# \[PATCH v2 0/5\] ARM OMAP3530evm misc fixes for linux-omap

- Subsystems: INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN) DRIVERS, ARM PORT, MULTIFUNCTION DEVICES (MFD), OMAP CLOCK FRAMEWORK SUPPORT, OMAP2+ SUPPORT, THE REST
- Maintainers: Dmitry Torokhov, Russell King, Lee Jones, Paul Walmsley, Aaro Koskinen, Andreas Kemnade, Kevin Hilman, Roger Quadros, Tony Lindgren, Linus Torvalds
- Series: 5 patches touching 4 files, +84/-1
- Status: PENDING · 1 of 5 reviewed
- Pending, 1 of 5 reviewed.
- List: linux-input
- 25 messages, 6 authors
- Page: https://ratatoskr.run/linux-input/2012/06/8609178/t

## \[PATCH v2 0/5\] ARM OMAP3530evm misc fixes for linux-omap

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 01:44:05 
- Message: https://ratatoskr.run/linux-input/2012/06/8609178.md

```text
These patches fix misc problems when reflash ti-omap3530evm for
master branch on Linux-omap.

The series is based upon the latest linux-omap master branch from
Tony (3.5-rc1).

Changes vs V1:

 1. NAND flash definition changes as Jon's comments.
 2. Add more shortlog for VBUS switch from a kind people.
 3. Jon's cosmetic fix seems more fit.
 4. Debounce time I still leave a ugly hardcode in driver level
    with bracketing by ARCH_OMAP3. Anyway, Igor's comments are
    more sense.

 If you guy don't like patch 4 or 5, feel free to drop them :-)
 I'm OK for that, thanks all of your kind RR from Jon, Igor, and
 Tony.

 Zumeng Chen (5):
      ARM: OMAP3EVM: Add NAND flash definition
      ARM: OMAP3EVM: Adding USB internal LDOs board file
      ARM: omap3evm: enable VBUS switch for EHCI tranceiver
      ARM: OMAP3EVM: cosmetic fixes for parent clk set
      Input: ads7846: set proper debounce time in driver level

 arch/arm/mach-omap2/board-omap3evm.c |   75 ++++++++++++++++++++++++++++++++++
 arch/arm/plat-omap/clock.c           |    4 ++
 drivers/input/touchscreen/ads7846.c  |    4 ++
 drivers/mfd/omap-usb-host.c          |    2 +-
 4 files changed, 84 insertions(+), 1 deletions(-)
 

```

## \[PATCH V2 1/5\] ARM: OMAP3EVM: Add NAND flash definition

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 01:44:06 
- Message: https://ratatoskr.run/linux-input/2012/06/8609180.md

```text
From: Zumeng Chen <redacted>

Signed-off-by: Vaibhav Hiremath <redacted>
Tested-by: Zumeng Chen <redacted>
---
 arch/arm/mach-omap2/board-omap3evm.c |   39 ++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 639bd07..0b83d0e 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -24,6 +24,10 @@
 #include <linux/leds.h>
 #include <linux/interrupt.h>
 
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/nand.h>
+
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl.h>
@@ -43,6 +47,7 @@
 
 #include <plat/board.h>
 #include <plat/usb.h>
+#include <plat/nand.h>
 #include "common.h"
 #include <plat/mcspi.h>
 #include <video/omapdss.h>
@@ -607,6 +612,37 @@ static struct regulator_consumer_supply dummy_supplies[] = {
 	REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
 };
 
+static struct mtd_partition omap3evm_nand_partitions[] = {
+	/* All the partition sizes are listed in terms of NAND block size */
+	{
+		.name           = "X-Loader",
+		.offset         = 0,
+		.size           = 4*(SZ_128K),
+		.mask_flags     = MTD_WRITEABLE
+	},
+	{
+		.name           = "U-Boot",
+		.offset         = MTDPART_OFS_APPEND,
+		.size           = 14*(SZ_128K),
+		.mask_flags     = MTD_WRITEABLE
+	},
+	{
+		.name           = "U-Boot Env",
+		.offset         = MTDPART_OFS_APPEND,
+		.size           = 2*(SZ_128K)
+	},
+	{
+		.name           = "Kernel",
+		.offset         = MTDPART_OFS_APPEND,
+		.size           = 40*(SZ_128K)
+	},
+	{
+		.name           = "File system",
+		.size           = MTDPART_SIZ_FULL,
+		.offset         = MTDPART_OFS_APPEND,
+	},
+};
+
 static void __init omap3_evm_init(void)
 {
 	struct omap_board_mux *obm;
@@ -656,6 +692,9 @@ static void __init omap3_evm_init(void)
 	}
 	usb_musb_init(&musb_board_data);
 	usbhs_init(&usbhs_bdata);
+	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
+			     ARRAY_SIZE(omap3evm_nand_partitions));
+
 	omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
 	omap3evm_init_smsc911x();
 	omap3_evm_display_init();
-- 
1.7.5.4

```

## \[PATCH V2 2/5\] ARM: OMAP3EVM: Adding USB internal LDOs board file

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 01:44:07 
- Message: https://ratatoskr.run/linux-input/2012/06/8609179.md

```text
From: Zumeng Chen <redacted>

EHCI PHY requires these regulators:
        EVM Rev >=E  --> VAUX2
        EVM Rev < E  --> VUSB1V5, VUSB1V8

Adding USB internal LDOs (vusb1v5 & vusb1v8) and VAUX2 to omap3evm
board file. Also removing vaux2_{1/2/3} supplies as they are not
used on omap3 evm.

But we need not to add vaux2 in twl4030_platform_data since it will
be added conditionally.

Signed-off-by: Ajay Kumar Gupta <redacted>
Signed-off-by: Vaibhav Hiremath <redacted>
Signed-off-by: Zumeng Chen <redacted>
---
 arch/arm/mach-omap2/board-omap3evm.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 0b83d0e..3c91534 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -466,6 +466,30 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
 };
 #endif
 
+/* VAUX2 for USB */
+static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
+	REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"),	/* OMAP ISP */
+	REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"),	/* OMAP ISP */
+	REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
+	{
+		.supply		= "vaux2",
+	}
+};
+
+static struct regulator_init_data omap3evm_vaux2 = {
+	.constraints = {
+		.min_uV		= 2800000,
+		.max_uV		= 2800000,
+		.apply_uV	= true,
+		.valid_modes_mask	= REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask		= REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies		= ARRAY_SIZE(omap3evm_vaux2_supplies),
+	.consumer_supplies		= omap3evm_vaux2_supplies,
+};
+
 static struct twl4030_platform_data omap3evm_twldata = {
 	/* platform_data for children goes here */
 	.keypad		= &omap3evm_kp_data,
@@ -659,6 +683,9 @@ static void __init omap3_evm_init(void)
 	omap_mux_init_gpio(63, OMAP_PIN_INPUT);
 	omap_hsmmc_init(mmc);
 
+	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
+		omap3evm_twldata.vaux2 = &omap3evm_vaux2;
+
 	omap3_evm_i2c_init();
 
 	omap_display_init(&omap3_evm_dss_data);
-- 
1.7.5.4

```

## \[PATCH V2 3/5\] ARM: omap3evm: enable VBUS switch for EHCI tranceiver

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 01:44:08 
- Message: https://ratatoskr.run/linux-input/2012/06/8609181.md

```text
From: Zumeng Chen <redacted>

This was chosen by following the trace on the schematic from component U131
and U134 to the CPEN pin on the USB3320 device.

TWL4030.GPIO2-...->(T2_GPIO2_3V3)U131-..>nUSB2_EN-..>U134-..>EXP_nUSB2_1V8
which starts EHCI tranceiver USB3320.

This will set TWL4030.GPIO2 as output pin to drive EHCI tranceiver.

Signed-off-by: Ajay Kumar Gupta <redacted>
Signed-off-by: Zumeng Chen <redacted>
---
 arch/arm/mach-omap2/board-omap3evm.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 3c91534..63bb865 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -360,6 +360,15 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
 
 	platform_device_register(&leds_gpio);
 
+	/* Enable VBUS switch by setting TWL4030.GPIO2DIR as output
+	 * for starting USB tranceiver
+	 */
+	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
+		u8 val;
+		twl_i2c_read_u8(TWL4030_MODULE_GPIO, &val, REG_GPIODATADIR1);
+		val |= 0x04; /* TWL4030.GPIO2DIR BIT at GPIODATADIR1(0x9B) */
+		twl_i2c_write_u8(TWL4030_MODULE_GPIO, val, REG_GPIODATADIR1);
+	}
 	return 0;
 }
 
-- 
1.7.5.4

```

## \[PATCH V2 4/5\] ARM: OMAP3EVM: cosmetic fixes for parent clk set

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 01:44:09 
- Message: https://ratatoskr.run/linux-input/2012/06/8609182.md

```text
From: Zumeng Chen <redacted>

Since set parent for dummy clock will dump failed message,
so we can just ignore to mute it.

Signed-off-by: Signed-off-by: Jon Hunter <redacted>
Signed-off-by: Zumeng Chen <redacted>
---
 arch/arm/plat-omap/clock.c  |    4 ++++
 drivers/mfd/omap-usb-host.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 62ec5c4..c7e26e4 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -149,6 +149,10 @@ int clk_set_parent(struct clk *clk, struct clk *parent)
 	if (!arch_clock || !arch_clock->clk_set_parent)
 		return ret;
 
+	/* If the clock is a dummy clock just return */
+	if (clk == &dummy_ck)
+		return 0;
+
 	spin_lock_irqsave(&clockfw_lock, flags);
 	if (clk->usecount == 0) {
 		ret = arch_clock->clk_set_parent(clk, parent);
diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 7e96bb2..c9d27c4 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -699,7 +699,7 @@ static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 	}
 
 	if (is_ehci_phy_mode(pdata->port_mode[0])) {
-		/* for OMAP3 , the clk set paretn fails */
+		/* for OMAP3 , the clk set parent fails */
 		ret = clk_set_parent(omap->utmi_p1_fck,
 					omap->xclk60mhsp1_ck);
 		if (ret != 0)
-- 
1.7.5.4

```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 01:44:10 
- Message: https://ratatoskr.run/linux-input/2012/06/8609183.md

```text
From: Zumeng Chen <redacted>

If we don't set proper debouce time for ads7846, then there are
flooded interrupt counters of ads7846 responding to one time
touch on screen, so the driver couldn't work well.

And since most OMAP3 series boards pass NULL pointer of board_pdata
to omap_ads7846_init, so it's more proper to set it in driver level
after having gpio_request done.

This patch has been validated on 3530evm.

Signed-off-by: Zumeng Chen <redacted>
Signed-off-by: Syed Mohammed Khasim <redacted>
---
 drivers/input/touchscreen/ads7846.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index f02028e..459ff29 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
 		}
 
 		ts->gpio_pendown = pdata->gpio_pendown;
+#ifdef CONFIG_ARCH_OMAP3
+		/* 310 means about 10 microsecond for omap3 */
+		gpio_set_debounce(pdata->gpio_pendown, 310);
+#endif
 
 	} else {
 		dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
-- 
1.7.5.4

```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Igor Grinberg \<hidden\>
- Date: 2012-06-13 07:51:26 
- Message: https://ratatoskr.run/linux-input/2012/06/8609204.md

```text
On 06/13/12 04:44, Zumeng Chen wrote:
> From: Zumeng Chen <redacted>
> 
> If we don't set proper debouce time for ads7846, then there are
> flooded interrupt counters of ads7846 responding to one time
> touch on screen, so the driver couldn't work well.
> 
> And since most OMAP3 series boards pass NULL pointer of board_pdata
> to omap_ads7846_init, so it's more proper to set it in driver level
> after having gpio_request done.
> 
> This patch has been validated on 3530evm.
> 
> Signed-off-by: Zumeng Chen <redacted>
> Signed-off-by: Syed Mohammed Khasim <redacted>
> ---
>  drivers/input/touchscreen/ads7846.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index f02028e..459ff29 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>  		}
>  
>  		ts->gpio_pendown = pdata->gpio_pendown;
> +#ifdef CONFIG_ARCH_OMAP3
> +		/* 310 means about 10 microsecond for omap3 */
> +		gpio_set_debounce(pdata->gpio_pendown, 310);
> +#endif

Unless this concerns many boards/archs/platforms, I'd suggest you to implement
the get_pendown_state() method in the board file.
If more users will need this, it can be facilitated in the driver.
(and of course not with the ugly ifdefs...)

>  
>  	} else {
>  		dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");

-- 
Regards,
Igor.
```

## \[PATCH V2 1/5\] ARM: OMAP3EVM: Add NAND flash definition

- From: Igor Grinberg \<hidden\>
- Date: 2012-06-13 07:57:55 
- Message: https://ratatoskr.run/linux-input/2012/06/8609205.md

```text
On 06/13/12 04:44, Zumeng Chen wrote:
> From: Zumeng Chen <redacted>
> 
> Signed-off-by: Vaibhav Hiremath <redacted>
> Tested-by: Zumeng Chen <redacted>
> ---
>  arch/arm/mach-omap2/board-omap3evm.c |   39 ++++++++++++++++++++++++++++++++++
>  1 files changed, 39 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
> index 639bd07..0b83d0e 100644
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -24,6 +24,10 @@
>  #include <linux/leds.h>
>  #include <linux/interrupt.h>
>  
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +#include <linux/mtd/nand.h>
> +
>  #include <linux/spi/spi.h>
>  #include <linux/spi/ads7846.h>
>  #include <linux/i2c/twl.h>
> @@ -43,6 +47,7 @@
>  
>  #include <plat/board.h>
>  #include <plat/usb.h>
> +#include <plat/nand.h>
>  #include "common.h"
>  #include <plat/mcspi.h>
>  #include <video/omapdss.h>
> @@ -607,6 +612,37 @@ static struct regulator_consumer_supply dummy_supplies[] = {
>  	REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
>  };
>  
> +static struct mtd_partition omap3evm_nand_partitions[] = {
> +	/* All the partition sizes are listed in terms of NAND block size */
> +	{
> +		.name           = "X-Loader",
> +		.offset         = 0,
> +		.size           = 4*(SZ_128K),
> +		.mask_flags     = MTD_WRITEABLE
> +	},
> +	{
> +		.name           = "U-Boot",
> +		.offset         = MTDPART_OFS_APPEND,
> +		.size           = 14*(SZ_128K),
> +		.mask_flags     = MTD_WRITEABLE
> +	},
> +	{
> +		.name           = "U-Boot Env",
> +		.offset         = MTDPART_OFS_APPEND,
> +		.size           = 2*(SZ_128K)
> +	},
> +	{
> +		.name           = "Kernel",
> +		.offset         = MTDPART_OFS_APPEND,
> +		.size           = 40*(SZ_128K)
> +	},
> +	{
> +		.name           = "File system",
> +		.size           = MTDPART_SIZ_FULL,
> +		.offset         = MTDPART_OFS_APPEND,
> +	},
> +};
> +
>  static void __init omap3_evm_init(void)
>  {
>  	struct omap_board_mux *obm;
> @@ -656,6 +692,9 @@ static void __init omap3_evm_init(void)
>  	}
>  	usb_musb_init(&musb_board_data);
>  	usbhs_init(&usbhs_bdata);
> +	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
> +			     ARRAY_SIZE(omap3evm_nand_partitions));
> +

I think, this will interfere with Afzal's patches [1]?

>  	omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
>  	omap3evm_init_smsc911x();
>  	omap3_evm_display_init();

[1] http://www.spinics.net/lists/arm-kernel/msg178664.html

-- 
Regards,
Igor.
```

## \[PATCH V2 2/5\] ARM: OMAP3EVM: Adding USB internal LDOs board file

- From: Igor Grinberg \<hidden\>
- Date: 2012-06-13 08:16:23 
- Message: https://ratatoskr.run/linux-input/2012/06/8609206.md

```text
On 06/13/12 04:44, Zumeng Chen wrote:
> From: Zumeng Chen <redacted>
> 
> EHCI PHY requires these regulators:
>         EVM Rev >=E  --> VAUX2
>         EVM Rev < E  --> VUSB1V5, VUSB1V8
> 
> Adding USB internal LDOs (vusb1v5 & vusb1v8) and VAUX2 to omap3evm
> board file. Also removing vaux2_{1/2/3} supplies as they are not
> used on omap3 evm.
> 
> But we need not to add vaux2 in twl4030_platform_data since it will
> be added conditionally.
> 
> Signed-off-by: Ajay Kumar Gupta <redacted>
> Signed-off-by: Vaibhav Hiremath <redacted>
> Signed-off-by: Zumeng Chen <redacted>
> ---
>  arch/arm/mach-omap2/board-omap3evm.c |   27 +++++++++++++++++++++++++++
>  1 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
> index 0b83d0e..3c91534 100644
> --- a/arch/arm/mach-omap2/board-omap3evm.c
> +++ b/arch/arm/mach-omap2/board-omap3evm.c
> @@ -466,6 +466,30 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
>  };
>  #endif
>  
> +/* VAUX2 for USB */
> +static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
> +	REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"),	/* OMAP ISP */
> +	REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"),	/* OMAP ISP */
> +	REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
> +	{
> +		.supply		= "vaux2",
> +	}

This too can use the REGULATOR_SUPPLY() macro, why not use it?

> +};
> +
> +static struct regulator_init_data omap3evm_vaux2 = {
> +	.constraints = {
> +		.min_uV		= 2800000,
> +		.max_uV		= 2800000,
> +		.apply_uV	= true,
> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask		= REGULATOR_CHANGE_MODE
> +					| REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies		= ARRAY_SIZE(omap3evm_vaux2_supplies),
> +	.consumer_supplies		= omap3evm_vaux2_supplies,
> +};
> +
>  static struct twl4030_platform_data omap3evm_twldata = {
>  	/* platform_data for children goes here */
>  	.keypad		= &omap3evm_kp_data,
> @@ -659,6 +683,9 @@ static void __init omap3_evm_init(void)
>  	omap_mux_init_gpio(63, OMAP_PIN_INPUT);
>  	omap_hsmmc_init(mmc);
>  
> +	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
> +		omap3evm_twldata.vaux2 = &omap3evm_vaux2;
> +
>  	omap3_evm_i2c_init();
>  
>  	omap_display_init(&omap3_evm_dss_data);

-- 
Regards,
Igor.
```

## \[PATCH V2 1/5\] ARM: OMAP3EVM: Add NAND flash definition

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 08:16:34 
- Message: https://ratatoskr.run/linux-input/2012/06/8609207.md

```text
于 2012年06月13日 15:57, Igor Grinberg 写道:
> On 06/13/12 04:44, Zumeng Chen wrote:
>> From: Zumeng Chen<redacted>
>>
>> Signed-off-by: Vaibhav Hiremath<redacted>
>> Tested-by: Zumeng Chen<redacted>
>> ---
>>   arch/arm/mach-omap2/board-omap3evm.c |   39 ++++++++++++++++++++++++++++++++++
>>   1 files changed, 39 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
>> index 639bd07..0b83d0e 100644
>> --- a/arch/arm/mach-omap2/board-omap3evm.c
>> +++ b/arch/arm/mach-omap2/board-omap3evm.c
>> @@ -24,6 +24,10 @@
>>   #include<linux/leds.h>
>>   #include<linux/interrupt.h>
>>
>> +#include<linux/mtd/mtd.h>
>> +#include<linux/mtd/partitions.h>
>> +#include<linux/mtd/nand.h>
>> +
>>   #include<linux/spi/spi.h>
>>   #include<linux/spi/ads7846.h>
>>   #include<linux/i2c/twl.h>
>> @@ -43,6 +47,7 @@
>>
>>   #include<plat/board.h>
>>   #include<plat/usb.h>
>> +#include<plat/nand.h>
>>   #include "common.h"
>>   #include<plat/mcspi.h>
>>   #include<video/omapdss.h>
>> @@ -607,6 +612,37 @@ static struct regulator_consumer_supply dummy_supplies[] = {
>>   	REGULATOR_SUPPLY("vdd33a", "smsc911x.0"),
>>   };
>>
>> +static struct mtd_partition omap3evm_nand_partitions[] = {
>> +	/* All the partition sizes are listed in terms of NAND block size */
>> +	{
>> +		.name           = "X-Loader",
>> +		.offset         = 0,
>> +		.size           = 4*(SZ_128K),
>> +		.mask_flags     = MTD_WRITEABLE
>> +	},
>> +	{
>> +		.name           = "U-Boot",
>> +		.offset         = MTDPART_OFS_APPEND,
>> +		.size           = 14*(SZ_128K),
>> +		.mask_flags     = MTD_WRITEABLE
>> +	},
>> +	{
>> +		.name           = "U-Boot Env",
>> +		.offset         = MTDPART_OFS_APPEND,
>> +		.size           = 2*(SZ_128K)
>> +	},
>> +	{
>> +		.name           = "Kernel",
>> +		.offset         = MTDPART_OFS_APPEND,
>> +		.size           = 40*(SZ_128K)
>> +	},
>> +	{
>> +		.name           = "File system",
>> +		.size           = MTDPART_SIZ_FULL,
>> +		.offset         = MTDPART_OFS_APPEND,
>> +	},
>> +};
>> +
>>   static void __init omap3_evm_init(void)
>>   {
>>   	struct omap_board_mux *obm;
>> @@ -656,6 +692,9 @@ static void __init omap3_evm_init(void)
>>   	}
>>   	usb_musb_init(&musb_board_data);
>>   	usbhs_init(&usbhs_bdata);
>> +	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3evm_nand_partitions,
>> +			     ARRAY_SIZE(omap3evm_nand_partitions));
>> +
> I think, this will interfere with Afzal's patches [1]?
Yes, Igor, thanks for your kind reminder, I have already
noticed Afzal's GPMC patches when at [PATCH v4 00/39]

But I didn't read recently, I'll check them again to see if they
have been in Tony's queue :-)

Regards,
Zumeng

>>   	omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
>>   	omap3evm_init_smsc911x();
>>   	omap3_evm_display_init();
> [1] http://www.spinics.net/lists/arm-kernel/msg178664.html
>

--
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
```

## \[PATCH V2 2/5\] ARM: OMAP3EVM: Adding USB internal LDOs board file

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 08:23:19 
- Message: https://ratatoskr.run/linux-input/2012/06/8609208.md

```text
于 2012年06月13日 16:16, Igor Grinberg 写道:
> On 06/13/12 04:44, Zumeng Chen wrote:
>> From: Zumeng Chen<redacted>
>>
>> EHCI PHY requires these regulators:
>>          EVM Rev>=E  -->  VAUX2
>>          EVM Rev<  E  -->  VUSB1V5, VUSB1V8
>>
>> Adding USB internal LDOs (vusb1v5&  vusb1v8) and VAUX2 to omap3evm
>> board file. Also removing vaux2_{1/2/3} supplies as they are not
>> used on omap3 evm.
>>
>> But we need not to add vaux2 in twl4030_platform_data since it will
>> be added conditionally.
>>
>> Signed-off-by: Ajay Kumar Gupta<redacted>
>> Signed-off-by: Vaibhav Hiremath<redacted>
>> Signed-off-by: Zumeng Chen<redacted>
>> ---
>>   arch/arm/mach-omap2/board-omap3evm.c |   27 +++++++++++++++++++++++++++
>>   1 files changed, 27 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
>> index 0b83d0e..3c91534 100644
>> --- a/arch/arm/mach-omap2/board-omap3evm.c
>> +++ b/arch/arm/mach-omap2/board-omap3evm.c
>> @@ -466,6 +466,30 @@ struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
>>   };
>>   #endif
>>
>> +/* VAUX2 for USB */
>> +static struct regulator_consumer_supply omap3evm_vaux2_supplies[] = {
>> +	REGULATOR_SUPPLY("VDD_CSIPHY1", "omap3isp"),	/* OMAP ISP */
>> +	REGULATOR_SUPPLY("VDD_CSIPHY2", "omap3isp"),	/* OMAP ISP */
>> +	REGULATOR_SUPPLY("hsusb1", "ehci-omap.0"),
>> +	{
>> +		.supply		= "vaux2",
>> +	}
> This too can use the REGULATOR_SUPPLY() macro, why not use it?
Yes, Of course from me, I'll try to see if there is other considerations
from the original patch. If no I'll change it.

Regards,
Zumeng
>> +};
>> +
>> +static struct regulator_init_data omap3evm_vaux2 = {
>> +	.constraints = {
>> +		.min_uV		= 2800000,
>> +		.max_uV		= 2800000,
>> +		.apply_uV	= true,
>> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
>> +					| REGULATOR_MODE_STANDBY,
>> +		.valid_ops_mask		= REGULATOR_CHANGE_MODE
>> +					| REGULATOR_CHANGE_STATUS,
>> +	},
>> +	.num_consumer_supplies		= ARRAY_SIZE(omap3evm_vaux2_supplies),
>> +	.consumer_supplies		= omap3evm_vaux2_supplies,
>> +};
>> +
>>   static struct twl4030_platform_data omap3evm_twldata = {
>>   	/* platform_data for children goes here */
>>   	.keypad		=&omap3evm_kp_data,
>> @@ -659,6 +683,9 @@ static void __init omap3_evm_init(void)
>>   	omap_mux_init_gpio(63, OMAP_PIN_INPUT);
>>   	omap_hsmmc_init(mmc);
>>
>> +	if (get_omap3_evm_rev()>= OMAP3EVM_BOARD_GEN_2)
>> +		omap3evm_twldata.vaux2 =&omap3evm_vaux2;
>> +
>>   	omap3_evm_i2c_init();
>>
>>   	omap_display_init(&omap3_evm_dss_data);

--
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
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-13 09:03:55 
- Message: https://ratatoskr.run/linux-input/2012/06/8609213.md

```text
于 2012年06月13日 15:51, Igor Grinberg 写道:
> On 06/13/12 04:44, Zumeng Chen wrote:
>> From: Zumeng Chen<redacted>
>>
>> If we don't set proper debouce time for ads7846, then there are
>> flooded interrupt counters of ads7846 responding to one time
>> touch on screen, so the driver couldn't work well.
>>
>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>> to omap_ads7846_init, so it's more proper to set it in driver level
>> after having gpio_request done.
>>
>> This patch has been validated on 3530evm.
>>
>> Signed-off-by: Zumeng Chen<redacted>
>> Signed-off-by: Syed Mohammed Khasim<redacted>
>> ---
>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>> index f02028e..459ff29 100644
>> --- a/drivers/input/touchscreen/ads7846.c
>> +++ b/drivers/input/touchscreen/ads7846.c
>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>   		}
>>
>>   		ts->gpio_pendown = pdata->gpio_pendown;
>> +#ifdef CONFIG_ARCH_OMAP3
>> +		/* 310 means about 10 microsecond for omap3 */
>> +		gpio_set_debounce(pdata->gpio_pendown, 310);
>> +#endif
> Unless this concerns many boards/archs/platforms,
Yes, this is the case.
> I'd suggest you to implement
> the get_pendown_state() method in the board file.
it seems they are different way between gpio and
get_pendown_state, and gpio way is used for omap3
to drive ads7846, so I guess we may have to do like this.

Regards,
Zumeng
> If more users will need this, it can be facilitated in the driver.
> (and of course not with the ugly ifdefs...)
>
>>
>>   	} else {
>>   		dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");

--
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
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Igor Grinberg \<hidden\>
- Date: 2012-06-13 10:13:32 
- Message: https://ratatoskr.run/linux-input/2012/06/8609225.md

```text
On 06/13/12 12:03, Zumeng Chen wrote:
> 于 2012年06月13日 15:51, Igor Grinberg 写道:
>> On 06/13/12 04:44, Zumeng Chen wrote:
>>> From: Zumeng Chen<redacted>
>>>
>>> If we don't set proper debouce time for ads7846, then there are
>>> flooded interrupt counters of ads7846 responding to one time
>>> touch on screen, so the driver couldn't work well.
>>>
>>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>> to omap_ads7846_init, so it's more proper to set it in driver level
>>> after having gpio_request done.
>>>
>>> This patch has been validated on 3530evm.
>>>
>>> Signed-off-by: Zumeng Chen<redacted>
>>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>> ---
>>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>> index f02028e..459ff29 100644
>>> --- a/drivers/input/touchscreen/ads7846.c
>>> +++ b/drivers/input/touchscreen/ads7846.c
>>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>           }
>>>
>>>           ts->gpio_pendown = pdata->gpio_pendown;
>>> +#ifdef CONFIG_ARCH_OMAP3
>>> +        /* 310 means about 10 microsecond for omap3 */
>>> +        gpio_set_debounce(pdata->gpio_pendown, 310);
>>> +#endif
>> Unless this concerns many boards/archs/platforms,
> Yes, this is the case.
>> I'd suggest you to implement
>> the get_pendown_state() method in the board file.
> it seems they are different way between gpio and
> get_pendown_state, and gpio way is used for omap3
> to drive ads7846, so I guess we may have to do like this.

No, this is not (and does not have to be) OMAP wide.
The decision for this is made on per-board basis.

> 
> Regards,
> Zumeng
>> If more users will need this, it can be facilitated in the driver.
>> (and of course not with the ugly ifdefs...)
>>
>>>
>>>       } else {
>>>           dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
> 
> -- 
> 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
> 

-- 
Regards,
Igor.
--
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
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Hiremath, Vaibhav \<hidden\>
- Date: 2012-06-13 12:18:32 
- Message: https://ratatoskr.run/linux-input/2012/06/8609245.md

```text
On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
> From: Zumeng Chen <redacted>
> 
> If we don't set proper debouce time for ads7846, then there are
> flooded interrupt counters of ads7846 responding to one time
> touch on screen, so the driver couldn't work well.
> 
> And since most OMAP3 series boards pass NULL pointer of board_pdata
> to omap_ads7846_init, so it's more proper to set it in driver level
> after having gpio_request done.
> 
> This patch has been validated on 3530evm.
> 
> Signed-off-by: Zumeng Chen <redacted>
> Signed-off-by: Syed Mohammed Khasim <redacted>
> ---
>  drivers/input/touchscreen/ads7846.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index f02028e..459ff29 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>  		}
>  
>  		ts->gpio_pendown = pdata->gpio_pendown;
> +#ifdef CONFIG_ARCH_OMAP3
> +		/* 310 means about 10 microsecond for omap3 */
> +		gpio_set_debounce(pdata->gpio_pendown, 310);
> +#endif
>  

Zumeng,

With my sign-off you are changing the original code, that too
without my sign-off and ack. 
I wouldn't mind you to submit patches from my tree, but the expectation is 
if you are changing the original code, it should be under your sign-off.

Coming to the patch, #ifdef in driver is not recommended, and this 10msec 
delay is specific to OMAP GPIO and driver should not be aware of this, 
that's where you will find the original patch handling it in board file.

Thanks,
Vaibhav
>  	} else {
>  		dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
> -- 
> 1.7.5.4
> 
> 

```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-14 03:29:11 
- Message: https://ratatoskr.run/linux-input/2012/06/8609691.md

```text
2012/6/13 Hiremath, Vaibhav [ref]

> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
> > From: Zumeng Chen <redacted>
> >
> > If we don't set proper debouce time for ads7846, then there are
> > flooded interrupt counters of ads7846 responding to one time
> > touch on screen, so the driver couldn't work well.
> >
> > And since most OMAP3 series boards pass NULL pointer of board_pdata
> > to omap_ads7846_init, so it's more proper to set it in driver level
> > after having gpio_request done.
> >
> > This patch has been validated on 3530evm.
> >
> > Signed-off-by: Zumeng Chen <redacted>
> > Signed-off-by: Syed Mohammed Khasim <redacted>
> > ---
> >  drivers/input/touchscreen/ads7846.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/drivers/input/touchscreen/ads7846.c
> b/drivers/input/touchscreen/ads7846.c
> > index f02028e..459ff29 100644
> > --- a/drivers/input/touchscreen/ads7846.c
> > +++ b/drivers/input/touchscreen/ads7846.c
> > @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct
> spi_device *spi, struct ads784
> >               }
> >
> >               ts->gpio_pendown = pdata->gpio_pendown;
> > +#ifdef CONFIG_ARCH_OMAP3
> > +             /* 310 means about 10 microsecond for omap3 */
> > +             gpio_set_debounce(pdata->gpio_pendown, 310);
> > +#endif
> >
>
> Zumeng,
>
> With my sign-off you are changing the original code, that too
> without my sign-off and ack.
> I wouldn't mind you to submit patches from my tree, but the expectation is
> if you are changing the original code, it should be under your sign-off.
>
Many thanks for your information, good to learn. I'll remove too. Sorry for
inconvenience.

>
> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
> delay is specific to OMAP GPIO and driver should not be aware of this,
> that's where you will find the original patch handling it in board file.
>
Yes, I just went through again the board related codes, there is a commit
from
Mike, I think that's the basic thoughts for me to do this patch for all
omap3 about
ads7846 :-)

Regards,
Zumeng


>
> Thanks,
> Vaibhav
> >       } else {
> >               dev_err(&spi->dev, "no get_pendown_state nor
> gpio_pendown?\n");
> > --
> > 1.7.5.4
> >
> >
>
>
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-14 04:46:55 
- Message: https://ratatoskr.run/linux-input/2012/06/8609327.md

```text
于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>> From: Zumeng Chen<redacted>
>>
>> If we don't set proper debouce time for ads7846, then there are
>> flooded interrupt counters of ads7846 responding to one time
>> touch on screen, so the driver couldn't work well.
>>
>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>> to omap_ads7846_init, so it's more proper to set it in driver level
>> after having gpio_request done.
>>
>> This patch has been validated on 3530evm.
>>
>> Signed-off-by: Zumeng Chen<redacted>
>> Signed-off-by: Syed Mohammed Khasim<redacted>
>> ---
>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>> index f02028e..459ff29 100644
>> --- a/drivers/input/touchscreen/ads7846.c
>> +++ b/drivers/input/touchscreen/ads7846.c
>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>   		}
>>
>>   		ts->gpio_pendown = pdata->gpio_pendown;
>> +#ifdef CONFIG_ARCH_OMAP3
>> +		/* 310 means about 10 microsecond for omap3 */
>> +		gpio_set_debounce(pdata->gpio_pendown, 310);
>> +#endif
>>
> Zumeng,
>
> With my sign-off you are changing the original code, that too
> without my sign-off and ack.
> I wouldn't mind you to submit patches from my tree, but the expectation is
> if you are changing the original code, it should be under your sign-off.
Thanks, good to learn. I'll remove in next time.
> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
> delay is specific to OMAP GPIO and driver should not be aware of this,
> that's where you will find the original patch handling it in board file.
According to the git blame of the board-omap3evm.c I think
96974a24 did a good thing to all the related codes for omap3
boards. So I think we can call board and driver as BSP level :-)

If #ifdef in driver can save many codes, I guess it's deserved.

Regards,
Zumeng
> Thanks,
> Vaibhav
>>   	} else {
>>   		dev_err(&spi->dev, "no get_pendown_state nor gpio_pendown?\n");
>> -- 
>> 1.7.5.4
>>
>>

--
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
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Hiremath, Vaibhav \<hidden\>
- Date: 2012-06-14 06:31:16 
- Message: https://ratatoskr.run/linux-input/2012/06/8609351.md

```text
On Thu, Jun 14, 2012 at 10:16:55, Zumeng Chen wrote:
> 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
> > On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
> >> From: Zumeng Chen<redacted>
> >>
> >> If we don't set proper debouce time for ads7846, then there are
> >> flooded interrupt counters of ads7846 responding to one time
> >> touch on screen, so the driver couldn't work well.
> >>
> >> And since most OMAP3 series boards pass NULL pointer of board_pdata
> >> to omap_ads7846_init, so it's more proper to set it in driver level
> >> after having gpio_request done.
> >>
> >> This patch has been validated on 3530evm.
> >>
> >> Signed-off-by: Zumeng Chen<redacted>
> >> Signed-off-by: Syed Mohammed Khasim<redacted>
> >> ---
> >>   drivers/input/touchscreen/ads7846.c |    4 ++++
> >>   1 files changed, 4 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> >> index f02028e..459ff29 100644
> >> --- a/drivers/input/touchscreen/ads7846.c
> >> +++ b/drivers/input/touchscreen/ads7846.c
> >> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
> >>   		}
> >>
> >>   		ts->gpio_pendown = pdata->gpio_pendown;
> >> +#ifdef CONFIG_ARCH_OMAP3
> >> +		/* 310 means about 10 microsecond for omap3 */
> >> +		gpio_set_debounce(pdata->gpio_pendown, 310);
> >> +#endif
> >>
> > Zumeng,
> >
> > With my sign-off you are changing the original code, that too
> > without my sign-off and ack.
> > I wouldn't mind you to submit patches from my tree, but the expectation is
> > if you are changing the original code, it should be under your sign-off.
> Thanks, good to learn. I'll remove in next time.
> > Coming to the patch, #ifdef in driver is not recommended, and this 10msec
> > delay is specific to OMAP GPIO and driver should not be aware of this,
> > that's where you will find the original patch handling it in board file.
> According to the git blame of the board-omap3evm.c I think
> 96974a24 did a good thing to all the related codes for omap3
> boards. So I think we can call board and driver as BSP level :-)
> 
> If #ifdef in driver can save many codes, I guess it's deserved.
> 

No, not really.

In the same commit, the debounce time is already handled as an argument to 
the function omap_ads7846_init(), and that’s the way it should be.
So no need for #ifdefs in driver...

Thanks,
Vaibhav
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Igor Grinberg \<hidden\>
- Date: 2012-06-14 06:44:38 
- Message: https://ratatoskr.run/linux-input/2012/06/8609356.md

```text
On 06/14/12 07:46, Zumeng Chen wrote:
> 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>> From: Zumeng Chen<redacted>
>>>
>>> If we don't set proper debouce time for ads7846, then there are
>>> flooded interrupt counters of ads7846 responding to one time
>>> touch on screen, so the driver couldn't work well.
>>>
>>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>> to omap_ads7846_init, so it's more proper to set it in driver level
>>> after having gpio_request done.
>>>
>>> This patch has been validated on 3530evm.
>>>
>>> Signed-off-by: Zumeng Chen<redacted>
>>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>> ---
>>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>> index f02028e..459ff29 100644
>>> --- a/drivers/input/touchscreen/ads7846.c
>>> +++ b/drivers/input/touchscreen/ads7846.c
>>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>           }
>>>
>>>           ts->gpio_pendown = pdata->gpio_pendown;
>>> +#ifdef CONFIG_ARCH_OMAP3
>>> +        /* 310 means about 10 microsecond for omap3 */
>>> +        gpio_set_debounce(pdata->gpio_pendown, 310);
>>> +#endif
>>>
>> Zumeng,
>>
>> With my sign-off you are changing the original code, that too
>> without my sign-off and ack.
>> I wouldn't mind you to submit patches from my tree, but the expectation is
>> if you are changing the original code, it should be under your sign-off.
> Thanks, good to learn. I'll remove in next time.
>> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>> delay is specific to OMAP GPIO and driver should not be aware of this,
>> that's where you will find the original patch handling it in board file.
> According to the git blame of the board-omap3evm.c I think
> 96974a24 did a good thing to all the related codes for omap3
> boards. So I think we can call board and driver as BSP level :-)
> 
> If #ifdef in driver can save many codes, I guess it's deserved.

No, platform/board specific ifdefs in the generic driver code are never
deserved.
How about the attached patch, does it fix the problem for you?


-- 
Regards,
Igor.
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-14 06:59:28 
- Message: https://ratatoskr.run/linux-input/2012/06/8609357.md

```text
于 2012年06月14日 14:31, Hiremath, Vaibhav 写道:
> On Thu, Jun 14, 2012 at 10:16:55, Zumeng Chen wrote:
>> 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>>> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>>> From: Zumeng Chen<redacted>
>>>>
>>>> If we don't set proper debouce time for ads7846, then there are
>>>> flooded interrupt counters of ads7846 responding to one time
>>>> touch on screen, so the driver couldn't work well.
>>>>
>>>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>>> to omap_ads7846_init, so it's more proper to set it in driver level
>>>> after having gpio_request done.
>>>>
>>>> This patch has been validated on 3530evm.
>>>>
>>>> Signed-off-by: Zumeng Chen<redacted>
>>>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>>> ---
>>>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>>> index f02028e..459ff29 100644
>>>> --- a/drivers/input/touchscreen/ads7846.c
>>>> +++ b/drivers/input/touchscreen/ads7846.c
>>>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>>   		}
>>>>
>>>>   		ts->gpio_pendown = pdata->gpio_pendown;
>>>> +#ifdef CONFIG_ARCH_OMAP3
>>>> +		/* 310 means about 10 microsecond for omap3 */
>>>> +		gpio_set_debounce(pdata->gpio_pendown, 310);
>>>> +#endif
>>>>
>>> Zumeng,
>>>
>>> With my sign-off you are changing the original code, that too
>>> without my sign-off and ack.
>>> I wouldn't mind you to submit patches from my tree, but the expectation is
>>> if you are changing the original code, it should be under your sign-off.
>> Thanks, good to learn. I'll remove in next time.
>>> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>>> delay is specific to OMAP GPIO and driver should not be aware of this,
>>> that's where you will find the original patch handling it in board file.
>> According to the git blame of the board-omap3evm.c I think
>> 96974a24 did a good thing to all the related codes for omap3
>> boards. So I think we can call board and driver as BSP level :-)
>>
>> If #ifdef in driver can save many codes, I guess it's deserved.
>>
> No, not really.
>
> In the same commit, the debounce time is already handled as an argument to 
> the function omap_ads7846_init(), and that’s the way it should be.
That means you'd like to implement the same get_pendown_state for every
omap3 board? Currently, board_pdata is NULL.

And actually, the reason why I agree 96974a24 is that get_pendown_state
for all omap3 boards is the common chip level gpio operations. so I think
we should set debounce for them in one common point.

But since Igor and you don't like them, I have created and tested the
attachment
patch, and I'd like Mike to check if convenience too
But obviously there are more codes than mine before :-)

Regards,
Zumeng
> So no need for #ifdefs in driver...
>
> Thanks,
> Vaibhav

```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-14 07:08:10 
- Message: https://ratatoskr.run/linux-input/2012/06/8609693.md

```text
于 2012年06月14日 14:44, Igor Grinberg 写道:
> On 06/14/12 07:46, Zumeng Chen wrote:
>> >  于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>>> >>  On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>>> >>>  From: Zumeng Chen[ref]
>>>> >>>
>>>> >>>  If we don't set proper debouce time for ads7846, then there are
>>>> >>>  flooded interrupt counters of ads7846 responding to one time
>>>> >>>  touch on screen, so the driver couldn't work well.
>>>> >>>
>>>> >>>  And since most OMAP3 series boards pass NULL pointer of board_pdata
>>>> >>>  to omap_ads7846_init, so it's more proper to set it in driver level
>>>> >>>  after having gpio_request done.
>>>> >>>
>>>> >>>  This patch has been validated on 3530evm.
>>>> >>>
>>>> >>>  Signed-off-by: Zumeng Chen[ref]
>>>> >>>  Signed-off-by: Syed Mohammed Khasim[ref]
>>>> >>>  ---
>>>> >>>     drivers/input/touchscreen/ads7846.c |    4 ++++
>>>> >>>     1 files changed, 4 insertions(+), 0 deletions(-)
>>>> >>>
>>>> >>>  diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>>> >>>  index f02028e..459ff29 100644
>>>> >>>  --- a/drivers/input/touchscreen/ads7846.c
>>>> >>>  +++ b/drivers/input/touchscreen/ads7846.c
>>>> >>>  @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>> >>>             }
>>>> >>>
>>>> >>>             ts->gpio_pendown = pdata->gpio_pendown;
>>>> >>>  +#ifdef CONFIG_ARCH_OMAP3
>>>> >>>  +        /* 310 means about 10 microsecond for omap3 */
>>>> >>>  +        gpio_set_debounce(pdata->gpio_pendown, 310);
>>>> >>>  +#endif
>>>> >>>
>>> >>  Zumeng,
>>> >>
>>> >>  With my sign-off you are changing the original code, that too
>>> >>  without my sign-off and ack.
>>> >>  I wouldn't mind you to submit patches from my tree, but the expectation is
>>> >>  if you are changing the original code, it should be under your sign-off.
>> >  Thanks, good to learn. I'll remove in next time.
>>> >>  Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>>> >>  delay is specific to OMAP GPIO and driver should not be aware of this,
>>> >>  that's where you will find the original patch handling it in board file.
>> >  According to the git blame of the board-omap3evm.c I think
>> >  96974a24 did a good thing to all the related codes for omap3
>> >  boards. So I think we can call board and driver as BSP level:-)
>> >  
>> >  If #ifdef in driver can save many codes, I guess it's deserved.
> No, platform/board specific ifdefs in the generic driver code are never
> deserved.
> How about the attached patch, does it fix the problem for you?
Sorry Igor, I just read your patch, yes, most are there, and we
just have to set get_pendown_state as you early said. Really
*thanks* for your drive :)

Regards,
Zumeng
> -- Regards, Igor.
> ads7846.patch
>
>
> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
> index 1706ebc..c187586 100644
> --- a/arch/arm/mach-omap2/common-board-devices.c
> +++ b/arch/arm/mach-omap2/common-board-devices.c
> @@ -63,28 +63,30 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>   	struct spi_board_info *spi_bi =&ads7846_spi_board_info;
>   	int err;
>
> -	if (board_pdata&&  board_pdata->get_pendown_state) {
> -		err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
> -		if (err) {
> -			pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
> -			return;
> -		}
> -		gpio_export(gpio_pendown, 0);
> -
> -		if (gpio_debounce)
> -			gpio_set_debounce(gpio_pendown, gpio_debounce);
> +	err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
> +	if (err) {
> +		pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
> +		return;
>   	}
>   	
> +	if (gpio_debounce)
> +		gpio_set_debounce(gpio_pendown, gpio_debounce);
> +
>   	spi_bi->bus_num	= bus_num;
>   	spi_bi->irq	= gpio_to_irq(gpio_pendown);
>
>   	if (board_pdata) {
>   		board_pdata->gpio_pendown = gpio_pendown;
>   		spi_bi->platform_data = board_pdata;
> +		if (board_pdata->get_pendown_state)
> +			gpio_export(gpio_pendown, 0);
>   	} else {
>   		ads7846_config.gpio_pendown = gpio_pendown;
>   	}
>
> +	if (!board_pdata || (board_pdata&&  !board_pdata->get_pendown_state))
> +		gpio_free(gpio_pendown);
> +
>   	spi_register_board_info(&ads7846_spi_board_info, 1);
>   }
>   #else

```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Igor Grinberg \<hidden\>
- Date: 2012-06-14 08:06:41 
- Message: https://ratatoskr.run/linux-input/2012/06/8609371.md

```text
On 06/14/12 10:08, Zumeng Chen wrote:
> 于 2012年06月14日 14:44, Igor Grinberg 写道:
>> On 06/14/12 07:46, Zumeng Chen wrote:
>>> > 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>>>> >> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>>>> >>> From: Zumeng Chen<redacted>
>>>>> >>>
>>>>> >>> If we don't set proper debouce time for ads7846, then there are
>>>>> >>> flooded interrupt counters of ads7846 responding to one time
>>>>> >>> touch on screen, so the driver couldn't work well.
>>>>> >>>
>>>>> >>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>>>> >>> to omap_ads7846_init, so it's more proper to set it in driver level
>>>>> >>> after having gpio_request done.
>>>>> >>>
>>>>> >>> This patch has been validated on 3530evm.
>>>>> >>>
>>>>> >>> Signed-off-by: Zumeng Chen<redacted>
>>>>> >>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>>>> >>> ---
>>>>> >>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>>>> >>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>>> >>>
>>>>> >>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>>>> >>> index f02028e..459ff29 100644
>>>>> >>> --- a/drivers/input/touchscreen/ads7846.c
>>>>> >>> +++ b/drivers/input/touchscreen/ads7846.c
>>>>> >>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>>> >>>           }
>>>>> >>>
>>>>> >>>           ts->gpio_pendown = pdata->gpio_pendown;
>>>>> >>> +#ifdef CONFIG_ARCH_OMAP3
>>>>> >>> +        /* 310 means about 10 microsecond for omap3 */
>>>>> >>> +        gpio_set_debounce(pdata->gpio_pendown, 310);
>>>>> >>> +#endif
>>>>> >>>
>>>> >> Zumeng,
>>>> >>
>>>> >> With my sign-off you are changing the original code, that too
>>>> >> without my sign-off and ack.
>>>> >> I wouldn't mind you to submit patches from my tree, but the expectation is
>>>> >> if you are changing the original code, it should be under your sign-off.
>>> > Thanks, good to learn. I'll remove in next time.
>>>> >> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>>>> >> delay is specific to OMAP GPIO and driver should not be aware of this,
>>>> >> that's where you will find the original patch handling it in board file.
>>> > According to the git blame of the board-omap3evm.c I think
>>> > 96974a24 did a good thing to all the related codes for omap3
>>> > boards. So I think we can call board and driver as BSP level :-)
>>> > 
>>> > If #ifdef in driver can save many codes, I guess it's deserved.
>> No, platform/board specific ifdefs in the generic driver code are never
>> deserved.
>> How about the attached patch, does it fix the problem for you?
> Sorry Igor, I just read your patch, yes, most are there, and we
> just have to set get_pendown_state as you early said. Really
> *thanks* for your drive :)

No, with my patch, you don't need the get_pendown_state() and
you don't need to change the board-omap3evm.c ADS7846 related code.
So, I'm going to submit my patch properly.

> 
> Regards,
> Zumeng
>> -- Regards, Igor.
>> ads7846.patch
>>
>>
>> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
>> index 1706ebc..c187586 100644
>> --- a/arch/arm/mach-omap2/common-board-devices.c
>> +++ b/arch/arm/mach-omap2/common-board-devices.c
>> @@ -63,28 +63,30 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>>  	struct spi_board_info *spi_bi = &ads7846_spi_board_info;
>>  	int err;
>>  
>> -	if (board_pdata && board_pdata->get_pendown_state) {
>> -		err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
>> -		if (err) {
>> -			pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
>> -			return;
>> -		}
>> -		gpio_export(gpio_pendown, 0);
>> -
>> -		if (gpio_debounce)
>> -			gpio_set_debounce(gpio_pendown, gpio_debounce);
>> +	err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
>> +	if (err) {
>> +		pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
>> +		return;
>>  	}
>>  	
>> +	if (gpio_debounce)
>> +		gpio_set_debounce(gpio_pendown, gpio_debounce);
>> +
>>  	spi_bi->bus_num	= bus_num;
>>  	spi_bi->irq	= gpio_to_irq(gpio_pendown);
>>  
>>  	if (board_pdata) {
>>  		board_pdata->gpio_pendown = gpio_pendown;
>>  		spi_bi->platform_data = board_pdata;
>> +		if (board_pdata->get_pendown_state)
>> +			gpio_export(gpio_pendown, 0);
>>  	} else {
>>  		ads7846_config.gpio_pendown = gpio_pendown;
>>  	}
>>  
>> +	if (!board_pdata || (board_pdata && !board_pdata->get_pendown_state))
>> +		gpio_free(gpio_pendown);
>> +
>>  	spi_register_board_info(&ads7846_spi_board_info, 1);
>>  }
>>  #else
> 

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

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-14 08:18:29 
- Message: https://ratatoskr.run/linux-input/2012/06/8609377.md

```text
于 2012年06月14日 16:06, Igor Grinberg 写道:
> On 06/14/12 10:08, Zumeng Chen wrote:
>> 于 2012年06月14日 14:44, Igor Grinberg 写道:
>>> On 06/14/12 07:46, Zumeng Chen wrote:
>>>>> 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>>>>>>> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>>>>>>>> From: Zumeng Chen<redacted>
>>>>>>>>>
>>>>>>>>> If we don't set proper debouce time for ads7846, then there are
>>>>>>>>> flooded interrupt counters of ads7846 responding to one time
>>>>>>>>> touch on screen, so the driver couldn't work well.
>>>>>>>>>
>>>>>>>>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>>>>>>>> to omap_ads7846_init, so it's more proper to set it in driver level
>>>>>>>>> after having gpio_request done.
>>>>>>>>>
>>>>>>>>> This patch has been validated on 3530evm.
>>>>>>>>>
>>>>>>>>> Signed-off-by: Zumeng Chen<redacted>
>>>>>>>>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>>>>>>>> ---
>>>>>>>>>    drivers/input/touchscreen/ads7846.c |    4 ++++
>>>>>>>>>    1 files changed, 4 insertions(+), 0 deletions(-)
>>>>>>>>>
>>>>>>>>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>>>>>>>> index f02028e..459ff29 100644
>>>>>>>>> --- a/drivers/input/touchscreen/ads7846.c
>>>>>>>>> +++ b/drivers/input/touchscreen/ads7846.c
>>>>>>>>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>>>>>>>            }
>>>>>>>>>
>>>>>>>>>            ts->gpio_pendown = pdata->gpio_pendown;
>>>>>>>>> +#ifdef CONFIG_ARCH_OMAP3
>>>>>>>>> +        /* 310 means about 10 microsecond for omap3 */
>>>>>>>>> +        gpio_set_debounce(pdata->gpio_pendown, 310);
>>>>>>>>> +#endif
>>>>>>>>>
>>>>>>> Zumeng,
>>>>>>>
>>>>>>> With my sign-off you are changing the original code, that too
>>>>>>> without my sign-off and ack.
>>>>>>> I wouldn't mind you to submit patches from my tree, but the expectation is
>>>>>>> if you are changing the original code, it should be under your sign-off.
>>>>> Thanks, good to learn. I'll remove in next time.
>>>>>>> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>>>>>>> delay is specific to OMAP GPIO and driver should not be aware of this,
>>>>>>> that's where you will find the original patch handling it in board file.
>>>>> According to the git blame of the board-omap3evm.c I think
>>>>> 96974a24 did a good thing to all the related codes for omap3
>>>>> boards. So I think we can call board and driver as BSP level :-)
>>>>>
>>>>> If #ifdef in driver can save many codes, I guess it's deserved.
>>> No, platform/board specific ifdefs in the generic driver code are never
>>> deserved.
>>> How about the attached patch, does it fix the problem for you?
>> Sorry Igor, I just read your patch, yes, most are there, and we
>> just have to set get_pendown_state as you early said. Really
>> *thanks* for your drive :)
> No, with my patch, you don't need the get_pendown_state() and
> you don't need to change the board-omap3evm.c ADS7846 related code.
> So, I'm going to submit my patch properly.
Feel free to do that

>> Regards,
>> Zumeng
>>> -- Regards, Igor.
>>> ads7846.patch
>>>
>>>
>>> diff --git a/arch/arm/mach-omap2/common-board-devices.c b/arch/arm/mach-omap2/common-board-devices.c
>>> index 1706ebc..c187586 100644
>>> --- a/arch/arm/mach-omap2/common-board-devices.c
>>> +++ b/arch/arm/mach-omap2/common-board-devices.c
>>> @@ -63,28 +63,30 @@ void __init omap_ads7846_init(int bus_num, int gpio_pendown, int gpio_debounce,
>>>   	struct spi_board_info *spi_bi =&ads7846_spi_board_info;
>>>   	int err;
>>>
>>> -	if (board_pdata&&  board_pdata->get_pendown_state) {
>>> -		err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
>>> -		if (err) {
>>> -			pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
>>> -			return;
>>> -		}
>>> -		gpio_export(gpio_pendown, 0);
>>> -
>>> -		if (gpio_debounce)
>>> -			gpio_set_debounce(gpio_pendown, gpio_debounce);
>>> +	err = gpio_request_one(gpio_pendown, GPIOF_IN, "TSPenDown");
>>> +	if (err) {
>>> +		pr_err("Couldn't obtain gpio for TSPenDown: %d\n", err);
>>> +		return;
>>>   	}
>>>   	
>>> +	if (gpio_debounce)
>>> +		gpio_set_debounce(gpio_pendown, gpio_debounce);
>>> +
>>>   	spi_bi->bus_num	= bus_num;
>>>   	spi_bi->irq	= gpio_to_irq(gpio_pendown);
>>>
>>>   	if (board_pdata) {
>>>   		board_pdata->gpio_pendown = gpio_pendown;
>>>   		spi_bi->platform_data = board_pdata;
>>> +		if (board_pdata->get_pendown_state)
>>> +			gpio_export(gpio_pendown, 0);
>>>   	} else {
>>>   		ads7846_config.gpio_pendown = gpio_pendown;
>>>   	}
>>>
>>> +	if (!board_pdata || (board_pdata&&  !board_pdata->get_pendown_state))
>>> +		gpio_free(gpio_pendown);
>>> +
>>>   	spi_register_board_info(&ads7846_spi_board_info, 1);
>>>   }
>>>   #else

--
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
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: zumeng.chen \<hidden\>
- Date: 2012-06-16 00:15:19 
- Message: https://ratatoskr.run/linux-input/2012/06/8609664.md

```text
On 2012年06月14日 14:59, Zumeng Chen wrote:
> 于 2012年06月14日 14:31, Hiremath, Vaibhav 写道:
>> On Thu, Jun 14, 2012 at 10:16:55, Zumeng Chen wrote:
>>> 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>>>> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>>>> From: Zumeng Chen<redacted>
>>>>>
>>>>> If we don't set proper debouce time for ads7846, then there are
>>>>> flooded interrupt counters of ads7846 responding to one time
>>>>> touch on screen, so the driver couldn't work well.
>>>>>
>>>>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>>>> to omap_ads7846_init, so it's more proper to set it in driver level
>>>>> after having gpio_request done.
>>>>>
>>>>> This patch has been validated on 3530evm.
>>>>>
>>>>> Signed-off-by: Zumeng Chen<redacted>
>>>>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>>>> ---
>>>>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>>>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>>>> index f02028e..459ff29 100644
>>>>> --- a/drivers/input/touchscreen/ads7846.c
>>>>> +++ b/drivers/input/touchscreen/ads7846.c
>>>>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>>>   		}
>>>>>
>>>>>   		ts->gpio_pendown = pdata->gpio_pendown;
>>>>> +#ifdef CONFIG_ARCH_OMAP3
>>>>> +		/* 310 means about 10 microsecond for omap3 */
>>>>> +		gpio_set_debounce(pdata->gpio_pendown, 310);
>>>>> +#endif
>>>>>
>>>> Zumeng,
>>>>
>>>> With my sign-off you are changing the original code, that too
>>>> without my sign-off and ack.
>>>> I wouldn't mind you to submit patches from my tree, but the expectation is
>>>> if you are changing the original code, it should be under your sign-off.
>>> Thanks, good to learn. I'll remove in next time.
>>>> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>>>> delay is specific to OMAP GPIO and driver should not be aware of this,
>>>> that's where you will find the original patch handling it in board file.
>>> According to the git blame of the board-omap3evm.c I think
>>> 96974a24 did a good thing to all the related codes for omap3
>>> boards. So I think we can call board and driver as BSP level :-)
>>>
>>> If #ifdef in driver can save many codes, I guess it's deserved.
>>>
>> No, not really.
>>
>> In the same commit, the debounce time is already handled as an argument to 
>> the function omap_ads7846_init(), and that’s the way it should be.
> That means you'd like to implement the same get_pendown_state for every
> omap3 board? Currently, board_pdata is NULL.
>
> And actually, the reason why I agree 96974a24 is that get_pendown_state
> for all omap3 boards is the common chip level gpio operations. so I think
> we should set debounce for them in one common point.
>
> But since Igor and you don't like them, I have created and tested the
> attachment
> patch, and I'd like Mike to check if convenience too
> But obviously there are more codes than mine before :-)
Tony & Mike,

How about your comments on this issue? Do you think the following is
acceptable VS my last email _attachment_.

+#ifdef CONFIG_ARCH_OMAP3
+		/* 310 means about 10 microsecond for omap3 */
+		gpio_set_debounce(pdata->gpio_pendown, 310);
+#endif


Regards,
Zumeng


> Regards,
> Zumeng
>> So no need for #ifdefs in driver...
>>
>> Thanks,
>> Vaibhav

```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Marek Vasut \<hidden\>
- Date: 2012-06-16 13:27:22 
- Message: https://ratatoskr.run/linux-input/2012/06/8609706.md

```text
Dear Igor Grinberg,

> On 06/13/12 12:03, Zumeng Chen wrote:
> > 于 2012年06月13日 15:51, Igor Grinberg 写道:
> >> On 06/13/12 04:44, Zumeng Chen wrote:
> >>> From: Zumeng Chen<redacted>
> >>> 
> >>> If we don't set proper debouce time for ads7846, then there are
> >>> flooded interrupt counters of ads7846 responding to one time
> >>> touch on screen, so the driver couldn't work well.
> >>> 
> >>> And since most OMAP3 series boards pass NULL pointer of board_pdata
> >>> to omap_ads7846_init, so it's more proper to set it in driver level
> >>> after having gpio_request done.
> >>> 
> >>> This patch has been validated on 3530evm.
> >>> 
> >>> Signed-off-by: Zumeng Chen<redacted>
> >>> Signed-off-by: Syed Mohammed Khasim<redacted>
> >>> ---
> >>> 
> >>>   drivers/input/touchscreen/ads7846.c |    4 ++++
> >>>   1 files changed, 4 insertions(+), 0 deletions(-)
> >>> 
> >>> diff --git a/drivers/input/touchscreen/ads7846.c
> >>> b/drivers/input/touchscreen/ads7846.c index f02028e..459ff29 100644
> >>> --- a/drivers/input/touchscreen/ads7846.c
> >>> +++ b/drivers/input/touchscreen/ads7846.c
> >>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct
> >>> spi_device *spi, struct ads784
> >>> 
> >>>           }
> >>>           
> >>>           ts->gpio_pendown = pdata->gpio_pendown;
> >>> 
> >>> +#ifdef CONFIG_ARCH_OMAP3
> >>> +        /* 310 means about 10 microsecond for omap3 */
> >>> +        gpio_set_debounce(pdata->gpio_pendown, 310);
> >>> +#endif
> >> 
> >> Unless this concerns many boards/archs/platforms,
> > 
> > Yes, this is the case.
> > 
> >> I'd suggest you to implement
> >> the get_pendown_state() method in the board file.
> > 
> > it seems they are different way between gpio and
> > get_pendown_state, and gpio way is used for omap3
> > to drive ads7846, so I guess we may have to do like this.
> 
> No, this is not (and does not have to be) OMAP wide.
> The decision for this is made on per-board basis.

+1 agreed

> > Regards,
> > Zumeng
> > 
> >> If more users will need this, it can be facilitated in the driver.
> >> (and of course not with the ugly ifdefs...)
> >> 
> >>>       } else {
> >>>       
> >>>           dev_err(&spi->dev, "no get_pendown_state nor
> >>>           gpio_pendown?\n");

Best regards,
Marek Vasut
--
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
```

## \[PATCH V2 5/5\] Input: ads7846: set proper debounce time in driver level

- From: Zumeng Chen \<hidden\>
- Date: 2012-06-20 05:28:46 
- Message: https://ratatoskr.run/linux-input/2012/06/8609948.md

```text
于 2012年06月14日 14:59, Zumeng Chen 写道:
> 于 2012年06月14日 14:31, Hiremath, Vaibhav 写道:
>> On Thu, Jun 14, 2012 at 10:16:55, Zumeng Chen wrote:
>>> 于 2012年06月13日 20:18, Hiremath, Vaibhav 写道:
>>>> On Wed, Jun 13, 2012 at 07:14:10, Zumeng Chen wrote:
>>>>> From: Zumeng Chen<redacted>
>>>>>
>>>>> If we don't set proper debouce time for ads7846, then there are
>>>>> flooded interrupt counters of ads7846 responding to one time
>>>>> touch on screen, so the driver couldn't work well.
>>>>>
>>>>> And since most OMAP3 series boards pass NULL pointer of board_pdata
>>>>> to omap_ads7846_init, so it's more proper to set it in driver level
>>>>> after having gpio_request done.
>>>>>
>>>>> This patch has been validated on 3530evm.
>>>>>
>>>>> Signed-off-by: Zumeng Chen<redacted>
>>>>> Signed-off-by: Syed Mohammed Khasim<redacted>
>>>>> ---
>>>>>   drivers/input/touchscreen/ads7846.c |    4 ++++
>>>>>   1 files changed, 4 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
>>>>> index f02028e..459ff29 100644
>>>>> --- a/drivers/input/touchscreen/ads7846.c
>>>>> +++ b/drivers/input/touchscreen/ads7846.c
>>>>> @@ -980,6 +980,10 @@ static int __devinit ads7846_setup_pendown(struct spi_device *spi, struct ads784
>>>>>   		}
>>>>>
>>>>>   		ts->gpio_pendown = pdata->gpio_pendown;
>>>>> +#ifdef CONFIG_ARCH_OMAP3
>>>>> +		/* 310 means about 10 microsecond for omap3 */
>>>>> +		gpio_set_debounce(pdata->gpio_pendown, 310);
>>>>> +#endif
>>>>>
>>>> Zumeng,
>>>>
>>>> With my sign-off you are changing the original code, that too
>>>> without my sign-off and ack.
>>>> I wouldn't mind you to submit patches from my tree, but the expectation is
>>>> if you are changing the original code, it should be under your sign-off.
>>> Thanks, good to learn. I'll remove in next time.
>>>> Coming to the patch, #ifdef in driver is not recommended, and this 10msec
>>>> delay is specific to OMAP GPIO and driver should not be aware of this,
>>>> that's where you will find the original patch handling it in board file.
>>> According to the git blame of the board-omap3evm.c I think
>>> 96974a24 did a good thing to all the related codes for omap3
>>> boards. So I think we can call board and driver as BSP level :-)
>>>
>>> If #ifdef in driver can save many codes, I guess it's deserved.
>>>
>> No, not really.
>>
>> In the same commit, the debounce time is already handled as an argument to 
>> the function omap_ads7846_init(), and that’s the way it should be.
> That means you'd like to implement the same get_pendown_state for every
> omap3 board? Currently, board_pdata is NULL.
>
> And actually, the reason why I agree 96974a24 is that get_pendown_state
> for all omap3 boards is the common chip level gpio operations. so I think
> we should set debounce for them in one common point.
>
> But since Igor and you don't like them, I have created and tested the
> attachment
> patch, and I'd like Mike to check if convenience too
> But obviously there are more codes than mine before :-)
Hi Mike,

I'll send V3 with the change on the attachment to you for 5/5,
if you happen to get it, it's high appreciated to review it.

Regards,
Zumeng
>
> Regards,
> Zumeng
>> So no need for #ifdefs in driver...
>>
>> Thanks,
>> Vaibhav

```
