LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] rc: img-ir: Add and enable sys clock for IR
@ 2015-02-03 17:30 Sifan Naeem
  2015-02-04 10:15 ` James Hogan
  2015-04-08 11:32 ` Mauro Carvalho Chehab
  0 siblings, 2 replies; 6+ messages in thread
From: Sifan Naeem @ 2015-02-03 17:30 UTC (permalink / raw)
  To: james.hogan, mchehab; +Cc: linux-kernel, linux-media, Sifan Naeem

Gets a handle to the system clock, already described in the binding
document, and calls the appropriate common clock
framework functions to mark it prepared/enabled, the common clock
framework initially enables the clock and doesn't disable it at least
until the device/driver is removed.
The system clock to IR is needed for the driver to communicate with the
IR hardware via MMIO accesses on the system bus, so it must not be
disabled during use or the driver will malfunction.

Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
---
 drivers/media/rc/img-ir/img-ir-core.c |   13 +++++++++----
 drivers/media/rc/img-ir/img-ir.h      |    2 ++
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
index 77c78de..783dd21 100644
--- a/drivers/media/rc/img-ir/img-ir-core.c
+++ b/drivers/media/rc/img-ir/img-ir-core.c
@@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv *priv)
 
 	if (!IS_ERR(priv->clk))
 		clk_prepare_enable(priv->clk);
+	if (!IS_ERR(priv->sys_clk))
+		clk_prepare_enable(priv->sys_clk);
 }
 
 static void img_ir_ident(struct img_ir_priv *priv)
@@ -110,10 +112,11 @@ static int img_ir_probe(struct platform_device *pdev)
 	priv->clk = devm_clk_get(&pdev->dev, "core");
 	if (IS_ERR(priv->clk))
 		dev_warn(&pdev->dev, "cannot get core clock resource\n");
-	/*
-	 * The driver doesn't need to know about the system ("sys") or power
-	 * modulation ("mod") clocks yet
-	 */
+
+	/* Get sys clock */
+	priv->sys_clk = devm_clk_get(&pdev->dev, "sys");
+	if (IS_ERR(priv->sys_clk))
+		dev_warn(&pdev->dev, "cannot get sys clock resource\n");
 
 	/* Set up raw & hw decoder */
 	error = img_ir_probe_raw(priv);
@@ -152,6 +155,8 @@ static int img_ir_remove(struct platform_device *pdev)
 
 	if (!IS_ERR(priv->clk))
 		clk_disable_unprepare(priv->clk);
+	if (!IS_ERR(priv->sys_clk))
+		clk_disable_unprepare(priv->sys_clk);
 	return 0;
 }
 
diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
index 2ddf560..f1387c0 100644
--- a/drivers/media/rc/img-ir/img-ir.h
+++ b/drivers/media/rc/img-ir/img-ir.h
@@ -138,6 +138,7 @@ struct clk;
  * @dev:		Platform device.
  * @irq:		IRQ number.
  * @clk:		Input clock.
+ * @sys_clk:		System clock.
  * @reg_base:		Iomem base address of IR register block.
  * @lock:		Protects IR registers and variables in this struct.
  * @raw:		Driver data for raw decoder.
@@ -147,6 +148,7 @@ struct img_ir_priv {
 	struct device		*dev;
 	int			irq;
 	struct clk		*clk;
+	struct clk		*sys_clk;
 	void __iomem		*reg_base;
 	spinlock_t		lock;
 
-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
  2015-02-03 17:30 [PATCH] rc: img-ir: Add and enable sys clock for IR Sifan Naeem
@ 2015-02-04 10:15 ` James Hogan
  2015-04-08 11:32 ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 6+ messages in thread
From: James Hogan @ 2015-02-04 10:15 UTC (permalink / raw)
  To: Sifan Naeem, mchehab; +Cc: linux-kernel, linux-media

[-- Attachment #1: Type: text/plain, Size: 3933 bytes --]

Hi Sifan,

On 03/02/15 17:30, Sifan Naeem wrote:
> Gets a handle to the system clock, already described in the binding
> document, and calls the appropriate common clock
> framework functions to mark it prepared/enabled, the common clock
> framework initially enables the clock and doesn't disable it at least
> until the device/driver is removed.
> The system clock to IR is needed for the driver to communicate with the
> IR hardware via MMIO accesses on the system bus, so it must not be
> disabled during use or the driver will malfunction.
> 
> Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> ---
>  drivers/media/rc/img-ir/img-ir-core.c |   13 +++++++++----
>  drivers/media/rc/img-ir/img-ir.h      |    2 ++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
> index 77c78de..783dd21 100644
> --- a/drivers/media/rc/img-ir/img-ir-core.c
> +++ b/drivers/media/rc/img-ir/img-ir-core.c
> @@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv *priv)
>  
>  	if (!IS_ERR(priv->clk))
>  		clk_prepare_enable(priv->clk);
> +	if (!IS_ERR(priv->sys_clk))
> +		clk_prepare_enable(priv->sys_clk);

The patch mostly looks good, however I just realised this only enables
the system clock after it has already used the register interface. To be
safe it should really be enabled before any hardware accesses, so before
img_ir_ident() is called (and certainly before the img_ir_setup_raw()
and img_ir_setup_hw() functions are called since they set up the default
timings / irq mask etc).

Currently img_ir_probe_raw() and img_ir_probe_hw() don't appear to
access the hardware, but I can imagine they may want to access hardware
in future to read the revision register, so I think its worth doing it
from img_ir_probe() before they get called too, which should also ensure
the ISR doesn't get called with sysclock disabled (obviously error
handling in probe function would need to take it into account).

I suspect you would see this causing a problem when the driver is built
as a module and loaded after unused clocks have been automatically
disabled by the common clock framework at the end of the init sequence.

Thanks
James

>  }
>  
>  static void img_ir_ident(struct img_ir_priv *priv)
> @@ -110,10 +112,11 @@ static int img_ir_probe(struct platform_device *pdev)
>  	priv->clk = devm_clk_get(&pdev->dev, "core");
>  	if (IS_ERR(priv->clk))
>  		dev_warn(&pdev->dev, "cannot get core clock resource\n");
> -	/*
> -	 * The driver doesn't need to know about the system ("sys") or power
> -	 * modulation ("mod") clocks yet
> -	 */
> +
> +	/* Get sys clock */
> +	priv->sys_clk = devm_clk_get(&pdev->dev, "sys");
> +	if (IS_ERR(priv->sys_clk))
> +		dev_warn(&pdev->dev, "cannot get sys clock resource\n");
>  
>  	/* Set up raw & hw decoder */
>  	error = img_ir_probe_raw(priv);
> @@ -152,6 +155,8 @@ static int img_ir_remove(struct platform_device *pdev)
>  
>  	if (!IS_ERR(priv->clk))
>  		clk_disable_unprepare(priv->clk);
> +	if (!IS_ERR(priv->sys_clk))
> +		clk_disable_unprepare(priv->sys_clk);
>  	return 0;
>  }
>  
> diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
> index 2ddf560..f1387c0 100644
> --- a/drivers/media/rc/img-ir/img-ir.h
> +++ b/drivers/media/rc/img-ir/img-ir.h
> @@ -138,6 +138,7 @@ struct clk;
>   * @dev:		Platform device.
>   * @irq:		IRQ number.
>   * @clk:		Input clock.
> + * @sys_clk:		System clock.
>   * @reg_base:		Iomem base address of IR register block.
>   * @lock:		Protects IR registers and variables in this struct.
>   * @raw:		Driver data for raw decoder.
> @@ -147,6 +148,7 @@ struct img_ir_priv {
>  	struct device		*dev;
>  	int			irq;
>  	struct clk		*clk;
> +	struct clk		*sys_clk;
>  	void __iomem		*reg_base;
>  	spinlock_t		lock;
>  
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
  2015-02-03 17:30 [PATCH] rc: img-ir: Add and enable sys clock for IR Sifan Naeem
  2015-02-04 10:15 ` James Hogan
@ 2015-04-08 11:32 ` Mauro Carvalho Chehab
  2015-04-08 13:56   ` Sifan Naeem
  1 sibling, 1 reply; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2015-04-08 11:32 UTC (permalink / raw)
  To: Sifan Naeem; +Cc: james.hogan, linux-kernel, linux-media

Em Tue, 3 Feb 2015 17:30:29 +0000
Sifan Naeem <sifan.naeem@imgtec.com> escreveu:

> Gets a handle to the system clock, already described in the binding
> document, and calls the appropriate common clock
> framework functions to mark it prepared/enabled, the common clock
> framework initially enables the clock and doesn't disable it at least
> until the device/driver is removed.
> The system clock to IR is needed for the driver to communicate with the
> IR hardware via MMIO accesses on the system bus, so it must not be
> disabled during use or the driver will malfunction.

Hmm... patchwork has two versions of this patch, but I have only one on
my e-mail.

Could you please check if I applied the right one? If not, please
send me an email with a fixup patch.

Thanks!
Mauro

> 
> Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> ---
>  drivers/media/rc/img-ir/img-ir-core.c |   13 +++++++++----
>  drivers/media/rc/img-ir/img-ir.h      |    2 ++
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/media/rc/img-ir/img-ir-core.c b/drivers/media/rc/img-ir/img-ir-core.c
> index 77c78de..783dd21 100644
> --- a/drivers/media/rc/img-ir/img-ir-core.c
> +++ b/drivers/media/rc/img-ir/img-ir-core.c
> @@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv *priv)
>  
>  	if (!IS_ERR(priv->clk))
>  		clk_prepare_enable(priv->clk);
> +	if (!IS_ERR(priv->sys_clk))
> +		clk_prepare_enable(priv->sys_clk);
>  }
>  
>  static void img_ir_ident(struct img_ir_priv *priv)
> @@ -110,10 +112,11 @@ static int img_ir_probe(struct platform_device *pdev)
>  	priv->clk = devm_clk_get(&pdev->dev, "core");
>  	if (IS_ERR(priv->clk))
>  		dev_warn(&pdev->dev, "cannot get core clock resource\n");
> -	/*
> -	 * The driver doesn't need to know about the system ("sys") or power
> -	 * modulation ("mod") clocks yet
> -	 */
> +
> +	/* Get sys clock */
> +	priv->sys_clk = devm_clk_get(&pdev->dev, "sys");
> +	if (IS_ERR(priv->sys_clk))
> +		dev_warn(&pdev->dev, "cannot get sys clock resource\n");
>  
>  	/* Set up raw & hw decoder */
>  	error = img_ir_probe_raw(priv);
> @@ -152,6 +155,8 @@ static int img_ir_remove(struct platform_device *pdev)
>  
>  	if (!IS_ERR(priv->clk))
>  		clk_disable_unprepare(priv->clk);
> +	if (!IS_ERR(priv->sys_clk))
> +		clk_disable_unprepare(priv->sys_clk);
>  	return 0;
>  }
>  
> diff --git a/drivers/media/rc/img-ir/img-ir.h b/drivers/media/rc/img-ir/img-ir.h
> index 2ddf560..f1387c0 100644
> --- a/drivers/media/rc/img-ir/img-ir.h
> +++ b/drivers/media/rc/img-ir/img-ir.h
> @@ -138,6 +138,7 @@ struct clk;
>   * @dev:		Platform device.
>   * @irq:		IRQ number.
>   * @clk:		Input clock.
> + * @sys_clk:		System clock.
>   * @reg_base:		Iomem base address of IR register block.
>   * @lock:		Protects IR registers and variables in this struct.
>   * @raw:		Driver data for raw decoder.
> @@ -147,6 +148,7 @@ struct img_ir_priv {
>  	struct device		*dev;
>  	int			irq;
>  	struct clk		*clk;
> +	struct clk		*sys_clk;
>  	void __iomem		*reg_base;
>  	spinlock_t		lock;
>  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] rc: img-ir: Add and enable sys clock for IR
  2015-04-08 11:32 ` Mauro Carvalho Chehab
@ 2015-04-08 13:56   ` Sifan Naeem
  2015-04-08 14:40     ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 6+ messages in thread
From: Sifan Naeem @ 2015-04-08 13:56 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: James Hogan, linux-kernel, linux-media

Hi Mauro,

I sent you a v2 of this patch on 4th February:

From: Sifan Naeem 
Sent: 04 February 2015 16:48
To: James Hogan; mchehab@osg.samsung.com
Cc: linux-kernel@vger.kernel.org; linux-media@vger.kernel.org; Sifan Naeem
Subject: [PATCH v2] rc: img-ir: Add and enable sys clock for img-ir


Unfortunately, while trying to improve the commit message in v2 I had changed the last word of the patch name from IR to img-ir.

Do you want me to do a diff between the 2 patches and send you a new patch?

Sifan

> -----Original Message-----
> From: Mauro Carvalho Chehab [mailto:mchehab@osg.samsung.com]
> Sent: 08 April 2015 12:32
> To: Sifan Naeem
> Cc: James Hogan; linux-kernel@vger.kernel.org; linux-
> media@vger.kernel.org
> Subject: Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
> 
> Em Tue, 3 Feb 2015 17:30:29 +0000
> Sifan Naeem <sifan.naeem@imgtec.com> escreveu:
> 
> > Gets a handle to the system clock, already described in the binding
> > document, and calls the appropriate common clock framework functions
> > to mark it prepared/enabled, the common clock framework initially
> > enables the clock and doesn't disable it at least until the
> > device/driver is removed.
> > The system clock to IR is needed for the driver to communicate with
> > the IR hardware via MMIO accesses on the system bus, so it must not be
> > disabled during use or the driver will malfunction.
> 
> Hmm... patchwork has two versions of this patch, but I have only one on my
> e-mail.
> 
> Could you please check if I applied the right one? If not, please send me an
> email with a fixup patch.
> 
> Thanks!
> Mauro
> 
> >
> > Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> > ---
> >  drivers/media/rc/img-ir/img-ir-core.c |   13 +++++++++----
> >  drivers/media/rc/img-ir/img-ir.h      |    2 ++
> >  2 files changed, 11 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/media/rc/img-ir/img-ir-core.c
> > b/drivers/media/rc/img-ir/img-ir-core.c
> > index 77c78de..783dd21 100644
> > --- a/drivers/media/rc/img-ir/img-ir-core.c
> > +++ b/drivers/media/rc/img-ir/img-ir-core.c
> > @@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv *priv)
> >
> >  	if (!IS_ERR(priv->clk))
> >  		clk_prepare_enable(priv->clk);
> > +	if (!IS_ERR(priv->sys_clk))
> > +		clk_prepare_enable(priv->sys_clk);
> >  }
> >
> >  static void img_ir_ident(struct img_ir_priv *priv) @@ -110,10 +112,11
> > @@ static int img_ir_probe(struct platform_device *pdev)
> >  	priv->clk = devm_clk_get(&pdev->dev, "core");
> >  	if (IS_ERR(priv->clk))
> >  		dev_warn(&pdev->dev, "cannot get core clock resource\n");
> > -	/*
> > -	 * The driver doesn't need to know about the system ("sys") or
> power
> > -	 * modulation ("mod") clocks yet
> > -	 */
> > +
> > +	/* Get sys clock */
> > +	priv->sys_clk = devm_clk_get(&pdev->dev, "sys");
> > +	if (IS_ERR(priv->sys_clk))
> > +		dev_warn(&pdev->dev, "cannot get sys clock resource\n");
> >
> >  	/* Set up raw & hw decoder */
> >  	error = img_ir_probe_raw(priv);
> > @@ -152,6 +155,8 @@ static int img_ir_remove(struct platform_device
> > *pdev)
> >
> >  	if (!IS_ERR(priv->clk))
> >  		clk_disable_unprepare(priv->clk);
> > +	if (!IS_ERR(priv->sys_clk))
> > +		clk_disable_unprepare(priv->sys_clk);
> >  	return 0;
> >  }
> >
> > diff --git a/drivers/media/rc/img-ir/img-ir.h
> > b/drivers/media/rc/img-ir/img-ir.h
> > index 2ddf560..f1387c0 100644
> > --- a/drivers/media/rc/img-ir/img-ir.h
> > +++ b/drivers/media/rc/img-ir/img-ir.h
> > @@ -138,6 +138,7 @@ struct clk;
> >   * @dev:		Platform device.
> >   * @irq:		IRQ number.
> >   * @clk:		Input clock.
> > + * @sys_clk:		System clock.
> >   * @reg_base:		Iomem base address of IR register block.
> >   * @lock:		Protects IR registers and variables in this struct.
> >   * @raw:		Driver data for raw decoder.
> > @@ -147,6 +148,7 @@ struct img_ir_priv {
> >  	struct device		*dev;
> >  	int			irq;
> >  	struct clk		*clk;
> > +	struct clk		*sys_clk;
> >  	void __iomem		*reg_base;
> >  	spinlock_t		lock;
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
  2015-04-08 13:56   ` Sifan Naeem
@ 2015-04-08 14:40     ` Mauro Carvalho Chehab
  2015-04-09  8:51       ` Sifan Naeem
  0 siblings, 1 reply; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2015-04-08 14:40 UTC (permalink / raw)
  To: Sifan Naeem; +Cc: James Hogan, linux-kernel, linux-media

Em Wed, 08 Apr 2015 13:56:14 +0000
Sifan Naeem <Sifan.Naeem@imgtec.com> escreveu:

> Hi Mauro,
> 
> I sent you a v2 of this patch on 4th February:
> 
> From: Sifan Naeem 
> Sent: 04 February 2015 16:48
> To: James Hogan; mchehab@osg.samsung.com
> Cc: linux-kernel@vger.kernel.org; linux-media@vger.kernel.org; Sifan Naeem
> Subject: [PATCH v2] rc: img-ir: Add and enable sys clock for img-ir
> 
> 
> Unfortunately, while trying to improve the commit message in v2 I had changed the last word of the patch name from IR to img-ir.
> 
> Do you want me to do a diff between the 2 patches and send you a new patch?

Yes, please do that, changing the patch name/description to reflect
what changed since v1.

Regards,
Mauro

> 
> Sifan
> 
> > -----Original Message-----
> > From: Mauro Carvalho Chehab [mailto:mchehab@osg.samsung.com]
> > Sent: 08 April 2015 12:32
> > To: Sifan Naeem
> > Cc: James Hogan; linux-kernel@vger.kernel.org; linux-
> > media@vger.kernel.org
> > Subject: Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
> > 
> > Em Tue, 3 Feb 2015 17:30:29 +0000
> > Sifan Naeem <sifan.naeem@imgtec.com> escreveu:
> > 
> > > Gets a handle to the system clock, already described in the binding
> > > document, and calls the appropriate common clock framework functions
> > > to mark it prepared/enabled, the common clock framework initially
> > > enables the clock and doesn't disable it at least until the
> > > device/driver is removed.
> > > The system clock to IR is needed for the driver to communicate with
> > > the IR hardware via MMIO accesses on the system bus, so it must not be
> > > disabled during use or the driver will malfunction.
> > 
> > Hmm... patchwork has two versions of this patch, but I have only one on my
> > e-mail.
> > 
> > Could you please check if I applied the right one? If not, please send me an
> > email with a fixup patch.
> > 
> > Thanks!
> > Mauro
> > 
> > >
> > > Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> > > ---
> > >  drivers/media/rc/img-ir/img-ir-core.c |   13 +++++++++----
> > >  drivers/media/rc/img-ir/img-ir.h      |    2 ++
> > >  2 files changed, 11 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/media/rc/img-ir/img-ir-core.c
> > > b/drivers/media/rc/img-ir/img-ir-core.c
> > > index 77c78de..783dd21 100644
> > > --- a/drivers/media/rc/img-ir/img-ir-core.c
> > > +++ b/drivers/media/rc/img-ir/img-ir-core.c
> > > @@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv *priv)
> > >
> > >  	if (!IS_ERR(priv->clk))
> > >  		clk_prepare_enable(priv->clk);
> > > +	if (!IS_ERR(priv->sys_clk))
> > > +		clk_prepare_enable(priv->sys_clk);
> > >  }
> > >
> > >  static void img_ir_ident(struct img_ir_priv *priv) @@ -110,10 +112,11
> > > @@ static int img_ir_probe(struct platform_device *pdev)
> > >  	priv->clk = devm_clk_get(&pdev->dev, "core");
> > >  	if (IS_ERR(priv->clk))
> > >  		dev_warn(&pdev->dev, "cannot get core clock resource\n");
> > > -	/*
> > > -	 * The driver doesn't need to know about the system ("sys") or
> > power
> > > -	 * modulation ("mod") clocks yet
> > > -	 */
> > > +
> > > +	/* Get sys clock */
> > > +	priv->sys_clk = devm_clk_get(&pdev->dev, "sys");
> > > +	if (IS_ERR(priv->sys_clk))
> > > +		dev_warn(&pdev->dev, "cannot get sys clock resource\n");
> > >
> > >  	/* Set up raw & hw decoder */
> > >  	error = img_ir_probe_raw(priv);
> > > @@ -152,6 +155,8 @@ static int img_ir_remove(struct platform_device
> > > *pdev)
> > >
> > >  	if (!IS_ERR(priv->clk))
> > >  		clk_disable_unprepare(priv->clk);
> > > +	if (!IS_ERR(priv->sys_clk))
> > > +		clk_disable_unprepare(priv->sys_clk);
> > >  	return 0;
> > >  }
> > >
> > > diff --git a/drivers/media/rc/img-ir/img-ir.h
> > > b/drivers/media/rc/img-ir/img-ir.h
> > > index 2ddf560..f1387c0 100644
> > > --- a/drivers/media/rc/img-ir/img-ir.h
> > > +++ b/drivers/media/rc/img-ir/img-ir.h
> > > @@ -138,6 +138,7 @@ struct clk;
> > >   * @dev:		Platform device.
> > >   * @irq:		IRQ number.
> > >   * @clk:		Input clock.
> > > + * @sys_clk:		System clock.
> > >   * @reg_base:		Iomem base address of IR register block.
> > >   * @lock:		Protects IR registers and variables in this struct.
> > >   * @raw:		Driver data for raw decoder.
> > > @@ -147,6 +148,7 @@ struct img_ir_priv {
> > >  	struct device		*dev;
> > >  	int			irq;
> > >  	struct clk		*clk;
> > > +	struct clk		*sys_clk;
> > >  	void __iomem		*reg_base;
> > >  	spinlock_t		lock;
> > >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] rc: img-ir: Add and enable sys clock for IR
  2015-04-08 14:40     ` Mauro Carvalho Chehab
@ 2015-04-09  8:51       ` Sifan Naeem
  0 siblings, 0 replies; 6+ messages in thread
From: Sifan Naeem @ 2015-04-09  8:51 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: James Hogan, linux-kernel, linux-media

Hi Mauro,

Seems like you have applied the correct patch after all. ([v2] rc: img-ir: Add and enable sys clock for img-ir)

Thanks,
Sifan

> -----Original Message-----
> From: Mauro Carvalho Chehab [mailto:mchehab@osg.samsung.com]
> Sent: 08 April 2015 15:41
> To: Sifan Naeem
> Cc: James Hogan; linux-kernel@vger.kernel.org; linux-
> media@vger.kernel.org
> Subject: Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
> 
> Em Wed, 08 Apr 2015 13:56:14 +0000
> Sifan Naeem <Sifan.Naeem@imgtec.com> escreveu:
> 
> > Hi Mauro,
> >
> > I sent you a v2 of this patch on 4th February:
> >
> > From: Sifan Naeem
> > Sent: 04 February 2015 16:48
> > To: James Hogan; mchehab@osg.samsung.com
> > Cc: linux-kernel@vger.kernel.org; linux-media@vger.kernel.org; Sifan
> > Naeem
> > Subject: [PATCH v2] rc: img-ir: Add and enable sys clock for img-ir
> >
> >
> > Unfortunately, while trying to improve the commit message in v2 I had
> changed the last word of the patch name from IR to img-ir.
> >
> > Do you want me to do a diff between the 2 patches and send you a new
> patch?
> 
> Yes, please do that, changing the patch name/description to reflect what
> changed since v1.
> 
> Regards,
> Mauro
> 
> >
> > Sifan
> >
> > > -----Original Message-----
> > > From: Mauro Carvalho Chehab [mailto:mchehab@osg.samsung.com]
> > > Sent: 08 April 2015 12:32
> > > To: Sifan Naeem
> > > Cc: James Hogan; linux-kernel@vger.kernel.org; linux-
> > > media@vger.kernel.org
> > > Subject: Re: [PATCH] rc: img-ir: Add and enable sys clock for IR
> > >
> > > Em Tue, 3 Feb 2015 17:30:29 +0000
> > > Sifan Naeem <sifan.naeem@imgtec.com> escreveu:
> > >
> > > > Gets a handle to the system clock, already described in the
> > > > binding document, and calls the appropriate common clock framework
> > > > functions to mark it prepared/enabled, the common clock framework
> > > > initially enables the clock and doesn't disable it at least until
> > > > the device/driver is removed.
> > > > The system clock to IR is needed for the driver to communicate
> > > > with the IR hardware via MMIO accesses on the system bus, so it
> > > > must not be disabled during use or the driver will malfunction.
> > >
> > > Hmm... patchwork has two versions of this patch, but I have only one
> > > on my e-mail.
> > >
> > > Could you please check if I applied the right one? If not, please
> > > send me an email with a fixup patch.
> > >
> > > Thanks!
> > > Mauro
> > >
> > > >
> > > > Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> > > > ---
> > > >  drivers/media/rc/img-ir/img-ir-core.c |   13 +++++++++----
> > > >  drivers/media/rc/img-ir/img-ir.h      |    2 ++
> > > >  2 files changed, 11 insertions(+), 4 deletions(-)
> > > >
> > > > diff --git a/drivers/media/rc/img-ir/img-ir-core.c
> > > > b/drivers/media/rc/img-ir/img-ir-core.c
> > > > index 77c78de..783dd21 100644
> > > > --- a/drivers/media/rc/img-ir/img-ir-core.c
> > > > +++ b/drivers/media/rc/img-ir/img-ir-core.c
> > > > @@ -60,6 +60,8 @@ static void img_ir_setup(struct img_ir_priv
> > > > *priv)
> > > >
> > > >  	if (!IS_ERR(priv->clk))
> > > >  		clk_prepare_enable(priv->clk);
> > > > +	if (!IS_ERR(priv->sys_clk))
> > > > +		clk_prepare_enable(priv->sys_clk);
> > > >  }
> > > >
> > > >  static void img_ir_ident(struct img_ir_priv *priv) @@ -110,10
> > > > +112,11 @@ static int img_ir_probe(struct platform_device *pdev)
> > > >  	priv->clk = devm_clk_get(&pdev->dev, "core");
> > > >  	if (IS_ERR(priv->clk))
> > > >  		dev_warn(&pdev->dev, "cannot get core clock resource\n");
> > > > -	/*
> > > > -	 * The driver doesn't need to know about the system ("sys") or
> > > power
> > > > -	 * modulation ("mod") clocks yet
> > > > -	 */
> > > > +
> > > > +	/* Get sys clock */
> > > > +	priv->sys_clk = devm_clk_get(&pdev->dev, "sys");
> > > > +	if (IS_ERR(priv->sys_clk))
> > > > +		dev_warn(&pdev->dev, "cannot get sys clock resource\n");
> > > >
> > > >  	/* Set up raw & hw decoder */
> > > >  	error = img_ir_probe_raw(priv);
> > > > @@ -152,6 +155,8 @@ static int img_ir_remove(struct
> > > > platform_device
> > > > *pdev)
> > > >
> > > >  	if (!IS_ERR(priv->clk))
> > > >  		clk_disable_unprepare(priv->clk);
> > > > +	if (!IS_ERR(priv->sys_clk))
> > > > +		clk_disable_unprepare(priv->sys_clk);
> > > >  	return 0;
> > > >  }
> > > >
> > > > diff --git a/drivers/media/rc/img-ir/img-ir.h
> > > > b/drivers/media/rc/img-ir/img-ir.h
> > > > index 2ddf560..f1387c0 100644
> > > > --- a/drivers/media/rc/img-ir/img-ir.h
> > > > +++ b/drivers/media/rc/img-ir/img-ir.h
> > > > @@ -138,6 +138,7 @@ struct clk;
> > > >   * @dev:		Platform device.
> > > >   * @irq:		IRQ number.
> > > >   * @clk:		Input clock.
> > > > + * @sys_clk:		System clock.
> > > >   * @reg_base:		Iomem base address of IR register block.
> > > >   * @lock:		Protects IR registers and variables in this struct.
> > > >   * @raw:		Driver data for raw decoder.
> > > > @@ -147,6 +148,7 @@ struct img_ir_priv {
> > > >  	struct device		*dev;
> > > >  	int			irq;
> > > >  	struct clk		*clk;
> > > > +	struct clk		*sys_clk;
> > > >  	void __iomem		*reg_base;
> > > >  	spinlock_t		lock;
> > > >

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-04-09 10:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-03 17:30 [PATCH] rc: img-ir: Add and enable sys clock for IR Sifan Naeem
2015-02-04 10:15 ` James Hogan
2015-04-08 11:32 ` Mauro Carvalho Chehab
2015-04-08 13:56   ` Sifan Naeem
2015-04-08 14:40     ` Mauro Carvalho Chehab
2015-04-09  8:51       ` Sifan Naeem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).