Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a74d1caf authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'acpi-bus', 'acpi-sleep' and 'acpi-processor'

* acpi-bus:
  spi: acpi: Initialize modalias from of_compatible
  i2c: acpi: Initialize info.type from of_compatible
  ACPI / bus: Introduce acpi_of_modalias() equiv of of_modalias_node()

* acpi-sleep:
  ACPI: save NVS memory for Lenovo G50-45

* acpi-processor:
  x86/ACPI: keep x86_cpu_to_acpiid mapping valid on CPU hotplug
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -887,7 +887,8 @@ static int _acpi_map_lsapic(acpi_handle handle, int physid, int *pcpu)
}

/* wrapper to silence section mismatch warning */
int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
int __ref acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
		       int *pcpu)
{
	return _acpi_map_lsapic(handle, physid, pcpu);
}
+3 −2
Original line number Diff line number Diff line
@@ -723,11 +723,12 @@ int acpi_map_cpu2node(acpi_handle handle, int cpu, int physid)
	return 0;
}

int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, int *pcpu)
int acpi_map_cpu(acpi_handle handle, phys_cpuid_t physid, u32 acpi_id,
		 int *pcpu)
{
	int cpu;

	cpu = acpi_register_lapic(physid, U32_MAX, ACPI_MADT_ENABLED);
	cpu = acpi_register_lapic(physid, acpi_id, ACPI_MADT_ENABLED);
	if (cpu < 0) {
		pr_info(PREFIX "Unable to map lapic to logical cpu number\n");
		return cpu;
+2 −2
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ static int acpi_processor_errata(void)

#ifdef CONFIG_ACPI_HOTPLUG_CPU
int __weak acpi_map_cpu(acpi_handle handle,
		phys_cpuid_t physid, int *pcpu)
		phys_cpuid_t physid, u32 acpi_id, int *pcpu)
{
	return -ENODEV;
}
@@ -203,7 +203,7 @@ static int acpi_processor_hotadd_init(struct acpi_processor *pr)
	cpu_maps_update_begin();
	cpu_hotplug_begin();

	ret = acpi_map_cpu(pr->handle, pr->phys_id, &pr->id);
	ret = acpi_map_cpu(pr->handle, pr->phys_id, pr->acpi_id, &pr->id);
	if (ret)
		goto out;

+42 −0
Original line number Diff line number Diff line
@@ -677,6 +677,48 @@ static bool acpi_of_match_device(struct acpi_device *adev,
	return false;
}

static bool acpi_of_modalias(struct acpi_device *adev,
			     char *modalias, size_t len)
{
	const union acpi_object *of_compatible;
	const union acpi_object *obj;
	const char *str, *chr;

	of_compatible = adev->data.of_compatible;
	if (!of_compatible)
		return false;

	if (of_compatible->type == ACPI_TYPE_PACKAGE)
		obj = of_compatible->package.elements;
	else /* Must be ACPI_TYPE_STRING. */
		obj = of_compatible;

	str = obj->string.pointer;
	chr = strchr(str, ',');
	strlcpy(modalias, chr ? chr + 1 : str, len);

	return true;
}

/**
 * acpi_set_modalias - Set modalias using "compatible" property or supplied ID
 * @adev:	ACPI device object to match
 * @default_id:	ID string to use as default if no compatible string found
 * @modalias:   Pointer to buffer that modalias value will be copied into
 * @len:	Length of modalias buffer
 *
 * This is a counterpart of of_modalias_node() for struct acpi_device objects.
 * If there is a compatible string for @adev, it will be copied to @modalias
 * with the vendor prefix stripped; otherwise, @default_id will be used.
 */
void acpi_set_modalias(struct acpi_device *adev, const char *default_id,
		       char *modalias, size_t len)
{
	if (!acpi_of_modalias(adev, modalias, len))
		strlcpy(modalias, default_id, len);
}
EXPORT_SYMBOL_GPL(acpi_set_modalias);

static bool __acpi_match_device_cls(const struct acpi_device_id *id,
				    struct acpi_hardware_id *hwid)
{
+19 −0
Original line number Diff line number Diff line
@@ -130,6 +130,12 @@ void __init acpi_nvs_nosave_s3(void)
	nvs_nosave_s3 = true;
}

static int __init init_nvs_save_s3(const struct dmi_system_id *d)
{
	nvs_nosave_s3 = false;
	return 0;
}

/*
 * ACPI 1.0 wants us to execute _PTS before suspending devices, so we allow the
 * user to request that behavior by using the 'acpi_old_suspend_ordering'
@@ -324,6 +330,19 @@ static struct dmi_system_id acpisleep_dmi_table[] __initdata = {
		DMI_MATCH(DMI_PRODUCT_NAME, "K54HR"),
		},
	},
	/*
	 * https://bugzilla.kernel.org/show_bug.cgi?id=189431
	 * Lenovo G50-45 is a platform later than 2012, but needs nvs memory
	 * saving during S3.
	 */
	{
	.callback = init_nvs_save_s3,
	.ident = "Lenovo G50-45",
	.matches = {
		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
		DMI_MATCH(DMI_PRODUCT_NAME, "80E3"),
		},
	},
	{},
};

Loading