aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840/cx25840-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx25840/cx25840-core.c')
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c76
1 files changed, 56 insertions, 20 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index fc1ff69cffd0..d8eac3e30a7e 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -84,7 +84,7 @@ MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
84 84
85 85
86/* ----------------------------------------------------------------------- */ 86/* ----------------------------------------------------------------------- */
87static void cx23885_std_setup(struct i2c_client *client); 87static void cx23888_std_setup(struct i2c_client *client);
88 88
89int cx25840_write(struct i2c_client *client, u16 addr, u8 value) 89int cx25840_write(struct i2c_client *client, u16 addr, u8 value)
90{ 90{
@@ -638,10 +638,13 @@ static void cx23885_initialize(struct i2c_client *client)
638 finish_wait(&state->fw_wait, &wait); 638 finish_wait(&state->fw_wait, &wait);
639 destroy_workqueue(q); 639 destroy_workqueue(q);
640 640
641 /* Call the cx23885 specific std setup func, we no longer rely on 641 /* Call the cx23888 specific std setup func, we no longer rely on
642 * the generic cx24840 func. 642 * the generic cx24840 func.
643 */ 643 */
644 cx23885_std_setup(client); 644 if (is_cx23888(state))
645 cx23888_std_setup(client);
646 else
647 cx25840_std_setup(client);
645 648
646 /* (re)set input */ 649 /* (re)set input */
647 set_input(client, state->vid_input, state->aud_input); 650 set_input(client, state->vid_input, state->aud_input);
@@ -1103,9 +1106,23 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
1103 1106
1104 cx25840_write4(client, 0x410, 0xffff0dbf); 1107 cx25840_write4(client, 0x410, 0xffff0dbf);
1105 cx25840_write4(client, 0x414, 0x00137d03); 1108 cx25840_write4(client, 0x414, 0x00137d03);
1106 cx25840_write4(client, 0x418, 0x01008080); 1109
1110 /* on the 887, 0x418 is HSCALE_CTRL, on the 888 it is
1111 CHROMA_CTRL */
1112 if (is_cx23888(state))
1113 cx25840_write4(client, 0x418, 0x01008080);
1114 else
1115 cx25840_write4(client, 0x418, 0x01000000);
1116
1107 cx25840_write4(client, 0x41c, 0x00000000); 1117 cx25840_write4(client, 0x41c, 0x00000000);
1108 cx25840_write4(client, 0x420, 0x001c3e0f); 1118
1119 /* on the 887, 0x420 is CHROMA_CTRL, on the 888 it is
1120 CRUSH_CTRL */
1121 if (is_cx23888(state))
1122 cx25840_write4(client, 0x420, 0x001c3e0f);
1123 else
1124 cx25840_write4(client, 0x420, 0x001c8282);
1125
1109 cx25840_write4(client, 0x42c, 0x42600000); 1126 cx25840_write4(client, 0x42c, 0x42600000);
1110 cx25840_write4(client, 0x430, 0x0000039b); 1127 cx25840_write4(client, 0x430, 0x0000039b);
1111 cx25840_write4(client, 0x438, 0x00000000); 1128 cx25840_write4(client, 0x438, 0x00000000);
@@ -1233,7 +1250,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
1233 cx25840_write4(client, 0x8d0, 0x1f063870); 1250 cx25840_write4(client, 0x8d0, 0x1f063870);
1234 } 1251 }
1235 1252
1236 if (is_cx2388x(state)) { 1253 if (is_cx23888(state)) {
1237 /* HVR1850 */ 1254 /* HVR1850 */
1238 /* AUD_IO_CTRL - I2S Input, Parallel1*/ 1255 /* AUD_IO_CTRL - I2S Input, Parallel1*/
1239 /* - Channel 1 src - Parallel1 (Merlin out) */ 1256 /* - Channel 1 src - Parallel1 (Merlin out) */
@@ -1298,8 +1315,8 @@ static int set_v4lstd(struct i2c_client *client)
1298 } 1315 }
1299 cx25840_and_or(client, 0x400, ~0xf, fmt); 1316 cx25840_and_or(client, 0x400, ~0xf, fmt);
1300 cx25840_and_or(client, 0x403, ~0x3, pal_m); 1317 cx25840_and_or(client, 0x403, ~0x3, pal_m);
1301 if (is_cx2388x(state)) 1318 if (is_cx23888(state))
1302 cx23885_std_setup(client); 1319 cx23888_std_setup(client);
1303 else 1320 else
1304 cx25840_std_setup(client); 1321 cx25840_std_setup(client);
1305 if (!is_cx2583x(state)) 1322 if (!is_cx2583x(state))
@@ -1312,6 +1329,7 @@ static int set_v4lstd(struct i2c_client *client)
1312static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) 1329static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
1313{ 1330{
1314 struct v4l2_subdev *sd = to_sd(ctrl); 1331 struct v4l2_subdev *sd = to_sd(ctrl);
1332 struct cx25840_state *state = to_state(sd);
1315 struct i2c_client *client = v4l2_get_subdevdata(sd); 1333 struct i2c_client *client = v4l2_get_subdevdata(sd);
1316 1334
1317 switch (ctrl->id) { 1335 switch (ctrl->id) {
@@ -1324,12 +1342,20 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
1324 break; 1342 break;
1325 1343
1326 case V4L2_CID_SATURATION: 1344 case V4L2_CID_SATURATION:
1327 cx25840_write(client, 0x420, ctrl->val << 1); 1345 if (is_cx23888(state)) {
1328 cx25840_write(client, 0x421, ctrl->val << 1); 1346 cx25840_write(client, 0x418, ctrl->val << 1);
1347 cx25840_write(client, 0x419, ctrl->val << 1);
1348 } else {
1349 cx25840_write(client, 0x420, ctrl->val << 1);
1350 cx25840_write(client, 0x421, ctrl->val << 1);
1351 }
1329 break; 1352 break;
1330 1353
1331 case V4L2_CID_HUE: 1354 case V4L2_CID_HUE:
1332 cx25840_write(client, 0x422, ctrl->val); 1355 if (is_cx23888(state))
1356 cx25840_write(client, 0x41a, ctrl->val);
1357 else
1358 cx25840_write(client, 0x422, ctrl->val);
1333 break; 1359 break;
1334 1360
1335 default: 1361 default:
@@ -1354,11 +1380,21 @@ static int cx25840_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt
1354 fmt->field = V4L2_FIELD_INTERLACED; 1380 fmt->field = V4L2_FIELD_INTERLACED;
1355 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1381 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M;
1356 1382
1357 Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; 1383 if (is_cx23888(state)) {
1358 Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; 1384 Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4;
1385 Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4;
1386 } else {
1387 Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4;
1388 Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4;
1389 }
1359 1390
1360 Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; 1391 if (is_cx23888(state)) {
1361 Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; 1392 Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4;
1393 Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4;
1394 } else {
1395 Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4;
1396 Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4;
1397 }
1362 1398
1363 Vlines = fmt->height + (is_50Hz ? 4 : 7); 1399 Vlines = fmt->height + (is_50Hz ? 4 : 7);
1364 1400
@@ -1782,8 +1818,8 @@ static int cx25840_s_video_routing(struct v4l2_subdev *sd,
1782 struct cx25840_state *state = to_state(sd); 1818 struct cx25840_state *state = to_state(sd);
1783 struct i2c_client *client = v4l2_get_subdevdata(sd); 1819 struct i2c_client *client = v4l2_get_subdevdata(sd);
1784 1820
1785 if (is_cx2388x(state)) 1821 if (is_cx23888(state))
1786 cx23885_std_setup(client); 1822 cx23888_std_setup(client);
1787 1823
1788 return set_input(client, input, state->aud_input); 1824 return set_input(client, input, state->aud_input);
1789} 1825}
@@ -1794,8 +1830,8 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
1794 struct cx25840_state *state = to_state(sd); 1830 struct cx25840_state *state = to_state(sd);
1795 struct i2c_client *client = v4l2_get_subdevdata(sd); 1831 struct i2c_client *client = v4l2_get_subdevdata(sd);
1796 1832
1797 if (is_cx2388x(state)) 1833 if (is_cx23888(state))
1798 cx23885_std_setup(client); 1834 cx23888_std_setup(client);
1799 return set_input(client, state->vid_input, input); 1835 return set_input(client, state->vid_input, input);
1800} 1836}
1801 1837
@@ -4939,7 +4975,7 @@ void cx23885_dif_setup(struct i2c_client *client, u32 ifHz)
4939 } 4975 }
4940} 4976}
4941 4977
4942static void cx23885_std_setup(struct i2c_client *client) 4978static void cx23888_std_setup(struct i2c_client *client)
4943{ 4979{
4944 struct cx25840_state *state = to_state(i2c_get_clientdata(client)); 4980 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
4945 v4l2_std_id std = state->std; 4981 v4l2_std_id std = state->std;