diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-12-04 11:52:33 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-01-08 07:38:58 -0500 |
commit | 0081e8020ebd814a99e45720a10e869a54ee08a6 (patch) | |
tree | 0036c31844ae55ff00b370a4a476768398c29844 /include | |
parent | 934cd3f979a1daacbd403398f2c7a8f6720c33aa (diff) |
leds: Add WM8350 LED driver
The voltage and current regulators on the WM8350 AudioPlus PMIC can be
used in concert to provide a power efficient LED driver. This driver
implements support for this within the standard LED class.
Platform initialisation code should configure the LED hardware in the
init callback provided by the WM8350 core driver. The callback should
use wm8350_isink_set_flash(), wm8350_dcdc25_set_mode() and
wm8350_dcdc_set_slot() to configure the operating parameters of the
regulators for their hardware and then then use wm8350_register_led() to
instantiate the LED driver.
This driver was originally written by Liam Girdwood, though it has been
extensively modified since then.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mfd/wm8350/pmic.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index 96acbfc8aa12..be3264e286e0 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h | |||
@@ -13,6 +13,10 @@ | |||
13 | #ifndef __LINUX_MFD_WM8350_PMIC_H | 13 | #ifndef __LINUX_MFD_WM8350_PMIC_H |
14 | #define __LINUX_MFD_WM8350_PMIC_H | 14 | #define __LINUX_MFD_WM8350_PMIC_H |
15 | 15 | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/leds.h> | ||
18 | #include <linux/regulator/machine.h> | ||
19 | |||
16 | /* | 20 | /* |
17 | * Register values. | 21 | * Register values. |
18 | */ | 22 | */ |
@@ -700,6 +704,33 @@ struct wm8350; | |||
700 | struct platform_device; | 704 | struct platform_device; |
701 | struct regulator_init_data; | 705 | struct regulator_init_data; |
702 | 706 | ||
707 | /* | ||
708 | * WM8350 LED platform data | ||
709 | */ | ||
710 | struct wm8350_led_platform_data { | ||
711 | const char *name; | ||
712 | const char *default_trigger; | ||
713 | int max_uA; | ||
714 | }; | ||
715 | |||
716 | struct wm8350_led { | ||
717 | struct platform_device *pdev; | ||
718 | struct mutex mutex; | ||
719 | struct work_struct work; | ||
720 | spinlock_t value_lock; | ||
721 | enum led_brightness value; | ||
722 | struct led_classdev cdev; | ||
723 | int max_uA_index; | ||
724 | int enabled; | ||
725 | |||
726 | struct regulator *isink; | ||
727 | struct regulator_consumer_supply isink_consumer; | ||
728 | struct regulator_init_data isink_init; | ||
729 | struct regulator *dcdc; | ||
730 | struct regulator_consumer_supply dcdc_consumer; | ||
731 | struct regulator_init_data dcdc_init; | ||
732 | }; | ||
733 | |||
703 | struct wm8350_pmic { | 734 | struct wm8350_pmic { |
704 | /* Number of regulators of each type on this device */ | 735 | /* Number of regulators of each type on this device */ |
705 | int max_dcdc; | 736 | int max_dcdc; |
@@ -717,10 +748,15 @@ struct wm8350_pmic { | |||
717 | 748 | ||
718 | /* regulator devices */ | 749 | /* regulator devices */ |
719 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; | 750 | struct platform_device *pdev[NUM_WM8350_REGULATORS]; |
751 | |||
752 | /* LED devices */ | ||
753 | struct wm8350_led led[2]; | ||
720 | }; | 754 | }; |
721 | 755 | ||
722 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, | 756 | int wm8350_register_regulator(struct wm8350 *wm8350, int reg, |
723 | struct regulator_init_data *initdata); | 757 | struct regulator_init_data *initdata); |
758 | int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink, | ||
759 | struct wm8350_led_platform_data *pdata); | ||
724 | 760 | ||
725 | /* | 761 | /* |
726 | * Additional DCDC control not supported via regulator API | 762 | * Additional DCDC control not supported via regulator API |