leds: leds-mc13783: Prepare driver to support MC13892 LEDs
Subsystems (5)
Arm (32-bit) Arm sub-architectures Arm i.MX and Layerscape Multifunction devices (MFD) +1 more subsystems
PATCH v3 1/2 leds: leds-mc13783: Prepare driver to support MC13892 LEDs
This patch rewrite driver code to be ready to add support for MC13892 LEDs.
Signed-off-by Alexander Shiyan <[email protected]>
--- arch/arm/mach-imx/mach-mx31moboard.c | 9 +- drivers/leds/leds-mc13783.c | 395 +++++++++++++---------------------- include/linux/mfd/mc13xxx.h | 91 ++++---- 3 files changed, 195 insertions(+), 300 deletions(-)
arch/arm/mach-imx/mach-mx31moboard.c +5 -4
@@ -268,10 +268,11 @@ static struct mc13xxx_led_platform_data moboard_led[] = {static struct mc13xxx_leds_platform_data moboard_leds = { .num_leds =ARRAY_SIZE (moboard_led), .led = moboard_led, - .flags =MC13783_LED_SLEWLIMTC , - .abmode =MC13783_LED_AB_DISABLED , - .tc1_period =MC13783_LED_PERIOD_10MS , - .tc2_period =MC13783_LED_PERIOD_10MS , + .led_control[0 ] =MC13783_LED_C0_ENABLE |MC13783_LED_C0_ABMODE (0 ), + .led_control[1 ] =MC13783_LED_C1_SLEWLIM , + .led_control[2 ] =MC13783_LED_C2_SLEWLIM , + .led_control[3 ] =MC13783_LED_C3_PERIOD (0 ), + .led_control[4 ] =MC13783_LED_C3_PERIOD (0 ), };static struct mc13xxx_buttons_platform_data moboard_buttons = {
drivers/leds/leds-mc13783.c +149 -246
509 lines not on this page · raw message
include/linux/mfd/mc13xxx.h +41 -50
106 lines not on this page · raw message
Signature · 1 line
1.8.1.5
PATCH v3 2/2 leds: leds-mc13783: Add MC13892 LED support
Signed-off-by Alexander Shiyan <[email protected]>
--- drivers/leds/leds-mc13783.c | 60 ++++++++++++++++++++++++++++++++++++++++++++- include/linux/mfd/mc13xxx.h | 7 ++++++ 2 files changed, 66 insertions(+), 1 deletion(-)
drivers/leds/leds-mc13783.c +59 -1
@@ -1,5 +1,5 @@/* -* LEDs driver for Freescale MC13783 +* LEDs driver for Freescale MC13783/MC13892 * * Copyright (C) 2010 Philippe R?tornaz *
@@ -85,6 +85,34 @@ static void mc13xxx_led_work(struct work_struct *work) value = led->new_brightness >>3 ; mask =0x1f ;break ; +case MC13892_LED_MD : + reg =MC13XXX_REG_LED_CONTROL (0 ); + shift =3 ; + mask =0x3f ; + value = led->new_brightness >>2 ; +break ; +case MC13892_LED_AD : + reg =MC13XXX_REG_LED_CONTROL (0 ); + shift =15 ; + mask =0x3f ; + value = led->new_brightness >>2 ; +break ; +case MC13892_LED_KP : + reg =MC13XXX_REG_LED_CONTROL (1 ); + shift =3 ; + mask =0x3f ; + value = led->new_brightness >>2 ; +break ; +case MC13892_LED_R : +case MC13892_LED_G : +case MC13892_LED_B : + off = led->id -MC13892_LED_R ; + bank = off /2 ; + reg =MC13XXX_REG_LED_CONTROL (2 ) + bank; + shift = (off - bank *2 ) *12 +3 ; + value = led->new_brightness >>2 ; + mask =0x3f ; +break ;default :BUG (); }
@@ -138,6 +166,29 @@ static int __init mc13xxx_led_setup(struct mc13xxx_led *led, int max_current) shift = ((led->id -MC13783_LED_R1 ) - bank *3 ) *2 ; mask =0x03 ;break ; +case MC13892_LED_MD : + reg =MC13XXX_REG_LED_CONTROL (0 ); + shift =9 ; + mask =0x07 ; +break ; +case MC13892_LED_AD : + reg =MC13XXX_REG_LED_CONTROL (0 ); + shift =21 ; + mask =0x07 ; +break ; +case MC13892_LED_KP : + reg =MC13XXX_REG_LED_CONTROL (1 ); + shift =9 ; + mask =0x07 ; +break ; +case MC13892_LED_R : +case MC13892_LED_G : +case MC13892_LED_B : + bank = (led->id -MC13892_LED_R ) /2 ; + reg =MC13XXX_REG_LED_CONTROL (2 ) + bank; + shift = ((led->id -MC13892_LED_R ) - bank *2 ) *12 +9 ; + mask =0x07 ; +break ;default :BUG (); }
@@ -273,8 +324,15 @@ static const struct mc13xxx_led_devtype mc13783_led_devtype = { .num_regs = 6, }; +static const struct mc13xxx_led_devtype mc13892_led_devtype = { + .led_min =MC13892_LED_MD , + .led_max =MC13892_LED_B , + .num_regs =4 , +}; +static const struct platform_device_id mc13xxx_led_id_table[] = { {"mc13783-led" , (kernel_ulong_t)&mc13783_led_devtype, }, + {"mc13892-led" , (kernel_ulong_t)&mc13892_led_devtype, }, { } };MODULE_DEVICE_TABLE (platform, mc13xxx_led_id_table);
include/linux/mfd/mc13xxx.h +7 -0
@@ -92,6 +92,13 @@ enum {MC13783_LED_R3 ,MC13783_LED_G3 ,MC13783_LED_B3 , +/* MC13892 LED IDs */ +MC13892_LED_MD , +MC13892_LED_AD , +MC13892_LED_KP , +MC13892_LED_R , +MC13892_LED_G , + MC13892_LED_B, }; struct mc13xxx_led_platform_data {
Signature · 1 line
1.8.1.5
Quoted 4 lines
This patch rewrite driver code to be ready to add support for MC13892 LEDs.
Signed-off-by Alexander Shiyan <[email protected]>
Please do not apply these patches. This contain a problem and I will extend v4 for probe with devicetree.
Thanks.
---