Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8eaeb939 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Samuel Ortiz
Browse files

mfd: Convert twl6040 to i2c driver, and separate it from twl core



Complete the separation of the twl6040 from the twl core since
it is a separate chip, not part of the twl6030 PMIC.

Make the needed Kconfig changes for the depending drivers at the
same time to avoid breaking the kernel build (vibra, ASoC components).

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: default avatarMark Brown <broonie@opensource.wolfsonicro.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
Acked-by: default avatarDmitry Torokhov <dtor@mail.ru>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 4accdff7
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/usb/otg.h>
#include <linux/spi/spi.h>
#include <linux/i2c/twl.h>
#include <linux/mfd/twl6040.h>
#include <linux/gpio_keys.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
@@ -560,7 +561,7 @@ static struct regulator_init_data sdp4430_vusim = {
	},
};

static struct twl4030_codec_data twl6040_codec = {
static struct twl6040_codec_data twl6040_codec = {
	/* single-step ramp for headset and handsfree */
	.hs_left_step	= 0x0f,
	.hs_right_step	= 0x0f,
@@ -568,7 +569,7 @@ static struct twl4030_codec_data twl6040_codec = {
	.hf_right_step	= 0x1d,
};

static struct twl4030_vibra_data twl6040_vibra = {
static struct twl6040_vibra_data twl6040_vibra = {
	.vibldrv_res = 8,
	.vibrdrv_res = 3,
	.viblmotor_res = 10,
@@ -577,16 +578,14 @@ static struct twl4030_vibra_data twl6040_vibra = {
	.vddvibr_uV = 0,	/* fixed volt supply - VBAT */
};

static struct twl4030_audio_data twl6040_audio = {
static struct twl6040_platform_data twl6040_data = {
	.codec		= &twl6040_codec,
	.vibra		= &twl6040_vibra,
	.audpwron_gpio	= 127,
	.naudint_irq	= OMAP44XX_IRQ_SYS_2N,
	.irq_base	= TWL6040_CODEC_IRQ_BASE,
};

static struct twl4030_platform_data sdp4430_twldata = {
	.audio		= &twl6040_audio,
	/* Regulators */
	.vusim		= &sdp4430_vusim,
	.vaux1		= &sdp4430_vaux1,
@@ -617,7 +616,8 @@ static int __init omap4_i2c_init(void)
			TWL_COMMON_REGULATOR_VCXIO |
			TWL_COMMON_REGULATOR_VUSB |
			TWL_COMMON_REGULATOR_CLK32KG);
	omap4_pmic_init("twl6030", &sdp4430_twldata);
	omap4_pmic_init("twl6030", &sdp4430_twldata,
			&twl6040_data, OMAP44XX_IRQ_SYS_2N);
	omap_register_i2c_bus(2, 400, NULL, 0);
	omap_register_i2c_bus(3, 400, sdp4430_i2c_3_boardinfo,
				ARRAY_SIZE(sdp4430_i2c_3_boardinfo));
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ static struct twl4030_platform_data sdp4430_twldata = {

static void __init omap4_i2c_init(void)
{
	omap4_pmic_init("twl6030", &sdp4430_twldata);
	omap4_pmic_init("twl6030", &sdp4430_twldata, NULL, 0);
}

static void __init omap4_init(void)
+6 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
#include <linux/gpio.h>
#include <linux/usb/otg.h>
#include <linux/i2c/twl.h>
#include <linux/mfd/twl6040.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/fixed.h>
#include <linux/wl12xx.h>
@@ -284,7 +285,7 @@ static int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
	return 0;
}

static struct twl4030_codec_data twl6040_codec = {
static struct twl6040_codec_data twl6040_codec = {
	/* single-step ramp for headset and handsfree */
	.hs_left_step	= 0x0f,
	.hs_right_step	= 0x0f,
@@ -292,17 +293,14 @@ static struct twl4030_codec_data twl6040_codec = {
	.hf_right_step	= 0x1d,
};

static struct twl4030_audio_data twl6040_audio = {
static struct twl6040_platform_data twl6040_data = {
	.codec		= &twl6040_codec,
	.audpwron_gpio	= 127,
	.naudint_irq	= OMAP44XX_IRQ_SYS_2N,
	.irq_base	= TWL6040_CODEC_IRQ_BASE,
};

/* Panda board uses the common PMIC configuration */
static struct twl4030_platform_data omap4_panda_twldata = {
	.audio		= &twl6040_audio,
};
static struct twl4030_platform_data omap4_panda_twldata;

/*
 * Display monitor features are burnt in their EEPROM as EDID data. The EEPROM
@@ -326,7 +324,8 @@ static int __init omap4_panda_i2c_init(void)
			TWL_COMMON_REGULATOR_VCXIO |
			TWL_COMMON_REGULATOR_VUSB |
			TWL_COMMON_REGULATOR_CLK32KG);
	omap4_pmic_init("twl6030", &omap4_panda_twldata);
	omap4_pmic_init("twl6030", &omap4_panda_twldata,
			&twl6040_data, OMAP44XX_IRQ_SYS_2N);
	omap_register_i2c_bus(2, 400, NULL, 0);
	/*
	 * Bus 3 is attached to the DVI port where devices like the pico DLP
+32 −5
Original line number Diff line number Diff line
@@ -37,6 +37,16 @@ static struct i2c_board_info __initdata pmic_i2c_board_info = {
	.flags		= I2C_CLIENT_WAKE,
};

static struct i2c_board_info __initdata omap4_i2c1_board_info[] = {
	{
		.addr		= 0x48,
		.flags		= I2C_CLIENT_WAKE,
	},
	{
		I2C_BOARD_INFO("twl6040", 0x4b),
	},
};

void __init omap_pmic_init(int bus, u32 clkrate,
			   const char *pmic_type, int pmic_irq,
			   struct twl4030_platform_data *pmic_data)
@@ -49,13 +59,30 @@ void __init omap_pmic_init(int bus, u32 clkrate,
	omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
}

void __init omap4_pmic_init(const char *pmic_type,
		    struct twl4030_platform_data *pmic_data,
		    struct twl6040_platform_data *twl6040_data, int twl6040_irq)
{
	/* PMIC part*/
	strncpy(omap4_i2c1_board_info[0].type, pmic_type,
		sizeof(omap4_i2c1_board_info[0].type));
	omap4_i2c1_board_info[0].irq = OMAP44XX_IRQ_SYS_1N;
	omap4_i2c1_board_info[0].platform_data = pmic_data;

	/* TWL6040 audio IC part */
	omap4_i2c1_board_info[1].irq = twl6040_irq;
	omap4_i2c1_board_info[1].platform_data = twl6040_data;

	omap_register_i2c_bus(1, 400, omap4_i2c1_board_info, 2);

}

void __init omap_pmic_late_init(void)
{
	/* Init the OMAP TWL parameters (if PMIC has been registerd) */
	if (!pmic_i2c_board_info.irq)
		return;

	if (pmic_i2c_board_info.irq)
		omap3_twl_init();
	if (omap4_i2c1_board_info[0].irq)
		omap4_twl_init();
}

+4 −6
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@


struct twl4030_platform_data;
struct twl6040_platform_data;

void omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq,
		    struct twl4030_platform_data *pmic_data);
@@ -46,12 +47,9 @@ static inline void omap3_pmic_init(const char *pmic_type,
	omap_pmic_init(1, 2600, pmic_type, INT_34XX_SYS_NIRQ, pmic_data);
}

static inline void omap4_pmic_init(const char *pmic_type,
				   struct twl4030_platform_data *pmic_data)
{
	/* Phoenix Audio IC needs I2C1 to start with 400 KHz or less */
	omap_pmic_init(1, 400, pmic_type, OMAP44XX_IRQ_SYS_1N, pmic_data);
}
void omap4_pmic_init(const char *pmic_type,
		    struct twl4030_platform_data *pmic_data,
		    struct twl6040_platform_data *audio_data, int twl6040_irq);

void omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
			   u32 pdata_flags, u32 regulators_flags);
Loading