diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2015-11-30 10:09:50 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-12-18 13:31:24 -0200 |
commit | cdf472d32a5a1a99c54c3df5c155785db2e529c3 (patch) | |
tree | ae8f8f597b9675b71ad9c1fc621b51d51dd77389 /drivers/media/i2c/cx25840/cx25840-vbi.c | |
parent | 80954cbbe431bcc43af6d8c8d39a83fa016dffdf (diff) |
[media] cx25840: fix VBI support for cx23888
The cx23888 has the VBI registers at different addresses compared to
the other variants. In most cases it is a fixed offset, but not always.
Update the code so the right registers are written for the cx23888.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c/cx25840/cx25840-vbi.c')
-rw-r--r-- | drivers/media/i2c/cx25840/cx25840-vbi.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/drivers/media/i2c/cx25840/cx25840-vbi.c b/drivers/media/i2c/cx25840/cx25840-vbi.c index 04034c592603..0470bb6128e1 100644 --- a/drivers/media/i2c/cx25840/cx25840-vbi.c +++ b/drivers/media/i2c/cx25840/cx25840-vbi.c @@ -104,7 +104,8 @@ int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format * if (is_pal) { for (i = 7; i <= 23; i++) { - u8 v = cx25840_read(client, 0x424 + i - 7); + u8 v = cx25840_read(client, + state->vbi_regs_offset + 0x424 + i - 7); svbi->service_lines[0][i] = lcr2vbi[v >> 4]; svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; @@ -113,7 +114,8 @@ int cx25840_g_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format * } } else { for (i = 10; i <= 21; i++) { - u8 v = cx25840_read(client, 0x424 + i - 10); + u8 v = cx25840_read(client, + state->vbi_regs_offset + 0x424 + i - 10); svbi->service_lines[0][i] = lcr2vbi[v >> 4]; svbi->service_lines[1][i] = lcr2vbi[v & 0xf]; @@ -135,7 +137,10 @@ int cx25840_s_raw_fmt(struct v4l2_subdev *sd, struct v4l2_vbi_format *fmt) cx25840_std_setup(client); /* VBI Offset */ - cx25840_write(client, 0x47f, vbi_offset); + if (is_cx23888(state)) + cx25840_write(client, 0x54f, vbi_offset); + else + cx25840_write(client, 0x47f, vbi_offset); cx25840_write(client, 0x404, 0x2e); return 0; } @@ -158,7 +163,10 @@ int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format * /* Sliced VBI */ cx25840_write(client, 0x404, 0x32); /* Ancillary data */ cx25840_write(client, 0x406, 0x13); - cx25840_write(client, 0x47f, vbi_offset); + if (is_cx23888(state)) + cx25840_write(client, 0x54f, vbi_offset); + else + cx25840_write(client, 0x47f, vbi_offset); if (is_pal) { for (i = 0; i <= 6; i++) @@ -194,17 +202,23 @@ int cx25840_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_format * } if (is_pal) { - for (x = 1, i = 0x424; i <= 0x434; i++, x++) + for (x = 1, i = state->vbi_regs_offset + 0x424; + i <= state->vbi_regs_offset + 0x434; i++, x++) cx25840_write(client, i, lcr[6 + x]); } else { - for (x = 1, i = 0x424; i <= 0x430; i++, x++) + for (x = 1, i = state->vbi_regs_offset + 0x424; + i <= state->vbi_regs_offset + 0x430; i++, x++) cx25840_write(client, i, lcr[9 + x]); - for (i = 0x431; i <= 0x434; i++) + for (i = state->vbi_regs_offset + 0x431; + i <= state->vbi_regs_offset + 0x434; i++) cx25840_write(client, i, 0); } - cx25840_write(client, 0x43c, 0x16); - cx25840_write(client, 0x474, is_pal ? 0x2a : 0x22); + cx25840_write(client, state->vbi_regs_offset + 0x43c, 0x16); + if (is_cx23888(state)) + cx25840_write(client, 0x428, is_pal ? 0x2a : 0x22); + else + cx25840_write(client, 0x474, is_pal ? 0x2a : 0x22); return 0; } |