mfd: Add ASIC3 LED support
Subsystems (2)
PATCH v2 1/1 mfd: Add ASIC3 LED support
Add LED support for the HTC ASIC3. Underlying support is provided by the mfd/asic3 and leds/leds-asic3 drivers. An example configuration is provided by the pxa/hx4700 platform.
Signed-off-by Paul Parsons <[email protected]>
---
drivers/leds/Kconfig +10 -0
@@ -379,6 +379,16 @@ config LEDS_NETXBIG and 5Big Network v2 boards. The LEDs are wired to a CPLD and are controlled through a GPIO extension bus. +config LEDS_ASIC3 + bool "LED support for the HTC ASIC3" + depends on MFD_ASIC3 + default y + help + This option enables support for the LEDs on the HTC ASIC3. The HTC + ASIC3 LED GPIOs are inputs, not outputs, thus the leds-gpio driver + cannot be used. This driver supports hardware blinking with an on+off + period from 62ms to 125s. Say Y to enable LEDs on the HP iPAQ hx4700. + config LEDS_TRIGGERS bool "LED Trigger support" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_LEDS_DELL_NETBOOKS) += dell obj-$(CONFIG_LEDS_MC13783) += leds-mc13783.o obj-$(CONFIG_LEDS_NS2) += leds-ns2.o obj-$(CONFIG_LEDS_NETXBIG) += leds-netxbig.o +obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o # LED SPI Drivers obj-$(CONFIG_LEDS_DAC124S085) += leds-dac124s085.o
drivers/leds/leds-asic3.c +177 -0
177 lines not on this page · raw message
drivers/mfd/asic3.c +58 -5
92 lines not on this page · raw message
include/linux/mfd/asic3.h +19 -3
@@ -16,6 +16,13 @@#include <linux/types.h> +struct led_classdev ; +struct asic3_led { +const char *name; +const char *default_trigger; +struct led_classdev *cdev; +}; +struct asic3_platform_data {u16 *gpio_config;unsigned int gpio_config_num;
@@ -23,6 +30,8 @@ struct asic3_platform_data {unsigned int irq_base;unsigned int gpio_base; + +struct asic3_led *leds; };#define ASIC3_NUM_GPIO_BANKS 4
@@ -111,9 +120,9 @@ struct asic3_platform_data {#define ASIC3_GPIOA11_PWM0 ASIC3_CONFIG_GPIO(11, 1, 1, 0)#define ASIC3_GPIOA12_PWM1 ASIC3_CONFIG_GPIO(12, 1, 1, 0)#define ASIC3_GPIOA15_CONTROL_CX ASIC3_CONFIG_GPIO(15, 1, 1, 0) -#define ASIC3_GPIOC0_LED0 ASIC3_CONFIG_GPIO(32, 1, 1, 0) -#define ASIC3_GPIOC1_LED1 ASIC3_CONFIG_GPIO(33, 1, 1, 0) -#define ASIC3_GPIOC2_LED2 ASIC3_CONFIG_GPIO(34, 1, 1, 0) +#define ASIC3_GPIOC0_LED0 ASIC3_CONFIG_GPIO(32, 1, 0, 0) +#define ASIC3_GPIOC1_LED1 ASIC3_CONFIG_GPIO(33, 1, 0, 0) +#define ASIC3_GPIOC2_LED2 ASIC3_CONFIG_GPIO(34, 1, 0, 0)#define ASIC3_GPIOC3_SPI_RXD ASIC3_CONFIG_GPIO(35, 1, 0, 0)#define ASIC3_GPIOC4_CF_nCD ASIC3_CONFIG_GPIO(36, 1, 0, 0)#define ASIC3_GPIOC4_SPI_TXD ASIC3_CONFIG_GPIO(36, 1, 1, 0)
@@ -152,6 +161,7 @@ struct asic3_platform_data {#define PWM_TIMEBASE_VALUE (x) ((x)&0xf)/* Low 4 bits sets time base */ #define PWM_TIMEBASE_ENABLE (1 << 4)/* Enable clock */ +#define ASIC3_NUM_LEDS 3#define ASIC3_LED_0_Base 0x0700#define ASIC3_LED_1_Base 0x0800#define ASIC3_LED_2_Base 0x0900
@@ -293,4 +303,10 @@ struct asic3_platform_data {#define ASIC3_MAP_SIZE_32BIT 0x2000#define ASIC3_MAP_SIZE_16BIT 0x1000 +/* Functions needed by leds-asic3 */ + +struct asic3 ; +extern void asic3_write_register (struct asic3 *asic,unsigned int reg,u32 val); +extern u32 asic3_read_register (struct asic3 *asic,unsigned int reg); +#endif /* __ASIC3_H__ */