Skip to content

Commit

Permalink
Merge branches 'acpi-pm', 'acpi-processor', 'acpi-ec' and 'acpi-video'
Browse files Browse the repository at this point in the history
Make ACPI power management changes, ACPI processor driver updates, ACPI
EC driver quirk and ACPI backlight driver updates for 6.2-rc1:

 - Print full name paths of ACPI power resources objects during
   enumeration (Kane Chen).

 - Eliminate a compiler warning regarding a missing function prototype
   in the ACPI power management code (Sudeep Holla).

 - Fix and clean up the ACPI processor driver (Rafael Wysocki, Li Zhong,
   Colin Ian King, Sudeep Holla).

 - Add quirk for the HP Pavilion Gaming 15-cx0041ur to the ACPI EC
   driver (Mia Kanashi).

 - Add some mew ACPI backlight handling quirks and update some existing
   ones (Hans de Goede).

 - Make the ACPI backlight driver prefer the native backlight control
   over vendor backlight control when possible (Hans de Goede).

* acpi-pm:
  ACPI: PM: Silence missing prototype warning
  ACPI: PM: Print full name path while adding power resource

* acpi-processor:
  ACPI: processor: perflib: Adjust acpi_processor_notify_smm() return value
  ACPI: processor: perflib: Rearrange acpi_processor_notify_smm()
  ACPI: processor: perflib: Rearrange unregistration routine
  ACPI: processor: perflib: Drop redundant parentheses
  ACPI: processor: perflib: Adjust white space
  ACPI: processor: idle: Drop unnecessary statements and parens
  ACPI: processor: Silence missing prototype warnings
  ACPI: processor_idle: Silence missing prototype warnings
  ACPI: processor: throttling: remove variable count
  ACPI: processor: idle: Check acpi_fetch_acpi_dev() return value

* acpi-ec:
  ACPI: EC: Add quirk for the HP Pavilion Gaming 15-cx0041ur

* acpi-video:
  ACPI: video: Prefer native over vendor
  ACPI: video: Simplify __acpi_video_get_backlight_type()
  ACPI: video: Add force_native quirk for Sony Vaio VPCY11S1E
  ACPI: video: Add force_vendor quirk for Sony Vaio PCG-FRV35
  ACPI: video: Change Sony Vaio VPCEH3U1E quirk to force_native
  ACPI: video: Change GIGABYTE GB-BXBT-2807 quirk to force_none
  ACPI: video: Add a few bugtracker links to DMI quirks
  • Loading branch information
Rafael J. Wysocki committed Dec 12, 2022
5 parents 45494d7 + d96d30d + f1a70ba + b423f24 + fb1836c commit 6f15818
Show file tree
Hide file tree
Showing 8 changed files with 136 additions and 111 deletions.
10 changes: 10 additions & 0 deletions drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1874,6 +1874,16 @@ static const struct dmi_system_id ec_dmi_table[] __initconst = {
DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Gaming Laptop 15-cx0xxx"),
},
},
{
/*
* HP Pavilion Gaming Laptop 15-cx0041ur
*/
.callback = ec_honor_dsdt_gpe,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "HP"),
DMI_MATCH(DMI_PRODUCT_NAME, "HP 15-cx0041ur"),
},
},
{
/*
* Samsung hardware
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/power.c
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
if (acpi_power_get_state(resource, &state_dummy))
__acpi_power_on(resource);

pr_info("%s [%s]\n", acpi_device_name(device), acpi_device_bid(device));
acpi_handle_info(handle, "New power resource\n");

result = acpi_tie_acpi_dev(device);
if (result)
Expand Down
9 changes: 5 additions & 4 deletions drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
* the erratum), but this is known to disrupt certain ISA
* devices thus we take the conservative approach.
*/
else if (errata.piix4.fdma) {
if (errata.piix4.fdma) {
acpi_handle_debug(pr->handle,
"C3 not supported on PIIX4 with Type-F DMA\n");
return;
Expand Down Expand Up @@ -384,8 +384,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
* handle BM_RLD is to set it and leave it set.
*/
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, 1);

return;
}

static int acpi_cst_latency_cmp(const void *a, const void *b)
Expand Down Expand Up @@ -459,7 +457,7 @@ static int acpi_processor_power_verify(struct acpi_processor *pr)

lapic_timer_propagate_broadcast(pr);

return (working);
return working;
}

static int acpi_processor_get_cstate_info(struct acpi_processor *pr)
Expand Down Expand Up @@ -1134,6 +1132,9 @@ static int acpi_processor_get_lpi_info(struct acpi_processor *pr)
status = acpi_get_parent(handle, &pr_ahandle);
while (ACPI_SUCCESS(status)) {
d = acpi_fetch_acpi_dev(pr_ahandle);
if (!d)
break;

handle = pr_ahandle;

if (strcmp(acpi_device_hid(d), ACPI_PROCESSOR_CONTAINER_HID))
Expand Down
100 changes: 45 additions & 55 deletions drivers/acpi/processor_perflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ int acpi_processor_get_bios_limit(int cpu, unsigned int *limit)
pr = per_cpu(processors, cpu);
if (!pr || !pr->performance || !pr->performance->state_count)
return -ENODEV;

*limit = pr->performance->states[pr->performance_platform_limit].
core_frequency * 1000;
return 0;
Expand Down Expand Up @@ -201,8 +202,7 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)
}

pct = (union acpi_object *)buffer.pointer;
if (!pct || (pct->type != ACPI_TYPE_PACKAGE)
|| (pct->package.count != 2)) {
if (!pct || pct->type != ACPI_TYPE_PACKAGE || pct->package.count != 2) {
pr_err("Invalid _PCT data\n");
result = -EFAULT;
goto end;
Expand All @@ -214,9 +214,8 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)

obj = pct->package.elements[0];

if ((obj.type != ACPI_TYPE_BUFFER)
|| (obj.buffer.length < sizeof(struct acpi_pct_register))
|| (obj.buffer.pointer == NULL)) {
if (!obj.buffer.pointer || obj.type != ACPI_TYPE_BUFFER ||
obj.buffer.length < sizeof(struct acpi_pct_register)) {
pr_err("Invalid _PCT data (control_register)\n");
result = -EFAULT;
goto end;
Expand All @@ -230,9 +229,8 @@ static int acpi_processor_get_performance_control(struct acpi_processor *pr)

obj = pct->package.elements[1];

if ((obj.type != ACPI_TYPE_BUFFER)
|| (obj.buffer.length < sizeof(struct acpi_pct_register))
|| (obj.buffer.pointer == NULL)) {
if (!obj.buffer.pointer || obj.type != ACPI_TYPE_BUFFER ||
obj.buffer.length < sizeof(struct acpi_pct_register)) {
pr_err("Invalid _PCT data (status_register)\n");
result = -EFAULT;
goto end;
Expand Down Expand Up @@ -260,8 +258,8 @@ static void amd_fixup_frequency(struct acpi_processor_px *px, int i)
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
return;

if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10)
|| boot_cpu_data.x86 == 0x11) {
if ((boot_cpu_data.x86 == 0x10 && boot_cpu_data.x86_model < 10) ||
boot_cpu_data.x86 == 0x11) {
rdmsr(MSR_AMD_PSTATE_DEF_BASE + index, lo, hi);
/*
* MSR C001_0064+:
Expand Down Expand Up @@ -300,7 +298,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
}

pss = buffer.pointer;
if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) {
if (!pss || pss->type != ACPI_TYPE_PACKAGE) {
pr_err("Invalid _PSS data\n");
result = -EFAULT;
goto end;
Expand Down Expand Up @@ -353,8 +351,7 @@ static int acpi_processor_get_performance_states(struct acpi_processor *pr)
* Check that ACPI's u64 MHz will be valid as u32 KHz in cpufreq
*/
if (!px->core_frequency ||
((u32)(px->core_frequency * 1000) !=
(px->core_frequency * 1000))) {
(u32)(px->core_frequency * 1000) != px->core_frequency * 1000) {
pr_err(FW_BUG
"Invalid BIOS _PSS frequency found for processor %d: 0x%llx MHz\n",
pr->id, px->core_frequency);
Expand Down Expand Up @@ -456,50 +453,49 @@ int acpi_processor_pstate_control(void)
int acpi_processor_notify_smm(struct module *calling_module)
{
static int is_done;
int result;
int result = 0;

if (!acpi_processor_cpufreq_init)
return -EBUSY;

if (!try_module_get(calling_module))
return -EINVAL;

/* is_done is set to negative if an error occurred,
* and to postitive if _no_ error occurred, but SMM
* was already notified. This avoids double notification
* which might lead to unexpected results...
/*
* is_done is set to negative if an error occurs and to 1 if no error
* occurrs, but SMM has been notified already. This avoids repeated
* notification which might lead to unexpected results.
*/
if (is_done > 0) {
module_put(calling_module);
return 0;
} else if (is_done < 0) {
module_put(calling_module);
return is_done;
}
if (is_done != 0) {
if (is_done < 0)
result = is_done;

is_done = -EIO;
goto out_put;
}

result = acpi_processor_pstate_control();
if (!result) {
pr_debug("No SMI port or pstate_control\n");
module_put(calling_module);
return 0;
}
if (result < 0) {
module_put(calling_module);
return result;
if (result <= 0) {
if (result) {
is_done = result;
} else {
pr_debug("No SMI port or pstate_control\n");
is_done = 1;
}
goto out_put;
}

/* Success. If there's no _PPC, we need to fear nothing, so
* we can allow the cpufreq driver to be rmmod'ed. */
is_done = 1;
/*
* Success. If there _PPC, unloading the cpufreq driver would be risky,
* so disallow it in that case.
*/
if (acpi_processor_ppc_in_use)
return 0;

if (!acpi_processor_ppc_in_use)
module_put(calling_module);

return 0;
out_put:
module_put(calling_module);
return result;
}

EXPORT_SYMBOL(acpi_processor_notify_smm);

int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
Expand All @@ -517,7 +513,7 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
}

psd = buffer.pointer;
if (!psd || (psd->type != ACPI_TYPE_PACKAGE)) {
if (!psd || psd->type != ACPI_TYPE_PACKAGE) {
pr_err("Invalid _PSD data\n");
result = -EFAULT;
goto end;
Expand All @@ -532,8 +528,7 @@ int acpi_processor_get_psd(acpi_handle handle, struct acpi_psd_package *pdomain)
state.length = sizeof(struct acpi_psd_package);
state.pointer = pdomain;

status = acpi_extract_package(&(psd->package.elements[0]),
&format, &state);
status = acpi_extract_package(&(psd->package.elements[0]), &format, &state);
if (ACPI_FAILURE(status)) {
pr_err("Invalid _PSD data\n");
result = -EFAULT;
Expand Down Expand Up @@ -716,9 +711,8 @@ int acpi_processor_preregister_performance(
}
EXPORT_SYMBOL(acpi_processor_preregister_performance);

int
acpi_processor_register_performance(struct acpi_processor_performance
*performance, unsigned int cpu)
int acpi_processor_register_performance(struct acpi_processor_performance
*performance, unsigned int cpu)
{
struct acpi_processor *pr;

Expand Down Expand Up @@ -751,7 +745,6 @@ acpi_processor_register_performance(struct acpi_processor_performance
mutex_unlock(&performance_mutex);
return 0;
}

EXPORT_SYMBOL(acpi_processor_register_performance);

void acpi_processor_unregister_performance(unsigned int cpu)
Expand All @@ -761,18 +754,15 @@ void acpi_processor_unregister_performance(unsigned int cpu)
mutex_lock(&performance_mutex);

pr = per_cpu(processors, cpu);
if (!pr) {
mutex_unlock(&performance_mutex);
return;
}
if (!pr)
goto unlock;

if (pr->performance)
kfree(pr->performance->states);

pr->performance = NULL;

unlock:
mutex_unlock(&performance_mutex);

return;
}

EXPORT_SYMBOL(acpi_processor_unregister_performance);
4 changes: 1 addition & 3 deletions drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ static int __acpi_processor_set_throttling(struct acpi_processor *pr,

static int acpi_processor_update_tsd_coord(void)
{
int count, count_target;
int count_target;
int retval = 0;
unsigned int i, j;
cpumask_var_t covered_cpus;
Expand Down Expand Up @@ -107,7 +107,6 @@ static int acpi_processor_update_tsd_coord(void)

/* Validate the Domain info */
count_target = pdomain->num_processors;
count = 1;

for_each_possible_cpu(j) {
if (i == j)
Expand Down Expand Up @@ -140,7 +139,6 @@ static int acpi_processor_update_tsd_coord(void)

cpumask_set_cpu(j, covered_cpus);
cpumask_set_cpu(j, pthrottling->shared_cpu_map);
count++;
}
for_each_possible_cpu(j) {
if (i == j)
Expand Down
Loading

0 comments on commit 6f15818

Please sign in to comment.