aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2012-01-04 19:16:15 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-05 03:57:32 -0500
commit51ada787b89828314f09cb6b2f401c209db88917 (patch)
tree3117d6cfaabf0c4be9030bdc6ef23583f9e4fdb0 /drivers/media/video/cx25840
parent74900b4715bb2092bf0c88dc673008935b8151d2 (diff)
[media] cx25840: Added g_std support to the video decoder driver
Making the detected video standard available to the core driver and for user query. Signed-off-by: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 41d2ee4e37db..4f43f4a7e72d 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1705,6 +1705,41 @@ static int cx25840_s_stream(struct v4l2_subdev *sd, int enable)
1705 return 0; 1705 return 0;
1706} 1706}
1707 1707
1708/* Query the current detected video format */
1709static int cx25840_g_std(struct v4l2_subdev *sd, v4l2_std_id *std)
1710{
1711 struct i2c_client *client = v4l2_get_subdevdata(sd);
1712
1713 v4l2_std_id stds[] = {
1714 /* 0000 */ V4L2_STD_UNKNOWN,
1715
1716 /* 0001 */ V4L2_STD_NTSC_M,
1717 /* 0010 */ V4L2_STD_NTSC_M_JP,
1718 /* 0011 */ V4L2_STD_NTSC_443,
1719 /* 0100 */ V4L2_STD_PAL,
1720 /* 0101 */ V4L2_STD_PAL_M,
1721 /* 0110 */ V4L2_STD_PAL_N,
1722 /* 0111 */ V4L2_STD_PAL_Nc,
1723 /* 1000 */ V4L2_STD_PAL_60,
1724
1725 /* 1001 */ V4L2_STD_UNKNOWN,
1726 /* 1010 */ V4L2_STD_UNKNOWN,
1727 /* 1001 */ V4L2_STD_UNKNOWN,
1728 /* 1010 */ V4L2_STD_UNKNOWN,
1729 /* 1011 */ V4L2_STD_UNKNOWN,
1730 /* 1110 */ V4L2_STD_UNKNOWN,
1731 /* 1111 */ V4L2_STD_UNKNOWN
1732 };
1733
1734 u32 fmt = (cx25840_read4(client, 0x40c) >> 8) & 0xf;
1735 *std = stds[ fmt ];
1736
1737 v4l_dbg(1, cx25840_debug, client, "g_std fmt = %x, v4l2_std_id = 0x%x\n",
1738 fmt, (unsigned int)stds[ fmt ]);
1739
1740 return 0;
1741}
1742
1708static int cx25840_s_std(struct v4l2_subdev *sd, v4l2_std_id std) 1743static int cx25840_s_std(struct v4l2_subdev *sd, v4l2_std_id std)
1709{ 1744{
1710 struct cx25840_state *state = to_state(sd); 1745 struct cx25840_state *state = to_state(sd);
@@ -4973,6 +5008,7 @@ static const struct v4l2_subdev_core_ops cx25840_core_ops = {
4973 .queryctrl = v4l2_subdev_queryctrl, 5008 .queryctrl = v4l2_subdev_queryctrl,
4974 .querymenu = v4l2_subdev_querymenu, 5009 .querymenu = v4l2_subdev_querymenu,
4975 .s_std = cx25840_s_std, 5010 .s_std = cx25840_s_std,
5011 .g_std = cx25840_g_std,
4976 .reset = cx25840_reset, 5012 .reset = cx25840_reset,
4977 .load_fw = cx25840_load_fw, 5013 .load_fw = cx25840_load_fw,
4978 .s_io_pin_config = common_s_io_pin_config, 5014 .s_io_pin_config = common_s_io_pin_config,