11 #include <linux/i2c.h>
14 #include <linux/slab.h>
15 #include <linux/videodev2.h>
16 #include <linux/module.h>
23 #define AK881X_INTERFACE_MODE 0
24 #define AK881X_VIDEO_PROCESS1 1
25 #define AK881X_VIDEO_PROCESS2 2
26 #define AK881X_VIDEO_PROCESS3 3
27 #define AK881X_DAC_MODE 5
28 #define AK881X_STATUS 0x24
29 #define AK881X_DEVICE_ID 0x25
30 #define AK881X_DEVICE_REVISION 0x26
57 return reg_write(client, reg, (ret & ~mask) | (data & mask));
68 struct i2c_client *client = v4l2_get_subdevdata(sd);
77 id->ident = ak881x->
id;
83 #ifdef CONFIG_VIDEO_ADV_DEBUG
84 static int ak881x_g_register(
struct v4l2_subdev *sd,
87 struct i2c_client *client = v4l2_get_subdevdata(sd);
97 if (reg->
val > 0xffff)
103 static int ak881x_s_register(
struct v4l2_subdev *sd,
106 struct i2c_client *client = v4l2_get_subdevdata(sd);
121 static int ak881x_try_g_mbus_fmt(
struct v4l2_subdev *sd,
122 struct v4l2_mbus_framefmt *mf)
124 struct i2c_client *client = v4l2_get_subdevdata(sd);
125 struct ak881x *ak881x = to_ak881x(client);
128 &mf->height, 0, ak881x->
lines, 1, 0);
136 static int ak881x_s_mbus_fmt(
struct v4l2_subdev *sd,
137 struct v4l2_mbus_framefmt *mf)
143 return ak881x_try_g_mbus_fmt(sd, mf);
158 struct i2c_client *client = v4l2_get_subdevdata(sd);
159 struct ak881x *ak881x = to_ak881x(client);
175 struct i2c_client *client = v4l2_get_subdevdata(sd);
176 struct ak881x *ak881x = to_ak881x(client);
206 struct i2c_client *client = v4l2_get_subdevdata(sd);
207 struct ak881x *ak881x = to_ak881x(client);
232 .g_chip_ident = ak881x_g_chip_ident,
233 #ifdef CONFIG_VIDEO_ADV_DEBUG
234 .g_register = ak881x_g_register,
235 .s_register = ak881x_s_register,
240 .s_mbus_fmt = ak881x_s_mbus_fmt,
241 .g_mbus_fmt = ak881x_try_g_mbus_fmt,
242 .try_mbus_fmt = ak881x_try_g_mbus_fmt,
243 .cropcap = ak881x_cropcap,
244 .enum_mbus_fmt = ak881x_enum_mbus_fmt,
245 .s_std_output = ak881x_s_std_output,
246 .s_stream = ak881x_s_stream,
250 .core = &ak881x_subdev_core_ops,
251 .video = &ak881x_subdev_video_ops,
254 static int ak881x_probe(
struct i2c_client *client,
258 struct ak881x *ak881x;
263 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n");
267 ak881x = kzalloc(
sizeof(
struct ak881x),
GFP_KERNEL);
284 "No ak881x chip detected, register read %x\n", data);
290 ak881x->
pdata = client->
dev.platform_data;
310 dev_dbg(&client->
dev,
"IF mode %x\n", ifmode);
323 dev_info(&client->
dev,
"Detected an ak881x chip ID %x, revision %x\n",
329 static int ak881x_remove(
struct i2c_client *client)
331 struct ak881x *ak881x = to_ak881x(client);
346 static struct i2c_driver ak881x_i2c_driver = {
350 .probe = ak881x_probe,
351 .remove = ak881x_remove,
352 .id_table = ak881x_id,