diff mbox

[1/2] regulator: tps65917: Add bypass ops for ldo1 and ldo2 regulators

Message ID 1449815322-22868-2-git-send-email-j-keerthy@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

J, KEERTHY Dec. 11, 2015, 6:28 a.m. UTC
set/get_bypass ops were missing for ldo1/ldo2 regulators which
support bypass mode. Adding the bypass ops for ldo1 and ldo2.
This helps consumers configure ldo1 and ldo2 in bypass mode or
remove bypass mode if need be.

Signed-off-by: Keerthy <j-keerthy@ti.com>
Reported-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/regulator/palmas-regulator.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Comments

Nishanth Menon Dec. 11, 2015, 4:47 p.m. UTC | #1
On 12/11/2015 12:28 AM, Keerthy wrote:
> set/get_bypass ops were missing for ldo1/ldo2 regulators which
> support bypass mode. Adding the bypass ops for ldo1 and ldo2.
> This helps consumers configure ldo1 and ldo2 in bypass mode or
> remove bypass mode if need be.
> 
> Signed-off-by: Keerthy <j-keerthy@ti.com>
> Reported-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
>  drivers/regulator/palmas-regulator.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
> index 8217613..776b59a 100644
> --- a/drivers/regulator/palmas-regulator.c
> +++ b/drivers/regulator/palmas-regulator.c
> @@ -389,6 +389,7 @@ static unsigned int palmas_smps_ramp_delay[4] = {0, 10000, 5000, 2500};
>  #define SMPS10_BOOST_EN			(1<<2)
>  #define SMPS10_BYPASS_EN		(1<<1)
>  #define SMPS10_SWITCH_EN		(1<<0)
> +#define TPS65917_LDO_1_2_BYPASS_EN	BIT(6)


This also applies to TWL6035/37, TPS659038 LDO9 as well.
why not do it for all? considering the bit definition is the same as well?

>  
>  #define REGULATOR_SLAVE			0
>  
> @@ -639,6 +640,19 @@ static struct regulator_ops tps65917_ops_ldo = {
>  	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
>  };
>  
> +static struct regulator_ops tps65917_ops_ldo_1_2 = {
> +	.is_enabled		= palmas_is_enabled_ldo,
> +	.enable			= regulator_enable_regmap,
> +	.disable		= regulator_disable_regmap,
> +	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
> +	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
> +	.list_voltage		= regulator_list_voltage_linear,
> +	.map_voltage		= regulator_map_voltage_linear,
> +	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
> +	.set_bypass		= regulator_set_bypass_regmap,
> +	.get_bypass		= regulator_get_bypass_regmap,
> +};
> +
>  static int palmas_regulator_config_external(struct palmas *palmas, int id,
>  		struct palmas_reg_init *reg_init)
>  {
> @@ -1019,6 +1033,12 @@ static int tps65917_ldo_registration(struct palmas_pmic *pmic,
>  			 * It is of the order of ~60mV/uS.
>  			 */
>  			desc->ramp_delay = 2500;
> +			if (id == TPS65917_REG_LDO1 ||
> +			    id == TPS65917_REG_LDO2) {
> +				desc->ops = &tps65917_ops_ldo_1_2;
> +				desc->bypass_reg = desc->enable_reg;
> +				desc->bypass_mask = TPS65917_LDO_1_2_BYPASS_EN;
> +			}
>  		} else {
>  			desc->n_voltages = 1;
>  			if (reg_init && reg_init->roof_floor)
>
Keerthy Dec. 14, 2015, 3:16 a.m. UTC | #2
On Friday 11 December 2015 10:17 PM, Nishanth Menon wrote:
> On 12/11/2015 12:28 AM, Keerthy wrote:
>> set/get_bypass ops were missing for ldo1/ldo2 regulators which
>> support bypass mode. Adding the bypass ops for ldo1 and ldo2.
>> This helps consumers configure ldo1 and ldo2 in bypass mode or
>> remove bypass mode if need be.
>>
>> Signed-off-by: Keerthy <j-keerthy@ti.com>
>> Reported-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>>   drivers/regulator/palmas-regulator.c | 20 ++++++++++++++++++++
>>   1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
>> index 8217613..776b59a 100644
>> --- a/drivers/regulator/palmas-regulator.c
>> +++ b/drivers/regulator/palmas-regulator.c
>> @@ -389,6 +389,7 @@ static unsigned int palmas_smps_ramp_delay[4] = {0, 10000, 5000, 2500};
>>   #define SMPS10_BOOST_EN			(1<<2)
>>   #define SMPS10_BYPASS_EN		(1<<1)
>>   #define SMPS10_SWITCH_EN		(1<<0)
>> +#define TPS65917_LDO_1_2_BYPASS_EN	BIT(6)
>
>
> This also applies to TWL6035/37, TPS659038 LDO9 as well.
> why not do it for all? considering the bit definition is the same as well?

I will send a patch on top of this.

>
>>
>>   #define REGULATOR_SLAVE			0
>>
>> @@ -639,6 +640,19 @@ static struct regulator_ops tps65917_ops_ldo = {
>>   	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
>>   };
>>
>> +static struct regulator_ops tps65917_ops_ldo_1_2 = {
>> +	.is_enabled		= palmas_is_enabled_ldo,
>> +	.enable			= regulator_enable_regmap,
>> +	.disable		= regulator_disable_regmap,
>> +	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
>> +	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
>> +	.list_voltage		= regulator_list_voltage_linear,
>> +	.map_voltage		= regulator_map_voltage_linear,
>> +	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
>> +	.set_bypass		= regulator_set_bypass_regmap,
>> +	.get_bypass		= regulator_get_bypass_regmap,
>> +};
>> +
>>   static int palmas_regulator_config_external(struct palmas *palmas, int id,
>>   		struct palmas_reg_init *reg_init)
>>   {
>> @@ -1019,6 +1033,12 @@ static int tps65917_ldo_registration(struct palmas_pmic *pmic,
>>   			 * It is of the order of ~60mV/uS.
>>   			 */
>>   			desc->ramp_delay = 2500;
>> +			if (id == TPS65917_REG_LDO1 ||
>> +			    id == TPS65917_REG_LDO2) {
>> +				desc->ops = &tps65917_ops_ldo_1_2;
>> +				desc->bypass_reg = desc->enable_reg;
>> +				desc->bypass_mask = TPS65917_LDO_1_2_BYPASS_EN;
>> +			}
>>   		} else {
>>   			desc->n_voltages = 1;
>>   			if (reg_init && reg_init->roof_floor)
>>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 8217613..776b59a 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -389,6 +389,7 @@  static unsigned int palmas_smps_ramp_delay[4] = {0, 10000, 5000, 2500};
 #define SMPS10_BOOST_EN			(1<<2)
 #define SMPS10_BYPASS_EN		(1<<1)
 #define SMPS10_SWITCH_EN		(1<<0)
+#define TPS65917_LDO_1_2_BYPASS_EN	BIT(6)
 
 #define REGULATOR_SLAVE			0
 
@@ -639,6 +640,19 @@  static struct regulator_ops tps65917_ops_ldo = {
 	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
 };
 
+static struct regulator_ops tps65917_ops_ldo_1_2 = {
+	.is_enabled		= palmas_is_enabled_ldo,
+	.enable			= regulator_enable_regmap,
+	.disable		= regulator_disable_regmap,
+	.get_voltage_sel	= regulator_get_voltage_sel_regmap,
+	.set_voltage_sel	= regulator_set_voltage_sel_regmap,
+	.list_voltage		= regulator_list_voltage_linear,
+	.map_voltage		= regulator_map_voltage_linear,
+	.set_voltage_time_sel	= regulator_set_voltage_time_sel,
+	.set_bypass		= regulator_set_bypass_regmap,
+	.get_bypass		= regulator_get_bypass_regmap,
+};
+
 static int palmas_regulator_config_external(struct palmas *palmas, int id,
 		struct palmas_reg_init *reg_init)
 {
@@ -1019,6 +1033,12 @@  static int tps65917_ldo_registration(struct palmas_pmic *pmic,
 			 * It is of the order of ~60mV/uS.
 			 */
 			desc->ramp_delay = 2500;
+			if (id == TPS65917_REG_LDO1 ||
+			    id == TPS65917_REG_LDO2) {
+				desc->ops = &tps65917_ops_ldo_1_2;
+				desc->bypass_reg = desc->enable_reg;
+				desc->bypass_mask = TPS65917_LDO_1_2_BYPASS_EN;
+			}
 		} else {
 			desc->n_voltages = 1;
 			if (reg_init && reg_init->roof_floor)