On Sat, 10 Mar 2007 21:15:50 +0100
Jean Delvare <[EMAIL PROTECTED]> wrote:

> I like the idea very much. Would this let us get rid of i2c-ixp2000?
> i2c-ixp4xx? scx200_i2c? Other drivers?

Any platform that implements the generic gpio api should be able to use
this driver. So yes, I hope we might be able to get rid of a few
existing bitbanging drivers.

> > +/*
> > + * Bitbanging i2c bus driver using the GPIO API
> > + *
> > + * Copyright (C) 2006 Atmel Corporation
> 
> I'm told we're in year 2007 ;)

I'm also told that copyright protection lasts infinitely long in
practice ;)

I'll update it. I probably just copied it blindly from a different
driver.

> > +int i2c_gpio_getsda(void *data)
> > +{
> > +   struct i2c_gpio_platform_data *pdata = data;
> > +
> > +   return gpio_get_value(pdata->sda_pin);
> > +}
> 
> 
> What value will you get if the SDA pin is open-drain and currently in
> output mode? Are such GPIO pins actually able to detect that the pin is
> low while they are not themselves driving it low?

I guess that depends on the GPIO controller. But being able to read the
pin state even when the pin is configured as an output is a
prerequisite for using this driver with "open drain" pins, so if the
hardware doesn't support this, the board code should just set
{sda,scl}_is_opendrain to zero.

> > +   bit_data->udelay        = 5,                    /* 100 kHz */
> 
> Actually, no, i2c-algo-bit has a 1/3-2/3 duty cycle, so a complete
> cycle is 3 times the udelay value. So udelay=5 gives you 66 kHz. If
> someone wants to fix that...

Ok. I guess we should move this parameter into the platform data struct
anyway.

> Also, I wouldn't recommend such a low value when SCL cannot be sensed,
> if a slave stretches the line even very briefly, you won't notice and
> havoc will ensue. udelay=50 sounds more reasonable for such half-baked
> busses.

Makes sense.

> > +   ret = platform_driver_probe(&i2c_gpio_driver, i2c_gpio_probe);
> > +   if (ret)
> > +           printk("i2c-gpio: probe failed: %d\n", ret);
> 
> Add KERN_ERR or similar.

Will do.

> Would you mind also adding yourself to MAINTAINERS for this driver? I
> would appreciate it.

Sure. I'm hoping this driver won't cause that much maintenance overhead
anyway since all the complicated stuff is in i2c-algo-bit. But I agree
it needs a maintainer.

Haavard
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to