提交 5cbe786a 编写于 作者: P Peter Ujfalusi 提交者: Samuel Ortiz

mfd: twl6040: Add twl6040-gpio child

Add needed platform data structure and code to be able to load
the GPO child of twl6040.
Update the devicetree binding documentation at the same time.
Signed-off-by: NSergio Aguirre <saaguirre@ti.com>
Signed-off-by: NPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 35736dce
Texas Instruments TWL6040 family Texas Instruments TWL6040 family
The TWL6040s are 8-channel high quality low-power audio codecs providing audio The TWL6040s are 8-channel high quality low-power audio codecs providing audio,
and vibra functionality on OMAP4+ platforms. vibra and GPO functionality on OMAP4+ platforms.
They are connected ot the host processor via i2c for commands, McPDM for audio They are connected ot the host processor via i2c for commands, McPDM for audio
data and commands. data and commands.
...@@ -10,6 +10,8 @@ Required properties: ...@@ -10,6 +10,8 @@ Required properties:
- reg: must be 0x4b for i2c address - reg: must be 0x4b for i2c address
- interrupts: twl6040 has one interrupt line connecteded to the main SoC - interrupts: twl6040 has one interrupt line connecteded to the main SoC
- interrupt-parent: The parent interrupt controller - interrupt-parent: The parent interrupt controller
- gpio-controller:
- #gpio-cells = <1>: twl6040 provides GPO lines.
- twl6040,audpwron-gpio: Power on GPIO line for the twl6040 - twl6040,audpwron-gpio: Power on GPIO line for the twl6040
- vio-supply: Regulator for the twl6040 VIO supply - vio-supply: Regulator for the twl6040 VIO supply
...@@ -37,7 +39,6 @@ Example: ...@@ -37,7 +39,6 @@ Example:
&i2c1 { &i2c1 {
twl6040: twl@4b { twl6040: twl@4b {
compatible = "ti,twl6040"; compatible = "ti,twl6040";
reg = <0x4b>;
interrupts = <0 119 4>; interrupts = <0 119 4>;
interrupt-parent = <&gic>; interrupt-parent = <&gic>;
...@@ -60,3 +61,5 @@ Example: ...@@ -60,3 +61,5 @@ Example:
}; };
}; };
}; };
/include/ "twl6040.dtsi"
...@@ -631,6 +631,21 @@ static int __devinit twl6040_probe(struct i2c_client *client, ...@@ -631,6 +631,21 @@ static int __devinit twl6040_probe(struct i2c_client *client,
children++; children++;
} }
/*
* Enable the GPO driver in the following cases:
* DT booted kernel or legacy boot with valid gpo platform_data
*/
if (!pdata || (pdata && pdata->gpo)) {
cell = &twl6040->cells[children];
cell->name = "twl6040-gpo";
if (pdata) {
cell->platform_data = pdata->gpo;
cell->pdata_size = sizeof(*pdata->gpo);
}
children++;
}
ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children, ret = mfd_add_devices(&client->dev, -1, twl6040->cells, children,
NULL, 0, NULL); NULL, 0, NULL);
if (ret) if (ret)
......
...@@ -158,7 +158,7 @@ ...@@ -158,7 +158,7 @@
#define TWL6040_VIBROCDET 0x20 #define TWL6040_VIBROCDET 0x20
#define TWL6040_TSHUTDET 0x40 #define TWL6040_TSHUTDET 0x40
#define TWL6040_CELLS 2 #define TWL6040_CELLS 3
#define TWL6040_REV_ES1_0 0x00 #define TWL6040_REV_ES1_0 0x00
#define TWL6040_REV_ES1_1 0x01 /* Rev ES1.1 and ES1.2 */ #define TWL6040_REV_ES1_1 0x01 /* Rev ES1.1 and ES1.2 */
...@@ -176,6 +176,8 @@ ...@@ -176,6 +176,8 @@
#define TWL6040_SYSCLK_SEL_LPPLL 0 #define TWL6040_SYSCLK_SEL_LPPLL 0
#define TWL6040_SYSCLK_SEL_HPPLL 1 #define TWL6040_SYSCLK_SEL_HPPLL 1
#define TWL6040_GPO_MAX 3
struct twl6040_codec_data { struct twl6040_codec_data {
u16 hs_left_step; u16 hs_left_step;
u16 hs_right_step; u16 hs_right_step;
...@@ -192,12 +194,17 @@ struct twl6040_vibra_data { ...@@ -192,12 +194,17 @@ struct twl6040_vibra_data {
int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */
}; };
struct twl6040_gpo_data {
int gpio_base;
};
struct twl6040_platform_data { struct twl6040_platform_data {
int audpwron_gpio; /* audio power-on gpio */ int audpwron_gpio; /* audio power-on gpio */
unsigned int irq_base; unsigned int irq_base;
struct twl6040_codec_data *codec; struct twl6040_codec_data *codec;
struct twl6040_vibra_data *vibra; struct twl6040_vibra_data *vibra;
struct twl6040_gpo_data *gpo;
}; };
struct regmap; struct regmap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册