Blackfin: bf537-stamp: add example AD7416 IIO resources
[safe/jmp/linux-2.6] / arch / blackfin / mach-bf537 / boards / stamp.c
index 8a138f0..4aec6c0 100644 (file)
@@ -528,8 +528,8 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
 };
 #endif
 
-#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
-       || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
+#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
+       || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
 static struct bfin5xx_spi_chip ad1836_spi_chip_info = {
        .enable_dma = 0,
        .bits_per_word = 16,
@@ -663,6 +663,18 @@ static struct bfin5xx_spi_chip ad2s90_spi_chip_info = {
 };
 #endif
 
+#if defined(CONFIG_AD2S120X) || defined(CONFIG_AD2S120X_MODULE)
+unsigned short ad2s120x_platform_data[] = {
+       /* used as SAMPLE and RDVEL */
+       GPIO_PF5, GPIO_PF6, 0
+};
+
+static struct bfin5xx_spi_chip ad2s120x_spi_chip_info = {
+       .enable_dma = 0,
+       .bits_per_word = 16,
+};
+#endif
+
 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
 #define MMC_SPI_CARD_DETECT_INT IRQ_PF5
 
@@ -941,13 +953,14 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        },
 #endif
 
-#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
-       || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
+#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \
+       || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE)
        {
-               .modalias = "ad1836",
+               .modalias = "ad183x",
                .max_speed_hz = 3125000,     /* max spi clock (SCK) speed in HZ */
                .bus_num = 0,
                .chip_select = 4,/* CONFIG_SND_BLACKFIN_SPI_PFBIT */
+               .platform_data = "ad1836", /* only includes chip name for the moment */
                .controller_data = &ad1836_spi_chip_info,
                .mode = SPI_MODE_3,
        },
@@ -987,6 +1000,16 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        },
 #endif
 
+#if defined(CONFIG_AD2S120X) || defined(CONFIG_AD2S120X_MODULE)
+       {
+               .modalias = "ad2s120x",
+               .bus_num = 0,
+               .chip_select = 4,            /* CS, change it for your board */
+               .platform_data = ad2s120x_platform_data,
+               .controller_data = &ad2s120x_spi_chip_info,
+       },
+#endif
+
 #if defined(CONFIG_MMC_SPI) || defined(CONFIG_MMC_SPI_MODULE)
        {
                .modalias = "mmc_spi",
@@ -1659,6 +1682,48 @@ static struct adp8870_backlight_platform_data adp8870_pdata = {
 };
 #endif
 
+#if defined(CONFIG_BACKLIGHT_ADP8860) || defined(CONFIG_BACKLIGHT_ADP8860_MODULE)
+#include <linux/i2c/adp8860.h>
+static struct led_info adp8860_leds[] = {
+       {
+               .name = "adp8860-led7",
+               .default_trigger = "none",
+               .flags = ADP8860_LED_D7 | ADP8860_LED_OFFT_600ms,
+       },
+};
+
+static struct adp8860_backlight_platform_data adp8860_pdata = {
+       .bl_led_assign = ADP8860_BL_D1 | ADP8860_BL_D2 | ADP8860_BL_D3 |
+                        ADP8860_BL_D4 | ADP8860_BL_D5 | ADP8860_BL_D6, /* 1 = Backlight 0 = Individual LED */
+
+       .bl_fade_in = ADP8860_FADE_T_1200ms,            /* Backlight Fade-In Timer */
+       .bl_fade_out = ADP8860_FADE_T_1200ms,           /* Backlight Fade-Out Timer */
+       .bl_fade_law = ADP8860_FADE_LAW_CUBIC1,         /* fade-on/fade-off transfer characteristic */
+
+       .en_ambl_sens = 1,                              /* 1 = enable ambient light sensor */
+       .abml_filt = ADP8860_BL_AMBL_FILT_320ms,        /* Light sensor filter time */
+
+       .l1_daylight_max = ADP8860_BL_CUR_mA(20),       /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
+       .l1_daylight_dim = ADP8860_BL_CUR_mA(0),        /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
+       .l2_office_max = ADP8860_BL_CUR_mA(6),          /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
+       .l2_office_dim = ADP8860_BL_CUR_mA(0),          /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
+       .l3_dark_max = ADP8860_BL_CUR_mA(2),            /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
+       .l3_dark_dim = ADP8860_BL_CUR_mA(0),            /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
+
+       .l2_trip = ADP8860_L2_COMP_CURR_uA(710),        /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
+       .l2_hyst = ADP8860_L2_COMP_CURR_uA(73),         /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
+       .l3_trip = ADP8860_L3_COMP_CURR_uA(43),         /* use L3_COMP_CURR_uA(I) 0 <= I <= 138 uA */
+       .l3_hyst = ADP8860_L3_COMP_CURR_uA(11),         /* use L3_COMP_CURR_uA(I) 0 <= I <= 138 uA */
+
+       .leds = adp8860_leds,
+       .num_leds = ARRAY_SIZE(adp8860_leds),
+       .led_fade_law = ADP8860_FADE_LAW_SQUARE,        /* fade-on/fade-off transfer characteristic */
+       .led_fade_in = ADP8860_FADE_T_600ms,
+       .led_fade_out = ADP8860_FADE_T_600ms,
+       .led_on_time = ADP8860_LED_ONT_200ms,
+};
+#endif
+
 #if defined(CONFIG_REGULATOR_AD5398) || defined(CONFIG_REGULATOR_AD5398_MODULE)
 static struct regulator_consumer_supply ad5398_consumer = {
        .supply = "current",
@@ -1740,6 +1805,32 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 
+#if defined(CONFIG_AD7414) || defined(CONFIG_AD7414_MODULE)
+       {
+               I2C_BOARD_INFO("ad7414", 0x9),
+               .irq = IRQ_PG5,
+               /*
+                * platform_data pointer is borrwoed by the driver to
+                * store custimer defined IRQ ALART level mode.
+                * only IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW are valid.
+                */
+               .platform_data = (void *)IRQF_TRIGGER_LOW,
+       },
+#endif
+
+#if defined(CONFIG_AD7416) || defined(CONFIG_AD7416_MODULE)
+       {
+               I2C_BOARD_INFO("ad7417", 0xb),
+               .irq = IRQ_PG5,
+               /*
+                * platform_data pointer is borrwoed by the driver to
+                * store custimer defined IRQ ALART level mode.
+                * only IRQF_TRIGGER_HIGH and IRQF_TRIGGER_LOW are valid.
+                */
+               .platform_data = (void *)IRQF_TRIGGER_LOW,
+       },
+#endif
+
 #if defined(CONFIG_BFIN_TWI_LCD) || defined(CONFIG_BFIN_TWI_LCD_MODULE)
        {
                I2C_BOARD_INFO("pcf8574_lcd", 0x22),
@@ -1832,6 +1923,12 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
                .platform_data = (void *)&ad5398_i2c_platform_data,
        },
 #endif
+#if defined(CONFIG_BACKLIGHT_ADP8860) || defined(CONFIG_BACKLIGHT_ADP8860_MODULE)
+       {
+               I2C_BOARD_INFO("adp8860", 0x2A),
+               .platform_data = (void *)&adp8860_pdata,
+       },
+#endif
 };
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
@@ -2033,6 +2130,8 @@ static struct regulator_init_data adp_switch_regulator_data[] = {
                .constraints = {
                        .name = REGULATOR_ADP122,
                        .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+                       .min_uA = 0,
+                       .max_uA = 300000,
                },
                .num_consumer_supplies = 1,     /* only 1 */
                .consumer_supplies     = &adp122_consumers,
@@ -2042,6 +2141,8 @@ static struct regulator_init_data adp_switch_regulator_data[] = {
                .constraints = {
                        .name = REGULATOR_ADP150,
                        .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+                       .min_uA = 0,
+                       .max_uA = 150000,
                },
                .num_consumer_supplies = 1,     /* only 1 */
                .consumer_supplies     = &adp150_consumers,