Skip to contentSkip to conversation

regulator: lp8788-buck: Remove val array in lp8788_init_dvs

PATCH Applied Axel Lin 3 participants 7 messages Dec 7, 2012 – Dec 10, 2012 1 message not in the archive Voltage and current regulator framework

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/2 regulator: lp8788-buck: Remove val array in lp8788_init_dvs

All elements of val array are zero.
Simply set data argument to be 0 in lp8788_update_bits call and remove the val array.

---
 drivers/regulator/lp8788-buck.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/regulator/lp8788-buck.c +1 -3
index 6cc02c3..d33b81a 100644
@@ -478,7 +478,6 @@ static int lp8788_init_dvs(struct lp8788_buck *buck, enum lp8788_buck_id id)
 {
 	struct lp8788_platform_data *pdata = buck->lp->pdata;
 	u8 mask[] = { LP8788_BUCK1_DVS_SEL_M, LP8788_BUCK2_DVS_SEL_M };
-	u8 val[]  = { LP8788_BUCK1_DVS_PIN, LP8788_BUCK2_DVS_PIN };
 	u8 default_dvs_mode[] = { LP8788_BUCK1_DVS_I2C, LP8788_BUCK2_DVS_I2C };
 
 	/* no dvs for buck3, 4 */
@@ -496,8 +495,7 @@ static int lp8788_init_dvs(struct lp8788_buck *buck, enum lp8788_buck_id id)
 	if (lp8788_dvs_gpio_request(buck, id))
 		goto set_default_dvs_mode;
 
-	return lp8788_update_bits(buck->lp, LP8788_BUCK_DVS_SEL, mask[id],
-				val[id]);
+	return lp8788_update_bits(buck->lp, LP8788_BUCK_DVS_SEL, mask[id], 0);
 
 set_default_dvs_mode:
 	return lp8788_update_bits(buck->lp, LP8788_BUCK_DVS_SEL, mask[id],
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 regulator: lp8788-buck: Kill _gpio_request function

Simply use devm_gpio_request_one() instead.

---
 drivers/regulator/lp8788-buck.c |   18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/regulator/lp8788-buck.c +4 -14
index d33b81a..369b034 100644
@@ -429,18 +429,6 @@ static struct regulator_desc lp8788_buck_desc[] = {
 	},
 };
 
-static int _gpio_request(struct lp8788_buck *buck, int gpio, char *name)
-{
-	struct device *dev = buck->lp->dev;
-
-	if (!gpio_is_valid(gpio)) {
-		dev_err(dev, "invalid gpio: %d\n", gpio);
-		return -EINVAL;
-	}
-
-	return devm_gpio_request_one(dev, gpio, DVS_LOW, name);
-}
-
 static int lp8788_dvs_gpio_request(struct lp8788_buck *buck,
 				enum lp8788_buck_id id)
 {
@@ -452,7 +440,8 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck,
 	switch (id) {
 	case BUCK1:
 		gpio = pdata->buck1_dvs->gpio;
-		ret = _gpio_request(buck, gpio, b1_name);
+		ret = devm_gpio_request_one(buck->lp->dev, gpio, DVS_LOW,
+					    b1_name);
 		if (ret)
 			return ret;
 
@@ -461,7 +450,8 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck,
 	case BUCK2:
 		for (i = 0 ; i < LP8788_NUM_BUCK2_DVS ; i++) {
 			gpio = pdata->buck2_dvs->gpio[i];
-			ret = _gpio_request(buck, gpio, b2_name[i]);
+			ret = devm_gpio_request_one(buck->lp->dev, gpio,
+						    DVS_LOW, b2_name[i]);
 			if (ret)
 				return ret;
 		}
Signature · 1 line
1.7.9.5
Acked-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] regulator: lp8788-buck: Kill _gpio_request function

Quoted 3 lines

Simply use devm_gpio_request_one() instead.

Thanks!

���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

Applied
#3 lore raw

Re: [PATCH 2/2] regulator: lp8788-buck: Kill _gpio_request function

In reply to Axel Lin
Quoted 1 line · Axel Lin

Simply use devm_gpio_request_one() instead.

Applied, thanks.

Milo, you don't have a MAINTAINERS entry for this chip - would you mind sending a patch adding one as you are reviewing patches for the driver? This will ensure that people send you patches for review.

#4 lore raw

RE: [PATCH 2/2] regulator: lp8788-buck: Kill _gpio_request function

Quoted 5 lines

Applied, thanks.

Milo, you don't have a MAINTAINERS entry for this chip - would you mind sending a patch adding one as you are reviewing patches for the driver? This will ensure that people send you patches for review.

OK, I'll update MAINTAINERS file for lp872x and lp8788. Thanks for your help.

Best Regards,
Milo

#5 lore raw
In reply to Axel Lin
Quoted 6 lines

All elements of val array are zero.
Simply set data argument to be 0 in lp8788_update_bits call and remove the val
array.

Axel, sorry I disagree with this patch because DVS_PIN is meaningful. In this case, explicit bit description is more important than code simplicity. So I would keep it.

Thanks,
Milo ���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m���� ������?�I�

A message that is not in the archive (sent off-list or not yet received): CAFRkauAFZ-G=7R4LbBLuJaCwwgc6i+_9tNm8ozKRw7G1w07j3A@mail.gmail.com

#7 lore raw
Quoted 2 lines

Actually, what you want is to clear mask[id] bits. Setting 0 for the data argument here is clear.

I would say it's not clearing bit but the DVS control configuration. If the bit is 0, external pin is used for the DVS.
If it is 1, then DVS is controlled by other register settings. Therefore, it's a kind of default configuration rather than clearing bits.

Quoted 1 line

But if you prefer to keep it as is, it's ok.

Thanks for your understanding.

Best Regards,
Milo