public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rodolfo Giometti <giometti@enneenne.com>
To: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: linux-kernel@vger.kernel.org, Anton Vorontsov <cbou@mail.ru>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] power: support for Texas Instruments BQ27x00 battery managers.
Date: Fri, 20 Jun 2008 08:13:45 +0200	[thread overview]
Message-ID: <20080620061345.GA9339@gundam.enneenne.com> (raw)
In-Reply-To: <20080619233411.GA27198@zarina>

Hello,

before answering to other questions I'd like solve the following
issue.

On Fri, Jun 20, 2008 at 03:34:11AM +0400, Anton Vorontsov wrote:

> To avoid these ifdefs, I would suggest you to reconsider the model
> of this driver. How about:
> 
> - drivers/power/bq27x00_battery.c:
> 
>   Registers two platform_drivers, first is "bq27200-bat" (I2C) and
>   second is "bq27000-bat" (W1). Both are using the same probe and
>   remove methods. This driver will simply register power_supply
>   and will do all battery logic, separated from the underlaying
>   bus.
> 
>   (Two platform drivers are used simply because underlaying
>   I2C/W1 drivers will not know each other, thus will not able to
>   pass uniqe platform_device.id in case of single driver).
> 
> - include/linux/bq27x00-battery.h:
> 
>   Declares
>   struct bq27x00_access_methods {
>   	/*
> 	 * dev argument is I2C or W1 device, battery driver will use
> 	 * platform_device->dev.parent to pass the dev argument.
> 	 */
> 	int (*read)(struct device *dev, u8 reg, int *rt_value, int b_single);
>   };

Where this function should be defined? Can you explain better what you
mean?

> 
> - drivers/i2c/chips/bq27200.c:
> 
>   This driver will do all I2C stuff, and then will register
>   "bq27200-bat" platform device, with .platform_data pointed
>   to the allocated and filled "struct bq27x00_access_methods".
> 
> - drivers/w1/slaves/bq27000.c:
> 
>   This driver will do all W1 stuff, and then will register
>   "bq27000-bat" platform device, with .platform_data pointed
>   to the allocated and filled "struct bq27x00_access_methods".
> 
> Will this (not) work?

As you can see at the top of the file I based this work an previour
work by Texas Instruments people which never goes into linux vanilla
but lives into linux-omap tree. I just fixed some basic issue which
prevent the driver to compile and work properly and repropose the
driver here.

My hardware just uses the I2C chip version so I cannot test the W1 one
at all. If you agree I can remove the W1 code and provide the
bq27200.c driver only.

Maybe, as you suggested above, we can try to write the code in order
that a future W1 driver writer can write few lines. :)

Ciao,

Rodolfo

-- 

GNU/Linux Solutions                  e-mail: giometti@enneenne.com
Linux Device Driver                          giometti@linux.it
Embedded Systems                     phone:  +39 349 2432127
UNIX programming                     skype:  rodolfo.giometti

  parent reply	other threads:[~2008-06-20  6:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 13:08 [PATCH] power: support for Texas Instruments BQ27x00 battery managers Rodolfo Giometti
     [not found] ` <20080619233411.GA27198@zarina>
2008-06-20  6:13   ` Rodolfo Giometti [this message]
2008-06-23  6:38     ` Anton Vorontsov
     [not found]       ` <20080731210354.GW8465@enneenne.com>
2008-08-01  8:28         ` Anton Vorontsov
2008-08-01  9:26           ` Rodolfo Giometti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080620061345.GA9339@gundam.enneenne.com \
    --to=giometti@enneenne.com \
    --cc=cbou@mail.ru \
    --cc=cbouatmailru@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox