21 #include <linux/module.h>
22 #include <linux/kernel.h>
23 #include <linux/i2c.h>
24 #include <linux/videodev2.h>
25 #include <linux/slab.h>
74 if ((input & 0xf) > 6) {
75 v4l2_err(sd,
"Invalid input %d.\n", input);
78 cs5345_write(sd, 0x09, input & 0xf);
79 cs5345_write(sd, 0x05, input & 0xf0);
89 cs5345_write(sd, 0x04, ctrl->
val ? 0x80 : 0);
92 cs5345_write(sd, 0x07, ((
u8)ctrl->
val) & 0x3f);
93 cs5345_write(sd, 0x08, ((
u8)ctrl->
val) & 0x3f);
99 #ifdef CONFIG_VIDEO_ADV_DEBUG
109 reg->
val = cs5345_read(sd, reg->
reg & 0x1f);
115 struct i2c_client *client = v4l2_get_subdevdata(sd);
121 cs5345_write(sd, reg->
reg & 0x1f, reg->
val & 0xff);
128 struct i2c_client *client = v4l2_get_subdevdata(sd);
133 static int cs5345_log_status(
struct v4l2_subdev *sd)
135 u8 v = cs5345_read(sd, 0x09) & 7;
136 u8 m = cs5345_read(sd, 0x04);
137 int vol = cs5345_read(sd, 0x08) & 0x3f;
140 (m & 0x80) ?
" (muted)" :
"");
150 .s_ctrl = cs5345_s_ctrl,
154 .log_status = cs5345_log_status,
155 .g_chip_ident = cs5345_g_chip_ident,
163 #ifdef CONFIG_VIDEO_ADV_DEBUG
164 .g_register = cs5345_g_register,
165 .s_register = cs5345_s_register,
170 .s_routing = cs5345_s_routing,
174 .core = &cs5345_core_ops,
175 .audio = &cs5345_audio_ops,
180 static int cs5345_probe(
struct i2c_client *client,
190 v4l_info(client,
"chip found @ 0x%x (%s)\n",
205 if (state->
hdl.error) {
206 int err = state->
hdl.error;
215 cs5345_write(sd, 0x02, 0x00);
216 cs5345_write(sd, 0x04, 0x01);
217 cs5345_write(sd, 0x09, 0x01);
223 static int cs5345_remove(
struct i2c_client *client)
225 struct v4l2_subdev *sd = i2c_get_clientdata(client);
247 .probe = cs5345_probe,
248 .remove = cs5345_remove,
249 .id_table = cs5345_id,