Skip to contentSkip to conversation

ARM: S3C64XX: Add s3c64xx support to touchscreen driver

PATCH New Maurus Cuelenaere 3 participants 6 messages Jan 22, 2010 – Jan 26, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 ARM: S3C64XX: Add s3c64xx support to touchscreen driver

ARM: S3C64XX: Add s3c64xx support to touchscreen driver

This ack's the extra interrupt s3c64xx platforms have in the touchscreen driver.

---
 drivers/input/touchscreen/Kconfig      |    6 +++---
 drivers/input/touchscreen/s3c2410_ts.c |   28 ++++++++++++++++++++++++----
 2 files changed, 27 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/input/touchscreen/Kconfig
index dfafc76..0378b3d 100644

drivers/input/touchscreen/Kconfig +3 -3
@@ -146,11 +146,11 @@ config TOUCHSCREEN_FUJITSU
 	  module will be called fujitsu-ts.
 
 config TOUCHSCREEN_S3C2410
-	tristate "Samsung S3C2410 touchscreen input driver"
-	depends on ARCH_S3C2410
+	tristate "Samsung S3C touchscreen input driver"
+	depends on ARCH_S3C2410 || ARCH_S3C64XX
 	select S3C24XX_ADC
 	help
-	  Say Y here if you have the s3c2410 touchscreen.
+	  Say Y here if you have the s3c touchscreen.
 
 	  If unsure, say N.
 
(quoted diff) +0 -0

b/drivers/input/touchscreen/s3c2410_ts.c
index 3debbc2..7dfbc38 100644

drivers/input/touchscreen/s3c2410_ts.c +17 -0
@@ -40,7 +40,9 @@
 #include <plat/regs-adc.h>
 #include <plat/ts.h>
 
+#ifdef PLAT_S3C24XX
 #include <mach/regs-gpio.h>
+#endif
 
 #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
@@ -88,6 +90,12 @@ struct s3c2410ts {
 
 static struct s3c2410ts ts;
 
+enum s3c_cpu_type {
+	TYPE_S3C2410,
+	TYPE_S3C2440,
+	TYPE_S3C64XX,
+};
+
 /**
  * s3c2410_ts_connect - configure gpio for s3c2410 systems
  *
@@ -95,6 +103,7 @@ static struct s3c2410ts ts;
  * connected to the device (later systems such as the S3C2440 integrate
  * these into the device).
 */
+#ifdef PLAT_S3C24XX
 static inline void s3c2410_ts_connect(void)
 {
 	s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);
@@ -102,6 +111,7 @@ static inline void s3c2410_ts_connect(void)
 	s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
 	s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
 }
+#endif
 
 /**
  * get_down - return the down state of the pen
@@ -169,6 +179,7 @@ static DEFINE_TIMER(touch_timer, touch_timer_fire, 0, 0);
  */
 static irqreturn_t stylus_irq(int irq, void *dev_id)
 {
+	struct platform_device *pdev = to_platform_device(ts.dev);
 	unsigned long data0;
 	unsigned long data1;
 	bool down;
@@ -187,6 +198,12 @@ static irqreturn_t stylus_irq(int irq, void *dev_id)
 	else
 		dev_info(ts.dev, "%s: count=%d\n", __func__, ts.count);
 
+
+	if (platform_get_device_id(pdev)->driver_data == TYPE_S3C64XX) {
+		/* Clear pen down/up interrupt */
+		writel(0x0, ts.io + S3C64XX_ADCCLRINTPNDNUP);
+	}
+
 	return IRQ_HANDLED;
 }
 
@@ -295,9 +312,11 @@ static int __devinit s3c2410ts_probe(struct

platform_device *pdev)
goto err_clk;
}

+#ifdef PLAT_S3C24XX
/* Configure the touchscreen external FETs on the S3C2410 */
- if (!platform_get_device_id(pdev)->driver_data)
+ if (platform_get_device_id(pdev)->driver_data == TYPE_S3C2410)
s3c2410_ts_connect();
+#endif

ts.client = s3c_adc_register(pdev, s3c24xx_ts_select,
s3c24xx_ts_conversion, 1);
@@ -418,15 +437,16 @@ static struct dev_pm_ops s3c_ts_pmops = {
#endif

static struct platform_device_id s3cts_driver_ids[] = {
- { "s3c2410-ts", 0 },
- { "s3c2440-ts", 1 },
+ { "s3c2410-ts", TYPE_S3C2410 },
+ { "s3c2440-ts", TYPE_S3C2440 },
+ { "s3c64xx-ts", TYPE_S3C64XX },
{ }
};
MODULE_DEVICE_TABLE(platform, s3cts_driver_ids);

static struct platform_driver s3c_ts_driver = {
.driver = {

-		.name   = "s3c24xx-ts",
+		.name   = "s3c-ts",
 		.owner  = THIS_MODULE,

#ifdef CONFIG_PM
.pm = &s3c_ts_pmops,

Signature · 1 line
1.6.6.1
#1 lore raw

PATCH 4/4 ARM: S3C64XX: Add s3c64xx support to touchscreen driver

Maurus Cuelenaere <[email protected]> writes:

Hi,

Quoted 67 lines

ARM: S3C64XX: Add s3c64xx support to touchscreen driver

This ack's the extra interrupt s3c64xx platforms have in the touchscreen driver.

---
 drivers/input/touchscreen/Kconfig      |    6 +++---
 drivers/input/touchscreen/s3c2410_ts.c |   28 ++++++++++++++++++++++++----
 2 files changed, 27 insertions(+), 7 deletions(-)
drivers/input/touchscreen/Kconfig +3 -3
index dfafc76..0378b3d 100644
@@ -146,11 +146,11 @@ config TOUCHSCREEN_FUJITSU
 	  module will be called fujitsu-ts.
 
 config TOUCHSCREEN_S3C2410
-	tristate "Samsung S3C2410 touchscreen input driver"
-	depends on ARCH_S3C2410
+	tristate "Samsung S3C touchscreen input driver"
+	depends on ARCH_S3C2410 || ARCH_S3C64XX
 	select S3C24XX_ADC
 	help
-	  Say Y here if you have the s3c2410 touchscreen.
+	  Say Y here if you have the s3c touchscreen.
 
 	  If unsure, say N.
 
drivers/input/touchscreen/s3c2410_ts.c +9 -0
index 3debbc2..7dfbc38 100644
@@ -40,7 +40,9 @@
 #include <plat/regs-adc.h>
 #include <plat/ts.h>
 
+#ifdef PLAT_S3C24XX
 #include <mach/regs-gpio.h>
+#endif
 
 #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
@@ -88,6 +90,12 @@ struct s3c2410ts {
 
 static struct s3c2410ts ts;
 
+enum s3c_cpu_type {
+	TYPE_S3C2410,
+	TYPE_S3C2440,
+	TYPE_S3C64XX,
+};
+
 /**
  * s3c2410_ts_connect - configure gpio for s3c2410 systems
  *
@@ -95,6 +103,7 @@ static struct s3c2410ts ts;
  * connected to the device (later systems such as the S3C2440 integrate
  * these into the device).
 */
+#ifdef PLAT_S3C24XX
 static inline void s3c2410_ts_connect(void)
 {
 	s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);

drivers/input/touchscreen/s3c2410_ts.c static inline void s3c2410_ts_connect(void) · line 114

Quoted 4 lines
drivers/input/touchscreen/s3c2410_ts.c +1 -0
@@ -102,6 +111,7 @@ static inline void s3c2410_ts_connect(void)
 	s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
 	s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
 }
+#endif

Please, remove all theses #ifdef. I don't see the point of them as it's only few lines of C code and they don't get executed when running on other platforms than 2410.

Arnaud

#2 lore raw

PATCH 4/4 ARM: S3C64XX: Add s3c64xx support to touchscreen driver

Op 25-01-10 10:46, Arnaud Patard (Rtp) schreef:

Quoted 81 lines

Maurus Cuelenaere<[email protected]> writes:

Hi,

Quoted 67 lines

ARM: S3C64XX: Add s3c64xx support to touchscreen driver

This ack's the extra interrupt s3c64xx platforms have in the touchscreen driver.

---
  drivers/input/touchscreen/Kconfig      |    6 +++---
  drivers/input/touchscreen/s3c2410_ts.c |   28 ++++++++++++++++++++++++----
  2 files changed, 27 insertions(+), 7 deletions(-)
drivers/input/touchscreen/Kconfig +3 -3
index dfafc76..0378b3d 100644
@@ -146,11 +146,11 @@ config TOUCHSCREEN_FUJITSU
  	  module will be called fujitsu-ts.
 
  config TOUCHSCREEN_S3C2410
-	tristate "Samsung S3C2410 touchscreen input driver"
-	depends on ARCH_S3C2410
+	tristate "Samsung S3C touchscreen input driver"
+	depends on ARCH_S3C2410 || ARCH_S3C64XX
  	select S3C24XX_ADC
  	help
-	  Say Y here if you have the s3c2410 touchscreen.
+	  Say Y here if you have the s3c touchscreen.
 
  	  If unsure, say N.
 
drivers/input/touchscreen/s3c2410_ts.c +9 -0
index 3debbc2..7dfbc38 100644
@@ -40,7 +40,9 @@
  #include<plat/regs-adc.h>
  #include<plat/ts.h>
 
+#ifdef PLAT_S3C24XX
  #include<mach/regs-gpio.h>
+#endif
 
  #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
@@ -88,6 +90,12 @@ struct s3c2410ts {
 
  static struct s3c2410ts ts;
 
+enum s3c_cpu_type {
+	TYPE_S3C2410,
+	TYPE_S3C2440,
+	TYPE_S3C64XX,
+};
+
  /**
   * s3c2410_ts_connect - configure gpio for s3c2410 systems
   *
@@ -95,6 +103,7 @@ static struct s3c2410ts ts;
   * connected to the device (later systems such as the S3C2440 integrate
   * these into the device).
  */
+#ifdef PLAT_S3C24XX
  static inline void s3c2410_ts_connect(void)
  {
  	s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);

drivers/input/touchscreen/s3c2410_ts.c static inline void s3c2410_ts_connect(void) · line 115

Quoted 5 lines
drivers/input/touchscreen/s3c2410_ts.c +1 -0
@@ -102,6 +111,7 @@ static inline void s3c2410_ts_connect(void)
  	s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
  	s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
  }
+#endif
 

Please, remove all theses #ifdef. I don't see the point of them as it's only few lines of C code and they don't get executed when running on other platforms than 2410.

Quoted 2 lines

Arnaud

The problem is that s3c2410_gpio_cfgpin() and S3C2410_* isn't defined on S3C64XX builds so this gives implicit declaration errors.

Regards,
Maurus Cuelenaere

#3 lore raw

PATCH 4/4 ARM: S3C64XX: Add s3c64xx support to touchscreen driver

Maurus Cuelenaere <[email protected]> writes:

[...]

Quoted 41 lines
Quoted 41 lines
Quoted 32 lines
drivers/input/touchscreen/s3c2410_ts.c +9 -0
@@ -40,7 +40,9 @@
  #include<plat/regs-adc.h>
  #include<plat/ts.h>
 
+#ifdef PLAT_S3C24XX
  #include<mach/regs-gpio.h>
+#endif
 
  #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
@@ -88,6 +90,12 @@ struct s3c2410ts {
 
  static struct s3c2410ts ts;
 
+enum s3c_cpu_type {
+	TYPE_S3C2410,
+	TYPE_S3C2440,
+	TYPE_S3C64XX,
+};
+
  /**
   * s3c2410_ts_connect - configure gpio for s3c2410 systems
   *
@@ -95,6 +103,7 @@ static struct s3c2410ts ts;
   * connected to the device (later systems such as the S3C2440 integrate
   * these into the device).
  */
+#ifdef PLAT_S3C24XX
  static inline void s3c2410_ts_connect(void)
  {
  	s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);

drivers/input/touchscreen/s3c2410_ts.c static inline void s3c2410_ts_connect(void) · line 115

Quoted 5 lines
drivers/input/touchscreen/s3c2410_ts.c +1 -0
@@ -102,6 +111,7 @@ static inline void s3c2410_ts_connect(void)
  	s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
  	s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
  }
+#endif
 

Please, remove all theses #ifdef. I don't see the point of them as it's only few lines of C code and they don't get executed when running on other platforms than 2410.

Quoted 5 lines
Quoted 2 lines

Arnaud

The problem is that s3c2410_gpio_cfgpin() and S3C2410_* isn't defined on S3C64XX builds so this gives implicit declaration errors.

hmm... I didn't look in details but I thought such kind of issues was going to be fixed thanks to the changes in Ben's -next-* branches.

Arnaud

#4 lore raw

PATCH 4/4 ARM: S3C64XX: Add s3c64xx support to touchscreen driver

Op 25-01-10 11:22, Arnaud Patard (Rtp) schreef:

Quoted 47 lines

Maurus Cuelenaere<[email protected]> writes:

[...]

Quoted 42 lines
Quoted 42 lines
Quoted 32 lines
drivers/input/touchscreen/s3c2410_ts.c +9 -0
@@ -40,7 +40,9 @@
   #include<plat/regs-adc.h>
   #include<plat/ts.h>
 
+#ifdef PLAT_S3C24XX
   #include<mach/regs-gpio.h>
+#endif
 
   #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
@@ -88,6 +90,12 @@ struct s3c2410ts {
 
   static struct s3c2410ts ts;
 
+enum s3c_cpu_type {
+	TYPE_S3C2410,
+	TYPE_S3C2440,
+	TYPE_S3C64XX,
+};
+
   /**
    * s3c2410_ts_connect - configure gpio for s3c2410 systems
    *
@@ -95,6 +103,7 @@ static struct s3c2410ts ts;
    * connected to the device (later systems such as the S3C2440 integrate
    * these into the device).
   */
+#ifdef PLAT_S3C24XX
   static inline void s3c2410_ts_connect(void)
   {
   	s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);

drivers/input/touchscreen/s3c2410_ts.c static inline void s3c2410_ts_connect(void) · line 116

Quoted 6 lines
drivers/input/touchscreen/s3c2410_ts.c +1 -0
@@ -102,6 +111,7 @@ static inline void s3c2410_ts_connect(void)
   	s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
   	s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
   }
+#endif
 
 

Please, remove all theses #ifdef. I don't see the point of them as it's only few lines of C code and they don't get executed when running on other platforms than 2410.

Quoted 6 lines
Quoted 3 lines

The problem is that s3c2410_gpio_cfgpin() and S3C2410_* isn't defined on S3C64XX builds so this gives implicit declaration errors.

hmm... I didn't look in details but I thought such kind of issues was going to be fixed thanks to the changes in Ben's -next-* branches.

Hmm I checked next-samsung but didn't see anything relevant.. Normally I check Ben's tree pretty regularly (this diff was based on an older next-samsung), so if he changes something I should pickup.

I can remove one pair of #ifdef's though, if I move the first one inside s3c2410_ts_connect() there's no need for the second one.

Regards,
Maurus Cuelenaere

#5 lore raw

PATCH 4/4 ARM: S3C64XX: Add s3c64xx support to touchscreen driver

In reply to Arnaud Patard (Rtp)
Quoted 45 lines · Arnaud Patard

Maurus Cuelenaere <[email protected]> writes:

[...]

Quoted 41 lines
Quoted 41 lines
Quoted 32 lines
drivers/input/touchscreen/s3c2410_ts.c +9 -0
@@ -40,7 +40,9 @@
  #include<plat/regs-adc.h>
  #include<plat/ts.h>
 
+#ifdef PLAT_S3C24XX
  #include<mach/regs-gpio.h>
+#endif
 
  #define TSC_SLEEP  (S3C2410_ADCTSC_PULL_UP_DISABLE | S3C2410_ADCTSC_XY_PST(0))
 
@@ -88,6 +90,12 @@ struct s3c2410ts {
 
  static struct s3c2410ts ts;
 
+enum s3c_cpu_type {
+	TYPE_S3C2410,
+	TYPE_S3C2440,
+	TYPE_S3C64XX,
+};
+
  /**
   * s3c2410_ts_connect - configure gpio for s3c2410 systems
   *
@@ -95,6 +103,7 @@ static struct s3c2410ts ts;
   * connected to the device (later systems such as the S3C2440 integrate
   * these into the device).
  */
+#ifdef PLAT_S3C24XX
  static inline void s3c2410_ts_connect(void)
  {
  	s3c2410_gpio_cfgpin(S3C2410_GPG(12), S3C2410_GPG12_XMON);

drivers/input/touchscreen/s3c2410_ts.c static inline void s3c2410_ts_connect(void) · line 115

Quoted 5 lines
drivers/input/touchscreen/s3c2410_ts.c +1 -0
@@ -102,6 +111,7 @@ static inline void s3c2410_ts_connect(void)
  	s3c2410_gpio_cfgpin(S3C2410_GPG(14), S3C2410_GPG14_YMON);
  	s3c2410_gpio_cfgpin(S3C2410_GPG(15), S3C2410_GPG15_nYPON);
  }
+#endif
 

Please, remove all theses #ifdef. I don't see the point of them as it's only few lines of C code and they don't get executed when running on other platforms than 2410.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Arnaud

The problem is that s3c2410_gpio_cfgpin() and S3C2410_* isn't defined on S3C64XX builds so this gives implicit declaration errors.

hmm... I didn't look in details but I thought such kind of issues was going to be fixed thanks to the changes in Ben's -next-* branches.

there's nothing currently in here to deal with this.

The thing is that will configuring the GPIOs to their special function before the driver is loaded do any damage to the SoC? If not then it may be worth moving the s3c2410 case into the machines that need it (iirc, about two so far) and simply remove it from the driver and thus avoid the need for S3C2410/S3C2440 detection. Input welcome.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.