Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: g.liakhovetski@gmx.de (Guennadi Liakhovetski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/13] atmel-isi: move hw code into isi_hw_initialize()
Date: Sun, 24 Jan 2016 19:09:14 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.1601241906070.16570@axis700.grange> (raw)
In-Reply-To: <1453121545-27528-2-git-send-email-rainyfeeling@gmail.com>

On Mon, 18 Jan 2016, Josh Wu wrote:

> That make hw operation code separate with general code.
> 
> Also since reset action can be failed, so add a return value for
> isi_hw_initialze().
> 
> Signed-off-by: Josh Wu <rainyfeeling@gmail.com>
> ---
> 
>  drivers/media/platform/soc_camera/atmel-isi.c | 34 +++++++++++++++++----------
>  1 file changed, 21 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
> index 4ddc309..ed4d04b 100644
> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> @@ -203,10 +203,27 @@ static int isi_hw_wait_status(struct atmel_isi *isi, int status_flag,
>  	return 0;
>  }
>  
> -static void isi_hw_initialize(struct atmel_isi *isi)
> +static int isi_hw_initialize(struct atmel_isi *isi)
>  {
>  	u32 common_flags = isi->bus_param;
>  	u32 cfg1 = 0;
> +	int ret;
> +
> +	/* Reset ISI */
> +	isi_writel(isi, ISI_CTRL, ISI_CTRL_SRST);
> +
> +	/* Check Reset status */
> +	ret  = isi_hw_wait_status(isi, ISI_CTRL_SRST, 500);

You could also remove the superfluous space while at it.

Thanks
Guennadi

> +	if (ret) {
> +		dev_err(isi->soc_host.icd->parent, "Reset ISI timed out\n");
> +		return ret;
> +	}
> +
> +	/* Disable all interrupts */
> +	isi_writel(isi, ISI_INTDIS, (u32)~0UL);
> +
> +	/* Clear any pending interrupt */
> +	isi_readl(isi, ISI_STATUS);
>  
>  	/* set bus param for ISI */
>  	if (common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)
> @@ -229,6 +246,8 @@ static void isi_hw_initialize(struct atmel_isi *isi)
>  
>  	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
>  	isi_writel(isi, ISI_CFG1, cfg1);
> +
> +	return 0;
>  }
>  
>  static irqreturn_t atmel_isi_handle_streaming(struct atmel_isi *isi)
> @@ -453,27 +472,16 @@ static int start_streaming(struct vb2_queue *vq, unsigned int count)
>  
>  	pm_runtime_get_sync(ici->v4l2_dev.dev);
>  
> -	/* Reset ISI */
> -	isi_writel(isi, ISI_CTRL, ISI_CTRL_SRST);
> -
> -	/* Check Reset status */
> -	ret  = isi_hw_wait_status(isi, ISI_CTRL_SRST, 500);
> +	ret = isi_hw_initialize(isi);
>  	if (ret) {
> -		dev_err(icd->parent, "Reset ISI timed out\n");
>  		pm_runtime_put(ici->v4l2_dev.dev);
>  		return ret;
>  	}
> -	/* Disable all interrupts */
> -	isi_writel(isi, ISI_INTDIS, (u32)~0UL);
> -
> -	isi_hw_initialize(isi);
>  
>  	configure_geometry(isi, icd->user_width, icd->user_height,
>  				icd->current_fmt);
>  
>  	spin_lock_irq(&isi->lock);
> -	/* Clear any pending interrupt */
> -	isi_readl(isi, ISI_STATUS);
>  
>  	if (count)
>  		start_dma(isi, isi->active);
> -- 
> 1.9.1
> 

  reply	other threads:[~2016-01-24 18:09 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-18 12:21 [PATCH 00/13] media: atmel-isi: extract the hw releated functions into structure Josh Wu
2016-01-18 12:21 ` [PATCH 01/13] atmel-isi: use try_or_set_fmt() for both set_fmt() and try_fmt() Josh Wu
2016-01-24 16:11   ` Guennadi Liakhovetski
2016-01-18 12:21 ` [PATCH 02/13] atmel-isi: move the is_support() close to try/set format function Josh Wu
2016-01-24 16:12   ` Guennadi Liakhovetski
2016-01-18 12:21 ` [PATCH 03/13] atmel-isi: add isi_hw_initialize() function to handle hw setup Josh Wu
2016-01-18 12:21 ` [PATCH 04/13] atmel-isi: move the cfg1 initialize to isi_hw_initialize() Josh Wu
2016-01-18 12:21 ` [PATCH 05/13] atmel-isi: add a function: isi_hw_wait_status() to check ISI_SR status Josh Wu
2016-01-18 12:52 ` [PATCH 06/13] atmel-isi: check ISI_SR's flags by polling instead of interrupt Josh Wu
2016-01-18 12:52   ` [PATCH 07/13] atmel-isi: move hw code into isi_hw_initialize() Josh Wu
2016-01-24 18:09     ` Guennadi Liakhovetski [this message]
2016-01-26 14:07       ` Josh Wu
2016-01-18 12:52   ` [PATCH 08/13] atmel-isi: remove the function set_dma_ctrl() as it just use once Josh Wu
2016-01-18 12:52   ` [PATCH 09/13] atmel-isi: add a function start_isi() Josh Wu
2016-01-18 12:52   ` [PATCH 10/13] atmel-isi: reuse start_dma() function in isi interrupt handler Josh Wu
2016-01-18 12:52   ` [PATCH 11/13] atmel-isi: add hw_uninitialize() in stop_streaming() Josh Wu
2016-01-18 12:52   ` [PATCH 11/13] atmel-isi: add hw_uninitialize() Josh Wu
2016-01-18 12:52   ` [PATCH 12/13] atmel-isi: use union for the fbd (frame buffer descriptor) Josh Wu
2016-01-24 19:31     ` Guennadi Liakhovetski
2016-01-26 14:04       ` Josh Wu
2016-01-26 14:10         ` Guennadi Liakhovetski
2016-01-26 14:24           ` Josh Wu
2016-01-26 14:39             ` Guennadi Liakhovetski
2016-01-18 12:52   ` [PATCH 13/13] atmel-isi: use an hw_data structure according compatible string Josh Wu
2016-01-24 16:58   ` [PATCH 06/13] atmel-isi: check ISI_SR's flags by polling instead of interrupt Guennadi Liakhovetski
2016-01-26 14:16     ` Josh Wu
2016-01-26 14:38       ` Guennadi Liakhovetski
2016-01-19 14:52 ` [PATCH 00/13] media: atmel-isi: extract the hw releated functions into structure Ludovic Desroches
2016-01-21 14:19   ` Josh Wu

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.1601241906070.16570@axis700.grange \
    --to=g.liakhovetski@gmx.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox