aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-04-08 04:35:30 -0400
committerIngo Molnar <mingo@elte.hu>2009-04-08 04:35:30 -0400
commit5ea472a77f8e4811ceee3f44a9deda6ad6e8b789 (patch)
treea9ec5019e2b666a19874fc344ffb0dd5da6bce94 /drivers/media/video/cx18
parent6c009ecef8cca28c7c09eb16d0802e37915a76e1 (diff)
parent577c9c456f0e1371cbade38eaf91ae8e8a308555 (diff)
Merge commit 'v2.6.30-rc1' into perfcounters/core
Conflicts: arch/powerpc/include/asm/systbl.h arch/powerpc/include/asm/unistd.h include/linux/init_task.h Merge reason: the conflicts are non-trivial: PowerPC placement of sys_perf_counter_open has to be mixed with the new preadv/pwrite syscalls. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/media/video/cx18')
-rw-r--r--drivers/media/video/cx18/cx18-audio.c9
-rw-r--r--drivers/media/video/cx18/cx18-av-core.c70
-rw-r--r--drivers/media/video/cx18/cx18-av-core.h5
-rw-r--r--drivers/media/video/cx18/cx18-driver.c4
-rw-r--r--drivers/media/video/cx18/cx18-fileops.c2
-rw-r--r--drivers/media/video/cx18/cx18-gpio.c6
-rw-r--r--drivers/media/video/cx18/cx18-i2c.c14
-rw-r--r--drivers/media/video/cx18/cx18-ioctl.c12
-rw-r--r--drivers/media/video/cx18/cx18-video.c16
9 files changed, 54 insertions, 84 deletions
diff --git a/drivers/media/video/cx18/cx18-audio.c b/drivers/media/video/cx18/cx18-audio.c
index bb5c5165dd5f..1519e91c677a 100644
--- a/drivers/media/video/cx18/cx18-audio.c
+++ b/drivers/media/video/cx18/cx18-audio.c
@@ -33,7 +33,6 @@
33int cx18_audio_set_io(struct cx18 *cx) 33int cx18_audio_set_io(struct cx18 *cx)
34{ 34{
35 const struct cx18_card_audio_input *in; 35 const struct cx18_card_audio_input *in;
36 struct v4l2_routing route;
37 u32 val; 36 u32 val;
38 int err; 37 int err;
39 38
@@ -44,13 +43,11 @@ int cx18_audio_set_io(struct cx18 *cx)
44 in = &cx->card->audio_inputs[cx->audio_input]; 43 in = &cx->card->audio_inputs[cx->audio_input];
45 44
46 /* handle muxer chips */ 45 /* handle muxer chips */
47 route.input = in->muxer_input; 46 v4l2_subdev_call(cx->sd_extmux, audio, s_routing,
48 route.output = 0; 47 in->audio_input, 0, 0);
49 v4l2_subdev_call(cx->sd_extmux, audio, s_routing, &route);
50 48
51 route.input = in->audio_input;
52 err = cx18_call_hw_err(cx, cx->card->hw_audio_ctrl, 49 err = cx18_call_hw_err(cx, cx->card->hw_audio_ctrl,
53 audio, s_routing, &route); 50 audio, s_routing, in->audio_input, 0, 0);
54 if (err) 51 if (err)
55 return err; 52 return err;
56 53
diff --git a/drivers/media/video/cx18/cx18-av-core.c b/drivers/media/video/cx18/cx18-av-core.c
index f4dd9d78eb3d..cf2bd888a429 100644
--- a/drivers/media/video/cx18/cx18-av-core.c
+++ b/drivers/media/video/cx18/cx18-av-core.c
@@ -203,43 +203,42 @@ static int cx18_av_reset(struct v4l2_subdev *sd, u32 val)
203 203
204static int cx18_av_init(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);
207 struct cx18 *cx = v4l2_get_subdevdata(sd); 206 struct cx18 *cx = v4l2_get_subdevdata(sd);
208 207
209 switch (val) { 208 /*
210 case CX18_AV_INIT_PLLS: 209 * The crystal freq used in calculations in this driver will be
211 /* 210 * 28.636360 MHz.
212 * The crystal freq used in calculations in this driver will be 211 * Aim to run the PLLs' VCOs near 400 MHz to minimze errors.
213 * 28.636360 MHz. 212 */
214 * Aim to run the PLLs' VCOs near 400 MHz to minimze errors.
215 */
216 213
217 /* 214 /*
218 * VDCLK Integer = 0x0f, Post Divider = 0x04 215 * VDCLK Integer = 0x0f, Post Divider = 0x04
219 * AIMCLK Integer = 0x0e, Post Divider = 0x16 216 * AIMCLK Integer = 0x0e, Post Divider = 0x16
220 */ 217 */
221 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f); 218 cx18_av_write4(cx, CXADEC_PLL_CTRL1, 0x160e040f);
222 219
223 /* VDCLK Fraction = 0x2be2fe */ 220 /* VDCLK Fraction = 0x2be2fe */
224 /* xtal * 0xf.15f17f0/4 = 108 MHz: 432 MHz before post divide */ 221 /* xtal * 0xf.15f17f0/4 = 108 MHz: 432 MHz before post divide */
225 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe); 222 cx18_av_write4(cx, CXADEC_VID_PLL_FRAC, 0x002be2fe);
226 223
227 /* AIMCLK Fraction = 0x05227ad */ 224 /* AIMCLK Fraction = 0x05227ad */
228 /* xtal * 0xe.2913d68/0x16 = 48000 * 384: 406 MHz pre post-div*/ 225 /* xtal * 0xe.2913d68/0x16 = 48000 * 384: 406 MHz pre post-div*/
229 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad); 226 cx18_av_write4(cx, CXADEC_AUX_PLL_FRAC, 0x005227ad);
230 227
231 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */ 228 /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x16 */
232 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56); 229 cx18_av_write(cx, CXADEC_I2S_MCLK, 0x56);
233 break; 230 return 0;
231}
234 232
235 case CX18_AV_INIT_NORMAL: 233static int cx18_av_load_fw(struct v4l2_subdev *sd)
236 default: 234{
237 if (!state->is_initialized) { 235 struct cx18_av_state *state = to_cx18_av_state(sd);
238 /* initialize on first use */ 236 struct cx18 *cx = v4l2_get_subdevdata(sd);
239 state->is_initialized = 1; 237
240 cx18_av_initialize(cx); 238 if (!state->is_initialized) {
241 } 239 /* initialize on first use */
242 break; 240 state->is_initialized = 1;
241 cx18_av_initialize(cx);
243 } 242 }
244 return 0; 243 return 0;
245} 244}
@@ -548,19 +547,19 @@ static int set_input(struct cx18 *cx, enum cx18_av_video_input vid_input,
548} 547}
549 548
550static int cx18_av_s_video_routing(struct v4l2_subdev *sd, 549static int cx18_av_s_video_routing(struct v4l2_subdev *sd,
551 const struct v4l2_routing *route) 550 u32 input, u32 output, u32 config)
552{ 551{
553 struct cx18_av_state *state = to_cx18_av_state(sd); 552 struct cx18_av_state *state = to_cx18_av_state(sd);
554 struct cx18 *cx = v4l2_get_subdevdata(sd); 553 struct cx18 *cx = v4l2_get_subdevdata(sd);
555 return set_input(cx, route->input, state->aud_input); 554 return set_input(cx, input, state->aud_input);
556} 555}
557 556
558static int cx18_av_s_audio_routing(struct v4l2_subdev *sd, 557static int cx18_av_s_audio_routing(struct v4l2_subdev *sd,
559 const struct v4l2_routing *route) 558 u32 input, u32 output, u32 config)
560{ 559{
561 struct cx18_av_state *state = to_cx18_av_state(sd); 560 struct cx18_av_state *state = to_cx18_av_state(sd);
562 struct cx18 *cx = v4l2_get_subdevdata(sd); 561 struct cx18 *cx = v4l2_get_subdevdata(sd);
563 return set_input(cx, state->vid_input, route->input); 562 return set_input(cx, state->vid_input, input);
564} 563}
565 564
566static int cx18_av_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) 565static int cx18_av_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
@@ -1185,10 +1184,12 @@ static const struct v4l2_subdev_core_ops cx18_av_general_ops = {
1185 .g_chip_ident = cx18_av_g_chip_ident, 1184 .g_chip_ident = cx18_av_g_chip_ident,
1186 .log_status = cx18_av_log_status, 1185 .log_status = cx18_av_log_status,
1187 .init = cx18_av_init, 1186 .init = cx18_av_init,
1187 .load_fw = cx18_av_load_fw,
1188 .reset = cx18_av_reset, 1188 .reset = cx18_av_reset,
1189 .queryctrl = cx18_av_queryctrl, 1189 .queryctrl = cx18_av_queryctrl,
1190 .g_ctrl = cx18_av_g_ctrl, 1190 .g_ctrl = cx18_av_g_ctrl,
1191 .s_ctrl = cx18_av_s_ctrl, 1191 .s_ctrl = cx18_av_s_ctrl,
1192 .s_std = cx18_av_s_std,
1192#ifdef CONFIG_VIDEO_ADV_DEBUG 1193#ifdef CONFIG_VIDEO_ADV_DEBUG
1193 .g_register = cx18_av_g_register, 1194 .g_register = cx18_av_g_register,
1194 .s_register = cx18_av_s_register, 1195 .s_register = cx18_av_s_register,
@@ -1200,7 +1201,6 @@ static const struct v4l2_subdev_tuner_ops cx18_av_tuner_ops = {
1200 .s_frequency = cx18_av_s_frequency, 1201 .s_frequency = cx18_av_s_frequency,
1201 .g_tuner = cx18_av_g_tuner, 1202 .g_tuner = cx18_av_g_tuner,
1202 .s_tuner = cx18_av_s_tuner, 1203 .s_tuner = cx18_av_s_tuner,
1203 .s_std = cx18_av_s_std,
1204}; 1204};
1205 1205
1206static const struct v4l2_subdev_audio_ops cx18_av_audio_ops = { 1206static const struct v4l2_subdev_audio_ops cx18_av_audio_ops = {
diff --git a/drivers/media/video/cx18/cx18-av-core.h b/drivers/media/video/cx18/cx18-av-core.h
index c458120e8c90..9b84a0c58e0e 100644
--- a/drivers/media/video/cx18/cx18-av-core.h
+++ b/drivers/media/video/cx18/cx18-av-core.h
@@ -328,11 +328,6 @@ static inline struct cx18_av_state *to_cx18_av_state(struct v4l2_subdev *sd)
328 return container_of(sd, struct cx18_av_state, sd); 328 return container_of(sd, struct cx18_av_state, sd);
329} 329}
330 330
331enum cx18_av_subdev_init_arg {
332 CX18_AV_INIT_NORMAL = 0,
333 CX18_AV_INIT_PLLS = 1,
334};
335
336/* ----------------------------------------------------------------------- */ 331/* ----------------------------------------------------------------------- */
337/* cx18_av-core.c */ 332/* cx18_av-core.c */
338int cx18_av_write(struct cx18 *cx, u16 addr, u8 value); 333int cx18_av_write(struct cx18 *cx, u16 addr, u8 value);
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index 210c68aaae00..49b1c3d7b1a8 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -810,7 +810,7 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
810 CX18_ERR("Could not register A/V decoder subdevice\n"); 810 CX18_ERR("Could not register A/V decoder subdevice\n");
811 goto free_map; 811 goto free_map;
812 } 812 }
813 cx18_call_hw(cx, CX18_HW_418_AV, core, init, (u32) CX18_AV_INIT_PLLS); 813 cx18_call_hw(cx, CX18_HW_418_AV, core, init, 0);
814 814
815 /* Initialize GPIO Reset Controller to do chip resets during i2c init */ 815 /* Initialize GPIO Reset Controller to do chip resets during i2c init */
816 if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) { 816 if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) {
@@ -1028,7 +1028,7 @@ int cx18_init_on_first_open(struct cx18 *cx)
1028 cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG); 1028 cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
1029 1029
1030 /* Init the A/V decoder, if it hasn't been already */ 1030 /* Init the A/V decoder, if it hasn't been already */
1031 v4l2_subdev_call(cx->sd_av, core, init, (u32) CX18_AV_INIT_NORMAL); 1031 v4l2_subdev_call(cx->sd_av, core, load_fw);
1032 1032
1033 vf.tuner = 0; 1033 vf.tuner = 0;
1034 vf.type = V4L2_TUNER_ANALOG_TV; 1034 vf.type = V4L2_TUNER_ANALOG_TV;
diff --git a/drivers/media/video/cx18/cx18-fileops.c b/drivers/media/video/cx18/cx18-fileops.c
index 4d7d6d5a7f86..b3889c0b2697 100644
--- a/drivers/media/video/cx18/cx18-fileops.c
+++ b/drivers/media/video/cx18/cx18-fileops.c
@@ -608,7 +608,7 @@ int cx18_v4l2_close(struct file *filp)
608 /* Mark that the radio is no longer in use */ 608 /* Mark that the radio is no longer in use */
609 clear_bit(CX18_F_I_RADIO_USER, &cx->i_flags); 609 clear_bit(CX18_F_I_RADIO_USER, &cx->i_flags);
610 /* Switch tuner to TV */ 610 /* Switch tuner to TV */
611 cx18_call_all(cx, tuner, s_std, cx->std); 611 cx18_call_all(cx, core, s_std, cx->std);
612 /* Select correct audio input (i.e. TV tuner or Line in) */ 612 /* Select correct audio input (i.e. TV tuner or Line in) */
613 cx18_audio_set_io(cx); 613 cx18_audio_set_io(cx);
614 if (atomic_read(&cx->ana_capturing) > 0) { 614 if (atomic_read(&cx->ana_capturing) > 0) {
diff --git a/drivers/media/video/cx18/cx18-gpio.c b/drivers/media/video/cx18/cx18-gpio.c
index 5518d1424f8f..86a204b5448e 100644
--- a/drivers/media/video/cx18/cx18-gpio.c
+++ b/drivers/media/video/cx18/cx18-gpio.c
@@ -156,12 +156,12 @@ static int gpiomux_s_std(struct v4l2_subdev *sd, v4l2_std_id norm)
156} 156}
157 157
158static int gpiomux_s_audio_routing(struct v4l2_subdev *sd, 158static int gpiomux_s_audio_routing(struct v4l2_subdev *sd,
159 const struct v4l2_routing *route) 159 u32 input, u32 output, u32 config)
160{ 160{
161 struct cx18 *cx = v4l2_get_subdevdata(sd); 161 struct cx18 *cx = v4l2_get_subdevdata(sd);
162 u32 data; 162 u32 data;
163 163
164 switch (route->input) { 164 switch (input) {
165 case 0: 165 case 0:
166 data = cx->card->gpio_audio_input.tuner; 166 data = cx->card->gpio_audio_input.tuner;
167 break; 167 break;
@@ -180,10 +180,10 @@ static int gpiomux_s_audio_routing(struct v4l2_subdev *sd,
180 180
181static const struct v4l2_subdev_core_ops gpiomux_core_ops = { 181static const struct v4l2_subdev_core_ops gpiomux_core_ops = {
182 .log_status = gpiomux_log_status, 182 .log_status = gpiomux_log_status,
183 .s_std = gpiomux_s_std,
183}; 184};
184 185
185static const struct v4l2_subdev_tuner_ops gpiomux_tuner_ops = { 186static const struct v4l2_subdev_tuner_ops gpiomux_tuner_ops = {
186 .s_std = gpiomux_s_std,
187 .s_radio = gpiomux_s_radio, 187 .s_radio = gpiomux_s_radio,
188}; 188};
189 189
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c
index d092643faf46..b9b7064a2be8 100644
--- a/drivers/media/video/cx18/cx18-i2c.c
+++ b/drivers/media/video/cx18/cx18-i2c.c
@@ -100,16 +100,16 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
100 100
101 if (hw == CX18_HW_TUNER) { 101 if (hw == CX18_HW_TUNER) {
102 /* special tuner group handling */ 102 /* special tuner group handling */
103 sd = v4l2_i2c_new_probed_subdev(adap, mod, type, 103 sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev,
104 cx->card_i2c->radio); 104 adap, mod, type, cx->card_i2c->radio);
105 if (sd != NULL) 105 if (sd != NULL)
106 sd->grp_id = hw; 106 sd->grp_id = hw;
107 sd = v4l2_i2c_new_probed_subdev(adap, mod, type, 107 sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev,
108 cx->card_i2c->demod); 108 adap, mod, type, cx->card_i2c->demod);
109 if (sd != NULL) 109 if (sd != NULL)
110 sd->grp_id = hw; 110 sd->grp_id = hw;
111 sd = v4l2_i2c_new_probed_subdev(adap, mod, type, 111 sd = v4l2_i2c_new_probed_subdev(&cx->v4l2_dev,
112 cx->card_i2c->tv); 112 adap, mod, type, cx->card_i2c->tv);
113 if (sd != NULL) 113 if (sd != NULL)
114 sd->grp_id = hw; 114 sd->grp_id = hw;
115 return sd != NULL ? 0 : -1; 115 return sd != NULL ? 0 : -1;
@@ -120,7 +120,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx)
120 return -1; 120 return -1;
121 121
122 /* It's an I2C device other than an analog tuner */ 122 /* It's an I2C device other than an analog tuner */
123 sd = v4l2_i2c_new_subdev(adap, mod, type, hw_addrs[idx]); 123 sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, mod, type, hw_addrs[idx]);
124 if (sd != NULL) 124 if (sd != NULL)
125 sd->grp_id = hw; 125 sd->grp_id = hw;
126 return sd != NULL ? 0 : -1; 126 return sd != NULL ? 0 : -1;
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c
index e4c9e3d8bacd..d7b1921e6666 100644
--- a/drivers/media/video/cx18/cx18-ioctl.c
+++ b/drivers/media/video/cx18/cx18-ioctl.c
@@ -705,7 +705,7 @@ int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std)
705 (unsigned long long) cx->std); 705 (unsigned long long) cx->std);
706 706
707 /* Tuner */ 707 /* Tuner */
708 cx18_call_all(cx, tuner, s_std, cx->std); 708 cx18_call_all(cx, core, s_std, cx->std);
709 return 0; 709 return 0;
710} 710}
711 711
@@ -926,16 +926,6 @@ static long cx18_default(struct file *file, void *fh, int cmd, void *arg)
926 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 926 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
927 927
928 switch (cmd) { 928 switch (cmd) {
929 case VIDIOC_INT_S_AUDIO_ROUTING: {
930 struct v4l2_routing *route = arg;
931
932 CX18_DEBUG_IOCTL("VIDIOC_INT_S_AUDIO_ROUTING(%d, %d)\n",
933 route->input, route->output);
934 cx18_call_hw(cx, cx->card->hw_audio_ctrl, audio, s_routing,
935 route);
936 break;
937 }
938
939 case VIDIOC_INT_RESET: { 929 case VIDIOC_INT_RESET: {
940 u32 val = *(u32 *)arg; 930 u32 val = *(u32 *)arg;
941 931
diff --git a/drivers/media/video/cx18/cx18-video.c b/drivers/media/video/cx18/cx18-video.c
index 6fdadedf17a8..6dc84aac8f44 100644
--- a/drivers/media/video/cx18/cx18-video.c
+++ b/drivers/media/video/cx18/cx18-video.c
@@ -25,20 +25,8 @@
25 25
26void cx18_video_set_io(struct cx18 *cx) 26void cx18_video_set_io(struct cx18 *cx)
27{ 27{
28 struct v4l2_routing route;
29 int inp = cx->active_input; 28 int inp = cx->active_input;
30 u32 type;
31 29
32 route.input = cx->card->video_inputs[inp].video_input; 30 v4l2_subdev_call(cx->sd_av, video, s_routing,
33 route.output = 0; 31 cx->card->video_inputs[inp].video_input, 0, 0);
34 v4l2_subdev_call(cx->sd_av, video, s_routing, &route);
35
36 type = cx->card->video_inputs[inp].video_type;
37
38 if (type == CX18_CARD_INPUT_VID_TUNER)
39 route.input = 0; /* Tuner */
40 else if (type < CX18_CARD_INPUT_COMPOSITE1)
41 route.input = 2; /* S-Video */
42 else
43 route.input = 1; /* Composite */
44} 32}