aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2007-03-28 21:37:26 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-04-27 14:45:11 -0400
commit5b9c4e6dbb3204568d4c058af6e34772393ada19 (patch)
tree04043fc593fbd639901a9b7fddb740acf20ab099 /drivers
parentc1d570385bd6dd5fe4c0cab09b1c390331111b35 (diff)
V4L/DVB (5478): Use ARRAY_SIZE and a cleaner logic for initializing tuner
ATI HDTV Wonder needs to initialize some registers before allowing the tuner to start working. The current logic have lots of magic. This patch makes the code cleaner, using ARRAY_SIZE() for the initialization array and using a bidimensional array, instead of doing some stuff like: &buffer[i+2] Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx88/cx88-cards.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 13a8bb551fff..6a33f4cf4fca 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1790,7 +1790,7 @@ static void dvico_fusionhdtv_hybrid_init(struct cx88_core *core)
1790 { 0x03, 0x0C }, 1790 { 0x03, 0x0C },
1791 }; 1791 };
1792 1792
1793 for (i = 0; i < 13; i++) { 1793 for (i = 0; i < ARRAY_SIZE(init_bufs); i++) {
1794 msg.buf = init_bufs[i]; 1794 msg.buf = init_bufs[i];
1795 msg.len = (i != 12 ? 5 : 2); 1795 msg.len = (i != 12 ? 5 : 2);
1796 err = i2c_transfer(&core->i2c_adap, &msg, 1); 1796 err = i2c_transfer(&core->i2c_adap, &msg, 1);
@@ -1917,12 +1917,21 @@ void cx88_card_setup(struct cx88_core *core)
1917 if (0 == core->i2c_rc) { 1917 if (0 == core->i2c_rc) {
1918 /* enable tuner */ 1918 /* enable tuner */
1919 int i; 1919 int i;
1920 static const u8 buffer [] = { 0x10,0x12,0x13,0x04,0x16,0x00,0x14,0x04,0x017,0x00 }; 1920 static const u8 buffer [][2] = {
1921 {0x10,0x12},
1922 {0x13,0x04},
1923 {0x16,0x00},
1924 {0x14,0x04},
1925 {0x17,0x00}
1926 };
1921 core->i2c_client.addr = 0x0a; 1927 core->i2c_client.addr = 0x0a;
1922 1928
1923 for (i = 0; i < 5; i++) 1929 for (i = 0; i < ARRAY_SIZE(buffer); i++)
1924 if (2 != i2c_master_send(&core->i2c_client,&buffer[i*2],2)) 1930 if (2 != i2c_master_send(&core->i2c_client,
1925 printk(KERN_WARNING "%s: Unable to enable tuner(%i).\n", 1931 buffer[i],2))
1932 printk(KERN_WARNING
1933 "%s: Unable to enable "
1934 "tuner(%i).\n",
1926 core->name, i); 1935 core->name, i);
1927 } 1936 }
1928 break; 1937 break;