All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benoit Parrot <bparrot@ti.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>, <linux-media@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Hans Verkuil <hverkuil@xs4all.nl>
Subject: Re: [PATCH v2 11/19] media: ti-vpe: cal: use reg_write_field
Date: Thu, 19 Mar 2020 17:41:26 -0500	[thread overview]
Message-ID: <6157752c-dfd1-1c4f-4260-28b9aa55e27b@ti.com> (raw)
In-Reply-To: <20200319075023.22151-12-tomi.valkeinen@ti.com>

Tomi,

Thanks for the patch.

On 3/19/20 2:50 AM, Tomi Valkeinen wrote:
> Simplify the code by using reg_write_field() where trivially possible.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Tested-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Benoit Parrot <bparrot@ti.com>

> ---
>  drivers/media/platform/ti-vpe/cal.c | 34 ++++++++++++-----------------
>  1 file changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/media/platform/ti-vpe/cal.c b/drivers/media/platform/ti-vpe/cal.c
> index 979f9027a232..5208dfde6fb5 100644
> --- a/drivers/media/platform/ti-vpe/cal.c
> +++ b/drivers/media/platform/ti-vpe/cal.c
> @@ -761,10 +761,9 @@ static void csi2_phy_init(struct cal_ctx *ctx)
>  	camerarx_phy_enable(ctx);
>  
>  	/* 2. Reset complex IO - Do not wait for reset completion */
> -	val = reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port));
> -	set_field(&val, CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_OPERATIONAL,
> -		  CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_MASK);
> -	reg_write(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port), val);
> +	reg_write_field(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port),
> +			CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_OPERATIONAL,
> +			CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_MASK);
>  	ctx_dbg(3, ctx, "CAL_CSI2_COMPLEXIO_CFG(%d) = 0x%08x De-assert Complex IO Reset\n",
>  		ctx->csi2_port,
>  		reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port)));
> @@ -786,18 +785,16 @@ static void csi2_phy_init(struct cal_ctx *ctx)
>  		reg_read(ctx->dev, CAL_CSI2_TIMING(ctx->csi2_port)));
>  
>  	/* 4. Force FORCERXMODE */
> -	val = reg_read(ctx->dev, CAL_CSI2_TIMING(ctx->csi2_port));
> -	set_field(&val, 1, CAL_CSI2_TIMING_FORCE_RX_MODE_IO1_MASK);
> -	reg_write(ctx->dev, CAL_CSI2_TIMING(ctx->csi2_port), val);
> +	reg_write_field(ctx->dev, CAL_CSI2_TIMING(ctx->csi2_port),
> +			1, CAL_CSI2_TIMING_FORCE_RX_MODE_IO1_MASK);
>  	ctx_dbg(3, ctx, "CAL_CSI2_TIMING(%d) = 0x%08x Force RXMODE\n",
>  		ctx->csi2_port,
>  		reg_read(ctx->dev, CAL_CSI2_TIMING(ctx->csi2_port)));
>  
>  	/* E. Power up the PHY using the complex IO */
> -	val = reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port));
> -	set_field(&val, CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_ON,
> -		  CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_MASK);
> -	reg_write(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port), val);
> +	reg_write_field(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port),
> +			CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_ON,
> +			CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_MASK);
>  
>  	/* F. Wait for power up completion */
>  	for (i = 0; i < 10; i++) {
> @@ -869,13 +866,11 @@ static void csi2_wait_for_phy(struct cal_ctx *ctx)
>  static void csi2_phy_deinit(struct cal_ctx *ctx)
>  {
>  	int i;
> -	u32 val;
>  
>  	/* Power down the PHY using the complex IO */
> -	val = reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port));
> -	set_field(&val, CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_OFF,
> -		  CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_MASK);
> -	reg_write(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port), val);
> +	reg_write_field(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port),
> +			CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_STATE_OFF,
> +			CAL_CSI2_COMPLEXIO_CFG_PWR_CMD_MASK);
>  
>  	/* Wait for power down completion */
>  	for (i = 0; i < 10; i++) {
> @@ -892,10 +887,9 @@ static void csi2_phy_deinit(struct cal_ctx *ctx)
>  		(i >= 10) ? "(timeout)" : "");
>  
>  	/* Assert Comple IO Reset */
> -	val = reg_read(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port));
> -	set_field(&val, CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL,
> -		  CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_MASK);
> -	reg_write(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port), val);
> +	reg_write_field(ctx->dev, CAL_CSI2_COMPLEXIO_CFG(ctx->csi2_port),
> +			CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL,
> +			CAL_CSI2_COMPLEXIO_CFG_RESET_CTRL_MASK);
>  
>  	/* Wait for power down completion */
>  	for (i = 0; i < 10; i++) {
> 

  reply	other threads:[~2020-03-19 22:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19  7:50 [PATCH v2 00/19] CAL fixes and improvements Tomi Valkeinen
2020-03-19  7:50 ` [PATCH v2 01/19] media: ti-vpe: cal: fix DMA memory corruption Tomi Valkeinen
2020-03-19 21:41   ` Benoit Parrot
2020-03-19 21:46     ` Benoit Parrot
2020-03-19 22:25   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 02/19] media: ti-vpe: cal: improve enable_irqs Tomi Valkeinen
2020-03-19 22:26   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 03/19] media: ti-vpe: cal: fix use of wrong macro Tomi Valkeinen
2020-03-19 22:27   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 04/19] media: ti-vpe: cal: use runtime_resume for errata handling Tomi Valkeinen
2020-03-19 22:28   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 05/19] media: ti-vpe: cal: drop cal_runtime_get/put Tomi Valkeinen
2020-03-19 22:29   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 06/19] media: ti-vpe: cal: catch error irqs and print errors Tomi Valkeinen
2020-03-19 22:32   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 07/19] media: ti-vpe: cal: print errors on timeouts Tomi Valkeinen
2020-03-19 22:38   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 08/19] media: ti-vpe: cal: simplify irq handling Tomi Valkeinen
2020-03-19 22:39   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 09/19] media: ti-vpe: cal: remove useless CAL_GEN_* macros Tomi Valkeinen
2020-03-19 22:40   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 10/19] media: ti-vpe: cal: remove useless IRQ defines Tomi Valkeinen
2020-03-19 22:40   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 11/19] media: ti-vpe: cal: use reg_write_field Tomi Valkeinen
2020-03-19 22:41   ` Benoit Parrot [this message]
2020-03-19  7:50 ` [PATCH v2 12/19] media: ti-vpe: cal: cleanup CIO power enable/disable Tomi Valkeinen
2020-03-19 22:42   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 13/19] media: ti-vpe: cal: fix dummy read to phy Tomi Valkeinen
2020-03-19 22:43   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 14/19] media: ti-vpe: cal: program number of lines properly Tomi Valkeinen
2020-03-19 22:44   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 15/19] media: ti-vpe: cal: set DMA max seg size Tomi Valkeinen
2020-03-19 22:44   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 16/19] media: ti-vpe: cal: move code to separate functions Tomi Valkeinen
2020-03-19 22:45   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 17/19] media: ti-vpe: cal: improve wait for CIO resetdone Tomi Valkeinen
2020-03-19 22:46   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 18/19] media: ti-vpe: cal: improve wait for stop-state Tomi Valkeinen
2020-03-19 22:46   ` Benoit Parrot
2020-03-19  7:50 ` [PATCH v2 19/19] media: ti-vpe: cal: fix stop state timeout Tomi Valkeinen
2020-03-19 22:53   ` Benoit Parrot
2020-03-20  9:33     ` Tomi Valkeinen

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=6157752c-dfd1-1c4f-4260-28b9aa55e27b@ti.com \
    --to=bparrot@ti.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    /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.