linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Power: s3c_adc_battery.c backup battery query
@ 2012-08-22  5:05 anish kumar
  2012-08-22  7:34 ` Vasily Khoruzhick
  0 siblings, 1 reply; 2+ messages in thread
From: anish kumar @ 2012-08-22  5:05 UTC (permalink / raw)
  To: linux-kernel; +Cc: lars, cbou, dwmw2, kzjeef, anarsoul

Hello,

I am trying to write a generic batttery driver using IIO and I have
one some below
questions:

Why do we have the representation of backup battery in this
driver(s3c_adc_battery.c) and when does the
s3c_adc_backup_bat_get_property function gets called?

As I understand, it is as this:It is called when it is registered
and when the user wants to know the backup battery status(sysfs)
and we don't do a workqueue scheduling as it will consume more power.

static struct s3c_adc_bat backup_bat = {
        .psy = {
                .name           = "backup-battery",
                .type           = POWER_SUPPLY_TYPE_BATTERY,
                .properties     = s3c_adc_backup_bat_props,
                .num_properties = ARRAY_SIZE(s3c_adc_backup_bat_props),
                .get_property   = s3c_adc_backup_bat_get_property,
                .use_for_apm    = 1,
        },
};

I am stuck with mulitple *get_property callbacks.As we don't know how many
batteries system has and consequently we don't know how many *get_property
callbacks to be implemented.

So below is my plan:
What I am trying to do is to have a single callback(*get_property) and manage
everything in this callback and will use the name of the psy to
distinguish between
the different batteries which system has and driver will receive this
information using
platform data.Hope it makes sense.

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

* Re: Power: s3c_adc_battery.c backup battery query
  2012-08-22  5:05 Power: s3c_adc_battery.c backup battery query anish kumar
@ 2012-08-22  7:34 ` Vasily Khoruzhick
  0 siblings, 0 replies; 2+ messages in thread
From: Vasily Khoruzhick @ 2012-08-22  7:34 UTC (permalink / raw)
  To: anish kumar; +Cc: linux-kernel, lars, cbou, dwmw2, kzjeef

On Wed, Aug 22, 2012 at 8:05 AM, anish kumar <yesanishhere@gmail.com> wrote:
> Hello,

Hi

> I am trying to write a generic batttery driver using IIO and I have
> one some below
> questions:
>
> Why do we have the representation of backup battery in this
> driver(s3c_adc_battery.c) and when does the
> s3c_adc_backup_bat_get_property function gets called?

Because backup battery differs a bit from main battery (for example,
it has no current monitoring capability).
Maybe it was not a good decision, as it's possible to handle it via
platform data info as you suggested.

> As I understand, it is as this:It is called when it is registered
> and when the user wants to know the backup battery status(sysfs)
> and we don't do a workqueue scheduling as it will consume more power.
>
> static struct s3c_adc_bat backup_bat = {
>         .psy = {
>                 .name           = "backup-battery",
>                 .type           = POWER_SUPPLY_TYPE_BATTERY,
>                 .properties     = s3c_adc_backup_bat_props,
>                 .num_properties = ARRAY_SIZE(s3c_adc_backup_bat_props),
>                 .get_property   = s3c_adc_backup_bat_get_property,
>                 .use_for_apm    = 1,
>         },
> };
>
> I am stuck with mulitple *get_property callbacks.As we don't know how many
> batteries system has and consequently we don't know how many *get_property
> callbacks to be implemented.
>
> So below is my plan:
> What I am trying to do is to have a single callback(*get_property) and manage
> everything in this callback and will use the name of the psy to
> distinguish between
> the different batteries which system has and driver will receive this
> information using
> platform data.Hope it makes sense.

Just send a patch for review :)

Regards
Vasily

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

end of thread, other threads:[~2012-08-22  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22  5:05 Power: s3c_adc_battery.c backup battery query anish kumar
2012-08-22  7:34 ` Vasily Khoruzhick

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