ACPI / LPSS: Only call pwm_add_table() for Bay Trail PWM if PMIC HRV is 2
PATCH 1/1 ACPI / LPSS: Only call pwm_add_table() for Bay Trail PWM if PMIC HRV is 2
The Point of View mobii wintab p800w Bay Trail tablet comes with a Crystal Cove PMIC, yet uses the LPSS PWM for backlight control, rather then the Crystal Cove's PWM, so we need to call pwm_add_table() to add a pwm_backlight mapping for the LPSS pwm despite there being an INT33FD ACPI device present.
On all Bay Trail devices the _HRV object of the INT33FD ACPI device will normally return 2, to indicate the Bay Trail variant of the CRC PMIC is present, except on this tablet where _HRV is 0xffff. I guess this is a hack to make the windows Crystal Cove PWM driver not bind.
Out of the 44 DSTDs with an INT33FD device in there which I have (from different model devices) only the pov mobii wintab p800w uses 0xffff for the HRV.
The byt_pwm_setup code calls acpi_dev_present to check for the presence of a INT33FD ACPI device which indicates that a CRC PMIC is present and if the INT33FD ACPI device is present then byt_pwm_setup will not add a pwm_backlight mapping for the LPSS pwm, so that the CRC PWM will get used instead.
acpi_dev_present has a hrv parameter, this commit make us pass 2 instead of -1, so that things still match on normal tablets, but on this special case with its _HRV of 0xffff, the check will now fail so that the pwm_backlight mapping for the LPSS pwm gets added fixing backlight brightness control on this device.
--- drivers/acpi/acpi_lpss.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/acpi/acpi_lpss.c +5 -1
@@ -69,6 +69,10 @@ ACPI_MODULE_NAME("acpi_lpss");#define LPSS_SAVE_CTX BIT(4)#define LPSS_NO_D3_DELAY BIT(5) +/* Crystal Cove PMIC shares same ACPI ID between different platforms */ +#define BYT_CRC_HRV 2 +#define CHT_CRC_HRV 3 +struct lpss_private_data ;struct lpss_device_desc {
@@ -162,7 +166,7 @@ static void byt_pwm_setup(struct lpss_private_data *pdata)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 ,BYT_CRC_HRV ))pwm_add_table (byt_pwm_lookup,ARRAY_SIZE (byt_pwm_lookup)); }
Signature · 1 line
2.17.0
Quoted 27 lines · Hans de Goede
The Point of View mobii wintab p800w Bay Trail tablet comes with a Crystal
Cove PMIC, yet uses the LPSS PWM for backlight control, rather then the
Crystal Cove's PWM, so we need to callpwm_add_table()to add apwm_backlightmapping for the LPSS pwm despite there being an INT33FD ACPI device present.On all Bay Trail devices the
_HRVobject of the INT33FD ACPI device will normally return 2, to indicate the Bay Trail variant of the CRC PMIC is present, except on this tablet where_HRVis0xffff. I guess this
is a hack to make the windows Crystal Cove PWM driver not bind.Out of the 44 DSTDs with an INT33FD device in there which I have (from different model devices) only the pov mobii wintab p800w uses
0xfffffor
the HRV.The
byt_pwm_setupcode callsacpi_dev_presentto check for the presence
of a INT33FD ACPI device which indicates that a CRC PMIC is present and
if the INT33FD ACPI device is present thenbyt_pwm_setupwill not add apwm_backlightmapping for the LPSS pwm, so that the CRC PWM will get used instead.
Quoted 8 lines
acpi_dev_presenthas a hrv parameter, this commit make us pass 2 instead
of -1, so that things still match on normal tablets, but on this special
case with its_HRVof0xffff, the check will now fail so that thepwm_backlightmapping for the LPSS pwm gets added fixing backlight brightness control on this device.
Quoted 32 lines
Signed-off-by Hans de Goede <[email protected]>--- drivers/acpi/acpi_lpss.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/acpi/acpi_lpss.c +4
-0@@ -69,6 +69,10 @@ ACPI_MODULE_NAME("acpi_lpss");#define LPSS_SAVE_CTX BIT(4)#define LPSS_NO_D3_DELAY BIT(5) +/* Crystal Cove PMIC shares same ACPI ID between different platforms */ +#define BYT_CRC_HRV 2 +#define CHT_CRC_HRV 3 +struct lpss_private_data ;struct
lpss_device_desc{drivers/acpi/acpi_lpss.c +1
-1@@ -162,7 +166,7 @@ static void byt_pwm_setup(struct lpss_private_data *pdata)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 ,BYT_CRC_HRV ))pwm_add_table (byt_pwm_lookup,ARRAY_SIZE (byt_pwm_lookup));}
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Rafael J. Wysocki
AppliedQuoted 37 lines · CEST Andy Shevchenko
Quoted 27 lines · Hans de Goede
The Point of View mobii wintab p800w Bay Trail tablet comes with a Crystal
Cove PMIC, yet uses the LPSS PWM for backlight control, rather then the
Crystal Cove's PWM, so we need to callpwm_add_table()to add apwm_backlightmapping for the LPSS pwm despite there being an INT33FD ACPI device present.On all Bay Trail devices the
_HRVobject of the INT33FD ACPI device will normally return 2, to indicate the Bay Trail variant of the CRC PMIC is present, except on this tablet where_HRVis0xffff. I guess this
is a hack to make the windows Crystal Cove PWM driver not bind.Out of the 44 DSTDs with an INT33FD device in there which I have (from different model devices) only the pov mobii wintab p800w uses
0xfffffor
the HRV.The
byt_pwm_setupcode callsacpi_dev_presentto check for the presence
of a INT33FD ACPI device which indicates that a CRC PMIC is present and
if the INT33FD ACPI device is present thenbyt_pwm_setupwill not add apwm_backlightmapping for the LPSS pwm, so that the CRC PWM will get used instead.Quoted 8 lines
acpi_dev_presenthas a hrv parameter, this commit make us pass 2 instead
of -1, so that things still match on normal tablets, but on this special
case with its_HRVof0xffff, the check will now fail so that thepwm_backlightmapping for the LPSS pwm gets added fixing backlight brightness control on this device.
Quoted 1 line
Reviewed-by Andy Shevchenko <[email protected]>
Applied, thanks!