diff options
author | Kim, Milo <Milo.Kim@ti.com> | 2012-03-23 18:02:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 19:58:35 -0400 |
commit | bb982009d3850759d3f4a4c853f9c456c48b6c2d (patch) | |
tree | 9bd6ed1979f86e5531f83240720cf0119b33a4e0 /include/linux/led-lm3530.h | |
parent | e13d97865942e9dcf4fdd39d9fb9c5ae31e7c3d1 (diff) |
leds-lm3530: support pwm input mode
* add 'struct lm3530_pwm_data' in the platform data
The pwm data is the platform specific functions which generate the pwm.
The pwm data is only valid when brightness is pwm input mode.
Functions should be implemented by the pwm driver.
pwm_set_intensity() : set duty of pwm.
pwm_get_intensity() : get current the brightness.
* brightness control by pwm
If the control mode is pwm, then brightness is changed by the duty of
pwm=. So pwm platform function should be called in lm3530_brightness_set().
* do not update brightness register when pwm input mode
In pwm input mode, brightness register is not used.
If any value is updated in this register, then the led will be off.
* when input mode is changed, set duty of pwm to 0 if unnecessary.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/led-lm3530.h')
-rw-r--r-- | include/linux/led-lm3530.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/led-lm3530.h b/include/linux/led-lm3530.h index 8eb12357a110..eeae6e742471 100644 --- a/include/linux/led-lm3530.h +++ b/include/linux/led-lm3530.h | |||
@@ -72,6 +72,12 @@ enum lm3530_als_mode { | |||
72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ | 72 | LM3530_INPUT_CEIL, /* Max of ALS1 and ALS2 */ |
73 | }; | 73 | }; |
74 | 74 | ||
75 | /* PWM Platform Specific Data */ | ||
76 | struct lm3530_pwm_data { | ||
77 | void (*pwm_set_intensity) (int brightness, int max_brightness); | ||
78 | int (*pwm_get_intensity) (int max_brightness); | ||
79 | }; | ||
80 | |||
75 | /** | 81 | /** |
76 | * struct lm3530_platform_data | 82 | * struct lm3530_platform_data |
77 | * @mode: mode of operation i.e. Manual, ALS or PWM | 83 | * @mode: mode of operation i.e. Manual, ALS or PWM |
@@ -87,6 +93,7 @@ enum lm3530_als_mode { | |||
87 | * @als_vmin: als input voltage calibrated for max brightness in mV | 93 | * @als_vmin: als input voltage calibrated for max brightness in mV |
88 | * @als_vmax: als input voltage calibrated for min brightness in mV | 94 | * @als_vmax: als input voltage calibrated for min brightness in mV |
89 | * @brt_val: brightness value (0-255) | 95 | * @brt_val: brightness value (0-255) |
96 | * @pwm_data: PWM control functions (only valid when the mode is PWM) | ||
90 | */ | 97 | */ |
91 | struct lm3530_platform_data { | 98 | struct lm3530_platform_data { |
92 | enum lm3530_mode mode; | 99 | enum lm3530_mode mode; |
@@ -107,6 +114,8 @@ struct lm3530_platform_data { | |||
107 | u32 als_vmax; | 114 | u32 als_vmax; |
108 | 115 | ||
109 | u8 brt_val; | 116 | u8 brt_val; |
117 | |||
118 | struct lm3530_pwm_data pwm_data; | ||
110 | }; | 119 | }; |
111 | 120 | ||
112 | #endif /* _LINUX_LED_LM3530_H__ */ | 121 | #endif /* _LINUX_LED_LM3530_H__ */ |