All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make use of media bus pixel codes in adv7175 driver
@ 2011-09-27 19:16 Christian Gmeiner
  2011-09-30 10:28 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Gmeiner @ 2011-09-27 19:16 UTC (permalink / raw)
  To: linux-media

The ADV7175A/ADV7176A can operate in either 8-bit or 16-bit YCrCb mode.

* 8-Bit YCrCb Mode
This default mode accepts multiplexed YCrCb inputs through
the P7-P0 pixel inputs. The inputs follow the sequence Cb0, Y0
Cr0, Y1 Cb1, Y2, etc. The Y, Cb and Cr data are input on a
rising clock edge.

* 16-Bit YCrCb Mode
This mode accepts Y inputs through the P7–P0 pixel inputs and
multiplexed CrCb inputs through the P15–P8 pixel inputs. The
data is loaded on every second rising edge of CLOCK. The inputs
follow the sequence Cb0, Y0 Cr0, Y1 Cb1, Y2, etc.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
---
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
index d2327db..206078e 100644
--- a/drivers/media/video/adv7175.c
+++ b/drivers/media/video/adv7175.c
@@ -61,6 +61,11 @@ static inline struct adv7175 *to_adv7175(struct
v4l2_subdev *sd)

 static char *inputs[] = { "pass_through", "play_back", "color_bar" };

+static enum v4l2_mbus_pixelcode adv7175_codes[] = {
+	V4L2_MBUS_FMT_UYVY8_2X8,
+	V4L2_MBUS_FMT_UYVY8_1X16,
+};
+
 /* ----------------------------------------------------------------------- */

 static inline int adv7175_write(struct v4l2_subdev *sd, u8 reg, u8 value)
@@ -296,6 +301,60 @@ static int adv7175_s_routing(struct v4l2_subdev *sd,
 	return 0;
 }

+static int adv7175_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
+				enum v4l2_mbus_pixelcode *code)
+{
+	if (index >= ARRAY_SIZE(adv7175_codes))
+		return -EINVAL;
+
+	*code = adv7175_codes[index];
+	return 0;
+}
+
+static int adv7175_g_fmt(struct v4l2_subdev *sd,
+				struct v4l2_mbus_framefmt *mf)
+{
+	u8 val = adv7175_read(sd, 0x7);
+
+	if ((val & 0x40) == (1 << 6))
+		mf->code = V4L2_MBUS_FMT_UYVY8_1X16;
+	else
+		mf->code = V4L2_MBUS_FMT_UYVY8_2X8;
+
+	mf->colorspace  = V4L2_COLORSPACE_SMPTE170M;
+	mf->width       = 0;
+	mf->height      = 0;
+	mf->field       = V4L2_FIELD_ANY;
+
+	return 0;
+}
+
+static int adv7175_s_fmt(struct v4l2_subdev *sd,
+				struct v4l2_mbus_framefmt *mf)
+{
+	u8 val = adv7175_read(sd, 0x7);
+	int ret;
+
+	switch (mf->code) {
+	case V4L2_MBUS_FMT_UYVY8_2X8:
+		val &= ~0x40;
+		break;
+
+	case V4L2_MBUS_FMT_UYVY8_1X16:
+		val |= 0x40;
+		break;
+
+	default:
+		v4l2_dbg(1, debug, sd,
+			"illegal v4l2_mbus_framefmt code: %d\n", mf->code);
+		return -EINVAL;
+	}
+
+	ret = adv7175_write(sd, 0x7, val);
+
+	return ret;
+}
+
 static int adv7175_g_chip_ident(struct v4l2_subdev *sd, struct
v4l2_dbg_chip_ident *chip)
 {
 	struct i2c_client *client = v4l2_get_subdevdata(sd);
@@ -324,6 +383,9 @@ static const struct v4l2_subdev_core_ops
adv7175_core_ops = {
 static const struct v4l2_subdev_video_ops adv7175_video_ops = {
 	.s_std_output = adv7175_s_std_output,
 	.s_routing = adv7175_s_routing,
+	.s_mbus_fmt = adv7175_s_fmt,
+	.g_mbus_fmt = adv7175_g_fmt,
+	.enum_mbus_fmt  = adv7175_enum_fmt,
 };

 static const struct v4l2_subdev_ops adv7175_ops = {
--
1.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make use of media bus pixel codes in adv7175 driver
  2011-09-27 19:16 [PATCH] Make use of media bus pixel codes in adv7175 driver Christian Gmeiner
@ 2011-09-30 10:28 ` Mauro Carvalho Chehab
  2011-10-05 19:47   ` Christian Gmeiner
  0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2011-09-30 10:28 UTC (permalink / raw)
  To: Christian Gmeiner; +Cc: linux-media

Em 27-09-2011 16:16, Christian Gmeiner escreveu:
> The ADV7175A/ADV7176A can operate in either 8-bit or 16-bit YCrCb mode.
> 
> * 8-Bit YCrCb Mode
> This default mode accepts multiplexed YCrCb inputs through
> the P7-P0 pixel inputs. The inputs follow the sequence Cb0, Y0
> Cr0, Y1 Cb1, Y2, etc. The Y, Cb and Cr data are input on a
> rising clock edge.
> 
> * 16-Bit YCrCb Mode
> This mode accepts Y inputs through the P7–P0 pixel inputs and
> multiplexed CrCb inputs through the P15–P8 pixel inputs. The
> data is loaded on every second rising edge of CLOCK. The inputs
> follow the sequence Cb0, Y0 Cr0, Y1 Cb1, Y2, etc.
> 
> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
> ---
> diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
> index d2327db..206078e 100644
> --- a/drivers/media/video/adv7175.c
> +++ b/drivers/media/video/adv7175.c
> @@ -61,6 +61,11 @@ static inline struct adv7175 *to_adv7175(struct
> v4l2_subdev *sd)

Patch looks ok, but it got truncated by your emailer [1]... Couldn't apply it
[1] http://patchwork.linuxtv.org/patch/7973/

Care to fix it and re-send?

Thanks!
Mauro

> 
>  static char *inputs[] = { "pass_through", "play_back", "color_bar" };
> 
> +static enum v4l2_mbus_pixelcode adv7175_codes[] = {
> +	V4L2_MBUS_FMT_UYVY8_2X8,
> +	V4L2_MBUS_FMT_UYVY8_1X16,
> +};
> +
>  /* ----------------------------------------------------------------------- */
> 
>  static inline int adv7175_write(struct v4l2_subdev *sd, u8 reg, u8 value)
> @@ -296,6 +301,60 @@ static int adv7175_s_routing(struct v4l2_subdev *sd,
>  	return 0;
>  }
> 
> +static int adv7175_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
> +				enum v4l2_mbus_pixelcode *code)
> +{
> +	if (index >= ARRAY_SIZE(adv7175_codes))
> +		return -EINVAL;
> +
> +	*code = adv7175_codes[index];
> +	return 0;
> +}
> +
> +static int adv7175_g_fmt(struct v4l2_subdev *sd,
> +				struct v4l2_mbus_framefmt *mf)
> +{
> +	u8 val = adv7175_read(sd, 0x7);
> +
> +	if ((val & 0x40) == (1 << 6))
> +		mf->code = V4L2_MBUS_FMT_UYVY8_1X16;
> +	else
> +		mf->code = V4L2_MBUS_FMT_UYVY8_2X8;
> +
> +	mf->colorspace  = V4L2_COLORSPACE_SMPTE170M;
> +	mf->width       = 0;
> +	mf->height      = 0;
> +	mf->field       = V4L2_FIELD_ANY;
> +
> +	return 0;
> +}
> +
> +static int adv7175_s_fmt(struct v4l2_subdev *sd,
> +				struct v4l2_mbus_framefmt *mf)
> +{
> +	u8 val = adv7175_read(sd, 0x7);
> +	int ret;
> +
> +	switch (mf->code) {
> +	case V4L2_MBUS_FMT_UYVY8_2X8:
> +		val &= ~0x40;
> +		break;
> +
> +	case V4L2_MBUS_FMT_UYVY8_1X16:
> +		val |= 0x40;
> +		break;
> +
> +	default:
> +		v4l2_dbg(1, debug, sd,
> +			"illegal v4l2_mbus_framefmt code: %d\n", mf->code);
> +		return -EINVAL;
> +	}
> +
> +	ret = adv7175_write(sd, 0x7, val);
> +
> +	return ret;
> +}
> +
>  static int adv7175_g_chip_ident(struct v4l2_subdev *sd, struct
> v4l2_dbg_chip_ident *chip)
>  {
>  	struct i2c_client *client = v4l2_get_subdevdata(sd);
> @@ -324,6 +383,9 @@ static const struct v4l2_subdev_core_ops
> adv7175_core_ops = {
>  static const struct v4l2_subdev_video_ops adv7175_video_ops = {
>  	.s_std_output = adv7175_s_std_output,
>  	.s_routing = adv7175_s_routing,
> +	.s_mbus_fmt = adv7175_s_fmt,
> +	.g_mbus_fmt = adv7175_g_fmt,
> +	.enum_mbus_fmt  = adv7175_enum_fmt,
>  };
> 
>  static const struct v4l2_subdev_ops adv7175_ops = {
> --
> 1.7.6
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make use of media bus pixel codes in adv7175 driver
  2011-09-30 10:28 ` Mauro Carvalho Chehab
@ 2011-10-05 19:47   ` Christian Gmeiner
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Gmeiner @ 2011-10-05 19:47 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Hi Mauro

2011/9/30 Mauro Carvalho Chehab <mchehab@redhat.com>:
> Em 27-09-2011 16:16, Christian Gmeiner escreveu:
>> The ADV7175A/ADV7176A can operate in either 8-bit or 16-bit YCrCb mode.
>>
>> * 8-Bit YCrCb Mode
>> This default mode accepts multiplexed YCrCb inputs through
>> the P7-P0 pixel inputs. The inputs follow the sequence Cb0, Y0
>> Cr0, Y1 Cb1, Y2, etc. The Y, Cb and Cr data are input on a
>> rising clock edge.
>>
>> * 16-Bit YCrCb Mode
>> This mode accepts Y inputs through the P7–P0 pixel inputs and
>> multiplexed CrCb inputs through the P15–P8 pixel inputs. The
>> data is loaded on every second rising edge of CLOCK. The inputs
>> follow the sequence Cb0, Y0 Cr0, Y1 Cb1, Y2, etc.
>>
>> Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
>> ---
>> diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c
>> index d2327db..206078e 100644
>> --- a/drivers/media/video/adv7175.c
>> +++ b/drivers/media/video/adv7175.c
>> @@ -61,6 +61,11 @@ static inline struct adv7175 *to_adv7175(struct
>> v4l2_subdev *sd)
>
> Patch looks ok, but it got truncated by your emailer [1]... Couldn't apply it
> [1] http://patchwork.linuxtv.org/patch/7973/
>
> Care to fix it and re-send?

sure... I switched to KMail now.. lets see if it works better now.

Thanks,
Christian

>
> Thanks!
> Mauro
>
>>
>>  static char *inputs[] = { "pass_through", "play_back", "color_bar" };
>>
>> +static enum v4l2_mbus_pixelcode adv7175_codes[] = {
>> +     V4L2_MBUS_FMT_UYVY8_2X8,
>> +     V4L2_MBUS_FMT_UYVY8_1X16,
>> +};
>> +
>>  /* ----------------------------------------------------------------------- */
>>
>>  static inline int adv7175_write(struct v4l2_subdev *sd, u8 reg, u8 value)
>> @@ -296,6 +301,60 @@ static int adv7175_s_routing(struct v4l2_subdev *sd,
>>       return 0;
>>  }
>>
>> +static int adv7175_enum_fmt(struct v4l2_subdev *sd, unsigned int index,
>> +                             enum v4l2_mbus_pixelcode *code)
>> +{
>> +     if (index >= ARRAY_SIZE(adv7175_codes))
>> +             return -EINVAL;
>> +
>> +     *code = adv7175_codes[index];
>> +     return 0;
>> +}
>> +
>> +static int adv7175_g_fmt(struct v4l2_subdev *sd,
>> +                             struct v4l2_mbus_framefmt *mf)
>> +{
>> +     u8 val = adv7175_read(sd, 0x7);
>> +
>> +     if ((val & 0x40) == (1 << 6))
>> +             mf->code = V4L2_MBUS_FMT_UYVY8_1X16;
>> +     else
>> +             mf->code = V4L2_MBUS_FMT_UYVY8_2X8;
>> +
>> +     mf->colorspace  = V4L2_COLORSPACE_SMPTE170M;
>> +     mf->width       = 0;
>> +     mf->height      = 0;
>> +     mf->field       = V4L2_FIELD_ANY;
>> +
>> +     return 0;
>> +}
>> +
>> +static int adv7175_s_fmt(struct v4l2_subdev *sd,
>> +                             struct v4l2_mbus_framefmt *mf)
>> +{
>> +     u8 val = adv7175_read(sd, 0x7);
>> +     int ret;
>> +
>> +     switch (mf->code) {
>> +     case V4L2_MBUS_FMT_UYVY8_2X8:
>> +             val &= ~0x40;
>> +             break;
>> +
>> +     case V4L2_MBUS_FMT_UYVY8_1X16:
>> +             val |= 0x40;
>> +             break;
>> +
>> +     default:
>> +             v4l2_dbg(1, debug, sd,
>> +                     "illegal v4l2_mbus_framefmt code: %d\n", mf->code);
>> +             return -EINVAL;
>> +     }
>> +
>> +     ret = adv7175_write(sd, 0x7, val);
>> +
>> +     return ret;
>> +}
>> +
>>  static int adv7175_g_chip_ident(struct v4l2_subdev *sd, struct
>> v4l2_dbg_chip_ident *chip)
>>  {
>>       struct i2c_client *client = v4l2_get_subdevdata(sd);
>> @@ -324,6 +383,9 @@ static const struct v4l2_subdev_core_ops
>> adv7175_core_ops = {
>>  static const struct v4l2_subdev_video_ops adv7175_video_ops = {
>>       .s_std_output = adv7175_s_std_output,
>>       .s_routing = adv7175_s_routing,
>> +     .s_mbus_fmt = adv7175_s_fmt,
>> +     .g_mbus_fmt = adv7175_g_fmt,
>> +     .enum_mbus_fmt  = adv7175_enum_fmt,
>>  };
>>
>>  static const struct v4l2_subdev_ops adv7175_ops = {
>> --
>> 1.7.6
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-media" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-05 19:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-27 19:16 [PATCH] Make use of media bus pixel codes in adv7175 driver Christian Gmeiner
2011-09-30 10:28 ` Mauro Carvalho Chehab
2011-10-05 19:47   ` Christian Gmeiner

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.