Linux I2C development
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
To: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>,
	video4linux-list@redhat.com, i2c@lm-sensors.org
Subject: Re: [i2c] [RFC PATCH 3/8] Philips PCA9536 4 bit I2C GPIO extender driver
Date: Sun, 27 Jan 2008 23:27:41 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.0801272313060.6715@axis700.grange> (raw)
In-Reply-To: <20080127224559.4eed7cea@hyperion.delvare>

On Sun, 27 Jan 2008, Jean Delvare wrote:

> Hi Guennadi,
> 
> On Wed, 23 Jan 2008 18:41:39 +0100 (CET), Guennadi Liakhovetski wrote:
> > This driver will be used by the mt9m001 and the mt9v022 camera drivers,
> > that can use a pca9536 to switch between 8 and 10 bit modes.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
> > ---
> >  drivers/i2c/chips/Kconfig   |   10 +++
> >  drivers/i2c/chips/Makefile  |    1 +
> >  drivers/i2c/chips/pca9536.c |  153 +++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 164 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/i2c/chips/pca9536.c
> 
> There is a new GPIO subsystem (under driver/gpio), that's where you
> should add this driver.

Right, thanks, will move there, as well as will fix all your clean up 
suggestions - unneeded headers, dev_dbg, actually, might even remove 
sysfs attributes - they were there only for debugging.

> > +	if (client->dev.platform_data)
> > +		/* This chip is going to be used from the kernel */
> > +		*(struct i2c_client **)client->dev.platform_data = client;
> 
> This doesn't make any sense to me - what are you doing?

This was my way to call 

int pca9536_set_level(struct i2c_client *client, u8 pin, u8 level)
{
...
}
EXPORT_SYMBOL(pca9536_set_level);

from video drivers. But, if I make it a GPIO driver, I'll get a gpio API 
too, so, will not have to export a new function, right (haven't looked at 
gpio API yet)? But, probably, I still will need to somehow pass a handle 
to this gpio-controller to the video driver. The idea is:

in platform file we know, that a specific GPIO controller is attached to a 
specific camera. So, I do

static struct i2c_client *camera_data_bus_switch;

static struct soc_camera_link iclink[] = {
	{
		.bus_id		= 0, /* Must match with the camera ID above */
		.extender	= &camera_data_bus_switch,
	}, {
		.bus_id		= 0, /* Must match with the camera ID above */
	}
};

/* Board I2C devices. */
static struct i2c_board_info __initdata pcm027_i2c_devices[] = {
	{
		/* Must initialize before the camera(s) */
		I2C_BOARD_INFO("pca9536", 0x41),
		.type = "pca9536",
		.platform_data = &camera_data_bus_switch,
	}, {
		I2C_BOARD_INFO("mt9v022", 0x48),
		.type = "mt9v022",
		.platform_data = &iclink[0], /* With extender */
	}, {
		I2C_BOARD_INFO("mt9m001", 0x5d),
		.type = "mt9m001",
		.platform_data = &iclink[0], /* With extender */
	},
};

this way I tell, that the pca9536 extender with i2c address 0x41 is used 
to switch both cameras. And in the pca9536 driver I fill in the 
camera_data_bus_switch variable, so that cameras can later find and use 
the switch.

Well, I haven't find a better way to do this.

Thanks
Guennadi
---
Guennadi Liakhovetski

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  reply	other threads:[~2008-01-27 22:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.64.0801231646090.4932@axis700.grange>
2008-01-23 17:41 ` [RFC PATCH 3/8] Philips PCA9536 4 bit I2C GPIO extender driver Guennadi Liakhovetski
     [not found]   ` <Pine.LNX.4.64.0801231820060.4932-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2008-01-27 21:45     ` Jean Delvare
2008-01-27 22:27       ` Guennadi Liakhovetski [this message]
     [not found]       ` <20080127224559.4eed7cea-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-28  6:18         ` David Brownell
2008-01-30 16:48           ` [i2c] [RFC PATCH 3/8] Add PCA9536 4 bit I2C GPIO extender support to the pca9539 GPIO driver Guennadi Liakhovetski
2008-01-31  1:31             ` eric miao
     [not found]               ` <f17812d70801301731n62597f12kc151d01c320e3dec-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-01-31  4:52                 ` David Brownell
2008-01-31 10:13                   ` [i2c] " Guennadi Liakhovetski
     [not found]                     ` <Pine.LNX.4.64.0801311025210.6494-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2008-01-31 10:48                       ` David Brownell
2008-01-31 11:30                         ` [i2c] " Guennadi Liakhovetski
     [not found]                           ` <Pine.LNX.4.64.0801311204280.6494-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2008-01-31 11:46                             ` David Brownell
2008-01-31 11:49                             ` David Brownell
2008-01-31 13:30                         ` [i2c] " Guennadi Liakhovetski
     [not found]                           ` <Pine.LNX.4.64.0801311425300.6494-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2008-01-31 23:56                             ` David Brownell

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=Pine.LNX.4.64.0801272313060.6715@axis700.grange \
    --to=g.liakhovetski@pengutronix.de \
    --cc=david-b@pacbell.net \
    --cc=i2c@lm-sensors.org \
    --cc=khali@linux-fr.org \
    --cc=video4linux-list@redhat.com \
    /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