public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: bq20z75: Fix time and temp units
@ 2011-02-28  0:41 Benson Leung
  2011-02-28  1:41 ` [PATCH RESEND] " Benson Leung
  2011-02-28  1:41 ` [PATCH] " Benson Leung
  0 siblings, 2 replies; 6+ messages in thread
From: Benson Leung @ 2011-02-28  0:41 UTC (permalink / raw)
  To: linux-kernel, cbouatmailru; +Cc: rklein, bleung

Corrected temperature and time to empty/full conversions.
Temperature is in 0.1°C, time is in seconds.

Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/power/bq20z75.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c
index 4141775..998123e 100644
--- a/drivers/power/bq20z75.c
+++ b/drivers/power/bq20z75.c
@@ -269,12 +269,15 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
 {
 #define BASE_UNIT_CONVERSION		1000
 #define BATTERY_MODE_CAP_MULT_WATT	(10 * BASE_UNIT_CONVERSION)
-#define TIME_UNIT_CONVERSION		600
-#define TEMP_KELVIN_TO_CELCIUS		2731
+#define TIME_UNIT_CONVERSION		60
+#define TEMP_KELVIN_TO_CELSIUS		2731
 	switch (psp) {
 	case POWER_SUPPLY_PROP_ENERGY_NOW:
 	case POWER_SUPPLY_PROP_ENERGY_FULL:
 	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
+		/* bq20z75 provides energy in units of 10mWh.
+		 * Convert to µW
+		 */
 		val->intval *= BATTERY_MODE_CAP_MULT_WATT;
 		break;
 
@@ -288,14 +291,17 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
 		break;
 
 	case POWER_SUPPLY_PROP_TEMP:
-		/* bq20z75 provides battery tempreture in 0.1°K
-		 * so convert it to 0.1°C */
-		val->intval -= TEMP_KELVIN_TO_CELCIUS;
-		val->intval *= 10;
+		/* bq20z75 provides battery temperature in 0.1K
+		 * so convert it to 0.1°C
+		 */
+		val->intval -= TEMP_KELVIN_TO_CELSIUS;
 		break;
 
 	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
 	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
+		/* bq20z75 provides time to empty and time to full in minutes.
+		 * Convert to seconds
+		 */
 		val->intval *= TIME_UNIT_CONVERSION;
 		break;
 
-- 
1.7.1


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

* [PATCH RESEND] power: bq20z75: Fix time and temp units
  2011-02-28  0:41 [PATCH] power: bq20z75: Fix time and temp units Benson Leung
@ 2011-02-28  1:41 ` Benson Leung
  2011-02-28  1:41 ` [PATCH] " Benson Leung
  1 sibling, 0 replies; 6+ messages in thread
From: Benson Leung @ 2011-02-28  1:41 UTC (permalink / raw)
  To: linux-kernel, cbouatmailru; +Cc: rklein, bleung

Fixed incorrect comment.


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

* [PATCH] power: bq20z75: Fix time and temp units
  2011-02-28  0:41 [PATCH] power: bq20z75: Fix time and temp units Benson Leung
  2011-02-28  1:41 ` [PATCH RESEND] " Benson Leung
@ 2011-02-28  1:41 ` Benson Leung
  2011-03-09 19:00   ` Rhyland Klein
  1 sibling, 1 reply; 6+ messages in thread
From: Benson Leung @ 2011-02-28  1:41 UTC (permalink / raw)
  To: linux-kernel, cbouatmailru; +Cc: rklein, bleung

Corrected temperature and time to empty/full conversions.
Temperature is in 0.1°C, time is in seconds.

Corrected units in comment. "Convert to µWh."

Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/power/bq20z75.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c
index 4141775..123e169 100644
--- a/drivers/power/bq20z75.c
+++ b/drivers/power/bq20z75.c
@@ -269,12 +269,15 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
 {
 #define BASE_UNIT_CONVERSION		1000
 #define BATTERY_MODE_CAP_MULT_WATT	(10 * BASE_UNIT_CONVERSION)
-#define TIME_UNIT_CONVERSION		600
-#define TEMP_KELVIN_TO_CELCIUS		2731
+#define TIME_UNIT_CONVERSION		60
+#define TEMP_KELVIN_TO_CELSIUS		2731
 	switch (psp) {
 	case POWER_SUPPLY_PROP_ENERGY_NOW:
 	case POWER_SUPPLY_PROP_ENERGY_FULL:
 	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
+		/* bq20z75 provides energy in units of 10mWh.
+		 * Convert to µWh
+		 */
 		val->intval *= BATTERY_MODE_CAP_MULT_WATT;
 		break;
 
@@ -288,14 +291,17 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
 		break;
 
 	case POWER_SUPPLY_PROP_TEMP:
-		/* bq20z75 provides battery tempreture in 0.1°K
-		 * so convert it to 0.1°C */
-		val->intval -= TEMP_KELVIN_TO_CELCIUS;
-		val->intval *= 10;
+		/* bq20z75 provides battery temperature in 0.1K
+		 * so convert it to 0.1°C
+		 */
+		val->intval -= TEMP_KELVIN_TO_CELSIUS;
 		break;
 
 	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
 	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
+		/* bq20z75 provides time to empty and time to full in minutes.
+		 * Convert to seconds
+		 */
 		val->intval *= TIME_UNIT_CONVERSION;
 		break;
 
-- 
1.7.1


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

* Re: [PATCH] power: bq20z75: Fix time and temp units
  2011-02-28  1:41 ` [PATCH] " Benson Leung
@ 2011-03-09 19:00   ` Rhyland Klein
  2011-03-16  9:41     ` Benson Leung
  0 siblings, 1 reply; 6+ messages in thread
From: Rhyland Klein @ 2011-03-09 19:00 UTC (permalink / raw)
  To: Benson Leung; +Cc: linux-kernel@vger.kernel.org, cbouatmailru@gmail.com

On Sun, 2011-02-27 at 17:41 -0800, Benson Leung wrote:
> Corrected temperature and time to empty/full conversions.
> Temperature is in 0.1°C, time is in seconds.
> 
> Corrected units in comment. "Convert to µWh."
> 
> Signed-off-by: Benson Leung <bleung@chromium.org>
> ---
>  drivers/power/bq20z75.c |   18 ++++++++++++------
>  1 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c
> index 4141775..123e169 100644
> --- a/drivers/power/bq20z75.c
> +++ b/drivers/power/bq20z75.c
> @@ -269,12 +269,15 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
>  {
>  #define BASE_UNIT_CONVERSION		1000
>  #define BATTERY_MODE_CAP_MULT_WATT	(10 * BASE_UNIT_CONVERSION)
> -#define TIME_UNIT_CONVERSION		600
> -#define TEMP_KELVIN_TO_CELCIUS		2731
> +#define TIME_UNIT_CONVERSION		60
> +#define TEMP_KELVIN_TO_CELSIUS		2731
>  	switch (psp) {
>  	case POWER_SUPPLY_PROP_ENERGY_NOW:
>  	case POWER_SUPPLY_PROP_ENERGY_FULL:
>  	case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
> +		/* bq20z75 provides energy in units of 10mWh.
> +		 * Convert to µWh
> +		 */
>  		val->intval *= BATTERY_MODE_CAP_MULT_WATT;
>  		break;
>  
> @@ -288,14 +291,17 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
>  		break;
>  
>  	case POWER_SUPPLY_PROP_TEMP:
> -		/* bq20z75 provides battery tempreture in 0.1°K
> -		 * so convert it to 0.1°C */
> -		val->intval -= TEMP_KELVIN_TO_CELCIUS;
> -		val->intval *= 10;
> +		/* bq20z75 provides battery temperature in 0.1K
> +		 * so convert it to 0.1°C
> +		 */
> +		val->intval -= TEMP_KELVIN_TO_CELSIUS;
>  		break;
>  
>  	case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
>  	case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
> +		/* bq20z75 provides time to empty and time to full in minutes.
> +		 * Convert to seconds
> +		 */
>  		val->intval *= TIME_UNIT_CONVERSION;
>  		break;
>  

LGTM

Acked-by: Rhyland Klein <rklein@nvidia.com>



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

* Re: [PATCH] power: bq20z75: Fix time and temp units
  2011-03-09 19:00   ` Rhyland Klein
@ 2011-03-16  9:41     ` Benson Leung
  2011-03-16 13:43       ` Anton Vorontsov
  0 siblings, 1 reply; 6+ messages in thread
From: Benson Leung @ 2011-03-16  9:41 UTC (permalink / raw)
  To: Rhyland Klein; +Cc: linux-kernel@vger.kernel.org, cbouatmailru@gmail.com

Hi Anton,

Rhyland has LGTM'd my change to the bq20z75 driver to fix temperature
and time units. Can it go upstream?

Thanks,
Benson

On Wed, Mar 9, 2011 at 11:00 AM, Rhyland Klein <rklein@nvidia.com> wrote:
>
> On Sun, 2011-02-27 at 17:41 -0800, Benson Leung wrote:
> > Corrected temperature and time to empty/full conversions.
> > Temperature is in 0.1°C, time is in seconds.
> >
> > Corrected units in comment. "Convert to µWh."
> >
> > Signed-off-by: Benson Leung <bleung@chromium.org>
> > ---
> >  drivers/power/bq20z75.c |   18 ++++++++++++------
> >  1 files changed, 12 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/power/bq20z75.c b/drivers/power/bq20z75.c
> > index 4141775..123e169 100644
> > --- a/drivers/power/bq20z75.c
> > +++ b/drivers/power/bq20z75.c
> > @@ -269,12 +269,15 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
> >  {
> >  #define BASE_UNIT_CONVERSION         1000
> >  #define BATTERY_MODE_CAP_MULT_WATT   (10 * BASE_UNIT_CONVERSION)
> > -#define TIME_UNIT_CONVERSION         600
> > -#define TEMP_KELVIN_TO_CELCIUS               2731
> > +#define TIME_UNIT_CONVERSION         60
> > +#define TEMP_KELVIN_TO_CELSIUS               2731
> >       switch (psp) {
> >       case POWER_SUPPLY_PROP_ENERGY_NOW:
> >       case POWER_SUPPLY_PROP_ENERGY_FULL:
> >       case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
> > +             /* bq20z75 provides energy in units of 10mWh.
> > +              * Convert to µWh
> > +              */
> >               val->intval *= BATTERY_MODE_CAP_MULT_WATT;
> >               break;
> >
> > @@ -288,14 +291,17 @@ static void  bq20z75_unit_adjustment(struct i2c_client *client,
> >               break;
> >
> >       case POWER_SUPPLY_PROP_TEMP:
> > -             /* bq20z75 provides battery tempreture in 0.1°K
> > -              * so convert it to 0.1°C */
> > -             val->intval -= TEMP_KELVIN_TO_CELCIUS;
> > -             val->intval *= 10;
> > +             /* bq20z75 provides battery temperature in 0.1K
> > +              * so convert it to 0.1°C
> > +              */
> > +             val->intval -= TEMP_KELVIN_TO_CELSIUS;
> >               break;
> >
> >       case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
> >       case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
> > +             /* bq20z75 provides time to empty and time to full in minutes.
> > +              * Convert to seconds
> > +              */
> >               val->intval *= TIME_UNIT_CONVERSION;
> >               break;
> >
>
> LGTM
>
> Acked-by: Rhyland Klein <rklein@nvidia.com>
>
>



--
Benson Leung
Software Engineer, Chrom* OS
bleung@chromium.org

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

* Re: [PATCH] power: bq20z75: Fix time and temp units
  2011-03-16  9:41     ` Benson Leung
@ 2011-03-16 13:43       ` Anton Vorontsov
  0 siblings, 0 replies; 6+ messages in thread
From: Anton Vorontsov @ 2011-03-16 13:43 UTC (permalink / raw)
  To: Benson Leung; +Cc: Rhyland Klein, linux-kernel@vger.kernel.org

On Wed, Mar 16, 2011 at 02:41:52AM -0700, Benson Leung wrote:
> Hi Anton,
> 
> Rhyland has LGTM'd my change to the bq20z75 driver to fix temperature
> and time units. Can it go upstream?

Sorry for the delay, the patch is now applied.

Thanks!

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

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

end of thread, other threads:[~2011-03-16 13:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28  0:41 [PATCH] power: bq20z75: Fix time and temp units Benson Leung
2011-02-28  1:41 ` [PATCH RESEND] " Benson Leung
2011-02-28  1:41 ` [PATCH] " Benson Leung
2011-03-09 19:00   ` Rhyland Klein
2011-03-16  9:41     ` Benson Leung
2011-03-16 13:43       ` Anton Vorontsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox