linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iio:kxcjk-1013: Add support for SMO8500 device
@ 2014-09-09 17:19 Bastien Nocera
  2014-09-09 18:53 ` Daniel Baluta
  2014-09-14 14:05 ` Jonathan Cameron
  0 siblings, 2 replies; 11+ messages in thread
From: Bastien Nocera @ 2014-09-09 17:19 UTC (permalink / raw)
  To: linux-iio; +Cc: Daniel Baluta

The Onda v975w tablet contains an accelerometer that's advertised over
ACPI as SMO8500. This device is however a KXCJ9 accelerometer as
can be seen in the Windows driver's INF file.

---

I tested the patch, and it works correctly in my testing. However,
there's no GPIO pin for the "data ready" interrupt, and this throws an
error that looks fatal in the logs (could this be downgraded?), and
the name of the device doesn't match the hid-sensor-hub ones, making it
hard for user-space to discover them.
(https://github.com/hadess/iio-sensor-proxy is my attempt at something
 that integrates with user-space and the IIO sensors)

It will also conflict with Daniel's patch here:
http://www.spinics.net/lists/linux-iio/msg14438.html

Cheers
---
 drivers/iio/accel/kxcjk-1013.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 7941cf2..dea5732 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -736,12 +736,14 @@ static SIMPLE_DEV_PM_OPS(kxcjk1013_pm_ops, kxcjk1013_suspend, kxcjk1013_resume);
 
 static const struct acpi_device_id kx_acpi_match[] = {
 	{"KXCJ1013", 0},
+	{"SMO8500", 0},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, kx_acpi_match);
 
 static const struct i2c_device_id kxcjk1013_id[] = {
 	{"kxcjk1013", 0},
+	{"SMO8500", 0},
 	{}
 };
 
-- 
2.1.0



^ permalink raw reply related	[flat|nested] 11+ messages in thread
* [PATCH] iio:kxcjk-1013: Add support for SMO8500 device
@ 2014-11-03 23:07 Bastien Nocera
  0 siblings, 0 replies; 11+ messages in thread
From: Bastien Nocera @ 2014-11-03 23:07 UTC (permalink / raw)
  To: linux-iio; +Cc: jic23

The Onda v975w tablet contains an accelerometer that's advertised over
ACPI as SMO8500. This device is however a KXCJ9 accelerometer as
can be seen in the Windows driver's INF file, and from the etching on
the chipset ("KXCJ9 41566 0414").

This patch also removes the attempt to get the IRQ for the "data ready"
signal, as it does not seem to be supported by this device on this
platform.
---
 drivers/iio/accel/kxcjk-1013.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index 98909a9..3b07e5f 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -108,6 +108,7 @@ struct kxcjk1013_data {
 	bool motion_trigger_on;
 	int64_t timestamp;
 	enum kx_chipset chipset;
+	bool is_smo8500_device;
 };
 
 enum kxcjk1013_axis {
@@ -1129,12 +1130,15 @@ static irqreturn_t kxcjk1013_data_rdy_trig_poll(int irq, void *private)
 }
 
 static const char *kxcjk1013_match_acpi_device(struct device *dev,
-					       enum kx_chipset *chipset)
+					       enum kx_chipset *chipset,
+					       bool *is_smo8500_device)
 {
 	const struct acpi_device_id *id;
 	id = acpi_match_device(dev->driver->acpi_match_table, dev);
 	if (!id)
 		return NULL;
+	if (strcmp (id->id, "SMO8500") == 0)
+		*is_smo8500_device = true;
 	*chipset = (enum kx_chipset)id->driver_data;
 
 	return dev_name(dev);
@@ -1149,6 +1153,8 @@ static int kxcjk1013_gpio_probe(struct i2c_client *client,
 
 	if (!client)
 		return -EINVAL;
+	if (data->is_smo8500_device)
+		return -ENOTSUPP;
 
 	dev = &client->dev;
 
@@ -1198,7 +1204,8 @@ static int kxcjk1013_probe(struct i2c_client *client,
 		name = id->name;
 	} else if (ACPI_HANDLE(&client->dev)) {
 		name = kxcjk1013_match_acpi_device(&client->dev,
-						   &data->chipset);
+						   &data->chipset,
+						   &data->is_smo8500_device);
 	} else
 		return -ENODEV;
 
@@ -1397,6 +1404,7 @@ static const struct acpi_device_id kx_acpi_match[] = {
 	{"KXCJ1013", KXCJK1013},
 	{"KXCJ1008", KXCJ91008},
 	{"KXTJ1009", KXTJ21009},
+	{"SMO8500",  KXCJK1013},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, kx_acpi_match);
@@ -1405,6 +1413,7 @@ static const struct i2c_device_id kxcjk1013_id[] = {
 	{"kxcjk1013", KXCJK1013},
 	{"kxcj91008", KXCJ91008},
 	{"kxtj21009", KXTJ21009},
+	{"SMO8500",   KXCJK1013},
 	{}
 };
 
-- 
2.1.0



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

end of thread, other threads:[~2014-11-03 23:08 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-09 17:19 [PATCH] iio:kxcjk-1013: Add support for SMO8500 device Bastien Nocera
2014-09-09 18:53 ` Daniel Baluta
2014-09-09 18:58   ` Bastien Nocera
2014-09-11 18:18   ` Bastien Nocera
2014-09-12 12:24     ` Daniel Baluta
2014-09-12 12:24       ` Bastien Nocera
2014-09-14 14:11         ` Jonathan Cameron
2014-09-25  8:49           ` Bastien Nocera
2014-09-25 12:47             ` Jonathan Cameron
2014-09-14 14:05 ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2014-11-03 23:07 Bastien Nocera

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).