2011-06-04 05:16:41 +00:00
|
|
|
/*
|
|
|
|
* twl-common.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Texas Instruments, Inc..
|
|
|
|
* Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* version 2 as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
|
|
|
* 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/i2c.h>
|
|
|
|
#include <linux/i2c/twl.h>
|
|
|
|
#include <linux/gpio.h>
|
2013-01-30 11:46:49 +00:00
|
|
|
#include <linux/string.h>
|
2013-09-27 06:23:28 +00:00
|
|
|
#include <linux/phy/phy.h>
|
2011-06-07 07:26:46 +00:00
|
|
|
#include <linux/regulator/machine.h>
|
|
|
|
#include <linux/regulator/fixed.h>
|
2011-06-04 05:16:41 +00:00
|
|
|
|
2012-08-31 17:59:07 +00:00
|
|
|
#include "soc.h"
|
2011-06-04 05:16:41 +00:00
|
|
|
#include "twl-common.h"
|
2011-11-23 22:43:01 +00:00
|
|
|
#include "pm.h"
|
2012-02-20 10:26:08 +00:00
|
|
|
#include "voltage.h"
|
2012-06-28 17:01:32 +00:00
|
|
|
#include "mux.h"
|
2011-06-04 05:16:41 +00:00
|
|
|
|
|
|
|
static struct i2c_board_info __initdata pmic_i2c_board_info = {
|
|
|
|
.addr = 0x48,
|
|
|
|
.flags = I2C_CLIENT_WAKE,
|
|
|
|
};
|
|
|
|
|
2012-06-21 08:36:02 +00:00
|
|
|
#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
|
2012-02-20 10:26:08 +00:00
|
|
|
static int twl_set_voltage(void *data, int target_uV)
|
|
|
|
{
|
|
|
|
struct voltagedomain *voltdm = (struct voltagedomain *)data;
|
|
|
|
return voltdm_scale(voltdm, target_uV);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int twl_get_voltage(void *data)
|
|
|
|
{
|
|
|
|
struct voltagedomain *voltdm = (struct voltagedomain *)data;
|
|
|
|
return voltdm_get_voltage(voltdm);
|
|
|
|
}
|
2012-06-21 08:36:02 +00:00
|
|
|
#endif
|
2012-02-20 10:26:08 +00:00
|
|
|
|
2011-06-04 05:16:41 +00:00
|
|
|
void __init omap_pmic_init(int bus, u32 clkrate,
|
|
|
|
const char *pmic_type, int pmic_irq,
|
|
|
|
struct twl4030_platform_data *pmic_data)
|
|
|
|
{
|
2012-07-16 23:56:15 +00:00
|
|
|
omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
|
2013-01-30 11:46:49 +00:00
|
|
|
strlcpy(pmic_i2c_board_info.type, pmic_type,
|
2011-06-04 05:16:41 +00:00
|
|
|
sizeof(pmic_i2c_board_info.type));
|
|
|
|
pmic_i2c_board_info.irq = pmic_irq;
|
|
|
|
pmic_i2c_board_info.platform_data = pmic_data;
|
|
|
|
|
|
|
|
omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
|
|
|
|
}
|
2011-06-07 07:26:46 +00:00
|
|
|
|
2012-04-03 08:56:51 +00:00
|
|
|
void __init omap4_pmic_init(const char *pmic_type,
|
|
|
|
struct twl4030_platform_data *pmic_data,
|
2012-09-24 09:24:48 +00:00
|
|
|
struct i2c_board_info *devices, int nr_devices)
|
2012-04-03 08:56:51 +00:00
|
|
|
{
|
|
|
|
/* PMIC part*/
|
2012-06-28 17:01:32 +00:00
|
|
|
omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
|
2012-11-08 19:08:50 +00:00
|
|
|
omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
|
2012-09-24 09:24:48 +00:00
|
|
|
omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
|
2012-04-03 08:56:51 +00:00
|
|
|
|
2012-09-24 09:24:48 +00:00
|
|
|
/* Register additional devices on i2c1 bus if needed */
|
|
|
|
if (devices)
|
|
|
|
i2c_register_board_info(1, devices, nr_devices);
|
2012-04-03 08:56:51 +00:00
|
|
|
}
|
|
|
|
|
2011-11-23 22:43:01 +00:00
|
|
|
void __init omap_pmic_late_init(void)
|
|
|
|
{
|
2012-09-24 09:24:48 +00:00
|
|
|
/* Init the OMAP TWL parameters (if PMIC has been registerd) */
|
|
|
|
if (!pmic_i2c_board_info.irq)
|
|
|
|
return;
|
|
|
|
|
|
|
|
omap3_twl_init();
|
|
|
|
omap4_twl_init();
|
2011-11-23 22:43:01 +00:00
|
|
|
}
|
|
|
|
|
2011-08-09 12:36:50 +00:00
|
|
|
#if defined(CONFIG_ARCH_OMAP3)
|
2013-09-27 06:23:28 +00:00
|
|
|
struct phy_consumer consumers[] = {
|
|
|
|
PHY_CONSUMER("musb-hdrc.0", "usb"),
|
|
|
|
};
|
|
|
|
|
|
|
|
struct phy_init_data init_data = {
|
|
|
|
.consumers = consumers,
|
|
|
|
.num_consumers = ARRAY_SIZE(consumers),
|
|
|
|
};
|
|
|
|
|
2011-06-07 07:28:54 +00:00
|
|
|
static struct twl4030_usb_data omap3_usb_pdata = {
|
|
|
|
.usb_mode = T2_USB_MODE_ULPI,
|
2013-09-27 06:23:28 +00:00
|
|
|
.init_data = &init_data,
|
2011-06-07 07:28:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int omap3_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 omap3_bci_pdata = {
|
|
|
|
.battery_tmp_tbl = omap3_batt_table,
|
|
|
|
.tblsize = ARRAY_SIZE(omap3_batt_table),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct twl4030_madc_platform_data omap3_madc_pdata = {
|
|
|
|
.irq_line = 1,
|
|
|
|
};
|
|
|
|
|
2011-05-31 12:21:13 +00:00
|
|
|
static struct twl4030_codec_data omap3_codec;
|
2011-06-07 07:28:54 +00:00
|
|
|
|
2011-05-31 12:21:13 +00:00
|
|
|
static struct twl4030_audio_data omap3_audio_pdata = {
|
2011-06-07 07:28:54 +00:00
|
|
|
.audio_mclk = 26000000,
|
2011-05-31 12:21:13 +00:00
|
|
|
.codec = &omap3_codec,
|
2011-06-07 07:28:54 +00:00
|
|
|
};
|
|
|
|
|
2011-06-07 08:38:24 +00:00
|
|
|
static struct regulator_consumer_supply omap3_vdda_dac_supplies[] = {
|
|
|
|
REGULATOR_SUPPLY("vdda_dac", "omapdss_venc"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap3_vdac_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap3_vdda_dac_supplies),
|
|
|
|
.consumer_supplies = omap3_vdda_dac_supplies,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply omap3_vpll2_supplies[] = {
|
|
|
|
REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
|
2013-05-31 07:37:53 +00:00
|
|
|
REGULATOR_SUPPLY("vdds_dsi", "omapdss_dpi.0"),
|
2011-08-03 11:00:57 +00:00
|
|
|
REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
|
2011-06-07 08:38:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap3_vpll2_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap3_vpll2_supplies),
|
|
|
|
.consumer_supplies = omap3_vpll2_supplies,
|
|
|
|
};
|
|
|
|
|
2012-02-20 10:26:07 +00:00
|
|
|
static struct regulator_consumer_supply omap3_vdd1_supply[] = {
|
ARM: OMAP2+: PM: MPU DVFS: use generic CPU device for MPU-SS
Currently, a dummy omap_device is created for the MPU sub-system so
that a device node exists for MPU DVFS. Specifically, for the
association of MPU OPPs to a device node, and so that a voltage
regulator can be mapped to a device node.
For drivers to get a handle to this device node, an OMAP-specific API
has been used. However, the kernel already has device nodes for the
CPU(s) in the system, so we can use those instead of an OMAP-specific
dummy device and then drivers (like OMAP CPUfreq) can use generic
APIs.
To use the existing CPU device nodes, modify the OPP creation and
regulator registration to use the CPU0 device node for registraion.
NOTE: this patch always uses CPU0 as the device node. On all
OMAPs today, MPU DVFS scales all CPUs together, so this will
not be a problem, but this assumption will need to be changed
if independently scalable CPUs are introduced.
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Kevin Hilman <khilman@ti.com>
2012-09-06 21:03:08 +00:00
|
|
|
REGULATOR_SUPPLY("vcc", "cpu0"),
|
2012-02-20 10:26:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply omap3_vdd2_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("vcc", "l3_main.0"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap3_vdd1 = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "vdd_mpu_iva",
|
|
|
|
.min_uV = 600000,
|
|
|
|
.max_uV = 1450000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap3_vdd1_supply),
|
|
|
|
.consumer_supplies = omap3_vdd1_supply,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap3_vdd2 = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "vdd_core",
|
|
|
|
.min_uV = 600000,
|
|
|
|
.max_uV = 1450000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap3_vdd2_supply),
|
|
|
|
.consumer_supplies = omap3_vdd2_supply,
|
|
|
|
};
|
|
|
|
|
2012-02-20 10:26:08 +00:00
|
|
|
static struct twl_regulator_driver_data omap3_vdd1_drvdata = {
|
|
|
|
.get_voltage = twl_get_voltage,
|
|
|
|
.set_voltage = twl_set_voltage,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct twl_regulator_driver_data omap3_vdd2_drvdata = {
|
|
|
|
.get_voltage = twl_get_voltage,
|
|
|
|
.set_voltage = twl_set_voltage,
|
|
|
|
};
|
|
|
|
|
2011-08-09 12:36:50 +00:00
|
|
|
void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data,
|
|
|
|
u32 pdata_flags, u32 regulators_flags)
|
|
|
|
{
|
2012-02-20 10:26:08 +00:00
|
|
|
if (!pmic_data->vdd1) {
|
|
|
|
omap3_vdd1.driver_data = &omap3_vdd1_drvdata;
|
|
|
|
omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva");
|
2012-02-20 10:26:07 +00:00
|
|
|
pmic_data->vdd1 = &omap3_vdd1;
|
2012-02-20 10:26:08 +00:00
|
|
|
}
|
|
|
|
if (!pmic_data->vdd2) {
|
|
|
|
omap3_vdd2.driver_data = &omap3_vdd2_drvdata;
|
|
|
|
omap3_vdd2_drvdata.data = voltdm_lookup("core");
|
2012-02-20 10:26:07 +00:00
|
|
|
pmic_data->vdd2 = &omap3_vdd2;
|
2012-02-20 10:26:08 +00:00
|
|
|
}
|
2011-08-09 12:36:50 +00:00
|
|
|
|
|
|
|
/* Common platform data configurations */
|
|
|
|
if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
|
|
|
|
pmic_data->usb = &omap3_usb_pdata;
|
|
|
|
|
|
|
|
if (pdata_flags & TWL_COMMON_PDATA_BCI && !pmic_data->bci)
|
|
|
|
pmic_data->bci = &omap3_bci_pdata;
|
|
|
|
|
|
|
|
if (pdata_flags & TWL_COMMON_PDATA_MADC && !pmic_data->madc)
|
|
|
|
pmic_data->madc = &omap3_madc_pdata;
|
|
|
|
|
|
|
|
if (pdata_flags & TWL_COMMON_PDATA_AUDIO && !pmic_data->audio)
|
|
|
|
pmic_data->audio = &omap3_audio_pdata;
|
|
|
|
|
|
|
|
/* Common regulator configurations */
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
|
|
|
|
pmic_data->vdac = &omap3_vdac_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VPLL2 && !pmic_data->vpll2)
|
|
|
|
pmic_data->vpll2 = &omap3_vpll2_idata;
|
|
|
|
}
|
|
|
|
#endif /* CONFIG_ARCH_OMAP3 */
|
|
|
|
|
|
|
|
#if defined(CONFIG_ARCH_OMAP4)
|
|
|
|
static struct twl4030_usb_data omap4_usb_pdata = {
|
|
|
|
};
|
|
|
|
|
2012-08-15 12:54:53 +00:00
|
|
|
static struct regulator_consumer_supply omap4_vdda_hdmi_dac_supplies[] = {
|
|
|
|
REGULATOR_SUPPLY("vdda_hdmi_dac", "omapdss_hdmi"),
|
|
|
|
};
|
|
|
|
|
2011-06-07 07:26:46 +00:00
|
|
|
static struct regulator_init_data omap4_vdac_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
2012-08-15 12:54:53 +00:00
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_vdda_hdmi_dac_supplies),
|
|
|
|
.consumer_supplies = omap4_vdda_hdmi_dac_supplies,
|
2012-05-09 21:19:16 +00:00
|
|
|
.supply_regulator = "V2V1",
|
2011-06-07 07:26:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vaux2_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1200000,
|
|
|
|
.max_uV = 2800000,
|
|
|
|
.apply_uV = true,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
|
|
|
|
| REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vaux3_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1000000,
|
|
|
|
.max_uV = 3000000,
|
|
|
|
.apply_uV = true,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
|
|
|
|
| REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply omap4_vmmc_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
|
|
|
|
};
|
|
|
|
|
|
|
|
/* VMMC1 for MMC1 card */
|
|
|
|
static struct regulator_init_data omap4_vmmc_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1200000,
|
|
|
|
.max_uV = 3000000,
|
|
|
|
.apply_uV = true,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
|
|
|
|
| REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_vmmc_supply),
|
|
|
|
.consumer_supplies = omap4_vmmc_supply,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vpp_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 2500000,
|
|
|
|
.apply_uV = true,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
|
|
|
|
| REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vana_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 2100000,
|
|
|
|
.max_uV = 2100000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2011-08-03 11:13:52 +00:00
|
|
|
static struct regulator_consumer_supply omap4_vcxio_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("vdds_dsi", "omapdss_dss"),
|
|
|
|
REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.0"),
|
|
|
|
REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi.1"),
|
|
|
|
};
|
|
|
|
|
2011-06-07 07:26:46 +00:00
|
|
|
static struct regulator_init_data omap4_vcxio_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
2011-08-03 11:13:52 +00:00
|
|
|
.always_on = true,
|
2011-06-07 07:26:46 +00:00
|
|
|
},
|
2011-08-03 11:13:52 +00:00
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_vcxio_supply),
|
|
|
|
.consumer_supplies = omap4_vcxio_supply,
|
2012-05-09 21:19:16 +00:00
|
|
|
.supply_regulator = "V2V1",
|
2011-06-07 07:26:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vusb_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 3300000,
|
|
|
|
.max_uV = 3300000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_clk32kg_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2012-02-22 10:40:40 +00:00
|
|
|
static struct regulator_consumer_supply omap4_vdd1_supply[] = {
|
2012-11-05 23:46:36 +00:00
|
|
|
REGULATOR_SUPPLY("vcc", "cpu0"),
|
2012-02-22 10:40:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply omap4_vdd2_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("vcc", "iva.0"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply omap4_vdd3_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("vcc", "l3_main.0"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vdd1 = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "vdd_mpu",
|
|
|
|
.min_uV = 500000,
|
|
|
|
.max_uV = 1500000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_vdd1_supply),
|
|
|
|
.consumer_supplies = omap4_vdd1_supply,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vdd2 = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "vdd_iva",
|
|
|
|
.min_uV = 500000,
|
|
|
|
.max_uV = 1500000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_vdd2_supply),
|
|
|
|
.consumer_supplies = omap4_vdd2_supply,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_vdd3 = {
|
|
|
|
.constraints = {
|
|
|
|
.name = "vdd_core",
|
|
|
|
.min_uV = 500000,
|
|
|
|
.max_uV = 1500000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_vdd3_supply),
|
|
|
|
.consumer_supplies = omap4_vdd3_supply,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static struct twl_regulator_driver_data omap4_vdd1_drvdata = {
|
|
|
|
.get_voltage = twl_get_voltage,
|
|
|
|
.set_voltage = twl_set_voltage,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct twl_regulator_driver_data omap4_vdd2_drvdata = {
|
|
|
|
.get_voltage = twl_get_voltage,
|
|
|
|
.set_voltage = twl_set_voltage,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct twl_regulator_driver_data omap4_vdd3_drvdata = {
|
|
|
|
.get_voltage = twl_get_voltage,
|
|
|
|
.set_voltage = twl_set_voltage,
|
|
|
|
};
|
|
|
|
|
2012-05-09 21:19:16 +00:00
|
|
|
static struct regulator_consumer_supply omap4_v1v8_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("vio", "1-004b"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_v1v8_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 1800000,
|
|
|
|
.max_uV = 1800000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
.always_on = true,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_v1v8_supply),
|
|
|
|
.consumer_supplies = omap4_v1v8_supply,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_consumer_supply omap4_v2v1_supply[] = {
|
|
|
|
REGULATOR_SUPPLY("v2v1", "1-004b"),
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct regulator_init_data omap4_v2v1_idata = {
|
|
|
|
.constraints = {
|
|
|
|
.min_uV = 2100000,
|
|
|
|
.max_uV = 2100000,
|
|
|
|
.valid_modes_mask = REGULATOR_MODE_NORMAL
|
|
|
|
| REGULATOR_MODE_STANDBY,
|
|
|
|
.valid_ops_mask = REGULATOR_CHANGE_MODE
|
|
|
|
| REGULATOR_CHANGE_STATUS,
|
|
|
|
},
|
|
|
|
.num_consumer_supplies = ARRAY_SIZE(omap4_v2v1_supply),
|
|
|
|
.consumer_supplies = omap4_v2v1_supply,
|
|
|
|
};
|
|
|
|
|
2011-06-07 07:26:46 +00:00
|
|
|
void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data,
|
|
|
|
u32 pdata_flags, u32 regulators_flags)
|
|
|
|
{
|
2012-02-22 10:40:40 +00:00
|
|
|
if (!pmic_data->vdd1) {
|
|
|
|
omap4_vdd1.driver_data = &omap4_vdd1_drvdata;
|
|
|
|
omap4_vdd1_drvdata.data = voltdm_lookup("mpu");
|
|
|
|
pmic_data->vdd1 = &omap4_vdd1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pmic_data->vdd2) {
|
|
|
|
omap4_vdd2.driver_data = &omap4_vdd2_drvdata;
|
|
|
|
omap4_vdd2_drvdata.data = voltdm_lookup("iva");
|
|
|
|
pmic_data->vdd2 = &omap4_vdd2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!pmic_data->vdd3) {
|
|
|
|
omap4_vdd3.driver_data = &omap4_vdd3_drvdata;
|
|
|
|
omap4_vdd3_drvdata.data = voltdm_lookup("core");
|
|
|
|
pmic_data->vdd3 = &omap4_vdd3;
|
|
|
|
}
|
|
|
|
|
2011-06-07 07:26:46 +00:00
|
|
|
/* Common platform data configurations */
|
|
|
|
if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb)
|
|
|
|
pmic_data->usb = &omap4_usb_pdata;
|
|
|
|
|
|
|
|
/* Common regulator configurations */
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VDAC && !pmic_data->vdac)
|
|
|
|
pmic_data->vdac = &omap4_vdac_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VAUX2 && !pmic_data->vaux2)
|
|
|
|
pmic_data->vaux2 = &omap4_vaux2_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VAUX3 && !pmic_data->vaux3)
|
|
|
|
pmic_data->vaux3 = &omap4_vaux3_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VMMC && !pmic_data->vmmc)
|
|
|
|
pmic_data->vmmc = &omap4_vmmc_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VPP && !pmic_data->vpp)
|
|
|
|
pmic_data->vpp = &omap4_vpp_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VANA && !pmic_data->vana)
|
|
|
|
pmic_data->vana = &omap4_vana_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VCXIO && !pmic_data->vcxio)
|
|
|
|
pmic_data->vcxio = &omap4_vcxio_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_VUSB && !pmic_data->vusb)
|
|
|
|
pmic_data->vusb = &omap4_vusb_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_CLK32KG &&
|
|
|
|
!pmic_data->clk32kg)
|
|
|
|
pmic_data->clk32kg = &omap4_clk32kg_idata;
|
2012-05-09 21:19:16 +00:00
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_V1V8 && !pmic_data->v1v8)
|
|
|
|
pmic_data->v1v8 = &omap4_v1v8_idata;
|
|
|
|
|
|
|
|
if (regulators_flags & TWL_COMMON_REGULATOR_V2V1 && !pmic_data->v2v1)
|
|
|
|
pmic_data->v2v1 = &omap4_v2v1_idata;
|
2011-06-07 07:26:46 +00:00
|
|
|
}
|
2011-08-09 12:36:50 +00:00
|
|
|
#endif /* CONFIG_ARCH_OMAP4 */
|
2012-08-14 09:07:57 +00:00
|
|
|
|
|
|
|
#if defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030) || \
|
|
|
|
defined(CONFIG_SND_OMAP_SOC_OMAP_TWL4030_MODULE)
|
|
|
|
#include <linux/platform_data/omap-twl4030.h>
|
|
|
|
|
2012-12-05 13:40:30 +00:00
|
|
|
/* Commonly used configuration */
|
2012-08-14 09:07:57 +00:00
|
|
|
static struct omap_tw4030_pdata omap_twl4030_audio_data;
|
|
|
|
|
|
|
|
static struct platform_device audio_device = {
|
|
|
|
.name = "omap-twl4030",
|
|
|
|
.id = -1,
|
|
|
|
};
|
|
|
|
|
2013-02-05 18:36:21 +00:00
|
|
|
void omap_twl4030_audio_init(char *card_name,
|
2012-12-05 13:45:23 +00:00
|
|
|
struct omap_tw4030_pdata *pdata)
|
2012-08-14 09:07:57 +00:00
|
|
|
{
|
2012-12-05 13:45:23 +00:00
|
|
|
if (!pdata)
|
|
|
|
pdata = &omap_twl4030_audio_data;
|
|
|
|
|
|
|
|
pdata->card_name = card_name;
|
|
|
|
|
|
|
|
audio_device.dev.platform_data = pdata;
|
2012-08-14 09:07:57 +00:00
|
|
|
platform_device_register(&audio_device);
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* SOC_OMAP_TWL4030 */
|
2013-02-05 18:36:21 +00:00
|
|
|
void omap_twl4030_audio_init(char *card_name,
|
2012-12-05 13:45:23 +00:00
|
|
|
struct omap_tw4030_pdata *pdata)
|
2012-08-14 09:07:57 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif /* SOC_OMAP_TWL4030 */
|