diff options
Diffstat (limited to 'drivers/media/video/saa7115.c')
-rw-r--r-- | drivers/media/video/saa7115.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index 44873a016c2c..c0a7f8a369f4 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -104,6 +104,10 @@ static int saa711x_has_reg(const int id, const u8 reg) | |||
104 | if (id == V4L2_IDENT_SAA7111) | 104 | if (id == V4L2_IDENT_SAA7111) |
105 | return reg < 0x20 && reg != 0x01 && reg != 0x0f && | 105 | return reg < 0x20 && reg != 0x01 && reg != 0x0f && |
106 | (reg < 0x13 || reg > 0x19) && reg != 0x1d && reg != 0x1e; | 106 | (reg < 0x13 || reg > 0x19) && reg != 0x1d && reg != 0x1e; |
107 | if (id == V4L2_IDENT_SAA7111A) | ||
108 | return reg < 0x20 && reg != 0x01 && reg != 0x0f && | ||
109 | reg != 0x14 && reg != 0x18 && reg != 0x19 && | ||
110 | reg != 0x1d && reg != 0x1e; | ||
107 | 111 | ||
108 | /* common for saa7113/4/5/8 */ | 112 | /* common for saa7113/4/5/8 */ |
109 | if (unlikely((reg >= 0x3b && reg <= 0x3f) || reg == 0x5c || reg == 0x5f || | 113 | if (unlikely((reg >= 0x3b && reg <= 0x3f) || reg == 0x5c || reg == 0x5f || |
@@ -954,8 +958,7 @@ static void saa711x_set_v4lstd(struct v4l2_subdev *sd, v4l2_std_id std) | |||
954 | 011 NTSC N (3.58MHz) PAL M (3.58MHz) | 958 | 011 NTSC N (3.58MHz) PAL M (3.58MHz) |
955 | 100 reserved NTSC-Japan (3.58MHz) | 959 | 100 reserved NTSC-Japan (3.58MHz) |
956 | */ | 960 | */ |
957 | if (state->ident == V4L2_IDENT_SAA7111 || | 961 | if (state->ident <= V4L2_IDENT_SAA7113) { |
958 | state->ident == V4L2_IDENT_SAA7113) { | ||
959 | u8 reg = saa711x_read(sd, R_0E_CHROMA_CNTL_1) & 0x8f; | 962 | u8 reg = saa711x_read(sd, R_0E_CHROMA_CNTL_1) & 0x8f; |
960 | 963 | ||
961 | if (std == V4L2_STD_PAL_M) { | 964 | if (std == V4L2_STD_PAL_M) { |
@@ -1232,22 +1235,19 @@ static int saa711x_s_routing(struct v4l2_subdev *sd, | |||
1232 | u32 input, u32 output, u32 config) | 1235 | u32 input, u32 output, u32 config) |
1233 | { | 1236 | { |
1234 | struct saa711x_state *state = to_state(sd); | 1237 | struct saa711x_state *state = to_state(sd); |
1235 | u8 mask = (state->ident == V4L2_IDENT_SAA7111) ? 0xf8 : 0xf0; | 1238 | u8 mask = (state->ident <= V4L2_IDENT_SAA7111A) ? 0xf8 : 0xf0; |
1236 | 1239 | ||
1237 | v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", | 1240 | v4l2_dbg(1, debug, sd, "decoder set input %d output %d\n", |
1238 | input, output); | 1241 | input, output); |
1239 | 1242 | ||
1240 | /* saa7111/3 does not have these inputs */ | 1243 | /* saa7111/3 does not have these inputs */ |
1241 | if ((state->ident == V4L2_IDENT_SAA7113 || | 1244 | if (state->ident <= V4L2_IDENT_SAA7113 && |
1242 | state->ident == V4L2_IDENT_SAA7111) && | ||
1243 | (input == SAA7115_COMPOSITE4 || | 1245 | (input == SAA7115_COMPOSITE4 || |
1244 | input == SAA7115_COMPOSITE5)) { | 1246 | input == SAA7115_COMPOSITE5)) { |
1245 | return -EINVAL; | 1247 | return -EINVAL; |
1246 | } | 1248 | } |
1247 | if (input > SAA7115_SVIDEO3) | 1249 | if (input > SAA7115_SVIDEO3) |
1248 | return -EINVAL; | 1250 | return -EINVAL; |
1249 | if (output > SAA7115_IPORT_ON) | ||
1250 | return -EINVAL; | ||
1251 | if (state->input == input && state->output == output) | 1251 | if (state->input == input && state->output == output) |
1252 | return 0; | 1252 | return 0; |
1253 | 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", |
@@ -1256,7 +1256,7 @@ static int saa711x_s_routing(struct v4l2_subdev *sd, | |||
1256 | state->input = input; | 1256 | state->input = input; |
1257 | 1257 | ||
1258 | /* saa7111 has slightly different input numbering */ | 1258 | /* saa7111 has slightly different input numbering */ |
1259 | if (state->ident == V4L2_IDENT_SAA7111) { | 1259 | if (state->ident <= V4L2_IDENT_SAA7111A) { |
1260 | if (input >= SAA7115_COMPOSITE4) | 1260 | if (input >= SAA7115_COMPOSITE4) |
1261 | input -= 2; | 1261 | input -= 2; |
1262 | /* saa7111 specific */ | 1262 | /* saa7111 specific */ |
@@ -1292,7 +1292,7 @@ static int saa711x_s_gpio(struct v4l2_subdev *sd, u32 val) | |||
1292 | { | 1292 | { |
1293 | struct saa711x_state *state = to_state(sd); | 1293 | struct saa711x_state *state = to_state(sd); |
1294 | 1294 | ||
1295 | if (state->ident != V4L2_IDENT_SAA7111) | 1295 | if (state->ident > V4L2_IDENT_SAA7111A) |
1296 | return -EINVAL; | 1296 | return -EINVAL; |
1297 | saa711x_write(sd, 0x11, (saa711x_read(sd, 0x11) & 0x7f) | | 1297 | saa711x_write(sd, 0x11, (saa711x_read(sd, 0x11) & 0x7f) | |
1298 | (val ? 0x80 : 0)); | 1298 | (val ? 0x80 : 0)); |
@@ -1596,6 +1596,10 @@ static int saa711x_probe(struct i2c_client *client, | |||
1596 | switch (chip_id) { | 1596 | switch (chip_id) { |
1597 | case '1': | 1597 | case '1': |
1598 | state->ident = V4L2_IDENT_SAA7111; | 1598 | state->ident = V4L2_IDENT_SAA7111; |
1599 | if (saa711x_read(sd, R_00_CHIP_VERSION) & 0xf0) { | ||
1600 | v4l_info(client, "saa7111a variant found\n"); | ||
1601 | state->ident = V4L2_IDENT_SAA7111A; | ||
1602 | } | ||
1599 | break; | 1603 | break; |
1600 | case '3': | 1604 | case '3': |
1601 | state->ident = V4L2_IDENT_SAA7113; | 1605 | state->ident = V4L2_IDENT_SAA7113; |
@@ -1612,7 +1616,7 @@ static int saa711x_probe(struct i2c_client *client, | |||
1612 | default: | 1616 | default: |
1613 | state->ident = V4L2_IDENT_SAA7111; | 1617 | state->ident = V4L2_IDENT_SAA7111; |
1614 | v4l2_info(sd, "WARNING: Chip is not known - Falling back to saa7111\n"); | 1618 | v4l2_info(sd, "WARNING: Chip is not known - Falling back to saa7111\n"); |
1615 | 1619 | break; | |
1616 | } | 1620 | } |
1617 | 1621 | ||
1618 | state->audclk_freq = 48000; | 1622 | state->audclk_freq = 48000; |
@@ -1623,6 +1627,7 @@ static int saa711x_probe(struct i2c_client *client, | |||
1623 | state->crystal_freq = SAA7115_FREQ_24_576_MHZ; | 1627 | state->crystal_freq = SAA7115_FREQ_24_576_MHZ; |
1624 | switch (state->ident) { | 1628 | switch (state->ident) { |
1625 | case V4L2_IDENT_SAA7111: | 1629 | case V4L2_IDENT_SAA7111: |
1630 | case V4L2_IDENT_SAA7111A: | ||
1626 | saa711x_writeregs(sd, saa7111_init); | 1631 | saa711x_writeregs(sd, saa7111_init); |
1627 | break; | 1632 | break; |
1628 | case V4L2_IDENT_SAA7113: | 1633 | case V4L2_IDENT_SAA7113: |
@@ -1632,7 +1637,7 @@ static int saa711x_probe(struct i2c_client *client, | |||
1632 | state->crystal_freq = SAA7115_FREQ_32_11_MHZ; | 1637 | state->crystal_freq = SAA7115_FREQ_32_11_MHZ; |
1633 | saa711x_writeregs(sd, saa7115_init_auto_input); | 1638 | saa711x_writeregs(sd, saa7115_init_auto_input); |
1634 | } | 1639 | } |
1635 | if (state->ident != V4L2_IDENT_SAA7111) | 1640 | if (state->ident > V4L2_IDENT_SAA7111A) |
1636 | saa711x_writeregs(sd, saa7115_init_misc); | 1641 | saa711x_writeregs(sd, saa7115_init_misc); |
1637 | saa711x_set_v4lstd(sd, V4L2_STD_NTSC); | 1642 | saa711x_set_v4lstd(sd, V4L2_STD_NTSC); |
1638 | 1643 | ||