linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND v2 0/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree
@ 2019-07-30 10:10 Richard Tresidder
  2019-07-30 10:10 ` [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding Richard Tresidder
  2019-07-30 10:10 ` [RESEND v2 2/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
  0 siblings, 2 replies; 4+ messages in thread
From: Richard Tresidder @ 2019-07-30 10:10 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, rtresidd, kstewart, gregkh, tglx,
	rfontana, allison, linux-pm, devicetree, linux-kernel

Add the ability to force load a hot pluggable battery during boot where
there is no gpio detect method available and the module is statically
built. Normal polling will then occur on that battery when it is inserted.

Richard Tresidder (2):
  dt-binding docs: sbs_sbs-battery: Addition of force_load binding
  power/supply/sbs-battery: Add ability to force load a battery via the
    devicetree

 Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt | 4 +++-
 drivers/power/supply/sbs-battery.c                                 | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

-- 
1.8.3.1


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

* [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding
  2019-07-30 10:10 [RESEND v2 0/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
@ 2019-07-30 10:10 ` Richard Tresidder
  2019-09-02 18:23   ` Sebastian Reichel
  2019-07-30 10:10 ` [RESEND v2 2/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Tresidder @ 2019-07-30 10:10 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, rtresidd, kstewart, gregkh, tglx,
	rfontana, allison, linux-pm, devicetree, linux-kernel

Add device tree binding documentation for addition of force_load boolean value
to allow loading a battery during boot even if notpresent at that time.

Signed-off-by: Richard Tresidder <rtresidd@electromag.com.au>
---
 Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt
index 4e78e51..187d7bb 100644
--- a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt
+++ b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt
@@ -15,7 +15,8 @@ Optional properties :
    after an external change notification.
  - sbs,battery-detect-gpios : The gpio which signals battery detection and
    a flag specifying its polarity.
-
+ - sbs,force-load : Allow loading of a hot-pluggable battery when there is no
+   GPIO detect available and the module is statically built.
 Example:
 
 	battery@b {
@@ -24,4 +25,5 @@ Example:
 		sbs,i2c-retry-count = <2>;
 		sbs,poll-retry-count = <10>;
 		sbs,battery-detect-gpios = <&gpio-controller 122 1>;
+		sbs,force-load;
 	}
-- 
1.8.3.1


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

* [RESEND v2 2/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree
  2019-07-30 10:10 [RESEND v2 0/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
  2019-07-30 10:10 ` [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding Richard Tresidder
@ 2019-07-30 10:10 ` Richard Tresidder
  1 sibling, 0 replies; 4+ messages in thread
From: Richard Tresidder @ 2019-07-30 10:10 UTC (permalink / raw)
  To: sre, robh+dt, mark.rutland, rtresidd, kstewart, gregkh, tglx,
	rfontana, allison, linux-pm, devicetree, linux-kernel

Add the ability to force load a hot pluggable battery during boot where
there is no gpio detect method available and the module is statically
built. Normal polling will then occur on that battery when it is inserted.

Signed-off-by: Richard Tresidder <rtresidd@electromag.com.au>
---
 drivers/power/supply/sbs-battery.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
index 048d205..b55721d 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -816,6 +816,7 @@ static int sbs_probe(struct i2c_client *client,
 	struct power_supply_config psy_cfg = {};
 	int rc;
 	int irq;
+	bool dt_force_load;
 
 	sbs_desc = devm_kmemdup(&client->dev, &sbs_default_desc,
 			sizeof(*sbs_desc), GFP_KERNEL);
@@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client,
 	if (rc)
 		chip->poll_retry_count = 0;
 
+	dt_force_load = of_property_read_bool(client->dev.of_node,
+						"sbs,force-load");
+
 	if (pdata) {
 		chip->poll_retry_count = pdata->poll_retry_count;
 		chip->i2c_retry_count  = pdata->i2c_retry_count;
@@ -890,7 +894,7 @@ static int sbs_probe(struct i2c_client *client,
 	 * Before we register, we might need to make sure we can actually talk
 	 * to the battery.
 	 */
-	if (!(force_load || chip->gpio_detect)) {
+	if (!(force_load || chip->gpio_detect || dt_force_load)) {
 		rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
 
 		if (rc < 0) {
-- 
1.8.3.1


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

* Re: [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding
  2019-07-30 10:10 ` [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding Richard Tresidder
@ 2019-09-02 18:23   ` Sebastian Reichel
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2019-09-02 18:23 UTC (permalink / raw)
  To: Richard Tresidder
  Cc: robh+dt, mark.rutland, kstewart, gregkh, tglx, rfontana, allison,
	linux-pm, devicetree, linux-kernel

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

Hi,

On Tue, Jul 30, 2019 at 06:10:03PM +0800, Richard Tresidder wrote:
> Add device tree binding documentation for addition of force_load boolean value
> to allow loading a battery during boot even if notpresent at that time.
> 
> Signed-off-by: Richard Tresidder <rtresidd@electromag.com.au>
> ---
>  Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt
> index 4e78e51..187d7bb 100644
> --- a/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt
> +++ b/Documentation/devicetree/bindings/power/supply/sbs_sbs-battery.txt
> @@ -15,7 +15,8 @@ Optional properties :
>     after an external change notification.
>   - sbs,battery-detect-gpios : The gpio which signals battery detection and
>     a flag specifying its polarity.
> -
> + - sbs,force-load : Allow loading of a hot-pluggable battery when there is no
> +   GPIO detect available and the module is statically built.

This does not describe hardware configuration and is not an
acceptable DT property.

-- Sebastian

>  Example:
>  
>  	battery@b {
> @@ -24,4 +25,5 @@ Example:
>  		sbs,i2c-retry-count = <2>;
>  		sbs,poll-retry-count = <10>;
>  		sbs,battery-detect-gpios = <&gpio-controller 122 1>;
> +		sbs,force-load;
>  	}
> -- 
> 1.8.3.1
> 

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

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

end of thread, other threads:[~2019-09-02 18:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-30 10:10 [RESEND v2 0/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
2019-07-30 10:10 ` [RESEND v2 1/2] dt-binding docs: sbs_sbs-battery: Addition of force_load binding Richard Tresidder
2019-09-02 18:23   ` Sebastian Reichel
2019-07-30 10:10 ` [RESEND v2 2/2] power/supply/sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder

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