aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2008-04-17 20:44:58 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-04-24 13:09:42 -0400
commit41facaa4b63cc1a0ff5a900149a29942d47e1491 (patch)
tree8c6b1ec84b0ed96e27f6edfc9c297d593b55288f /drivers
parent7e26ca8012a8392c5e53055b8ff3d9512faee6c6 (diff)
V4L/DVB (7613): em28xx: rename registers
Now, all registers will follow the same convension: EM28XX_R<reg_number>_<reg_name> This allows to associate a register with its value, and also with a canonical name. Also, registers that are specific to a given chip were renamed accordingly, as EM2800_foo (for 2800 only registers) or EM2880_foo (for registers that started to appear on em2880). Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c18
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c86
-rw-r--r--drivers/media/video/em28xx/em28xx-reg.h112
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c6
-rw-r--r--drivers/media/video/em28xx/em28xx.h26
5 files changed, 124 insertions, 124 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index cbf6e179acb4..ed50b4e55264 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -437,17 +437,17 @@ MODULE_DEVICE_TABLE(usb, em28xx_id_table);
437/* Board Hauppauge WinTV HVR 900 analog */ 437/* Board Hauppauge WinTV HVR 900 analog */
438struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = { 438struct em28xx_reg_seq hauppauge_wintv_hvr_900_analog[] = {
439 { -1, -1, 6}, 439 { -1, -1, 6},
440 {EM_R08_GPIO, 0x2d, 10}, 440 {EM28XX_R08_GPIO, 0x2d, 10},
441 {EM_R08_GPIO, 0x3d, 5}, 441 {EM28XX_R08_GPIO, 0x3d, 5},
442 { -1, -1, -1}, 442 { -1, -1, -1},
443}; 443};
444/* Board Hauppauge WinTV HVR 900 digital */ 444/* Board Hauppauge WinTV HVR 900 digital */
445struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = { 445struct em28xx_reg_seq hauppauge_wintv_hvr_900_digital[] = {
446 { -1, -1, 6}, 446 { -1, -1, 6},
447 {EM_R08_GPIO, 0x2e, 6}, 447 {EM28XX_R08_GPIO, 0x2e, 6},
448 {EM_R08_GPIO, 0x3e, 6}, 448 {EM28XX_R08_GPIO, 0x3e, 6},
449 {EM_R04_GPO, 0x04, 10}, 449 {EM2880_R04_GPO, 0x04, 10},
450 {EM_R04_GPO, 0x0c, 10}, 450 {EM2880_R04_GPO, 0x0c, 10},
451 { -1, -1, -1}, 451 { -1, -1, -1},
452}; 452};
453 453
@@ -528,7 +528,7 @@ void em28xx_pre_card_setup(struct em28xx *dev)
528 int rc; 528 int rc;
529 529
530 dev->wait_after_write = 5; 530 dev->wait_after_write = 5;
531 rc = em28xx_read_reg(dev, CHIPID_REG); 531 rc = em28xx_read_reg(dev, EM28XX_R0A_CHIPID);
532 if (rc > 0) { 532 if (rc > 0) {
533 switch (rc) { 533 switch (rc) {
534 case CHIP_ID_EM2883: 534 case CHIP_ID_EM2883:
@@ -547,8 +547,8 @@ void em28xx_pre_card_setup(struct em28xx *dev)
547 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: 547 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900:
548 case EM2880_BOARD_TERRATEC_HYBRID_XS: 548 case EM2880_BOARD_TERRATEC_HYBRID_XS:
549 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950: 549 case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_950:
550 em28xx_write_regs(dev, XCLK_REG, "\x27", 1); 550 em28xx_write_regs(dev, EM28XX_R0F_XCLK, "\x27", 1);
551 em28xx_write_regs(dev, I2C_CLK_REG, "\x40", 1); 551 em28xx_write_regs(dev, EM28XX_R06_I2C_CLK, "\x40", 1);
552 em28xx_write_regs(dev, 0x08, "\xff", 1); 552 em28xx_write_regs(dev, 0x08, "\xff", 1);
553 em28xx_write_regs(dev, 0x04, "\x00", 1); 553 em28xx_write_regs(dev, 0x04, "\x00", 1);
554 msleep(100); 554 msleep(100);
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index e47b206187b5..01d5f44268ff 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -194,17 +194,17 @@ static int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 *val)
194 int ret, i; 194 int ret, i;
195 u8 addr = reg & 0x7f; 195 u8 addr = reg & 0x7f;
196 196
197 ret = em28xx_write_regs(dev, AC97LSB_REG, val, 2); 197 ret = em28xx_write_regs(dev, EM28XX_R40_AC97LSB, val, 2);
198 if (ret < 0) 198 if (ret < 0)
199 return ret; 199 return ret;
200 200
201 ret = em28xx_write_regs(dev, AC97ADDR_REG, &addr, 1); 201 ret = em28xx_write_regs(dev, EM28XX_R42_AC97ADDR, &addr, 1);
202 if (ret < 0) 202 if (ret < 0)
203 return ret; 203 return ret;
204 204
205 /* Wait up to 50 ms for AC97 command to complete */ 205 /* Wait up to 50 ms for AC97 command to complete */
206 for (i = 0; i < 10; i++) { 206 for (i = 0; i < 10; i++) {
207 ret = em28xx_read_reg(dev, AC97BUSY_REG); 207 ret = em28xx_read_reg(dev, EM28XX_R43_AC97BUSY);
208 if (ret < 0) 208 if (ret < 0)
209 return ret; 209 return ret;
210 210
@@ -230,7 +230,7 @@ static int em28xx_set_audio_source(struct em28xx *dev)
230 else 230 else
231 input = EM2800_AUDIO_SRC_TUNER; 231 input = EM2800_AUDIO_SRC_TUNER;
232 232
233 ret = em28xx_write_regs(dev, EM2800_AUDIOSRC_REG, &input, 1); 233 ret = em28xx_write_regs(dev, EM2800_R08_AUDIOSRC, &input, 1);
234 if (ret < 0) 234 if (ret < 0)
235 return ret; 235 return ret;
236 } 236 }
@@ -256,7 +256,7 @@ static int em28xx_set_audio_source(struct em28xx *dev)
256 } 256 }
257 } 257 }
258 258
259 ret = em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); 259 ret = em28xx_write_reg_bits(dev, EM28XX_R0E_AUDIOSRC, input, 0xc0);
260 if (ret < 0) 260 if (ret < 0)
261 return ret; 261 return ret;
262 msleep(5); 262 msleep(5);
@@ -264,11 +264,11 @@ static int em28xx_set_audio_source(struct em28xx *dev)
264 /* Sets AC97 mixer registers 264 /* Sets AC97 mixer registers
265 This is seems to be needed, even for non-ac97 configs 265 This is seems to be needed, even for non-ac97 configs
266 */ 266 */
267 ret = em28xx_write_ac97(dev, VIDEO_AC97, video); 267 ret = em28xx_write_ac97(dev, EM28XX_R14_VIDEO_AC97, video);
268 if (ret < 0) 268 if (ret < 0)
269 return ret; 269 return ret;
270 270
271 ret = em28xx_write_ac97(dev, LINE_IN_AC97, line); 271 ret = em28xx_write_ac97(dev, EM28XX_R10_LINE_IN_AC97, line);
272 272
273 return ret; 273 return ret;
274} 274}
@@ -284,7 +284,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
284 284
285 /* Mute */ 285 /* Mute */
286 s[1] |= 0x80; 286 s[1] |= 0x80;
287 ret = em28xx_write_ac97(dev, MASTER_AC97, s); 287 ret = em28xx_write_ac97(dev, EM28XX_R02_MASTER_AC97, s);
288 288
289 if (ret < 0) 289 if (ret < 0)
290 return ret; 290 return ret;
@@ -295,7 +295,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
295 if (!dev->mute) 295 if (!dev->mute)
296 xclk |= 0x80; 296 xclk |= 0x80;
297 297
298 ret = em28xx_write_reg_bits(dev, XCLK_REG, xclk, 0xa7); 298 ret = em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, xclk, 0xa7);
299 if (ret < 0) 299 if (ret < 0)
300 return ret; 300 return ret;
301 msleep(10); 301 msleep(10);
@@ -306,7 +306,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
306 /* Unmute device */ 306 /* Unmute device */
307 if (!dev->mute) 307 if (!dev->mute)
308 s[1] &= ~0x80; 308 s[1] &= ~0x80;
309 ret = em28xx_write_ac97(dev, MASTER_AC97, s); 309 ret = em28xx_write_ac97(dev, EM28XX_R02_MASTER_AC97, s);
310 310
311 return ret; 311 return ret;
312} 312}
@@ -314,20 +314,20 @@ EXPORT_SYMBOL_GPL(em28xx_audio_analog_set);
314 314
315int em28xx_colorlevels_set_default(struct em28xx *dev) 315int em28xx_colorlevels_set_default(struct em28xx *dev)
316{ 316{
317 em28xx_write_regs(dev, YGAIN_REG, "\x10", 1); /* contrast */ 317 em28xx_write_regs(dev, EM28XX_R20_YGAIN, "\x10", 1); /* contrast */
318 em28xx_write_regs(dev, YOFFSET_REG, "\x00", 1); /* brightness */ 318 em28xx_write_regs(dev, EM28XX_R21_YOFFSET, "\x00", 1); /* brightness */
319 em28xx_write_regs(dev, UVGAIN_REG, "\x10", 1); /* saturation */ 319 em28xx_write_regs(dev, EM28XX_R22_UVGAIN, "\x10", 1); /* saturation */
320 em28xx_write_regs(dev, UOFFSET_REG, "\x00", 1); 320 em28xx_write_regs(dev, EM28XX_R23_UOFFSET, "\x00", 1);
321 em28xx_write_regs(dev, VOFFSET_REG, "\x00", 1); 321 em28xx_write_regs(dev, EM28XX_R24_VOFFSET, "\x00", 1);
322 em28xx_write_regs(dev, SHARPNESS_REG, "\x00", 1); 322 em28xx_write_regs(dev, EM28XX_R25_SHARPNESS, "\x00", 1);
323 323
324 em28xx_write_regs(dev, GAMMA_REG, "\x20", 1); 324 em28xx_write_regs(dev, EM28XX_R14_GAMMA, "\x20", 1);
325 em28xx_write_regs(dev, RGAIN_REG, "\x20", 1); 325 em28xx_write_regs(dev, EM28XX_R15_RGAIN, "\x20", 1);
326 em28xx_write_regs(dev, GGAIN_REG, "\x20", 1); 326 em28xx_write_regs(dev, EM28XX_R16_GGAIN, "\x20", 1);
327 em28xx_write_regs(dev, BGAIN_REG, "\x20", 1); 327 em28xx_write_regs(dev, EM28XX_R17_BGAIN, "\x20", 1);
328 em28xx_write_regs(dev, ROFFSET_REG, "\x00", 1); 328 em28xx_write_regs(dev, EM28XX_R18_ROFFSET, "\x00", 1);
329 em28xx_write_regs(dev, GOFFSET_REG, "\x00", 1); 329 em28xx_write_regs(dev, EM28XX_R19_GOFFSET, "\x00", 1);
330 return em28xx_write_regs(dev, BOFFSET_REG, "\x00", 1); 330 return em28xx_write_regs(dev, EM28XX_R1A_BOFFSET, "\x00", 1);
331} 331}
332 332
333int em28xx_capture_start(struct em28xx *dev, int start) 333int em28xx_capture_start(struct em28xx *dev, int start)
@@ -335,14 +335,14 @@ int em28xx_capture_start(struct em28xx *dev, int start)
335 int rc; 335 int rc;
336 /* FIXME: which is the best order? */ 336 /* FIXME: which is the best order? */
337 /* video registers are sampled by VREF */ 337 /* video registers are sampled by VREF */
338 rc = em28xx_write_reg_bits(dev, USBSUSP_REG, 338 rc = em28xx_write_reg_bits(dev, EM28XX_R0C_USBSUSP,
339 start ? 0x10 : 0x00, 0x10); 339 start ? 0x10 : 0x00, 0x10);
340 if (rc < 0) 340 if (rc < 0)
341 return rc; 341 return rc;
342 342
343 if (!start) { 343 if (!start) {
344 /* disable video capture */ 344 /* disable video capture */
345 rc = em28xx_write_regs(dev, VINENABLE_REG, "\x27", 1); 345 rc = em28xx_write_regs(dev, EM28XX_R12_VINENABLE, "\x27", 1);
346 return rc; 346 return rc;
347 } 347 }
348 348
@@ -350,9 +350,9 @@ int em28xx_capture_start(struct em28xx *dev, int start)
350 rc = em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1); 350 rc = em28xx_write_regs_req(dev, 0x00, 0x48, "\x00", 1);
351 351
352 if (dev->mode == EM28XX_ANALOG_MODE) 352 if (dev->mode == EM28XX_ANALOG_MODE)
353 rc = em28xx_write_regs(dev, VINENABLE_REG, "\x67", 1); 353 rc = em28xx_write_regs(dev, EM28XX_R12_VINENABLE, "\x67", 1);
354 else 354 else
355 rc = em28xx_write_regs(dev, VINENABLE_REG, "\x37", 1); 355 rc = em28xx_write_regs(dev, EM28XX_R12_VINENABLE, "\x37", 1);
356 356
357 msleep(6); 357 msleep(6);
358 358
@@ -361,9 +361,9 @@ int em28xx_capture_start(struct em28xx *dev, int start)
361 361
362int em28xx_outfmt_set_yuv422(struct em28xx *dev) 362int em28xx_outfmt_set_yuv422(struct em28xx *dev)
363{ 363{
364 em28xx_write_regs(dev, OUTFMT_REG, "\x34", 1); 364 em28xx_write_regs(dev, EM28XX_R27_OUTFMT, "\x34", 1);
365 em28xx_write_regs(dev, VINMODE_REG, "\x10", 1); 365 em28xx_write_regs(dev, EM28XX_R10_VINMODE, "\x10", 1);
366 return em28xx_write_regs(dev, VINCTRL_REG, "\x11", 1); 366 return em28xx_write_regs(dev, EM28XX_R11_VINCTRL, "\x11", 1);
367} 367}
368 368
369static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, 369static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
@@ -372,10 +372,10 @@ static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
372 em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n", 372 em28xx_coredbg("em28xx Scale: (%d,%d)-(%d,%d)\n",
373 xmin, ymin, xmax, ymax); 373 xmin, ymin, xmax, ymax);
374 374
375 em28xx_write_regs(dev, XMIN_REG, &xmin, 1); 375 em28xx_write_regs(dev, EM28XX_R28_XMIN, &xmin, 1);
376 em28xx_write_regs(dev, XMAX_REG, &xmax, 1); 376 em28xx_write_regs(dev, EM28XX_R29_XMAX, &xmax, 1);
377 em28xx_write_regs(dev, YMIN_REG, &ymin, 1); 377 em28xx_write_regs(dev, EM28XX_R2A_YMIN, &ymin, 1);
378 return em28xx_write_regs(dev, YMAX_REG, &ymax, 1); 378 return em28xx_write_regs(dev, EM28XX_R2B_YMAX, &ymax, 1);
379} 379}
380 380
381static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, 381static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
@@ -389,11 +389,11 @@ static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
389 (width | (overflow & 2) << 7), 389 (width | (overflow & 2) << 7),
390 (height | (overflow & 1) << 8)); 390 (height | (overflow & 1) << 8));
391 391
392 em28xx_write_regs(dev, HSTART_REG, &hstart, 1); 392 em28xx_write_regs(dev, EM28XX_R1C_HSTART, &hstart, 1);
393 em28xx_write_regs(dev, VSTART_REG, &vstart, 1); 393 em28xx_write_regs(dev, EM28XX_R1D_VSTART, &vstart, 1);
394 em28xx_write_regs(dev, CWIDTH_REG, &cwidth, 1); 394 em28xx_write_regs(dev, EM28XX_R1E_CWIDTH, &cwidth, 1);
395 em28xx_write_regs(dev, CHEIGHT_REG, &cheight, 1); 395 em28xx_write_regs(dev, EM28XX_R1F_CHEIGHT, &cheight, 1);
396 return em28xx_write_regs(dev, OFLOW_REG, &overflow, 1); 396 return em28xx_write_regs(dev, EM28XX_R1B_OFLOW, &overflow, 1);
397} 397}
398 398
399static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) 399static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
@@ -406,15 +406,15 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
406 u8 buf[2]; 406 u8 buf[2];
407 buf[0] = h; 407 buf[0] = h;
408 buf[1] = h >> 8; 408 buf[1] = h >> 8;
409 em28xx_write_regs(dev, HSCALELOW_REG, (char *)buf, 2); 409 em28xx_write_regs(dev, EM28XX_R30_HSCALELOW, (char *)buf, 2);
410 buf[0] = v; 410 buf[0] = v;
411 buf[1] = v >> 8; 411 buf[1] = v >> 8;
412 em28xx_write_regs(dev, VSCALELOW_REG, (char *)buf, 2); 412 em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2);
413 /* it seems that both H and V scalers must be active 413 /* it seems that both H and V scalers must be active
414 to work correctly */ 414 to work correctly */
415 mode = (h || v)? 0x30: 0x00; 415 mode = (h || v)? 0x30: 0x00;
416 } 416 }
417 return em28xx_write_reg_bits(dev, COMPR_REG, mode, 0x30); 417 return em28xx_write_reg_bits(dev, EM28XX_R26_COMPR, mode, 0x30);
418} 418}
419 419
420/* FIXME: this only function read values from dev */ 420/* FIXME: this only function read values from dev */
diff --git a/drivers/media/video/em28xx/em28xx-reg.h b/drivers/media/video/em28xx/em28xx-reg.h
index 02eb2b171ba6..9058bed07953 100644
--- a/drivers/media/video/em28xx/em28xx-reg.h
+++ b/drivers/media/video/em28xx/em28xx-reg.h
@@ -13,68 +13,68 @@
13#define EM_GPO_3 (1 << 3) 13#define EM_GPO_3 (1 << 3)
14 14
15/* em2800 registers */ 15/* em2800 registers */
16#define EM2800_AUDIOSRC_REG 0x08 16#define EM2800_R08_AUDIOSRC 0x08
17 17
18/* em28xx registers */ 18/* em28xx registers */
19 19
20 /* GPIO/GPO registers */ 20 /* GPIO/GPO registers */
21#define EM_R04_GPO 0x04 /* em2880-em2883 only */ 21#define EM2880_R04_GPO 0x04 /* em2880-em2883 only */
22#define EM_R08_GPIO 0x08 /* em2820 or upper */ 22#define EM28XX_R08_GPIO 0x08 /* em2820 or upper */
23 23
24#define I2C_CLK_REG 0x06 24#define EM28XX_R06_I2C_CLK 0x06
25#define CHIPID_REG 0x0a 25#define EM28XX_R0A_CHIPID 0x0a
26#define USBSUSP_REG 0x0c /* */ 26#define EM28XX_R0C_USBSUSP 0x0c /* */
27 27
28#define AUDIOSRC_REG 0x0e 28#define EM28XX_R0E_AUDIOSRC 0x0e
29#define XCLK_REG 0x0f 29#define EM28XX_R0F_XCLK 0x0f
30 30
31#define VINMODE_REG 0x10 31#define EM28XX_R10_VINMODE 0x10
32#define VINCTRL_REG 0x11 32#define EM28XX_R11_VINCTRL 0x11
33#define VINENABLE_REG 0x12 /* */ 33#define EM28XX_R12_VINENABLE 0x12 /* */
34 34
35#define GAMMA_REG 0x14 35#define EM28XX_R14_GAMMA 0x14
36#define RGAIN_REG 0x15 36#define EM28XX_R15_RGAIN 0x15
37#define GGAIN_REG 0x16 37#define EM28XX_R16_GGAIN 0x16
38#define BGAIN_REG 0x17 38#define EM28XX_R17_BGAIN 0x17
39#define ROFFSET_REG 0x18 39#define EM28XX_R18_ROFFSET 0x18
40#define GOFFSET_REG 0x19 40#define EM28XX_R19_GOFFSET 0x19
41#define BOFFSET_REG 0x1a 41#define EM28XX_R1A_BOFFSET 0x1a
42 42
43#define OFLOW_REG 0x1b 43#define EM28XX_R1B_OFLOW 0x1b
44#define HSTART_REG 0x1c 44#define EM28XX_R1C_HSTART 0x1c
45#define VSTART_REG 0x1d 45#define EM28XX_R1D_VSTART 0x1d
46#define CWIDTH_REG 0x1e 46#define EM28XX_R1E_CWIDTH 0x1e
47#define CHEIGHT_REG 0x1f 47#define EM28XX_R1F_CHEIGHT 0x1f
48 48
49#define YGAIN_REG 0x20 49#define EM28XX_R20_YGAIN 0x20
50#define YOFFSET_REG 0x21 50#define EM28XX_R21_YOFFSET 0x21
51#define UVGAIN_REG 0x22 51#define EM28XX_R22_UVGAIN 0x22
52#define UOFFSET_REG 0x23 52#define EM28XX_R23_UOFFSET 0x23
53#define VOFFSET_REG 0x24 53#define EM28XX_R24_VOFFSET 0x24
54#define SHARPNESS_REG 0x25 54#define EM28XX_R25_SHARPNESS 0x25
55 55
56#define COMPR_REG 0x26 56#define EM28XX_R26_COMPR 0x26
57#define OUTFMT_REG 0x27 57#define EM28XX_R27_OUTFMT 0x27
58 58
59#define XMIN_REG 0x28 59#define EM28XX_R28_XMIN 0x28
60#define XMAX_REG 0x29 60#define EM28XX_R29_XMAX 0x29
61#define YMIN_REG 0x2a 61#define EM28XX_R2A_YMIN 0x2a
62#define YMAX_REG 0x2b 62#define EM28XX_R2B_YMAX 0x2b
63 63
64#define HSCALELOW_REG 0x30 64#define EM28XX_R30_HSCALELOW 0x30
65#define HSCALEHIGH_REG 0x31 65#define EM28XX_R31_HSCALEHIGH 0x31
66#define VSCALELOW_REG 0x32 66#define EM28XX_R32_VSCALELOW 0x32
67#define VSCALEHIGH_REG 0x33 67#define EM28XX_R33_VSCALEHIGH 0x33
68 68
69#define AC97LSB_REG 0x40 69#define EM28XX_R40_AC97LSB 0x40
70#define AC97MSB_REG 0x41 70#define EM28XX_R41_AC97MSB 0x41
71#define AC97ADDR_REG 0x42 71#define EM28XX_R42_AC97ADDR 0x42
72#define AC97BUSY_REG 0x43 72#define EM28XX_R43_AC97BUSY 0x43
73 73
74/* em202 registers */ 74/* em202 registers */
75#define MASTER_AC97 0x02 75#define EM28XX_R02_MASTER_AC97 0x02
76#define LINE_IN_AC97 0x10 76#define EM28XX_R10_LINE_IN_AC97 0x10
77#define VIDEO_AC97 0x14 77#define EM28XX_R14_VIDEO_AC97 0x14
78 78
79/* register settings */ 79/* register settings */
80#define EM2800_AUDIO_SRC_TUNER 0x0d 80#define EM2800_AUDIO_SRC_TUNER 0x0d
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index a8aa09c5bc5f..fb533fda2198 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -1142,9 +1142,9 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1142static int em28xx_reg_len(int reg) 1142static int em28xx_reg_len(int reg)
1143{ 1143{
1144 switch (reg) { 1144 switch (reg) {
1145 case AC97LSB_REG: 1145 case EM28XX_R40_AC97LSB:
1146 case HSCALELOW_REG: 1146 case EM28XX_R30_HSCALELOW:
1147 case VSCALELOW_REG: 1147 case EM28XX_R32_VSCALELOW:
1148 return 2; 1148 return 2;
1149 default: 1149 default:
1150 return 1; 1150 return 1;
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index 2188bc44c465..e4a56d8dfcf4 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -500,73 +500,73 @@ int em28xx_get_key_pinnacle_usb_grey(struct IR_i2c *ir, u32 *ir_key,
500static inline int em28xx_compression_disable(struct em28xx *dev) 500static inline int em28xx_compression_disable(struct em28xx *dev)
501{ 501{
502 /* side effect of disabling scaler and mixer */ 502 /* side effect of disabling scaler and mixer */
503 return em28xx_write_regs(dev, COMPR_REG, "\x00", 1); 503 return em28xx_write_regs(dev, EM28XX_R26_COMPR, "\x00", 1);
504} 504}
505 505
506static inline int em28xx_contrast_get(struct em28xx *dev) 506static inline int em28xx_contrast_get(struct em28xx *dev)
507{ 507{
508 return em28xx_read_reg(dev, YGAIN_REG) & 0x1f; 508 return em28xx_read_reg(dev, EM28XX_R20_YGAIN) & 0x1f;
509} 509}
510 510
511static inline int em28xx_brightness_get(struct em28xx *dev) 511static inline int em28xx_brightness_get(struct em28xx *dev)
512{ 512{
513 return em28xx_read_reg(dev, YOFFSET_REG); 513 return em28xx_read_reg(dev, EM28XX_R21_YOFFSET);
514} 514}
515 515
516static inline int em28xx_saturation_get(struct em28xx *dev) 516static inline int em28xx_saturation_get(struct em28xx *dev)
517{ 517{
518 return em28xx_read_reg(dev, UVGAIN_REG) & 0x1f; 518 return em28xx_read_reg(dev, EM28XX_R22_UVGAIN) & 0x1f;
519} 519}
520 520
521static inline int em28xx_u_balance_get(struct em28xx *dev) 521static inline int em28xx_u_balance_get(struct em28xx *dev)
522{ 522{
523 return em28xx_read_reg(dev, UOFFSET_REG); 523 return em28xx_read_reg(dev, EM28XX_R23_UOFFSET);
524} 524}
525 525
526static inline int em28xx_v_balance_get(struct em28xx *dev) 526static inline int em28xx_v_balance_get(struct em28xx *dev)
527{ 527{
528 return em28xx_read_reg(dev, VOFFSET_REG); 528 return em28xx_read_reg(dev, EM28XX_R24_VOFFSET);
529} 529}
530 530
531static inline int em28xx_gamma_get(struct em28xx *dev) 531static inline int em28xx_gamma_get(struct em28xx *dev)
532{ 532{
533 return em28xx_read_reg(dev, GAMMA_REG) & 0x3f; 533 return em28xx_read_reg(dev, EM28XX_R14_GAMMA) & 0x3f;
534} 534}
535 535
536static inline int em28xx_contrast_set(struct em28xx *dev, s32 val) 536static inline int em28xx_contrast_set(struct em28xx *dev, s32 val)
537{ 537{
538 u8 tmp = (u8) val; 538 u8 tmp = (u8) val;
539 return em28xx_write_regs(dev, YGAIN_REG, &tmp, 1); 539 return em28xx_write_regs(dev, EM28XX_R20_YGAIN, &tmp, 1);
540} 540}
541 541
542static inline int em28xx_brightness_set(struct em28xx *dev, s32 val) 542static inline int em28xx_brightness_set(struct em28xx *dev, s32 val)
543{ 543{
544 u8 tmp = (u8) val; 544 u8 tmp = (u8) val;
545 return em28xx_write_regs(dev, YOFFSET_REG, &tmp, 1); 545 return em28xx_write_regs(dev, EM28XX_R21_YOFFSET, &tmp, 1);
546} 546}
547 547
548static inline int em28xx_saturation_set(struct em28xx *dev, s32 val) 548static inline int em28xx_saturation_set(struct em28xx *dev, s32 val)
549{ 549{
550 u8 tmp = (u8) val; 550 u8 tmp = (u8) val;
551 return em28xx_write_regs(dev, UVGAIN_REG, &tmp, 1); 551 return em28xx_write_regs(dev, EM28XX_R22_UVGAIN, &tmp, 1);
552} 552}
553 553
554static inline int em28xx_u_balance_set(struct em28xx *dev, s32 val) 554static inline int em28xx_u_balance_set(struct em28xx *dev, s32 val)
555{ 555{
556 u8 tmp = (u8) val; 556 u8 tmp = (u8) val;
557 return em28xx_write_regs(dev, UOFFSET_REG, &tmp, 1); 557 return em28xx_write_regs(dev, EM28XX_R23_UOFFSET, &tmp, 1);
558} 558}
559 559
560static inline int em28xx_v_balance_set(struct em28xx *dev, s32 val) 560static inline int em28xx_v_balance_set(struct em28xx *dev, s32 val)
561{ 561{
562 u8 tmp = (u8) val; 562 u8 tmp = (u8) val;
563 return em28xx_write_regs(dev, VOFFSET_REG, &tmp, 1); 563 return em28xx_write_regs(dev, EM28XX_R24_VOFFSET, &tmp, 1);
564} 564}
565 565
566static inline int em28xx_gamma_set(struct em28xx *dev, s32 val) 566static inline int em28xx_gamma_set(struct em28xx *dev, s32 val)
567{ 567{
568 u8 tmp = (u8) val; 568 u8 tmp = (u8) val;
569 return em28xx_write_regs(dev, GAMMA_REG, &tmp, 1); 569 return em28xx_write_regs(dev, EM28XX_R14_GAMMA, &tmp, 1);
570} 570}
571 571
572/*FIXME: maxw should be dependent of alt mode */ 572/*FIXME: maxw should be dependent of alt mode */