diff options
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r-- | drivers/media/video/saa7115.c | 61 |
1 files changed, 24 insertions, 37 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index cebf159f52cf..44873a016c2c 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #include <linux/videodev2.h> | 46 | #include <linux/videodev2.h> |
47 | #include <media/v4l2-device.h> | 47 | #include <media/v4l2-device.h> |
48 | #include <media/v4l2-chip-ident.h> | 48 | #include <media/v4l2-chip-ident.h> |
49 | #include <media/v4l2-i2c-drv-legacy.h> | 49 | #include <media/v4l2-i2c-drv.h> |
50 | #include <media/saa7115.h> | 50 | #include <media/saa7115.h> |
51 | #include <asm/div64.h> | 51 | #include <asm/div64.h> |
52 | 52 | ||
@@ -62,12 +62,6 @@ module_param(debug, bool, 0644); | |||
62 | 62 | ||
63 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); | 63 | MODULE_PARM_DESC(debug, "Debug level (0-1)"); |
64 | 64 | ||
65 | static unsigned short normal_i2c[] = { | ||
66 | 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */ | ||
67 | 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */ | ||
68 | I2C_CLIENT_END }; | ||
69 | |||
70 | I2C_CLIENT_INSMOD; | ||
71 | 65 | ||
72 | struct saa711x_state { | 66 | struct saa711x_state { |
73 | struct v4l2_subdev sd; | 67 | struct v4l2_subdev sd; |
@@ -1234,30 +1228,32 @@ static int saa711x_s_radio(struct v4l2_subdev *sd) | |||
1234 | return 0; | 1228 | return 0; |
1235 | } | 1229 | } |
1236 | 1230 | ||
1237 | static int saa711x_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *route) | 1231 | static int saa711x_s_routing(struct v4l2_subdev *sd, |
1232 | u32 input, u32 output, u32 config) | ||
1238 | { | 1233 | { |
1239 | struct saa711x_state *state = to_state(sd); | 1234 | struct saa711x_state *state = to_state(sd); |
1240 | u32 input = route->input; | ||
1241 | u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0; | 1235 | u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0; |
1242 | 1236 | ||
1243 | v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", route->input, route->output); | 1237 | v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", |
1238 | input, output); | ||
1239 | |||
1244 | /* saa7111/3 does not have these inputs */ | 1240 | /* saa7111/3 does not have these inputs */ |
1245 | if ((state->ident == V4L2_IDENT_SAA7113 || | 1241 | if ((state->ident == V4L2_IDENT_SAA7113 || |
1246 | state->ident == V4L2_IDENT_SAA7111) && | 1242 | state->ident == V4L2_IDENT_SAA7111) && |
1247 | (route->input == SAA7115_COMPOSITE4 || | 1243 | (input == SAA7115_COMPOSITE4 || |
1248 | route->input == SAA7115_COMPOSITE5)) { | 1244 | input == SAA7115_COMPOSITE5)) { |
1249 | return -EINVAL; | 1245 | return -EINVAL; |
1250 | } | 1246 | } |
1251 | if (route->input > SAA7115_SVIDEO3) | 1247 | if (input > SAA7115_SVIDEO3) |
1252 | return -EINVAL; | 1248 | return -EINVAL; |
1253 | if (route->output > SAA7115_IPORT_ON) | 1249 | if (output > SAA7115_IPORT_ON) |
1254 | return -EINVAL; | 1250 | return -EINVAL; |
1255 | if (state->input == route->input && state->output == route->output) | 1251 | if (state->input == input && state->output == output) |
1256 | return 0; | 1252 | return 0; |
1257 | v4l2_dbg(1, debug, sd, "now setting %s input %s output\n", | 1253 | v4l2_dbg(1, debug, sd, "now setting %s input %s output\n", |
1258 | (route->input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", | 1254 | (input >= SAA7115_SVIDEO0) ? "S-Video" : "Composite", |
1259 | (route->output == SAA7115_IPORT_ON) ? "iport on" : "iport off"); | 1255 | (output == SAA7115_IPORT_ON) ? "iport on" : "iport off"); |
1260 | state->input = route->input; | 1256 | state->input = input; |
1261 | 1257 | ||
1262 | /* saa7111 has slightly different input numbering */ | 1258 | /* saa7111 has slightly different input numbering */ |
1263 | if (state->ident == V4L2_IDENT_SAA7111) { | 1259 | if (state->ident == V4L2_IDENT_SAA7111) { |
@@ -1266,10 +1262,10 @@ static int saa711x_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing * | |||
1266 | /* saa7111 specific */ | 1262 | /* saa7111 specific */ |
1267 | saa711x_write(sd, R_10_CHROMA_CNTL_2, | 1263 | saa711x_write(sd, R_10_CHROMA_CNTL_2, |
1268 | (saa711x_read(sd, R_10_CHROMA_CNTL_2) & 0x3f) | | 1264 | (saa711x_read(sd, R_10_CHROMA_CNTL_2) & 0x3f) | |
1269 | ((route->output & 0xc0) ^ 0x40)); | 1265 | ((output & 0xc0) ^ 0x40)); |
1270 | saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL, | 1266 | saa711x_write(sd, R_13_RT_X_PORT_OUT_CNTL, |
1271 | (saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL) & 0xf0) | | 1267 | (saa711x_read(sd, R_13_RT_X_PORT_OUT_CNTL) & 0xf0) | |
1272 | ((route->output & 2) ? 0x0a : 0)); | 1268 | ((output & 2) ? 0x0a : 0)); |
1273 | } | 1269 | } |
1274 | 1270 | ||
1275 | /* select mode */ | 1271 | /* select mode */ |
@@ -1282,7 +1278,7 @@ static int saa711x_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing * | |||
1282 | (saa711x_read(sd, R_09_LUMA_CNTL) & 0x7f) | | 1278 | (saa711x_read(sd, R_09_LUMA_CNTL) & 0x7f) | |
1283 | (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); | 1279 | (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); |
1284 | 1280 | ||
1285 | state->output = route->output; | 1281 | state->output = output; |
1286 | if (state->ident == V4L2_IDENT_SAA7114 || | 1282 | if (state->ident == V4L2_IDENT_SAA7114 || |
1287 | state->ident == V4L2_IDENT_SAA7115) { | 1283 | state->ident == V4L2_IDENT_SAA7115) { |
1288 | saa711x_write(sd, R_83_X_PORT_I_O_ENA_AND_OUT_CLK, | 1284 | saa711x_write(sd, R_83_X_PORT_I_O_ENA_AND_OUT_CLK, |
@@ -1319,17 +1315,16 @@ static int saa711x_s_stream(struct v4l2_subdev *sd, int enable) | |||
1319 | return 0; | 1315 | return 0; |
1320 | } | 1316 | } |
1321 | 1317 | ||
1322 | static int saa711x_s_crystal_freq(struct v4l2_subdev *sd, struct v4l2_crystal_freq *freq) | 1318 | static int saa711x_s_crystal_freq(struct v4l2_subdev *sd, u32 freq, u32 flags) |
1323 | { | 1319 | { |
1324 | struct saa711x_state *state = to_state(sd); | 1320 | struct saa711x_state *state = to_state(sd); |
1325 | 1321 | ||
1326 | if (freq->freq != SAA7115_FREQ_32_11_MHZ && | 1322 | if (freq != SAA7115_FREQ_32_11_MHZ && freq != SAA7115_FREQ_24_576_MHZ) |
1327 | freq->freq != SAA7115_FREQ_24_576_MHZ) | ||
1328 | return -EINVAL; | 1323 | return -EINVAL; |
1329 | state->crystal_freq = freq->freq; | 1324 | state->crystal_freq = freq; |
1330 | state->cgcdiv = (freq->flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4; | 1325 | state->cgcdiv = (flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4; |
1331 | state->ucgc = (freq->flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0; | 1326 | state->ucgc = (flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0; |
1332 | state->apll = (freq->flags & SAA7115_FREQ_FL_APLL) ? 1 : 0; | 1327 | state->apll = (flags & SAA7115_FREQ_FL_APLL) ? 1 : 0; |
1333 | saa711x_s_clock_freq(sd, state->audclk_freq); | 1328 | saa711x_s_clock_freq(sd, state->audclk_freq); |
1334 | return 0; | 1329 | return 0; |
1335 | } | 1330 | } |
@@ -1498,11 +1493,6 @@ static int saa711x_log_status(struct v4l2_subdev *sd) | |||
1498 | return 0; | 1493 | return 0; |
1499 | } | 1494 | } |
1500 | 1495 | ||
1501 | static int saa711x_command(struct i2c_client *client, unsigned cmd, void *arg) | ||
1502 | { | ||
1503 | return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg); | ||
1504 | } | ||
1505 | |||
1506 | /* ----------------------------------------------------------------------- */ | 1496 | /* ----------------------------------------------------------------------- */ |
1507 | 1497 | ||
1508 | static const struct v4l2_subdev_core_ops saa711x_core_ops = { | 1498 | static const struct v4l2_subdev_core_ops saa711x_core_ops = { |
@@ -1511,6 +1501,7 @@ static const struct v4l2_subdev_core_ops saa711x_core_ops = { | |||
1511 | .g_ctrl = saa711x_g_ctrl, | 1501 | .g_ctrl = saa711x_g_ctrl, |
1512 | .s_ctrl = saa711x_s_ctrl, | 1502 | .s_ctrl = saa711x_s_ctrl, |
1513 | .queryctrl = saa711x_queryctrl, | 1503 | .queryctrl = saa711x_queryctrl, |
1504 | .s_std = saa711x_s_std, | ||
1514 | .reset = saa711x_reset, | 1505 | .reset = saa711x_reset, |
1515 | .s_gpio = saa711x_s_gpio, | 1506 | .s_gpio = saa711x_s_gpio, |
1516 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1507 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
@@ -1520,7 +1511,6 @@ static const struct v4l2_subdev_core_ops saa711x_core_ops = { | |||
1520 | }; | 1511 | }; |
1521 | 1512 | ||
1522 | static const struct v4l2_subdev_tuner_ops saa711x_tuner_ops = { | 1513 | static const struct v4l2_subdev_tuner_ops saa711x_tuner_ops = { |
1523 | .s_std = saa711x_s_std, | ||
1524 | .s_radio = saa711x_s_radio, | 1514 | .s_radio = saa711x_s_radio, |
1525 | .g_tuner = saa711x_g_tuner, | 1515 | .g_tuner = saa711x_g_tuner, |
1526 | }; | 1516 | }; |
@@ -1676,10 +1666,7 @@ MODULE_DEVICE_TABLE(i2c, saa7115_id); | |||
1676 | 1666 | ||
1677 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | 1667 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { |
1678 | .name = "saa7115", | 1668 | .name = "saa7115", |
1679 | .driverid = I2C_DRIVERID_SAA711X, | ||
1680 | .command = saa711x_command, | ||
1681 | .probe = saa711x_probe, | 1669 | .probe = saa711x_probe, |
1682 | .remove = saa711x_remove, | 1670 | .remove = saa711x_remove, |
1683 | .legacy_class = I2C_CLASS_TV_ANALOG | I2C_CLASS_TV_DIGITAL, | ||
1684 | .id_table = saa7115_id, | 1671 | .id_table = saa7115_id, |
1685 | }; | 1672 | }; |