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

Commit 827ed9ae authored by Peter Ujfalusi's avatar Peter Ujfalusi
Browse files

OMAP3: Move common twl configuration to twl-common



Reduce the amount of duplicated code by moving the common
configuration for twl4030/5030/tpsxx to the twl-common file.
Use the omap3_pmic_get_config function from board files to
properly configure the PMIC with the common fields.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Acked-by: default avatarTony Lindgren <tony@atomide.com>
parent b22f954b
Loading
Loading
Loading
Loading
+4 −38
Original line number Diff line number Diff line
@@ -231,22 +231,6 @@ static void __init omap_3430sdp_init_early(void)
	omap2_init_common_devices(hyb18m512160af6_sdrc_params, NULL);
}

static int sdp3430_batt_table[] = {
/* 0 C*/
30800, 29500, 28300, 27100,
26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
11600, 11200, 10800, 10400, 10000, 9630,   9280,   8950,   8620,   8310,
8020,   7730,   7460,   7200,   6950,   6710,   6470,   6250,   6040,   5830,
5640,   5450,   5260,   5090,   4920,   4760,   4600,   4450,   4310,   4170,
4040,   3910,   3790,   3670,   3550
};

static struct twl4030_bci_platform_data sdp3430_bci_data = {
	.battery_tmp_tbl	= sdp3430_batt_table,
	.tblsize		= ARRAY_SIZE(sdp3430_batt_table),
};

static struct omap2_hsmmc_info mmc[] = {
	{
		.mmc		= 1,
@@ -292,14 +276,6 @@ static struct twl4030_gpio_platform_data sdp3430_gpio_data = {
	.setup		= sdp3430_twl_gpio_setup,
};

static struct twl4030_usb_data sdp3430_usb_data = {
	.usb_mode	= T2_USB_MODE_ULPI,
};

static struct twl4030_madc_platform_data sdp3430_madc_data = {
	.irq_line	= 1,
};

/* regulator consumer mappings */

/* ads7846 on SPI */
@@ -463,24 +439,10 @@ static struct regulator_init_data sdp3430_vpll2 = {
	.consumer_supplies	= sdp3430_vpll2_supplies,
};

static struct twl4030_codec_audio_data sdp3430_audio;

static struct twl4030_codec_data sdp3430_codec = {
	.audio_mclk = 26000000,
	.audio = &sdp3430_audio,
};

static struct twl4030_platform_data sdp3430_twldata = {
	.irq_base	= TWL4030_IRQ_BASE,
	.irq_end	= TWL4030_IRQ_END,

	/* platform_data for children goes here */
	.bci		= &sdp3430_bci_data,
	.gpio		= &sdp3430_gpio_data,
	.madc		= &sdp3430_madc_data,
	.keypad		= &sdp3430_kp_data,
	.usb		= &sdp3430_usb_data,
	.codec		= &sdp3430_codec,

	.vaux1		= &sdp3430_vaux1,
	.vaux2		= &sdp3430_vaux2,
@@ -496,7 +458,11 @@ static struct twl4030_platform_data sdp3430_twldata = {
static int __init omap3430_i2c_init(void)
{
	/* i2c1 for PMIC only */
	omap3_pmic_get_config(&sdp3430_twldata,
			  TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_BCI |
			  TWL_COMMON_PDATA_MADC | TWL_COMMON_PDATA_AUDIO, 0);
	omap3_pmic_init("twl4030", &sdp3430_twldata);

	/* i2c2 on camera connector (for sensor control) and optional isp1301 */
	omap_register_i2c_bus(2, 400, NULL, 0);
	/* i2c3 on display connector (for DVI, tfp410) */
+1 −8
Original line number Diff line number Diff line
@@ -410,10 +410,6 @@ static struct regulator_init_data cm_t35_vpll2 = {
	.consumer_supplies	= cm_t35_vdvi_supply,
};

static struct twl4030_usb_data cm_t35_usb_data = {
	.usb_mode	= T2_USB_MODE_ULPI,
};

static uint32_t cm_t35_keymap[] = {
	KEY(0, 0, KEY_A),	KEY(0, 1, KEY_B),	KEY(0, 2, KEY_LEFT),
	KEY(1, 0, KEY_UP),	KEY(1, 1, KEY_ENTER),	KEY(1, 2, KEY_DOWN),
@@ -492,12 +488,8 @@ static struct twl4030_gpio_platform_data cm_t35_gpio_data = {
};

static struct twl4030_platform_data cm_t35_twldata = {
	.irq_base	= TWL4030_IRQ_BASE,
	.irq_end	= TWL4030_IRQ_END,

	/* platform_data for children goes here */
	.keypad		= &cm_t35_kp_data,
	.usb		= &cm_t35_usb_data,
	.gpio		= &cm_t35_gpio_data,
	.vmmc1		= &cm_t35_vmmc1,
	.vsim		= &cm_t35_vsim,
@@ -507,6 +499,7 @@ static struct twl4030_platform_data cm_t35_twldata = {

static void __init cm_t35_init_i2c(void)
{
	omap3_pmic_get_config(&cm_t35_twldata, TWL_COMMON_PDATA_USB, 0);
	omap3_pmic_init("tps65930", &cm_t35_twldata);
}

+2 −16
Original line number Diff line number Diff line
@@ -332,25 +332,9 @@ static struct regulator_init_data devkit8000_vio = {
	.consumer_supplies      = devkit8000_vio_supply,
};

static struct twl4030_usb_data devkit8000_usb_data = {
	.usb_mode	= T2_USB_MODE_ULPI,
};

static struct twl4030_codec_audio_data devkit8000_audio_data;

static struct twl4030_codec_data devkit8000_codec_data = {
	.audio_mclk = 26000000,
	.audio = &devkit8000_audio_data,
};

static struct twl4030_platform_data devkit8000_twldata = {
	.irq_base	= TWL4030_IRQ_BASE,
	.irq_end	= TWL4030_IRQ_END,

	/* platform_data for children goes here */
	.usb		= &devkit8000_usb_data,
	.gpio		= &devkit8000_gpio_data,
	.codec		= &devkit8000_codec_data,
	.vmmc1		= &devkit8000_vmmc1,
	.vdac		= &devkit8000_vdac,
	.vpll1		= &devkit8000_vpll1,
@@ -360,6 +344,8 @@ static struct twl4030_platform_data devkit8000_twldata = {

static int __init devkit8000_i2c_init(void)
{
	omap3_pmic_get_config(&devkit8000_twldata,
			  TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_AUDIO, 0);
	omap3_pmic_init("tps65930", &devkit8000_twldata);
	/* Bus 3 is attached to the DVI port where devices like the pico DLP
	 * projector don't work reliably with 400kHz */
+4 −16
Original line number Diff line number Diff line
@@ -443,10 +443,6 @@ static struct twl4030_gpio_platform_data igep_twl4030_gpio_pdata = {
	.setup		= igep_twl_gpio_setup,
};

static struct twl4030_usb_data igep_usb_data = {
	.usb_mode	= T2_USB_MODE_ULPI,
};

static int igep2_enable_dvi(struct omap_dss_device *dssdev)
{
	gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1);
@@ -522,13 +518,6 @@ static void __init igep_init_early(void)
				  m65kxxxxam_sdrc_params);
}

static struct twl4030_codec_audio_data igep2_audio_data;

static struct twl4030_codec_data igep2_codec_data = {
	.audio_mclk = 26000000,
	.audio = &igep2_audio_data,
};

static int igep2_keymap[] = {
	KEY(0, 0, KEY_LEFT),
	KEY(0, 1, KEY_RIGHT),
@@ -561,11 +550,7 @@ static struct twl4030_keypad_data igep2_keypad_pdata = {
};

static struct twl4030_platform_data igep_twldata = {
	.irq_base	= TWL4030_IRQ_BASE,
	.irq_end	= TWL4030_IRQ_END,

	/* platform_data for children goes here */
	.usb		= &igep_usb_data,
	.gpio		= &igep_twl4030_gpio_pdata,
	.vmmc1          = &igep_vmmc1,
	.vio		= &igep_vio,
@@ -581,6 +566,8 @@ static void __init igep_i2c_init(void)
{
	int ret;

	omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_USB, 0);

	if (machine_is_igep0020()) {
		/*
		 * Bus 3 is attached to the DVI port where devices like the
@@ -591,9 +578,10 @@ static void __init igep_i2c_init(void)
		if (ret)
			pr_warning("IGEP2: Could not register I2C3 bus (%d)\n", ret);

		igep_twldata.codec	= &igep2_codec_data;
		igep_twldata.keypad	= &igep2_keypad_pdata;
		igep_twldata.vpll2	= &igep2_vpll2;
		/* Use common codec data */
		omap3_pmic_get_config(&igep_twldata, TWL_COMMON_PDATA_AUDIO, 0);
	}

	omap3_pmic_init("twl4030", &igep_twldata);
+2 −13
Original line number Diff line number Diff line
@@ -199,20 +199,12 @@ static void __init omap_ldp_init_early(void)
	omap2_init_common_devices(NULL, NULL);
}

static struct twl4030_usb_data ldp_usb_data = {
	.usb_mode	= T2_USB_MODE_ULPI,
};

static struct twl4030_gpio_platform_data ldp_gpio_data = {
	.gpio_base	= OMAP_MAX_GPIO_LINES,
	.irq_base	= TWL4030_GPIO_IRQ_BASE,
	.irq_end	= TWL4030_GPIO_IRQ_END,
};

static struct twl4030_madc_platform_data ldp_madc_data = {
	.irq_line	= 1,
};

static struct regulator_consumer_supply ldp_vmmc1_supply[] = {
	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
};
@@ -253,12 +245,7 @@ static struct regulator_init_data ldp_vaux1 = {
};

static struct twl4030_platform_data ldp_twldata = {
	.irq_base	= TWL4030_IRQ_BASE,
	.irq_end	= TWL4030_IRQ_END,

	/* platform_data for children goes here */
	.madc		= &ldp_madc_data,
	.usb		= &ldp_usb_data,
	.vmmc1		= &ldp_vmmc1,
	.vaux1		= &ldp_vaux1,
	.gpio		= &ldp_gpio_data,
@@ -267,6 +254,8 @@ static struct twl4030_platform_data ldp_twldata = {

static int __init omap_i2c_init(void)
{
	omap3_pmic_get_config(&ldp_twldata,
			  TWL_COMMON_PDATA_USB | TWL_COMMON_PDATA_MADC, 0);
	omap3_pmic_init("twl4030", &ldp_twldata);
	omap_register_i2c_bus(2, 400, NULL, 0);
	omap_register_i2c_bus(3, 400, NULL, 0);
Loading