All of lore.kernel.org
 help / color / mirror / Atom feed
* rx51: support for lis3lv02d accelerometer
@ 2012-05-04 15:37 Pali Rohár
  2012-05-09  0:07 ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2012-05-04 15:37 UTC (permalink / raw)
  To: linux-omap, linux-kernel, Lauri Leukkunen, Tony Lindgren,
	Sebastian Reichel, Felipe Contreras, Ameya Palande

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

Hi!

Upstream linux kernel has already driver for lis3lv02d accelerometer
in drivers/misc/lis3lv02d. So now can be added also platform support
for nokia rx51. Patch exists for long time in meego obs repository:
https://build.pub.meego.com/package/view_file?file=linux-2.6-omap-rx51-Platform-support-for-lis3lv02d-acceleromet.patch&package=kernel-adaptation-n900&project=CE%3AAdaptation%3AN900

It is possible to include this patch to upstream kernel?


diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index d87ee06..a49801f 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -44,6 +44,7 @@
 #include <linux/leds-lp5523.h>
 
 #include <../drivers/staging/iio/light/tsl2563.h>
+#include <linux/lis3lv02d.h>
 
 #include "mux.h"
 #include "hsmmc.h"
@@ -63,6 +64,9 @@
 #define RX51_TSC2005_RESET_GPIO         104
 #define RX51_TSC2005_IRQ_GPIO           100
 
+#define LIS302_IRQ1_GPIO 181
+#define LIS302_IRQ2_GPIO 180  /* Not yet in use */
+
 /* list all spi devices here */
 enum {
 	RX51_SPI_WL1251,
@@ -73,6 +77,77 @@ enum {
 static struct wl12xx_platform_data wl1251_pdata;
 static struct tsc2005_platform_data tsc2005_pdata;
 
+#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
+static int lis302_setup(void)
+{
+	int err;
+	int irq1 = LIS302_IRQ1_GPIO;
+	int irq2 = LIS302_IRQ2_GPIO;
+
+	/* gpio for interrupt pin 1 */
+	err = gpio_request(irq1, "lis3lv02dl_irq1");
+	if (err) {
+		printk(KERN_ERR "lis3lv02dl: gpio request failed\n");
+		goto out;
+	}
+
+	/* gpio for interrupt pin 2 */
+	err = gpio_request(irq2, "lis3lv02dl_irq2");
+	if (err) {
+		gpio_free(irq1);
+		printk(KERN_ERR "lis3lv02dl: gpio request failed\n");
+		goto out;
+	}
+
+	gpio_direction_input(irq1);
+	gpio_direction_input(irq2);
+
+out:
+	return err;
+}
+
+static int lis302_release(void)
+{
+	gpio_free(LIS302_IRQ1_GPIO);
+	gpio_free(LIS302_IRQ2_GPIO);
+
+        return 0;
+}
+
+static struct lis3lv02d_platform_data rx51_lis3lv02d_data = {
+	.click_flags    = LIS3_CLICK_SINGLE_X | LIS3_CLICK_SINGLE_Y |
+			  LIS3_CLICK_SINGLE_Z,
+	/* Limits are 0.5g * value */
+	.click_thresh_x = 8,
+	.click_thresh_y = 8,
+	.click_thresh_z = 10,
+	/* Click must be longer than time limit */
+	.click_time_limit = 9,
+	/* Kind of debounce filter */
+	.click_latency    = 50,
+
+	/* Limits for all axis. millig-value / 18 to get HW values */
+	.wakeup_flags = LIS3_WAKEUP_X_HI | LIS3_WAKEUP_Y_HI,
+	.wakeup_thresh = 800 / 18,
+	.wakeup_flags2 = LIS3_WAKEUP_Z_HI ,
+	.wakeup_thresh2 = 900 / 18,
+
+	.hipass_ctrl = LIS3_HIPASS1_DISABLE | LIS3_HIPASS2_DISABLE,
+
+	/* Interrupt line 2 for click detection, line 1 for thresholds */
+	.irq_cfg = LIS3_IRQ2_CLICK | LIS3_IRQ1_FF_WU_12,
+
+	.axis_x = LIS3_DEV_X,
+	.axis_y = LIS3_INV_DEV_Y,
+	.axis_z = LIS3_INV_DEV_Z,
+	.setup_resources = lis302_setup,
+	.release_resources = lis302_release,
+	.st_min_limits = {-32, 3, 3},
+	.st_max_limits = {-3, 32, 32},
+	.irq2 = OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO),
+};
+#endif
+
 #if defined(CONFIG_SENSORS_TSL2563) || defined(CONFIG_SENSORS_TSL2563_MODULE)
 static struct tsl2563_platform_data rx51_tsl2563_platform_data = {
 	.cover_comp_gain = 16,
@@ -950,6 +1025,16 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_2[] = {
 	}
 };
 
+static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = {
+#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
+	{
+		I2C_BOARD_INFO("lis3lv02d", 0x1d),
+		.platform_data = &rx51_lis3lv02d_data,
+		.irq = OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO),
+	},
+#endif
+};
+
 static int __init rx51_i2c_init(void)
 {
 	if ((system_rev >= SYSTEM_REV_S_USES_VAUX3 && system_rev < 0x100) ||
@@ -971,7 +1056,8 @@ static int __init rx51_i2c_init(void)
 	omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
 	omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
 			      ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
-	omap_register_i2c_bus(3, 400, NULL, 0);
+	omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3,
+			      ARRAY_SIZE(rx51_peripherals_i2c_board_info_3));
 	return 0;
 }
 


-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* Re: rx51: support for lis3lv02d accelerometer
  2012-05-04 15:37 rx51: support for lis3lv02d accelerometer Pali Rohár
@ 2012-05-09  0:07 ` Tony Lindgren
  2012-05-21 16:08     ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2012-05-09  0:07 UTC (permalink / raw)
  To: Pali Rohár
  Cc: linux-omap, linux-kernel, Lauri Leukkunen, Sebastian Reichel,
	Felipe Contreras, Ameya Palande

* Pali Rohár <pali.rohar@gmail.com> [120504 08:41]:
> Hi!
> 
> Upstream linux kernel has already driver for lis3lv02d accelerometer
> in drivers/misc/lis3lv02d. So now can be added also platform support
> for nokia rx51. Patch exists for long time in meego obs repository:
> https://build.pub.meego.com/package/view_file?file=linux-2.6-omap-rx51-Platform-support-for-lis3lv02d-acceleromet.patch&package=kernel-adaptation-n900&project=CE%3AAdaptation%3AN900
> 
> It is possible to include this patch to upstream kernel?

Thanks, applying into board branch with From: Ameya as in the
link above.

Regards,

Tony

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

* Re: rx51: support for lis3lv02d accelerometer
  2012-05-09  0:07 ` Tony Lindgren
@ 2012-05-21 16:08     ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2012-05-21 16:08 UTC (permalink / raw)
  To: Pali Rohár
  Cc: linux-omap, linux-kernel, Lauri Leukkunen, Sebastian Reichel,
	Felipe Contreras, Ameya Palande

Hi Pali,

* Tony Lindgren <tony@atomide.com> [120508 17:12]:
> * Pali Rohár <pali.rohar@gmail.com> [120504 08:41]:
> > Hi!
> > 
> > Upstream linux kernel has already driver for lis3lv02d accelerometer
> > in drivers/misc/lis3lv02d. So now can be added also platform support
> > for nokia rx51. Patch exists for long time in meego obs repository:
> > https://build.pub.meego.com/package/view_file?file=linux-2.6-omap-rx51-Platform-support-for-lis3lv02d-acceleromet.patch&package=kernel-adaptation-n900&project=CE%3AAdaptation%3AN900
> > 
> > It is possible to include this patch to upstream kernel?
> 
> Thanks, applying into board branch with From: Ameya as in the
> link above.

Just noticed that this one is still using OMAP_GPIO_IRQ that
won't work any longer. Can you please send a fix on top of this
patch against linux next to fix it?

The fix is to use gpio_to_irq() in the related init function
instead of static OMAP_GPIO_IRQ in the data structure.

Regards,

Tony

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

* Re: rx51: support for lis3lv02d accelerometer
@ 2012-05-21 16:08     ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2012-05-21 16:08 UTC (permalink / raw)
  To: Pali Rohár
  Cc: linux-omap, linux-kernel, Lauri Leukkunen, Sebastian Reichel,
	Felipe Contreras, Ameya Palande

Hi Pali,

* Tony Lindgren <tony@atomide.com> [120508 17:12]:
> * Pali Rohár <pali.rohar@gmail.com> [120504 08:41]:
> > Hi!
> > 
> > Upstream linux kernel has already driver for lis3lv02d accelerometer
> > in drivers/misc/lis3lv02d. So now can be added also platform support
> > for nokia rx51. Patch exists for long time in meego obs repository:
> > https://build.pub.meego.com/package/view_file?file=linux-2.6-omap-rx51-Platform-support-for-lis3lv02d-acceleromet.patch&package=kernel-adaptation-n900&project=CE%3AAdaptation%3AN900
> > 
> > It is possible to include this patch to upstream kernel?
> 
> Thanks, applying into board branch with From: Ameya as in the
> link above.

Just noticed that this one is still using OMAP_GPIO_IRQ that
won't work any longer. Can you please send a fix on top of this
patch against linux next to fix it?

The fix is to use gpio_to_irq() in the related init function
instead of static OMAP_GPIO_IRQ in the data structure.

Regards,

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

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

* Re: rx51: support for lis3lv02d accelerometer
  2012-05-21 16:08     ` Tony Lindgren
  (?)
@ 2012-05-23 18:22     ` Pali Rohár
  2012-06-04  7:27       ` [PATCH] ARM: OMAP: Fix lis3lv02d accelerometer to use gpio_to_irq Tony Lindgren
  -1 siblings, 1 reply; 6+ messages in thread
From: Pali Rohár @ 2012-05-23 18:22 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-omap, linux-kernel, Lauri Leukkunen, Sebastian Reichel,
	Felipe Contreras, Ameya Palande

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

On Monday 21 May 2012 09:08:40 Tony Lindgren wrote:
> Hi Pali,
> 
> * Tony Lindgren <tony@atomide.com> [120508 17:12]:
> > * Pali Rohár <pali.rohar@gmail.com> [120504 08:41]:
> > > Hi!
> > > 
> > > Upstream linux kernel has already driver for lis3lv02d
> > > accelerometer in drivers/misc/lis3lv02d. So now can be
> > > added also platform support for nokia rx51. Patch exists
> > > for long time in meego obs repository:
> > > https://build.pub.meego.com/package/view_file?file=linux-2
> > > .6-omap-rx51-Platform-support-for-lis3lv02d-acceleromet.pat
> > > ch&package=kernel-adaptation-n900&project=CE%3AAdaptation%3
> > > AN900
> > > 
> > > It is possible to include this patch to upstream kernel?
> > 
> > Thanks, applying into board branch with From: Ameya as in the
> > link above.
> 
> Just noticed that this one is still using OMAP_GPIO_IRQ that
> won't work any longer. Can you please send a fix on top of this
> patch against linux next to fix it?
> 
> The fix is to use gpio_to_irq() in the related init function
> instead of static OMAP_GPIO_IRQ in the data structure.
> 
> Regards,
> 
> Tony

Sorry, but now I do not have time for it. Tony, if fix is simple 
can you do it?

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* [PATCH] ARM: OMAP: Fix lis3lv02d accelerometer to use gpio_to_irq
  2012-05-23 18:22     ` Pali Rohár
@ 2012-06-04  7:27       ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2012-06-04  7:27 UTC (permalink / raw)
  To: Pali Rohár
  Cc: linux-omap, linux-kernel, Lauri Leukkunen, Sebastian Reichel,
	Felipe Contreras, Ameya Palande

Commit 3b511201 (ARM: OMAP: rx51: Platform support for lis3lv02d accelerometer)
added support for lis3lv02d accelerometer.

The patch was still using OMAP_GPIO_IRQ which no longer exists.

Fix it by using gpio_to_irq().

Signed-off-by: Tony Lindgren <tony@atomide.com>

---

Here's this one fixed. Compile and boot tested only, I don't have
physical access to my n900 right now.

--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -144,7 +144,6 @@ static struct lis3lv02d_platform_data rx51_lis3lv02d_data = {
 	.release_resources = lis302_release,
 	.st_min_limits = {-32, 3, 3},
 	.st_max_limits = {-3, 32, 32},
-	.irq2 = OMAP_GPIO_IRQ(LIS302_IRQ2_GPIO),
 };
 #endif
 
@@ -1030,7 +1029,6 @@ static struct i2c_board_info __initdata rx51_peripherals_i2c_board_info_3[] = {
 	{
 		I2C_BOARD_INFO("lis3lv02d", 0x1d),
 		.platform_data = &rx51_lis3lv02d_data,
-		.irq = OMAP_GPIO_IRQ(LIS302_IRQ1_GPIO),
 	},
 #endif
 };
@@ -1056,6 +1054,10 @@ static int __init rx51_i2c_init(void)
 	omap_pmic_init(1, 2200, "twl5030", INT_34XX_SYS_NIRQ, &rx51_twldata);
 	omap_register_i2c_bus(2, 100, rx51_peripherals_i2c_board_info_2,
 			      ARRAY_SIZE(rx51_peripherals_i2c_board_info_2));
+#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
+	rx51_lis3lv02d_data.irq2 = gpio_to_irq(LIS302_IRQ2_GPIO);
+	rx51_peripherals_i2c_board_info_3[0].irq = gpio_to_irq(LIS302_IRQ1_GPIO);
+#endif
 	omap_register_i2c_bus(3, 400, rx51_peripherals_i2c_board_info_3,
 			      ARRAY_SIZE(rx51_peripherals_i2c_board_info_3));
 	return 0;

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

end of thread, other threads:[~2012-06-04  7:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-04 15:37 rx51: support for lis3lv02d accelerometer Pali Rohár
2012-05-09  0:07 ` Tony Lindgren
2012-05-21 16:08   ` Tony Lindgren
2012-05-21 16:08     ` Tony Lindgren
2012-05-23 18:22     ` Pali Rohár
2012-06-04  7:27       ` [PATCH] ARM: OMAP: Fix lis3lv02d accelerometer to use gpio_to_irq Tony Lindgren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.