Skip to contentSkip to conversation

ACPI: LPSS: Add pwm_lookup_table entry for second PWM on CHT/BSW devices

PATCH Superseded Hans de Goede 3 participants 4 messages May 9, 2023 ACPI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: LPSS: Add pwm_lookup_table entry for second PWM on CHT/BSW devices

BSW PWM2 is used for backlight control for fixed (etched into the glass) touch controls on some models.

Add an entry for the second PWM controller to bsw_pwm_lookup, so that drivers can use pwm_get() to get a referene to it.

These touch-controls have specialized drivers which bind to different devices on different models, so the consumer-device-name in the lookup table entry is set to NULL, so that only con-id matching is used.

The con-id is set to "pwm_soc_lpss_2" which describes the PWM controller rather then the usual approach of describing its function. The specialized (model specific) drivers which need access to the PWM controller know they need the "pwm_soc_lpss_2" con-id.

Cc Uwe Kleine-König <[email protected]>
---
 drivers/acpi/acpi_lpss.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/acpi_lpss.c +9 -1
index 77186f084d3a..539e700de4d2 100644
@@ -201,11 +201,19 @@ static void byt_i2c_setup(struct lpss_private_data *pdata)
 	writel(0, pdata->mmio_base + LPSS_I2C_ENABLE);
 }
 
-/* BSW PWM used for backlight control by the i915 driver */
+/*
+ * BSW PWM1 is used for backlight control by the i915 driver
+ * BSW PWM2 is used for backlight control for fixed (etched into the glass)
+ * touch controls on some models. These touch-controls have specialized
+ * drivers which know they need the "pwm_soc_lpss_2" con-id.
+ */
 static struct pwm_lookup bsw_pwm_lookup[] = {
 	PWM_LOOKUP_WITH_MODULE("80862288:00", 0, "0000:00:02.0",
 			       "pwm_soc_backlight", 0, PWM_POLARITY_NORMAL,
 			       "pwm-lpss-platform"),
+	PWM_LOOKUP_WITH_MODULE("80862289:00", 0, NULL,
+			       "pwm_soc_lpss_2", 0, PWM_POLARITY_NORMAL,
+			       "pwm-lpss-platform"),
 };
 
 static void bsw_pwm_setup(struct lpss_private_data *pdata)
Signature · 1 line
2.40.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Hans de Goede

BSW PWM2 is used for backlight control for fixed (etched into the glass) touch controls on some models.

Add an entry for the second PWM controller to bsw_pwm_lookup, so that drivers can use pwm_get() to get a referene to it.

reference

Quoted 6 lines

These touch-controls have specialized drivers which bind to different devices on different models, so the consumer-device-name in the lookup table entry is set to NULL, so that only con-id matching is used.

The con-id is set to "pwm_soc_lpss_2" which describes the PWM controller rather then the usual approach of describing its function.

than

Quoted 2 lines

The specialized (model specific) drivers which need access to the PWM controller know they need the "pwm_soc_lpss_2" con-id.

Quoted 34 lines
Cc Uwe Kleine-König <[email protected]>
---
 drivers/acpi/acpi_lpss.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/acpi/acpi_lpss.c +9 -2
index 77186f084d3a..539e700de4d2 100644
@@ -201,11 +201,19 @@ static void byt_i2c_setup(struct lpss_private_data *pdata)
        writel(0, pdata->mmio_base + LPSS_I2C_ENABLE);
 }
 
-/* BSW PWM used for backlight control by the i915 driver */
+/*
+ * BSW PWM1 is used for backlight control by the i915 driver
+ * BSW PWM2 is used for backlight control for fixed (etched into the glass)
+ * touch controls on some models. These touch-controls have specialized
+ * drivers which know they need the "pwm_soc_lpss_2" con-id.
+ */
 static struct pwm_lookup bsw_pwm_lookup[] = {
        PWM_LOOKUP_WITH_MODULE("80862288:00", 0, "0000:00:02.0",
                               "pwm_soc_backlight", 0, PWM_POLARITY_NORMAL,
                               "pwm-lpss-platform"),
+       PWM_LOOKUP_WITH_MODULE("80862289:00", 0, NULL,
+                              "pwm_soc_lpss_2", 0, PWM_POLARITY_NORMAL,
+                              "pwm-lpss-platform"),
 };
 
 static void bsw_pwm_setup(struct lpss_private_data *pdata)
--

2.40.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
Acked-by on v1 1/1
#2 lore raw
In reply to Hans de Goede
Quoted 10 lines · Hans de Goede

BSW PWM2 is used for backlight control for fixed (etched into the glass) touch controls on some models.

Add an entry for the second PWM controller to bsw_pwm_lookup, so that drivers can use pwm_get() to get a referene to it.

These touch-controls have specialized drivers which bind to different devices on different models, so the consumer-device-name in the lookup table entry is set to NULL, so that only con-id matching is used.

Quoted 7 lines

The con-id is set to "pwm_soc_lpss_2" which describes the PWM controller rather then the usual approach of describing its function. The specialized (model specific) drivers which need access to the PWM controller know they need the "pwm_soc_lpss_2" con-id.

Cc Uwe Kleine-König <[email protected]>

I don't understand the conditional before the call to pwm_add_table, but I guess that's ok.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |
#3 lore raw
Quoted 17 lines · Uwe Kleine-König
Quoted 15 lines · Hans de Goede

BSW PWM2 is used for backlight control for fixed (etched into the glass) touch controls on some models.

Add an entry for the second PWM controller to bsw_pwm_lookup, so that drivers can use pwm_get() to get a referene to it.

These touch-controls have specialized drivers which bind to different devices on different models, so the consumer-device-name in the lookup table entry is set to NULL, so that only con-id matching is used.

The con-id is set to "pwm_soc_lpss_2" which describes the PWM controller rather then the usual approach of describing its function. The specialized (model specific) drivers which need access to the PWM controller know they need the "pwm_soc_lpss_2" con-id.

Quoted 5 lines
Quoted 2 lines
Cc Uwe Kleine-König <[email protected]>

I don't understand the conditional before the call to pwm_add_table, but I guess that's ok.

There is a comment.
The _UID can be different for the _HID (so on some devices we have the same _HID, but different _UIDs, i.e. '80862288 / 1', '80862288 / n'), this is to prevent duplication for those, on the other hand the devices where there are two different IDs, i.e. '80862288 / 1', '80862289 / n', we expect to have the second one only when the first one is present. At the same time we have no callback for the second one at all. I.o.w. for the '80862289' we add the table when '80862288 / 1' is enumerated.

Signature · 2 lines
With Best Regards,
Andy Shevchenko