All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] acpi: lpss: call pwm_add_table() for bsw pwm device
@ 2017-01-19 17:53 Hans de Goede
  2017-01-20  6:48 ` Thierry Reding
  0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2017-01-19 17:53 UTC (permalink / raw)
  To: Rafael J . Wysocki, Len Brown
  Cc: linux-acpi, Thierry Reding, linux-pwm, Hans de Goede

On x86 we do not have devicetree to link the pwm controller and
the display controller together. So someone needs to call
pwm_add_table() to create the link, so that the i915 driver's
pwm_get(dev, "pwm_backlight") call returns the lpss' pwm0.

The pwm subsystem does not want to have pwm_add_table() calls
directly in pwm drivers (this leads to probe ordering issues),
so lets do it here since the acpi-lpss code is always builtin.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/acpi_lpss.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 8ea836c..1b4bcf6 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -20,6 +20,7 @@
 #include <linux/platform_data/clk-lpss.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
+#include <linux/pwm.h>
 #include <linux/delay.h>
 
 #include "internal.h"
@@ -154,6 +155,17 @@ 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 */
+static struct pwm_lookup bsw_pwm_lookup[] = {
+	PWM_LOOKUP("80862288:00", 0, "0000:00:02.0", "pwm_backlight", 0,
+		   PWM_POLARITY_NORMAL),
+};
+
+static void bsw_pwm_setup(struct lpss_private_data *pdata)
+{
+	pwm_add_table(bsw_pwm_lookup, ARRAY_SIZE(bsw_pwm_lookup));
+}
+
 static const struct lpss_device_desc lpt_dev_desc = {
 	.flags = LPSS_CLK | LPSS_CLK_GATE | LPSS_CLK_DIVIDER | LPSS_LTR,
 	.prv_offset = 0x800,
@@ -191,6 +203,7 @@ static const struct lpss_device_desc byt_pwm_dev_desc = {
 
 static const struct lpss_device_desc bsw_pwm_dev_desc = {
 	.flags = LPSS_SAVE_CTX | LPSS_NO_D3_DELAY,
+	.setup = bsw_pwm_setup,
 };
 
 static const struct lpss_device_desc byt_uart_dev_desc = {
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] acpi: lpss: call pwm_add_table() for bsw pwm device
  2017-01-19 17:53 [PATCH] acpi: lpss: call pwm_add_table() for bsw pwm device Hans de Goede
@ 2017-01-20  6:48 ` Thierry Reding
  0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2017-01-20  6:48 UTC (permalink / raw)
  To: Hans de Goede; +Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-pwm

[-- Attachment #1: Type: text/plain, Size: 700 bytes --]

On Thu, Jan 19, 2017 at 06:53:38PM +0100, Hans de Goede wrote:
> On x86 we do not have devicetree to link the pwm controller and
> the display controller together. So someone needs to call
> pwm_add_table() to create the link, so that the i915 driver's
> pwm_get(dev, "pwm_backlight") call returns the lpss' pwm0.
> 
> The pwm subsystem does not want to have pwm_add_table() calls
> directly in pwm drivers (this leads to probe ordering issues),
> so lets do it here since the acpi-lpss code is always builtin.

Nit: "pwm" -> "PWM" in the above. Other than that this looks like a much
more suitable location for pwm_add_table(), so:

Acked-by: Thierry Reding <thierry.reding@gmail.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-20  6:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-19 17:53 [PATCH] acpi: lpss: call pwm_add_table() for bsw pwm device Hans de Goede
2017-01-20  6:48 ` Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.