All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] input:Add clk api support for w90p910 touchscreen
@ 2009-07-09  2:53 Wan ZongShun
  2009-07-09  5:11 ` Dmitry Torokhov
  0 siblings, 1 reply; 11+ messages in thread
From: Wan ZongShun @ 2009-07-09  2:53 UTC (permalink / raw)
  To: linux-arm-kernel, linux-input, Trilok Soni, Dmitry Torokhov

Dear sirs,

According to Trilok Soni's comments,I fixed up my ts patch again.

Thanks a lot for Trilok Soni's help.

Add clk api support for w90p910 touchscreen.

Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>

---
 drivers/input/touchscreen/w90p910_ts.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/drivers/input/touchscreen/w90p910_ts.c b/drivers/input/touchscreen/w90p910_ts.c
index 6071f58..639117a 100644
--- a/drivers/input/touchscreen/w90p910_ts.c
+++ b/drivers/input/touchscreen/w90p910_ts.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/clk.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
 
@@ -47,8 +48,8 @@ enum ts_state {
 struct w90p910_ts {
 	struct input_dev *input;
 	struct timer_list timer;
+	struct clk *clk;
 	int irq_num;
-	void __iomem *clocken;
 	void __iomem *ts_reg;
 	spinlock_t lock;
 	enum ts_state state;
@@ -166,8 +167,7 @@ static int w90p910_open(struct input_dev *dev)
 	unsigned long val;
 
 	/* enable the ADC clock */
-	val = __raw_readl(w90p910_ts->clocken);
-	__raw_writel(val | ADC_CLK_EN, w90p910_ts->clocken);
+	clk_enable(w90p910_ts->clk);
 
 	__raw_writel(ADC_RST1, w90p910_ts->ts_reg);
 	msleep(1);
@@ -211,8 +211,7 @@ static void w90p910_close(struct input_dev *dev)
 	del_timer_sync(&w90p910_ts->timer);
 
 	/* stop the ADC clock */
-	val = __raw_readl(w90p910_ts->clocken);
-	__raw_writel(val & ~ADC_CLK_EN, w90p910_ts->clocken);
+	clk_disable(w90p910_ts->clk);
 }
 
 static int __devinit w90x900ts_probe(struct platform_device *pdev)
@@ -253,14 +252,12 @@ static int __devinit w90x900ts_probe(struct platform_device *pdev)
 		goto fail2;
 	}
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
-	if (!res) {
-		err = -ENXIO;
+	w90p910_ts->clk = clk_get(&pdev->dev, NULL);
+	if (IS_ERR(w90p910_ts->clk)) {
+		err = PTR_ERR(w90p910_ts->clk);
 		goto fail3;
 	}
 
-	w90p910_ts->clocken = (void __iomem *)res->start;
-
 	input_dev->name = "W90P910 TouchScreen";
 	input_dev->phys = "w90p910ts/event0";
 	input_dev->id.bustype = BUS_HOST;
@@ -283,18 +280,19 @@ static int __devinit w90x900ts_probe(struct platform_device *pdev)
 	if (request_irq(w90p910_ts->irq_num, w90p910_ts_interrupt,
 			IRQF_DISABLED, "w90p910ts", w90p910_ts)) {
 		err = -EBUSY;
-		goto fail3;
+		goto fail4;
 	}
 
 	err = input_register_device(w90p910_ts->input);
 	if (err)
-		goto fail4;
+		goto fail5;
 
 	platform_set_drvdata(pdev, w90p910_ts);
 
 	return 0;
 
-fail4:	free_irq(w90p910_ts->irq_num, w90p910_ts);
+fail5:	free_irq(w90p910_ts->irq_num, w90p910_ts);
+fail4:	clk_put(w90p910_ts->clk);
 fail3:	iounmap(w90p910_ts->ts_reg);
 fail2:	release_mem_region(res->start, res->end - res->start + 1);
 fail1:	input_free_device(input_dev);
@@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
 	del_timer_sync(&w90p910_ts->timer);
 	iounmap(w90p910_ts->ts_reg);
 
+	clk_disable(w90p910_ts->clk);
+	clk_put(w90p910_ts->clk);
+
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(res->start, res->end - res->start + 1);
 
-- 
1.5.6.3

Wan.

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  2:53 [PATCH v2] input:Add clk api support for w90p910 touchscreen Wan ZongShun
@ 2009-07-09  5:11 ` Dmitry Torokhov
  2009-07-09  5:14   ` Wan ZongShun
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Torokhov @ 2009-07-09  5:11 UTC (permalink / raw)
  To: Wan ZongShun; +Cc: linux-arm-kernel, linux-input, Trilok Soni

Hi Wan,

On Thu, Jul 09, 2009 at 10:53:18AM +0800, Wan ZongShun wrote:
> @@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
>  	del_timer_sync(&w90p910_ts->timer);
>  	iounmap(w90p910_ts->ts_reg);
>  
> +	clk_disable(w90p910_ts->clk);

This disable is unneeded since we already disable clock in close(). I
will fix locally and apply, there is no need to resubmit. I will also
fix pxa27 driver.

Thanks!

-- 
Dmitry

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  5:11 ` Dmitry Torokhov
@ 2009-07-09  5:14   ` Wan ZongShun
  2009-07-09  6:29     ` Dmitry Torokhov
  0 siblings, 1 reply; 11+ messages in thread
From: Wan ZongShun @ 2009-07-09  5:14 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-arm-kernel, linux-input, Trilok Soni

Dmitry Torokhov 写道:
> Hi Wan,
> 
> On Thu, Jul 09, 2009 at 10:53:18AM +0800, Wan ZongShun wrote:
>> @@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
>>  	del_timer_sync(&w90p910_ts->timer);
>>  	iounmap(w90p910_ts->ts_reg);
>>  
>> +	clk_disable(w90p910_ts->clk);
> 
> This disable is unneeded since we already disable clock in close(). I
> will fix locally and apply, there is no need to resubmit. I will also
> fix pxa27 driver.

Okay, got it, thanks for your help!

> Thanks!
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  5:14   ` Wan ZongShun
@ 2009-07-09  6:29     ` Dmitry Torokhov
  2009-07-09  7:01       ` Wan ZongShun
  2009-07-09  7:37       ` Baruch Siach
  0 siblings, 2 replies; 11+ messages in thread
From: Dmitry Torokhov @ 2009-07-09  6:29 UTC (permalink / raw)
  To: Wan ZongShun; +Cc: linux-arm-kernel, linux-input, Trilok Soni

On Thu, Jul 09, 2009 at 01:14:36PM +0800, Wan ZongShun wrote:
> Dmitry Torokhov 写道:
> > Hi Wan,
> > 
> > On Thu, Jul 09, 2009 at 10:53:18AM +0800, Wan ZongShun wrote:
> >> @@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
> >>  	del_timer_sync(&w90p910_ts->timer);
> >>  	iounmap(w90p910_ts->ts_reg);
> >>  
> >> +	clk_disable(w90p910_ts->clk);
> > 
> > This disable is unneeded since we already disable clock in close(). I
> > will fix locally and apply, there is no need to resubmit. I will also
> > fix pxa27 driver.
> 
> Okay, got it, thanks for your help!
> 

Umm, one more thing - we need to add "depends on" to Kconfig since
clk API is not implemented on every platform. Any ideas what is the
most wide dependency is?

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  6:29     ` Dmitry Torokhov
@ 2009-07-09  7:01       ` Wan ZongShun
  2009-07-09  7:37       ` Baruch Siach
  1 sibling, 0 replies; 11+ messages in thread
From: Wan ZongShun @ 2009-07-09  7:01 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-arm-kernel, linux-input, Trilok Soni

Dear Dmitry,

Please see below.


Dmitry Torokhov:
> On Thu, Jul 09, 2009 at 01:14:36PM +0800, Wan ZongShun wrote:
>> Dmitry Torokhov 写道:
>>> Hi Wan,
>>>
>>> On Thu, Jul 09, 2009 at 10:53:18AM +0800, Wan ZongShun wrote:
>>>> @@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
>>>>  	del_timer_sync(&w90p910_ts->timer);
>>>>  	iounmap(w90p910_ts->ts_reg);
>>>>  
>>>> +	clk_disable(w90p910_ts->clk);
>>> This disable is unneeded since we already disable clock in close(). I
>>> will fix locally and apply, there is no need to resubmit. I will also
>>> fix pxa27 driver.
>> Okay, got it, thanks for your help!
>>
> 
> Umm, one more thing - we need to add "depends on" to Kconfig since
> clk API is not implemented on every platform. Any ideas what is the
> most wide dependency is?
> 

Do you mean that w90p910 ts have missed this "depends on"?
Adding this depends as following:

config TOUCHSCREEN_W90X900
	tristate "W90P910 touchscreen driver"
	depends on ARCH_W90X900
	help
	  Say Y here if you have a W90P910 based touchscreen.

	  To compile this driver as a module, choose M here: the
	  module will be called w90p910_ts.

Is it okay, now?
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  6:29     ` Dmitry Torokhov
  2009-07-09  7:01       ` Wan ZongShun
@ 2009-07-09  7:37       ` Baruch Siach
  2009-07-09  8:54         ` Dmitry Torokhov
  1 sibling, 1 reply; 11+ messages in thread
From: Baruch Siach @ 2009-07-09  7:37 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Wan ZongShun, linux-arm-kernel, linux-input, Trilok Soni

Hi Dmitry,

On Wed, Jul 08, 2009 at 11:29:29PM -0700, Dmitry Torokhov wrote:
> On Thu, Jul 09, 2009 at 01:14:36PM +0800, Wan ZongShun wrote:
> > Dmitry Torokhov 写道:
> > > Hi Wan,
> > > 
> > > On Thu, Jul 09, 2009 at 10:53:18AM +0800, Wan ZongShun wrote:
> > >> @@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
> > >>  	del_timer_sync(&w90p910_ts->timer);
> > >>  	iounmap(w90p910_ts->ts_reg);
> > >>  
> > >> +	clk_disable(w90p910_ts->clk);
> > > 
> > > This disable is unneeded since we already disable clock in close(). I
> > > will fix locally and apply, there is no need to resubmit. I will also
> > > fix pxa27 driver.
> > 
> > Okay, got it, thanks for your help!
> > 
> 
> Umm, one more thing - we need to add "depends on" to Kconfig since
> clk API is not implemented on every platform. Any ideas what is the
> most wide dependency is?

The most wide dependency for the clk API is HAVE_CLK.

baruch

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  7:37       ` Baruch Siach
@ 2009-07-09  8:54         ` Dmitry Torokhov
  2009-07-09  9:00           ` Wan ZongShun
  0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Torokhov @ 2009-07-09  8:54 UTC (permalink / raw)
  To: Baruch Siach; +Cc: Wan ZongShun, linux-arm-kernel, linux-input, Trilok Soni

On Thu, Jul 09, 2009 at 10:37:03AM +0300, Baruch Siach wrote:
> Hi Dmitry,
> 
> On Wed, Jul 08, 2009 at 11:29:29PM -0700, Dmitry Torokhov wrote:
> > On Thu, Jul 09, 2009 at 01:14:36PM +0800, Wan ZongShun wrote:
> > > Dmitry Torokhov 写道:
> > > > Hi Wan,
> > > > 
> > > > On Thu, Jul 09, 2009 at 10:53:18AM +0800, Wan ZongShun wrote:
> > > >> @@ -311,6 +309,9 @@ static int __devexit w90x900ts_remove(struct platform_device *pdev)
> > > >>  	del_timer_sync(&w90p910_ts->timer);
> > > >>  	iounmap(w90p910_ts->ts_reg);
> > > >>  
> > > >> +	clk_disable(w90p910_ts->clk);
> > > > 
> > > > This disable is unneeded since we already disable clock in close(). I
> > > > will fix locally and apply, there is no need to resubmit. I will also
> > > > fix pxa27 driver.
> > > 
> > > Okay, got it, thanks for your help!
> > > 
> > 
> > Umm, one more thing - we need to add "depends on" to Kconfig since
> > clk API is not implemented on every platform. Any ideas what is the
> > most wide dependency is?
> 
> The most wide dependency for the clk API is HAVE_CLK.
> 

Cool, thanks.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  8:54         ` Dmitry Torokhov
@ 2009-07-09  9:00           ` Wan ZongShun
  2009-07-09  9:06             ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Wan ZongShun @ 2009-07-09  9:00 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Baruch Siach, linux-arm-kernel, linux-input, Trilok Soni

Dear Dmitry,

>>> Umm, one more thing - we need to add "depends on" to Kconfig since
>>> clk API is not implemented on every platform. Any ideas what is the
>>> most wide dependency is?
>> The most wide dependency for the clk API is HAVE_CLK.
>>
> 
> Cool, thanks.
> 
Sure, but why to add it to touchscreen's kconfig?
it seems it should be put arch/arm/kconfig.

In addition,I never use this HAVE_CLK in ARCH_W90X900, 
only using COMMON_CLKDEV to support clk API. 

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  9:00           ` Wan ZongShun
@ 2009-07-09  9:06             ` Russell King - ARM Linux
  2009-07-09  9:23               ` Wan ZongShun
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2009-07-09  9:06 UTC (permalink / raw)
  To: Wan ZongShun
  Cc: Dmitry Torokhov, Baruch Siach, linux-arm-kernel, linux-input,
	Trilok Soni

On Thu, Jul 09, 2009 at 05:00:39PM +0800, Wan ZongShun wrote:
> Dear Dmitry,
> 
> >>> Umm, one more thing - we need to add "depends on" to Kconfig since
> >>> clk API is not implemented on every platform. Any ideas what is the
> >>> most wide dependency is?
> >> The most wide dependency for the clk API is HAVE_CLK.
> >>
> > 
> > Cool, thanks.
> > 
> Sure, but why to add it to touchscreen's kconfig?
> it seems it should be put arch/arm/kconfig.
> 
> In addition,I never use this HAVE_CLK in ARCH_W90X900, 
> only using COMMON_CLKDEV to support clk API. 

HAVE_CLK is the configuration symbol which tells the rest of the kernel
configuration system that the clk API is available.  Drivers using the
clk API should depend on HAVE_CLK.

COMMON_CLKDEV is just one implementation of a subset of the clk API, and
nothing should ever depend on this symbol.

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  9:06             ` Russell King - ARM Linux
@ 2009-07-09  9:23               ` Wan ZongShun
  2009-07-11 15:33                 ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Wan ZongShun @ 2009-07-09  9:23 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Dmitry Torokhov, Baruch Siach, linux-arm-kernel, linux-input,
	Trilok Soni

Dear Russell,


>>>>> Umm, one more thing - we need to add "depends on" to Kconfig since
>>>>> clk API is not implemented on every platform. Any ideas what is the
>>>>> most wide dependency is?
>>>> The most wide dependency for the clk API is HAVE_CLK.
>>>>
>>> Cool, thanks.
>>>
>> Sure, but why to add it to touchscreen's kconfig?
>> it seems it should be put arch/arm/kconfig.
>>
>> In addition,I never use this HAVE_CLK in ARCH_W90X900, 
>> only using COMMON_CLKDEV to support clk API. 
> 
> HAVE_CLK is the configuration symbol which tells the rest of the kernel
> configuration system that the clk API is available.  Drivers using the
> clk API should depend on HAVE_CLK.
> 
> COMMON_CLKDEV is just one implementation of a subset of the clk API, and
> nothing should ever depend on this symbol.
> 
 Maybe I should add this "select HAVE_CLK" to arch/arm/Kconfig too, as following:

config ARCH_W90X900
	bool "Nuvoton W90X900 CPU"
	select CPU_ARM926T
	select ARCH_REQUIRE_GPIOLIB
	select GENERIC_GPIO
	select COMMON_CLKDEV
	select HAVE_CLK

Is it right?

-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

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

* Re: [PATCH v2] input:Add clk api support for w90p910 touchscreen
  2009-07-09  9:23               ` Wan ZongShun
@ 2009-07-11 15:33                 ` Russell King - ARM Linux
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2009-07-11 15:33 UTC (permalink / raw)
  To: Wan ZongShun
  Cc: Dmitry Torokhov, Baruch Siach, linux-arm-kernel, linux-input,
	Trilok Soni

On Thu, Jul 09, 2009 at 05:23:18PM +0800, Wan ZongShun wrote:
> config ARCH_W90X900
> 	bool "Nuvoton W90X900 CPU"
> 	select CPU_ARM926T
> 	select ARCH_REQUIRE_GPIOLIB
> 	select GENERIC_GPIO
> 	select COMMON_CLKDEV
> 	select HAVE_CLK
> 
> Is it right?

Yes.

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

end of thread, other threads:[~2009-07-11 15:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09  2:53 [PATCH v2] input:Add clk api support for w90p910 touchscreen Wan ZongShun
2009-07-09  5:11 ` Dmitry Torokhov
2009-07-09  5:14   ` Wan ZongShun
2009-07-09  6:29     ` Dmitry Torokhov
2009-07-09  7:01       ` Wan ZongShun
2009-07-09  7:37       ` Baruch Siach
2009-07-09  8:54         ` Dmitry Torokhov
2009-07-09  9:00           ` Wan ZongShun
2009-07-09  9:06             ` Russell King - ARM Linux
2009-07-09  9:23               ` Wan ZongShun
2009-07-11 15:33                 ` Russell King - ARM Linux

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.