Skip to contentSkip to conversation

sunxi: power: axp809.c: Fix aldo1-2 being disabled for mvolt != 0

PATCH New Rask Ingemann Lambertsen 3 participants 4 messages Jan 18, 2017 – Mar 9, 2017 X-powers multifunction PMIC device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sunxi: power: axp809.c: Fix aldo1-2 being disabled for mvolt != 0

The execution flow is currently like this for aldo_num == 1 or 2:

int axp_set_aldo(int aldo_num, unsigned int mvolt) {
...

	if (mvolt == 0)
		return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));

...
return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
}

I.e. aldo1 and aldo2 will always be disabled. This patch fixes it by setting (rather than clearing) the enable bit when mvolt != 0.

Fixes 795857df413a ("sunxi: power: add AXP809 support")

---

This patch needs someone to test it. I can't do so myself because I don't have any hardware with an AXP809 PMIC. I just happened to spot the bug when looking at the code.

 drivers/power/axp809.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/axp809.c +1 -1
index c5b608d..5b5cb36 100644
@@ -143,7 +143,7 @@ int axp_set_aldo(int aldo_num, unsigned int mvolt)
 	if (aldo_num == 3)
 		return pmic_bus_setbits(AXP809_OUTPUT_CTRL2,
 					AXP809_OUTPUT_CTRL2_ALDO3_EN);
-	return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
+	return pmic_bus_setbits(AXP809_OUTPUT_CTRL1,
 				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
 }
 
Signature · 4 lines
2.10.2

-- 
Rask Ingemann Lambertsen
#1 lore raw

PATCH 1/1 sunxi: power: axp809.c: Fix aldo1-2 being disabled for mvolt != 0

Hi,

Quoted 13 lines · Rask Ingemann Lambertsen

The execution flow is currently like this for aldo_num == 1 or 2:

int axp_set_aldo(int aldo_num, unsigned int mvolt) {
...

	if (mvolt == 0)
		return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));

...
return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
}

Quoted 5 lines

I.e. aldo1 and aldo2 will always be disabled. This patch fixes it by setting (rather than clearing) the enable bit when mvolt != 0.

Fixes 795857df413a ("sunxi: power: add AXP809 support")

It makes sense. if someone can test it, it's more better. :) I can't access u-boot-pmic git repository yet.
So if possible, i will make the "pmic" branch on u-boot-mmc.

And i will apply the patches relevant to Power.

Best Regards,
Jaehoon Chung

Quoted 23 lines

---

This patch needs someone to test it. I can't do so myself because I don't have any hardware with an AXP809 PMIC. I just happened to spot the bug when looking at the code.

 drivers/power/axp809.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/axp809.c +1 -1
index c5b608d..5b5cb36 100644
@@ -143,7 +143,7 @@ int axp_set_aldo(int aldo_num, unsigned int mvolt)
 	if (aldo_num == 3)
 		return pmic_bus_setbits(AXP809_OUTPUT_CTRL2,
 					AXP809_OUTPUT_CTRL2_ALDO3_EN);
-	return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
+	return pmic_bus_setbits(AXP809_OUTPUT_CTRL1,
 				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
 }
 
#2 lore raw

PATCH 1/1 sunxi: power: axp809.c: Fix aldo1-2 being disabled for mvolt != 0

Hi,

Quoted 19 lines · Jaehoon Chung

Hi,

Quoted 16 lines · Rask Ingemann Lambertsen

The execution flow is currently like this for aldo_num == 1 or 2:

int axp_set_aldo(int aldo_num, unsigned int mvolt) {
...

      if (mvolt == 0)
              return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
                              AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
...
      return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
                              AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));

}

I.e. aldo1 and aldo2 will always be disabled. This patch fixes it by setting (rather than clearing) the enable bit when mvolt != 0.

Quoted 6 lines
Quoted 2 lines
Fixes 795857df413a ("sunxi: power: add AXP809 support")

It makes sense. if someone can test it, it's more better. :) I can't access u-boot-pmic git repository yet.
So if possible, i will make the "pmic" branch on u-boot-mmc.

Looks good to me. Looks like the original was a copy-paste error by yours truly.

Nothing really uses aldo 1 or 2 in U-boot though. One of them powers the pins used for cameras. The other powers 3.3V for the USB hosts. Neither feature is supported in U-boot at the moment.

ChenYu

Quoted 30 lines

And i will apply the patches relevant to Power.

Best Regards,
Jaehoon Chung

Quoted 23 lines

---

This patch needs someone to test it. I can't do so myself because I don't have any hardware with an AXP809 PMIC. I just happened to spot the bug when looking at the code.

 drivers/power/axp809.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/axp809.c +1 -1
index c5b608d..5b5cb36 100644
@@ -143,7 +143,7 @@ int axp_set_aldo(int aldo_num, unsigned int mvolt)
      if (aldo_num == 3)
              return pmic_bus_setbits(AXP809_OUTPUT_CTRL2,
                                      AXP809_OUTPUT_CTRL2_ALDO3_EN);
-     return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
+     return pmic_bus_setbits(AXP809_OUTPUT_CTRL1,
                              AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
 }
 
#3 lore raw

PATCH 1/1 sunxi: power: axp809.c: Fix aldo1-2 being disabled for mvolt != 0

In reply to Rask Ingemann Lambertsen
Quoted 13 lines · Rask Ingemann Lambertsen

The execution flow is currently like this for aldo_num == 1 or 2:

int axp_set_aldo(int aldo_num, unsigned int mvolt) {
...

	if (mvolt == 0)
		return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));

...
return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
}

Quoted 5 lines

I.e. aldo1 and aldo2 will always be disabled. This patch fixes it by setting (rather than clearing) the enable bit when mvolt != 0.

Fixes 795857df413a ("sunxi: power: add AXP809 support")

Applied on u-boot-mmc(pmic branch). Thanks!

Best Regards,
Jaehoon Chung

Quoted 23 lines

---

This patch needs someone to test it. I can't do so myself because I don't have any hardware with an AXP809 PMIC. I just happened to spot the bug when looking at the code.

 drivers/power/axp809.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/axp809.c +1 -1
index c5b608d..5b5cb36 100644
@@ -143,7 +143,7 @@ int axp_set_aldo(int aldo_num, unsigned int mvolt)
 	if (aldo_num == 3)
 		return pmic_bus_setbits(AXP809_OUTPUT_CTRL2,
 					AXP809_OUTPUT_CTRL2_ALDO3_EN);
-	return pmic_bus_clrbits(AXP809_OUTPUT_CTRL1,
+	return pmic_bus_setbits(AXP809_OUTPUT_CTRL1,
 				AXP809_OUTPUT_CTRL1_ALDO1_EN << (aldo_num - 1));
 }