X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fmedia%2Fvideo%2Fadv7175.c;h=68e7d7aff5e6423b4bf51386473fe6c6d2c62663;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=95d0974b0ab53497a6163d537ec3614cf082f495;hpb=cee37fe97739d85991964371c1f3a745c00dd236;p=linux-2.6.git diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 95d0974b0..68e7d7aff 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c @@ -1,4 +1,4 @@ -/* +/* * adv7175 - adv7175a video encoder driver version 0.0.3 * * Copyright (C) 1998 Dave Perks @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -50,7 +49,6 @@ MODULE_AUTHOR("Dave Perks"); MODULE_LICENSE("GPL"); #include -#include #define I2C_NAME(s) (s)->name @@ -69,8 +67,6 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); /* ----------------------------------------------------------------------- */ struct adv7175 { - unsigned char reg[128]; - int norm; int input; int enable; @@ -96,9 +92,6 @@ adv7175_write (struct i2c_client *client, u8 reg, u8 value) { - struct adv7175 *encoder = i2c_get_clientdata(client); - - encoder->reg[reg] = value; return i2c_smbus_write_byte_data(client, reg, value); } @@ -121,25 +114,21 @@ adv7175_write_block (struct i2c_client *client, * the adapter understands raw I2C */ if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { /* do raw I2C, not smbus compatible */ - struct adv7175 *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++] = - encoder->reg[reg++] = data[1]; + block_data[block_len++] = data[1]; + reg++; 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 { @@ -172,24 +161,6 @@ set_subcarrier_freq (struct i2c_client *client, adv7175_write(client, 0x05, 0x25); } -#ifdef ENCODER_DUMP -static void -dump (struct i2c_client *client) -{ - struct adv7175 *encoder = i2c_get_clientdata(client); - int i, j; - - printk(KERN_INFO "%s: registry dump\n", I2C_NAME(client)); - for (i = 0; i < 182 / 8; i++) { - printk("%s: 0x%02x -", I2C_NAME(client), i * 8); - for (j = 0; j < 8; j++) { - printk(" 0x%02x", encoder->reg[i * 8 + j]); - } - printk("\n"); - } -} -#endif - /* ----------------------------------------------------------------------- */ // Output filter: S-Video Composite @@ -262,7 +233,7 @@ adv7175_command (struct i2c_client *client, sizeof(init_common)); adv7175_write(client, 0x07, TR0MODE | TR0RST); adv7175_write(client, 0x07, TR0MODE); - break; + break; case ENCODER_GET_CAPABILITIES: { @@ -408,14 +379,6 @@ adv7175_command (struct i2c_client *client, } break; -#ifdef ENCODER_DUMP - case ENCODER_DUMP: - { - dump(client); - } - break; -#endif - default: return -EINVAL; } @@ -434,22 +397,13 @@ static unsigned short normal_i2c[] = I2C_ADV7176 >> 1, (I2C_ADV7176 >> 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_adv7175; @@ -473,14 +427,12 @@ adv7175_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_adv7175; - client->flags = I2C_CLIENT_ALLOW_USE; if ((client->addr == I2C_ADV7175 >> 1) || (client->addr == (I2C_ADV7175 >> 1) + 1)) { dname = adv7175_name; @@ -494,12 +446,11 @@ adv7175_detect_client (struct i2c_adapter *adapter, } strlcpy(I2C_NAME(client), dname, sizeof(I2C_NAME(client))); - encoder = kmalloc(sizeof(struct adv7175), GFP_KERNEL); + encoder = kzalloc(sizeof(struct adv7175), GFP_KERNEL); if (encoder == NULL) { kfree(client); return -ENOMEM; } - memset(encoder, 0, sizeof(struct adv7175)); encoder->norm = VIDEO_MODE_PAL; encoder->input = 0; encoder->enable = 1; @@ -558,11 +509,11 @@ adv7175_detach_client (struct i2c_client *client) /* ----------------------------------------------------------------------- */ static struct i2c_driver i2c_driver_adv7175 = { - .owner = THIS_MODULE, - .name = "adv7175", /* name */ + .driver = { + .name = "adv7175", /* name */ + }, .id = I2C_DRIVERID_ADV7175, - .flags = I2C_DF_NOTIFY, .attach_adapter = adv7175_attach_adapter, .detach_client = adv7175_detach_client,