diff options
| author | Alexander Shiyan <shc_work@mail.ru> | 2013-06-10 12:59:30 -0400 |
|---|---|---|
| committer | Bryan Wu <cooloney@gmail.com> | 2013-06-20 19:21:34 -0400 |
| commit | 9d263813c27e2ad3da7ea0877e623f4ff8767ddd (patch) | |
| tree | 07eb43efd73190d4d5f117113db12c2ade9afda0 /include/linux | |
| parent | fb277f5b3a15c895586545d3938dc869e760bec6 (diff) | |
leds: leds-mc13783: Prepare driver to support MC13892 LEDs
This patch rewrite driver code to be ready to add support for
MC13892 LEDs and probe from devicetree.
(cooloney@gmail.com: fix one coding style issue when apply this patch)
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Tested-by: Philippe Retornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mfd/mc13xxx.h | 93 |
1 files changed, 43 insertions, 50 deletions
diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index bf070755982e..ee280f16350c 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h | |||
| @@ -78,20 +78,23 @@ struct mc13xxx_regulator_platform_data { | |||
| 78 | struct mc13xxx_regulator_init_data *regulators; | 78 | struct mc13xxx_regulator_init_data *regulators; |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| 81 | enum { | ||
| 82 | /* MC13783 LED IDs */ | ||
| 83 | MC13783_LED_MD, | ||
| 84 | MC13783_LED_AD, | ||
| 85 | MC13783_LED_KP, | ||
| 86 | MC13783_LED_R1, | ||
| 87 | MC13783_LED_G1, | ||
| 88 | MC13783_LED_B1, | ||
| 89 | MC13783_LED_R2, | ||
| 90 | MC13783_LED_G2, | ||
| 91 | MC13783_LED_B2, | ||
| 92 | MC13783_LED_R3, | ||
| 93 | MC13783_LED_G3, | ||
| 94 | MC13783_LED_B3, | ||
| 95 | }; | ||
| 96 | |||
| 81 | struct mc13xxx_led_platform_data { | 97 | struct mc13xxx_led_platform_data { |
| 82 | #define MC13783_LED_MD 0 | ||
| 83 | #define MC13783_LED_AD 1 | ||
| 84 | #define MC13783_LED_KP 2 | ||
| 85 | #define MC13783_LED_R1 3 | ||
| 86 | #define MC13783_LED_G1 4 | ||
| 87 | #define MC13783_LED_B1 5 | ||
| 88 | #define MC13783_LED_R2 6 | ||
| 89 | #define MC13783_LED_G2 7 | ||
| 90 | #define MC13783_LED_B2 8 | ||
| 91 | #define MC13783_LED_R3 9 | ||
| 92 | #define MC13783_LED_G3 10 | ||
| 93 | #define MC13783_LED_B3 11 | ||
| 94 | #define MC13783_LED_MAX MC13783_LED_B3 | ||
| 95 | int id; | 98 | int id; |
| 96 | const char *name; | 99 | const char *name; |
| 97 | const char *default_trigger; | 100 | const char *default_trigger; |
| @@ -100,46 +103,36 @@ struct mc13xxx_led_platform_data { | |||
| 100 | char max_current; | 103 | char max_current; |
| 101 | }; | 104 | }; |
| 102 | 105 | ||
| 106 | #define MAX_LED_CONTROL_REGS 6 | ||
| 107 | |||
| 103 | struct mc13xxx_leds_platform_data { | 108 | struct mc13xxx_leds_platform_data { |
| 104 | int num_leds; | ||
| 105 | struct mc13xxx_led_platform_data *led; | 109 | struct mc13xxx_led_platform_data *led; |
| 110 | int num_leds; | ||
| 106 | 111 | ||
| 107 | #define MC13783_LED_TRIODE_MD (1 << 0) | 112 | /* LED Control 0 */ |
| 108 | #define MC13783_LED_TRIODE_AD (1 << 1) | 113 | #define MC13783_LED_C0_ENABLE (1 << 0) |
| 109 | #define MC13783_LED_TRIODE_KP (1 << 2) | 114 | #define MC13783_LED_C0_TRIODE_MD (1 << 7) |
| 110 | #define MC13783_LED_BOOST_EN (1 << 3) | 115 | #define MC13783_LED_C0_TRIODE_AD (1 << 8) |
| 111 | #define MC13783_LED_TC1HALF (1 << 4) | 116 | #define MC13783_LED_C0_TRIODE_KP (1 << 9) |
| 112 | #define MC13783_LED_SLEWLIMTC (1 << 5) | 117 | #define MC13783_LED_C0_BOOST (1 << 10) |
| 113 | #define MC13783_LED_SLEWLIMBL (1 << 6) | 118 | #define MC13783_LED_C0_ABMODE(x) (((x) & 0x7) << 11) |
| 114 | #define MC13783_LED_TRIODE_TC1 (1 << 7) | 119 | #define MC13783_LED_C0_ABREF(x) (((x) & 0x3) << 14) |
| 115 | #define MC13783_LED_TRIODE_TC2 (1 << 8) | 120 | /* LED Control 1 */ |
| 116 | #define MC13783_LED_TRIODE_TC3 (1 << 9) | 121 | #define MC13783_LED_C1_TC1HALF (1 << 18) |
| 117 | int flags; | 122 | #define MC13783_LED_C1_SLEWLIM (1 << 23) |
| 118 | 123 | /* LED Control 2 */ | |
| 119 | #define MC13783_LED_AB_DISABLED 0 | 124 | #define MC13783_LED_C2_PERIOD(x) (((x) & 0x3) << 21) |
| 120 | #define MC13783_LED_AB_MD1 1 | 125 | #define MC13783_LED_C2_SLEWLIM (1 << 23) |
| 121 | #define MC13783_LED_AB_MD12 2 | 126 | /* LED Control 3 */ |
| 122 | #define MC13783_LED_AB_MD123 3 | 127 | #define MC13783_LED_C3_PERIOD(x) (((x) & 0x3) << 21) |
| 123 | #define MC13783_LED_AB_MD1234 4 | 128 | #define MC13783_LED_C3_TRIODE_TC1 (1 << 23) |
| 124 | #define MC13783_LED_AB_MD1234_AD1 5 | 129 | /* LED Control 4 */ |
| 125 | #define MC13783_LED_AB_MD1234_AD12 6 | 130 | #define MC13783_LED_C4_PERIOD(x) (((x) & 0x3) << 21) |
| 126 | #define MC13783_LED_AB_MD1_AD 7 | 131 | #define MC13783_LED_C4_TRIODE_TC2 (1 << 23) |
| 127 | char abmode; | 132 | /* LED Control 5 */ |
| 128 | 133 | #define MC13783_LED_C5_PERIOD(x) (((x) & 0x3) << 21) | |
| 129 | #define MC13783_LED_ABREF_200MV 0 | 134 | #define MC13783_LED_C5_TRIODE_TC3 (1 << 23) |
| 130 | #define MC13783_LED_ABREF_400MV 1 | 135 | u32 led_control[MAX_LED_CONTROL_REGS]; |
| 131 | #define MC13783_LED_ABREF_600MV 2 | ||
| 132 | #define MC13783_LED_ABREF_800MV 3 | ||
| 133 | char abref; | ||
| 134 | |||
| 135 | #define MC13783_LED_PERIOD_10MS 0 | ||
| 136 | #define MC13783_LED_PERIOD_100MS 1 | ||
| 137 | #define MC13783_LED_PERIOD_500MS 2 | ||
| 138 | #define MC13783_LED_PERIOD_2S 3 | ||
| 139 | char bl_period; | ||
| 140 | char tc1_period; | ||
| 141 | char tc2_period; | ||
| 142 | char tc3_period; | ||
| 143 | }; | 136 | }; |
| 144 | 137 | ||
| 145 | struct mc13xxx_buttons_platform_data { | 138 | struct mc13xxx_buttons_platform_data { |
