aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Walls <awalls@radix.net>2009-02-16 00:23:25 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:01 -0400
commitfa3e70360c86480acbaa54c9791e843196327a66 (patch)
treebc8d1f8b68f9aad107d63d6b6c9e884519fe1d34
parent5811cf99df2e3c102055be3ea77508e56c9f77c6 (diff)
V4L/DVB (10757): cx18, v4l2-chip-ident: Finish conversion of AV decoder core to v4l2_subdev
Added a new chip identifer to v4l2-chip-ident for the integrated A/V broadcast decoder core internal to the CX23418. Completed separation and encapsulation of the A/V decoder core interface as a v4l2_subdevice. The cx18 driver now compiles and links again. Signed-off-by: Andy Walls <awalls@radix.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c85
-rw-r--r--drivers/media/video/cx18/cx18-av-core.h10
-rw-r--r--drivers/media/video/cx18/cx18-controls.c8
-rw-r--r--drivers/media/video/cx18/cx18-driver.c18
-rw-r--r--drivers/media/video/cx18/cx18-driver.h1
-rw-r--r--drivers/media/video/cx18/cx18-firmware.c18
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c4
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c14
-rw-r--r--drivers/media/video/cx18/cx18-streams.c2
-rw-r--r--drivers/media/video/cx18/cx18-vbi.c2
-rw-r--r--drivers/media/video/cx18/cx18-video.c2
-rw-r--r--include/media/v4l2-chip-ident.h3
12 files changed, 100 insertions, 67 deletions
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index 9b30f77b5205..f9bb77a25ee9 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -201,15 +201,45 @@ static int cx18_av_reset(struct v4l2_subdev *sd, u32 val)
201 return 0; 201 return 0;
202} 202}
203 203
204static int cx18_av_init_hardware(struct v4l2_subdev *sd, u32 val) 204static int cx18_av_init(struct v4l2_subdev *sd, u32 val)
205{ 205{
206 struct cx18_av_state *state = to_cx18_av_state(sd); 206 struct cx18_av_state *state = to_cx18_av_state(sd);
207 struct cx18 *cx = v4l2_get_subdevdata(sd); 207 struct cx18 *cx = v4l2_get_subdevdata(sd);
208 208
209 if (!state->is_initialized) { 209 switch (val) {
210 /* initialize on first use */ 210 case CX18_AV_INIT_PLLS:
211 state->is_initialized = 1; 211 /*
212 cx18_av_initialize(cx); 212 * The crystal freq used in calculations in this driver will be
213 * 28.636360 MHz.
214 * Aim to run the PLLs' VCOs near 400 MHz to minimze errors.
215 */
216
217 /*
218 * VDCLK Integer = 0x0f, Post Divider = 0x04
219 * AIMCLK Integer = 0x0e, Post Divider = 0x16
220 */
221 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f);
222
223 /* VDCLK Fraction = 0x2be2fe */
224 /* xtal * 0xf.15f17f0/4 = 108 MHz: 432 MHz before post divide */
225 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe);
226
227 /* AIMCLK Fraction = 0x05227ad */
228 /* xtal * 0xe.2913d68/0x16 = 48000 * 384: 406 MHz pre post-div*/
229 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad);
230
231 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */
232 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56);
233 break;
234
235 case CX18_AV_INIT_NORMAL:
236 default:
237 if (!state->is_initialized) {
238 /* initialize on first use */
239 state->is_initialized = 1;
240 cx18_av_initialize(cx);
241 }
242 break;
213 } 243 }
214 return 0; 244 return 0;
215} 245}
@@ -1095,14 +1125,11 @@ static inline int cx18_av_dbg_match(const struct v4l2_dbg_match *match)
1095static int cx18_av_g_chip_ident(struct v4l2_subdev *sd, 1125static int cx18_av_g_chip_ident(struct v4l2_subdev *sd,
1096 struct v4l2_dbg_chip_ident *chip) 1126 struct v4l2_dbg_chip_ident *chip)
1097{ 1127{
1128 struct cx18_av_state *state = to_cx18_av_state(sd);
1129
1098 if (cx18_av_dbg_match(&chip->match)) { 1130 if (cx18_av_dbg_match(&chip->match)) {
1099 /* 1131 chip->ident = state->id;
1100 * Nothing else is going to claim to be this combination, 1132 chip->revision = state->rev;
1101 * and the real host chip revision will be returned by a host
1102 * match on address 0.
1103 */
1104 chip->ident = V4L2_IDENT_CX25843;
1105 chip->revision = V4L2_IDENT_CX23418; /* Why not */
1106 } 1133 }
1107 return 0; 1134 return 0;
1108} 1135}
@@ -1143,7 +1170,7 @@ static int cx18_av_s_register(struct v4l2_subdev *sd,
1143static const struct v4l2_subdev_core_ops cx18_av_general_ops = { 1170static const struct v4l2_subdev_core_ops cx18_av_general_ops = {
1144 .g_chip_ident = cx18_av_g_chip_ident, 1171 .g_chip_ident = cx18_av_g_chip_ident,
1145 .log_status = cx18_av_log_status, 1172 .log_status = cx18_av_log_status,
1146 .init = cx18_av_init_hardware, 1173 .init = cx18_av_init,
1147 .reset = cx18_av_reset, 1174 .reset = cx18_av_reset,
1148 .queryctrl = cx18_av_queryctrl, 1175 .queryctrl = cx18_av_queryctrl,
1149 .g_ctrl = cx18_av_g_ctrl, 1176 .g_ctrl = cx18_av_g_ctrl,
@@ -1182,19 +1209,31 @@ static const struct v4l2_subdev_ops cx18_av_ops = {
1182 .video = &cx18_av_video_ops, 1209 .video = &cx18_av_video_ops,
1183}; 1210};
1184 1211
1185int cx18_av_init(struct cx18 *cx) 1212int cx18_av_probe(struct cx18 *cx, struct v4l2_subdev **sd)
1186{ 1213{
1187 struct v4l2_subdev *sd = &cx->av_state.sd; 1214 struct cx18_av_state *state = &cx->av_state;
1188 1215
1189 v4l2_subdev_init(sd, &cx18_av_ops); 1216 state->rev = cx18_av_read4(cx, CXADEC_CHIP_CTRL) & 0xffff;
1190 v4l2_set_subdevdata(sd, cx); 1217 state->id = ((state->rev >> 4) == CXADEC_CHIP_TYPE_MAKO)
1191 snprintf(sd->name, sizeof(sd->name), 1218 ? V4L2_IDENT_CX23418_843 : V4L2_IDENT_UNKNOWN;
1192 "%s-internal A/V decoder", cx->v4l2_dev.name); 1219
1193 sd->grp_id = CX18_HW_CX23418; 1220 state->vid_input = CX18_AV_COMPOSITE7;
1194 return v4l2_device_register_subdev(&cx->v4l2_dev, sd); 1221 state->aud_input = CX18_AV_AUDIO8;
1222 state->audclk_freq = 48000;
1223 state->audmode = V4L2_TUNER_MODE_LANG1;
1224 state->slicer_line_delay = 0;
1225 state->slicer_line_offset = (10 + state->slicer_line_delay - 2);
1226
1227 *sd = &state->sd;
1228 v4l2_subdev_init(*sd, &cx18_av_ops);
1229 v4l2_set_subdevdata(*sd, cx);
1230 snprintf((*sd)->name, sizeof((*sd)->name),
1231 "%s internal A/V decoder", cx->v4l2_dev.name);
1232 (*sd)->grp_id = CX18_HW_CX23418;
1233 return v4l2_device_register_subdev(&cx->v4l2_dev, *sd);
1195} 1234}
1196 1235
1197void cx18_av_fini(struct cx18 *cx) 1236void cx18_av_exit(struct cx18 *cx, struct v4l2_subdev *sd)
1198{ 1237{
1199 v4l2_device_unregister_subdev(&cx->av_state.sd); 1238 v4l2_device_unregister_subdev(&cx->av_state.sd);
1200} 1239}
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h
index 025100aee4b8..90bdca960292 100644
--- a/drivers/media/video/cx18/cx18-av-core.h
+++ b/drivers/media/video/cx18/cx18-av-core.h
@@ -323,6 +323,11 @@ static inline struct cx18_av_state *to_cx18_av_state(struct v4l2_subdev *sd)
323 return container_of(sd, struct cx18_av_state, sd); 323 return container_of(sd, struct cx18_av_state, sd);
324} 324}
325 325
326enum cx18_av_subdev_init_arg {
327 CX18_AV_INIT_NORMAL = 0,
328 CX18_AV_INIT_PLLS = 1,
329};
330
326/* ----------------------------------------------------------------------- */ 331/* ----------------------------------------------------------------------- */
327/* cx18_av-core.c */ 332/* cx18_av-core.c */
328int cx18_av_write(struct cx18 *cx, u16 addr, u8 value); 333int cx18_av_write(struct cx18 *cx, u16 addr, u8 value);
@@ -337,9 +342,8 @@ int cx18_av_and_or(struct cx18 *cx, u16 addr, unsigned mask, u8 value);
337int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value); 342int cx18_av_and_or4(struct cx18 *cx, u16 addr, u32 mask, u32 value);
338void cx18_av_std_setup(struct cx18 *cx); 343void cx18_av_std_setup(struct cx18 *cx);
339 344
340int cx18_av_cmd(struct cx18 *cx, int cmd, void *arg); /* FIXME - Remove */ 345int cx18_av_probe(struct cx18 *cx, struct v4l2_subdev **sd);
341int cx18_av_init(struct cx18 *cx); 346void cx18_av_exit(struct cx18 *cx, struct v4l2_subdev *sd);
342void cx18_av_fini(struct cx18 *cx);
343 347
344/* ----------------------------------------------------------------------- */ 348/* ----------------------------------------------------------------------- */
345/* cx18_av-firmware.c */ 349/* cx18_av-firmware.c */
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c
index 10a4e07b7aca..9505c417371d 100644
--- a/drivers/media/video/cx18/cx18-controls.c
+++ b/drivers/media/video/cx18/cx18-controls.c
@@ -67,7 +67,7 @@ int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *qctrl)
67 case V4L2_CID_HUE: 67 case V4L2_CID_HUE:
68 case V4L2_CID_SATURATION: 68 case V4L2_CID_SATURATION:
69 case V4L2_CID_CONTRAST: 69 case V4L2_CID_CONTRAST:
70 if (cx18_av_cmd(cx, VIDIOC_QUERYCTRL, qctrl)) 70 if (v4l2_subdev_call(cx->sd_av, core, queryctrl, qctrl))
71 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED; 71 qctrl->flags |= V4L2_CTRL_FLAG_DISABLED;
72 return 0; 72 return 0;
73 73
@@ -126,7 +126,7 @@ static int cx18_s_ctrl(struct cx18 *cx, struct v4l2_control *vctrl)
126 case V4L2_CID_HUE: 126 case V4L2_CID_HUE:
127 case V4L2_CID_SATURATION: 127 case V4L2_CID_SATURATION:
128 case V4L2_CID_CONTRAST: 128 case V4L2_CID_CONTRAST:
129 return cx18_av_cmd(cx, VIDIOC_S_CTRL, vctrl); 129 return v4l2_subdev_call(cx->sd_av, core, s_ctrl, vctrl);
130 130
131 case V4L2_CID_AUDIO_VOLUME: 131 case V4L2_CID_AUDIO_VOLUME:
132 case V4L2_CID_AUDIO_MUTE: 132 case V4L2_CID_AUDIO_MUTE:
@@ -151,7 +151,7 @@ static int cx18_g_ctrl(struct cx18 *cx, struct v4l2_control *vctrl)
151 case V4L2_CID_HUE: 151 case V4L2_CID_HUE:
152 case V4L2_CID_SATURATION: 152 case V4L2_CID_SATURATION:
153 case V4L2_CID_CONTRAST: 153 case V4L2_CID_CONTRAST:
154 return cx18_av_cmd(cx, VIDIOC_G_CTRL, vctrl); 154 return v4l2_subdev_call(cx->sd_av, core, g_ctrl, vctrl);
155 155
156 case V4L2_CID_AUDIO_VOLUME: 156 case V4L2_CID_AUDIO_VOLUME:
157 case V4L2_CID_AUDIO_MUTE: 157 case V4L2_CID_AUDIO_MUTE:
@@ -278,7 +278,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c)
278 fmt.fmt.pix.width = cx->params.width 278 fmt.fmt.pix.width = cx->params.width
279 / (is_mpeg1 ? 2 : 1); 279 / (is_mpeg1 ? 2 : 1);
280 fmt.fmt.pix.height = cx->params.height; 280 fmt.fmt.pix.height = cx->params.height;
281 cx18_av_cmd(cx, VIDIOC_S_FMT, &fmt); 281 v4l2_subdev_call(cx->sd_av, video, s_fmt, &fmt);
282 } 282 }
283 priv.cx = cx; 283 priv.cx = cx;
284 priv.s = &cx->streams[id->type]; 284 priv.s = &cx->streams[id->type];
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index f69e688ab6f4..f5a41dd663dc 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -621,13 +621,6 @@ static void __devinit cx18_init_struct2(struct cx18 *cx)
621 i = 0; 621 i = 0;
622 cx->active_input = i; 622 cx->active_input = i;
623 cx->audio_input = cx->card->video_inputs[i].audio_index; 623 cx->audio_input = cx->card->video_inputs[i].audio_index;
624 cx->av_state.vid_input = CX18_AV_COMPOSITE7;
625 cx->av_state.aud_input = CX18_AV_AUDIO8;
626 cx->av_state.audclk_freq = 48000;
627 cx->av_state.audmode = V4L2_TUNER_MODE_LANG1;
628 cx->av_state.slicer_line_delay = 0;
629 cx->av_state.slicer_line_offset =
630 (10 + cx->av_state.slicer_line_delay - 2);
631} 624}
632 625
633static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev, 626static int cx18_setup_pci(struct cx18 *cx, struct pci_dev *pci_dev,
@@ -812,6 +805,14 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
812 805
813 cx18_gpio_init(cx); 806 cx18_gpio_init(cx);
814 807
808 retval = cx18_av_probe(cx, &cx->sd_av);
809 if (retval) {
810 CX18_ERR("Could not register A/V decoder subdevice\n");
811 goto free_map;
812 }
813 /* Initialize the A/V decoder PLLs to sane defaults */
814 v4l2_subdev_call(cx->sd_av, core, init, (u32) CX18_AV_INIT_PLLS);
815
815 /* active i2c */ 816 /* active i2c */
816 CX18_DEBUG_INFO("activating i2c...\n"); 817 CX18_DEBUG_INFO("activating i2c...\n");
817 retval = init_cx18_i2c(cx); 818 retval = init_cx18_i2c(cx);
@@ -1020,6 +1021,9 @@ int cx18_init_on_first_open(struct cx18 *cx)
1020 cx18_vapi(cx, CX18_APU_RESETAI, 0); 1021 cx18_vapi(cx, CX18_APU_RESETAI, 0);
1021 cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG); 1022 cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
1022 1023
1024 /* Init the A/V decoder, if it hasn't been already */
1025 v4l2_subdev_call(cx->sd_av, core, init, (u32) CX18_AV_INIT_NORMAL);
1026
1023 vf.tuner = 0; 1027 vf.tuner = 0;
1024 vf.type = V4L2_TUNER_ANALOG_TV; 1028 vf.type = V4L2_TUNER_ANALOG_TV;
1025 vf.frequency = 6400; /* the tuner 'baseline' frequency */ 1029 vf.frequency = 6400; /* the tuner 'baseline' frequency */
diff --git a/drivers/media/video/cx18/cx18-driver.h b/drivers/media/video/cx18/cx18-driver.h
index def82bd1078a..4b50878fc265 100644
--- a/drivers/media/video/cx18/cx18-driver.h
+++ b/drivers/media/video/cx18/cx18-driver.h
@@ -448,6 +448,7 @@ struct cx18 {
448 int instance; 448 int instance;
449 struct pci_dev *pci_dev; 449 struct pci_dev *pci_dev;
450 struct v4l2_device v4l2_dev; 450 struct v4l2_device v4l2_dev;
451 struct v4l2_subdev *sd_av;
451 452
452 const struct cx18_card *card; /* card information */ 453 const struct cx18_card *card; /* card information */
453 const char *card_name; /* full name of the card */ 454 const char *card_name; /* full name of the card */
diff --git a/drivers/media/video/cx18/cx18-firmware.c b/drivers/media/video/cx18/cx18-firmware.c
index aa89bee65af0..83cd559cc609 100644
--- a/drivers/media/video/cx18/cx18-firmware.c
+++ b/drivers/media/video/cx18/cx18-firmware.c
@@ -26,7 +26,6 @@
26#include "cx18-irq.h" 26#include "cx18-irq.h"
27#include "cx18-firmware.h" 27#include "cx18-firmware.h"
28#include "cx18-cards.h" 28#include "cx18-cards.h"
29#include "cx18-av-core.h"
30#include <linux/firmware.h> 29#include <linux/firmware.h>
31 30
32#define CX18_PROC_SOFT_RESET 0xc70010 31#define CX18_PROC_SOFT_RESET 0xc70010
@@ -286,23 +285,6 @@ void cx18_init_power(struct cx18 *cx, int lowpwr)
286 cx18_write_reg(cx, 0x2BE2FE, CX18_MPEG_CLOCK_PLL_FRAC); 285 cx18_write_reg(cx, 0x2BE2FE, CX18_MPEG_CLOCK_PLL_FRAC);
287 cx18_write_reg(cx, 8, CX18_MPEG_CLOCK_PLL_POST); 286 cx18_write_reg(cx, 8, CX18_MPEG_CLOCK_PLL_POST);
288 287
289 /*
290 * VDCLK Integer = 0x0f, Post Divider = 0x04
291 * AIMCLK Integer = 0x0e, Post Divider = 0x16
292 */
293 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f);
294
295 /* VDCLK Fraction = 0x2be2fe */
296 /* xtal * 0xf.15f17f0/4 = 108 MHz: 432 MHz before post divide */
297 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe);
298
299 /* AIMCLK Fraction = 0x05227ad */
300 /* xtal * 0xe.2913d68/0x16 = 48000 * 384: 406 MHz before post-divide */
301 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad);
302
303 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */
304 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56);
305
306 /* Defaults */ 288 /* Defaults */
307 /* APU = SC or SC/2 = 125/62.5 */ 289 /* APU = SC or SC/2 = 125/62.5 */
308 /* EPU = SC = 125 */ 290 /* EPU = SC = 125 */
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index db2c3e6997d0..db7b55281f50 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -304,7 +304,7 @@ int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg)
304 return cx18_gpio(cx, cmd, arg); 304 return cx18_gpio(cx, cmd, arg);
305 305
306 if (hw == CX18_HW_CX23418) 306 if (hw == CX18_HW_CX23418)
307 return cx18_av_cmd(cx, cmd, arg); 307 return v4l2_subdev_command(cx->sd_av, cmd, arg);
308 308
309 addr = cx18_i2c_hw_addr(cx, hw); 309 addr = cx18_i2c_hw_addr(cx, hw);
310 if (addr < 0) { 310 if (addr < 0) {
@@ -322,7 +322,7 @@ void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg)
322 CX18_ERR("adapter is not set\n"); 322 CX18_ERR("adapter is not set\n");
323 return; 323 return;
324 } 324 }
325 cx18_av_cmd(cx, cmd, arg); 325 v4l2_subdev_command(cx->sd_av, cmd, arg);
326 i2c_clients_command(&cx->i2c_adap[0], cmd, arg); 326 i2c_clients_command(&cx->i2c_adap[0], cmd, arg);
327 i2c_clients_command(&cx->i2c_adap[1], cmd, arg); 327 i2c_clients_command(&cx->i2c_adap[1], cmd, arg);
328 if (cx->hw_flags & CX18_HW_GPIO) 328 if (cx->hw_flags & CX18_HW_GPIO)
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index 3277b3d3ceae..0ddf4dd55308 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -208,7 +208,7 @@ static int cx18_g_fmt_sliced_vbi_cap(struct file *file, void *fh,
208 * digitizer/slicer. Note, cx18_av_vbi() wipes the passed in 208 * digitizer/slicer. Note, cx18_av_vbi() wipes the passed in
209 * fmt->fmt.sliced under valid calling conditions 209 * fmt->fmt.sliced under valid calling conditions
210 */ 210 */
211 if (cx18_av_cmd(cx, VIDIOC_G_FMT, fmt)) 211 if (v4l2_subdev_call(cx->sd_av, video, g_fmt, fmt))
212 return -EINVAL; 212 return -EINVAL;
213 213
214 /* Ensure V4L2 spec compliant output */ 214 /* Ensure V4L2 spec compliant output */
@@ -295,7 +295,7 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
295 295
296 cx->params.width = w; 296 cx->params.width = w;
297 cx->params.height = h; 297 cx->params.height = h;
298 cx18_av_cmd(cx, VIDIOC_S_FMT, fmt); 298 v4l2_subdev_call(cx->sd_av, video, s_fmt, fmt);
299 return cx18_g_fmt_vid_cap(file, fh, fmt); 299 return cx18_g_fmt_vid_cap(file, fh, fmt);
300} 300}
301 301
@@ -322,7 +322,7 @@ static int cx18_s_fmt_vbi_cap(struct file *file, void *fh,
322 * Note cx18_av_vbi_wipes out alot of the passed in fmt under valid 322 * Note cx18_av_vbi_wipes out alot of the passed in fmt under valid
323 * calling conditions 323 * calling conditions
324 */ 324 */
325 ret = cx18_av_cmd(cx, VIDIOC_S_FMT, fmt); 325 ret = v4l2_subdev_call(cx->sd_av, video, s_fmt, fmt);
326 if (ret) 326 if (ret)
327 return ret; 327 return ret;
328 328
@@ -359,7 +359,7 @@ static int cx18_s_fmt_sliced_vbi_cap(struct file *file, void *fh,
359 * Note, cx18_av_vbi() wipes some "impossible" service lines in the 359 * Note, cx18_av_vbi() wipes some "impossible" service lines in the
360 * passed in fmt->fmt.sliced under valid calling conditions 360 * passed in fmt->fmt.sliced under valid calling conditions
361 */ 361 */
362 ret = cx18_av_cmd(cx, VIDIOC_S_FMT, fmt); 362 ret = v4l2_subdev_call(cx->sd_av, video, s_fmt, fmt);
363 if (ret) 363 if (ret)
364 return ret; 364 return ret;
365 /* Store our current v4l2 sliced VBI settings */ 365 /* Store our current v4l2 sliced VBI settings */
@@ -516,7 +516,8 @@ static int cx18_s_crop(struct file *file, void *fh, struct v4l2_crop *crop)
516 516
517 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 517 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
518 return -EINVAL; 518 return -EINVAL;
519 return cx18_av_cmd(cx, VIDIOC_S_CROP, crop); 519 CX18_DEBUG_WARN("VIDIOC_S_CROP not implemented\n");
520 return -EINVAL;
520} 521}
521 522
522static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop) 523static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop)
@@ -525,7 +526,8 @@ static int cx18_g_crop(struct file *file, void *fh, struct v4l2_crop *crop)
525 526
526 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 527 if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
527 return -EINVAL; 528 return -EINVAL;
528 return cx18_av_cmd(cx, VIDIOC_G_CROP, crop); 529 CX18_DEBUG_WARN("VIDIOC_G_CROP not implemented\n");
530 return -EINVAL;
529} 531}
530 532
531static int cx18_enum_fmt_vid_cap(struct file *file, void *fh, 533static int cx18_enum_fmt_vid_cap(struct file *file, void *fh,
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c
index eff4a14d0152..1d17884b3b0d 100644
--- a/drivers/media/video/cx18/cx18-streams.c
+++ b/drivers/media/video/cx18/cx18-streams.c
@@ -348,7 +348,7 @@ static void cx18_vbi_setup(struct cx18_stream *s)
348 } 348 }
349 349
350 /* setup VBI registers */ 350 /* setup VBI registers */
351 cx18_av_cmd(cx, VIDIOC_S_FMT, &cx->vbi.in); 351 v4l2_subdev_call(cx->sd_av, video, s_fmt, &cx->vbi.in);
352 352
353 /* 353 /*
354 * Send the CX18_CPU_SET_RAW_VBI_PARAM API command to setup Encoder Raw 354 * Send the CX18_CPU_SET_RAW_VBI_PARAM API command to setup Encoder Raw
diff --git a/drivers/media/video/cx18/cx18-vbi.c b/drivers/media/video/cx18/cx18-vbi.c
index 8e6f4d4aff9a..91c21dce607f 100644
--- a/drivers/media/video/cx18/cx18-vbi.c
+++ b/drivers/media/video/cx18/cx18-vbi.c
@@ -154,7 +154,7 @@ static u32 compress_sliced_buf(struct cx18 *cx, u32 line, u8 *buf,
154 if (p[0] != 0xff || p[1] || p[2] || p[3] != eav) 154 if (p[0] != 0xff || p[1] || p[2] || p[3] != eav)
155 continue; 155 continue;
156 vbi.p = p + 4; 156 vbi.p = p + 4;
157 cx18_av_cmd(cx, VIDIOC_INT_DECODE_VBI_LINE, &vbi); 157 v4l2_subdev_call(cx->sd_av, video, decode_vbi_line, &vbi);
158 if (vbi.type) { 158 if (vbi.type) {
159 cx->vbi.sliced_data[line].id = vbi.type; 159 cx->vbi.sliced_data[line].id = vbi.type;
160 cx->vbi.sliced_data[line].field = vbi.is_second_field; 160 cx->vbi.sliced_data[line].field = vbi.is_second_field;
diff --git a/drivers/media/video/cx18/cx18-video.c b/drivers/media/video/cx18/cx18-video.c
index 2e5c41939330..fabacb0f87c6 100644
--- a/drivers/media/video/cx18/cx18-video.c
+++ b/drivers/media/video/cx18/cx18-video.c
@@ -32,7 +32,7 @@ void cx18_video_set_io(struct cx18 *cx)
32 32
33 route.input = cx->card->video_inputs[inp].video_input; 33 route.input = cx->card->video_inputs[inp].video_input;
34 route.output = 0; 34 route.output = 0;
35 cx18_av_cmd(cx, VIDIOC_INT_S_VIDEO_ROUTING, &route); 35 v4l2_subdev_call(cx->sd_av, video, s_routing, &route);
36 36
37 type = cx->card->video_inputs[inp].video_type; 37 type = cx->card->video_inputs[inp].video_type;
38 38
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h
index a5339d8ba9a4..70117e748f20 100644
--- a/include/media/v4l2-chip-ident.h
+++ b/include/media/v4l2-chip-ident.h
@@ -64,7 +64,8 @@ enum {
64 /* module saa7146: reserved range 300-309 */ 64 /* module saa7146: reserved range 300-309 */
65 V4L2_IDENT_SAA7146 = 300, 65 V4L2_IDENT_SAA7146 = 300,
66 66
67 /* Conexant MPEG encoder/decoders: reserved range 410-420 */ 67 /* Conexant MPEG encoder/decoders: reserved range 400-420 */
68 V4L2_IDENT_CX23418_843 = 403, /* Integrated A/V Decoder on the '418 */
68 V4L2_IDENT_CX23415 = 415, 69 V4L2_IDENT_CX23415 = 415,
69 V4L2_IDENT_CX23416 = 416, 70 V4L2_IDENT_CX23416 = 416,
70 V4L2_IDENT_CX23418 = 418, 71 V4L2_IDENT_CX23418 = 418,