linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value
@ 2019-06-13 13:01 Felix Riemann
  2019-06-13 13:59 ` Steve Twiss
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Riemann @ 2019-06-13 13:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: lee.jones, broonie, lgirdwood, support.opensource, Felix Riemann

According to the datasheet the LDO's voltage selection registers have
a minimum value of 0x2. This offset was not observed by the driver,
causing the LDO output being two steps (= 0.1V) lower than requested.

Signed-off-by: Felix Riemann <felix.riemann@sma.de>
---
 drivers/regulator/da9062-regulator.c | 40 +++++++++++++++++++++---------------
 include/linux/mfd/da9062/registers.h |  4 ++++
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/drivers/regulator/da9062-regulator.c b/drivers/regulator/da9062-regulator.c
index a02e0488410f..bfe0fe52fdd2 100644
--- a/drivers/regulator/da9062-regulator.c
+++ b/drivers/regulator/da9062-regulator.c
@@ -493,12 +493,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (900))/(50) + 1,
+.desc.n_voltages = ((3600) - (900))/(50) + 1
++ DA9062AA_VLDO1_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO1_CONT,
 .desc.enable_mask = DA9062AA_LDO1_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO1_A,
 .desc.vsel_mask = DA9062AA_VLDO1_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO1_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO1_A,
 __builtin_ffs((int)DA9062AA_LDO1_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -525,12 +526,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (600))/(50) + 1,
+.desc.n_voltages = ((3600) - (600))/(50) + 1
++ DA9062AA_VLDO2_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO2_CONT,
 .desc.enable_mask = DA9062AA_LDO2_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO2_A,
 .desc.vsel_mask = DA9062AA_VLDO2_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO2_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO2_A,
 __builtin_ffs((int)DA9062AA_LDO2_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -557,12 +559,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (900))/(50) + 1,
+.desc.n_voltages = ((3600) - (900))/(50) + 1
++ DA9062AA_VLDO3_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO3_CONT,
 .desc.enable_mask = DA9062AA_LDO3_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO3_A,
 .desc.vsel_mask = DA9062AA_VLDO3_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO3_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO3_A,
 __builtin_ffs((int)DA9062AA_LDO3_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -589,12 +592,13 @@ static const struct da9062_regulator_info local_da9061_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (900))/(50) + 1,
+.desc.n_voltages = ((3600) - (900))/(50) + 1
++ DA9062AA_VLDO4_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO4_CONT,
 .desc.enable_mask = DA9062AA_LDO4_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO4_A,
 .desc.vsel_mask = DA9062AA_VLDO4_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO4_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO4_A,
 __builtin_ffs((int)DA9062AA_LDO4_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -769,12 +773,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (900))/(50) + 1,
+.desc.n_voltages = ((3600) - (900))/(50) + 1
++ DA9062AA_VLDO1_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO1_CONT,
 .desc.enable_mask = DA9062AA_LDO1_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO1_A,
 .desc.vsel_mask = DA9062AA_VLDO1_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO1_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO1_A,
 __builtin_ffs((int)DA9062AA_LDO1_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -801,12 +806,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (600))/(50) + 1,
+.desc.n_voltages = ((3600) - (600))/(50) + 1
++ DA9062AA_VLDO2_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO2_CONT,
 .desc.enable_mask = DA9062AA_LDO2_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO2_A,
 .desc.vsel_mask = DA9062AA_VLDO2_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO2_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO2_A,
 __builtin_ffs((int)DA9062AA_LDO2_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -833,12 +839,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (900))/(50) + 1,
+.desc.n_voltages = ((3600) - (900))/(50) + 1
++ DA9062AA_VLDO3_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO3_CONT,
 .desc.enable_mask = DA9062AA_LDO3_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO3_A,
 .desc.vsel_mask = DA9062AA_VLDO3_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO3_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO3_A,
 __builtin_ffs((int)DA9062AA_LDO3_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
@@ -865,12 +872,13 @@ static const struct da9062_regulator_info local_da9062_regulator_info[] = {
 .desc.ops = &da9062_ldo_ops,
 .desc.min_uV = (900) * 1000,
 .desc.uV_step = (50) * 1000,
-.desc.n_voltages = ((3600) - (900))/(50) + 1,
+.desc.n_voltages = ((3600) - (900))/(50) + 1
++ DA9062AA_VLDO4_A_MIN_SEL,
 .desc.enable_reg = DA9062AA_LDO4_CONT,
 .desc.enable_mask = DA9062AA_LDO4_EN_MASK,
 .desc.vsel_reg = DA9062AA_VLDO4_A,
 .desc.vsel_mask = DA9062AA_VLDO4_A_MASK,
-.desc.linear_min_sel = 0,
+.desc.linear_min_sel = DA9062AA_VLDO4_A_MIN_SEL,
 .sleep = REG_FIELD(DA9062AA_VLDO4_A,
 __builtin_ffs((int)DA9062AA_LDO4_SL_A_MASK) - 1,
 sizeof(unsigned int) * 8 -
diff --git a/include/linux/mfd/da9062/registers.h b/include/linux/mfd/da9062/registers.h
index fe04b708742b..559b064d5e5a 100644
--- a/include/linux/mfd/da9062/registers.h
+++ b/include/linux/mfd/da9062/registers.h
@@ -798,24 +798,28 @@
 #define DA9062AA_BUCK3_SL_A_MASKBIT(7)

 /* DA9062AA_VLDO1_A = 0x0A9 */
+#define DA9062AA_VLDO1_A_MIN_SEL2
 #define DA9062AA_VLDO1_A_SHIFT0
 #define DA9062AA_VLDO1_A_MASK0x3f
 #define DA9062AA_LDO1_SL_A_SHIFT7
 #define DA9062AA_LDO1_SL_A_MASKBIT(7)

 /* DA9062AA_VLDO2_A = 0x0AA */
+#define DA9062AA_VLDO2_A_MIN_SEL2
 #define DA9062AA_VLDO2_A_SHIFT0
 #define DA9062AA_VLDO2_A_MASK0x3f
 #define DA9062AA_LDO2_SL_A_SHIFT7
 #define DA9062AA_LDO2_SL_A_MASKBIT(7)

 /* DA9062AA_VLDO3_A = 0x0AB */
+#define DA9062AA_VLDO3_A_MIN_SEL2
 #define DA9062AA_VLDO3_A_SHIFT0
 #define DA9062AA_VLDO3_A_MASK0x3f
 #define DA9062AA_LDO3_SL_A_SHIFT7
 #define DA9062AA_LDO3_SL_A_MASKBIT(7)

 /* DA9062AA_VLDO4_A = 0x0AC */
+#define DA9062AA_VLDO4_A_MIN_SEL2
 #define DA9062AA_VLDO4_A_SHIFT0
 #define DA9062AA_VLDO4_A_MASK0x3f
 #define DA9062AA_LDO4_SL_A_SHIFT7
--
2.16.4

___________________________________________________

SMA Solar Technology AG
Aufsichtsrat: Dr. Erik Ehrentraut (Vorsitzender)
Vorstand: Ulrich Hadding, Dr.-Ing. Juergen Reinert
Handelsregister: Amtsgericht Kassel HRB 3972
Sitz der Gesellschaft: 34266 Niestetal
USt-ID-Nr. DE 113 08 59 54
WEEE-Reg.-Nr. DE 95881150
___________________________________________________

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value
  2019-06-13 13:01 [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value Felix Riemann
@ 2019-06-13 13:59 ` Steve Twiss
  2019-06-18 11:07   ` AW: " Felix Riemann
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Twiss @ 2019-06-13 13:59 UTC (permalink / raw)
  To: Felix Riemann, linux-kernel
  Cc: lee.jones, broonie, lgirdwood, Support Opensource

Hi Felix,

On 13 June 2019 14:02, Felix Riemann wrote:

> Subject: [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value
> 
> According to the datasheet the LDO's voltage selection registers have
> a minimum value of 0x2. This offset was not observed by the driver,
> causing the LDO output being two steps (= 0.1V) lower than requested.
> 
> Signed-off-by: Felix Riemann <felix.riemann@sma.de>

Uh.

That looks right. But I want to take a closer look tomorrow along with my
tests, which must pass this behaviour.

Give me a day or two please.

Regards,
Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

* AW: [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value
  2019-06-13 13:59 ` Steve Twiss
@ 2019-06-18 11:07   ` Felix Riemann
  2019-06-18 12:18     ` Steve Twiss
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Riemann @ 2019-06-18 11:07 UTC (permalink / raw)
  To: Steve Twiss, linux-kernel
  Cc: lee.jones, broonie, lgirdwood, Support Opensource

Hi Steve,

A colleague told me that he saw our mail server mix-up whitespaces in text mails before, although the copy that got relayed back to me looks okay. Is the patch usable or should I try to resend it through another server?

Regards,
Felix

-----Ursprüngliche Nachricht-----
Von: Steve Twiss <stwiss.opensource@diasemi.com>
Gesendet: Donnerstag, 13. Juni 2019 16:00
An: Felix Riemann <Felix.Riemann@sma.de>; linux-kernel@vger.kernel.org
Cc: lee.jones@linaro.org; broonie@kernel.org; lgirdwood@gmail.com; Support Opensource <Support.Opensource@diasemi.com>
Betreff: RE: [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value

Hi Felix,

On 13 June 2019 14:02, Felix Riemann wrote:

> Subject: [PATCH] regulator: da9062: Adjust LDO voltage selection
> minimum value
>
> According to the datasheet the LDO's voltage selection registers have
> a minimum value of 0x2. This offset was not observed by the driver,
> causing the LDO output being two steps (= 0.1V) lower than requested.
>
> Signed-off-by: Felix Riemann <felix.riemann@sma.de>

Uh.

That looks right. But I want to take a closer look tomorrow along with my tests, which must pass this behaviour.

Give me a day or two please.

Regards,
Steve


___________________________________________________

SMA Solar Technology AG
Aufsichtsrat: Dr. Erik Ehrentraut (Vorsitzender)
Vorstand: Ulrich Hadding, Dr.-Ing. Juergen Reinert
Handelsregister: Amtsgericht Kassel HRB 3972
Sitz der Gesellschaft: 34266 Niestetal
USt-ID-Nr. DE 113 08 59 54
WEEE-Reg.-Nr. DE 95881150
___________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value
  2019-06-18 11:07   ` AW: " Felix Riemann
@ 2019-06-18 12:18     ` Steve Twiss
  0 siblings, 0 replies; 4+ messages in thread
From: Steve Twiss @ 2019-06-18 12:18 UTC (permalink / raw)
  To: Felix Riemann, linux-kernel
  Cc: lee.jones, broonie, lgirdwood, Support Opensource

Hi Felix,

On 18 June 2019 12:08 Felix Riemann wrote:

> Subject: AW: [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value
> 
> Hi Steve,
> 
> A colleague told me that he saw our mail server mix-up whitespaces in text mails
> before, although the copy that got relayed back to me looks okay. Is the patch
> usable or should I try to resend it through another server?

Yes there is a little bit of a white-space mix-up in both patches -- but I could see what
was supposed to happen.

I fixed those this morning and I've made a couple of suggestions. But before I send the
patch back (for your approval) I am just making some changes to my tests so it picks up
this change in future.

No need to send it again, thank you.
Once I've made certain it does what it is supposed to do, I will send for your review.

Regards,
Steve


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-18 12:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-13 13:01 [PATCH] regulator: da9062: Adjust LDO voltage selection minimum value Felix Riemann
2019-06-13 13:59 ` Steve Twiss
2019-06-18 11:07   ` AW: " Felix Riemann
2019-06-18 12:18     ` Steve Twiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).