Commit 7fdcef8a authored by Philippe Rétornaz's avatar Philippe Rétornaz Committed by Richard Purdie

leds: Add mc13783 LED support

This add basic led support for Freescale MC13783 PMIC.
Signed-off-by: default avatarPhilippe Rétornaz <philippe.retornaz@epfl.ch>
Signed-off-by: default avatarRichard Purdie <rpurdie@linux.intel.com>
parent 1e653acc
...@@ -295,6 +295,13 @@ config LEDS_DELL_NETBOOKS ...@@ -295,6 +295,13 @@ config LEDS_DELL_NETBOOKS
This adds support for the Latitude 2100 and similar This adds support for the Latitude 2100 and similar
notebooks that have an external LED. notebooks that have an external LED.
config LEDS_MC13783
tristate "LED Support for MC13783 PMIC"
depends on MFD_MC13783
help
This option enable support for on-chip LED drivers found
on Freescale Semiconductor MC13783 PMIC.
config LEDS_TRIGGERS config LEDS_TRIGGERS
bool "LED Trigger support" bool "LED Trigger support"
help help
......
...@@ -36,6 +36,7 @@ obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o ...@@ -36,6 +36,7 @@ obj-$(CONFIG_LEDS_INTEL_SS4200) += leds-ss4200.o
obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o obj-$(CONFIG_LEDS_LT3593) += leds-lt3593.o
obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o obj-$(CONFIG_LEDS_ADP5520) += leds-adp5520.o
obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell-led.o
obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o
# LED SPI Drivers # LED SPI Drivers
obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
......
This diff is collapsed.
...@@ -679,6 +679,10 @@ static int mc13783_probe(struct spi_device *spi) ...@@ -679,6 +679,10 @@ static int mc13783_probe(struct spi_device *spi)
if (pdata->flags & MC13783_USE_TOUCHSCREEN) if (pdata->flags & MC13783_USE_TOUCHSCREEN)
mc13783_add_subdevice(mc13783, "mc13783-ts"); mc13783_add_subdevice(mc13783, "mc13783-ts");
if (pdata->flags & MC13783_USE_LED)
mc13783_add_subdevice_pdata(mc13783, "mc13783-led",
pdata->leds, sizeof(*pdata->leds));
return 0; return 0;
} }
......
...@@ -64,6 +64,70 @@ static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq) ...@@ -64,6 +64,70 @@ static inline int mc13783_ackirq(struct mc13783 *mc13783, int irq)
MC13783_ADC0_TSMOD1 | \ MC13783_ADC0_TSMOD1 | \
MC13783_ADC0_TSMOD2) MC13783_ADC0_TSMOD2)
struct mc13783_led_platform_data {
#define MC13783_LED_MD 0
#define MC13783_LED_AD 1
#define MC13783_LED_KP 2
#define MC13783_LED_R1 3
#define MC13783_LED_G1 4
#define MC13783_LED_B1 5
#define MC13783_LED_R2 6
#define MC13783_LED_G2 7
#define MC13783_LED_B2 8
#define MC13783_LED_R3 9
#define MC13783_LED_G3 10
#define MC13783_LED_B3 11
#define MC13783_LED_MAX MC13783_LED_B3
int id;
const char *name;
const char *default_trigger;
/* Three or two bits current selection depending on the led */
char max_current;
};
struct mc13783_leds_platform_data {
int num_leds;
struct mc13783_led_platform_data *led;
#define MC13783_LED_TRIODE_MD (1 << 0)
#define MC13783_LED_TRIODE_AD (1 << 1)
#define MC13783_LED_TRIODE_KP (1 << 2)
#define MC13783_LED_BOOST_EN (1 << 3)
#define MC13783_LED_TC1HALF (1 << 4)
#define MC13783_LED_SLEWLIMTC (1 << 5)
#define MC13783_LED_SLEWLIMBL (1 << 6)
#define MC13783_LED_TRIODE_TC1 (1 << 7)
#define MC13783_LED_TRIODE_TC2 (1 << 8)
#define MC13783_LED_TRIODE_TC3 (1 << 9)
int flags;
#define MC13783_LED_AB_DISABLED 0
#define MC13783_LED_AB_MD1 1
#define MC13783_LED_AB_MD12 2
#define MC13783_LED_AB_MD123 3
#define MC13783_LED_AB_MD1234 4
#define MC13783_LED_AB_MD1234_AD1 5
#define MC13783_LED_AB_MD1234_AD12 6
#define MC13783_LED_AB_MD1_AD 7
char abmode;
#define MC13783_LED_ABREF_200MV 0
#define MC13783_LED_ABREF_400MV 1
#define MC13783_LED_ABREF_600MV 2
#define MC13783_LED_ABREF_800MV 3
char abref;
#define MC13783_LED_PERIOD_10MS 0
#define MC13783_LED_PERIOD_100MS 1
#define MC13783_LED_PERIOD_500MS 2
#define MC13783_LED_PERIOD_2S 3
char bl_period;
char tc1_period;
char tc2_period;
char tc3_period;
};
/* to be cleaned up */ /* to be cleaned up */
struct regulator_init_data; struct regulator_init_data;
...@@ -80,12 +144,14 @@ struct mc13783_regulator_platform_data { ...@@ -80,12 +144,14 @@ struct mc13783_regulator_platform_data {
struct mc13783_platform_data { struct mc13783_platform_data {
int num_regulators; int num_regulators;
struct mc13783_regulator_init_data *regulators; struct mc13783_regulator_init_data *regulators;
struct mc13783_leds_platform_data *leds;
#define MC13783_USE_TOUCHSCREEN (1 << 0) #define MC13783_USE_TOUCHSCREEN (1 << 0)
#define MC13783_USE_CODEC (1 << 1) #define MC13783_USE_CODEC (1 << 1)
#define MC13783_USE_ADC (1 << 2) #define MC13783_USE_ADC (1 << 2)
#define MC13783_USE_RTC (1 << 3) #define MC13783_USE_RTC (1 << 3)
#define MC13783_USE_REGULATOR (1 << 4) #define MC13783_USE_REGULATOR (1 << 4)
#define MC13783_USE_LED (1 << 5)
unsigned int flags; unsigned int flags;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment