All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 5/5] mt9m111: make use of testpattern
Date: Sun, 17 Jul 2011 18:55:30 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1107171854240.13485@axis700.grange> (raw)
In-Reply-To: <1310485146-27759-5-git-send-email-m.grzeschik@pengutronix.de>

On Tue, 12 Jul 2011, Michael Grzeschik wrote:

> Signed-off-by: Philipp Wiesner <p.wiesner@phytec.de>
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> Changes v1 -> v2
> 	* removed ifdef DEBUG
> 
>  drivers/media/video/mt9m111.c |   57 +++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 57 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c
> index 7eb2e4a..a3463d9 100644
> --- a/drivers/media/video/mt9m111.c
> +++ b/drivers/media/video/mt9m111.c
> @@ -87,6 +87,7 @@
>   */
>  #define MT9M111_OPER_MODE_CTRL		0x106
>  #define MT9M111_OUTPUT_FORMAT_CTRL	0x108
> +#define MT9M111_TEST_PATTERN_GEN	0x148
>  #define MT9M111_REDUCER_XZOOM_B		0x1a0
>  #define MT9M111_REDUCER_XSIZE_B		0x1a1
>  #define MT9M111_REDUCER_YZOOM_B		0x1a3
> @@ -103,6 +104,15 @@
>  #define MT9M111_OPMODE_AUTOWHITEBAL_EN	(1 << 1)
>  #define MT9M111_OUTFMT_FLIP_BAYER_COL  (1 << 9)
>  #define MT9M111_OUTFMT_FLIP_BAYER_ROW  (1 << 8)
> +#define MT9M111_TST_PATT_OFF		(0 << 0)
> +#define MT9M111_TST_PATT_1		(1 << 0)
> +#define MT9M111_TST_PATT_2		(2 << 0)
> +#define MT9M111_TST_PATT_3		(3 << 0)
> +#define MT9M111_TST_PATT_4		(4 << 0)
> +#define MT9M111_TST_PATT_5		(5 << 0)
> +#define MT9M111_TST_PATT_6		(6 << 0)
> +#define MT9M111_TST_PATT_COLORBARS	(7 << 0)
> +#define MT9M111_TST_PATT_FORCE_WB_GAIN_1 (1 << 7)
>  #define MT9M111_OUTFMT_PROCESSED_BAYER	(1 << 14)
>  #define MT9M111_OUTFMT_BYPASS_IFP	(1 << 10)
>  #define MT9M111_OUTFMT_INV_PIX_CLOCK	(1 << 9)
> @@ -138,6 +148,11 @@
>  #define MT9M111_MAX_HEIGHT	1024
>  #define MT9M111_MAX_WIDTH	1280
>  
> +static int testpattern;
> +module_param(testpattern, int, S_IRUGO);
> +MODULE_PARM_DESC(testpattern, "Test pattern: a number from 1 to 10, 0 for "
> +		"normal usage");
> +

I already replied, that I do not like using a module parameter for this.

Thanks
Guennadi

>  /* MT9M111 has only one fixed colorspace per pixelcode */
>  struct mt9m111_datafmt {
>  	enum v4l2_mbus_pixelcode	code;
> @@ -464,6 +479,7 @@ static int mt9m111_set_pixfmt(struct i2c_client *client,
>  			      enum v4l2_mbus_pixelcode code)
>  {
>  	u16 data_outfmt1 = 0, data_outfmt2 = 0, mask_outfmt1, mask_outfmt2;
> +	u16 pattern = 0;
>  	int ret = 0;
>  
>  	switch (code) {
> @@ -531,6 +547,47 @@ static int mt9m111_set_pixfmt(struct i2c_client *client,
>  	if (!ret)
>  		ret = reg_mask(OUTPUT_FORMAT_CTRL, data_outfmt1, mask_outfmt1);
>  
> +	switch (testpattern) {
> +	case 1:
> +		pattern = MT9M111_TST_PATT_1 | MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 2:
> +		pattern = MT9M111_TST_PATT_2 | MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 3:
> +		pattern = MT9M111_TST_PATT_3 | MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 4:
> +		pattern = MT9M111_TST_PATT_4 | MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 5:
> +		pattern = MT9M111_TST_PATT_5 | MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 6:
> +		pattern = MT9M111_TST_PATT_6 | MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 7:
> +		pattern = MT9M111_TST_PATT_COLORBARS |
> +			MT9M111_TST_PATT_FORCE_WB_GAIN_1;
> +		break;
> +	case 8:
> +		data_outfmt2 |= MT9M111_OUTFMT_TST_RAMP_COL;
> +		break;
> +	case 9:
> +		data_outfmt2 |= MT9M111_OUTFMT_TST_RAMP_ROW;
> +		break;
> +	case 10:
> +		data_outfmt2 |= MT9M111_OUTFMT_TST_RAMP_FRAME;
> +		break;
> +	}
> +
> +	dev_dbg(&client->dev, "%s: using testpattern %d\n", __func__,
> +			testpattern);
> +
> +	if (!ret)
> +		ret = mt9m111_reg_set(client,
> +				MT9M111_TEST_PATTERN_GEN, pattern);
> +
>  	if (!ret)
>  		ret = reg_mask(OUTPUT_FORMAT_CTRL2_A, data_outfmt2,
>  			mask_outfmt2);
> -- 
> 1.7.5.4
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

  reply	other threads:[~2011-07-17 16:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 15:39 [PATCH 1/5] mt9m111: set inital return values to zero Michael Grzeschik
2011-07-12 15:39 ` [PATCH 2/5] mt9m111: fix missing return value check mt9m111_reg_clear Michael Grzeschik
2011-07-17 16:54   ` Guennadi Liakhovetski
2011-07-12 15:39 ` [PATCH 3/5] mt9m111: move lastpage to struct mt9m111 for multi instances Michael Grzeschik
2011-07-14 15:27   ` Laurent Pinchart
2011-07-17 16:53     ` Guennadi Liakhovetski
2011-07-19 13:26   ` [PATCH v2] " Michael Grzeschik
2011-07-19 14:10     ` Guennadi Liakhovetski
2011-07-12 15:39 ` [PATCH v4 4/5] mt9m111: rewrite set_pixfmt Michael Grzeschik
2011-07-17 17:09   ` Guennadi Liakhovetski
2011-07-22 11:57     ` Michael Grzeschik
2011-07-12 15:39 ` [PATCH 5/5] mt9m111: make use of testpattern Michael Grzeschik
2011-07-17 16:55   ` Guennadi Liakhovetski [this message]
2011-07-14 15:25 ` [PATCH 1/5] mt9m111: set inital return values to zero Laurent Pinchart
2011-07-17 16:52   ` Guennadi Liakhovetski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1107171854240.13485@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.