Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a79220b7633b3926a9bd3527bdac3f04dbe6845c
Commit:     a79220b7633b3926a9bd3527bdac3f04dbe6845c
Parent:     4fe4a2bf9a687fc87ea796c234da8c59df763aab
Author:     Matej Kenda <[EMAIL PROTECTED]>
AuthorDate: Mon Mar 5 13:06:40 2007 +0100
Committer:  Russell King <[EMAIL PROTECTED]>
CommitDate: Sat Apr 21 20:36:55 2007 +0100

    [ARM] 4246/1: i2c-pxa: add adapter class to platform specific data
    
    Reposted patch for kernel 2.6.21-rc2.
    
    The driver i2c-pxa doesn't set the class member in i2c_adapter, which
    is used to register the I2C adapter. The hwmon (sensors) drivers (e.g.
    adm1021) that are connected to a i2c-pxa adapter don't attach because
    they expect that the adapter supports class I2C_CLASS_HWMON.
    
    This patch adds functionality to allow platforms to set the class and
    pass it as platform_data to the i2c-pxa driver. Sample usage in
    platform code:
    
    static struct i2c_pxa_platform_data my_i2c_platform_data = {
        .class = I2C_CLASS_HWMON
    };
    
    static void __init my_platform_init(void)
    {
        (void) platform_add_devices(devices, ARRAY_SIZE(devices));
    
        pxa_set_i2c_info(&my_i2c_platform_data);
    }
    
    Signed-off-by: Matej Kenda <[EMAIL PROTECTED]>
    Signed-off-by: Russell King <[EMAIL PROTECTED]>
---
 drivers/i2c/busses/i2c-pxa.c   |    6 ++++--
 include/asm-arm/arch-pxa/i2c.h |    1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 14e83d0..11c7477 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -839,9 +839,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
 {
        struct pxa_i2c *i2c = &i2c_pxa;
        struct resource *res;
-#ifdef CONFIG_I2C_PXA_SLAVE
        struct i2c_pxa_platform_data *plat = dev->dev.platform_data;
-#endif
        int ret;
        int irq;
 
@@ -911,6 +909,10 @@ static int i2c_pxa_probe(struct platform_device *dev)
        i2c->adap.algo_data = i2c;
        i2c->adap.dev.parent = &dev->dev;
 
+       if (plat) {
+               i2c->adap.class = plat->class;
+       }
+
        ret = i2c_add_adapter(&i2c->adap);
        if (ret < 0) {
                printk(KERN_INFO "I2C: Failed to add bus\n");
diff --git a/include/asm-arm/arch-pxa/i2c.h b/include/asm-arm/arch-pxa/i2c.h
index 46ec224..e404b23 100644
--- a/include/asm-arm/arch-pxa/i2c.h
+++ b/include/asm-arm/arch-pxa/i2c.h
@@ -64,6 +64,7 @@ struct i2c_slave_client;
 struct i2c_pxa_platform_data {
        unsigned int            slave_addr;
        struct i2c_slave_client *slave;
+       unsigned int            class;
 };
 
 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to