aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/mt9m001.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2009-08-25 10:47:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:19:09 -0400
commit85f8be68125163085392ed4fc30adcbea641586d (patch)
tree1f265f7be42b78c559db067810514d4096ca1141 /drivers/media/video/mt9m001.c
parentc9c1f1c0dbe90b82939917fdc3e4c9ccad42342d (diff)
V4L/DVB (12531): soc-camera: Use I2C device for dev_{dbg,info,...} output in all clients
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/mt9m001.c')
-rw-r--r--drivers/media/video/mt9m001.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c
index 6e762cd06e3f..775e1a3c98d3 100644
--- a/drivers/media/video/mt9m001.c
+++ b/drivers/media/video/mt9m001.c
@@ -118,7 +118,7 @@ static int mt9m001_init(struct soc_camera_device *icd)
118 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd)); 118 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
119 int ret; 119 int ret;
120 120
121 dev_dbg(&icd->dev, "%s\n", __func__); 121 dev_dbg(&client->dev, "%s\n", __func__);
122 122
123 /* 123 /*
124 * We don't know, whether platform provides reset, 124 * We don't know, whether platform provides reset,
@@ -421,7 +421,7 @@ static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
421 unsigned long range = qctrl->default_value - qctrl->minimum; 421 unsigned long range = qctrl->default_value - qctrl->minimum;
422 data = ((ctrl->value - qctrl->minimum) * 8 + range / 2) / range; 422 data = ((ctrl->value - qctrl->minimum) * 8 + range / 2) / range;
423 423
424 dev_dbg(&icd->dev, "Setting gain %d\n", data); 424 dev_dbg(&client->dev, "Setting gain %d\n", data);
425 data = reg_write(client, MT9M001_GLOBAL_GAIN, data); 425 data = reg_write(client, MT9M001_GLOBAL_GAIN, data);
426 if (data < 0) 426 if (data < 0)
427 return -EIO; 427 return -EIO;
@@ -439,7 +439,7 @@ static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
439 else 439 else
440 data = ((gain - 64) * 7 + 28) / 56 + 96; 440 data = ((gain - 64) * 7 + 28) / 56 + 96;
441 441
442 dev_dbg(&icd->dev, "Setting gain from %d to %d\n", 442 dev_dbg(&client->dev, "Setting gain from %d to %d\n",
443 reg_read(client, MT9M001_GLOBAL_GAIN), data); 443 reg_read(client, MT9M001_GLOBAL_GAIN), data);
444 data = reg_write(client, MT9M001_GLOBAL_GAIN, data); 444 data = reg_write(client, MT9M001_GLOBAL_GAIN, data);
445 if (data < 0) 445 if (data < 0)
@@ -458,8 +458,10 @@ static int mt9m001_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
458 unsigned long shutter = ((ctrl->value - qctrl->minimum) * 1048 + 458 unsigned long shutter = ((ctrl->value - qctrl->minimum) * 1048 +
459 range / 2) / range + 1; 459 range / 2) / range + 1;
460 460
461 dev_dbg(&icd->dev, "Setting shutter width from %d to %lu\n", 461 dev_dbg(&client->dev,
462 reg_read(client, MT9M001_SHUTTER_WIDTH), shutter); 462 "Setting shutter width from %d to %lu\n",
463 reg_read(client, MT9M001_SHUTTER_WIDTH),
464 shutter);
463 if (reg_write(client, MT9M001_SHUTTER_WIDTH, shutter) < 0) 465 if (reg_write(client, MT9M001_SHUTTER_WIDTH, shutter) < 0)
464 return -EIO; 466 return -EIO;
465 icd->exposure = ctrl->value; 467 icd->exposure = ctrl->value;
@@ -504,7 +506,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
504 506
505 /* Enable the chip */ 507 /* Enable the chip */
506 data = reg_write(client, MT9M001_CHIP_ENABLE, 1); 508 data = reg_write(client, MT9M001_CHIP_ENABLE, 1);
507 dev_dbg(&icd->dev, "write: %d\n", data); 509 dev_dbg(&client->dev, "write: %d\n", data);
508 510
509 /* Read out the chip version register */ 511 /* Read out the chip version register */
510 data = reg_read(client, MT9M001_CHIP_VERSION); 512 data = reg_read(client, MT9M001_CHIP_VERSION);
@@ -521,7 +523,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
521 icd->formats = mt9m001_monochrome_formats; 523 icd->formats = mt9m001_monochrome_formats;
522 break; 524 break;
523 default: 525 default:
524 dev_err(&icd->dev, 526 dev_err(&client->dev,
525 "No MT9M001 chip detected, register read %x\n", data); 527 "No MT9M001 chip detected, register read %x\n", data);
526 return -ENODEV; 528 return -ENODEV;
527 } 529 }
@@ -546,7 +548,7 @@ static int mt9m001_video_probe(struct soc_camera_device *icd,
546 if (flags & SOCAM_DATAWIDTH_8) 548 if (flags & SOCAM_DATAWIDTH_8)
547 icd->num_formats++; 549 icd->num_formats++;
548 550
549 dev_info(&icd->dev, "Detected a MT9M001 chip ID %x (%s)\n", data, 551 dev_info(&client->dev, "Detected a MT9M001 chip ID %x (%s)\n", data,
550 data == 0x8431 ? "C12STM" : "C12ST"); 552 data == 0x8431 ? "C12STM" : "C12ST");
551 553
552 return 0; 554 return 0;
@@ -557,7 +559,7 @@ static void mt9m001_video_remove(struct soc_camera_device *icd)
557 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd)); 559 struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd));
558 struct soc_camera_link *icl = to_soc_camera_link(icd); 560 struct soc_camera_link *icl = to_soc_camera_link(icd);
559 561
560 dev_dbg(&icd->dev, "Video %x removed: %p, %p\n", client->addr, 562 dev_dbg(&client->dev, "Video %x removed: %p, %p\n", client->addr,
561 icd->dev.parent, icd->vdev); 563 icd->dev.parent, icd->vdev);
562 if (icl->free_bus) 564 if (icl->free_bus)
563 icl->free_bus(icl); 565 icl->free_bus(icl);