aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2008-11-26 16:28:42 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-29 17:53:42 -0200
commit2a29a0d770ef6f24a8fd7806655c826d45888cba (patch)
tree4eda99c4a9574f9163f6017c6a27bb90c1eee184 /drivers/media/video/em28xx/em28xx-video.c
parentc864405747fa8b50c1454b280c216f54da834cb4 (diff)
V4L/DVB (9758): em28xx: replace some magic by register descriptions where known
Replaces all occurrences of em28xx_write_regs_req() and em28xx_write_reg() used to setup register names by em28xx_write_reg(). Also, documents the register names that are known. This patch were generated by this small perl script: my %reg_map = ( # Register table - the same as defined on parse_em28xx.pl script ); while (<>) { if (m/(.*)em28xx_write_regs_req\(dev\,\s*0x00\,\s*(.*)\,\s*\"\\x(..)\",\s*1\)\;(.*)/) { my $reg = $2; my $val = $3; $val =~ tr/A-f/a-f/; $reg = $reg_map{$reg} if defined($reg_map{$reg}); printf "$1em28xx_write_reg(dev, %s, 0x%s);$4\n", $reg, $val; } elsif (m/(.*)em28xx_write_regs\(dev\,\s*(.*)\,\s*\"\\x(..)\",\s*1\)\;(.*)/) { my $reg = $2; my $val = $3; $val =~ tr/A-f/a-f/; $reg = $reg_map{$reg} if defined($reg_map{$reg}); printf "$1em28xx_write_reg(dev, %s, 0x%s);$4\n", $reg, $val; } else { print $_; } } Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index acda76f86ff..87e9f1d7a95 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -518,7 +518,7 @@ static int em28xx_config(struct em28xx *dev)
/* Sets I2C speed to 100 KHz */
if (!dev->board.is_em2800) {
- retval = em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1);
+ retval = em28xx_write_reg(dev, EM28XX_R06_I2C_CLK, 0x40);
if (retval < 0) {
em28xx_errdev("%s: em28xx_write_regs_req failed! retval [%d]\n",
__func__, retval);
@@ -528,9 +528,9 @@ static int em28xx_config(struct em28xx *dev)
/* enable vbi capturing */
-/* em28xx_write_regs_req(dev, 0x00, 0x0e, "\xC0", 1); audio register */
-/* em28xx_write_regs_req(dev, 0x00, 0x0f, "\x80", 1); clk register */
- em28xx_write_regs_req(dev, 0x00, 0x11, "\x51", 1);
+/* em28xx_write_reg(dev, EM28XX_R0E_AUDIOSRC, 0xc0); audio register */
+/* em28xx_write_reg(dev, EM28XX_R0F_XCLK, 0x80); clk register */
+ em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x51);
dev->mute = 1; /* maybe not the right place... */
dev->volume = 0x1f;
@@ -2094,7 +2094,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
if (dev->board.has_msp34xx) {
/* Send a reset to other chips via gpio */
- errCode = em28xx_write_regs_req(dev, 0x00, 0x08, "\xf7", 1);
+ errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
if (errCode < 0) {
em28xx_errdev("%s: em28xx_write_regs_req - msp34xx(1) failed! errCode [%d]\n",
__func__, errCode);
@@ -2102,7 +2102,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
}
msleep(3);
- errCode = em28xx_write_regs_req(dev, 0x00, 0x08, "\xff", 1);
+ errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xff);
if (errCode < 0) {
em28xx_errdev("%s: em28xx_write_regs_req - msp34xx(2) failed! errCode [%d]\n",
__func__, errCode);