aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/bt832.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:32:46 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-01-09 12:32:46 -0500
commit0680481c8e6260e1780a0900990531f0193b0dd4 (patch)
tree5e55d97b90fa7eed6268f7a30a00105dc588a580 /drivers/media/video/bt832.c
parent565f49490556250383e976c7f3e04ee4b7f54788 (diff)
V4L/DVB (3305): Replaces old debug msgs to newer ones
- Replaces old debug msgs from bt832, tda743d and tda9875 to newer ones as defined under v4l2-common.h. Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/bt832.c')
-rw-r--r--drivers/media/video/bt832.c65
1 files changed, 35 insertions, 30 deletions
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
index d2cb5ccff56b..dda4aa6bef27 100644
--- a/drivers/media/video/bt832.c
+++ b/drivers/media/video/bt832.c
@@ -30,8 +30,9 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/errno.h> 31#include <linux/errno.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33
34#include <media/audiochip.h> 33#include <media/audiochip.h>
34#include <media/v4l2-common.h>
35
35#include "bttv.h" 36#include "bttv.h"
36#include "bt832.h" 37#include "bt832.h"
37 38
@@ -42,9 +43,10 @@ static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1,
42 I2C_CLIENT_END }; 43 I2C_CLIENT_END };
43I2C_CLIENT_INSMOD; 44I2C_CLIENT_INSMOD;
44 45
45/* ---------------------------------------------------------------------- */ 46int debug = 0; /* debug output */
47module_param(debug, int, 0644);
46 48
47#define dprintk if (debug) printk 49/* ---------------------------------------------------------------------- */
48 50
49static int bt832_detach(struct i2c_client *client); 51static int bt832_detach(struct i2c_client *client);
50 52
@@ -61,23 +63,26 @@ int bt832_hexdump(struct i2c_client *i2c_client_s, unsigned char *buf)
61 int i,rc; 63 int i,rc;
62 buf[0]=0x80; // start at register 0 with auto-increment 64 buf[0]=0x80; // start at register 0 with auto-increment
63 if (1 != (rc = i2c_master_send(i2c_client_s,buf,1))) 65 if (1 != (rc = i2c_master_send(i2c_client_s,buf,1)))
64 printk("bt832: i2c i/o error: rc == %d (should be 1)\n",rc); 66 v4l_err(i2c_client_s,"i2c i/o error: rc == %d (should be 1)\n",rc);
65 67
66 for(i=0;i<65;i++) 68 for(i=0;i<65;i++)
67 buf[i]=0; 69 buf[i]=0;
68 if (65 != (rc=i2c_master_recv(i2c_client_s,buf,65))) 70 if (65 != (rc=i2c_master_recv(i2c_client_s,buf,65)))
69 printk("bt832: i2c i/o error: rc == %d (should be 65)\n",rc); 71 v4l_err(i2c_client_s,"i2c i/o error: rc == %d (should be 65)\n",rc);
70 72
71 // Note: On READ the first byte is the current index 73 // Note: On READ the first byte is the current index
72 // (e.g. 0x80, what we just wrote) 74 // (e.g. 0x80, what we just wrote)
73 75
74 if(1) { 76 if(debug>1) {
75 int i; 77 int i;
76 printk("BT832 hexdump:\n"); 78 v4l_dbg(2,i2c_client_s,"hexdump:");
77 for(i=1;i<65;i++) { 79 for(i=1;i<65;i++) {
78 if(i!=1) { 80 if(i!=1) {
79 if(((i-1)%8)==0) printk(" "); 81 if(((i-1)%8)==0) printk(" ");
80 if(((i-1)%16)==0) printk("\n"); 82 if(((i-1)%16)==0) {
83 printk("\n");
84 v4l_dbg(2,i2c_client_s,"hexdump:");
85 }
81 } 86 }
82 printk(" %02x",buf[i]); 87 printk(" %02x",buf[i]);
83 } 88 }
@@ -96,56 +101,56 @@ int bt832_init(struct i2c_client *i2c_client_s)
96 bt832_hexdump(i2c_client_s,buf); 101 bt832_hexdump(i2c_client_s,buf);
97 102
98 if(buf[0x40] != 0x31) { 103 if(buf[0x40] != 0x31) {
99 printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); 104 v4l_err(i2c_client_s,"This i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]);
100 kfree(buf); 105 kfree(buf);
101 return 0; 106 return 0;
102 } 107 }
103 108
104 printk("Write 0 tp VPSTATUS\n"); 109 v4l_err(i2c_client_s,"Write 0 tp VPSTATUS\n");
105 buf[0]=BT832_VP_STATUS; // Reg.52 110 buf[0]=BT832_VP_STATUS; // Reg.52
106 buf[1]= 0x00; 111 buf[1]= 0x00;
107 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 112 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
108 printk("bt832: i2c i/o error VPS: rc == %d (should be 2)\n",rc); 113 v4l_err(i2c_client_s,"i2c i/o error VPS: rc == %d (should be 2)\n",rc);
109 114
110 bt832_hexdump(i2c_client_s,buf); 115 bt832_hexdump(i2c_client_s,buf);
111 116
112 117
113 // Leave low power mode: 118 // Leave low power mode:
114 printk("Bt832: leave low power mode.\n"); 119 v4l_err(i2c_client_s,"leave low power mode.\n");
115 buf[0]=BT832_CAM_SETUP0; //0x39 57 120 buf[0]=BT832_CAM_SETUP0; //0x39 57
116 buf[1]=0x08; 121 buf[1]=0x08;
117 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 122 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
118 printk("bt832: i2c i/o error LLPM: rc == %d (should be 2)\n",rc); 123 v4l_err(i2c_client_s,"i2c i/o error LLPM: rc == %d (should be 2)\n",rc);
119 124
120 bt832_hexdump(i2c_client_s,buf); 125 bt832_hexdump(i2c_client_s,buf);
121 126
122 printk("Write 0 tp VPSTATUS\n"); 127 v4l_info(i2c_client_s,"Write 0 tp VPSTATUS\n");
123 buf[0]=BT832_VP_STATUS; // Reg.52 128 buf[0]=BT832_VP_STATUS; // Reg.52
124 buf[1]= 0x00; 129 buf[1]= 0x00;
125 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 130 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
126 printk("bt832: i2c i/o error VPS: rc == %d (should be 2)\n",rc); 131 v4l_err(i2c_client_s,"i2c i/o error VPS: rc == %d (should be 2)\n",rc);
127 132
128 bt832_hexdump(i2c_client_s,buf); 133 bt832_hexdump(i2c_client_s,buf);
129 134
130 135
131 // Enable Output 136 // Enable Output
132 printk("Enable Output\n"); 137 v4l_info(i2c_client_s,"Enable Output\n");
133 buf[0]=BT832_VP_CONTROL1; // Reg.40 138 buf[0]=BT832_VP_CONTROL1; // Reg.40
134 buf[1]= 0x27 & (~0x01); // Default | !skip 139 buf[1]= 0x27 & (~0x01); // Default | !skip
135 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 140 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
136 printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); 141 v4l_err(i2c_client_s,"i2c i/o error EO: rc == %d (should be 2)\n",rc);
137 142
138 bt832_hexdump(i2c_client_s,buf); 143 bt832_hexdump(i2c_client_s,buf);
139 144
140 145
141 // for testing (even works when no camera attached) 146 // for testing (even works when no camera attached)
142 printk("bt832: *** Generate NTSC M Bars *****\n"); 147 v4l_info(i2c_client_s,"*** Generate NTSC M Bars *****\n");
143 buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42 148 buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42
144 buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally 149 buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally
145 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) 150 if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
146 printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc); 151 v4l_info(i2c_client_s,"i2c i/o error MBAR: rc == %d (should be 2)\n",rc);
147 152
148 printk("Bt832: Camera Present: %s\n", 153 v4l_info(i2c_client_s,"Camera Present: %s\n",
149 (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no"); 154 (buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no");
150 155
151 bt832_hexdump(i2c_client_s,buf); 156 bt832_hexdump(i2c_client_s,buf);
@@ -159,13 +164,9 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind)
159{ 164{
160 struct bt832 *t; 165 struct bt832 *t;
161 166
162 printk("bt832_attach\n");
163
164 client_template.adapter = adap; 167 client_template.adapter = adap;
165 client_template.addr = addr; 168 client_template.addr = addr;
166 169
167 printk("bt832: chip found @ 0x%x\n", addr<<1);
168
169 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 170 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL)))
170 return -ENOMEM; 171 return -ENOMEM;
171 memset(t,0,sizeof(*t)); 172 memset(t,0,sizeof(*t));
@@ -173,6 +174,9 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, int kind)
173 i2c_set_clientdata(&t->client, t); 174 i2c_set_clientdata(&t->client, t);
174 i2c_attach_client(&t->client); 175 i2c_attach_client(&t->client);
175 176
177 v4l_info(&t->client,"chip found @ 0x%x\n", addr<<1);
178
179
176 if(! bt832_init(&t->client)) { 180 if(! bt832_init(&t->client)) {
177 bt832_detach(&t->client); 181 bt832_detach(&t->client);
178 return -1; 182 return -1;
@@ -192,7 +196,7 @@ static int bt832_detach(struct i2c_client *client)
192{ 196{
193 struct bt832 *t = i2c_get_clientdata(client); 197 struct bt832 *t = i2c_get_clientdata(client);
194 198
195 printk("bt832: detach.\n"); 199 v4l_info(&t->client,"dettach\n");
196 i2c_detach_client(client); 200 i2c_detach_client(client);
197 kfree(t); 201 kfree(t);
198 return 0; 202 return 0;
@@ -203,7 +207,8 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
203{ 207{
204 struct bt832 *t = i2c_get_clientdata(client); 208 struct bt832 *t = i2c_get_clientdata(client);
205 209
206 printk("bt832: command %x\n",cmd); 210 if (debug>1)
211 v4l_i2c_print_ioctl(&t->client,cmd);
207 212
208 switch (cmd) { 213 switch (cmd) {
209 case BT832_HEXDUMP: { 214 case BT832_HEXDUMP: {
@@ -214,7 +219,7 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
214 } 219 }
215 break; 220 break;
216 case BT832_REATTACH: 221 case BT832_REATTACH:
217 printk("bt832: re-attach\n"); 222 v4l_info(&t->client,"re-attach\n");
218 i2c_del_driver(&driver); 223 i2c_del_driver(&driver);
219 i2c_add_driver(&driver); 224 i2c_add_driver(&driver);
220 break; 225 break;
@@ -226,9 +231,9 @@ bt832_command(struct i2c_client *client, unsigned int cmd, void *arg)
226 231
227static struct i2c_driver driver = { 232static struct i2c_driver driver = {
228 .driver = { 233 .driver = {
229 .name = "i2c bt832 driver", 234 .name = "bt832",
230 }, 235 },
231 .id = -1, /* FIXME */ 236 .id = 0, /* FIXME */
232 .attach_adapter = bt832_probe, 237 .attach_adapter = bt832_probe,
233 .detach_client = bt832_detach, 238 .detach_client = bt832_detach,
234 .command = bt832_command, 239 .command = bt832_command,