linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RESEND 1/3 v4] drivers:power:twl4030-charger: don't check if battery is present
@ 2017-04-14 19:29 H. Nikolaus Schaller
  2017-05-01 11:26 ` Sebastian Reichel
  0 siblings, 1 reply; 3+ messages in thread
From: H. Nikolaus Schaller @ 2017-04-14 19:29 UTC (permalink / raw)
  To: Sebastian Reichel, Dmitry Eremin-Solenikov, David Woodhouse
  Cc: Grazvydas Ignotas, Andreas Kemnade, linux-pm, letux-kernel,
	linux-kernel, H. Nikolaus Schaller

We can't assume that the battery is or stays present after probing
on devices with replaceable battery.

On some devices (e.g. GTA04 or OpenPanodra) it can be removed
and even be hot swapped by the user while device continues to operate
through external AC or USB power (as long as system power consumption
remains below ca. 500mA as provided by USB). Under certain conditions
it is possible to boot without battery.

So it makes no sense to check for this situation during probe and make
the charger driver (and its status reports) completely non-operational if
the battery can be inserted later.

Tested on: GTA04 and OpenPandora.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/power/supply/twl4030_charger.c | 36 ----------------------------------
 1 file changed, 36 deletions(-)

diff --git a/drivers/power/supply/twl4030_charger.c b/drivers/power/supply/twl4030_charger.c
index bcd4dc3..e7fc9b0 100644
--- a/drivers/power/supply/twl4030_charger.c
+++ b/drivers/power/supply/twl4030_charger.c
@@ -206,35 +206,6 @@ static int twl4030bci_read_adc_val(u8 reg)
 }
 
 /*
- * Check if Battery Pack was present
- */
-static int twl4030_is_battery_present(struct twl4030_bci *bci)
-{
-	int ret;
-	u8 val = 0;
-
-	/* Battery presence in Main charge? */
-	ret = twl_i2c_read_u8(TWL_MODULE_MAIN_CHARGE, &val, TWL4030_BCIMFSTS3);
-	if (ret)
-		return ret;
-	if (val & TWL4030_BATSTSMCHG)
-		return 0;
-
-	/*
-	 * OK, It could be that bootloader did not enable main charger,
-	 * pre-charge is h/w auto. So, Battery presence in Pre-charge?
-	 */
-	ret = twl_i2c_read_u8(TWL4030_MODULE_PRECHARGE, &val,
-			      TWL4030_BCIMFSTS1);
-	if (ret)
-		return ret;
-	if (val & TWL4030_BATSTSPCHG)
-		return 0;
-
-	return -ENODEV;
-}
-
-/*
  * TI provided formulas:
  * CGAIN == 0: ICHG = (BCIICHG * 1.7) / (2^10 - 1) - 0.85
  * CGAIN == 1: ICHG = (BCIICHG * 3.4) / (2^10 - 1) - 1.7
@@ -1009,13 +980,6 @@ static int twl4030_bci_probe(struct platform_device *pdev)
 	bci->irq_chg = platform_get_irq(pdev, 0);
 	bci->irq_bci = platform_get_irq(pdev, 1);
 
-	/* Only proceed further *IF* battery is physically present */
-	ret = twl4030_is_battery_present(bci);
-	if  (ret) {
-		dev_crit(&pdev->dev, "Battery was not detected:%d\n", ret);
-		return ret;
-	}
-
 	platform_set_drvdata(pdev, bci);
 
 	bci->ac = devm_power_supply_register(&pdev->dev, &twl4030_bci_ac_desc,
-- 
2.7.3

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

* Re: [PATCH RESEND 1/3 v4] drivers:power:twl4030-charger: don't check if battery is present
  2017-04-14 19:29 [PATCH RESEND 1/3 v4] drivers:power:twl4030-charger: don't check if battery is present H. Nikolaus Schaller
@ 2017-05-01 11:26 ` Sebastian Reichel
  2017-05-03 12:20   ` H. Nikolaus Schaller
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Reichel @ 2017-05-01 11:26 UTC (permalink / raw)
  To: H. Nikolaus Schaller
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, Grazvydas Ignotas,
	Andreas Kemnade, linux-pm, letux-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]

Hi,

On Fri, Apr 14, 2017 at 09:29:38PM +0200, H. Nikolaus Schaller wrote:
> We can't assume that the battery is or stays present after probing
> on devices with replaceable battery.
> 
> On some devices (e.g. GTA04 or OpenPanodra) it can be removed
> and even be hot swapped by the user while device continues to operate
> through external AC or USB power (as long as system power consumption
> remains below ca. 500mA as provided by USB). Under certain conditions
> it is possible to boot without battery.
> 
> So it makes no sense to check for this situation during probe and make
> the charger driver (and its status reports) completely non-operational if
> the battery can be inserted later.
> 
> Tested on: GTA04 and OpenPandora.
> 
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>

Thanks, queued.

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH RESEND 1/3 v4] drivers:power:twl4030-charger: don't check if battery is present
  2017-05-01 11:26 ` Sebastian Reichel
@ 2017-05-03 12:20   ` H. Nikolaus Schaller
  0 siblings, 0 replies; 3+ messages in thread
From: H. Nikolaus Schaller @ 2017-05-03 12:20 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: Dmitry Eremin-Solenikov, David Woodhouse, Grazvydas Ignotas,
	Andreas Kemnade, linux-pm, letux-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 976 bytes --]


> Am 01.05.2017 um 13:26 schrieb Sebastian Reichel <sebastian.reichel@collabora.co.uk>:
> 
> Hi,
> 
> On Fri, Apr 14, 2017 at 09:29:38PM +0200, H. Nikolaus Schaller wrote:
>> We can't assume that the battery is or stays present after probing
>> on devices with replaceable battery.
>> 
>> On some devices (e.g. GTA04 or OpenPanodra) it can be removed
>> and even be hot swapped by the user while device continues to operate
>> through external AC or USB power (as long as system power consumption
>> remains below ca. 500mA as provided by USB). Under certain conditions
>> it is possible to boot without battery.
>> 
>> So it makes no sense to check for this situation during probe and make
>> the charger driver (and its status reports) completely non-operational if
>> the battery can be inserted later.
>> 
>> Tested on: GTA04 and OpenPandora.
>> 
>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> 
> Thanks, queued.

TNX,
Nikolaus


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

end of thread, other threads:[~2017-05-03 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 19:29 [PATCH RESEND 1/3 v4] drivers:power:twl4030-charger: don't check if battery is present H. Nikolaus Schaller
2017-05-01 11:26 ` Sebastian Reichel
2017-05-03 12:20   ` H. Nikolaus Schaller

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).