aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c/ak881x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/i2c/ak881x.c')
-rw-r--r--drivers/media/i2c/ak881x.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c
index b918c3f29cbe..fcd8a3f626fa 100644
--- a/drivers/media/i2c/ak881x.c
+++ b/drivers/media/i2c/ak881x.c
@@ -16,7 +16,6 @@
16#include <linux/module.h> 16#include <linux/module.h>
17 17
18#include <media/ak881x.h> 18#include <media/ak881x.h>
19#include <media/v4l2-chip-ident.h>
20#include <media/v4l2-common.h> 19#include <media/v4l2-common.h>
21#include <media/v4l2-device.h> 20#include <media/v4l2-device.h>
22 21
@@ -33,7 +32,6 @@ struct ak881x {
33 struct v4l2_subdev subdev; 32 struct v4l2_subdev subdev;
34 struct ak881x_pdata *pdata; 33 struct ak881x_pdata *pdata;
35 unsigned int lines; 34 unsigned int lines;
36 int id; /* DEVICE_ID code V4L2_IDENT_AK881X code from v4l2-chip-ident.h */
37 char revision; /* DEVICE_REVISION content */ 35 char revision; /* DEVICE_REVISION content */
38}; 36};
39 37
@@ -62,36 +60,15 @@ static struct ak881x *to_ak881x(const struct i2c_client *client)
62 return container_of(i2c_get_clientdata(client), struct ak881x, subdev); 60 return container_of(i2c_get_clientdata(client), struct ak881x, subdev);
63} 61}
64 62
65static int ak881x_g_chip_ident(struct v4l2_subdev *sd,
66 struct v4l2_dbg_chip_ident *id)
67{
68 struct i2c_client *client = v4l2_get_subdevdata(sd);
69 struct ak881x *ak881x = to_ak881x(client);
70
71 if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR)
72 return -EINVAL;
73
74 if (id->match.addr != client->addr)
75 return -ENODEV;
76
77 id->ident = ak881x->id;
78 id->revision = ak881x->revision;
79
80 return 0;
81}
82
83#ifdef CONFIG_VIDEO_ADV_DEBUG 63#ifdef CONFIG_VIDEO_ADV_DEBUG
84static int ak881x_g_register(struct v4l2_subdev *sd, 64static int ak881x_g_register(struct v4l2_subdev *sd,
85 struct v4l2_dbg_register *reg) 65 struct v4l2_dbg_register *reg)
86{ 66{
87 struct i2c_client *client = v4l2_get_subdevdata(sd); 67 struct i2c_client *client = v4l2_get_subdevdata(sd);
88 68
89 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x26) 69 if (reg->reg > 0x26)
90 return -EINVAL; 70 return -EINVAL;
91 71
92 if (reg->match.addr != client->addr)
93 return -ENODEV;
94
95 reg->val = reg_read(client, reg->reg); 72 reg->val = reg_read(client, reg->reg);
96 73
97 if (reg->val > 0xffff) 74 if (reg->val > 0xffff)
@@ -105,12 +82,9 @@ static int ak881x_s_register(struct v4l2_subdev *sd,
105{ 82{
106 struct i2c_client *client = v4l2_get_subdevdata(sd); 83 struct i2c_client *client = v4l2_get_subdevdata(sd);
107 84
108 if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x26) 85 if (reg->reg > 0x26)
109 return -EINVAL; 86 return -EINVAL;
110 87
111 if (reg->match.addr != client->addr)
112 return -ENODEV;
113
114 if (reg_write(client, reg->reg, reg->val) < 0) 88 if (reg_write(client, reg->reg, reg->val) < 0)
115 return -EIO; 89 return -EIO;
116 90
@@ -229,7 +203,6 @@ static int ak881x_s_stream(struct v4l2_subdev *sd, int enable)
229} 203}
230 204
231static struct v4l2_subdev_core_ops ak881x_subdev_core_ops = { 205static struct v4l2_subdev_core_ops ak881x_subdev_core_ops = {
232 .g_chip_ident = ak881x_g_chip_ident,
233#ifdef CONFIG_VIDEO_ADV_DEBUG 206#ifdef CONFIG_VIDEO_ADV_DEBUG
234 .g_register = ak881x_g_register, 207 .g_register = ak881x_g_register,
235 .s_register = ak881x_s_register, 208 .s_register = ak881x_s_register,
@@ -274,10 +247,7 @@ static int ak881x_probe(struct i2c_client *client,
274 247
275 switch (data) { 248 switch (data) {
276 case 0x13: 249 case 0x13:
277 ak881x->id = V4L2_IDENT_AK8813;
278 break;
279 case 0x14: 250 case 0x14:
280 ak881x->id = V4L2_IDENT_AK8814;
281 break; 251 break;
282 default: 252 default:
283 dev_err(&client->dev, 253 dev_err(&client->dev,