aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/hexium_gemini.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/hexium_gemini.c')
-rw-r--r--drivers/media/video/hexium_gemini.c45
1 files changed, 25 insertions, 20 deletions
diff --git a/drivers/media/video/hexium_gemini.c b/drivers/media/video/hexium_gemini.c
index cbc505a2fc29..a62322d5c0d8 100644
--- a/drivers/media/video/hexium_gemini.c
+++ b/drivers/media/video/hexium_gemini.c
@@ -21,9 +21,12 @@
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/ 22*/
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25
24#define DEBUG_VARIABLE debug 26#define DEBUG_VARIABLE debug
25 27
26#include <media/saa7146_vv.h> 28#include <media/saa7146_vv.h>
29#include <linux/module.h>
27 30
28static int debug; 31static int debug;
29module_param(debug, int, 0); 32module_param(debug, int, 0);
@@ -175,13 +178,14 @@ static int hexium_init_done(struct saa7146_dev *dev)
175 union i2c_smbus_data data; 178 union i2c_smbus_data data;
176 int i = 0; 179 int i = 0;
177 180
178 DEB_D(("hexium_init_done called.\n")); 181 DEB_D("hexium_init_done called\n");
179 182
180 /* initialize the helper ics to useful values */ 183 /* initialize the helper ics to useful values */
181 for (i = 0; i < sizeof(hexium_ks0127b); i++) { 184 for (i = 0; i < sizeof(hexium_ks0127b); i++) {
182 data.byte = hexium_ks0127b[i]; 185 data.byte = hexium_ks0127b[i];
183 if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, i, I2C_SMBUS_BYTE_DATA, &data)) { 186 if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, i, I2C_SMBUS_BYTE_DATA, &data)) {
184 printk("hexium_gemini: hexium_init_done() failed for address 0x%02x\n", i); 187 pr_err("hexium_init_done() failed for address 0x%02x\n",
188 i);
185 } 189 }
186 } 190 }
187 191
@@ -192,7 +196,7 @@ static int hexium_set_input(struct hexium *hexium, int input)
192{ 196{
193 union i2c_smbus_data data; 197 union i2c_smbus_data data;
194 198
195 DEB_D((".\n")); 199 DEB_D("\n");
196 200
197 data.byte = hexium_input_select[input].byte; 201 data.byte = hexium_input_select[input].byte;
198 if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, hexium_input_select[input].adr, I2C_SMBUS_BYTE_DATA, &data)) { 202 if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, hexium_input_select[input].adr, I2C_SMBUS_BYTE_DATA, &data)) {
@@ -207,12 +211,13 @@ static int hexium_set_standard(struct hexium *hexium, struct hexium_data *vdec)
207 union i2c_smbus_data data; 211 union i2c_smbus_data data;
208 int i = 0; 212 int i = 0;
209 213
210 DEB_D((".\n")); 214 DEB_D("\n");
211 215
212 while (vdec[i].adr != -1) { 216 while (vdec[i].adr != -1) {
213 data.byte = vdec[i].byte; 217 data.byte = vdec[i].byte;
214 if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, vdec[i].adr, I2C_SMBUS_BYTE_DATA, &data)) { 218 if (0 != i2c_smbus_xfer(&hexium->i2c_adapter, 0x6c, 0, I2C_SMBUS_WRITE, vdec[i].adr, I2C_SMBUS_BYTE_DATA, &data)) {
215 printk("hexium_init_done: hexium_set_standard() failed for address 0x%02x\n", i); 219 pr_err("hexium_init_done: hexium_set_standard() failed for address 0x%02x\n",
220 i);
216 return -1; 221 return -1;
217 } 222 }
218 i++; 223 i++;
@@ -222,14 +227,14 @@ static int hexium_set_standard(struct hexium *hexium, struct hexium_data *vdec)
222 227
223static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i) 228static int vidioc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
224{ 229{
225 DEB_EE(("VIDIOC_ENUMINPUT %d.\n", i->index)); 230 DEB_EE("VIDIOC_ENUMINPUT %d\n", i->index);
226 231
227 if (i->index >= HEXIUM_INPUTS) 232 if (i->index >= HEXIUM_INPUTS)
228 return -EINVAL; 233 return -EINVAL;
229 234
230 memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input)); 235 memcpy(i, &hexium_inputs[i->index], sizeof(struct v4l2_input));
231 236
232 DEB_D(("v4l2_ioctl: VIDIOC_ENUMINPUT %d.\n", i->index)); 237 DEB_D("v4l2_ioctl: VIDIOC_ENUMINPUT %d\n", i->index);
233 return 0; 238 return 0;
234} 239}
235 240
@@ -240,7 +245,7 @@ static int vidioc_g_input(struct file *file, void *fh, unsigned int *input)
240 245
241 *input = hexium->cur_input; 246 *input = hexium->cur_input;
242 247
243 DEB_D(("VIDIOC_G_INPUT: %d\n", *input)); 248 DEB_D("VIDIOC_G_INPUT: %d\n", *input);
244 return 0; 249 return 0;
245} 250}
246 251
@@ -249,7 +254,7 @@ static int vidioc_s_input(struct file *file, void *fh, unsigned int input)
249 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev; 254 struct saa7146_dev *dev = ((struct saa7146_fh *)fh)->dev;
250 struct hexium *hexium = (struct hexium *) dev->ext_priv; 255 struct hexium *hexium = (struct hexium *) dev->ext_priv;
251 256
252 DEB_EE(("VIDIOC_S_INPUT %d.\n", input)); 257 DEB_EE("VIDIOC_S_INPUT %d\n", input);
253 258
254 if (input >= HEXIUM_INPUTS) 259 if (input >= HEXIUM_INPUTS)
255 return -EINVAL; 260 return -EINVAL;
@@ -270,7 +275,7 @@ static int vidioc_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *
270 for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) { 275 for (i = HEXIUM_CONTROLS - 1; i >= 0; i--) {
271 if (hexium_controls[i].id == qc->id) { 276 if (hexium_controls[i].id == qc->id) {
272 *qc = hexium_controls[i]; 277 *qc = hexium_controls[i];
273 DEB_D(("VIDIOC_QUERYCTRL %d.\n", qc->id)); 278 DEB_D("VIDIOC_QUERYCTRL %d\n", qc->id);
274 return 0; 279 return 0;
275 } 280 }
276 } 281 }
@@ -293,7 +298,7 @@ static int vidioc_g_ctrl(struct file *file, void *fh, struct v4l2_control *vc)
293 298
294 if (vc->id == V4L2_CID_PRIVATE_BASE) { 299 if (vc->id == V4L2_CID_PRIVATE_BASE) {
295 vc->value = hexium->cur_bw; 300 vc->value = hexium->cur_bw;
296 DEB_D(("VIDIOC_G_CTRL BW:%d.\n", vc->value)); 301 DEB_D("VIDIOC_G_CTRL BW:%d\n", vc->value);
297 return 0; 302 return 0;
298 } 303 }
299 return -EINVAL; 304 return -EINVAL;
@@ -316,7 +321,7 @@ static int vidioc_s_ctrl(struct file *file, void *fh, struct v4l2_control *vc)
316 if (vc->id == V4L2_CID_PRIVATE_BASE) 321 if (vc->id == V4L2_CID_PRIVATE_BASE)
317 hexium->cur_bw = vc->value; 322 hexium->cur_bw = vc->value;
318 323
319 DEB_D(("VIDIOC_S_CTRL BW:%d.\n", hexium->cur_bw)); 324 DEB_D("VIDIOC_S_CTRL BW:%d\n", hexium->cur_bw);
320 325
321 if (0 == hexium->cur_bw && V4L2_STD_PAL == hexium->cur_std) { 326 if (0 == hexium->cur_bw && V4L2_STD_PAL == hexium->cur_std) {
322 hexium_set_standard(hexium, hexium_pal); 327 hexium_set_standard(hexium, hexium_pal);
@@ -351,14 +356,14 @@ static struct saa7146_ext_vv vv_data;
351/* this function only gets called when the probing was successful */ 356/* this function only gets called when the probing was successful */
352static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) 357static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info)
353{ 358{
354 struct hexium *hexium = (struct hexium *) dev->ext_priv; 359 struct hexium *hexium;
355 int ret; 360 int ret;
356 361
357 DEB_EE((".\n")); 362 DEB_EE("\n");
358 363
359 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL); 364 hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
360 if (NULL == hexium) { 365 if (NULL == hexium) {
361 printk("hexium_gemini: not enough kernel memory in hexium_attach().\n"); 366 pr_err("not enough kernel memory in hexium_attach()\n");
362 return -ENOMEM; 367 return -ENOMEM;
363 } 368 }
364 dev->ext_priv = hexium; 369 dev->ext_priv = hexium;
@@ -371,7 +376,7 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
371 }; 376 };
372 saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480); 377 saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
373 if (i2c_add_adapter(&hexium->i2c_adapter) < 0) { 378 if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
374 DEB_S(("cannot register i2c-device. skipping.\n")); 379 DEB_S("cannot register i2c-device. skipping.\n");
375 kfree(hexium); 380 kfree(hexium);
376 return -EFAULT; 381 return -EFAULT;
377 } 382 }
@@ -402,11 +407,11 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d
402 vv_data.ops.vidioc_s_input = vidioc_s_input; 407 vv_data.ops.vidioc_s_input = vidioc_s_input;
403 ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER); 408 ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
404 if (ret < 0) { 409 if (ret < 0) {
405 printk("hexium_gemini: cannot register capture v4l2 device. skipping.\n"); 410 pr_err("cannot register capture v4l2 device. skipping.\n");
406 return ret; 411 return ret;
407 } 412 }
408 413
409 printk("hexium_gemini: found 'hexium gemini' frame grabber-%d.\n", hexium_num); 414 pr_info("found 'hexium gemini' frame grabber-%d\n", hexium_num);
410 hexium_num++; 415 hexium_num++;
411 416
412 return 0; 417 return 0;
@@ -416,7 +421,7 @@ static int hexium_detach(struct saa7146_dev *dev)
416{ 421{
417 struct hexium *hexium = (struct hexium *) dev->ext_priv; 422 struct hexium *hexium = (struct hexium *) dev->ext_priv;
418 423
419 DEB_EE(("dev:%p\n", dev)); 424 DEB_EE("dev:%p\n", dev);
420 425
421 saa7146_unregister_device(&hexium->video_dev, dev); 426 saa7146_unregister_device(&hexium->video_dev, dev);
422 saa7146_vv_release(dev); 427 saa7146_vv_release(dev);
@@ -508,7 +513,7 @@ static struct saa7146_extension hexium_extension = {
508static int __init hexium_init_module(void) 513static int __init hexium_init_module(void)
509{ 514{
510 if (0 != saa7146_register_extension(&hexium_extension)) { 515 if (0 != saa7146_register_extension(&hexium_extension)) {
511 DEB_S(("failed to register extension.\n")); 516 DEB_S("failed to register extension\n");
512 return -ENODEV; 517 return -ENODEV;
513 } 518 }
514 519