aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/soc_camera/mt9m001.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/soc_camera/mt9m001.c')
-rw-r--r--drivers/media/i2c/soc_camera/mt9m001.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/drivers/media/i2c/soc_camera/mt9m001.c b/drivers/media/i2c/soc_camera/mt9m001.c
index dd9089805757..3f1f437ee1c6 100644
--- a/drivers/media/i2c/soc_camera/mt9m001.c
+++ b/drivers/media/i2c/soc_camera/mt9m001.c
@@ -17,7 +17,6 @@
17#include <media/soc_camera.h> 17#include <media/soc_camera.h>
18#include <media/soc_mediabus.h> 18#include <media/soc_mediabus.h>
19#include <media/v4l2-subdev.h> 19#include <media/v4l2-subdev.h>
20#include <media/v4l2-chip-ident.h>
21#include <media/v4l2-ctrls.h> 20#include <media/v4l2-ctrls.h>
22 21
23/* 22/*
@@ -97,7 +96,6 @@ struct mt9m001 {
97 const struct mt9m001_datafmt *fmt; 96 const struct mt9m001_datafmt *fmt;
98 const struct mt9m001_datafmt *fmts; 97 const struct mt9m001_datafmt *fmts;
99 int num_fmts; 98 int num_fmts;
100 int model; /* V4L2_IDENT_MT9M001* codes from v4l2-chip-ident.h */
101 unsigned int total_h; 99 unsigned int total_h;
102 unsigned short y_skip_top; /* Lines to skip at the top */ 100 unsigned short y_skip_top; /* Lines to skip at the top */
103}; 101};
@@ -320,36 +318,15 @@ static int mt9m001_try_fmt(struct v4l2_subdev *sd,
320 return 0; 318 return 0;
321} 319}
322 320
323static int mt9m001_g_chip_ident(struct v4l2_subdev *sd,
324 struct v4l2_dbg_chip_ident *id)
325{
326 struct i2c_client *client = v4l2_get_subdevdata(sd);
327 struct mt9m001 *mt9m001 = to_mt9m001(client);
328
329 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
330 return -EINVAL;
331
332 if (id->match.addr != client->addr)
333 return -ENODEV;
334
335 id->ident = mt9m001->model;
336 id->revision = 0;
337
338 return 0;
339}
340
341#ifdef CONFIG_VIDEO_ADV_DEBUG 321#ifdef CONFIG_VIDEO_ADV_DEBUG
342static int mt9m001_g_register(struct v4l2_subdev *sd, 322static int mt9m001_g_register(struct v4l2_subdev *sd,
343 struct v4l2_dbg_register *reg) 323 struct v4l2_dbg_register *reg)
344{ 324{
345 struct i2c_client *client = v4l2_get_subdevdata(sd); 325 struct i2c_client *client = v4l2_get_subdevdata(sd);
346 326
347 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 327 if (reg->reg > 0xff)
348 return -EINVAL; 328 return -EINVAL;
349 329
350 if (reg->match.addr != client->addr)
351 return -ENODEV;
352
353 reg->size = 2; 330 reg->size = 2;
354 reg->val = reg_read(client, reg->reg); 331 reg->val = reg_read(client, reg->reg);
355 332
@@ -364,12 +341,9 @@ static int mt9m001_s_register(struct v4l2_subdev *sd,
364{ 341{
365 struct i2c_client *client = v4l2_get_subdevdata(sd); 342 struct i2c_client *client = v4l2_get_subdevdata(sd);
366 343
367 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 344 if (reg->reg > 0xff)
368 return -EINVAL; 345 return -EINVAL;
369 346
370 if (reg->match.addr != client->addr)
371 return -ENODEV;
372
373 if (reg_write(client, reg->reg, reg->val) < 0) 347 if (reg_write(client, reg->reg, reg->val) < 0)
374 return -EIO; 348 return -EIO;
375 349
@@ -505,11 +479,9 @@ static int mt9m001_video_probe(struct soc_camera_subdev_desc *ssdd,
505 switch (data) { 479 switch (data) {
506 case 0x8411: 480 case 0x8411:
507 case 0x8421: 481 case 0x8421:
508 mt9m001->model = V4L2_IDENT_MT9M001C12ST;
509 mt9m001->fmts = mt9m001_colour_fmts; 482 mt9m001->fmts = mt9m001_colour_fmts;
510 break; 483 break;
511 case 0x8431: 484 case 0x8431:
512 mt9m001->model = V4L2_IDENT_MT9M001C12STM;
513 mt9m001->fmts = mt9m001_monochrome_fmts; 485 mt9m001->fmts = mt9m001_monochrome_fmts;
514 break; 486 break;
515 default: 487 default:
@@ -580,7 +552,6 @@ static const struct v4l2_ctrl_ops mt9m001_ctrl_ops = {
580}; 552};
581 553
582static struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = { 554static struct v4l2_subdev_core_ops mt9m001_subdev_core_ops = {
583 .g_chip_ident = mt9m001_g_chip_ident,
584#ifdef CONFIG_VIDEO_ADV_DEBUG 555#ifdef CONFIG_VIDEO_ADV_DEBUG
585 .g_register = mt9m001_g_register, 556 .g_register = mt9m001_g_register,
586 .s_register = mt9m001_s_register, 557 .s_register = mt9m001_s_register,