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

Commit dd242a08 authored by Hans de Goede's avatar Hans de Goede Committed by Rafael J. Wysocki
Browse files

ACPI / LPSS: Only call pwm_add_table() for the first PWM controller

At least on the UP board SBC both PWMs are enabled leading to us
trying to add the same pwm_lookup twice, which leads to the following:

[    0.902224] list_add double add: new=ffffffffb8efd400,
               prev=ffffffffb8efd400, next=ffffffffb8eeede0.
[    0.912466] ------------[ cut here ]------------
[    0.917624] kernel BUG at lib/list_debug.c:31!
[    0.922588] invalid opcode: 0000 [#1] SMP
...
[    1.027450] Call Trace:
[    1.030185]  pwm_add_table+0x4c/0x90
[    1.034181]  bsw_pwm_setup+0x1a/0x20
[    1.038175]  acpi_lpss_create_device+0xfe/0x420
...

This commit fixes this by only calling pwm_add_table() for the first
PWM controller (which is the one used for the backlight).

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1458599


Fixes: bf7696a1 (acpi: lpss: call pwm_add_table() for BSW...)
Fixes: 04434ab5 (ACPI / LPSS: Call pwm_add_table() for Bay Trail...)
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Acked-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: 4.11+ <stable@vger.kernel.org> # 4.11+
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 6f7da290
Loading
Loading
Loading
Loading
+14 −0
Original line number Original line Diff line number Diff line
@@ -85,6 +85,7 @@ static const struct lpss_device_desc lpss_dma_desc = {
};
};


struct lpss_private_data {
struct lpss_private_data {
	struct acpi_device *adev;
	void __iomem *mmio_base;
	void __iomem *mmio_base;
	resource_size_t mmio_size;
	resource_size_t mmio_size;
	unsigned int fixed_clk_rate;
	unsigned int fixed_clk_rate;
@@ -155,6 +156,12 @@ static struct pwm_lookup byt_pwm_lookup[] = {


static void byt_pwm_setup(struct lpss_private_data *pdata)
static void byt_pwm_setup(struct lpss_private_data *pdata)
{
{
	struct acpi_device *adev = pdata->adev;

	/* Only call pwm_add_table for the first PWM controller */
	if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
		return;

	if (!acpi_dev_present("INT33FD", NULL, -1))
	if (!acpi_dev_present("INT33FD", NULL, -1))
		pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
		pwm_add_table(byt_pwm_lookup, ARRAY_SIZE(byt_pwm_lookup));
}
}
@@ -180,6 +187,12 @@ static struct pwm_lookup bsw_pwm_lookup[] = {


static void bsw_pwm_setup(struct lpss_private_data *pdata)
static void bsw_pwm_setup(struct lpss_private_data *pdata)
{
{
	struct acpi_device *adev = pdata->adev;

	/* Only call pwm_add_table for the first PWM controller */
	if (!adev->pnp.unique_id || strcmp(adev->pnp.unique_id, "1"))
		return;

	pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
	pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
}
}


@@ -456,6 +469,7 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
		goto err_out;
		goto err_out;
	}
	}


	pdata->adev = adev;
	pdata->dev_desc = dev_desc;
	pdata->dev_desc = dev_desc;


	if (dev_desc->setup)
	if (dev_desc->setup)