* [PATCHv10 0/4] omap smps regulator support @ 2012-02-20 10:26 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-omap, khilman; +Cc: linux-arm-kernel Hi, Just some cosmetic changes compared to previous version: - dropped out '[patchv9 4/5] regulator: twl4030: add support for external controller', as this was accepted for merge by Mark - changed names of regulators from VDD1 / VDD2 -> vdd_mpu_iva / vdd_core in patch 3 - added document codes for TWL data manuals used as reference to commit log in patch 3 -Tero ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCHv10 0/4] omap smps regulator support @ 2012-02-20 10:26 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-arm-kernel Hi, Just some cosmetic changes compared to previous version: - dropped out '[patchv9 4/5] regulator: twl4030: add support for external controller', as this was accepted for merge by Mark - changed names of regulators from VDD1 / VDD2 -> vdd_mpu_iva / vdd_core in patch 3 - added document codes for TWL data manuals used as reference to commit log in patch 3 -Tero ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 2012-02-20 10:26 ` Tero Kristo @ 2012-02-20 10:26 ` Tero Kristo -1 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-omap, khilman; +Cc: linux-arm-kernel Beagleboard rev-c4 has a speed sorted OMAP3530 chip which can run at 720MHz. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/board-omap3beagle.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-omap2/opp3xxx_data.c | 4 ++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 7ffcd28..97678e5 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -484,6 +484,35 @@ static void __init beagle_opp_init(void) return; } + if (omap3_beagle_version == OMAP3BEAGLE_BOARD_C4) { + struct device *mpu_dev, *iva_dev; + + mpu_dev = omap_device_get_by_hwmod_name("mpu"); + iva_dev = omap_device_get_by_hwmod_name("iva"); + + if (!mpu_dev || !iva_dev) { + pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", + __func__, mpu_dev, iva_dev); + return; + } + /* Enable MPU 720MHz opp */ + r = opp_enable(mpu_dev, 720000000); + + /* Enable IVA 520MHz opp */ + r |= opp_enable(iva_dev, 520000000); + + if (r) { + pr_err("%s: failed to enable higher opp %d\n", + __func__, r); + /* + * Cleanup - disable the higher freqs - we dont care + * about the results + */ + opp_disable(mpu_dev, 720000000); + opp_disable(iva_dev, 520000000); + } + } + /* Custom OPP enabled for all xM versions */ if (cpu_is_omap3630()) { struct device *mpu_dev, *iva_dev; diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c index d95f3f9..a0f5fe1 100644 --- a/arch/arm/mach-omap2/opp3xxx_data.c +++ b/arch/arm/mach-omap2/opp3xxx_data.c @@ -98,6 +98,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { OPP_INITIALIZER("mpu", true, 550000000, OMAP3430_VDD_MPU_OPP4_UV), /* MPU OPP5 */ OPP_INITIALIZER("mpu", true, 600000000, OMAP3430_VDD_MPU_OPP5_UV), + /* MPU OPP6 : omap3530 high speed grade only */ + OPP_INITIALIZER("mpu", false, 720000000, OMAP3430_VDD_MPU_OPP5_UV), /* * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is @@ -123,6 +125,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { OPP_INITIALIZER("iva", true, 400000000, OMAP3430_VDD_MPU_OPP4_UV), /* DSP OPP5 */ OPP_INITIALIZER("iva", true, 430000000, OMAP3430_VDD_MPU_OPP5_UV), + /* DSP OPP6 : omap3530 high speed grade only */ + OPP_INITIALIZER("iva", false, 520000000, OMAP3430_VDD_MPU_OPP5_UV), }; static struct omap_opp_def __initdata omap36xx_opp_def_list[] = { -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 @ 2012-02-20 10:26 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-arm-kernel Beagleboard rev-c4 has a speed sorted OMAP3530 chip which can run at 720MHz. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/board-omap3beagle.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-omap2/opp3xxx_data.c | 4 ++++ 2 files changed, 33 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 7ffcd28..97678e5 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -484,6 +484,35 @@ static void __init beagle_opp_init(void) return; } + if (omap3_beagle_version == OMAP3BEAGLE_BOARD_C4) { + struct device *mpu_dev, *iva_dev; + + mpu_dev = omap_device_get_by_hwmod_name("mpu"); + iva_dev = omap_device_get_by_hwmod_name("iva"); + + if (!mpu_dev || !iva_dev) { + pr_err("%s: Aiee.. no mpu/dsp devices? %p %p\n", + __func__, mpu_dev, iva_dev); + return; + } + /* Enable MPU 720MHz opp */ + r = opp_enable(mpu_dev, 720000000); + + /* Enable IVA 520MHz opp */ + r |= opp_enable(iva_dev, 520000000); + + if (r) { + pr_err("%s: failed to enable higher opp %d\n", + __func__, r); + /* + * Cleanup - disable the higher freqs - we dont care + * about the results + */ + opp_disable(mpu_dev, 720000000); + opp_disable(iva_dev, 520000000); + } + } + /* Custom OPP enabled for all xM versions */ if (cpu_is_omap3630()) { struct device *mpu_dev, *iva_dev; diff --git a/arch/arm/mach-omap2/opp3xxx_data.c b/arch/arm/mach-omap2/opp3xxx_data.c index d95f3f9..a0f5fe1 100644 --- a/arch/arm/mach-omap2/opp3xxx_data.c +++ b/arch/arm/mach-omap2/opp3xxx_data.c @@ -98,6 +98,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { OPP_INITIALIZER("mpu", true, 550000000, OMAP3430_VDD_MPU_OPP4_UV), /* MPU OPP5 */ OPP_INITIALIZER("mpu", true, 600000000, OMAP3430_VDD_MPU_OPP5_UV), + /* MPU OPP6 : omap3530 high speed grade only */ + OPP_INITIALIZER("mpu", false, 720000000, OMAP3430_VDD_MPU_OPP5_UV), /* * L3 OPP1 - 41.5 MHz is disabled because: The voltage for that OPP is @@ -123,6 +125,8 @@ static struct omap_opp_def __initdata omap34xx_opp_def_list[] = { OPP_INITIALIZER("iva", true, 400000000, OMAP3430_VDD_MPU_OPP4_UV), /* DSP OPP5 */ OPP_INITIALIZER("iva", true, 430000000, OMAP3430_VDD_MPU_OPP5_UV), + /* DSP OPP6 : omap3530 high speed grade only */ + OPP_INITIALIZER("iva", false, 520000000, OMAP3430_VDD_MPU_OPP5_UV), }; static struct omap_opp_def __initdata omap36xx_opp_def_list[] = { -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 2/4] omap3: voltage: fix channel configuration 2012-02-20 10:26 ` Tero Kristo @ 2012-02-20 10:26 ` Tero Kristo -1 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-omap, khilman; +Cc: linux-arm-kernel OMAP3 uses the default settings for VDD1 channel, otherwise the settings will overlap with VDD2 and attempting to modify VDD1 voltage will actually change VDD2 voltage. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/vc3xxx_data.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c index a5ec7f8f..5d8eaf3 100644 --- a/arch/arm/mach-omap2/vc3xxx_data.c +++ b/arch/arm/mach-omap2/vc3xxx_data.c @@ -46,6 +46,7 @@ static struct omap_vc_common omap3_vc_common = { }; struct omap_vc_channel omap3_vc_mpu = { + .flags = OMAP_VC_CHANNEL_DEFAULT, .common = &omap3_vc_common, .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 2/4] omap3: voltage: fix channel configuration @ 2012-02-20 10:26 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-arm-kernel OMAP3 uses the default settings for VDD1 channel, otherwise the settings will overlap with VDD2 and attempting to modify VDD1 voltage will actually change VDD2 voltage. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/vc3xxx_data.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c index a5ec7f8f..5d8eaf3 100644 --- a/arch/arm/mach-omap2/vc3xxx_data.c +++ b/arch/arm/mach-omap2/vc3xxx_data.c @@ -46,6 +46,7 @@ static struct omap_vc_common omap3_vc_common = { }; struct omap_vc_channel omap3_vc_mpu = { + .flags = OMAP_VC_CHANNEL_DEFAULT, .common = &omap3_vc_common, .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 2012-02-20 10:26 ` Tero Kristo @ 2012-02-20 10:26 ` Tero Kristo -1 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-omap, khilman; +Cc: linux-arm-kernel VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators are needed by DVFS. Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: - SWCS019L : TWL4030 ES3.1 Data Manual rev L - SWCS030E : TWL5030 ES1.2 Data Manual rev E Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/twl-common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 10b20c6..5f62e51 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -126,6 +126,38 @@ static struct regulator_init_data omap3_vpll2_idata = { .consumer_supplies = omap3_vpll2_supplies, }; +static struct regulator_consumer_supply omap3_vdd1_supply[] = { + REGULATOR_SUPPLY("vcc", "mpu.0"), +}; + +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, +}; + void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags) { @@ -133,6 +165,10 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->irq_base = TWL4030_IRQ_BASE; if (!pmic_data->irq_end) pmic_data->irq_end = TWL4030_IRQ_END; + if (!pmic_data->vdd1) + pmic_data->vdd1 = &omap3_vdd1; + if (!pmic_data->vdd2) + pmic_data->vdd2 = &omap3_vdd2; /* Common platform data configurations */ if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 @ 2012-02-20 10:26 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-arm-kernel VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators are needed by DVFS. Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: - SWCS019L : TWL4030 ES3.1 Data Manual rev L - SWCS030E : TWL5030 ES1.2 Data Manual rev E Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/twl-common.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 10b20c6..5f62e51 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -126,6 +126,38 @@ static struct regulator_init_data omap3_vpll2_idata = { .consumer_supplies = omap3_vpll2_supplies, }; +static struct regulator_consumer_supply omap3_vdd1_supply[] = { + REGULATOR_SUPPLY("vcc", "mpu.0"), +}; + +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, +}; + void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags) { @@ -133,6 +165,10 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->irq_base = TWL4030_IRQ_BASE; if (!pmic_data->irq_end) pmic_data->irq_end = TWL4030_IRQ_END; + if (!pmic_data->vdd1) + pmic_data->vdd1 = &omap3_vdd1; + if (!pmic_data->vdd2) + pmic_data->vdd2 = &omap3_vdd2; /* Common platform data configurations */ if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 2012-02-20 10:26 ` Tero Kristo @ 2012-02-22 0:00 ` Kevin Hilman -1 siblings, 0 replies; 16+ messages in thread From: Kevin Hilman @ 2012-02-22 0:00 UTC (permalink / raw) To: Tero Kristo; +Cc: linux-omap, linux-arm-kernel Tero Kristo <t-kristo@ti.com> writes: > VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used > to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators > are needed by DVFS. > > Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: > - SWCS019L : TWL4030 ES3.1 Data Manual rev L > - SWCS030E : TWL5030 ES1.2 Data Manual rev E > > Signed-off-by: Tero Kristo <t-kristo@ti.com> Do you have a similar patch for OMAP4 support? Kevin ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 @ 2012-02-22 0:00 ` Kevin Hilman 0 siblings, 0 replies; 16+ messages in thread From: Kevin Hilman @ 2012-02-22 0:00 UTC (permalink / raw) To: linux-arm-kernel Tero Kristo <t-kristo@ti.com> writes: > VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used > to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators > are needed by DVFS. > > Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: > - SWCS019L : TWL4030 ES3.1 Data Manual rev L > - SWCS030E : TWL5030 ES1.2 Data Manual rev E > > Signed-off-by: Tero Kristo <t-kristo@ti.com> Do you have a similar patch for OMAP4 support? Kevin ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 2012-02-22 0:00 ` Kevin Hilman @ 2012-02-22 10:47 ` Tero Kristo -1 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-22 10:47 UTC (permalink / raw) To: Kevin Hilman; +Cc: linux-omap, linux-arm-kernel [-- Attachment #1: Type: text/plain, Size: 825 bytes --] On Tue, 2012-02-21 at 16:00 -0800, Kevin Hilman wrote: > Tero Kristo <t-kristo@ti.com> writes: > > > VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used > > to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators > > are needed by DVFS. > > > > Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: > > - SWCS019L : TWL4030 ES3.1 Data Manual rev L > > - SWCS030E : TWL5030 ES1.2 Data Manual rev E > > > > Signed-off-by: Tero Kristo <t-kristo@ti.com> > > Do you have a similar patch for OMAP4 support? It looks like OMAP4 support requires some changes to the twl-regulator / twl-core in addition to the twl-common.c. I have these available (just created them), should I post these out? Attached here for reference in case you need to test something quickly. -Tero [-- Attachment #2: 0001-regulator-twl6030-add-support-for-vdd1-vdd2-and-vdd3.patch --] [-- Type: text/x-patch, Size: 4563 bytes --] >From 4bee5804e8f20af94ecfe170dd4c5df984bdca6c Mon Sep 17 00:00:00 2001 From: Tero Kristo <t-kristo@ti.com> Date: Wed, 22 Feb 2012 12:36:58 +0200 Subject: [PATCH 1/2] regulator: twl6030: add support for vdd1, vdd2 and vdd3 regulators vdd1 and vdd2 are now common regulators for twl4030 and twl6030. Also added vdd3 as a new regulator for twl6030. twl6030 vdd1...vdd3 smps regulator voltages can only be controlled through the smartreflex voltage channel, thus the support for the voltage_get and set is minimal and requires external controller. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- drivers/mfd/twl-core.c | 15 ++++++++++++++ drivers/regulator/twl-regulator.c | 39 +++++++++++++++++++++++++++++++++++++ include/linux/i2c/twl.h | 5 ++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c index fae5f76..c788e36 100644 --- a/drivers/mfd/twl-core.c +++ b/drivers/mfd/twl-core.c @@ -949,6 +949,21 @@ add_children(struct twl4030_platform_data *pdata, unsigned long features) /* twl6030 regulators */ if (twl_has_regulator() && twl_class_is_6030() && !(features & TWL6025_SUBCLASS)) { + child = add_regulator(TWL6030_REG_VDD1, pdata->vdd1, + features); + if (IS_ERR(child)) + return PTR_ERR(child); + + child = add_regulator(TWL6030_REG_VDD2, pdata->vdd2, + features); + if (IS_ERR(child)) + return PTR_ERR(child); + + child = add_regulator(TWL6030_REG_VDD3, pdata->vdd3, + features); + if (IS_ERR(child)) + return PTR_ERR(child); + child = add_regulator(TWL6030_REG_VMMC, pdata->vmmc, features); if (IS_ERR(child)) diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 0afc9e1a..55a0e4d 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -561,6 +561,32 @@ static struct regulator_ops twl4030smps_ops = { .get_voltage = twl4030smps_get_voltage, }; +static int twl6030coresmps_set_voltage(struct regulator_dev *rdev, int min_uV, + int max_uV, unsigned *selector) +{ + struct twlreg_info *info = rdev_get_drvdata(rdev); + + if (info->set_voltage) + return info->set_voltage(info->data, min_uV); + + return 0; +} + +static int twl6030coresmps_get_voltage(struct regulator_dev *rdev) +{ + struct twlreg_info *info = rdev_get_drvdata(rdev); + + if (info->get_voltage) + return info->get_voltage(info->data); + + return 0; +} + +static struct regulator_ops twl6030coresmps_ops = { + .set_voltage = twl6030coresmps_set_voltage, + .get_voltage = twl6030coresmps_get_voltage, +}; + static int twl6030ldo_list_voltage(struct regulator_dev *rdev, unsigned index) { struct twlreg_info *info = rdev_get_drvdata(rdev); @@ -918,6 +944,16 @@ static struct regulator_ops twlsmps_ops = { }, \ } +#define TWL6030_ADJUSTABLE_SMPS(label) { \ + .desc = { \ + .name = #label, \ + .id = TWL6030_REG_##label, \ + .ops = &twl6030coresmps_ops, \ + .type = REGULATOR_VOLTAGE, \ + .owner = THIS_MODULE, \ + }, \ + } + #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \ .base = offset, \ .min_mV = min_mVolts, \ @@ -1019,6 +1055,9 @@ static struct twlreg_info twl_regs[] = { /* 6030 REG with base as PMC Slave Misc : 0x0030 */ /* Turnon-delay and remap configuration values for 6030 are not verified since the specification is not public */ + TWL6030_ADJUSTABLE_SMPS(VDD1), + TWL6030_ADJUSTABLE_SMPS(VDD2), + TWL6030_ADJUSTABLE_SMPS(VDD3), TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300), TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300), TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300), diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index 08a82d3..f66c031 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h @@ -712,6 +712,9 @@ struct twl4030_platform_data { struct regulator_init_data *vaux1; struct regulator_init_data *vaux2; struct regulator_init_data *vaux3; + struct regulator_init_data *vdd1; + struct regulator_init_data *vdd2; + struct regulator_init_data *vdd3; /* TWL4030 LDO regulators */ struct regulator_init_data *vpll1; struct regulator_init_data *vpll2; @@ -720,8 +723,6 @@ struct twl4030_platform_data { struct regulator_init_data *vsim; struct regulator_init_data *vaux4; struct regulator_init_data *vio; - struct regulator_init_data *vdd1; - struct regulator_init_data *vdd2; struct regulator_init_data *vintana1; struct regulator_init_data *vintana2; struct regulator_init_data *vintdig; -- 1.7.4.1 [-- Attachment #3: 0002-arm-omap4-add-common-twl-configurations-for-vdd1-vdd.patch --] [-- Type: text/x-patch, Size: 3691 bytes --] >From 463f0e24eb89d7f14112379df04b6d86eb2a4e97 Mon Sep 17 00:00:00 2001 From: Tero Kristo <t-kristo@ti.com> Date: Wed, 22 Feb 2012 12:40:40 +0200 Subject: [PATCH 2/2] arm: omap4: add common twl configurations for vdd1, vdd2 and vdd3 VDD1 is used for MPU voltage, VDD2 is for IVA and VDD3 is for CORE. These are needed by DVFS. This patch also adds external controller support for these regulators, the default I2C control channel can't be used to modify the voltages for these regulators on TWL6030. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/twl-common.c | 82 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 82 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 0c453e7..f19793e 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -349,6 +349,70 @@ static struct regulator_init_data omap4_clk32kg_idata = { }, }; +static struct regulator_consumer_supply omap4_vdd1_supply[] = { + REGULATOR_SUPPLY("vcc", "mpu.0"), +}; + +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, +}; + void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags) { @@ -357,6 +421,24 @@ void __init omap4_pmic_get_config(struct twl4030_platform_data *pmic_data, if (!pmic_data->irq_end) pmic_data->irq_end = TWL6030_IRQ_END; + 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; + } + /* Common platform data configurations */ if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) pmic_data->usb = &omap4_usb_pdata; -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 @ 2012-02-22 10:47 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-22 10:47 UTC (permalink / raw) To: linux-arm-kernel On Tue, 2012-02-21 at 16:00 -0800, Kevin Hilman wrote: > Tero Kristo <t-kristo@ti.com> writes: > > > VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used > > to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators > > are needed by DVFS. > > > > Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: > > - SWCS019L : TWL4030 ES3.1 Data Manual rev L > > - SWCS030E : TWL5030 ES1.2 Data Manual rev E > > > > Signed-off-by: Tero Kristo <t-kristo@ti.com> > > Do you have a similar patch for OMAP4 support? It looks like OMAP4 support requires some changes to the twl-regulator / twl-core in addition to the twl-common.c. I have these available (just created them), should I post these out? Attached here for reference in case you need to test something quickly. -Tero -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-regulator-twl6030-add-support-for-vdd1-vdd2-and-vdd3.patch Type: text/x-patch Size: 4563 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120222/46cb4716/attachment-0002.bin> -------------- next part -------------- A non-text attachment was scrubbed... Name: 0002-arm-omap4-add-common-twl-configurations-for-vdd1-vdd.patch Type: text/x-patch Size: 3691 bytes Desc: not available URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120222/46cb4716/attachment-0003.bin> ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 2012-02-22 10:47 ` Tero Kristo @ 2012-02-22 19:16 ` Kevin Hilman -1 siblings, 0 replies; 16+ messages in thread From: Kevin Hilman @ 2012-02-22 19:16 UTC (permalink / raw) To: t-kristo; +Cc: linux-omap, linux-arm-kernel Tero Kristo <t-kristo@ti.com> writes: > On Tue, 2012-02-21 at 16:00 -0800, Kevin Hilman wrote: >> Tero Kristo <t-kristo@ti.com> writes: >> >> > VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used >> > to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators >> > are needed by DVFS. >> > >> > Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: >> > - SWCS019L : TWL4030 ES3.1 Data Manual rev L >> > - SWCS030E : TWL5030 ES1.2 Data Manual rev E >> > >> > Signed-off-by: Tero Kristo <t-kristo@ti.com> >> >> Do you have a similar patch for OMAP4 support? > > It looks like OMAP4 support requires some changes to the twl-regulator / > twl-core in addition to the twl-common.c. I have these available (just > created them), should I post these out? Yes please. > Attached here for reference in case you need to test something > quickly. Thanks, it's easier for me to validate actual voltage scaling on OMAP4 since I have a setup to easily measure voltage rails. Thanks for these, I verified they work using my v2 CPUfreq driver on OMAP4430. Kevin ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 @ 2012-02-22 19:16 ` Kevin Hilman 0 siblings, 0 replies; 16+ messages in thread From: Kevin Hilman @ 2012-02-22 19:16 UTC (permalink / raw) To: linux-arm-kernel Tero Kristo <t-kristo@ti.com> writes: > On Tue, 2012-02-21 at 16:00 -0800, Kevin Hilman wrote: >> Tero Kristo <t-kristo@ti.com> writes: >> >> > VDD1 and VDD2 are the core voltage regulators on OMAP3. VDD1 is used >> > to control MPU/IVA voltage, and VDD2 is used for CORE. These regulators >> > are needed by DVFS. >> > >> > Voltage ranges for VDD1 and VDD2 are taken from twl4030/twl5030 data manuals: >> > - SWCS019L : TWL4030 ES3.1 Data Manual rev L >> > - SWCS030E : TWL5030 ES1.2 Data Manual rev E >> > >> > Signed-off-by: Tero Kristo <t-kristo@ti.com> >> >> Do you have a similar patch for OMAP4 support? > > It looks like OMAP4 support requires some changes to the twl-regulator / > twl-core in addition to the twl-common.c. I have these available (just > created them), should I post these out? Yes please. > Attached here for reference in case you need to test something > quickly. Thanks, it's easier for me to validate actual voltage scaling on OMAP4 since I have a setup to easily measure voltage rails. Thanks for these, I verified they work using my v2 CPUfreq driver on OMAP4430. Kevin ^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators 2012-02-20 10:26 ` Tero Kristo @ 2012-02-20 10:26 ` Tero Kristo -1 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-omap, khilman; +Cc: linux-arm-kernel VDD1 and VDD2 now use voltage processor for controlling the regulators. This is done by passing additional voltdm data during the regulator init. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/twl-common.c | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 5f62e51..0c453e7 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -31,12 +31,25 @@ #include "twl-common.h" #include "pm.h" +#include "voltage.h" static struct i2c_board_info __initdata pmic_i2c_board_info = { .addr = 0x48, .flags = I2C_CLIENT_WAKE, }; +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); +} + void __init omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, struct twl4030_platform_data *pmic_data) @@ -158,6 +171,16 @@ static struct regulator_init_data omap3_vdd2 = { .consumer_supplies = omap3_vdd2_supply, }; +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, +}; + void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags) { @@ -165,10 +188,16 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->irq_base = TWL4030_IRQ_BASE; if (!pmic_data->irq_end) pmic_data->irq_end = TWL4030_IRQ_END; - if (!pmic_data->vdd1) + if (!pmic_data->vdd1) { + omap3_vdd1.driver_data = &omap3_vdd1_drvdata; + omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva"); pmic_data->vdd1 = &omap3_vdd1; - if (!pmic_data->vdd2) + } + if (!pmic_data->vdd2) { + omap3_vdd2.driver_data = &omap3_vdd2_drvdata; + omap3_vdd2_drvdata.data = voltdm_lookup("core"); pmic_data->vdd2 = &omap3_vdd2; + } /* Common platform data configurations */ if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators @ 2012-02-20 10:26 ` Tero Kristo 0 siblings, 0 replies; 16+ messages in thread From: Tero Kristo @ 2012-02-20 10:26 UTC (permalink / raw) To: linux-arm-kernel VDD1 and VDD2 now use voltage processor for controlling the regulators. This is done by passing additional voltdm data during the regulator init. Signed-off-by: Tero Kristo <t-kristo@ti.com> --- arch/arm/mach-omap2/twl-common.c | 33 +++++++++++++++++++++++++++++++-- 1 files changed, 31 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c index 5f62e51..0c453e7 100644 --- a/arch/arm/mach-omap2/twl-common.c +++ b/arch/arm/mach-omap2/twl-common.c @@ -31,12 +31,25 @@ #include "twl-common.h" #include "pm.h" +#include "voltage.h" static struct i2c_board_info __initdata pmic_i2c_board_info = { .addr = 0x48, .flags = I2C_CLIENT_WAKE, }; +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); +} + void __init omap_pmic_init(int bus, u32 clkrate, const char *pmic_type, int pmic_irq, struct twl4030_platform_data *pmic_data) @@ -158,6 +171,16 @@ static struct regulator_init_data omap3_vdd2 = { .consumer_supplies = omap3_vdd2_supply, }; +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, +}; + void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, u32 pdata_flags, u32 regulators_flags) { @@ -165,10 +188,16 @@ void __init omap3_pmic_get_config(struct twl4030_platform_data *pmic_data, pmic_data->irq_base = TWL4030_IRQ_BASE; if (!pmic_data->irq_end) pmic_data->irq_end = TWL4030_IRQ_END; - if (!pmic_data->vdd1) + if (!pmic_data->vdd1) { + omap3_vdd1.driver_data = &omap3_vdd1_drvdata; + omap3_vdd1_drvdata.data = voltdm_lookup("mpu_iva"); pmic_data->vdd1 = &omap3_vdd1; - if (!pmic_data->vdd2) + } + if (!pmic_data->vdd2) { + omap3_vdd2.driver_data = &omap3_vdd2_drvdata; + omap3_vdd2_drvdata.data = voltdm_lookup("core"); pmic_data->vdd2 = &omap3_vdd2; + } /* Common platform data configurations */ if (pdata_flags & TWL_COMMON_PDATA_USB && !pmic_data->usb) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 16+ messages in thread
end of thread, other threads:[~2012-02-22 19:16 UTC | newest] Thread overview: 16+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-02-20 10:26 [PATCHv10 0/4] omap smps regulator support Tero Kristo 2012-02-20 10:26 ` Tero Kristo 2012-02-20 10:26 ` [PATCHv10 1/4] TEMP: OMAP3: beagle rev-c4: enable OPP6 Tero Kristo 2012-02-20 10:26 ` Tero Kristo 2012-02-20 10:26 ` [PATCHv10 2/4] omap3: voltage: fix channel configuration Tero Kristo 2012-02-20 10:26 ` Tero Kristo 2012-02-20 10:26 ` [PATCHv10 3/4] omap3: add common twl configurations for vdd1 and vdd2 Tero Kristo 2012-02-20 10:26 ` Tero Kristo 2012-02-22 0:00 ` Kevin Hilman 2012-02-22 0:00 ` Kevin Hilman 2012-02-22 10:47 ` Tero Kristo 2012-02-22 10:47 ` Tero Kristo 2012-02-22 19:16 ` Kevin Hilman 2012-02-22 19:16 ` Kevin Hilman 2012-02-20 10:26 ` [PATCHv10 4/4] omap3: twl: add external controllers for core voltage regulators Tero Kristo 2012-02-20 10:26 ` Tero Kristo
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.