]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - mlp-open-source/kernel.git/blob - Examples/board-plat-lm3631.c
mfd : add new mfd device LM3631-backlight and regulator
[mlp-open-source/kernel.git] / Examples / board-plat-lm3631.c
1 /*
2  *      Platform Specific LM3631 Example
3  *
4  *                      Copyright (C) 2013 Texas Instruments
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  */
12 #include <linux/i2c.h>
13 #include <linux/slab.h>
14 #include <linux/mfd/lm3631.h>
15 #include <linux/pwm.h>
17 #include "mux.h"
18 #include "board-plat-lm3631.h"
20 static struct regulator_consumer_supply lcd_vboost[] = {
21         REGULATOR_SUPPLY("lcd_boost", NULL),
22 };
24 static struct regulator_consumer_supply lcd_vio[] = {
25         REGULATOR_SUPPLY("lcd_io", NULL),
26 };
28 static struct regulator_consumer_supply lcd_vpos[] = {
29         REGULATOR_SUPPLY("lcd_vpos", NULL),
30 };
32 static struct regulator_consumer_supply lcd_vneg[] = {
33         REGULATOR_SUPPLY("lcd_vneg", NULL),
34 };
36 static struct regulator_consumer_supply lcd_vgamma[] = {
37         REGULATOR_SUPPLY("lcd_gamma", NULL),
38 };
40 struct regulator_init_data lcd_boost = {
41         .constraints = {
42                 .name = "LCD_BOOST",
43                 .min_uV = 4500000,
44                 .max_uV = 6350000,
45                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
46                 .always_on = 1,
47         },
48         .num_consumer_supplies  = ARRAY_SIZE(lcd_vboost),
49         .consumer_supplies      = lcd_vboost,
50 };
52 struct regulator_init_data lcd_cont = {
53         .constraints = {
54                 .name = "LCD_CONT",
55                 .min_uV = 1800000,
56                 .max_uV = 3300000,
57                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
58                                 REGULATOR_CHANGE_STATUS,
59         },
60         .num_consumer_supplies  = ARRAY_SIZE(lcd_vio),
61         .consumer_supplies      = lcd_vio,
62 };
64 struct regulator_init_data lcd_oref = {
65         .constraints = {
66                 .name = "LCD_OREF",
67                 .min_uV = 4000000,
68                 .max_uV = 6000000,
69                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
70                                 REGULATOR_CHANGE_STATUS,
71         },
72         .num_consumer_supplies  = ARRAY_SIZE(lcd_vgamma),
73         .consumer_supplies      = lcd_vgamma,
74 };
76 struct regulator_init_data lcd_pos = {
77         .constraints = {
78                 .name = "LCD_VPOS",
79                 .min_uV = 4000000,
80                 .max_uV = 6000000,
81                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
82                                 REGULATOR_CHANGE_STATUS,
83                 .boot_on = 1,
84         },
85         .num_consumer_supplies  = ARRAY_SIZE(lcd_vpos),
86         .consumer_supplies      = lcd_vpos,
87 };
89 struct regulator_init_data lcd_neg = {
90         .constraints = {
91                 .name = "LCD_VNEG",
92                 .min_uV = 4000000,
93                 .max_uV = 6000000,
94                 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
95                                 REGULATOR_CHANGE_STATUS,
96                 .boot_on = 1,
97         },
98         .num_consumer_supplies  = ARRAY_SIZE(lcd_vneg),
99         .consumer_supplies      = lcd_vneg,
100 };
102 struct lm3631_backlight_platform_data lm3631_bl_pdata = {
103         .name = "lcd-bl",
104         .is_full_strings = true,
105         .mode = LM3631_COMB1,
106 };
108 #define LM3631_EN_GPIO          134
109 static struct lm3631_platform_data lm3631_pdata = {
110         .en_gpio = LM3631_EN_GPIO,
111         .regulator_data = {
112                 &lcd_boost,
113                 &lcd_cont,
114                 &lcd_oref,
115                 &lcd_pos,
116                 &lcd_neg,
117         }, 
118         .bl_pdata = &lm3631_bl_pdata,
119 };
121 static struct i2c_board_info __initdata led_i2c_boardinfo[] = {
122         {
123                 I2C_BOARD_INFO("lm3631", 0x29),
124                 .platform_data = &lm3631_pdata,
125         },
126 };
128 int plat_lm3631_init(void)
130         i2c_register_board_info(4, led_i2c_boardinfo,
131                                 ARRAY_SIZE(led_i2c_boardinfo));
132         return 0;