lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH0PR11MB56115C777A76F5E17F5D79008105A@PH0PR11MB5611.namprd11.prod.outlook.com>
Date:   Mon, 31 Jul 2023 10:19:29 +0000
From:   <Shravan.Chippa@...rochip.com>
To:     <Shravan.Chippa@...rochip.com>, <paul.j.murphy@...el.com>,
        <daniele.alessandrelli@...el.com>, <mchehab@...nel.org>
CC:     <linux-media@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] media: i2c: imx334: add support for test pattern
 generator

Hi,

Gentle ping!

Thanks,
Shravan


> -----Original Message-----
> From: shravan kumar <shravan.chippa@...rochip.com>
> Sent: Monday, July 10, 2023 3:21 PM
> To: paul.j.murphy@...el.com; daniele.alessandrelli@...el.com;
> mchehab@...nel.org
> Cc: linux-media@...r.kernel.org; linux-kernel@...r.kernel.org; shravan
> Chippa - I35088 <Shravan.Chippa@...rochip.com>
> Subject: [PATCH] media: i2c: imx334: add support for test pattern generator
> 
> From: Shravan Chippa <shravan.chippa@...rochip.com>
> 
> Add support for the imx334's test pattern generator.
> By default the test pattern generator is disabled, so add support for enabling
> and disabling horizontal and vertical colour bars.
> 
> Signed-off-by: Shravan Chippa <shravan.chippa@...rochip.com>
> ---
>  drivers/media/i2c/imx334.c | 57
> +++++++++++++++++++++++++++++++++++++-
>  1 file changed, 56 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index
> b65c526a5f1c..248ab65a6725 100644
> --- a/drivers/media/i2c/imx334.c
> +++ b/drivers/media/i2c/imx334.c
> @@ -56,6 +56,24 @@
>  #define IMX334_REG_MIN		0x00
>  #define IMX334_REG_MAX		0xfffff
> 
> +/* Test Pattern Control */
> +#define IMX334_REG_TP		0x329e
> +#define IMX334_TP_COLOR_HBARS	0xA
> +#define IMX334_TP_COLOR_VBARS	0xB
> +
> +#define IMX334_TPG_EN_DOUT	0x329c
> +#define IMX334_TP_ENABLE	0x1
> +#define IMX334_TP_DISABLE	0x0
> +
> +#define IMX334_TPG_COLORW	0x32a0
> +#define IMX334_TPG_COLORW_120P	0x13
> +
> +#define IMX334_TP_CLK_EN	0x3148
> +#define IMX334_TP_CLK_EN_VAL	0x10
> +#define IMX334_TP_CLK_DIS_VAL	0x0
> +
> +#define IMX334_DIG_CLP_MODE	0x3280
> +
>  /**
>   * struct imx334_reg - imx334 sensor register
>   * @address: Register address
> @@ -429,6 +447,18 @@ static const struct imx334_reg
> mode_3840x2160_regs[] = {
>  	{0x3a29, 0x00},
>  };
> 
> +static const char * const imx334_test_pattern_menu[] = {
> +	"Disabled",
> +	"Color Bars Ver",
> +	"Color Bars Hor",
> +};
> +
> +static const int imx334_test_pattern_val[] = {
> +	IMX334_TP_DISABLE,
> +	IMX334_TP_COLOR_HBARS,
> +	IMX334_TP_COLOR_VBARS,
> +};
> +
>  static const struct imx334_reg raw10_framefmt_regs[] = {
>  	{0x3050, 0x00},
>  	{0x319d, 0x00},
> @@ -711,6 +741,26 @@ static int imx334_set_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_HBLANK:
>  		ret = 0;
>  		break;
> +	case V4L2_CID_TEST_PATTERN:
> +		if (ctrl->val) {
> +			imx334_write_reg(imx334, IMX334_TP_CLK_EN, 1,
> +					 IMX334_TP_CLK_EN_VAL);
> +			imx334_write_reg(imx334, IMX334_DIG_CLP_MODE,
> 1, 0x0);
> +			imx334_write_reg(imx334, IMX334_TPG_COLORW, 1,
> +					 IMX334_TPG_COLORW_120P);
> +			imx334_write_reg(imx334, IMX334_REG_TP, 1,
> +					 imx334_test_pattern_val[ctrl->val]);
> +			imx334_write_reg(imx334, IMX334_TPG_EN_DOUT,
> 1,
> +					 IMX334_TP_ENABLE);
> +		} else {
> +			imx334_write_reg(imx334, IMX334_DIG_CLP_MODE,
> 1, 0x1);
> +			imx334_write_reg(imx334, IMX334_TP_CLK_EN, 1,
> +					 IMX334_TP_CLK_DIS_VAL);
> +			imx334_write_reg(imx334, IMX334_TPG_EN_DOUT,
> 1,
> +					 IMX334_TP_DISABLE);
> +		}
> +		ret = 0;
> +		break;
>  	default:
>  		dev_err(imx334->dev, "Invalid control %d", ctrl->id);
>  		ret = -EINVAL;
> @@ -1217,7 +1267,7 @@ static int imx334_init_controls(struct imx334
> *imx334)
>  	u32 lpfr;
>  	int ret;
> 
> -	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 6);
> +	ret = v4l2_ctrl_handler_init(ctrl_hdlr, 7);
>  	if (ret)
>  		return ret;
> 
> @@ -1277,6 +1327,11 @@ static int imx334_init_controls(struct imx334
> *imx334)
>  	if (imx334->hblank_ctrl)
>  		imx334->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
> 
> +	v4l2_ctrl_new_std_menu_items(ctrl_hdlr, &imx334_ctrl_ops,
> +				     V4L2_CID_TEST_PATTERN,
> +				     ARRAY_SIZE(imx334_test_pattern_menu) -
> 1,
> +				     0, 0, imx334_test_pattern_menu);
> +
>  	if (ctrl_hdlr->error) {
>  		dev_err(imx334->dev, "control init failed: %d",
>  			ctrl_hdlr->error);
> --
> 2.34.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ