All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
@ 2015-10-05 12:47 ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski; +Cc: linux-arm-kernel, linux-samsung-soc

Back when the PWM framework was introduced the concept of PWM lookup
tables was added to allow board code to register a table of PWM devices
and their association with consumers. The goal is to allow drivers to
use a unified method to request PWM devices. At the same time, since no
boards were exposing these tables, fallback code was kept in drivers to
allow old code to remain functional. In order to get rid of the legacy
fallback code, legacy users need to be updated to register PWM lookup
tables.

This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
backlight device to use the new PWM lookup tables. All patches have been
compile-tested, but I don't have access to any of these boards, so I
couldn't verify that they really work.

Thierry

Thierry Reding (6):
  ARM: s3c24xx: h1940: Use PWM lookup table
  ARM: s3c24xx: rx1950: Use PWM lookup table
  ARM: s3c64xx: smdk6410: Use PWM lookup table
  ARM: s3c64xx: crag6410: Use PWM lookup table
  ARM: s3c64xx: hmt: Use PWM lookup table
  ARM: s3c64xx: smartq: Use PWM lookup table

 arch/arm/mach-s3c24xx/mach-h1940.c    | 10 +++++++---
 arch/arm/mach-s3c24xx/mach-rx1950.c   |  8 ++++++--
 arch/arm/mach-s3c64xx/dev-backlight.c |  4 ----
 arch/arm/mach-s3c64xx/mach-crag6410.c |  9 +++++++--
 arch/arm/mach-s3c64xx/mach-hmt.c      |  9 +++++++--
 arch/arm/mach-s3c64xx/mach-smartq.c   |  9 +++++++--
 arch/arm/mach-s3c64xx/mach-smdk6410.c |  8 +++++++-
 7 files changed, 41 insertions(+), 16 deletions(-)

-- 
2.5.0

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

* [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
@ 2015-10-05 12:47 ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Back when the PWM framework was introduced the concept of PWM lookup
tables was added to allow board code to register a table of PWM devices
and their association with consumers. The goal is to allow drivers to
use a unified method to request PWM devices. At the same time, since no
boards were exposing these tables, fallback code was kept in drivers to
allow old code to remain functional. In order to get rid of the legacy
fallback code, legacy users need to be updated to register PWM lookup
tables.

This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
backlight device to use the new PWM lookup tables. All patches have been
compile-tested, but I don't have access to any of these boards, so I
couldn't verify that they really work.

Thierry

Thierry Reding (6):
  ARM: s3c24xx: h1940: Use PWM lookup table
  ARM: s3c24xx: rx1950: Use PWM lookup table
  ARM: s3c64xx: smdk6410: Use PWM lookup table
  ARM: s3c64xx: crag6410: Use PWM lookup table
  ARM: s3c64xx: hmt: Use PWM lookup table
  ARM: s3c64xx: smartq: Use PWM lookup table

 arch/arm/mach-s3c24xx/mach-h1940.c    | 10 +++++++---
 arch/arm/mach-s3c24xx/mach-rx1950.c   |  8 ++++++--
 arch/arm/mach-s3c64xx/dev-backlight.c |  4 ----
 arch/arm/mach-s3c64xx/mach-crag6410.c |  9 +++++++--
 arch/arm/mach-s3c64xx/mach-hmt.c      |  9 +++++++--
 arch/arm/mach-s3c64xx/mach-smartq.c   |  9 +++++++--
 arch/arm/mach-s3c64xx/mach-smdk6410.c |  8 +++++++-
 7 files changed, 41 insertions(+), 16 deletions(-)

-- 
2.5.0

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

* [PATCH 1/6] ARM: s3c24xx: h1940: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-05 12:47   ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Thierry Reding

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c24xx/mach-h1940.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index d40d4f5244c6..9f54300df4b3 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -25,6 +25,7 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/i2c.h>
 #include <linux/leds.h>
@@ -469,6 +470,11 @@ static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
 	.ocr_avail     = MMC_VDD_32_33,
 };
 
+static struct pwm_lookup h1940_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 36296,
+		   PWM_POLARITY_NORMAL),
+};
+
 static int h1940_backlight_init(struct device *dev)
 {
 	gpio_request(S3C2410_GPB(0), "Backlight");
@@ -503,11 +509,8 @@ static void h1940_backlight_exit(struct device *dev)
 
 
 static struct platform_pwm_backlight_data backlight_data = {
-	.pwm_id         = 0,
 	.max_brightness = 100,
 	.dft_brightness = 50,
-	/* tcnt = 0x31 */
-	.pwm_period_ns  = 36296,
 	.enable_gpio    = -1,
 	.init           = h1940_backlight_init,
 	.notify		= h1940_backlight_notify,
@@ -725,6 +728,7 @@ static void __init h1940_init(void)
 	gpio_request(H1940_LATCH_SD_POWER, "SD power");
 	gpio_direction_output(H1940_LATCH_SD_POWER, 0);
 
+	pwm_add_table(h1940_pwm_lookup, ARRAY_SIZE(h1940_pwm_lookup));
 	platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 
 	gpio_request(S3C2410_GPA(1), "Red LED blink");
-- 
2.5.0

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

* [PATCH 1/6] ARM: s3c24xx: h1940: Use PWM lookup table
@ 2015-10-05 12:47   ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c24xx/mach-h1940.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-h1940.c b/arch/arm/mach-s3c24xx/mach-h1940.c
index d40d4f5244c6..9f54300df4b3 100644
--- a/arch/arm/mach-s3c24xx/mach-h1940.c
+++ b/arch/arm/mach-s3c24xx/mach-h1940.c
@@ -25,6 +25,7 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/gpio_keys.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/i2c.h>
 #include <linux/leds.h>
@@ -469,6 +470,11 @@ static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
 	.ocr_avail     = MMC_VDD_32_33,
 };
 
+static struct pwm_lookup h1940_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 36296,
+		   PWM_POLARITY_NORMAL),
+};
+
 static int h1940_backlight_init(struct device *dev)
 {
 	gpio_request(S3C2410_GPB(0), "Backlight");
@@ -503,11 +509,8 @@ static void h1940_backlight_exit(struct device *dev)
 
 
 static struct platform_pwm_backlight_data backlight_data = {
-	.pwm_id         = 0,
 	.max_brightness = 100,
 	.dft_brightness = 50,
-	/* tcnt = 0x31 */
-	.pwm_period_ns  = 36296,
 	.enable_gpio    = -1,
 	.init           = h1940_backlight_init,
 	.notify		= h1940_backlight_notify,
@@ -725,6 +728,7 @@ static void __init h1940_init(void)
 	gpio_request(H1940_LATCH_SD_POWER, "SD power");
 	gpio_direction_output(H1940_LATCH_SD_POWER, 0);
 
+	pwm_add_table(h1940_pwm_lookup, ARRAY_SIZE(h1940_pwm_lookup));
 	platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
 
 	gpio_request(S3C2410_GPA(1), "Red LED blink");
-- 
2.5.0

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

* [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-05 12:47   ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Thierry Reding

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 1d35ff375a01..774c982a7b7e 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
 
 };
 
+static struct pwm_lookup rx1950_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct pwm_device *lcd_pwm;
 
 static void rx1950_lcd_power(int enable)
@@ -520,10 +525,8 @@ static int rx1950_backlight_notify(struct device *dev, int brightness)
 }
 
 static struct platform_pwm_backlight_data rx1950_backlight_data = {
-	.pwm_id = 0,
 	.max_brightness = 24,
 	.dft_brightness = 4,
-	.pwm_period_ns = 48000,
 	.enable_gpio = -1,
 	.init = rx1950_backlight_init,
 	.notify = rx1950_backlight_notify,
@@ -792,6 +795,7 @@ static void __init rx1950_init_machine(void)
 	gpio_direction_output(S3C2410_GPA(4), 0);
 	gpio_direction_output(S3C2410_GPJ(6), 0);
 
+	pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
 	platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
 
 	i2c_register_board_info(0, rx1950_i2c_devices,
-- 
2.5.0

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

* [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
@ 2015-10-05 12:47   ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
index 1d35ff375a01..774c982a7b7e 100644
--- a/arch/arm/mach-s3c24xx/mach-rx1950.c
+++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
@@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
 
 };
 
+static struct pwm_lookup rx1950_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct pwm_device *lcd_pwm;
 
 static void rx1950_lcd_power(int enable)
@@ -520,10 +525,8 @@ static int rx1950_backlight_notify(struct device *dev, int brightness)
 }
 
 static struct platform_pwm_backlight_data rx1950_backlight_data = {
-	.pwm_id = 0,
 	.max_brightness = 24,
 	.dft_brightness = 4,
-	.pwm_period_ns = 48000,
 	.enable_gpio = -1,
 	.init = rx1950_backlight_init,
 	.notify = rx1950_backlight_notify,
@@ -792,6 +795,7 @@ static void __init rx1950_init_machine(void)
 	gpio_direction_output(S3C2410_GPA(4), 0);
 	gpio_direction_output(S3C2410_GPJ(6), 0);
 
+	pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
 	platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
 
 	i2c_register_board_info(0, rx1950_i2c_devices,
-- 
2.5.0

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

* [PATCH 3/6] ARM: s3c64xx: smdk6410: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-05 12:47   ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Thierry Reding

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/dev-backlight.c | 4 ----
 arch/arm/mach-s3c64xx/mach-smdk6410.c | 8 +++++++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/dev-backlight.c b/arch/arm/mach-s3c64xx/dev-backlight.c
index 38c323e68e3f..e62e789f9aee 100644
--- a/arch/arm/mach-s3c64xx/dev-backlight.c
+++ b/arch/arm/mach-s3c64xx/dev-backlight.c
@@ -69,7 +69,6 @@ static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
 	.plat_data = {
 		.max_brightness = 255,
 		.dft_brightness = 255,
-		.pwm_period_ns  = 78770,
 		.enable_gpio    = -1,
 		.init           = samsung_bl_init,
 		.exit           = samsung_bl_exit,
@@ -111,7 +110,6 @@ void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
 	samsung_bl_data = &samsung_bl_drvdata->plat_data;
 
 	/* Copy board specific data provided by user */
-	samsung_bl_data->pwm_id = bl_data->pwm_id;
 	samsung_bl_device->dev.parent = &samsung_device_pwm.dev;
 
 	if (bl_data->max_brightness)
@@ -120,8 +118,6 @@ void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
 		samsung_bl_data->dft_brightness = bl_data->dft_brightness;
 	if (bl_data->lth_brightness)
 		samsung_bl_data->lth_brightness = bl_data->lth_brightness;
-	if (bl_data->pwm_period_ns)
-		samsung_bl_data->pwm_period_ns = bl_data->pwm_period_ns;
 	if (bl_data->enable_gpio >= 0)
 		samsung_bl_data->enable_gpio = bl_data->enable_gpio;
 	if (bl_data->init)
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index d590b88bd8a8..2722800d5c11 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -30,6 +30,7 @@
 #include <linux/smsc911x.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/platform_data/s3c-hsotg.h>
 
@@ -623,8 +624,12 @@ static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
 	.func = S3C_GPIO_SFN(2),
 };
 
+static struct pwm_lookup smdk6410_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL, 78770,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct platform_pwm_backlight_data smdk6410_bl_data = {
-	.pwm_id = 1,
 	.enable_gpio = -1,
 };
 
@@ -695,6 +700,7 @@ static void __init smdk6410_machine_init(void)
 
 	platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
 
+	pwm_add_table(smdk6410_pwm_lookup, ARRAY_SIZE(smdk6410_pwm_lookup));
 	samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
 }
 
-- 
2.5.0

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

* [PATCH 3/6] ARM: s3c64xx: smdk6410: Use PWM lookup table
@ 2015-10-05 12:47   ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/dev-backlight.c | 4 ----
 arch/arm/mach-s3c64xx/mach-smdk6410.c | 8 +++++++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/dev-backlight.c b/arch/arm/mach-s3c64xx/dev-backlight.c
index 38c323e68e3f..e62e789f9aee 100644
--- a/arch/arm/mach-s3c64xx/dev-backlight.c
+++ b/arch/arm/mach-s3c64xx/dev-backlight.c
@@ -69,7 +69,6 @@ static struct samsung_bl_drvdata samsung_dfl_bl_data __initdata = {
 	.plat_data = {
 		.max_brightness = 255,
 		.dft_brightness = 255,
-		.pwm_period_ns  = 78770,
 		.enable_gpio    = -1,
 		.init           = samsung_bl_init,
 		.exit           = samsung_bl_exit,
@@ -111,7 +110,6 @@ void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
 	samsung_bl_data = &samsung_bl_drvdata->plat_data;
 
 	/* Copy board specific data provided by user */
-	samsung_bl_data->pwm_id = bl_data->pwm_id;
 	samsung_bl_device->dev.parent = &samsung_device_pwm.dev;
 
 	if (bl_data->max_brightness)
@@ -120,8 +118,6 @@ void __init samsung_bl_set(struct samsung_bl_gpio_info *gpio_info,
 		samsung_bl_data->dft_brightness = bl_data->dft_brightness;
 	if (bl_data->lth_brightness)
 		samsung_bl_data->lth_brightness = bl_data->lth_brightness;
-	if (bl_data->pwm_period_ns)
-		samsung_bl_data->pwm_period_ns = bl_data->pwm_period_ns;
 	if (bl_data->enable_gpio >= 0)
 		samsung_bl_data->enable_gpio = bl_data->enable_gpio;
 	if (bl_data->init)
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index d590b88bd8a8..2722800d5c11 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -30,6 +30,7 @@
 #include <linux/smsc911x.h>
 #include <linux/regulator/fixed.h>
 #include <linux/regulator/machine.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/platform_data/s3c-hsotg.h>
 
@@ -623,8 +624,12 @@ static struct samsung_bl_gpio_info smdk6410_bl_gpio_info = {
 	.func = S3C_GPIO_SFN(2),
 };
 
+static struct pwm_lookup smdk6410_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL, 78770,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct platform_pwm_backlight_data smdk6410_bl_data = {
-	.pwm_id = 1,
 	.enable_gpio = -1,
 };
 
@@ -695,6 +700,7 @@ static void __init smdk6410_machine_init(void)
 
 	platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
 
+	pwm_add_table(smdk6410_pwm_lookup, ARRAY_SIZE(smdk6410_pwm_lookup));
 	samsung_bl_set(&smdk6410_bl_gpio_info, &smdk6410_bl_data);
 }
 
-- 
2.5.0

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

* [PATCH 4/6] ARM: s3c64xx: crag6410: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-05 12:47   ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Thierry Reding

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 65c426bc45f7..d13aa3f9bac4 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -25,6 +25,7 @@
 #include <linux/mmc/host.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/dm9000.h>
 #include <linux/gpio_keys.h>
@@ -108,11 +109,14 @@ static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
 	},
 };
 
+static struct pwm_lookup crag6410_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 100000,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct platform_pwm_backlight_data crag6410_backlight_data = {
-	.pwm_id		= 0,
 	.max_brightness	= 1000,
 	.dft_brightness	= 600,
-	.pwm_period_ns	= 100000,	/* about 1kHz */
 	.enable_gpio	= -1,
 };
 
@@ -843,6 +847,7 @@ static void __init crag6410_machine_init(void)
 	samsung_keypad_set_platdata(&crag6410_keypad_data);
 	s3c64xx_spi0_set_platdata(NULL, 0, 2);
 
+	pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
 	platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
 
 	gpio_led_register_device(-1, &gpio_leds_pdata);
-- 
2.5.0

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

* [PATCH 4/6] ARM: s3c64xx: crag6410: Use PWM lookup table
@ 2015-10-05 12:47   ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c
index 65c426bc45f7..d13aa3f9bac4 100644
--- a/arch/arm/mach-s3c64xx/mach-crag6410.c
+++ b/arch/arm/mach-s3c64xx/mach-crag6410.c
@@ -25,6 +25,7 @@
 #include <linux/mmc/host.h>
 #include <linux/regulator/machine.h>
 #include <linux/regulator/fixed.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/dm9000.h>
 #include <linux/gpio_keys.h>
@@ -108,11 +109,14 @@ static struct s3c2410_uartcfg crag6410_uartcfgs[] __initdata = {
 	},
 };
 
+static struct pwm_lookup crag6410_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight", NULL, 100000,
+		   PWM_POLARITY_NORMAL),
+};
+
 static struct platform_pwm_backlight_data crag6410_backlight_data = {
-	.pwm_id		= 0,
 	.max_brightness	= 1000,
 	.dft_brightness	= 600,
-	.pwm_period_ns	= 100000,	/* about 1kHz */
 	.enable_gpio	= -1,
 };
 
@@ -843,6 +847,7 @@ static void __init crag6410_machine_init(void)
 	samsung_keypad_set_platdata(&crag6410_keypad_data);
 	s3c64xx_spi0_set_platdata(NULL, 0, 2);
 
+	pwm_add_table(crag6410_pwm_lookup, ARRAY_SIZE(crag6410_pwm_lookup));
 	platform_add_devices(crag6410_devices, ARRAY_SIZE(crag6410_devices));
 
 	gpio_led_register_device(-1, &gpio_leds_pdata);
-- 
2.5.0

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

* [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-05 12:47   ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Thierry Reding

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index e4b087c58ee6..816b39d1e6d1 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -19,6 +19,7 @@
 #include <linux/gpio.h>
 #include <linux/delay.h>
 #include <linux/leds.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
 	},
 };
 
+static struct pwm_lookup hmt_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
+		   1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
+};
+
 static int hmt_bl_init(struct device *dev)
 {
 	int ret;
@@ -110,10 +116,8 @@ static void hmt_bl_exit(struct device *dev)
 }
 
 static struct platform_pwm_backlight_data hmt_backlight_data = {
-	.pwm_id		= 1,
 	.max_brightness	= 100 * 256,
 	.dft_brightness	= 40 * 256,
-	.pwm_period_ns	= 1000000000 / (100 * 256 * 20),
 	.enable_gpio	= -1,
 	.init		= hmt_bl_init,
 	.notify		= hmt_bl_notify,
@@ -268,6 +272,7 @@ static void __init hmt_machine_init(void)
 	gpio_request(S3C64XX_GPF(13), "usb power");
 	gpio_direction_output(S3C64XX_GPF(13), 1);
 
+	pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
 	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
 }
 
-- 
2.5.0

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

* [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
@ 2015-10-05 12:47   ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
index e4b087c58ee6..816b39d1e6d1 100644
--- a/arch/arm/mach-s3c64xx/mach-hmt.c
+++ b/arch/arm/mach-s3c64xx/mach-hmt.c
@@ -19,6 +19,7 @@
 #include <linux/gpio.h>
 #include <linux/delay.h>
 #include <linux/leds.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/partitions.h>
@@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
 	},
 };
 
+static struct pwm_lookup hmt_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
+		   1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
+};
+
 static int hmt_bl_init(struct device *dev)
 {
 	int ret;
@@ -110,10 +116,8 @@ static void hmt_bl_exit(struct device *dev)
 }
 
 static struct platform_pwm_backlight_data hmt_backlight_data = {
-	.pwm_id		= 1,
 	.max_brightness	= 100 * 256,
 	.dft_brightness	= 40 * 256,
-	.pwm_period_ns	= 1000000000 / (100 * 256 * 20),
 	.enable_gpio	= -1,
 	.init		= hmt_bl_init,
 	.notify		= hmt_bl_notify,
@@ -268,6 +272,7 @@ static void __init hmt_machine_init(void)
 	gpio_request(S3C64XX_GPF(13), "usb power");
 	gpio_direction_output(S3C64XX_GPF(13), 1);
 
+	pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
 	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
 }
 
-- 
2.5.0

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

* [PATCH 6/6] ARM: s3c64xx: smartq: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-05 12:47   ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: Kukjin Kim, Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Thierry Reding

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/mach-smartq.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index b3d13537a7f0..7b8a3699795c 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -14,6 +14,7 @@
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/serial_core.h>
 #include <linux/serial_s3c.h>
@@ -139,6 +140,11 @@ static struct platform_device smartq_usb_otg_vbus_dev = {
 	.dev.platform_data	= &smartq_usb_otg_vbus_pdata,
 };
 
+static struct pwm_lookup smartq_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
+		   1000000000 / (1000 * 20), PWM_POLARITY_NORMAL),
+};
+
 static int smartq_bl_init(struct device *dev)
 {
     s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
@@ -147,10 +153,8 @@ static int smartq_bl_init(struct device *dev)
 }
 
 static struct platform_pwm_backlight_data smartq_backlight_data = {
-	.pwm_id		= 1,
 	.max_brightness	= 1000,
 	.dft_brightness	= 600,
-	.pwm_period_ns	= 1000000000 / (1000 * 20),
 	.enable_gpio	= -1,
 	.init		= smartq_bl_init,
 };
@@ -396,5 +400,6 @@ void __init smartq_machine_init(void)
 	WARN_ON(smartq_usb_host_init());
 	WARN_ON(smartq_wifi_init());
 
+	pwm_add_table(smartq_pwm_lookup, ARRAY_SIZE(smartq_pwm_lookup));
 	platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
 }
-- 
2.5.0

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

* [PATCH 6/6] ARM: s3c64xx: smartq: Use PWM lookup table
@ 2015-10-05 12:47   ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-05 12:47 UTC (permalink / raw)
  To: linux-arm-kernel

Use a PWM lookup table to provide the PWM to the pwm-backlight device.
The driver has a legacy code path that is required only because boards
still use the legacy method of requesting PWMs by global ID. Replacing
these usages allows that legacy fallback to be removed.

Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
---
 arch/arm/mach-s3c64xx/mach-smartq.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/mach-smartq.c b/arch/arm/mach-s3c64xx/mach-smartq.c
index b3d13537a7f0..7b8a3699795c 100644
--- a/arch/arm/mach-s3c64xx/mach-smartq.c
+++ b/arch/arm/mach-s3c64xx/mach-smartq.c
@@ -14,6 +14,7 @@
 #include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
+#include <linux/pwm.h>
 #include <linux/pwm_backlight.h>
 #include <linux/serial_core.h>
 #include <linux/serial_s3c.h>
@@ -139,6 +140,11 @@ static struct platform_device smartq_usb_otg_vbus_dev = {
 	.dev.platform_data	= &smartq_usb_otg_vbus_pdata,
 };
 
+static struct pwm_lookup smartq_pwm_lookup[] = {
+	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
+		   1000000000 / (1000 * 20), PWM_POLARITY_NORMAL),
+};
+
 static int smartq_bl_init(struct device *dev)
 {
     s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
@@ -147,10 +153,8 @@ static int smartq_bl_init(struct device *dev)
 }
 
 static struct platform_pwm_backlight_data smartq_backlight_data = {
-	.pwm_id		= 1,
 	.max_brightness	= 1000,
 	.dft_brightness	= 600,
-	.pwm_period_ns	= 1000000000 / (1000 * 20),
 	.enable_gpio	= -1,
 	.init		= smartq_bl_init,
 };
@@ -396,5 +400,6 @@ void __init smartq_machine_init(void)
 	WARN_ON(smartq_usb_host_init());
 	WARN_ON(smartq_wifi_init());
 
+	pwm_add_table(smartq_pwm_lookup, ARRAY_SIZE(smartq_pwm_lookup));
 	platform_add_devices(smartq_devices, ARRAY_SIZE(smartq_devices));
 }
-- 
2.5.0

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

* Re: [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-06  0:28   ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-06  0:28 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Back when the PWM framework was introduced the concept of PWM lookup
> tables was added to allow board code to register a table of PWM devices
> and their association with consumers. The goal is to allow drivers to
> use a unified method to request PWM devices. At the same time, since no
> boards were exposing these tables, fallback code was kept in drivers to
> allow old code to remain functional. In order to get rid of the legacy
> fallback code, legacy users need to be updated to register PWM lookup
> tables.
> 
> This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
> backlight device to use the new PWM lookup tables. All patches have been
> compile-tested, but I don't have access to any of these boards, so I
> couldn't verify that they really work.

Unfortunately I can't verify them neither. I don't have these boards. In
that case I would prefer approach "if it ain't broken, don't touch
it"... unless someone tests the patches of course.

Anyone can provide tested-by tag?

Best regards,
Krzysztof


> 
> Thierry
> 
> Thierry Reding (6):
>   ARM: s3c24xx: h1940: Use PWM lookup table
>   ARM: s3c24xx: rx1950: Use PWM lookup table
>   ARM: s3c64xx: smdk6410: Use PWM lookup table
>   ARM: s3c64xx: crag6410: Use PWM lookup table
>   ARM: s3c64xx: hmt: Use PWM lookup table
>   ARM: s3c64xx: smartq: Use PWM lookup table
> 
>  arch/arm/mach-s3c24xx/mach-h1940.c    | 10 +++++++---
>  arch/arm/mach-s3c24xx/mach-rx1950.c   |  8 ++++++--
>  arch/arm/mach-s3c64xx/dev-backlight.c |  4 ----
>  arch/arm/mach-s3c64xx/mach-crag6410.c |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-hmt.c      |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smartq.c   |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smdk6410.c |  8 +++++++-
>  7 files changed, 41 insertions(+), 16 deletions(-)
> 

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

* [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
@ 2015-10-06  0:28   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-06  0:28 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Back when the PWM framework was introduced the concept of PWM lookup
> tables was added to allow board code to register a table of PWM devices
> and their association with consumers. The goal is to allow drivers to
> use a unified method to request PWM devices. At the same time, since no
> boards were exposing these tables, fallback code was kept in drivers to
> allow old code to remain functional. In order to get rid of the legacy
> fallback code, legacy users need to be updated to register PWM lookup
> tables.
> 
> This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
> backlight device to use the new PWM lookup tables. All patches have been
> compile-tested, but I don't have access to any of these boards, so I
> couldn't verify that they really work.

Unfortunately I can't verify them neither. I don't have these boards. In
that case I would prefer approach "if it ain't broken, don't touch
it"... unless someone tests the patches of course.

Anyone can provide tested-by tag?

Best regards,
Krzysztof


> 
> Thierry
> 
> Thierry Reding (6):
>   ARM: s3c24xx: h1940: Use PWM lookup table
>   ARM: s3c24xx: rx1950: Use PWM lookup table
>   ARM: s3c64xx: smdk6410: Use PWM lookup table
>   ARM: s3c64xx: crag6410: Use PWM lookup table
>   ARM: s3c64xx: hmt: Use PWM lookup table
>   ARM: s3c64xx: smartq: Use PWM lookup table
> 
>  arch/arm/mach-s3c24xx/mach-h1940.c    | 10 +++++++---
>  arch/arm/mach-s3c24xx/mach-rx1950.c   |  8 ++++++--
>  arch/arm/mach-s3c64xx/dev-backlight.c |  4 ----
>  arch/arm/mach-s3c64xx/mach-crag6410.c |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-hmt.c      |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smartq.c   |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smdk6410.c |  8 +++++++-
>  7 files changed, 41 insertions(+), 16 deletions(-)
> 

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

* Re: [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
  2015-10-06  0:28   ` Krzysztof Kozlowski
@ 2015-10-06  8:43     ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-06  8:43 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Kukjin Kim, linux-arm-kernel, linux-samsung-soc

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

On Tue, Oct 06, 2015 at 09:28:50AM +0900, Krzysztof Kozlowski wrote:
> On 05.10.2015 21:47, Thierry Reding wrote:
> > Back when the PWM framework was introduced the concept of PWM lookup
> > tables was added to allow board code to register a table of PWM devices
> > and their association with consumers. The goal is to allow drivers to
> > use a unified method to request PWM devices. At the same time, since no
> > boards were exposing these tables, fallback code was kept in drivers to
> > allow old code to remain functional. In order to get rid of the legacy
> > fallback code, legacy users need to be updated to register PWM lookup
> > tables.
> > 
> > This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
> > backlight device to use the new PWM lookup tables. All patches have been
> > compile-tested, but I don't have access to any of these boards, so I
> > couldn't verify that they really work.
> 
> Unfortunately I can't verify them neither. I don't have these boards. In
> that case I would prefer approach "if it ain't broken, don't touch
> it"... unless someone tests the patches of course.

Backlight on these boards is likely to be currently broken anyway. In
fact this series is part of an effort to restore backlight support for
these legacy boards (I sent out a similar series for PXA boards).

We're going to need to have this series merged so that we can remove the
legacy code that's being a lot of trouble maintaining. If this series
ends up breaking anything, I'd be happy to help fix things up.

Thierry

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

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

* [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
@ 2015-10-06  8:43     ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-06  8:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 06, 2015 at 09:28:50AM +0900, Krzysztof Kozlowski wrote:
> On 05.10.2015 21:47, Thierry Reding wrote:
> > Back when the PWM framework was introduced the concept of PWM lookup
> > tables was added to allow board code to register a table of PWM devices
> > and their association with consumers. The goal is to allow drivers to
> > use a unified method to request PWM devices. At the same time, since no
> > boards were exposing these tables, fallback code was kept in drivers to
> > allow old code to remain functional. In order to get rid of the legacy
> > fallback code, legacy users need to be updated to register PWM lookup
> > tables.
> > 
> > This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
> > backlight device to use the new PWM lookup tables. All patches have been
> > compile-tested, but I don't have access to any of these boards, so I
> > couldn't verify that they really work.
> 
> Unfortunately I can't verify them neither. I don't have these boards. In
> that case I would prefer approach "if it ain't broken, don't touch
> it"... unless someone tests the patches of course.

Backlight on these boards is likely to be currently broken anyway. In
fact this series is part of an effort to restore backlight support for
these legacy boards (I sent out a similar series for PXA boards).

We're going to need to have this series merged so that we can remove the
legacy code that's being a lot of trouble maintaining. If this series
ends up breaking anything, I'd be happy to help fix things up.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151006/70fa20d6/attachment.sig>

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

* Re: [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
  2015-10-06  8:43     ` Thierry Reding
@ 2015-10-06 12:27       ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-06 12:27 UTC (permalink / raw)
  To: Thierry Reding, Tomasz Figa
  Cc: k.kozlowski.k, Kukjin Kim, linux-arm-kernel, linux-samsung-soc

W dniu 06.10.2015 o 17:43, Thierry Reding pisze:
> On Tue, Oct 06, 2015 at 09:28:50AM +0900, Krzysztof Kozlowski wrote:
>> On 05.10.2015 21:47, Thierry Reding wrote:
>>> Back when the PWM framework was introduced the concept of PWM lookup
>>> tables was added to allow board code to register a table of PWM devices
>>> and their association with consumers. The goal is to allow drivers to
>>> use a unified method to request PWM devices. At the same time, since no
>>> boards were exposing these tables, fallback code was kept in drivers to
>>> allow old code to remain functional. In order to get rid of the legacy
>>> fallback code, legacy users need to be updated to register PWM lookup
>>> tables.
>>>
>>> This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
>>> backlight device to use the new PWM lookup tables. All patches have been
>>> compile-tested, but I don't have access to any of these boards, so I
>>> couldn't verify that they really work.
>>
>> Unfortunately I can't verify them neither. I don't have these boards. In
>> that case I would prefer approach "if it ain't broken, don't touch
>> it"... unless someone tests the patches of course.
> 
> Backlight on these boards is likely to be currently broken anyway. In
> fact this series is part of an effort to restore backlight support for
> these legacy boards (I sent out a similar series for PXA boards).
> 
> We're going to need to have this series merged so that we can remove the
> legacy code that's being a lot of trouble maintaining. If this series
> ends up breaking anything, I'd be happy to help fix things up.

So you suspect that it is already broken? Fair enough, I'll look at the
patches.

In the same time these are really old SoCs for mobile standard. I wonder
if anyone uses them... :)

Tomasz,
Do you have 6410 board? I remember you were quite involved in it.

Best regards,
Krzysztof

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

* [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
@ 2015-10-06 12:27       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-06 12:27 UTC (permalink / raw)
  To: linux-arm-kernel

W dniu 06.10.2015 o 17:43, Thierry Reding pisze:
> On Tue, Oct 06, 2015 at 09:28:50AM +0900, Krzysztof Kozlowski wrote:
>> On 05.10.2015 21:47, Thierry Reding wrote:
>>> Back when the PWM framework was introduced the concept of PWM lookup
>>> tables was added to allow board code to register a table of PWM devices
>>> and their association with consumers. The goal is to allow drivers to
>>> use a unified method to request PWM devices. At the same time, since no
>>> boards were exposing these tables, fallback code was kept in drivers to
>>> allow old code to remain functional. In order to get rid of the legacy
>>> fallback code, legacy users need to be updated to register PWM lookup
>>> tables.
>>>
>>> This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
>>> backlight device to use the new PWM lookup tables. All patches have been
>>> compile-tested, but I don't have access to any of these boards, so I
>>> couldn't verify that they really work.
>>
>> Unfortunately I can't verify them neither. I don't have these boards. In
>> that case I would prefer approach "if it ain't broken, don't touch
>> it"... unless someone tests the patches of course.
> 
> Backlight on these boards is likely to be currently broken anyway. In
> fact this series is part of an effort to restore backlight support for
> these legacy boards (I sent out a similar series for PXA boards).
> 
> We're going to need to have this series merged so that we can remove the
> legacy code that's being a lot of trouble maintaining. If this series
> ends up breaking anything, I'd be happy to help fix things up.

So you suspect that it is already broken? Fair enough, I'll look at the
patches.

In the same time these are really old SoCs for mobile standard. I wonder
if anyone uses them... :)

Tomasz,
Do you have 6410 board? I remember you were quite involved in it.

Best regards,
Krzysztof

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

* Re: [PATCH 1/6] ARM: s3c24xx: h1940: Use PWM lookup table
  2015-10-05 12:47   ` Thierry Reding
@ 2015-10-07  1:32     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:32 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c24xx/mach-h1940.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 

The code looks good.

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH 1/6] ARM: s3c24xx: h1940: Use PWM lookup table
@ 2015-10-07  1:32     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:32 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c24xx/mach-h1940.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 

The code looks good.

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
  2015-10-05 12:47   ` Thierry Reding
@ 2015-10-07  1:35     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:35 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
> index 1d35ff375a01..774c982a7b7e 100644
> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
> @@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
>  
>  };
>  
> +static struct pwm_lookup rx1950_pwm_lookup[] = {
> +	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,

Why the dev_id is "pwm-backlight.0"? Created platform device name is
"pwm-backlight".

Best regards,
Krzysztof

> +		   PWM_POLARITY_NORMAL),
> +};
> +
>  static struct pwm_device *lcd_pwm;
>  
>  static void rx1950_lcd_power(int enable)
> @@ -520,10 +525,8 @@ static int rx1950_backlight_notify(struct device *dev, int brightness)
>  }
>  
>  static struct platform_pwm_backlight_data rx1950_backlight_data = {
> -	.pwm_id = 0,
>  	.max_brightness = 24,
>  	.dft_brightness = 4,
> -	.pwm_period_ns = 48000,
>  	.enable_gpio = -1,
>  	.init = rx1950_backlight_init,
>  	.notify = rx1950_backlight_notify,
> @@ -792,6 +795,7 @@ static void __init rx1950_init_machine(void)
>  	gpio_direction_output(S3C2410_GPA(4), 0);
>  	gpio_direction_output(S3C2410_GPJ(6), 0);
>  
> +	pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
>  	platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
>  
>  	i2c_register_board_info(0, rx1950_i2c_devices,
> 

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

* [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
@ 2015-10-07  1:35     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:35 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
> index 1d35ff375a01..774c982a7b7e 100644
> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
> @@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
>  
>  };
>  
> +static struct pwm_lookup rx1950_pwm_lookup[] = {
> +	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,

Why the dev_id is "pwm-backlight.0"? Created platform device name is
"pwm-backlight".

Best regards,
Krzysztof

> +		   PWM_POLARITY_NORMAL),
> +};
> +
>  static struct pwm_device *lcd_pwm;
>  
>  static void rx1950_lcd_power(int enable)
> @@ -520,10 +525,8 @@ static int rx1950_backlight_notify(struct device *dev, int brightness)
>  }
>  
>  static struct platform_pwm_backlight_data rx1950_backlight_data = {
> -	.pwm_id = 0,
>  	.max_brightness = 24,
>  	.dft_brightness = 4,
> -	.pwm_period_ns = 48000,
>  	.enable_gpio = -1,
>  	.init = rx1950_backlight_init,
>  	.notify = rx1950_backlight_notify,
> @@ -792,6 +795,7 @@ static void __init rx1950_init_machine(void)
>  	gpio_direction_output(S3C2410_GPA(4), 0);
>  	gpio_direction_output(S3C2410_GPJ(6), 0);
>  
> +	pwm_add_table(rx1950_pwm_lookup, ARRAY_SIZE(rx1950_pwm_lookup));
>  	platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
>  
>  	i2c_register_board_info(0, rx1950_i2c_devices,
> 

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

* Re: [PATCH 4/6] ARM: s3c64xx: crag6410: Use PWM lookup table
  2015-10-05 12:47   ` Thierry Reding
@ 2015-10-07  1:36     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:36 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH 4/6] ARM: s3c64xx: crag6410: Use PWM lookup table
@ 2015-10-07  1:36     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:36 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
  2015-10-05 12:47   ` Thierry Reding
@ 2015-10-07  1:37     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:37 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
> index e4b087c58ee6..816b39d1e6d1 100644
> --- a/arch/arm/mach-s3c64xx/mach-hmt.c
> +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
> @@ -19,6 +19,7 @@
>  #include <linux/gpio.h>
>  #include <linux/delay.h>
>  #include <linux/leds.h>
> +#include <linux/pwm.h>
>  #include <linux/pwm_backlight.h>
>  #include <linux/mtd/mtd.h>
>  #include <linux/mtd/partitions.h>
> @@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
>  	},
>  };
>  
> +static struct pwm_lookup hmt_pwm_lookup[] = {
> +	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,

Same questions as in patch 2 - why suffix ".0" for "pwm-backlight"?

Best regards,
Krzysztof

> +		   1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
> +};
> +
>  static int hmt_bl_init(struct device *dev)
>  {
>  	int ret;
> @@ -110,10 +116,8 @@ static void hmt_bl_exit(struct device *dev)
>  }
>  
>  static struct platform_pwm_backlight_data hmt_backlight_data = {
> -	.pwm_id		= 1,
>  	.max_brightness	= 100 * 256,
>  	.dft_brightness	= 40 * 256,
> -	.pwm_period_ns	= 1000000000 / (100 * 256 * 20),
>  	.enable_gpio	= -1,
>  	.init		= hmt_bl_init,
>  	.notify		= hmt_bl_notify,
> @@ -268,6 +272,7 @@ static void __init hmt_machine_init(void)
>  	gpio_request(S3C64XX_GPF(13), "usb power");
>  	gpio_direction_output(S3C64XX_GPF(13), 1);
>  
> +	pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
>  	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
>  }
>  
> 

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

* [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
@ 2015-10-07  1:37     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-07  1:37 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
> index e4b087c58ee6..816b39d1e6d1 100644
> --- a/arch/arm/mach-s3c64xx/mach-hmt.c
> +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
> @@ -19,6 +19,7 @@
>  #include <linux/gpio.h>
>  #include <linux/delay.h>
>  #include <linux/leds.h>
> +#include <linux/pwm.h>
>  #include <linux/pwm_backlight.h>
>  #include <linux/mtd/mtd.h>
>  #include <linux/mtd/partitions.h>
> @@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
>  	},
>  };
>  
> +static struct pwm_lookup hmt_pwm_lookup[] = {
> +	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,

Same questions as in patch 2 - why suffix ".0" for "pwm-backlight"?

Best regards,
Krzysztof

> +		   1000000000 / (100 * 256 * 20), PWM_POLARITY_NORMAL),
> +};
> +
>  static int hmt_bl_init(struct device *dev)
>  {
>  	int ret;
> @@ -110,10 +116,8 @@ static void hmt_bl_exit(struct device *dev)
>  }
>  
>  static struct platform_pwm_backlight_data hmt_backlight_data = {
> -	.pwm_id		= 1,
>  	.max_brightness	= 100 * 256,
>  	.dft_brightness	= 40 * 256,
> -	.pwm_period_ns	= 1000000000 / (100 * 256 * 20),
>  	.enable_gpio	= -1,
>  	.init		= hmt_bl_init,
>  	.notify		= hmt_bl_notify,
> @@ -268,6 +272,7 @@ static void __init hmt_machine_init(void)
>  	gpio_request(S3C64XX_GPF(13), "usb power");
>  	gpio_direction_output(S3C64XX_GPF(13), 1);
>  
> +	pwm_add_table(hmt_pwm_lookup, ARRAY_SIZE(hmt_pwm_lookup));
>  	platform_add_devices(hmt_devices, ARRAY_SIZE(hmt_devices));
>  }
>  
> 

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

* Re: [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
  2015-10-07  1:35     ` Krzysztof Kozlowski
@ 2015-10-07 15:31       ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-07 15:31 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Kukjin Kim, linux-arm-kernel, linux-samsung-soc

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

On Wed, Oct 07, 2015 at 10:35:54AM +0900, Krzysztof Kozlowski wrote:
> On 05.10.2015 21:47, Thierry Reding wrote:
> > Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> > The driver has a legacy code path that is required only because boards
> > still use the legacy method of requesting PWMs by global ID. Replacing
> > these usages allows that legacy fallback to be removed.
> > 
> > Cc: Kukjin Kim <kgene@kernel.org>
> > Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> > ---
> >  arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
> > index 1d35ff375a01..774c982a7b7e 100644
> > --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
> > +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
> > @@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
> >  
> >  };
> >  
> > +static struct pwm_lookup rx1950_pwm_lookup[] = {
> > +	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
> 
> Why the dev_id is "pwm-backlight.0"? Created platform device name is
> "pwm-backlight".

"pwm-backlight" is only the base name. The platform bus code will use
the platform_device.id field and append it to the name as .<id> unless
it is -1 in which case it will be skipped. So in the rx1950_backlight
device the .id field isn't initialized at all, so it will be zeroed
out and hence the device name will become "pwm-backlight.0".

Thierry

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

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

* [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
@ 2015-10-07 15:31       ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-07 15:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 07, 2015 at 10:35:54AM +0900, Krzysztof Kozlowski wrote:
> On 05.10.2015 21:47, Thierry Reding wrote:
> > Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> > The driver has a legacy code path that is required only because boards
> > still use the legacy method of requesting PWMs by global ID. Replacing
> > these usages allows that legacy fallback to be removed.
> > 
> > Cc: Kukjin Kim <kgene@kernel.org>
> > Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> > ---
> >  arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
> > index 1d35ff375a01..774c982a7b7e 100644
> > --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
> > +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
> > @@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
> >  
> >  };
> >  
> > +static struct pwm_lookup rx1950_pwm_lookup[] = {
> > +	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
> 
> Why the dev_id is "pwm-backlight.0"? Created platform device name is
> "pwm-backlight".

"pwm-backlight" is only the base name. The platform bus code will use
the platform_device.id field and append it to the name as .<id> unless
it is -1 in which case it will be skipped. So in the rx1950_backlight
device the .id field isn't initialized at all, so it will be zeroed
out and hence the device name will become "pwm-backlight.0".

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151007/88988e0e/attachment.sig>

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

* Re: [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
  2015-10-07  1:37     ` Krzysztof Kozlowski
@ 2015-10-07 15:37       ` Thierry Reding
  -1 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-07 15:37 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: Kukjin Kim, linux-arm-kernel, linux-samsung-soc

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

On Wed, Oct 07, 2015 at 10:37:42AM +0900, Krzysztof Kozlowski wrote:
> On 05.10.2015 21:47, Thierry Reding wrote:
> > Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> > The driver has a legacy code path that is required only because boards
> > still use the legacy method of requesting PWMs by global ID. Replacing
> > these usages allows that legacy fallback to be removed.
> > 
> > Cc: Kukjin Kim <kgene@kernel.org>
> > Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> > ---
> >  arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
> > index e4b087c58ee6..816b39d1e6d1 100644
> > --- a/arch/arm/mach-s3c64xx/mach-hmt.c
> > +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
> > @@ -19,6 +19,7 @@
> >  #include <linux/gpio.h>
> >  #include <linux/delay.h>
> >  #include <linux/leds.h>
> > +#include <linux/pwm.h>
> >  #include <linux/pwm_backlight.h>
> >  #include <linux/mtd/mtd.h>
> >  #include <linux/mtd/partitions.h>
> > @@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
> >  	},
> >  };
> >  
> > +static struct pwm_lookup hmt_pwm_lookup[] = {
> > +	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
> 
> Same questions as in patch 2 - why suffix ".0" for "pwm-backlight"?

For the same reason that I explained in patch 2. Not sure if the .id = 0
was really supposed to be. For most devices it would probably make sense
to initialize it to -1 because they typically only have a single
backlight. But given that userspace might be using the name to control
the backlight via sysfs it's probably not a good idea to go and change
that.

Thierry

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

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

* [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
@ 2015-10-07 15:37       ` Thierry Reding
  0 siblings, 0 replies; 42+ messages in thread
From: Thierry Reding @ 2015-10-07 15:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Oct 07, 2015 at 10:37:42AM +0900, Krzysztof Kozlowski wrote:
> On 05.10.2015 21:47, Thierry Reding wrote:
> > Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> > The driver has a legacy code path that is required only because boards
> > still use the legacy method of requesting PWMs by global ID. Replacing
> > these usages allows that legacy fallback to be removed.
> > 
> > Cc: Kukjin Kim <kgene@kernel.org>
> > Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> > ---
> >  arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
> >  1 file changed, 7 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
> > index e4b087c58ee6..816b39d1e6d1 100644
> > --- a/arch/arm/mach-s3c64xx/mach-hmt.c
> > +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
> > @@ -19,6 +19,7 @@
> >  #include <linux/gpio.h>
> >  #include <linux/delay.h>
> >  #include <linux/leds.h>
> > +#include <linux/pwm.h>
> >  #include <linux/pwm_backlight.h>
> >  #include <linux/mtd/mtd.h>
> >  #include <linux/mtd/partitions.h>
> > @@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
> >  	},
> >  };
> >  
> > +static struct pwm_lookup hmt_pwm_lookup[] = {
> > +	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
> 
> Same questions as in patch 2 - why suffix ".0" for "pwm-backlight"?

For the same reason that I explained in patch 2. Not sure if the .id = 0
was really supposed to be. For most devices it would probably make sense
to initialize it to -1 because they typically only have a single
backlight. But given that userspace might be using the name to control
the backlight via sysfs it's probably not a good idea to go and change
that.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20151007/0a97cee3/attachment-0001.sig>

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

* Re: [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
  2015-10-07 15:31       ` Thierry Reding
@ 2015-10-08  1:00         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:00 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Kukjin Kim, linux-arm-kernel, linux-samsung-soc

On 08.10.2015 00:31, Thierry Reding wrote:
> On Wed, Oct 07, 2015 at 10:35:54AM +0900, Krzysztof Kozlowski wrote:
>> On 05.10.2015 21:47, Thierry Reding wrote:
>>> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
>>> The driver has a legacy code path that is required only because boards
>>> still use the legacy method of requesting PWMs by global ID. Replacing
>>> these usages allows that legacy fallback to be removed.
>>>
>>> Cc: Kukjin Kim <kgene@kernel.org>
>>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
>>> ---
>>>  arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
>>> index 1d35ff375a01..774c982a7b7e 100644
>>> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
>>> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
>>> @@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
>>>  
>>>  };
>>>  
>>> +static struct pwm_lookup rx1950_pwm_lookup[] = {
>>> +	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
>>
>> Why the dev_id is "pwm-backlight.0"? Created platform device name is
>> "pwm-backlight".
> 
> "pwm-backlight" is only the base name. The platform bus code will use
> the platform_device.id field and append it to the name as .<id> unless
> it is -1 in which case it will be skipped. So in the rx1950_backlight
> device the .id field isn't initialized at all, so it will be zeroed
> out and hence the device name will become "pwm-backlight.0".

Right, I missed the difference in device id.

The patch is fine:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH 2/6] ARM: s3c24xx: rx1950: Use PWM lookup table
@ 2015-10-08  1:00         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:00 UTC (permalink / raw)
  To: linux-arm-kernel

On 08.10.2015 00:31, Thierry Reding wrote:
> On Wed, Oct 07, 2015 at 10:35:54AM +0900, Krzysztof Kozlowski wrote:
>> On 05.10.2015 21:47, Thierry Reding wrote:
>>> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
>>> The driver has a legacy code path that is required only because boards
>>> still use the legacy method of requesting PWMs by global ID. Replacing
>>> these usages allows that legacy fallback to be removed.
>>>
>>> Cc: Kukjin Kim <kgene@kernel.org>
>>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
>>> ---
>>>  arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++--
>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-s3c24xx/mach-rx1950.c b/arch/arm/mach-s3c24xx/mach-rx1950.c
>>> index 1d35ff375a01..774c982a7b7e 100644
>>> --- a/arch/arm/mach-s3c24xx/mach-rx1950.c
>>> +++ b/arch/arm/mach-s3c24xx/mach-rx1950.c
>>> @@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
>>>  
>>>  };
>>>  
>>> +static struct pwm_lookup rx1950_pwm_lookup[] = {
>>> +	PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,
>>
>> Why the dev_id is "pwm-backlight.0"? Created platform device name is
>> "pwm-backlight".
> 
> "pwm-backlight" is only the base name. The platform bus code will use
> the platform_device.id field and append it to the name as .<id> unless
> it is -1 in which case it will be skipped. So in the rx1950_backlight
> device the .id field isn't initialized at all, so it will be zeroed
> out and hence the device name will become "pwm-backlight.0".

Right, I missed the difference in device id.

The patch is fine:

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH 3/6] ARM: s3c64xx: smdk6410: Use PWM lookup table
  2015-10-05 12:47   ` Thierry Reding
@ 2015-10-08  1:00     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:00 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/dev-backlight.c | 4 ----
>  arch/arm/mach-s3c64xx/mach-smdk6410.c | 8 +++++++-
>  2 files changed, 7 insertions(+), 5 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH 3/6] ARM: s3c64xx: smdk6410: Use PWM lookup table
@ 2015-10-08  1:00     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:00 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/dev-backlight.c | 4 ----
>  arch/arm/mach-s3c64xx/mach-smdk6410.c | 8 +++++++-
>  2 files changed, 7 insertions(+), 5 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
  2015-10-07 15:37       ` Thierry Reding
@ 2015-10-08  1:01         ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:01 UTC (permalink / raw)
  To: Thierry Reding; +Cc: Kukjin Kim, linux-arm-kernel, linux-samsung-soc

On 08.10.2015 00:37, Thierry Reding wrote:
> On Wed, Oct 07, 2015 at 10:37:42AM +0900, Krzysztof Kozlowski wrote:
>> On 05.10.2015 21:47, Thierry Reding wrote:
>>> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
>>> The driver has a legacy code path that is required only because boards
>>> still use the legacy method of requesting PWMs by global ID. Replacing
>>> these usages allows that legacy fallback to be removed.
>>>
>>> Cc: Kukjin Kim <kgene@kernel.org>
>>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
>>> ---
>>>  arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
>>> index e4b087c58ee6..816b39d1e6d1 100644
>>> --- a/arch/arm/mach-s3c64xx/mach-hmt.c
>>> +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
>>> @@ -19,6 +19,7 @@
>>>  #include <linux/gpio.h>
>>>  #include <linux/delay.h>
>>>  #include <linux/leds.h>
>>> +#include <linux/pwm.h>
>>>  #include <linux/pwm_backlight.h>
>>>  #include <linux/mtd/mtd.h>
>>>  #include <linux/mtd/partitions.h>
>>> @@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
>>>  	},
>>>  };
>>>  
>>> +static struct pwm_lookup hmt_pwm_lookup[] = {
>>> +	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
>>
>> Same questions as in patch 2 - why suffix ".0" for "pwm-backlight"?
> 
> For the same reason that I explained in patch 2. Not sure if the .id = 0
> was really supposed to be. For most devices it would probably make sense
> to initialize it to -1 because they typically only have a single
> backlight. But given that userspace might be using the name to control
> the backlight via sysfs it's probably not a good idea to go and change
> that.

Thanks for explanation.

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH 5/6] ARM: s3c64xx: hmt: Use PWM lookup table
@ 2015-10-08  1:01         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:01 UTC (permalink / raw)
  To: linux-arm-kernel

On 08.10.2015 00:37, Thierry Reding wrote:
> On Wed, Oct 07, 2015 at 10:37:42AM +0900, Krzysztof Kozlowski wrote:
>> On 05.10.2015 21:47, Thierry Reding wrote:
>>> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
>>> The driver has a legacy code path that is required only because boards
>>> still use the legacy method of requesting PWMs by global ID. Replacing
>>> these usages allows that legacy fallback to be removed.
>>>
>>> Cc: Kukjin Kim <kgene@kernel.org>
>>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>>> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
>>> ---
>>>  arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-s3c64xx/mach-hmt.c b/arch/arm/mach-s3c64xx/mach-hmt.c
>>> index e4b087c58ee6..816b39d1e6d1 100644
>>> --- a/arch/arm/mach-s3c64xx/mach-hmt.c
>>> +++ b/arch/arm/mach-s3c64xx/mach-hmt.c
>>> @@ -19,6 +19,7 @@
>>>  #include <linux/gpio.h>
>>>  #include <linux/delay.h>
>>>  #include <linux/leds.h>
>>> +#include <linux/pwm.h>
>>>  #include <linux/pwm_backlight.h>
>>>  #include <linux/mtd/mtd.h>
>>>  #include <linux/mtd/partitions.h>
>>> @@ -73,6 +74,11 @@ static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = {
>>>  	},
>>>  };
>>>  
>>> +static struct pwm_lookup hmt_pwm_lookup[] = {
>>> +	PWM_LOOKUP("samsung-pwm", 1, "pwm-backlight.0", NULL,
>>
>> Same questions as in patch 2 - why suffix ".0" for "pwm-backlight"?
> 
> For the same reason that I explained in patch 2. Not sure if the .id = 0
> was really supposed to be. For most devices it would probably make sense
> to initialize it to -1 because they typically only have a single
> backlight. But given that userspace might be using the name to control
> the backlight via sysfs it's probably not a good idea to go and change
> that.

Thanks for explanation.

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH 6/6] ARM: s3c64xx: smartq: Use PWM lookup table
  2015-10-05 12:47   ` Thierry Reding
@ 2015-10-08  1:02     ` Krzysztof Kozlowski
  -1 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:02 UTC (permalink / raw)
  To: Thierry Reding, Kukjin Kim; +Cc: linux-arm-kernel, linux-samsung-soc

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/mach-smartq.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* [PATCH 6/6] ARM: s3c64xx: smartq: Use PWM lookup table
@ 2015-10-08  1:02     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 42+ messages in thread
From: Krzysztof Kozlowski @ 2015-10-08  1:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 05.10.2015 21:47, Thierry Reding wrote:
> Use a PWM lookup table to provide the PWM to the pwm-backlight device.
> The driver has a legacy code path that is required only because boards
> still use the legacy method of requesting PWMs by global ID. Replacing
> these usages allows that legacy fallback to be removed.
> 
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
> ---
>  arch/arm/mach-s3c64xx/mach-smartq.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

Best regards,
Krzysztof

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

* Re: [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
  2015-10-05 12:47 ` Thierry Reding
@ 2015-10-12 19:17   ` Kukjin Kim
  -1 siblings, 0 replies; 42+ messages in thread
From: Kukjin Kim @ 2015-10-12 19:17 UTC (permalink / raw)
  To: Thierry Reding
  Cc: Kukjin Kim, Krzysztof Kozlowski, linux-arm-kernel, linux-samsung-soc

On 10/05/15 21:47, Thierry Reding wrote:
> Back when the PWM framework was introduced the concept of PWM lookup
> tables was added to allow board code to register a table of PWM devices
> and their association with consumers. The goal is to allow drivers to
> use a unified method to request PWM devices. At the same time, since no
> boards were exposing these tables, fallback code was kept in drivers to
> allow old code to remain functional. In order to get rid of the legacy
> fallback code, legacy users need to be updated to register PWM lookup
> tables.
> 
> This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
> backlight device to use the new PWM lookup tables. All patches have been
> compile-tested, but I don't have access to any of these boards, so I
> couldn't verify that they really work.
> 
> Thierry
> 
> Thierry Reding (6):
>   ARM: s3c24xx: h1940: Use PWM lookup table
>   ARM: s3c24xx: rx1950: Use PWM lookup table
>   ARM: s3c64xx: smdk6410: Use PWM lookup table
>   ARM: s3c64xx: crag6410: Use PWM lookup table
>   ARM: s3c64xx: hmt: Use PWM lookup table
>   ARM: s3c64xx: smartq: Use PWM lookup table
> 
>  arch/arm/mach-s3c24xx/mach-h1940.c    | 10 +++++++---
>  arch/arm/mach-s3c24xx/mach-rx1950.c   |  8 ++++++--
>  arch/arm/mach-s3c64xx/dev-backlight.c |  4 ----
>  arch/arm/mach-s3c64xx/mach-crag6410.c |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-hmt.c      |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smartq.c   |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smdk6410.c |  8 +++++++-
>  7 files changed, 41 insertions(+), 16 deletions(-)
> 
Applied this whole series with Krzysztof's review tag.

Thanks,
Kukjin

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

* [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table
@ 2015-10-12 19:17   ` Kukjin Kim
  0 siblings, 0 replies; 42+ messages in thread
From: Kukjin Kim @ 2015-10-12 19:17 UTC (permalink / raw)
  To: linux-arm-kernel

On 10/05/15 21:47, Thierry Reding wrote:
> Back when the PWM framework was introduced the concept of PWM lookup
> tables was added to allow board code to register a table of PWM devices
> and their association with consumers. The goal is to allow drivers to
> use a unified method to request PWM devices. At the same time, since no
> boards were exposing these tables, fallback code was kept in drivers to
> allow old code to remain functional. In order to get rid of the legacy
> fallback code, legacy users need to be updated to register PWM lookup
> tables.
> 
> This series converts all s3c24xx and s3c64xx boards that hook up a pwm-
> backlight device to use the new PWM lookup tables. All patches have been
> compile-tested, but I don't have access to any of these boards, so I
> couldn't verify that they really work.
> 
> Thierry
> 
> Thierry Reding (6):
>   ARM: s3c24xx: h1940: Use PWM lookup table
>   ARM: s3c24xx: rx1950: Use PWM lookup table
>   ARM: s3c64xx: smdk6410: Use PWM lookup table
>   ARM: s3c64xx: crag6410: Use PWM lookup table
>   ARM: s3c64xx: hmt: Use PWM lookup table
>   ARM: s3c64xx: smartq: Use PWM lookup table
> 
>  arch/arm/mach-s3c24xx/mach-h1940.c    | 10 +++++++---
>  arch/arm/mach-s3c24xx/mach-rx1950.c   |  8 ++++++--
>  arch/arm/mach-s3c64xx/dev-backlight.c |  4 ----
>  arch/arm/mach-s3c64xx/mach-crag6410.c |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-hmt.c      |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smartq.c   |  9 +++++++--
>  arch/arm/mach-s3c64xx/mach-smdk6410.c |  8 +++++++-
>  7 files changed, 41 insertions(+), 16 deletions(-)
> 
Applied this whole series with Krzysztof's review tag.

Thanks,
Kukjin

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

end of thread, other threads:[~2015-10-12 19:17 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-05 12:47 [PATCH 0/6] ARM: s3cxxxx: Use PWM lookup table Thierry Reding
2015-10-05 12:47 ` Thierry Reding
2015-10-05 12:47 ` [PATCH 1/6] ARM: s3c24xx: h1940: " Thierry Reding
2015-10-05 12:47   ` Thierry Reding
2015-10-07  1:32   ` Krzysztof Kozlowski
2015-10-07  1:32     ` Krzysztof Kozlowski
2015-10-05 12:47 ` [PATCH 2/6] ARM: s3c24xx: rx1950: " Thierry Reding
2015-10-05 12:47   ` Thierry Reding
2015-10-07  1:35   ` Krzysztof Kozlowski
2015-10-07  1:35     ` Krzysztof Kozlowski
2015-10-07 15:31     ` Thierry Reding
2015-10-07 15:31       ` Thierry Reding
2015-10-08  1:00       ` Krzysztof Kozlowski
2015-10-08  1:00         ` Krzysztof Kozlowski
2015-10-05 12:47 ` [PATCH 3/6] ARM: s3c64xx: smdk6410: " Thierry Reding
2015-10-05 12:47   ` Thierry Reding
2015-10-08  1:00   ` Krzysztof Kozlowski
2015-10-08  1:00     ` Krzysztof Kozlowski
2015-10-05 12:47 ` [PATCH 4/6] ARM: s3c64xx: crag6410: " Thierry Reding
2015-10-05 12:47   ` Thierry Reding
2015-10-07  1:36   ` Krzysztof Kozlowski
2015-10-07  1:36     ` Krzysztof Kozlowski
2015-10-05 12:47 ` [PATCH 5/6] ARM: s3c64xx: hmt: " Thierry Reding
2015-10-05 12:47   ` Thierry Reding
2015-10-07  1:37   ` Krzysztof Kozlowski
2015-10-07  1:37     ` Krzysztof Kozlowski
2015-10-07 15:37     ` Thierry Reding
2015-10-07 15:37       ` Thierry Reding
2015-10-08  1:01       ` Krzysztof Kozlowski
2015-10-08  1:01         ` Krzysztof Kozlowski
2015-10-05 12:47 ` [PATCH 6/6] ARM: s3c64xx: smartq: " Thierry Reding
2015-10-05 12:47   ` Thierry Reding
2015-10-08  1:02   ` Krzysztof Kozlowski
2015-10-08  1:02     ` Krzysztof Kozlowski
2015-10-06  0:28 ` [PATCH 0/6] ARM: s3cxxxx: " Krzysztof Kozlowski
2015-10-06  0:28   ` Krzysztof Kozlowski
2015-10-06  8:43   ` Thierry Reding
2015-10-06  8:43     ` Thierry Reding
2015-10-06 12:27     ` Krzysztof Kozlowski
2015-10-06 12:27       ` Krzysztof Kozlowski
2015-10-12 19:17 ` Kukjin Kim
2015-10-12 19:17   ` Kukjin Kim

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.