All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sbs-battery: correct capacity mode selection bits
@ 2017-07-07 14:23 Michael Heinemann
  2017-07-11  2:32 ` Phil Reid
  2017-07-24 18:56 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Heinemann @ 2017-07-07 14:23 UTC (permalink / raw)
  To: linux-pm

The capacity mode bit is bit 15. Currently it is written as
default initialized enum and never shifted. This leads to
a behaviour where the BATTERY_MODE is not correctly
recognized and set again.

This commit initializes the enum accordingly.

Signed-off-by: Michael Heinemann <committed@heine.so>
---
  drivers/power/supply/sbs-battery.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/sbs-battery.c 
b/drivers/power/supply/sbs-battery.c
index 8bb2eb3..498e9af 100644
--- a/drivers/power/supply/sbs-battery.c
+++ b/drivers/power/supply/sbs-battery.c
@@ -60,8 +60,8 @@ enum {
  #define BATTERY_MODE_OFFSET		0x03
  #define BATTERY_MODE_MASK		0x8000
  enum sbs_battery_mode {
-	BATTERY_MODE_AMPS,
-	BATTERY_MODE_WATTS
+	BATTERY_MODE_AMPS = 0,
+	BATTERY_MODE_WATTS = 0x8000
  };

  /* manufacturer access defines */
-- 
2.7.4

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

* Re: [PATCH] sbs-battery: correct capacity mode selection bits
  2017-07-07 14:23 [PATCH] sbs-battery: correct capacity mode selection bits Michael Heinemann
@ 2017-07-11  2:32 ` Phil Reid
  2017-07-24 18:56 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Phil Reid @ 2017-07-11  2:32 UTC (permalink / raw)
  To: Michael Heinemann, linux-pm

On 7/07/2017 22:23, Michael Heinemann wrote:
> The capacity mode bit is bit 15. Currently it is written as
> default initialized enum and never shifted. This leads to
> a behaviour where the BATTERY_MODE is not correctly
> recognized and set again.
> 
> This commit initializes the enum accordingly.
> 
> Signed-off-by: Michael Heinemann <committed@heine.so>

Tested-by: Phil Reid <preid@electromag.com.au>


> ---
>   drivers/power/supply/sbs-battery.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c b/drivers/power/supply/sbs-battery.c
> index 8bb2eb3..498e9af 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -60,8 +60,8 @@ enum {
>   #define BATTERY_MODE_OFFSET        0x03
>   #define BATTERY_MODE_MASK        0x8000
>   enum sbs_battery_mode {
> -    BATTERY_MODE_AMPS,
> -    BATTERY_MODE_WATTS
> +    BATTERY_MODE_AMPS = 0,
> +    BATTERY_MODE_WATTS = 0x8000
>   };
> 
>   /* manufacturer access defines */

-- 
Regards
Phil Reid

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

* Re: [PATCH] sbs-battery: correct capacity mode selection bits
  2017-07-07 14:23 [PATCH] sbs-battery: correct capacity mode selection bits Michael Heinemann
  2017-07-11  2:32 ` Phil Reid
@ 2017-07-24 18:56 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2017-07-24 18:56 UTC (permalink / raw)
  To: Michael Heinemann; +Cc: linux-pm

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

Hi,

On Fri, Jul 07, 2017 at 04:23:54PM +0200, Michael Heinemann wrote:
> The capacity mode bit is bit 15. Currently it is written as
> default initialized enum and never shifted. This leads to
> a behaviour where the BATTERY_MODE is not correctly
> recognized and set again.
> 
> This commit initializes the enum accordingly.
> 
> Signed-off-by: Michael Heinemann <committed@heine.so>
> ---

Thanks, applied to power-supply's fixes branch.

-- Sebastian

>  drivers/power/supply/sbs-battery.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/sbs-battery.c
> b/drivers/power/supply/sbs-battery.c
> index 8bb2eb3..498e9af 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -60,8 +60,8 @@ enum {
>  #define BATTERY_MODE_OFFSET		0x03
>  #define BATTERY_MODE_MASK		0x8000
>  enum sbs_battery_mode {
> -	BATTERY_MODE_AMPS,
> -	BATTERY_MODE_WATTS
> +	BATTERY_MODE_AMPS = 0,
> +	BATTERY_MODE_WATTS = 0x8000
>  };
> 
>  /* manufacturer access defines */
> -- 
> 2.7.4
> 

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

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

end of thread, other threads:[~2017-07-24 18:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-07 14:23 [PATCH] sbs-battery: correct capacity mode selection bits Michael Heinemann
2017-07-11  2:32 ` Phil Reid
2017-07-24 18:56 ` Sebastian Reichel

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.