diff mbox

[2/3,media] adv7180: Add cropcap operation

Message ID 1459618940-8170-3-git-send-email-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Niklas Söderlund April 2, 2016, 5:42 p.m. UTC
Add support to get the pixel aspect ratio depending on the current
standard (50 vs 60 Hz).

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
 drivers/media/i2c/adv7180.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Hans Verkuil April 3, 2016, 5:50 p.m. UTC | #1
On 04/02/2016 10:42 AM, Niklas Söderlund wrote:
> Add support to get the pixel aspect ratio depending on the current
> standard (50 vs 60 Hz).
>
> Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Acked-by: Hans Verkuil <hans.verkuil@cisco.com>

Thanks!

	Hans

> ---
>   drivers/media/i2c/adv7180.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
>
> diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
> index d680d76..80ded70 100644
> --- a/drivers/media/i2c/adv7180.c
> +++ b/drivers/media/i2c/adv7180.c
> @@ -726,6 +726,21 @@ static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
>   	return 0;
>   }
>
> +static int adv7180_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *cropcap)
> +{
> +	struct adv7180_state *state = to_state(sd);
> +
> +	if (state->curr_norm & V4L2_STD_525_60) {
> +		cropcap->pixelaspect.numerator = 11;
> +		cropcap->pixelaspect.denominator = 10;
> +	} else {
> +		cropcap->pixelaspect.numerator = 54;
> +		cropcap->pixelaspect.denominator = 59;
> +	}
> +
> +	return 0;
> +}
> +
>   static const struct v4l2_subdev_video_ops adv7180_video_ops = {
>   	.s_std = adv7180_s_std,
>   	.g_std = adv7180_g_std,
> @@ -733,6 +748,7 @@ static const struct v4l2_subdev_video_ops adv7180_video_ops = {
>   	.g_input_status = adv7180_g_input_status,
>   	.s_routing = adv7180_s_routing,
>   	.g_mbus_config = adv7180_g_mbus_config,
> +	.cropcap = adv7180_cropcap,
>   };
>
>
>
diff mbox

Patch

diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index d680d76..80ded70 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -726,6 +726,21 @@  static int adv7180_g_mbus_config(struct v4l2_subdev *sd,
 	return 0;
 }
 
+static int adv7180_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *cropcap)
+{
+	struct adv7180_state *state = to_state(sd);
+
+	if (state->curr_norm & V4L2_STD_525_60) {
+		cropcap->pixelaspect.numerator = 11;
+		cropcap->pixelaspect.denominator = 10;
+	} else {
+		cropcap->pixelaspect.numerator = 54;
+		cropcap->pixelaspect.denominator = 59;
+	}
+
+	return 0;
+}
+
 static const struct v4l2_subdev_video_ops adv7180_video_ops = {
 	.s_std = adv7180_s_std,
 	.g_std = adv7180_g_std,
@@ -733,6 +748,7 @@  static const struct v4l2_subdev_video_ops adv7180_video_ops = {
 	.g_input_status = adv7180_g_input_status,
 	.s_routing = adv7180_s_routing,
 	.g_mbus_config = adv7180_g_mbus_config,
+	.cropcap = adv7180_cropcap,
 };