* [lm-sensors] switching from at91 to gpio driver
@ 2007-11-15 23:10 Sergei Sharonov
2007-11-18 16:43 ` Jean Delvare
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Sergei Sharonov @ 2007-11-15 23:10 UTC (permalink / raw)
To: lm-sensors
Hi,
I switched from at91 i2c driver (hardware controller) to i2c-gpio driver in
kernel 2.6.23.1. All chip drivers failed to hook into i2c-gpio. The problem was
traced to the fact that in case of i2c-gpio adapter->class is not set to
I2C_CLASS_HWMON whereas in case of i2c-at91 it is. Chip driver (e.g. lm92)
checks for it in xxx_attach_adapter() function and does not call i2c_probe() if
it is not set.
Skipping the check allows lm92 driver to function.
Now, is it a bug or there is a place where I can tell i2c-gpio driver to set
class?
Thanks,
Sergei Sharonov
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] switching from at91 to gpio driver
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
@ 2007-11-18 16:43 ` Jean Delvare
2007-11-20 12:59 ` Atsushi Nemoto
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2007-11-18 16:43 UTC (permalink / raw)
To: lm-sensors
Hi Sergei,
On Thu, 15 Nov 2007 23:10:51 +0000 (UTC), Sergei Sharonov wrote:
> I switched from at91 i2c driver (hardware controller) to i2c-gpio driver in
> kernel 2.6.23.1. All chip drivers failed to hook into i2c-gpio. The problem was
> traced to the fact that in case of i2c-gpio adapter->class is not set to
> I2C_CLASS_HWMON whereas in case of i2c-at91 it is. Chip driver (e.g. lm92)
> checks for it in xxx_attach_adapter() function and does not call i2c_probe() if
> it is not set.
> Skipping the check allows lm92 driver to function.
>
> Now, is it a bug or there is a place where I can tell i2c-gpio driver to set
> class?
Thanks for reporting, good catch. I'm adding the i2c list in Cc, as
well as the author of the i2c-gpio driver and one of its users.
Indeed there needs to be a way to set the class of i2c-gpio buses to
I2C_CLASS_HWMON. We could change the driver to set the class to
I2C_CLASS_HWMON for all buses by default, but that's not very flexible.
It would IMHO make more sense to add a field to struct
i2c_gpio_platform_data, and let each user of i2c-gpio set the class to
whatever they want.
Maybe you, Haavard or Atsushi can submit a patch doing this? I'd be
happy to review and merge it quickly.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] switching from at91 to gpio driver
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
2007-11-18 16:43 ` Jean Delvare
@ 2007-11-20 12:59 ` Atsushi Nemoto
2007-11-20 20:07 ` Jean Delvare
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2007-11-20 12:59 UTC (permalink / raw)
To: lm-sensors
On Sun, 18 Nov 2007 17:43:54 +0100, Jean Delvare <khali@linux-fr.org> wrote:
> Indeed there needs to be a way to set the class of i2c-gpio buses to
> I2C_CLASS_HWMON. We could change the driver to set the class to
> I2C_CLASS_HWMON for all buses by default, but that's not very flexible.
> It would IMHO make more sense to add a field to struct
> i2c_gpio_platform_data, and let each user of i2c-gpio set the class to
> whatever they want.
>
> Maybe you, Haavard or Atsushi can submit a patch doing this? I'd be
> happy to review and merge it quickly.
I think just setting I2C_CLASS_HWMON (or I2C_CLASS_ALL) in
i2c_gpio_probe would be enough.
Well, frankly, I cannot understand the purpose of I2C_CLASS_XXX at
all. For example, what is an requirement for I2C_CLASS_HWMON?
---
Atsushi Nemoto
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] switching from at91 to gpio driver
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
2007-11-18 16:43 ` Jean Delvare
2007-11-20 12:59 ` Atsushi Nemoto
@ 2007-11-20 20:07 ` Jean Delvare
2007-11-22 15:50 ` Atsushi Nemoto
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2007-11-20 20:07 UTC (permalink / raw)
To: lm-sensors
Konbanwa Atsushi-san,
On Tue, 20 Nov 2007 21:59:37 +0900 (JST), Atsushi Nemoto wrote:
> On Sun, 18 Nov 2007 17:43:54 +0100, Jean Delvare <khali@linux-fr.org> wrote:
> > Indeed there needs to be a way to set the class of i2c-gpio buses to
> > I2C_CLASS_HWMON. We could change the driver to set the class to
> > I2C_CLASS_HWMON for all buses by default, but that's not very flexible.
> > It would IMHO make more sense to add a field to struct
> > i2c_gpio_platform_data, and let each user of i2c-gpio set the class to
> > whatever they want.
> >
> > Maybe you, Haavard or Atsushi can submit a patch doing this? I'd be
> > happy to review and merge it quickly.
>
> I think just setting I2C_CLASS_HWMON (or I2C_CLASS_ALL) in
> i2c_gpio_probe would be enough.
>
> Well, frankly, I cannot understand the purpose of I2C_CLASS_XXX at
> all. For example, what is an requirement for I2C_CLASS_HWMON?
There are no requirements. Classes are only informative, restricting
which i2c buses will be scanned by some categories of i2c chip drivers.
For example, hwmon drivers only scan i2c buses with I2C_CLASS_HWMON set.
I wouldn't recommend setting I2C_CLASS_ALL in i2c-gpio, as it pretty
much voids the idea of i2c classes. But on second thought,
I2C_CLASS_HWMON should work fine. That's what almost all
general-purpose i2c bus drivers do after all.
So, if someone sends me a patch adding class I2C_CLASS_HWMON to
i2c-gpio, I'll take that.
Arigato,
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] switching from at91 to gpio driver
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
` (2 preceding siblings ...)
2007-11-20 20:07 ` Jean Delvare
@ 2007-11-22 15:50 ` Atsushi Nemoto
2007-11-22 21:42 ` Jean Delvare
2007-11-23 15:53 ` Atsushi Nemoto
5 siblings, 0 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2007-11-22 15:50 UTC (permalink / raw)
To: lm-sensors
On Tue, 20 Nov 2007 21:07:08 +0100, Jean Delvare <khali@linux-fr.org> wrote:
> I wouldn't recommend setting I2C_CLASS_ALL in i2c-gpio, as it pretty
> much voids the idea of i2c classes. But on second thought,
> I2C_CLASS_HWMON should work fine. That's what almost all
> general-purpose i2c bus drivers do after all.
>
> So, if someone sends me a patch adding class I2C_CLASS_HWMON to
> i2c-gpio, I'll take that.
OK, done. Please review ;-)
------------------------------------------------------
Subject: i2c: initialize adapter class for i2c-gpio driver.
Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 44e1cd2..3ca19fc 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
adap->owner = THIS_MODULE;
snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
adap->algo_data = bit_data;
+ adap->class = I2C_CLASS_HWMON;
adap->dev.parent = &pdev->dev;
/*
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [lm-sensors] switching from at91 to gpio driver
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
` (3 preceding siblings ...)
2007-11-22 15:50 ` Atsushi Nemoto
@ 2007-11-22 21:42 ` Jean Delvare
2007-11-23 15:53 ` Atsushi Nemoto
5 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2007-11-22 21:42 UTC (permalink / raw)
To: lm-sensors
On Fri, 23 Nov 2007 00:50:26 +0900 (JST), Atsushi Nemoto wrote:
> On Tue, 20 Nov 2007 21:07:08 +0100, Jean Delvare <khali@linux-fr.org> wrote:
> > I wouldn't recommend setting I2C_CLASS_ALL in i2c-gpio, as it pretty
> > much voids the idea of i2c classes. But on second thought,
> > I2C_CLASS_HWMON should work fine. That's what almost all
> > general-purpose i2c bus drivers do after all.
> >
> > So, if someone sends me a patch adding class I2C_CLASS_HWMON to
> > i2c-gpio, I'll take that.
>
> OK, done. Please review ;-)
>
> ------------------------------------------------------
> Subject: i2c: initialize adapter class for i2c-gpio driver.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index 44e1cd2..3ca19fc 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -140,6 +140,7 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
> adap->owner = THIS_MODULE;
> snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
> adap->algo_data = bit_data;
> + adap->class = I2C_CLASS_HWMON;
> adap->dev.parent = &pdev->dev;
>
> /*
>
Applied, thanks. Does this need to go in 2.6.24?
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [lm-sensors] switching from at91 to gpio driver
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
` (4 preceding siblings ...)
2007-11-22 21:42 ` Jean Delvare
@ 2007-11-23 15:53 ` Atsushi Nemoto
5 siblings, 0 replies; 7+ messages in thread
From: Atsushi Nemoto @ 2007-11-23 15:53 UTC (permalink / raw)
To: lm-sensors
On Thu, 22 Nov 2007 22:42:36 +0100, Jean Delvare <khali@linux-fr.org> wrote:
> Applied, thanks. Does this need to go in 2.6.24?
I don't think so. This is not a regression. But I believe this fix
is safe for even stable releases.
---
Atsushi Nemoto
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-11-23 15:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-15 23:10 [lm-sensors] switching from at91 to gpio driver Sergei Sharonov
2007-11-18 16:43 ` Jean Delvare
2007-11-20 12:59 ` Atsushi Nemoto
2007-11-20 20:07 ` Jean Delvare
2007-11-22 15:50 ` Atsushi Nemoto
2007-11-22 21:42 ` Jean Delvare
2007-11-23 15:53 ` Atsushi Nemoto
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.