linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] AM3517: Add support for TSC2004 driver
@ 2009-11-19 14:47 hvaibhav
  2009-11-23 17:55 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: hvaibhav @ 2009-11-19 14:47 UTC (permalink / raw)
  To: linux-input; +Cc: linux-omap, Vaibhav Hiremath

From: Vaibhav Hiremath <hvaibhav@ti.com>


Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
---
 arch/arm/mach-omap2/board-am3517evm.c |   62 +++++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 415a13d..ae47b51 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -20,6 +20,8 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
+#include <linux/irq.h>
+#include <linux/i2c/tsc2004.h>
 
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -27,10 +29,64 @@
 #include <asm/mach/map.h>
 
 #include <plat/board.h>
+#include <plat/mux.h>
 #include <plat/common.h>
 #include <plat/usb.h>
 
 /*
+ * TSC 2004 Support
+ */
+#define	GPIO_TSC2004_IRQ	65
+
+static int tsc2004_init_irq(void)
+{
+	int ret = 0;
+
+	ret = gpio_request(GPIO_TSC2004_IRQ, "tsc2004-irq");
+	if (ret < 0) {
+		printk(KERN_WARNING "failed to request GPIO#%d: %d\n",
+				GPIO_TSC2004_IRQ, ret);
+		return ret;
+	}
+
+	if (gpio_direction_input(GPIO_TSC2004_IRQ)) {
+		printk(KERN_WARNING "GPIO#%d cannot be configured as "
+				"input\n", GPIO_TSC2004_IRQ);
+		return -ENXIO;
+	}
+
+	omap_set_gpio_debounce(GPIO_TSC2004_IRQ, 1);
+	omap_set_gpio_debounce_time(GPIO_TSC2004_IRQ, 0xa);
+	return ret;
+}
+
+static void tsc2004_exit_irq(void)
+{
+	gpio_free(GPIO_TSC2004_IRQ);
+}
+
+static int tsc2004_get_irq_level(void)
+{
+	return gpio_get_value(GPIO_TSC2004_IRQ) ? 0 : 1;
+}
+
+struct tsc2004_platform_data am3517evm_tsc2004data = {
+	.model = 2004,
+	.x_plate_ohms = 180,
+	.get_pendown_state = tsc2004_get_irq_level,
+	.init_platform_hw = tsc2004_init_irq,
+	.exit_platform_hw = tsc2004_exit_irq,
+};
+
+static struct i2c_board_info __initdata am3517evm_tsc_i2c_boardinfo[] = {
+	{
+		I2C_BOARD_INFO("tsc2004", 0x4B),
+		.type		= "tsc2004",
+		.platform_data	= &am3517evm_tsc2004data,
+	},
+};
+
+/*
  * Board initialization
  */
 static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
@@ -67,6 +123,12 @@ static void __init am3517_evm_init(void)
 
 	omap_serial_init();
 	usb_ehci_init(&ehci_pdata);
+
+	/* TSC 2004 */
+	omap_cfg_reg(U1_34XX_GPIO65);
+	am3517evm_tsc_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_TSC2004_IRQ);
+	i2c_register_board_info(1, am3517evm_tsc_i2c_boardinfo,
+				ARRAY_SIZE(am3517evm_tsc_i2c_boardinfo));
 }
 
 static void __init am3517_evm_map_io(void)
-- 
1.6.2.4


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

* Re: [PATCH 3/3] AM3517: Add support for TSC2004 driver
  2009-11-19 14:47 [PATCH 3/3] AM3517: Add support for TSC2004 driver hvaibhav
@ 2009-11-23 17:55 ` Tony Lindgren
  2009-11-24 14:18   ` Hiremath, Vaibhav
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2009-11-23 17:55 UTC (permalink / raw)
  To: hvaibhav; +Cc: linux-input, linux-omap

Hi,

* hvaibhav@ti.com <hvaibhav@ti.com> [091119 06:46]:
> From: Vaibhav Hiremath <hvaibhav@ti.com>
> 
> 
> Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
> ---
>  arch/arm/mach-omap2/board-am3517evm.c |   62 +++++++++++++++++++++++++++++++++
>  1 files changed, 62 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
> index 415a13d..ae47b51 100644
> --- a/arch/arm/mach-omap2/board-am3517evm.c
> +++ b/arch/arm/mach-omap2/board-am3517evm.c
> @@ -20,6 +20,8 @@
>  #include <linux/init.h>
>  #include <linux/platform_device.h>
>  #include <linux/gpio.h>
> +#include <linux/irq.h>
> +#include <linux/i2c/tsc2004.h>
>  
>  #include <mach/hardware.h>
>  #include <asm/mach-types.h>
> @@ -27,10 +29,64 @@
>  #include <asm/mach/map.h>
>  
>  #include <plat/board.h>
> +#include <plat/mux.h>
>  #include <plat/common.h>
>  #include <plat/usb.h>
>  
>  /*
> + * TSC 2004 Support
> + */
> +#define	GPIO_TSC2004_IRQ	65
> +
> +static int tsc2004_init_irq(void)
> +{
> +	int ret = 0;
> +
> +	ret = gpio_request(GPIO_TSC2004_IRQ, "tsc2004-irq");
> +	if (ret < 0) {
> +		printk(KERN_WARNING "failed to request GPIO#%d: %d\n",
> +				GPIO_TSC2004_IRQ, ret);
> +		return ret;
> +	}
> +
> +	if (gpio_direction_input(GPIO_TSC2004_IRQ)) {
> +		printk(KERN_WARNING "GPIO#%d cannot be configured as "
> +				"input\n", GPIO_TSC2004_IRQ);
> +		return -ENXIO;
> +	}
> +
> +	omap_set_gpio_debounce(GPIO_TSC2004_IRQ, 1);
> +	omap_set_gpio_debounce_time(GPIO_TSC2004_IRQ, 0xa);
> +	return ret;
> +}
> +
> +static void tsc2004_exit_irq(void)
> +{
> +	gpio_free(GPIO_TSC2004_IRQ);
> +}
> +
> +static int tsc2004_get_irq_level(void)
> +{
> +	return gpio_get_value(GPIO_TSC2004_IRQ) ? 0 : 1;
> +}
> +
> +struct tsc2004_platform_data am3517evm_tsc2004data = {
> +	.model = 2004,
> +	.x_plate_ohms = 180,
> +	.get_pendown_state = tsc2004_get_irq_level,
> +	.init_platform_hw = tsc2004_init_irq,
> +	.exit_platform_hw = tsc2004_exit_irq,
> +};
> +
> +static struct i2c_board_info __initdata am3517evm_tsc_i2c_boardinfo[] = {
> +	{
> +		I2C_BOARD_INFO("tsc2004", 0x4B),
> +		.type		= "tsc2004",
> +		.platform_data	= &am3517evm_tsc2004data,
> +	},
> +};
> +
> +/*
>   * Board initialization
>   */
>  static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
> @@ -67,6 +123,12 @@ static void __init am3517_evm_init(void)
>  
>  	omap_serial_init();
>  	usb_ehci_init(&ehci_pdata);
> +
> +	/* TSC 2004 */
> +	omap_cfg_reg(U1_34XX_GPIO65);
> +	am3517evm_tsc_i2c_boardinfo[0].irq = gpio_to_irq(GPIO_TSC2004_IRQ);
> +	i2c_register_board_info(1, am3517evm_tsc_i2c_boardinfo,
> +				ARRAY_SIZE(am3517evm_tsc_i2c_boardinfo));
>  }
>  
>  static void __init am3517_evm_map_io(void)

Can you please leave out the omap_cfg_reg call for new mux registers
from this patch? This way it will still compile and we can patch
in the muxing later on.

Regards,

Tony

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

* RE: [PATCH 3/3] AM3517: Add support for TSC2004 driver
  2009-11-23 17:55 ` Tony Lindgren
@ 2009-11-24 14:18   ` Hiremath, Vaibhav
  0 siblings, 0 replies; 3+ messages in thread
From: Hiremath, Vaibhav @ 2009-11-24 14:18 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-input@vger.kernel.org, linux-omap@vger.kernel.org


> -----Original Message-----
> From: Tony Lindgren [mailto:tony@atomide.com]
> Sent: Monday, November 23, 2009 11:25 PM
> To: Hiremath, Vaibhav
> Cc: linux-input@vger.kernel.org; linux-omap@vger.kernel.org
> Subject: Re: [PATCH 3/3] AM3517: Add support for TSC2004 driver
> 
> Hi,
> 
> * hvaibhav@ti.com <hvaibhav@ti.com> [091119 06:46]:
> > From: Vaibhav Hiremath <hvaibhav@ti.com>
> >
> >
> > Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
> > ---
> >  arch/arm/mach-omap2/board-am3517evm.c |   62
> +++++++++++++++++++++++++++++++++
> >  1 files changed, 62 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/board-am3517evm.c
> b/arch/arm/mach-omap2/board-am3517evm.c
> > index 415a13d..ae47b51 100644
> > --- a/arch/arm/mach-omap2/board-am3517evm.c
> > +++ b/arch/arm/mach-omap2/board-am3517evm.c
> > @@ -20,6 +20,8 @@
> >  #include <linux/init.h>
> >  #include <linux/platform_device.h>
> >  #include <linux/gpio.h>
> > +#include <linux/irq.h>
> > +#include <linux/i2c/tsc2004.h>
> >
> >  #include <mach/hardware.h>
> >  #include <asm/mach-types.h>
> > @@ -27,10 +29,64 @@
> >  #include <asm/mach/map.h>
> >
> >  #include <plat/board.h>
> > +#include <plat/mux.h>
> >  #include <plat/common.h>
> >  #include <plat/usb.h>
> >
> >  /*
> > + * TSC 2004 Support
> > + */
> > +#define	GPIO_TSC2004_IRQ	65
> > +
> > +static int tsc2004_init_irq(void)
> > +{
> > +	int ret = 0;
> > +
> > +	ret = gpio_request(GPIO_TSC2004_IRQ, "tsc2004-irq");
> > +	if (ret < 0) {
> > +		printk(KERN_WARNING "failed to request GPIO#%d: %d\n",
> > +				GPIO_TSC2004_IRQ, ret);
> > +		return ret;
> > +	}
> > +
> > +	if (gpio_direction_input(GPIO_TSC2004_IRQ)) {
> > +		printk(KERN_WARNING "GPIO#%d cannot be configured as "
> > +				"input\n", GPIO_TSC2004_IRQ);
> > +		return -ENXIO;
> > +	}
> > +
> > +	omap_set_gpio_debounce(GPIO_TSC2004_IRQ, 1);
> > +	omap_set_gpio_debounce_time(GPIO_TSC2004_IRQ, 0xa);
> > +	return ret;
> > +}
> > +
> > +static void tsc2004_exit_irq(void)
> > +{
> > +	gpio_free(GPIO_TSC2004_IRQ);
> > +}
> > +
> > +static int tsc2004_get_irq_level(void)
> > +{
> > +	return gpio_get_value(GPIO_TSC2004_IRQ) ? 0 : 1;
> > +}
> > +
> > +struct tsc2004_platform_data am3517evm_tsc2004data = {
> > +	.model = 2004,
> > +	.x_plate_ohms = 180,
> > +	.get_pendown_state = tsc2004_get_irq_level,
> > +	.init_platform_hw = tsc2004_init_irq,
> > +	.exit_platform_hw = tsc2004_exit_irq,
> > +};
> > +
> > +static struct i2c_board_info __initdata
> am3517evm_tsc_i2c_boardinfo[] = {
> > +	{
> > +		I2C_BOARD_INFO("tsc2004", 0x4B),
> > +		.type		= "tsc2004",
> > +		.platform_data	= &am3517evm_tsc2004data,
> > +	},
> > +};
> > +
> > +/*
> >   * Board initialization
> >   */
> >  static struct omap_board_config_kernel am3517_evm_config[]
> __initdata = {
> > @@ -67,6 +123,12 @@ static void __init am3517_evm_init(void)
> >
> >  	omap_serial_init();
> >  	usb_ehci_init(&ehci_pdata);
> > +
> > +	/* TSC 2004 */
> > +	omap_cfg_reg(U1_34XX_GPIO65);
> > +	am3517evm_tsc_i2c_boardinfo[0].irq =
> gpio_to_irq(GPIO_TSC2004_IRQ);
> > +	i2c_register_board_info(1, am3517evm_tsc_i2c_boardinfo,
> > +				ARRAY_SIZE(am3517evm_tsc_i2c_boardinfo));
> >  }
> >
> >  static void __init am3517_evm_map_io(void)
> 
> Can you please leave out the omap_cfg_reg call for new mux registers
> from this patch? This way it will still compile and we can patch
> in the muxing later on.
> 
[Hiremath, Vaibhav] I will resubmit the patch excluding omap_cfg_reg statement. As of now, I can handle this in u-boot to test, till we don't migrate to new mux framework.

Thanks,
Vaibhav

> Regards,
> 
> Tony

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

end of thread, other threads:[~2009-11-24 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-19 14:47 [PATCH 3/3] AM3517: Add support for TSC2004 driver hvaibhav
2009-11-23 17:55 ` Tony Lindgren
2009-11-24 14:18   ` Hiremath, Vaibhav

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