X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fadv7170.c;h=48709582a18612400040d91a53e4368cb0cf2081;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=80254caa444c9fc40bff4ebe3a8f4dd0bbf23878;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 80254caa4..48709582a 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c @@ -1,9 +1,9 @@ -/* +/* * adv7170 - adv7170, adv7171 video encoder driver version 0.0.1 * * Copyright (C) 2002 Maxim Yevtyushkin * - * Based on adv7176 driver by: + * Based on adv7176 driver by: * * Copyright (C) 1998 Dave Perks * Copyright (C) 1999 Wolfgang Scherr @@ -43,7 +43,6 @@ #include #include #include -#include #include #include @@ -54,7 +53,6 @@ MODULE_AUTHOR("Maxim Yevtyushkin"); MODULE_LICENSE("GPL"); #include -#include #define I2C_NAME(x) (x)->name @@ -126,24 +124,21 @@ adv7170_write_block (struct i2c_client *client, if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { /* do raw I2C, not smbus compatible */ struct adv7170 *encoder = i2c_get_clientdata(client); - struct i2c_msg msg; u8 block_data[32]; + int block_len; - msg.addr = client->addr; - msg.flags = 0; while (len >= 2) { - msg.buf = (char *) block_data; - msg.len = 0; - block_data[msg.len++] = reg = data[0]; + block_len = 0; + block_data[block_len++] = reg = data[0]; do { - block_data[msg.len++] = + block_data[block_len++] = encoder->reg[reg++] = data[1]; len -= 2; data += 2; } while (len >= 2 && data[0] == reg && - msg.len < 32); - if ((ret = i2c_transfer(client->adapter, - &msg, 1)) < 0) + block_len < 32); + if ((ret = i2c_master_send(client, block_data, + block_len)) < 0) break; } } else { @@ -178,7 +173,7 @@ adv7170_write_block (struct i2c_client *client, static const unsigned char init_NTSC[] = { 0x00, 0x10, // MR0 0x01, 0x20, // MR1 - 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 + 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 0x03, 0x80, // MR3 0x04, 0x30, // MR4 0x05, 0x00, // Reserved @@ -201,7 +196,7 @@ static const unsigned char init_NTSC[] = { 0x16, 0x00, // CGMS_WSS_0 0x17, 0x00, // CGMS_WSS_1 0x18, 0x00, // CGMS_WSS_2 - 0x19, 0x00, // Teletext Ctl + 0x19, 0x00, // Teletext Ctl }; static const unsigned char init_PAL[] = { @@ -384,22 +379,13 @@ static unsigned short normal_i2c[] = I2C_ADV7171 >> 1, (I2C_ADV7171 >> 1) + 1, I2C_CLIENT_END }; -static unsigned short normal_i2c_range[] = { I2C_CLIENT_END }; - -static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; -static unsigned short probe_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; -static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; -static unsigned short ignore_range[2] = { I2C_CLIENT_END, I2C_CLIENT_END }; -static unsigned short force[2] = { I2C_CLIENT_END , I2C_CLIENT_END }; - + +static unsigned short ignore = I2C_CLIENT_END; + static struct i2c_client_address_data addr_data = { .normal_i2c = normal_i2c, - .normal_i2c_range = normal_i2c_range, - .probe = probe, - .probe_range = probe_range, - .ignore = ignore, - .ignore_range = ignore_range, - .force = force + .probe = &ignore, + .ignore = &ignore, }; static struct i2c_driver i2c_driver_adv7170; @@ -423,14 +409,12 @@ adv7170_detect_client (struct i2c_adapter *adapter, if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return 0; - client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); + client = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (client == 0) return -ENOMEM; - memset(client, 0, sizeof(struct i2c_client)); client->addr = address; client->adapter = adapter; client->driver = &i2c_driver_adv7170; - client->flags = I2C_CLIENT_ALLOW_USE; if ((client->addr == I2C_ADV7170 >> 1) || (client->addr == (I2C_ADV7170 >> 1) + 1)) { dname = adv7170_name; @@ -444,12 +428,11 @@ adv7170_detect_client (struct i2c_adapter *adapter, } strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); - encoder = kmalloc(sizeof(struct adv7170), GFP_KERNEL); + encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL); if (encoder == NULL) { kfree(client); return -ENOMEM; } - memset(encoder, 0, sizeof(struct adv7170)); encoder->norm = VIDEO_MODE_NTSC; encoder->input = 0; encoder->enable = 1; @@ -508,11 +491,11 @@ adv7170_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_adv7170 = { - .owner = THIS_MODULE, - .name = "adv7170", /* name */ + .driver = { + .name = "adv7170", /* name */ + }, .id = I2C_DRIVERID_ADV7170, - .flags = I2C_DF_NOTIFY, .attach_adapter = adv7170_attach_adapter, .detach_client = adv7170_detach_client,