Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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 <matej.kenda@hermes-softlab.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Matej Kenda and committed by
Russell King
a79220b7 4fe4a2bf

+5 -2
+4 -2
drivers/i2c/busses/i2c-pxa.c
··· 839 839 { 840 840 struct pxa_i2c *i2c = &i2c_pxa; 841 841 struct resource *res; 842 - #ifdef CONFIG_I2C_PXA_SLAVE 843 842 struct i2c_pxa_platform_data *plat = dev->dev.platform_data; 844 - #endif 845 843 int ret; 846 844 int irq; 847 845 ··· 908 910 909 911 i2c->adap.algo_data = i2c; 910 912 i2c->adap.dev.parent = &dev->dev; 913 + 914 + if (plat) { 915 + i2c->adap.class = plat->class; 916 + } 911 917 912 918 ret = i2c_add_adapter(&i2c->adap); 913 919 if (ret < 0) {
+1
include/asm-arm/arch-pxa/i2c.h
··· 64 64 struct i2c_pxa_platform_data { 65 65 unsigned int slave_addr; 66 66 struct i2c_slave_client *slave; 67 + unsigned int class; 67 68 }; 68 69 69 70 extern void pxa_set_i2c_info(struct i2c_pxa_platform_data *info);