* [PATCH 1/2] media: saa7115: allow input standard autodetection for SAA7113
@ 2010-12-13 18:19 Anatolij Gustschin
2010-12-13 18:19 ` [PATCH 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
2010-12-22 16:50 ` [1/2] media: saa7115: allow input standard autodetection for SAA7113 Mauro Carvalho Chehab
0 siblings, 2 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2010-12-13 18:19 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Detlev Zundel
Autodetect input's standard using field frequency detection
feature (FIDT in status byte at 0x1F) of the SAA7113.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/media/video/saa7115.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 301c62b..f28a4c7 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1348,6 +1348,18 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
int reg1e;
*std = V4L2_STD_ALL;
+
+ if (state->ident == V4L2_IDENT_SAA7113) {
+ int reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC);
+
+ if (reg1f & 0x20)
+ *std = V4L2_STD_NTSC;
+ else
+ *std = V4L2_STD_PAL;
+
+ return 0;
+ }
+
if (state->ident != V4L2_IDENT_SAA7115)
return 0;
reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC);
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support
2010-12-13 18:19 [PATCH 1/2] media: saa7115: allow input standard autodetection for SAA7113 Anatolij Gustschin
@ 2010-12-13 18:19 ` Anatolij Gustschin
2010-12-22 17:03 ` [2/2] " Mauro Carvalho Chehab
2010-12-22 16:50 ` [1/2] media: saa7115: allow input standard autodetection for SAA7113 Mauro Carvalho Chehab
1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2010-12-13 18:19 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Detlev Zundel
VIDIOC_QUERYSTD and VIDIOC_G_STD ioctls are currently not
supported in the FSL VIU driver. The decoder subdevice
driver saa7115 extended by previous patch supports QUERYSTD
for saa7113, so we add the appropriate ioctls to the VIU
driver to be able to determine the video input's standard.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
drivers/media/video/fsl-viu.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c
index b8faff2..04be6eb 100644
--- a/drivers/media/video/fsl-viu.c
+++ b/drivers/media/video/fsl-viu.c
@@ -194,6 +194,8 @@ struct viu_dev {
/* decoder */
struct v4l2_subdev *decoder;
+
+ v4l2_std_id std;
};
struct viu_fh {
@@ -933,14 +935,31 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
#define decoder_call(viu, o, f, args...) \
v4l2_subdev_call(viu->decoder, o, f, ##args)
+static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
+{
+ struct viu_fh *fh = priv;
+
+ decoder_call(fh->dev, video, querystd, std_id);
+ return 0;
+}
+
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *id)
{
struct viu_fh *fh = priv;
+ fh->dev->std = *id;
decoder_call(fh->dev, core, s_std, *id);
return 0;
}
+static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *std_id)
+{
+ struct viu_fh *fh = priv;
+
+ *std_id = fh->dev->std;
+ return 0;
+}
+
/* only one input in this driver */
static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *inp)
@@ -1397,7 +1416,9 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = {
.vidioc_querybuf = vidioc_querybuf,
.vidioc_qbuf = vidioc_qbuf,
.vidioc_dqbuf = vidioc_dqbuf,
+ .vidioc_g_std = vidioc_g_std,
.vidioc_s_std = vidioc_s_std,
+ .vidioc_querystd = vidioc_querystd,
.vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input,
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [1/2] media: saa7115: allow input standard autodetection for SAA7113
2010-12-13 18:19 [PATCH 1/2] media: saa7115: allow input standard autodetection for SAA7113 Anatolij Gustschin
2010-12-13 18:19 ` [PATCH 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
@ 2010-12-22 16:50 ` Mauro Carvalho Chehab
2010-12-22 20:31 ` [PATCH v2 1/2] media: saa7115: allow input standard autodetection for more chips Anatolij Gustschin
2010-12-22 20:31 ` [PATCH v2 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
1 sibling, 2 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-12-22 16:50 UTC (permalink / raw)
To: Anatolij Gustschin; +Cc: linux-media, Hans Verkuil, Detlev Zundel
Em 13-12-2010 16:19, Anatolij Gustschin escreveu:
> Autodetect input's standard using field frequency detection
> feature (FIDT in status byte at 0x1F) of the SAA7113.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
>
> ---
> drivers/media/video/saa7115.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
> index 301c62b..f28a4c7 100644
> --- a/drivers/media/video/saa7115.c
> +++ b/drivers/media/video/saa7115.c
> @@ -1348,6 +1348,18 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
> int reg1e;
>
> *std = V4L2_STD_ALL;
> +
> + if (state->ident == V4L2_IDENT_SAA7113) {
> + int reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC);
> +
> + if (reg1f & 0x20)
> + *std = V4L2_STD_NTSC;
> + else
> + *std = V4L2_STD_PAL;
This is wrong. The meaning of bit 5 of reg 0x1f is if the standard is 50Hz
or 60Hz based (so, it detects the monocromatic standard, not the color
standard). So, instead, it should be doing:
if (reg1f & 0x20)
*std = V4L2_STD_525_60;
else
*std = V4L2_STD_625_50;
Also, this kind of detection could be used also for the other supported chips
on this driver (I checked datasheets of saa7111/saa7111a/saa7114/saa7118).
So, the better is to code it as:
if (state->ident != V4L2_IDENT_SAA7115) {
int reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC);
if (reg1f & 0x20)
*std = V4L2_STD_525_60;
else
*std = V4L2_STD_625_50;
return 0;
}
> +
> + return 0;
> + }
> +
> if (state->ident != V4L2_IDENT_SAA7115)
> return 0;
> reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC);
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support
2010-12-13 18:19 ` [PATCH 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
@ 2010-12-22 17:03 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2010-12-22 17:03 UTC (permalink / raw)
To: Anatolij Gustschin; +Cc: linux-media, Hans Verkuil, Detlev Zundel
Em 13-12-2010 16:19, Anatolij Gustschin escreveu:
> VIDIOC_QUERYSTD and VIDIOC_G_STD ioctls are currently not
> supported in the FSL VIU driver. The decoder subdevice
> driver saa7115 extended by previous patch supports QUERYSTD
> for saa7113, so we add the appropriate ioctls to the VIU
> driver to be able to determine the video input's standard.
This patch looks ok, but as it is somewhat dependent on the
saa7113 patch, please re-send it together with the other patch
for me to pull both together.
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
>
> ---
> drivers/media/video/fsl-viu.c | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c
> index b8faff2..04be6eb 100644
> --- a/drivers/media/video/fsl-viu.c
> +++ b/drivers/media/video/fsl-viu.c
> @@ -194,6 +194,8 @@ struct viu_dev {
>
> /* decoder */
> struct v4l2_subdev *decoder;
> +
> + v4l2_std_id std;
> };
>
> struct viu_fh {
> @@ -933,14 +935,31 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
> #define decoder_call(viu, o, f, args...) \
> v4l2_subdev_call(viu->decoder, o, f, ##args)
>
> +static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
> +{
> + struct viu_fh *fh = priv;
> +
> + decoder_call(fh->dev, video, querystd, std_id);
> + return 0;
> +}
> +
> static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *id)
> {
> struct viu_fh *fh = priv;
>
> + fh->dev->std = *id;
> decoder_call(fh->dev, core, s_std, *id);
> return 0;
> }
>
> +static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *std_id)
> +{
> + struct viu_fh *fh = priv;
> +
> + *std_id = fh->dev->std;
> + return 0;
> +}
> +
> /* only one input in this driver */
> static int vidioc_enum_input(struct file *file, void *priv,
> struct v4l2_input *inp)
> @@ -1397,7 +1416,9 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = {
> .vidioc_querybuf = vidioc_querybuf,
> .vidioc_qbuf = vidioc_qbuf,
> .vidioc_dqbuf = vidioc_dqbuf,
> + .vidioc_g_std = vidioc_g_std,
> .vidioc_s_std = vidioc_s_std,
> + .vidioc_querystd = vidioc_querystd,
> .vidioc_enum_input = vidioc_enum_input,
> .vidioc_g_input = vidioc_g_input,
> .vidioc_s_input = vidioc_s_input,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 1/2] media: saa7115: allow input standard autodetection for more chips
2010-12-22 16:50 ` [1/2] media: saa7115: allow input standard autodetection for SAA7113 Mauro Carvalho Chehab
@ 2010-12-22 20:31 ` Anatolij Gustschin
2010-12-22 20:31 ` [PATCH v2 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
1 sibling, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2010-12-22 20:31 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Detlev Zundel
Autodetect input's standard using field frequency detection
feature (FIDT in status byte at 0x1F) of the chips saa7111/
saa7111a/saa7113/saa7114/saa7118.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes since first patch version:
- reworked for chips other than saa7115
- fixed to return V4L2_STD_525_60 / V4L2_STD_625_50
instead of V4L2_STD_NTSC / V4L2_STD_PAL
- adapted the commit message
drivers/media/video/saa7115.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index 301c62b..f35459d 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1348,8 +1348,17 @@ static int saa711x_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
int reg1e;
*std = V4L2_STD_ALL;
- if (state->ident != V4L2_IDENT_SAA7115)
+ if (state->ident != V4L2_IDENT_SAA7115) {
+ int reg1f = saa711x_read(sd, R_1F_STATUS_BYTE_2_VD_DEC);
+
+ if (reg1f & 0x20)
+ *std = V4L2_STD_525_60;
+ else
+ *std = V4L2_STD_625_50;
+
return 0;
+ }
+
reg1e = saa711x_read(sd, R_1E_STATUS_BYTE_1_VD_DEC);
switch (reg1e & 0x03) {
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support
2010-12-22 16:50 ` [1/2] media: saa7115: allow input standard autodetection for SAA7113 Mauro Carvalho Chehab
2010-12-22 20:31 ` [PATCH v2 1/2] media: saa7115: allow input standard autodetection for more chips Anatolij Gustschin
@ 2010-12-22 20:31 ` Anatolij Gustschin
1 sibling, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2010-12-22 20:31 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab, Hans Verkuil, Detlev Zundel
VIDIOC_QUERYSTD and VIDIOC_G_STD ioctls are currently not
supported in the FSL VIU driver. The decoder subdevice
driver saa7115 extended by previous patch supports QUERYSTD
for saa711x, so we add the appropriate ioctls to the VIU
driver to be able to determine the video input's standard.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes since first patch version:
- fixed the commit message and rebased
drivers/media/video/fsl-viu.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c
index 693e9c0..e4bba88 100644
--- a/drivers/media/video/fsl-viu.c
+++ b/drivers/media/video/fsl-viu.c
@@ -194,6 +194,8 @@ struct viu_dev {
/* decoder */
struct v4l2_subdev *decoder;
+
+ v4l2_std_id std;
};
struct viu_fh {
@@ -937,14 +939,31 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
#define decoder_call(viu, o, f, args...) \
v4l2_subdev_call(viu->decoder, o, f, ##args)
+static int vidioc_querystd(struct file *file, void *priv, v4l2_std_id *std_id)
+{
+ struct viu_fh *fh = priv;
+
+ decoder_call(fh->dev, video, querystd, std_id);
+ return 0;
+}
+
static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *id)
{
struct viu_fh *fh = priv;
+ fh->dev->std = *id;
decoder_call(fh->dev, core, s_std, *id);
return 0;
}
+static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *std_id)
+{
+ struct viu_fh *fh = priv;
+
+ *std_id = fh->dev->std;
+ return 0;
+}
+
/* only one input in this driver */
static int vidioc_enum_input(struct file *file, void *priv,
struct v4l2_input *inp)
@@ -1402,7 +1421,9 @@ static const struct v4l2_ioctl_ops viu_ioctl_ops = {
.vidioc_querybuf = vidioc_querybuf,
.vidioc_qbuf = vidioc_qbuf,
.vidioc_dqbuf = vidioc_dqbuf,
+ .vidioc_g_std = vidioc_g_std,
.vidioc_s_std = vidioc_s_std,
+ .vidioc_querystd = vidioc_querystd,
.vidioc_enum_input = vidioc_enum_input,
.vidioc_g_input = vidioc_g_input,
.vidioc_s_input = vidioc_s_input,
--
1.7.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-12-22 20:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-13 18:19 [PATCH 1/2] media: saa7115: allow input standard autodetection for SAA7113 Anatolij Gustschin
2010-12-13 18:19 ` [PATCH 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
2010-12-22 17:03 ` [2/2] " Mauro Carvalho Chehab
2010-12-22 16:50 ` [1/2] media: saa7115: allow input standard autodetection for SAA7113 Mauro Carvalho Chehab
2010-12-22 20:31 ` [PATCH v2 1/2] media: saa7115: allow input standard autodetection for more chips Anatolij Gustschin
2010-12-22 20:31 ` [PATCH v2 2/2] media: fsl_viu: add VIDIOC_QUERYSTD and VIDIOC_G_STD support Anatolij Gustschin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.