ARM: s3cxxxx: Use PWM lookup table
Subsystems (3)
cover ARM: s3cxxxx: Use PWM lookup table
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(-)
Signature · 1 line
2.5.0
PATCH 1/6 ARM: s3c24xx: h1940: Use PWM lookup table
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.
--- arch/arm/mach-s3c24xx/mach-h1940.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/arm/mach-s3c24xx/mach-h1940.c +7 -3
@@ -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" );
Signature · 1 line
2.5.0
PATCH 1/6 ARM: s3c24xx: h1940: Use PWM lookup table
Quoted 5 lines · 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.
Quoted 7 lines
Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c24xx/mach-h1940.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
The code looks good.
Best regards,
Krzysztof
PATCH 2/6 ARM: s3c24xx: rx1950: Use PWM lookup table
In reply to Thierry RedingUse 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.
--- arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/arm/mach-s3c24xx/mach-rx1950.c +6 -2
@@ -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,
Signature · 1 line
2.5.0
PATCH 2/6 ARM: s3c24xx: rx1950: Use PWM lookup table
Quoted 17 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/arm/mach-s3c24xx/mach-rx1950.c +0
-0
arch/arm/mach-s3c24xx/mach-rx1950.c static struct s3c2410fb_mach_info rx1950_lcd_cfg = { · line 379
Quoted 5 lines
arch/arm/mach-s3c24xx/mach-rx1950.c +2
-0@@ -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
Quoted 26 lines
arch/arm/mach-s3c24xx/mach-rx1950.c +4
-2+ 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,
PATCH 2/6 ARM: s3c24xx: rx1950: Use PWM lookup table
Quoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/arm/mach-s3c24xx/mach-rx1950.c +0
-0@@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
Quoted 7 lines
arch/arm/mach-s3c24xx/mach-rx1950.c static struct s3c2410fb_mach_info rx1950_lcd_cfg = { · line 379
Quoted 4 lines
arch/arm/mach-s3c24xx/mach-rx1950.c +2
-0}; +static struct pwm_lookup rx1950_pwm_lookup[] = { + PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,Why the
dev_idis "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>
PATCH 2/6 ARM: s3c24xx: rx1950: Use PWM lookup table
Quoted 28 lines · Thierry Reding
Quoted 19 lines · Krzysztof Kozlowski
Quoted 18 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c24xx/mach-rx1950.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)arch/arm/mach-s3c24xx/mach-rx1950.c +0
-0@@ -375,6 +375,11 @@ static struct s3c2410fb_mach_info rx1950_lcd_cfg = {Quoted 7 lines
arch/arm/mach-s3c24xx/mach-rx1950.c static struct s3c2410fb_mach_info rx1950_lcd_cfg = { · line 379
Quoted 4 lines
arch/arm/mach-s3c24xx/mach-rx1950.c +2
-0}; +static struct pwm_lookup rx1950_pwm_lookup[] = { + PWM_LOOKUP("samsung-pwm", 0, "pwm-backlight.0", NULL, 48000,Why the
dev_idis "pwm-backlight.0"? Created platform device name is "pwm-backlight".
Quoted 5 lines
"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_backlightdevice 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:
Best regards,
Krzysztof
PATCH 3/6 ARM: s3c64xx: smdk6410: Use PWM lookup table
In reply to Thierry RedingUse 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.
--- arch/arm/mach-s3c64xx/dev-backlight.c | 4 ---- arch/arm/mach-s3c64xx/mach-smdk6410.c | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-)
arch/arm/mach-s3c64xx/dev-backlight.c +0 -4
@@ -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)
arch/arm/mach-s3c64xx/mach-smdk6410.c +7 -1
@@ -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); }
Signature · 1 line
2.5.0
PATCH 3/6 ARM: s3c64xx: smdk6410: Use PWM lookup table
Quoted 5 lines · 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.
Quoted 7 lines
Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c64xx/dev-backlight.c | 4 ---- arch/arm/mach-s3c64xx/mach-smdk6410.c | 8 +++++++- 2 files changed, 7 insertions(+), 5 deletions(-)
Best regards,
Krzysztof
PATCH 4/6 ARM: s3c64xx: crag6410: Use PWM lookup table
In reply to Thierry RedingUse 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.
--- arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-s3c64xx/mach-crag6410.c +7 -2
@@ -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);
Signature · 1 line
2.5.0
PATCH 4/6 ARM: s3c64xx: crag6410: Use PWM lookup table
Quoted 5 lines · 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.
Quoted 7 lines
Cc Kukjin Kim <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c64xx/mach-crag6410.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Best regards,
Krzysztof
PATCH 5/6 ARM: s3c64xx: hmt: Use PWM lookup table
In reply to Thierry RedingUse 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.
--- arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-s3c64xx/mach-hmt.c +7 -2
@@ -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)); }
Signature · 1 line
2.5.0
PATCH 5/6 ARM: s3c64xx: hmt: Use PWM lookup table
Quoted 25 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)arch/arm/mach-s3c64xx/mach-hmt.c +1
-0@@ -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>
arch/arm/mach-s3c64xx/mach-hmt.c static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = { · line 78
Quoted 5 lines
arch/arm/mach-s3c64xx/mach-hmt.c +2
-0@@ -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
Quoted 26 lines
arch/arm/mach-s3c64xx/mach-hmt.c +4
-2+ 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)); }
PATCH 5/6 ARM: s3c64xx: hmt: Use PWM lookup table
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)arch/arm/mach-s3c64xx/mach-hmt.c +1
-0@@ -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 = { }, };
Quoted 4 lines
arch/arm/mach-s3c64xx/mach-hmt.c static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = { · line 78
Quoted 2 lines
arch/arm/mach-s3c64xx/mach-hmt.c +2
-0+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>
PATCH 5/6 ARM: s3c64xx: hmt: Use PWM lookup table
Quoted 35 lines · Thierry Reding
Quoted 29 lines · Krzysztof Kozlowski
Quoted 28 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c64xx/mach-hmt.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)arch/arm/mach-s3c64xx/mach-hmt.c +1
-0@@ -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 = { }, };Quoted 4 lines
arch/arm/mach-s3c64xx/mach-hmt.c static struct s3c2410_uartcfg hmt_uartcfgs[] __initdata = { · line 78
Quoted 2 lines
arch/arm/mach-s3c64xx/mach-hmt.c +2
-0+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"?
Quoted 6 lines
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.
Best regards,
Krzysztof
PATCH 6/6 ARM: s3c64xx: smartq: Use PWM lookup table
In reply to Thierry RedingUse 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.
--- arch/arm/mach-s3c64xx/mach-smartq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/mach-s3c64xx/mach-smartq.c +7 -2
@@ -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)); }
Signature · 1 line
2.5.0
PATCH 6/6 ARM: s3c64xx: smartq: Use PWM lookup table
Quoted 11 lines · 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 <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Signed-off-by Thierry Reding <[email protected]>--- arch/arm/mach-s3c64xx/mach-smartq.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Best regards,
Krzysztof
cover ARM: s3cxxxx: Use PWM lookup table
In reply to Thierry RedingQuoted 9 lines · Thierry Reding
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.
Quoted 4 lines
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
Quoted 20 lines
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 tablearch/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(-)
cover ARM: s3cxxxx: Use PWM lookup table
Quoted 10 lines · Krzysztof Kozlowski
Quoted 9 lines · Thierry Reding
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.
Quoted 8 lines
Quoted 4 lines
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>
cover ARM: s3cxxxx: Use PWM lookup table
W dniu 06.10.2015 o 17:43, Thierry Reding pisze:
Quoted 20 lines · Krzysztof Kozlowski
Quoted 10 lines · Thierry Reding
Quoted 9 lines
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.
Quoted 8 lines
Quoted 4 lines
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.
Quoted 7 lines
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
cover ARM: s3cxxxx: Use PWM lookup table
In reply to Thierry RedingQuoted 24 lines · Thierry Reding
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
Quoted 9 lines
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