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 1/2 v3] V4L: atmel-isi: add code to enable/disable ISI_MCK clock
Date: Thu, 5 Jan 2012 18:21:47 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.64.1201051820060.23644@axis700.grange> (raw)
In-Reply-To: <4F05DAA1.2030207@atmel.com>

On Thu, 5 Jan 2012, Nicolas Ferre wrote:

> On 01/05/2012 06:09 PM, Russell King - ARM Linux :
> > clk_prepare/clk_unprepare?
> 
> Right, Guennadi, this modification has already made by Josh and it was the second patch of this series:
> "[PATCH v3 2/2] [media] V4L: atmel-isi: add clk_prepare()/clk_unprepare() functions"

Right, but not for this patch... I'll let him fix it here too.

> Moreover, I thought that both of them should go through v4l git tree?...

It could, but another arm patch depends on this one, so, we decided, it 
would be easier to pull also this one via arm.

> If it is not the case anymore, I think that Olof and Arnd prefer to pull 
> from git better than individual patches.

Hm, this shouldn't be a problem normally...

Thanks
Guennadi

> 
> Best regards,
> 
> > On Thu, Jan 05, 2012 at 05:55:17PM +0100, Guennadi Liakhovetski wrote:
> >> From: Josh Wu <josh.wu@atmel.com>
> >>
> >> This patch
> >> - add ISI_MCK clock enable/disable code.
> >> - change field name in isi_platform_data structure
> >>
> >> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> >> [g.liakhovetski at gmx.de: fix label names]
> >> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> >> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> >> Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> >> ---
> >>
> >> Arnd, please, pull this patch via your tree to avoid having to wait for 
> >> the V4L tree, Mauro has acked it.
> >>
> >>  drivers/media/video/atmel-isi.c |   31 +++++++++++++++++++++++++++++--
> >>  include/media/atmel-isi.h       |    4 +++-
> >>  2 files changed, 32 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/media/video/atmel-isi.c b/drivers/media/video/atmel-isi.c
> >> index b25bd7b..9fe4519 100644
> >> --- a/drivers/media/video/atmel-isi.c
> >> +++ b/drivers/media/video/atmel-isi.c
> >> @@ -90,7 +90,10 @@ struct atmel_isi {
> >>  	struct isi_dma_desc		dma_desc[MAX_BUFFER_NUM];
> >>  
> >>  	struct completion		complete;
> >> +	/* ISI peripherial clock */
> >>  	struct clk			*pclk;
> >> +	/* ISI_MCK, feed to camera sensor to generate pixel clock */
> >> +	struct clk			*mck;
> >>  	unsigned int			irq;
> >>  
> >>  	struct isi_platform_data	*pdata;
> >> @@ -766,6 +769,12 @@ static int isi_camera_add_device(struct soc_camera_device *icd)
> >>  	if (ret)
> >>  		return ret;
> >>  
> >> +	ret = clk_enable(isi->mck);
> >> +	if (ret) {
> >> +		clk_disable(isi->pclk);
> >> +		return ret;
> >> +	}
> >> +
> >>  	isi->icd = icd;
> >>  	dev_dbg(icd->parent, "Atmel ISI Camera driver attached to camera %d\n",
> >>  		 icd->devnum);
> >> @@ -779,6 +788,7 @@ static void isi_camera_remove_device(struct soc_camera_device *icd)
> >>  
> >>  	BUG_ON(icd != isi->icd);
> >>  
> >> +	clk_disable(isi->mck);
> >>  	clk_disable(isi->pclk);
> >>  	isi->icd = NULL;
> >>  
> >> @@ -874,7 +884,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd)
> >>  
> >>  	if (isi->pdata->has_emb_sync)
> >>  		cfg1 |= ISI_CFG1_EMB_SYNC;
> >> -	if (isi->pdata->isi_full_mode)
> >> +	if (isi->pdata->full_mode)
> >>  		cfg1 |= ISI_CFG1_FULL_MODE;
> >>  
> >>  	isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);
> >> @@ -912,6 +922,7 @@ static int __devexit atmel_isi_remove(struct platform_device *pdev)
> >>  			isi->fb_descriptors_phys);
> >>  
> >>  	iounmap(isi->regs);
> >> +	clk_put(isi->mck);
> >>  	clk_put(isi->pclk);
> >>  	kfree(isi);
> >>  
> >> @@ -930,7 +941,7 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
> >>  	struct isi_platform_data *pdata;
> >>  
> >>  	pdata = dev->platform_data;
> >> -	if (!pdata || !pdata->data_width_flags) {
> >> +	if (!pdata || !pdata->data_width_flags || !pdata->mck_hz) {
> >>  		dev_err(&pdev->dev,
> >>  			"No config available for Atmel ISI\n");
> >>  		return -EINVAL;
> >> @@ -959,6 +970,19 @@ static int __devinit atmel_isi_probe(struct platform_device *pdev)
> >>  	INIT_LIST_HEAD(&isi->video_buffer_list);
> >>  	INIT_LIST_HEAD(&isi->dma_desc_head);
> >>  
> >> +	/* Get ISI_MCK, provided by programmable clock or external clock */
> >> +	isi->mck = clk_get(dev, "isi_mck");
> >> +	if (IS_ERR(isi->mck)) {
> >> +		dev_err(dev, "Failed to get isi_mck\n");
> >> +		ret = PTR_ERR(isi->mck);
> >> +		goto err_clk_get;
> >> +	}
> >> +
> >> +	/* Set ISI_MCK's frequency, it should be faster than pixel clock */
> >> +	ret = clk_set_rate(isi->mck, pdata->mck_hz);
> >> +	if (ret < 0)
> >> +		goto err_set_mck_rate;
> >> +
> >>  	isi->p_fb_descriptors = dma_alloc_coherent(&pdev->dev,
> >>  				sizeof(struct fbd) * MAX_BUFFER_NUM,
> >>  				&isi->fb_descriptors_phys,
> >> @@ -1034,6 +1058,9 @@ err_alloc_ctx:
> >>  			isi->p_fb_descriptors,
> >>  			isi->fb_descriptors_phys);
> >>  err_alloc_descriptors:
> >> +err_set_mck_rate:
> >> +	clk_put(isi->mck);
> >> +err_clk_get:
> >>  	kfree(isi);
> >>  err_alloc_isi:
> >>  	clk_put(pclk);
> >> diff --git a/include/media/atmel-isi.h b/include/media/atmel-isi.h
> >> index 26cece5..6568230 100644
> >> --- a/include/media/atmel-isi.h
> >> +++ b/include/media/atmel-isi.h
> >> @@ -110,10 +110,12 @@ struct isi_platform_data {
> >>  	u8 hsync_act_low;
> >>  	u8 vsync_act_low;
> >>  	u8 pclk_act_falling;
> >> -	u8 isi_full_mode;
> >> +	u8 full_mode;
> >>  	u32 data_width_flags;
> >>  	/* Using for ISI_CFG1 */
> >>  	u32 frate;
> >> +	/* Using for ISI_MCK */
> >> +	u32 mck_hz;
> >>  };
> >>  
> >>  #endif /* __ATMEL_ISI_H__ */
> >> -- 
> >> 1.7.2.5
> >>
> >>
> >> _______________________________________________
> >> linux-arm-kernel mailing list
> >> linux-arm-kernel at lists.infradead.org
> >> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> > 
> 
> 
> -- 
> Nicolas Ferre
> 

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

  reply	other threads:[~2012-01-05 17:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 14:25 [GIT PULL] at91: devices and boards files update for 3.3 Nicolas Ferre
2011-12-16  7:06 ` Olof Johansson
2011-12-16 16:37   ` Nicolas Ferre
2011-12-16 21:03     ` Olof Johansson
2011-12-17 18:34       ` Guennadi Liakhovetski
2011-12-17 23:42         ` Olof Johansson
2011-12-18  0:08           ` Guennadi Liakhovetski
2011-12-20  4:32             ` Olof Johansson
2012-01-03 10:49               ` Nicolas Ferre
2012-01-03 10:59                 ` Guennadi Liakhovetski
2012-01-05 16:55               ` [PATCH 1/2 v3] V4L: atmel-isi: add code to enable/disable ISI_MCK clock Guennadi Liakhovetski
2012-01-05 17:09                 ` Russell King - ARM Linux
2012-01-05 17:15                   ` Nicolas Ferre
2012-01-05 17:21                     ` Guennadi Liakhovetski [this message]
2012-01-06  5:49                       ` Wu, Josh
     [not found] ` <4F02E1B9.30009@atmel.com>
2012-01-03 21:39   ` [GIT PULL v2] at91: devices and boards files update for 3.3 Arnd Bergmann
2012-01-04  9:20     ` Nicolas Ferre

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.1201051820060.23644@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