* [PATCH 1/1] power: supply: sbs-battery: Add ability to force load a battery via the devicetree
@ 2019-07-25 4:56 Richard Tresidder
2019-07-30 3:02 ` Richard Tresidder
0 siblings, 1 reply; 4+ messages in thread
From: Richard Tresidder @ 2019-07-25 4:56 UTC (permalink / raw)
To: sre, kstewart, gregkh, tglx, rfontana, allison, rtresidd,
linux-pm, 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>
---
Notes:
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.
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..ea8ba3e 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -161,6 +161,7 @@ struct sbs_info {
int poll_time;
u32 i2c_retry_count;
u32 poll_retry_count;
+ bool force_load;
struct delayed_work work;
struct mutex mode_lock;
u32 flags;
@@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client,
if (rc)
chip->poll_retry_count = 0;
+ chip->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 || chip->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: [PATCH 1/1] power: supply: sbs-battery: Add ability to force load a battery via the devicetree
2019-07-25 4:56 [PATCH 1/1] power: supply: sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
@ 2019-07-30 3:02 ` Richard Tresidder
2019-07-30 4:09 ` Guenter Roeck
0 siblings, 1 reply; 4+ messages in thread
From: Richard Tresidder @ 2019-07-30 3:02 UTC (permalink / raw)
To: sre, kstewart, gregkh, tglx, rfontana, allison, linux-pm,
linux-kernel, Nick Crews, Guenter Roeck
Hi Nick and Guenter
Just adding you to this one also seeing as you're looking at that other
sbs_battery patch for me.
Not sure why the get maintainers didn't list you for this one.
Cheers
Richard Tresidder
> 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>
> ---
>
> Notes:
> 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.
>
> 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..ea8ba3e 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -161,6 +161,7 @@ struct sbs_info {
> int poll_time;
> u32 i2c_retry_count;
> u32 poll_retry_count;
> + bool force_load;
> struct delayed_work work;
> struct mutex mode_lock;
> u32 flags;
> @@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client,
> if (rc)
> chip->poll_retry_count = 0;
>
> + chip->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 || chip->force_load)) {
> rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
>
> if (rc < 0) {
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] power: supply: sbs-battery: Add ability to force load a battery via the devicetree
2019-07-30 3:02 ` Richard Tresidder
@ 2019-07-30 4:09 ` Guenter Roeck
2019-07-30 5:49 ` Richard Tresidder
0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2019-07-30 4:09 UTC (permalink / raw)
To: Richard Tresidder
Cc: Sebastian Reichel, Kate Stewart, Greg Kroah-Hartman,
Thomas Gleixner, rfontana, allison, Linux PM list, linux-kernel,
Nick Crews
On Mon, Jul 29, 2019 at 8:02 PM Richard Tresidder
<rtresidd@electromag.com.au> wrote:
>
> Hi Nick and Guenter
> Just adding you to this one also seeing as you're looking at that other
> sbs_battery patch for me.
> Not sure why the get maintainers didn't list you for this one.
>
> Cheers
> Richard Tresidder
> > 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>
> > ---
> >
> > Notes:
> > 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.
> >
> > 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..ea8ba3e 100644
> > --- a/drivers/power/supply/sbs-battery.c
> > +++ b/drivers/power/supply/sbs-battery.c
> > @@ -161,6 +161,7 @@ struct sbs_info {
> > int poll_time;
> > u32 i2c_retry_count;
> > u32 poll_retry_count;
> > + bool force_load;
> > struct delayed_work work;
> > struct mutex mode_lock;
> > u32 flags;
> > @@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client,
> > if (rc)
> > chip->poll_retry_count = 0;
> >
> > + chip->force_load = of_property_read_bool(client->dev.of_node,
> > + "sbs,force-load");
> > +
Maybe it is documented in another patch, which I have not seen. If it
isn't, it will have to be documented and reviewed by a devicetree
maintainer. Either case, I don't immediately see why the variable
needs to reside in struct sbs_info; it seems to be used only in the
probe function.
> > 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 || chip->force_load)) {
> > rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
> >
> > if (rc < 0) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] power: supply: sbs-battery: Add ability to force load a battery via the devicetree
2019-07-30 4:09 ` Guenter Roeck
@ 2019-07-30 5:49 ` Richard Tresidder
0 siblings, 0 replies; 4+ messages in thread
From: Richard Tresidder @ 2019-07-30 5:49 UTC (permalink / raw)
To: Guenter Roeck
Cc: Sebastian Reichel, Kate Stewart, Greg Kroah-Hartman,
Thomas Gleixner, rfontana, allison, Linux PM list, linux-kernel,
Nick Crews
Hi Guenter
See below
Richard Tresidder
Cheers
Richard Tresidder
**
On 30/07/2019 12:09 pm, Guenter Roeck wrote:
> On Mon, Jul 29, 2019 at 8:02 PM Richard Tresidder
> <rtresidd@electromag.com.au> wrote:
>> Hi Nick and Guenter
>> Just adding you to this one also seeing as you're looking at that other
>> sbs_battery patch for me.
>> Not sure why the get maintainers didn't list you for this one.
>>
>> Cheers
>> Richard Tresidder
>>> 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>
>>> ---
>>>
>>> Notes:
>>> 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.
>>>
>>> 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..ea8ba3e 100644
>>> --- a/drivers/power/supply/sbs-battery.c
>>> +++ b/drivers/power/supply/sbs-battery.c
>>> @@ -161,6 +161,7 @@ struct sbs_info {
>>> int poll_time;
>>> u32 i2c_retry_count;
>>> u32 poll_retry_count;
>>> + bool force_load;
>>> struct delayed_work work;
>>> struct mutex mode_lock;
>>> u32 flags;
>>> @@ -852,6 +853,9 @@ static int sbs_probe(struct i2c_client *client,
>>> if (rc)
>>> chip->poll_retry_count = 0;
>>>
>>> + chip->force_load = of_property_read_bool(client->dev.of_node,
>>> + "sbs,force-load");
>>> +
> Maybe it is documented in another patch, which I have not seen. If it
> isn't, it will have to be documented and reviewed by a devicetree
> maintainer. Either case, I don't immediately see why the variable
> needs to reside in struct sbs_info; it seems to be used only in the
> probe function.
Good point, we don't actually need to store the value, it can just be a
local.
Yep I had done a device tree documentation patch, but confused myself
when submitting due to it having to be in a separate patch
I think I need to create 2 different patches but submit in the same
email via send-patch as a multipart patch..
I'll try to fix that when I send it in again.
>
>>> 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 || chip->force_load)) {
>>> rc = sbs_read_word_data(client, sbs_data[REG_STATUS].addr);
>>>
>>> if (rc < 0) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-07-30 5:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25 4:56 [PATCH 1/1] power: supply: sbs-battery: Add ability to force load a battery via the devicetree Richard Tresidder
2019-07-30 3:02 ` Richard Tresidder
2019-07-30 4:09 ` Guenter Roeck
2019-07-30 5:49 ` Richard Tresidder
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.