linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] power_supply: add few more values and props
@ 2008-01-06 12:27 Dmitry Baryshkov
  2008-01-06 14:09 ` Anton Vorontsov
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Baryshkov @ 2008-01-06 12:27 UTC (permalink / raw)
  To: cbouatmailru, linux-kernel, cbou, dwmw2

Add LiMn (one of the most common for small non-rechargable batteries)i
battery technology and voltage_min/_max properties support.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>


diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 249f61b..45d2f95 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -46,7 +46,8 @@ static ssize_t power_supply_show_property(struct device *dev,
 		"Unspecified failure"
 	};
 	static char *technology_text[] = {
-		"Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd"
+		"Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
+		"LiMn"
 	};
 	static char *capacity_level_text[] = {
 		"Unknown", "Critical", "Low", "Normal", "High", "Full"
@@ -88,6 +89,8 @@ static struct device_attribute power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(present),
 	POWER_SUPPLY_ATTR(online),
 	POWER_SUPPLY_ATTR(technology),
+	POWER_SUPPLY_ATTR(voltage_max),
+	POWER_SUPPLY_ATTR(voltage_min),
 	POWER_SUPPLY_ATTR(voltage_max_design),
 	POWER_SUPPLY_ATTR(voltage_min_design),
 	POWER_SUPPLY_ATTR(voltage_now),
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 606c095..cdbc5b8 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -54,6 +54,7 @@ enum {
 	POWER_SUPPLY_TECHNOLOGY_LIPO,
 	POWER_SUPPLY_TECHNOLOGY_LiFe,
 	POWER_SUPPLY_TECHNOLOGY_NiCd,
+	POWER_SUPPLY_TECHNOLOGY_LiMn,
 };
 
 enum {
@@ -72,6 +73,8 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_PRESENT,
 	POWER_SUPPLY_PROP_ONLINE,
 	POWER_SUPPLY_PROP_TECHNOLOGY,
+	POWER_SUPPLY_PROP_VOLTAGE_MAX,
+	POWER_SUPPLY_PROP_VOLTAGE_MIN,
 	POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
 	POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
 	POWER_SUPPLY_PROP_VOLTAGE_NOW,
-- 
With best wishes
Dmitry


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

* Re: [PATCH 1/3] power_supply: add few more values and props
  2008-01-06 12:27 [PATCH 1/3] power_supply: add few more values and props Dmitry Baryshkov
@ 2008-01-06 14:09 ` Anton Vorontsov
  2008-01-06 22:15   ` Dmitry
  0 siblings, 1 reply; 7+ messages in thread
From: Anton Vorontsov @ 2008-01-06 14:09 UTC (permalink / raw)
  To: Dmitry Baryshkov; +Cc: linux-kernel, cbou, dwmw2

On Sun, Jan 06, 2008 at 03:27:18PM +0300, Dmitry Baryshkov wrote:
> Add LiMn (one of the most common for small non-rechargable batteries)i
> battery technology and voltage_min/_max properties support.
> 
> Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>

Much thanks, all patches look good to me. Few questions about
this one though.

> diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
> index 249f61b..45d2f95 100644
> --- a/drivers/power/power_supply_sysfs.c
> +++ b/drivers/power/power_supply_sysfs.c
> @@ -46,7 +46,8 @@ static ssize_t power_supply_show_property(struct device *dev,
>  		"Unspecified failure"
>  	};
>  	static char *technology_text[] = {
> -		"Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd"
> +		"Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
> +		"LiMn"
>  	};
>  	static char *capacity_level_text[] = {
>  		"Unknown", "Critical", "Low", "Normal", "High", "Full"
> @@ -88,6 +89,8 @@ static struct device_attribute power_supply_attrs[] = {
>  	POWER_SUPPLY_ATTR(present),
>  	POWER_SUPPLY_ATTR(online),
>  	POWER_SUPPLY_ATTR(technology),
> +	POWER_SUPPLY_ATTR(voltage_max),
> +	POWER_SUPPLY_ATTR(voltage_min),

I'd suggest keep Documentation/power_supply_class.txt in sync
wrt new properties, to distinct their meanings and usage.

I assume you're using these new properties for non-rechargeable
LiMn batteries. So, why new properties, aren't voltage_*_design
ones suits that purpose? If battery is non-rechargeable it is
having only design values, no?

>  	POWER_SUPPLY_ATTR(voltage_max_design),
>  	POWER_SUPPLY_ATTR(voltage_min_design),
>  	POWER_SUPPLY_ATTR(voltage_now),
> diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> index 606c095..cdbc5b8 100644
> --- a/include/linux/power_supply.h
> +++ b/include/linux/power_supply.h
> @@ -54,6 +54,7 @@ enum {
>  	POWER_SUPPLY_TECHNOLOGY_LIPO,
>  	POWER_SUPPLY_TECHNOLOGY_LiFe,
>  	POWER_SUPPLY_TECHNOLOGY_NiCd,
> +	POWER_SUPPLY_TECHNOLOGY_LiMn,
>  };
>  
>  enum {
> @@ -72,6 +73,8 @@ enum power_supply_property {
>  	POWER_SUPPLY_PROP_PRESENT,
>  	POWER_SUPPLY_PROP_ONLINE,
>  	POWER_SUPPLY_PROP_TECHNOLOGY,
> +	POWER_SUPPLY_PROP_VOLTAGE_MAX,
> +	POWER_SUPPLY_PROP_VOLTAGE_MIN,
>  	POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
>  	POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
>  	POWER_SUPPLY_PROP_VOLTAGE_NOW,


Thanks,

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

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

* Re: [PATCH 1/3] power_supply: add few more values and props
  2008-01-06 14:09 ` Anton Vorontsov
@ 2008-01-06 22:15   ` Dmitry
  2008-01-06 22:30     ` Anton Vorontsov
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry @ 2008-01-06 22:15 UTC (permalink / raw)
  To: cbouatmailru; +Cc: linux-kernel, cbou, dwmw2

Hi,

2008/1/6, Anton Vorontsov <cbouatmailru@gmail.com>:
> On Sun, Jan 06, 2008 at 03:27:18PM +0300, Dmitry Baryshkov wrote:
> > Add LiMn (one of the most common for small non-rechargable batteries)i
> > battery technology and voltage_min/_max properties support.
> >
> > Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
>
> Much thanks, all patches look good to me. Few questions about
> this one though.
>
> > diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
> > index 249f61b..45d2f95 100644
> > --- a/drivers/power/power_supply_sysfs.c
> > +++ b/drivers/power/power_supply_sysfs.c
> > @@ -46,7 +46,8 @@ static ssize_t power_supply_show_property(struct device *dev,
> >               "Unspecified failure"
> >       };
> >       static char *technology_text[] = {
> > -             "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd"
> > +             "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
> > +             "LiMn"
> >       };
> >       static char *capacity_level_text[] = {
> >               "Unknown", "Critical", "Low", "Normal", "High", "Full"
> > @@ -88,6 +89,8 @@ static struct device_attribute power_supply_attrs[] = {
> >       POWER_SUPPLY_ATTR(present),
> >       POWER_SUPPLY_ATTR(online),
> >       POWER_SUPPLY_ATTR(technology),
> > +     POWER_SUPPLY_ATTR(voltage_max),
> > +     POWER_SUPPLY_ATTR(voltage_min),
>
> I'd suggest keep Documentation/power_supply_class.txt in sync
> wrt new properties, to distinct their meanings and usage.
>
> I assume you're using these new properties for non-rechargeable
> LiMn batteries. So, why new properties, aren't voltage_*_design
> ones suits that purpose? If battery is non-rechargeable it is
> having only design values, no?

No, I used it for the battery driver for Sharp Zaurus SL-6000 (tosa).
It's connected via simple ADC so I can get only voltages. I don't know
max_design value for the battery, but I have 'FULL' signal which I use
to detect 'voltage_max' and use it for power estimations.

> >       POWER_SUPPLY_ATTR(voltage_max_design),
> >       POWER_SUPPLY_ATTR(voltage_min_design),
> >       POWER_SUPPLY_ATTR(voltage_now),
> > diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
> > index 606c095..cdbc5b8 100644
> > --- a/include/linux/power_supply.h
> > +++ b/include/linux/power_supply.h
> > @@ -54,6 +54,7 @@ enum {
> >       POWER_SUPPLY_TECHNOLOGY_LIPO,
> >       POWER_SUPPLY_TECHNOLOGY_LiFe,
> >       POWER_SUPPLY_TECHNOLOGY_NiCd,
> > +     POWER_SUPPLY_TECHNOLOGY_LiMn,
> >  };
> >
> >  enum {
> > @@ -72,6 +73,8 @@ enum power_supply_property {
> >       POWER_SUPPLY_PROP_PRESENT,
> >       POWER_SUPPLY_PROP_ONLINE,
> >       POWER_SUPPLY_PROP_TECHNOLOGY,
> > +     POWER_SUPPLY_PROP_VOLTAGE_MAX,
> > +     POWER_SUPPLY_PROP_VOLTAGE_MIN,
> >       POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
> >       POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
> >       POWER_SUPPLY_PROP_VOLTAGE_NOW,
>
>
> Thanks,
>
> --
> Anton Vorontsov
> email: cbou@mail.ru
> backup email: ya-cbou@yandex.ru
> irc://irc.freenode.net/bd2
>


-- 
With best wishes
Dmitry

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

* Re: [PATCH 1/3] power_supply: add few more values and props
  2008-01-06 22:15   ` Dmitry
@ 2008-01-06 22:30     ` Anton Vorontsov
  2008-01-06 23:13       ` Dmitry
  0 siblings, 1 reply; 7+ messages in thread
From: Anton Vorontsov @ 2008-01-06 22:30 UTC (permalink / raw)
  To: Dmitry; +Cc: linux-kernel, cbou, dwmw2

On Mon, Jan 07, 2008 at 01:15:32AM +0300, Dmitry wrote:
[...]
> > > +     POWER_SUPPLY_ATTR(voltage_max),
> > > +     POWER_SUPPLY_ATTR(voltage_min),
> >
> > I'd suggest keep Documentation/power_supply_class.txt in sync
> > wrt new properties, to distinct their meanings and usage.
> >
> > I assume you're using these new properties for non-rechargeable
> > LiMn batteries. So, why new properties, aren't voltage_*_design
> > ones suits that purpose? If battery is non-rechargeable it is
> > having only design values, no?
> 
> No, I used it for the battery driver for Sharp Zaurus SL-6000 (tosa).
> It's connected via simple ADC so I can get only voltages. I don't know
> max_design value for the battery, but I have 'FULL' signal which I use
> to detect 'voltage_max' and use it for power estimations.

Ah, I see. In that case the value is empiric and voltage_max is
appropriate name indeed.

Thanks,

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

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

* Re: [PATCH 1/3] power_supply: add few more values and props
  2008-01-06 23:13       ` Dmitry
@ 2008-01-06 23:11         ` Anton Vorontsov
  2008-01-06 23:29           ` Dmitry
  0 siblings, 1 reply; 7+ messages in thread
From: Anton Vorontsov @ 2008-01-06 23:11 UTC (permalink / raw)
  To: Dmitry; +Cc: linux-kernel, cbou, dwmw2

On Mon, Jan 07, 2008 at 02:13:07AM +0300, Dmitry wrote:
> Hi,
> 
> 2008/1/7, Anton Vorontsov <cbouatmailru@gmail.com>:
> > On Mon, Jan 07, 2008 at 01:15:32AM +0300, Dmitry wrote:
> > [...]
> > > > > +     POWER_SUPPLY_ATTR(voltage_max),
> > > > > +     POWER_SUPPLY_ATTR(voltage_min),
> > > >
> > > > I'd suggest keep Documentation/power_supply_class.txt in sync
> > > > wrt new properties, to distinct their meanings and usage.
> > > >
> > > > I assume you're using these new properties for non-rechargeable
> > > > LiMn batteries. So, why new properties, aren't voltage_*_design
> > > > ones suits that purpose? If battery is non-rechargeable it is
> > > > having only design values, no?
> > >
> > > No, I used it for the battery driver for Sharp Zaurus SL-6000 (tosa).
> > > It's connected via simple ADC so I can get only voltages. I don't know
> > > max_design value for the battery, but I have 'FULL' signal which I use
> > > to detect 'voltage_max' and use it for power estimations.
> >
> > Ah, I see. In that case the value is empiric and voltage_max is
> > appropriate name indeed.
> 
> :) Documentation patch should be pretty trivial, could you please just
> make it w/o another resent cycle?

Sure thing, will do.

Thanks,

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

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

* Re: [PATCH 1/3] power_supply: add few more values and props
  2008-01-06 22:30     ` Anton Vorontsov
@ 2008-01-06 23:13       ` Dmitry
  2008-01-06 23:11         ` Anton Vorontsov
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry @ 2008-01-06 23:13 UTC (permalink / raw)
  To: cbouatmailru; +Cc: linux-kernel, cbou, dwmw2

Hi,

2008/1/7, Anton Vorontsov <cbouatmailru@gmail.com>:
> On Mon, Jan 07, 2008 at 01:15:32AM +0300, Dmitry wrote:
> [...]
> > > > +     POWER_SUPPLY_ATTR(voltage_max),
> > > > +     POWER_SUPPLY_ATTR(voltage_min),
> > >
> > > I'd suggest keep Documentation/power_supply_class.txt in sync
> > > wrt new properties, to distinct their meanings and usage.
> > >
> > > I assume you're using these new properties for non-rechargeable
> > > LiMn batteries. So, why new properties, aren't voltage_*_design
> > > ones suits that purpose? If battery is non-rechargeable it is
> > > having only design values, no?
> >
> > No, I used it for the battery driver for Sharp Zaurus SL-6000 (tosa).
> > It's connected via simple ADC so I can get only voltages. I don't know
> > max_design value for the battery, but I have 'FULL' signal which I use
> > to detect 'voltage_max' and use it for power estimations.
>
> Ah, I see. In that case the value is empiric and voltage_max is
> appropriate name indeed.

:) Documentation patch should be pretty trivial, could you please just
make it w/o another resent cycle?

>
> Thanks,
>
> --
> Anton Vorontsov
> email: cbou@mail.ru
> backup email: ya-cbou@yandex.ru
> irc://irc.freenode.net/bd2
>


-- 
With best wishes
Dmitry

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

* Re: [PATCH 1/3] power_supply: add few more values and props
  2008-01-06 23:11         ` Anton Vorontsov
@ 2008-01-06 23:29           ` Dmitry
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry @ 2008-01-06 23:29 UTC (permalink / raw)
  To: cbouatmailru; +Cc: linux-kernel, cbou, dwmw2

Hi,

2008/1/7, Anton Vorontsov <cbouatmailru@gmail.com>:
> On Mon, Jan 07, 2008 at 02:13:07AM +0300, Dmitry wrote:
> > Hi,
> >
> > 2008/1/7, Anton Vorontsov <cbouatmailru@gmail.com>:
> > > On Mon, Jan 07, 2008 at 01:15:32AM +0300, Dmitry wrote:
> > > [...]
> > > > > > +     POWER_SUPPLY_ATTR(voltage_max),
> > > > > > +     POWER_SUPPLY_ATTR(voltage_min),
> > > > >
> > > > > I'd suggest keep Documentation/power_supply_class.txt in sync
> > > > > wrt new properties, to distinct their meanings and usage.
> > > > >
> > > > > I assume you're using these new properties for non-rechargeable
> > > > > LiMn batteries. So, why new properties, aren't voltage_*_design
> > > > > ones suits that purpose? If battery is non-rechargeable it is
> > > > > having only design values, no?
> > > >
> > > > No, I used it for the battery driver for Sharp Zaurus SL-6000 (tosa).
> > > > It's connected via simple ADC so I can get only voltages. I don't know
> > > > max_design value for the battery, but I have 'FULL' signal which I use
> > > > to detect 'voltage_max' and use it for power estimations.
> > >
> > > Ah, I see. In that case the value is empiric and voltage_max is
> > > appropriate name indeed.
> >
> > :) Documentation patch should be pretty trivial, could you please just
> > make it w/o another resent cycle?
>
> Sure thing, will do.

Thank you very much!

>
> Thanks,
>
> --
> Anton Vorontsov
> email: cbou@mail.ru
> backup email: ya-cbou@yandex.ru
> irc://irc.freenode.net/bd2
>


-- 
With best wishes
Dmitry

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

end of thread, other threads:[~2008-01-06 23:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-06 12:27 [PATCH 1/3] power_supply: add few more values and props Dmitry Baryshkov
2008-01-06 14:09 ` Anton Vorontsov
2008-01-06 22:15   ` Dmitry
2008-01-06 22:30     ` Anton Vorontsov
2008-01-06 23:13       ` Dmitry
2008-01-06 23:11         ` Anton Vorontsov
2008-01-06 23:29           ` Dmitry

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