go7007: Convert to the new i2c device binding model (v2)
PATCH 1/1 go7007: Convert to the new i2c device binding model (v2)
Move the go7007 driver away from the legacy i2c binding model, which is going away really soon now.
The I2C addresses of the audio and video chips in s2250-board didn't look quite right, apparently they were left-aligned values when Linux wants right-aligned values, so I fixed them too.
---
Note: I just pushed this to Linus, as this is blocking the removal of the legacy i2c binding model, and I see no point in waiting for a driver which clearly doesn't work today anyway.
drivers/staging/go7007/go7007-driver.c | 11 +++- drivers/staging/go7007/go7007-i2c.c | 83 ------------------------------- drivers/staging/go7007/go7007-priv.h | 1 drivers/staging/go7007/go7007-usb.c | 14 ++++- drivers/staging/go7007/s2250-board.c | 71 +++++++++++--------------- drivers/staging/go7007/wis-i2c.h | 9 --- drivers/staging/go7007/wis-ov7640.c | 54 +++++--------------- drivers/staging/go7007/wis-saa7113.c | 60 +++++++--------------- drivers/staging/go7007/wis-saa7115.c | 60 +++++++--------------- drivers/staging/go7007/wis-sony-tuner.c | 60 ++++++---------------- drivers/staging/go7007/wis-tw2804.c | 57 ++++++--------------- drivers/staging/go7007/wis-tw9903.c | 60 +++++++--------------- drivers/staging/go7007/wis-uda1342.c | 52 +++++-------------- 13 files changed, 175 insertions(+), 417 deletions(-)
drivers/staging/go7007/go7007-driver.c +9 -2
@@ -191,8 +191,10 @@ int go7007_reset_encoder(struct go7007 */* * Attempt to instantiate an I2C client by ID, probably loading a module. */ -static int init_i2c_module (struct i2c_adapter *adapter,int id,int addr) +static int init_i2c_module (struct i2c_adapter *adapter,const char *type, +int id,int addr) { +struct i2c_board_info info;char *modname;switch (id) {
@@ -226,7 +228,11 @@ static int init_i2c_module(struct i2c_ad }if (modname !=NULL )request_module (modname); -if (wis_i2c_probe_device (adapter, id, addr) ==1 ) + +memset (&info,0 ,sizeof (struct i2c_board_info )); + info.addr = addr; +strlcpy (info.type, type,I2C_NAME_SIZE ); +if (!i2c_new_device (adapter, &info))return 0 ;if (modname !=NULL ) printk(KERN_INFO
@@ -266,6 +272,7 @@ int go7007_register_encoder(struct go700if (go->i2c_adapter_online) {for (i =0 ; i < go->board_info->num_i2c_devs; ++i)init_i2c_module (&go->i2c_adapter, + go->board_info->i2c_devs[i].type, go->board_info->i2c_devs[i].id, go->board_info->i2c_devs[i].addr);if (go->board_id ==GO7007_BOARDID_ADLINK_MPG24 )
drivers/staging/go7007/go7007-i2c.c +0 -83
96 lines not on this page · raw message
drivers/staging/go7007/go7007-priv.h +1 -0
@@ -87,6 +87,7 @@ struct go7007_board_info {int audio_main_div;int num_i2c_devs;struct { +const char *type;int id;int addr; } i2c_devs[4 ];
drivers/staging/go7007/go7007-usb.c +11 -3
@@ -91,6 +91,7 @@ static struct go7007_usb_board board_mat .num_i2c_devs = 1, .i2c_devs = { { + .type = "wis_saa7115", .id = I2C_DRIVERID_WIS_SAA7115, .addr = 0x20, },
@@ -127,6 +128,7 @@ static struct go7007_usb_board board_mat .num_i2c_devs = 1, .i2c_devs = { { + .type = "wis_saa7113", .id = I2C_DRIVERID_WIS_SAA7113, .addr = 0x25, },
@@ -164,6 +166,7 @@ static struct go7007_usb_board board_sta .num_i2c_devs = 1, .i2c_devs = { { + .type = "wis_saa7115", .id = I2C_DRIVERID_WIS_SAA7115, .addr = 0x20, },
@@ -209,14 +212,17 @@ static struct go7007_usb_board board_px_ .num_i2c_devs = 3, .i2c_devs = { { + .type = "wis_saa7115", .id = I2C_DRIVERID_WIS_SAA7115, .addr = 0x20, }, { + .type = "wis_uda1342", .id = I2C_DRIVERID_WIS_UDA1342, .addr = 0x1a, }, { + .type = "wis_sony_tuner", .id = I2C_DRIVERID_WIS_SONY_TUNER, .addr = 0x60, },
@@ -264,6 +270,7 @@ static struct go7007_usb_board board_xme .num_i2c_devs = 1, .i2c_devs = { { + .type = "wis_ov7640", .id = I2C_DRIVERID_WIS_OV7640, .addr = 0x21, },
@@ -296,6 +303,7 @@ static struct go7007_usb_board board_mat .num_i2c_devs = 1, .i2c_devs = { { + .type = "wis_tw9903", .id = I2C_DRIVERID_WIS_TW9903, .addr = 0x44, },
@@ -385,6 +393,7 @@ static struct go7007_usb_board board_adl .num_i2c_devs = 1, .i2c_devs = { { + .type = "wis_twTW2804", .id = I2C_DRIVERID_WIS_TW2804, .addr = 0x00, /* yes, really */ },
@@ -415,8 +424,9 @@ static struct go7007_usb_board board_sen .num_i2c_devs = 1, .i2c_devs = { { + .type = "s2250_board", .id = I2C_DRIVERID_S2250, - .addr = 0x34, + .addr = 0x43, }, }, .num_inputs = 2,
@@ -943,9 +953,7 @@ static struct i2c_algorithm go7007_usb_astatic struct i2c_adapter go7007_usb_adap_templ = { .owner =THIS_MODULE , - .class =I2C_CLASS_TV_ANALOG , .name ="WIS GO7007SB EZ-USB" , - .id =I2C_ALGO_GO7007_USB , .algo = &go7007_usb_algo, };
drivers/staging/go7007/s2250-board.c +30 -41
170 lines not on this page · raw message
drivers/staging/go7007/wis-i2c.h +0 -9
@@ -24,21 +24,12 @@#define I2C_DRIVERID_WIS_OV7640 0xf0f5#define I2C_DRIVERID_WIS_TW2804 0xf0f6#define I2C_DRIVERID_S2250 0xf0f7 -#define I2C_ALGO_GO7007 0xf00000 -#define I2C_ALGO_GO7007_USB 0xf10000/* Flag to indicate that the client needs to be accessed with SCCB semantics */ /* We re-use the I2C_M_TEN value so the flag passes through the masks in the * core I2C code. Major kludge, but the I2C layer ain't exactly flexible. */ #define I2C_CLIENT_SCCB 0x10 -typedef int (*found_proc ) (struct i2c_adapter *,int ,int ); -int wis_i2c_add_driver (unsigned int id,found_proc found_proc); -void wis_i2c_del_driver (found_proc found_proc); - -int wis_i2c_probe_device (struct i2c_adapter *adapter, -unsigned int id,int addr); -/* Definitions for new video decoder commands */ struct video_decoder_resolution {
drivers/staging/go7007/wis-ov7640.c +16 -38
92 lines not on this page · raw message
drivers/staging/go7007/wis-saa7113.c +19 -41
109 lines not on this page · raw message
drivers/staging/go7007/wis-saa7115.c +19 -41
109 lines not on this page · raw message
drivers/staging/go7007/wis-sony-tuner.c +18 -42
103 lines not on this page · raw message
drivers/staging/go7007/wis-tw2804.c +18 -39
100 lines not on this page · raw message
drivers/staging/go7007/wis-tw9903.c +19 -41
108 lines not on this page · raw message
drivers/staging/go7007/wis-uda1342.c +15 -37
88 lines not on this page · raw message
Signature · 1 line
Jean Delvare
Quoted 7 lines · Jean Delvare
Move the go7007 driver away from the legacy i2c binding model, which is going away really soon now.
The I2C addresses of the audio and video chips in s2250-board didn't look quite right, apparently they were left-aligned values when Linux wants right-aligned values, so I fixed them too.
Quoted 6 lines
Signed-off-by Jean Delvare <[email protected]>Cc Greg Kroah-Hartman <[email protected]>---
Note: I just pushed this to Linus, as this is blocking the removal of the legacy i2c binding model, and I see no point in waiting for a driver which clearly doesn't work today anyway.
No objection from me, feel free to add my:
if you need it.
thanks,
greg k-h