aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/video/saa711x.c206
1 files changed, 100 insertions, 106 deletions
diff --git a/drivers/media/video/saa711x.c b/drivers/media/video/saa711x.c
index 85f3403f7404..9aa8827de2c3 100644
--- a/drivers/media/video/saa711x.c
+++ b/drivers/media/video/saa711x.c
@@ -1,16 +1,10 @@
1/* 1/*
2 * saa7111 - Philips SAA7113A video decoder driver version 0.0.3 2 * saa711x - Philips SAA711x video decoder driver version 0.0.1
3 * 3 *
4 * Copyright (C) 1998 Dave Perks <dperks@ibm.net> 4 * To do: Now, it handles only saa7113/7114. Should be improved to
5 * handle all Philips saa711x devices.
5 * 6 *
6 * Slight changes for video timing and attachment output by 7 * Based on saa7113 driver from Dave Perks <dperks@ibm.net>
7 * Wolfgang Scherr <scherr@net4you.net>
8 *
9 * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net>
10 * - moved over to linux>=2.4.x i2c protocol (1/1/2003)
11 *
12 * Changes by Michael Hunold <michael@mihu.de>
13 * - implemented DECODER_SET_GPIO, DECODER_INIT, DECODER_SET_VBI_BYPASS
14 * 8 *
15 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -47,7 +41,7 @@
47#include <asm/uaccess.h> 41#include <asm/uaccess.h>
48#include <linux/videodev.h> 42#include <linux/videodev.h>
49 43
50MODULE_DESCRIPTION("Philips SAA7113 video decoder driver"); 44MODULE_DESCRIPTION("Philips SAA711x video decoder driver");
51MODULE_AUTHOR("Dave Perks, Jose Ignacio Gijon, Joerg Heckenbach, Mark McClelland, Dwaine Garden"); 45MODULE_AUTHOR("Dave Perks, Jose Ignacio Gijon, Joerg Heckenbach, Mark McClelland, Dwaine Garden");
52MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
53 47
@@ -71,7 +65,7 @@ MODULE_PARM_DESC(debug, " Set the default Debug level. Default: 0 (Off) - (0-1)
71 65
72/* ----------------------------------------------------------------------- */ 66/* ----------------------------------------------------------------------- */
73 67
74struct saa7113 { 68struct saa711x {
75 unsigned char reg[32]; 69 unsigned char reg[32];
76 70
77 int norm; 71 int norm;
@@ -89,29 +83,29 @@ struct saa7113 {
89/* ----------------------------------------------------------------------- */ 83/* ----------------------------------------------------------------------- */
90 84
91static inline int 85static inline int
92saa7113_write (struct i2c_client *client, 86saa711x_write (struct i2c_client *client,
93 u8 reg, 87 u8 reg,
94 u8 value) 88 u8 value)
95{ 89{
96 struct saa7113 *decoder = i2c_get_clientdata(client); 90 struct saa711x *decoder = i2c_get_clientdata(client);
97 91
98 decoder->reg[reg] = value; 92 decoder->reg[reg] = value;
99 return i2c_smbus_write_byte_data(client, reg, value); 93 return i2c_smbus_write_byte_data(client, reg, value);
100} 94}
101 95
102static int 96static int
103saa7113_write_block (struct i2c_client *client, 97saa711x_write_block (struct i2c_client *client,
104 const u8 *data, 98 const u8 *data,
105 unsigned int len) 99 unsigned int len)
106{ 100{
107 int ret = -1; 101 int ret = -1;
108 u8 reg; 102 u8 reg;
109 103
110 /* the saa7113 has an autoincrement function, use it if 104 /* the saa711x has an autoincrement function, use it if
111 * the adapter understands raw I2C */ 105 * the adapter understands raw I2C */
112 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) { 106 if (i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
113 /* do raw I2C, not smbus compatible */ 107 /* do raw I2C, not smbus compatible */
114 struct saa7113 *decoder = i2c_get_clientdata(client); 108 struct saa711x *decoder = i2c_get_clientdata(client);
115 struct i2c_msg msg; 109 struct i2c_msg msg;
116 u8 block_data[32]; 110 u8 block_data[32];
117 111
@@ -136,7 +130,7 @@ saa7113_write_block (struct i2c_client *client,
136 /* do some slow I2C emulation kind of thing */ 130 /* do some slow I2C emulation kind of thing */
137 while (len >= 2) { 131 while (len >= 2) {
138 reg = *data++; 132 reg = *data++;
139 if ((ret = saa7113_write(client, reg, 133 if ((ret = saa711x_write(client, reg,
140 *data++)) < 0) 134 *data++)) < 0)
141 break; 135 break;
142 len -= 2; 136 len -= 2;
@@ -147,14 +141,14 @@ saa7113_write_block (struct i2c_client *client,
147} 141}
148 142
149static int 143static int
150saa7113_init_decoder (struct i2c_client *client, 144saa711x_init_decoder (struct i2c_client *client,
151 struct video_decoder_init *init) 145 struct video_decoder_init *init)
152{ 146{
153 return saa7113_write_block(client, init->data, init->len); 147 return saa711x_write_block(client, init->data, init->len);
154} 148}
155 149
156static inline int 150static inline int
157saa7113_read (struct i2c_client *client, 151saa711x_read (struct i2c_client *client,
158 u8 reg) 152 u8 reg)
159{ 153{
160 return i2c_smbus_read_byte_data(client, reg); 154 return i2c_smbus_read_byte_data(client, reg);
@@ -162,39 +156,39 @@ saa7113_read (struct i2c_client *client,
162 156
163/* ----------------------------------------------------------------------- */ 157/* ----------------------------------------------------------------------- */
164 158
165static const unsigned char saa7113_i2c_init[] = { 159static const unsigned char saa711x_i2c_init[] = {
166 0x00, 0x00, /* PH7113_CHIP_VERSION 00 - ID byte */ 160 0x00, 0x00, /* PH711x_CHIP_VERSION 00 - ID byte */
167 0x01, 0x08, /* PH7113_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */ 161 0x01, 0x08, /* PH711x_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */
168 0x02, 0xc0, /* PH7113_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */ 162 0x02, 0xc0, /* PH711x_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */
169 0x03, 0x23, /* PH7113_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */ 163 0x03, 0x23, /* PH711x_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */
170 0x04, 0x00, /* PH7113_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */ 164 0x04, 0x00, /* PH711x_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */
171 0x05, 0x00, /* PH7113_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */ 165 0x05, 0x00, /* PH711x_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */
172 0x06, 0xeb, /* PH7113_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */ 166 0x06, 0xeb, /* PH711x_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */
173 0x07, 0xe0, /* PH7113_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */ 167 0x07, 0xe0, /* PH711x_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */
174 0x08, 0x88, /* PH7113_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */ 168 0x08, 0x88, /* PH711x_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */
175 0x09, 0x00, /* PH7113_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */ 169 0x09, 0x00, /* PH711x_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */
176 0x0a, 0x80, /* PH7113_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */ 170 0x0a, 0x80, /* PH711x_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */
177 0x0b, 0x47, /* PH7113_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */ 171 0x0b, 0x47, /* PH711x_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */
178 0x0c, 0x40, /* PH7113_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */ 172 0x0c, 0x40, /* PH711x_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */
179 0x0d, 0x00, /* PH7113_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */ 173 0x0d, 0x00, /* PH711x_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */
180 0x0e, 0x01, /* PH7113_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */ 174 0x0e, 0x01, /* PH711x_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */
181 0x0f, 0xaa, /* PH7113_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */ 175 0x0f, 0xaa, /* PH711x_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */
182 0x10, 0x00, /* PH7113_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */ 176 0x10, 0x00, /* PH711x_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */
183 0x11, 0x1C, /* PH7113_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */ 177 0x11, 0x1C, /* PH711x_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */
184 0x12, 0x01, /* PH7113_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */ 178 0x12, 0x01, /* PH711x_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */
185 0x13, 0x00, /* PH7113_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */ 179 0x13, 0x00, /* PH711x_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */
186 0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */ 180 0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */
187 0x15, 0x00, /* PH7113_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */ 181 0x15, 0x00, /* PH711x_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */
188 0x16, 0x00, /* PH7113_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */ 182 0x16, 0x00, /* PH711x_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */
189 0x17, 0x00, /* PH7113_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */ 183 0x17, 0x00, /* PH711x_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */
190}; 184};
191 185
192static int 186static int
193saa7113_command (struct i2c_client *client, 187saa711x_command (struct i2c_client *client,
194 unsigned int cmd, 188 unsigned int cmd,
195 void *arg) 189 void *arg)
196{ 190{
197 struct saa7113 *decoder = i2c_get_clientdata(client); 191 struct saa711x *decoder = i2c_get_clientdata(client);
198 192
199 switch (cmd) { 193 switch (cmd) {
200 194
@@ -203,12 +197,12 @@ saa7113_command (struct i2c_client *client,
203 { 197 {
204 struct video_decoder_init *init = arg; 198 struct video_decoder_init *init = arg;
205 if (NULL != init) 199 if (NULL != init)
206 return saa7113_init_decoder(client, init); 200 return saa711x_init_decoder(client, init);
207 else { 201 else {
208 struct video_decoder_init vdi; 202 struct video_decoder_init vdi;
209 vdi.data = saa7113_i2c_init; 203 vdi.data = saa711x_i2c_init;
210 vdi.len = sizeof(saa7113_i2c_init); 204 vdi.len = sizeof(saa711x_i2c_init);
211 return saa7113_init_decoder(client, &vdi); 205 return saa711x_init_decoder(client, &vdi);
212 } 206 }
213 } 207 }
214 208
@@ -222,7 +216,7 @@ saa7113_command (struct i2c_client *client,
222 printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i); 216 printk(KERN_DEBUG "%s: %03x", I2C_NAME(client), i);
223 for (j = 0; j < 16; ++j) { 217 for (j = 0; j < 16; ++j) {
224 printk(" %02x", 218 printk(" %02x",
225 saa7113_read(client, i + j)); 219 saa711x_read(client, i + j));
226 } 220 }
227 printk("\n"); 221 printk("\n");
228 } 222 }
@@ -249,7 +243,7 @@ saa7113_command (struct i2c_client *client,
249 int status; 243 int status;
250 int res; 244 int res;
251 245
252 status = saa7113_read(client, 0x1f); 246 status = saa711x_read(client, 0x1f);
253 dprintk(1, KERN_DEBUG "%s status: 0x%02x\n", I2C_NAME(client), 247 dprintk(1, KERN_DEBUG "%s status: 0x%02x\n", I2C_NAME(client),
254 status); 248 status);
255 res = 0; 249 res = 0;
@@ -286,10 +280,10 @@ saa7113_command (struct i2c_client *client,
286 { 280 {
287 int *iarg = arg; 281 int *iarg = arg;
288 if (0 != *iarg) { 282 if (0 != *iarg) {
289 saa7113_write(client, 0x11, 283 saa711x_write(client, 0x11,
290 (decoder->reg[0x11] | 0x80)); 284 (decoder->reg[0x11] | 0x80));
291 } else { 285 } else {
292 saa7113_write(client, 0x11, 286 saa711x_write(client, 0x11,
293 (decoder->reg[0x11] & 0x7f)); 287 (decoder->reg[0x11] & 0x7f));
294 } 288 }
295 break; 289 break;
@@ -299,10 +293,10 @@ saa7113_command (struct i2c_client *client,
299 { 293 {
300 int *iarg = arg; 294 int *iarg = arg;
301 if (0 != *iarg) { 295 if (0 != *iarg) {
302 saa7113_write(client, 0x13, 296 saa711x_write(client, 0x13,
303 (decoder->reg[0x13] & 0xf0) | 0x0a); 297 (decoder->reg[0x13] & 0xf0) | 0x0a);
304 } else { 298 } else {
305 saa7113_write(client, 0x13, 299 saa711x_write(client, 0x13,
306 (decoder->reg[0x13] & 0xf0)); 300 (decoder->reg[0x13] & 0xf0));
307 } 301 }
308 break; 302 break;
@@ -315,30 +309,30 @@ saa7113_command (struct i2c_client *client,
315 switch (*iarg) { 309 switch (*iarg) {
316 310
317 case VIDEO_MODE_NTSC: 311 case VIDEO_MODE_NTSC:
318 saa7113_write(client, 0x08, 312 saa711x_write(client, 0x08,
319 (decoder->reg[0x08] & 0x3f) | 0x40); 313 (decoder->reg[0x08] & 0x3f) | 0x40);
320 saa7113_write(client, 0x0e, 314 saa711x_write(client, 0x0e,
321 (decoder->reg[0x0e] & 0x8f)); 315 (decoder->reg[0x0e] & 0x8f));
322 break; 316 break;
323 317
324 case VIDEO_MODE_PAL: 318 case VIDEO_MODE_PAL:
325 saa7113_write(client, 0x08, 319 saa711x_write(client, 0x08,
326 (decoder->reg[0x08] & 0x3f) | 0x00); 320 (decoder->reg[0x08] & 0x3f) | 0x00);
327 saa7113_write(client, 0x0e, 321 saa711x_write(client, 0x0e,
328 (decoder->reg[0x0e] & 0x8f)); 322 (decoder->reg[0x0e] & 0x8f));
329 break; 323 break;
330 324
331 case VIDEO_MODE_SECAM: 325 case VIDEO_MODE_SECAM:
332 saa7113_write(client, 0x08, 326 saa711x_write(client, 0x08,
333 (decoder->reg[0x0e] & 0x3f) | 0x00); 327 (decoder->reg[0x0e] & 0x3f) | 0x00);
334 saa7113_write(client, 0x0e, 328 saa711x_write(client, 0x0e,
335 (decoder->reg[0x0e] & 0x8f) | 0x50); 329 (decoder->reg[0x0e] & 0x8f) | 0x50);
336 break; 330 break;
337 331
338 case VIDEO_MODE_AUTO: 332 case VIDEO_MODE_AUTO:
339 saa7113_write(client, 0x08, 333 saa711x_write(client, 0x08,
340 (decoder->reg[0x08] & 0x3f) | 0x80); 334 (decoder->reg[0x08] & 0x3f) | 0x80);
341 saa7113_write(client, 0x0e, 335 saa711x_write(client, 0x0e,
342 (decoder->reg[0x0e] & 0x8f)); 336 (decoder->reg[0x0e] & 0x8f));
343 break; 337 break;
344 338
@@ -359,10 +353,10 @@ saa7113_command (struct i2c_client *client,
359 if (decoder->input != *iarg) { 353 if (decoder->input != *iarg) {
360 decoder->input = *iarg; 354 decoder->input = *iarg;
361 /* select mode */ 355 /* select mode */
362 saa7113_write(client, 0x02, 356 saa711x_write(client, 0x02,
363 (decoder->reg[0x02] & 0xf0) | decoder->input); 357 (decoder->reg[0x02] & 0xf0) | decoder->input);
364 /* bypass chrominance trap for modes 4..7 */ 358 /* bypass chrominance trap for modes 4..7 */
365 saa7113_write(client, 0x09, 359 saa711x_write(client, 0x09,
366 (decoder->reg[0x09] & 0x7f) | ((decoder->input > 3) ? 0x80 : 0)); 360 (decoder->reg[0x09] & 0x7f) | ((decoder->input > 3) ? 0x80 : 0));
367 } 361 }
368 } 362 }
@@ -398,22 +392,22 @@ saa7113_command (struct i2c_client *client,
398 */ 392 */
399 393
400 if (decoder->enable) { 394 if (decoder->enable) {
401 saa7113_write(client, 0x02, 395 saa711x_write(client, 0x02,
402 (decoder-> 396 (decoder->
403 reg[0x02] & 0xf8) | 397 reg[0x02] & 0xf8) |
404 decoder->input); 398 decoder->input);
405 saa7113_write(client, 0x08, 399 saa711x_write(client, 0x08,
406 (decoder->reg[0x08] & 0xfb)); 400 (decoder->reg[0x08] & 0xfb));
407 saa7113_write(client, 0x11, 401 saa711x_write(client, 0x11,
408 (decoder-> 402 (decoder->
409 reg[0x11] & 0xf3) | 0x0c); 403 reg[0x11] & 0xf3) | 0x0c);
410 } else { 404 } else {
411 saa7113_write(client, 0x02, 405 saa711x_write(client, 0x02,
412 (decoder->reg[0x02] & 0xf8)); 406 (decoder->reg[0x02] & 0xf8));
413 saa7113_write(client, 0x08, 407 saa711x_write(client, 0x08,
414 (decoder-> 408 (decoder->
415 reg[0x08] & 0xfb) | 0x04); 409 reg[0x08] & 0xfb) | 0x04);
416 saa7113_write(client, 0x11, 410 saa711x_write(client, 0x11,
417 (decoder->reg[0x11] & 0xf3)); 411 (decoder->reg[0x11] & 0xf3));
418 } 412 }
419 } 413 }
@@ -427,23 +421,23 @@ saa7113_command (struct i2c_client *client,
427 if (decoder->bright != pic->brightness) { 421 if (decoder->bright != pic->brightness) {
428 /* We want 0 to 255 we get 0-65535 */ 422 /* We want 0 to 255 we get 0-65535 */
429 decoder->bright = pic->brightness; 423 decoder->bright = pic->brightness;
430 saa7113_write(client, 0x0a, decoder->bright >> 8); 424 saa711x_write(client, 0x0a, decoder->bright >> 8);
431 } 425 }
432 if (decoder->contrast != pic->contrast) { 426 if (decoder->contrast != pic->contrast) {
433 /* We want 0 to 127 we get 0-65535 */ 427 /* We want 0 to 127 we get 0-65535 */
434 decoder->contrast = pic->contrast; 428 decoder->contrast = pic->contrast;
435 saa7113_write(client, 0x0b, 429 saa711x_write(client, 0x0b,
436 decoder->contrast >> 9); 430 decoder->contrast >> 9);
437 } 431 }
438 if (decoder->sat != pic->colour) { 432 if (decoder->sat != pic->colour) {
439 /* We want 0 to 127 we get 0-65535 */ 433 /* We want 0 to 127 we get 0-65535 */
440 decoder->sat = pic->colour; 434 decoder->sat = pic->colour;
441 saa7113_write(client, 0x0c, decoder->sat >> 9); 435 saa711x_write(client, 0x0c, decoder->sat >> 9);
442 } 436 }
443 if (decoder->hue != pic->hue) { 437 if (decoder->hue != pic->hue) {
444 /* We want -128 to 127 we get 0-65535 */ 438 /* We want -128 to 127 we get 0-65535 */
445 decoder->hue = pic->hue; 439 decoder->hue = pic->hue;
446 saa7113_write(client, 0x0d, 440 saa711x_write(client, 0x0d,
447 (decoder->hue - 32768) >> 8); 441 (decoder->hue - 32768) >> 8);
448 } 442 }
449 } 443 }
@@ -473,21 +467,21 @@ static unsigned short normal_i2c[] = {
473I2C_CLIENT_INSMOD; 467I2C_CLIENT_INSMOD;
474 468
475 469
476static struct i2c_driver i2c_driver_saa7113; 470static struct i2c_driver i2c_driver_saa711x;
477 471
478static int 472static int
479saa7113_detect_client (struct i2c_adapter *adapter, 473saa711x_detect_client (struct i2c_adapter *adapter,
480 int address, 474 int address,
481 int kind) 475 int kind)
482{ 476{
483 int i; 477 int i;
484 struct i2c_client *client; 478 struct i2c_client *client;
485 struct saa7113 *decoder; 479 struct saa711x *decoder;
486 struct video_decoder_init vdi; 480 struct video_decoder_init vdi;
487 481
488 dprintk(1, 482 dprintk(1,
489 KERN_INFO 483 KERN_INFO
490 "saa7113.c: detecting saa7113 client on address 0x%x\n", 484 "saa711x.c: detecting saa711x client on address 0x%x\n",
491 address << 1); 485 address << 1);
492 486
493 /* Check if the adapter supports the needed features */ 487 /* Check if the adapter supports the needed features */
@@ -500,15 +494,15 @@ saa7113_detect_client (struct i2c_adapter *adapter,
500 memset(client, 0, sizeof(struct i2c_client)); 494 memset(client, 0, sizeof(struct i2c_client));
501 client->addr = address; 495 client->addr = address;
502 client->adapter = adapter; 496 client->adapter = adapter;
503 client->driver = &i2c_driver_saa7113; 497 client->driver = &i2c_driver_saa711x;
504 client->flags = I2C_CLIENT_ALLOW_USE; 498 client->flags = I2C_CLIENT_ALLOW_USE;
505 strlcpy(I2C_NAME(client), "saa7113", sizeof(I2C_NAME(client))); 499 strlcpy(I2C_NAME(client), "saa711x", sizeof(I2C_NAME(client)));
506 decoder = kmalloc(sizeof(struct saa7113), GFP_KERNEL); 500 decoder = kmalloc(sizeof(struct saa711x), GFP_KERNEL);
507 if (decoder == NULL) { 501 if (decoder == NULL) {
508 kfree(client); 502 kfree(client);
509 return -ENOMEM; 503 return -ENOMEM;
510 } 504 }
511 memset(decoder, 0, sizeof(struct saa7113)); 505 memset(decoder, 0, sizeof(struct saa711x));
512 decoder->norm = VIDEO_MODE_NTSC; 506 decoder->norm = VIDEO_MODE_NTSC;
513 decoder->input = 0; 507 decoder->input = 0;
514 decoder->enable = 1; 508 decoder->enable = 1;
@@ -525,9 +519,9 @@ saa7113_detect_client (struct i2c_adapter *adapter,
525 return i; 519 return i;
526 } 520 }
527 521
528 vdi.data = saa7113_i2c_init; 522 vdi.data = saa711x_i2c_init;
529 vdi.len = sizeof(saa7113_i2c_init); 523 vdi.len = sizeof(saa711x_i2c_init);
530 i = saa7113_init_decoder(client, &vdi); 524 i = saa711x_init_decoder(client, &vdi);
531 if (i < 0) { 525 if (i < 0) {
532 dprintk(1, KERN_ERR "%s_attach error: init status %d\n", 526 dprintk(1, KERN_ERR "%s_attach error: init status %d\n",
533 I2C_NAME(client), i); 527 I2C_NAME(client), i);
@@ -535,7 +529,7 @@ saa7113_detect_client (struct i2c_adapter *adapter,
535 dprintk(1, 529 dprintk(1,
536 KERN_INFO 530 KERN_INFO
537 "%s_attach: chip version %x at address 0x%x\n", 531 "%s_attach: chip version %x at address 0x%x\n",
538 I2C_NAME(client), saa7113_read(client, 0x00) >> 4, 532 I2C_NAME(client), saa711x_read(client, 0x00) >> 4,
539 client->addr << 1); 533 client->addr << 1);
540 } 534 }
541 535
@@ -543,19 +537,19 @@ saa7113_detect_client (struct i2c_adapter *adapter,
543} 537}
544 538
545static int 539static int
546saa7113_attach_adapter (struct i2c_adapter *adapter) 540saa711x_attach_adapter (struct i2c_adapter *adapter)
547{ 541{
548 dprintk(1, 542 dprintk(1,
549 KERN_INFO 543 KERN_INFO
550 "saa7113.c: starting probe for adapter %s (0x%x)\n", 544 "saa711x.c: starting probe for adapter %s (0x%x)\n",
551 I2C_NAME(adapter), adapter->id); 545 I2C_NAME(adapter), adapter->id);
552 return i2c_probe(adapter, &addr_data, &saa7113_detect_client); 546 return i2c_probe(adapter, &addr_data, &saa711x_detect_client);
553} 547}
554 548
555static int 549static int
556saa7113_detach_client (struct i2c_client *client) 550saa711x_detach_client (struct i2c_client *client)
557{ 551{
558 struct saa7113 *decoder = i2c_get_clientdata(client); 552 struct saa711x *decoder = i2c_get_clientdata(client);
559 int err; 553 int err;
560 554
561 err = i2c_detach_client(client); 555 err = i2c_detach_client(client);
@@ -571,29 +565,29 @@ saa7113_detach_client (struct i2c_client *client)
571 565
572/* ----------------------------------------------------------------------- */ 566/* ----------------------------------------------------------------------- */
573 567
574static struct i2c_driver i2c_driver_saa7113 = { 568static struct i2c_driver i2c_driver_saa711x = {
575 .owner = THIS_MODULE, 569 .owner = THIS_MODULE,
576 .name = "saa7113", 570 .name = "saa711x",
577 571
578 .id = I2C_DRIVERID_SAA7113, 572 .id = I2C_DRIVERID_SAA711X,
579 .flags = I2C_DF_NOTIFY, 573 .flags = I2C_DF_NOTIFY,
580 574
581 .attach_adapter = saa7113_attach_adapter, 575 .attach_adapter = saa711x_attach_adapter,
582 .detach_client = saa7113_detach_client, 576 .detach_client = saa711x_detach_client,
583 .command = saa7113_command, 577 .command = saa711x_command,
584}; 578};
585 579
586static int __init 580static int __init
587saa7113_init (void) 581saa711x_init (void)
588{ 582{
589 return i2c_add_driver(&i2c_driver_saa7113); 583 return i2c_add_driver(&i2c_driver_saa711x);
590} 584}
591 585
592static void __exit 586static void __exit
593saa7113_exit (void) 587saa711x_exit (void)
594{ 588{
595 i2c_del_driver(&i2c_driver_saa7113); 589 i2c_del_driver(&i2c_driver_saa711x);
596} 590}
597 591
598module_init(saa7113_init); 592module_init(saa711x_init);
599module_exit(saa7113_exit); 593module_exit(saa711x_exit);