[RFC v2] regmap: Add regmap_pipe_read API

2016-07-20 Thread Crestez Dan Leonard
nded. This breaks if caching is enabled and reg+1 happens to be a cacheable register. Without regmap support refactoring a driver to enable regmap caching requires separate i2c and spi paths. This is exactly what regmap is supposed to help avoid. Suggested-by: Jonathan Cameron Signed-off-by: C

Re: [PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible

2016-07-20 Thread Crestez Dan Leonard
On 07/19/2016 01:22 PM, Mark Brown wrote: > On Wed, Jul 13, 2016 at 02:53:42PM +0300, Crestez Dan Leonard wrote: >> When using devicetree spi_device.modalias is set to the compatible >> string with the vendor prefix removed. For SPI devices described via >> ACPI the i2c_boar

[PATCH v2 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node

2016-07-13 Thread Crestez Dan Leonard
When using devicetree stuff like i2c_client.name or spi_device.modalias is initialized to the first DT compatible id with the vendor prefix stripped. Since some drivers rely on this try to replicate it when using ACPI with DT ids. Signed-off-by: Crestez Dan Leonard --- drivers/acpi/bus.c

[PATCH v2 2/3] acpi i2c: Initialize info.type from of_compatible

2016-07-13 Thread Crestez Dan Leonard
;. If the of_compatible property is present try to use that instead. This makes it easier to instantiate i2c drivers through ACPI with DT ids. Signed-off-by: Crestez Dan Leonard --- drivers/i2c/i2c-core.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/d

[PATCH v2 0/3] Init device ids from ACPI of_compatible

2016-07-13 Thread Crestez Dan Leonard
rlays got it. * Change acpi_of_modalias outlen param to size_t * Use {} after else Crestez Dan Leonard (3): acpi: Export acpi_of_modalias equiv of of_modalias_node acpi i2c: Initialize info.type from of_compatible acpi spi: Initialize modalias from of_compatible drivers/acpi/bus.c |

[PATCH v2 3/3] acpi spi: Initialize modalias from of_compatible

2016-07-13 Thread Crestez Dan Leonard
;. Change acpi_register_spi_device to use the of_compatible property if present. This makes it easier to instantiate spi drivers through ACPI with DT ids. Signed-off-by: Crestez Dan Leonard --- drivers/spi/spi.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/s

[PATCH] iio: Fix missing unlock on duplicate trigger

2016-06-28 Thread Crestez Dan Leonard
Since duplicate trigger names are supposed to cause errors at probe time anyway this issue is unlikely to affect anyone. Fixes commit 2e2b6a13f5f5119c36551c1ab99b85e0ad1a2105: iio: Refuse to register triggers with duplicate names Signed-off-by: Crestez Dan Leonard --- drivers/iio/industrialio

Re: [RFC] regmap: Add regmap_pipe_read API

2016-06-22 Thread Crestez Dan Leonard
On 06/21/2016 09:42 PM, Mark Brown wrote: > On Thu, Jun 16, 2016 at 06:24:36PM +0300, Crestez Dan Leonard wrote: > >> +val = ((u8*)val) + read_len; > > This cast looks broken, you should be able to do pointer arithmetic on > void pointers as though they we

Re: [PATCH v3] iio: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors

2016-06-21 Thread Crestez Dan Leonard
On 06/19/2016 02:57 PM, Jonathan Cameron wrote: > On 17/06/16 12:10, Crestez Dan Leonard wrote: >> From: Peter Meerwald >> >> The si114x supports x=1,2,3 IR LEDs for proximity sensing together with >> visible and IR ambient light sensing (ALS). >> >> Newer

Re: [PATCH 2/3] acpi i2c: Initialize info.type from of_compatible

2016-06-17 Thread Crestez Dan Leonard
On 06/16/2016 11:11 AM, Mika Westerberg wrote: > On Wed, Jun 15, 2016 at 09:30:28PM +0300, Crestez Dan Leonard wrote: >> When using devicetree i2c_board_info.type is set to the compatible >> string with the vendor prefix removed. For I2C devices described via >> ACPI the i2c_b

[PATCH v3] iio: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors

2016-06-17 Thread Crestez Dan Leonard
er 0x1a as 'reserved'. It might make sense to just return a constant on these models. This was tested on si1143 and si1145 Link to v2: https://www.spinics.net/lists/linux-iio/msg25055.html Signed-off-by: Peter Meerwald Signed-off-by: Crestez Dan Leonard --- drivers/iio/light/Kconfi

Re: [RFC] regmap: Add regmap_pipe_read API

2016-06-17 Thread Crestez Dan Leonard
On 06/16/2016 06:43 PM, Geert Uytterhoeven wrote: > Hi Leonard, > > On Thu, Jun 16, 2016 at 5:24 PM, Crestez Dan Leonard > wrote: >> The regmap API usually assumes that bulk read operations will read a >> range of registers but some I2C/SPI devices have certain registe

[RFC] regmap: Add regmap_pipe_read API

2016-06-16 Thread Crestez Dan Leonard
happens to be a cacheable register. Without regmap support refactoring a driver to enable regmap caching requires separate I2C and SPI paths. This is exactly what regmap is supposed to help avoid. Suggested-by: Jonathan Cameron Signed-off-by: Crestez Dan Leonard --- This works as expected for mpu6050

[PATCH 3/3] acpi spi: Initialize modalias from of_compatible

2016-06-15 Thread Crestez Dan Leonard
;. Change acpi_register_spi_device to use the of_compatible property if present. This makes it easier to instantiate spi drivers through ACPI with DT ids. Signed-off-by: Crestez Dan Leonard --- drivers/spi/spi.c | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi.c

[PATCH 2/3] acpi i2c: Initialize info.type from of_compatible

2016-06-15 Thread Crestez Dan Leonard
;. If the of_compatible property is present try to use that instead. This makes it easier to instantiate i2c drivers through ACPI with DT ids. Signed-off-by: Crestez Dan Leonard --- drivers/i2c/i2c-core.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core.c b/d

[PATCH 1/3] acpi: Export acpi_of_modalias equiv of of_modalias_node

2016-06-15 Thread Crestez Dan Leonard
When using devicetree stuff like i2c_client.name or spi_device.modalias is initialized to the first DT compatible id with the vendor prefix stripped. Since some drivers rely on this try to replicate it when using ACPI with DT ids. Signed-off-by: Crestez Dan Leonard --- drivers/acpi/bus.c

[PATCH 0/3] Init device ids from ACPI of_compatible

2016-06-15 Thread Crestez Dan Leonard
patible", "st,lis3dh"}, } }) } The driver for that device supports tens of models is not aware of ACPI. Like to prev thread: https://www.spinics.net/lists/linux-acpi/msg66469.html Like to acpi overlays: https://www.spinics.net/lists/linux-acpi/msg66638.html Crestez

Re: [RFC v2 2/2] i2c: Pass i2c_device_id to probe func when using DT ids through ACPI

2016-06-10 Thread Crestez Dan Leonard
On 06/10/2016 09:32 AM, Mika Westerberg wrote: > On Thu, Jun 09, 2016 at 04:06:03PM +0300, Crestez Dan Leonard wrote: >> When devices are instatiated through devicetree the i2c_client->name is >> set to the compatible string with company name stripped out. This is >

Re: [RFC v2 2/2] i2c: Pass i2c_device_id to probe func when using DT ids through ACPI

2016-06-10 Thread Crestez Dan Leonard
On 06/10/2016 10:04 AM, Wolfram Sang wrote: > On Thu, Jun 09, 2016 at 04:06:03PM +0300, Crestez Dan Leonard wrote: >> When devices are instatiated through devicetree the i2c_client->name is >> set to the compatible string with company name stripped out. This is >> then matc

[RFC v2 2/2] i2c: Pass i2c_device_id to probe func when using DT ids through ACPI

2016-06-09 Thread Crestez Dan Leonard
ate between model numbers. When using ACPI this id parameter is NULL and the driver usually needs to do ACPI-specific differentiation. This patch attempts to find a valid i2c_device_id when using ACPI with DT-like compatible strings. Signed-off-by: Crestez Dan Leonard --- drivers/i2c/i2c-core.c |

[RFC v2 1/2] acpi: Expose acpi_of_match_device

2016-06-09 Thread Crestez Dan Leonard
This can be used by device drivers as the equivalent of of_match_device when they are instantiated through ACPI using devicetree IDs. This is described in Documentation/acpi/enumeration.txt Signed-off-by: Crestez Dan Leonard --- drivers/acpi/bus.c | 13 +++-- include/linux/acpi.h | 8

[RFC v2 0/2] Match i2c_device_id when using DT ids through ACPI

2016-06-09 Thread Crestez Dan Leonard
ch_device will have the same signature as of_match_device. The purpose of these changes would be to make more drivers easier to instantiate through ACPI firmware. v2 fixes the code to actually work correctly. Hopefully the patches will also be sent to the correct addresses this time. Crestez Dan

[RFC 0/2] Match i2c_device_id when using DT ids through ACPI

2016-06-06 Thread Crestez Dan Leonard
ch_device will have the same signature as of_match_device. The purpose of these changes would be to make more drivers easier to instantiate through ACPI firmware. It's possible that I misunderstood and this problem already has a different solution. Crestez Dan Leonard (2): acpi: Expose

[RFC 1/2] acpi: Expose acpi_of_match_device

2016-06-06 Thread Crestez Dan Leonard
This can be used by device drivers as the equivalent of of_match_device when they are instantiated through ACPI using devicetree IDs. This is described in Documentation/acpi/enumeration.txt Signed-off-by: Crestez Dan Leonard --- drivers/acpi/bus.c | 13 +++-- include/linux/acpi.h | 8

[RFC 2/2] i2c: Pass i2c_device_id to probe func when using DT ids through ACPI

2016-06-06 Thread Crestez Dan Leonard
ate between model numbers. When using ACPI this id parameter is NULL and the driver usually needs to do ACPI-specific differentiation. This patch attempts to find a valid i2c_device_id when using ACPI with DT-like compatible strings. Signed-off-by: Crestez Dan Leonard --- drivers/i2c/i2c-core.c |

[PATCH] iio: generic_buffer: Fix --trigger-num option

2016-06-03 Thread Crestez Dan Leonard
Initialize trig_num to -1 and handle trig_num=0 as a valid id. Fixes: 7c7e9dad (iio: iio_generic_buffer: Add --trigger-num option) Signed-off-by: Crestez Dan Leonard --- tools/iio/iio_generic_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/iio

Re: [PATCH v4 0/3] iio: generic_buffer: Select device/trigger by number

2016-06-03 Thread Crestez Dan Leonard
On 05/30/2016 06:19 PM, Crestez Dan Leonard wrote: > This patch series adds support for selecting iio devices/triggers by numeric > id > rather than just name. This is useful because the names are not actually > guaranteed to be unique. > > Changes since v3: > * Rebase o

[PATCH] iio: inv_mpu6050: Fix use-after-free in ACPI code

2016-06-03 Thread Crestez Dan Leonard
In some cases this can result in incorrectly returning a negative value from asus_acpi_get_sensor_info and the AK8963 magnetometer failing to show up. Cc: Srinivas Pandruvada Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c | 5 +++-- 1 file changed, 3

Re: [PATCH v2 6/7] iio: inv_mpu6050: Reformat sample for active scan mask

2016-05-31 Thread Crestez Dan Leonard
On 05/31/2016 12:42 AM, Jonathan Cameron wrote: > On 30 May 2016 14:44:41 BST, Crestez Dan Leonard > wrote: >> On 05/29/2016 06:47 PM, Jonathan Cameron wrote: >>> On 18/05/16 16:00, Crestez Dan Leonard wrote: >>>> Right now it is possible to only enable s

[PATCH v2] iio: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors

2016-05-30 Thread Crestez Dan Leonard
From: Peter Meerwald The si114x supports x=1,2,3 IR LEDs for proximity sensing together with visible and IR ambient light sensing (ALS). Newer parts (si1132, si1145/6/7) can measure UV light and compute an UV index Signed-off-by: Peter Meerwald Signed-off-by: Crestez Dan Leonard --- Changes

[PATCH v4 1/3] iio: generic_buffer: Cleanup when receiving signals

2016-05-30 Thread Crestez Dan Leonard
can all be done under a single error label. Signed-off-by: Crestez Dan Leonard --- tools/iio/iio_generic_buffer.c | 172 ++--- 1 file changed, 108 insertions(+), 64 deletions(-) diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c in

[PATCH v4 2/3] iio: generic_buffer: Add --device-num option

2016-05-30 Thread Crestez Dan Leonard
This makes it possible to distinguish between iio devices with the same name. Signed-off-by: Crestez Dan Leonard --- tools/iio/iio_generic_buffer.c | 69 +++--- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/tools/iio/iio_generic_buffer.c b

[PATCH v4 3/3] iio: generic_buffer: Add --trigger-num option

2016-05-30 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- tools/iio/iio_generic_buffer.c | 36 ++-- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c index 3f16e9f..0e8a1f7 100644 --- a/tools/iio

[PATCH v4 0/3] iio: generic_buffer: Select device/trigger by number

2016-05-30 Thread Crestez Dan Leonard
and check if >= 0 for valid id. Jonathan: you replied to v3 saying that they were applied but I don't see those patches on any branch from your repo: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git Crestez Dan Leonard (3): iio: generic_buffer: Cleanup when receiving

Re: [PATCH v2 6/7] iio: inv_mpu6050: Reformat sample for active scan mask

2016-05-30 Thread Crestez Dan Leonard
On 05/29/2016 06:47 PM, Jonathan Cameron wrote: > On 18/05/16 16:00, Crestez Dan Leonard wrote: >> Right now it is possible to only enable some of the x/y/z channels, for >> example you can enable accel_z without x or y but if you actually do >> that what you get is actual

Re: [RFC 6/7] iio: Refuse to register triggers with duplicate names

2016-05-30 Thread Crestez Dan Leonard
On 05/29/2016 10:48 PM, Jonathan Cameron wrote: > On 23/05/16 19:40, Crestez Dan Leonard wrote: >> The trigger name is documented as unique but drivers are currently >> allowed to register triggers with duplicate names. This should be >> considered a bug since it makes

Re: [RFC] iio: Add driver for Silabs si1132, si1141/2/3 and si1145/6/7 ambient light, uv index and proximity sensors

2016-05-24 Thread Crestez Dan Leonard
ensors/Pages/HID-USB-to-IR-Reference-Design.aspx > > Signed-off-by: Peter Meerwald > --- > This is the code I am currently working on, partly tested. I've stripped some > features from earlier versions and added support for newer chips. > I hope this is useful to Crestez Dan L

Re: [PATCH 3/3] iio: st_sensors: Use level interrupts

2016-05-24 Thread Crestez Dan Leonard
On 05/24/2016 02:40 PM, Linus Walleij wrote: > On Fri, May 13, 2016 at 8:43 PM, Crestez Dan Leonard > wrote: > >> As far as I can tell DRDY for ST sensors behaves as a level rather than >> edge interrupt. Registering for IRQF_TRIGGER_RISING instead of >> IRQF_TRIGG

Re: [PATCH 1/3] iio: st_sensors: Init trigger before irq request

2016-05-24 Thread Crestez Dan Leonard
On 05/24/2016 02:27 PM, Linus Walleij wrote: > On Fri, May 13, 2016 at 8:43 PM, Crestez Dan Leonard > wrote: > >> This fixes a possible race where an interrupt arrives before complete >> initialization and crashes because iio_trigger_get_drvdata returns NULL. >>

[RFC 4/7] iio: Add current_trigger_id alternative

2016-05-23 Thread Crestez Dan Leonard
This allows controlling the current trigger by numeric ID rather than name. Signed-off-by: Crestez Dan Leonard --- Documentation/ABI/testing/sysfs-bus-iio | 9 +++ Documentation/DocBook/iio.tmpl | 4 +- drivers/iio/industrialio-trigger.c | 115

[RFC 6/7] iio: Refuse to register triggers with duplicate names

2016-05-23 Thread Crestez Dan Leonard
The trigger name is documented as unique but drivers are currently allowed to register triggers with duplicate names. This should be considered a bug since it makes the 'current_trigger' interface unusable. Signed-off-by: Crestez Dan Leonard --- drivers/iio/industrialio-trig

[PATCHv3 3/7] iio: generic_buffer: Add --trigger-num option

2016-05-23 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 34 +- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 3f16e9f..e8c3052 100644 --- a/tools/iio/generic_buffer.c +++ b

[RFC 0/7] Deal with iio trigger names

2016-05-23 Thread Crestez Dan Leonard
sede the v2 I posted earlier: https://www.spinics.net/lists/linux-iio/msg24867.html Crestez Dan Leonard (7): iio: generic_buffer: Cleanup when receiving signals iio: generic_buffer: Add --device-num option iio: generic_buffer: Add --trigger-num option iio: Add current_trigger_id alternativ

[RFC 7/7] iio: Make trigger names unique

2016-05-23 Thread Crestez Dan Leonard
This changes the format of trigger names for some drivers so that the result always includes indio_dev->id and is thus unique. Signed-off-by: Crestez Dan Leonard --- drivers/iio/adc/max1027.c | 4 ++-- drivers/iio/common/st_sensors/st_sensors_trigger.c | 2 +- driv

[PATCHv3 1/7] iio: generic_buffer: Cleanup when receiving signals

2016-05-23 Thread Crestez Dan Leonard
can all be done under a single error label. Signed-off-by: Crestez Dan Leonard --- Changes since v2: Initialize data to NULL to prevent crash on free. tools/iio/generic_buffer.c | 172 - 1 file changed, 108 insertions(+), 64 deletions(-) diff --git a/to

[PATCHv3 2/7] iio: generic_buffer: Add --device-num option

2016-05-23 Thread Crestez Dan Leonard
This makes it possible to distinguish between iio devices with the same name. Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 69 ++ 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools

[RFC 5/7] iio: generic_buffer: Use current_trigger_id

2016-05-23 Thread Crestez Dan Leonard
This is a preferred alternative to 'current_trigger'. Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index e8c3052..b23371a 100644 -

Re: [PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals

2016-05-23 Thread Crestez Dan Leonard
On 05/21/2016 07:28 PM, Jonathan Cameron wrote: > On 20/05/16 16:55, Peter Meerwald-Stadler wrote: >> >>> This also drops all the code freeing string buffers at the end of main. >>> Memory is freed when the process exits anyway so there's no point in >>> cluttering the code with all those gotos. >>

[PATCH v2 2/2] iio: generic_buffer: Add --device-num option

2016-05-23 Thread Crestez Dan Leonard
This makes it possible to distinguish between iio devices with the same name. Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 69 ++ 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools

[PATCH v2 1/2] iio: generic_buffer: Cleanup when receiving signals

2016-05-23 Thread Crestez Dan Leonard
can all be done under a single error label. Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 170 - 1 file changed, 107 insertions(+), 63 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 2429

[PATCH 2/2] iio: generic_buffer: Add --device-num option

2016-05-20 Thread Crestez Dan Leonard
This makes it possible to distinguish between iio devices with the same name. Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 53 ++ 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools

[PATCH 1/2] iio: generic_buffer: Cleanup when receiving signals

2016-05-20 Thread Crestez Dan Leonard
x27;s no point in cluttering the code with all those gotos. Signed-off-by: Crestez Dan Leonard --- tools/iio/generic_buffer.c | 162 - 1 file changed, 88 insertions(+), 74 deletions(-) diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer

[PATCH] max44000: Remove scale from proximity

2016-05-20 Thread Crestez Dan Leonard
y: Crestez Dan Leonard --- drivers/iio/light/max44000.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/iio/light/max44000.c b/drivers/iio/light/max44000.c index e01e58a..f17cb2e 100644 --- a/drivers/iio/light/max44000.c +++ b/drivers/iio/light/max44000.c @@ -147,7 +147,6 @@ static co

Re: [PATCH v2 2/7] iio: inv_mpu6050: Initial regcache support

2016-05-20 Thread Crestez Dan Leonard
On 05/20/2016 09:39 AM, Peter Rosin wrote: > On 2016-05-20 04:34, Matt Ranostay wrote: >> On Wed, May 18, 2016 at 8:00 AM, Crestez Dan Leonard >> wrote: >>> Signed-off-by: Crestez Dan Leonard >>> --- >>> drive

[RFC] iio: add driver for si114x ambient light / proximity sensors

2016-05-19 Thread Crestez Dan Leonard
affordable reference design (via Digikey), see http://www.silabs.com/products/sensors/Pages/HID-USB-to-IR-Reference-Design.aspx Signed-off-by: Peter Meerwald Signed-off-by: Crestez Dan Leonard --- This is based on an old driver by Peter which was posted for review but not actually submitted. I

[RFC v2 5/7] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-05-18 Thread Crestez Dan Leonard
implemented by this patch. This I2C master mode also works when the MPU itself is connected via SPI. I2C master supports up to 5 slaves. Slaves 0-3 have a common operating mode while slave 4 is different. This patch implements an i2c adapter using slave 4. Signed-off-by: Crestez Dan Leonard

[PATCH v2 6/7] iio: inv_mpu6050: Reformat sample for active scan mask

2016-05-18 Thread Crestez Dan Leonard
: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 8 +++ drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c | 107 - 2 files changed, 112 insertions(+), 3 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h b/drivers/iio/imu/inv_mpu6050

[RFC v2 7/7] iio: inv_mpu6050: Expose channels from slave sensors

2016-05-18 Thread Crestez Dan Leonard
it to configure stuff like sample rates and scaling factors. Buffer values are read from the MPU fifo, allowing a much higher sampling rate. Signed-off-by: Crestez Dan Leonard --- .../devicetree/bindings/iio/imu/inv_mpu6050.txt| 47 ++- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

[PATCH v2 0/7] iio: inv_mpu6050: Support i2c master and external readings

2016-05-18 Thread Crestez Dan Leonard
registers For external channels support: * Only enable i2c slaves when required * Also forward write_raw for external channels * Drop handling read_raw from EXT_SENS registers * List external channels by scan index * Allow external channels with arbitrary sizes Crestez Dan Leonard (7): iio:

[PATCH v2 4/7] iio: inv_mpu6050: Cache non-volatile bits of user_ctrl

2016-05-18 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 2 ++ drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c| 9 ++--- drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iio/imu

[PATCH v2 3/7] iio: inv_mpu6050: Only toggle DATA_RDY_EN in inv_reset_fifo

2016-05-18 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c| 13 - drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu

[PATCH v2 1/7] iio: inv_mpu6050: Do burst reads using spi/i2c directly

2016-05-18 Thread Crestez Dan Leonard
Using regmap_read_bulk is wrong because it assumes that a range of registers is being read. In our case reading from the fifo register will return multiple values but this is *not* auto-increment. This currently works by accident. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu

[PATCH v2 2/7] iio: inv_mpu6050: Initial regcache support

2016-05-18 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 47 ++ drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 5 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 1 + drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 5 4 files changed

[PATCH 2/3] iio: st_sensors: Disable DRDY at init time

2016-05-13 Thread Crestez Dan Leonard
Walleij Cc: Giuseppe Barba Cc: Denis Ciocca Signed-off-by: Crestez Dan Leonard --- drivers/iio/common/st_sensors/st_sensors_core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/iio/common/st_sensors/st_sensors_core.c b/drivers/iio/common/st_sensors/st_sensors_core.c index 928ee68

[PATCH 1/3] iio: st_sensors: Init trigger before irq request

2016-05-13 Thread Crestez Dan Leonard
This fixes a possible race where an interrupt arrives before complete initialization and crashes because iio_trigger_get_drvdata returns NULL. Cc: Linus Walleij Cc: Giuseppe Barba Cc: Denis Ciocca Signed-off-by: Crestez Dan Leonard --- I ran into this while breaking the driver. But since the

[PATCH 3/3] iio: st_sensors: Use level interrupts

2016-05-13 Thread Crestez Dan Leonard
Linus Walleij Cc: Giuseppe Barba Cc: Denis Ciocca Signed-off-by: Crestez Dan Leonard --- This is an alternative fix to this patch: https://www.spinics.net/lists/linux-iio/msg24722.html [PATCH 2/2 v6] iio: st_sensors: read surplus samples in trigger. It's not clear if all st_sensors b

Re: [RFC 5/7] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-05-05 Thread Crestez Dan Leonard
On 05/01/2016 08:27 PM, Jonathan Cameron wrote: > On 29/04/16 20:02, Crestez Dan Leonard wrote: >> --- a/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt >> +++ b/Documentation/devicetree/bindings/iio/imu/inv_mpu6050.txt >> @@ -1,16 +1,27 @@ >> InvenSe

Re: [PATCH 6/7] iio: inv_mpu6050: Check channel configuration on preenable

2016-05-04 Thread Crestez Dan Leonard
On 05/04/2016 12:01 PM, Jonathan Cameron wrote: > On 03/05/16 14:01, Crestez Dan Leonard wrote: >> On 05/01/2016 08:34 PM, Jonathan Cameron wrote: >>> On 29/04/16 20:02, Crestez Dan Leonard wrote: >>>> Right now it is possible to only enable some of the x/y/z chan

Re: Regression in inv_mpu6050: 4.6.0-rc5

2016-05-03 Thread Crestez Dan Leonard
On 05/01/2016 10:58 PM, Jonathan Cameron wrote: > On 27/04/16 16:56, One Thousand Gnomes wrote: >> On Tue, 26 Apr 2016 18:07:55 -0500 >> Michael Welling wrote: >> >>> On Tue, Apr 26, 2016 at 11:26:51PM +0100, One Thousand Gnomes wrote: This now causes us to crash and burn on the ASUS T10

Re: [PATCH 6/7] iio: inv_mpu6050: Check channel configuration on preenable

2016-05-03 Thread Crestez Dan Leonard
On 05/01/2016 08:34 PM, Jonathan Cameron wrote: > On 29/04/16 20:02, Crestez Dan Leonard wrote: >> Right now it is possible to only enable some of the x/y/z channels, for >> example you can enable accel_z without x or y. If you actually do that >> what you get is actual

[PATCHv2] iio: Fix error handling in iio_trigger_attach_poll_func

2016-05-03 Thread Crestez Dan Leonard
triggered buffers a failure to enable the trigger used to make the buffer unusable. Signed-off-by: Crestez Dan Leonard --- Previous version was sent as a RFC. This version also properly handles errors from iio_trigger_get_irq and request_threaded_irq. Calling request_threaded_irq with a negative/i

Re: [RFC] iio: Release irq if set_trigger_state fails

2016-05-03 Thread Crestez Dan Leonard
On 05/01/2016 10:11 PM, Jonathan Cameron wrote: > On 28/04/16 17:40, Crestez Dan Leonard wrote: >> When attaching a pollfunc iio_trigger_attach_poll_func will allocate a >> virtual irq and call the driver's set_trigger_state function. Fix error >> handling to release th

Re: [RFC 0/7] iio: inv_mpu6050: Support i2c master and external readings

2016-05-03 Thread Crestez Dan Leonard
On 05/02/2016 06:23 PM, Mark Brown wrote: > On Sun, May 01, 2016 at 06:04:08PM +0100, Jonathan Cameron wrote: > >> If you were to break these registers up into regmap fields it might solve >> this.. Regmap writes always go through whatever - whether they match the >> existing state of the cache

[PATCH] iio: ak8975: Support adapters limited to BYTE_DATA

2016-04-29 Thread Crestez Dan Leonard
the fastest available transfer method. Signed-off-by: Crestez Dan Leonard --- drivers/iio/magnetometer/ak8975.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index dbf0661..c24b8a5

[PATCH 2/7] iio: inv_mpu6050: Initial regcache support

2016-04-29 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 47 ++ drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 5 drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 1 + drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 5 4 files changed

[RFC 0/7] iio: inv_mpu6050: Support i2c master and external readings

2016-04-29 Thread Crestez Dan Leonard
erly support driver-specified channel offsets instead of implicit iio rules. Patches 1,2,3,4 and 6 are required cleanups/fixed to make the rest work. They could go in separately. Crestez Dan Leonard (7): iio: inv_mpu6050: Do burst reads using spi/i2c directly iio: inv_mpu6050: Initial

[PATCH 6/7] iio: inv_mpu6050: Check channel configuration on preenable

2016-04-29 Thread Crestez Dan Leonard
selectively enable x/y/z accel by unpacking the data read from the hardware into a format the iio core accepts. It is easier to simply refuse incorrect configuration. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h

[PATCH 3/7] iio: inv_mpu6050: Only toggle DATA_RDY_EN in inv_reset_fifo

2016-04-29 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c| 13 - drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 3 ++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c b/drivers/iio/imu

[PATCH 4/7] iio: inv_mpu6050: Cache non-volatile bits of user_ctrl

2016-04-29 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 2 ++ drivers/iio/imu/inv_mpu6050/inv_mpu_ring.c| 9 ++--- drivers/iio/imu/inv_mpu6050/inv_mpu_trigger.c | 4 +++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/iio/imu

[RFC 7/7] iio: inv_mpu6050: Add support for external sensors

2016-04-29 Thread Crestez Dan Leonard
This works by copying their channels at probe time. Signed-off-by: Crestez Dan Leonard --- .../devicetree/bindings/iio/imu/inv_mpu6050.txt| 37 +- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 420 - drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 63

[RFC 5/7] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-04-29 Thread Crestez Dan Leonard
interface and it has an interrupt that signals when data from slave to master arrived. Signed-off-by: Crestez Dan Leonard --- .../devicetree/bindings/iio/imu/inv_mpu6050.txt| 61 +- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 239 - drivers/iio/imu/inv_mpu6050

[PATCH 1/7] iio: inv_mpu6050: Do burst reads using spi/i2c directly

2016-04-29 Thread Crestez Dan Leonard
Using regmap_read_bulk is wrong because it assumes that a range of registers is being read. In our case reading from the fifo register will return multiple values but this is *not* auto-increment. This currently works by accident. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu

[RFC] iio: Release irq if set_trigger_state fails

2016-04-28 Thread Crestez Dan Leonard
e then the buffer becomes unusable. It is not possible to handle this sort of error by calling iio_trigger_detach_poll_func externally somehow. That function should only be called if attach is successful. Signed-off-by: Crestez Dan Leonard --- I ran into this while adding some validation i

Re: [PATCH] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-04-28 Thread Crestez Dan Leonard
On 04/27/2016 11:39 AM, Peter Rosin wrote: > On 2016-04-23 23:32, Jonathan Cameron wrote: >> On 20/04/16 18:17, Crestez Dan Leonard wrote: >>> The MPU has an auxiliary I2C bus for connecting external >>> sensors. This bus has two operating modes: >>> * pass-thr

[PATCH] iio: inv_mpu6050: Do burst reads using spi/i2c directly

2016-04-28 Thread Crestez Dan Leonard
Using regmap_read_bulk is wrong because it assumes that a range of registers is being read. In our case reading from the fifo register will return multiple values but this is *not* auto-increment. This currently works by accident. Signed-off-by: Crestez Dan Leonard --- There is a need to

Re: [PATCH] iio: tmp006: Set correct iio name

2016-04-27 Thread Crestez Dan Leonard
On 04/26/2016 06:21 PM, Daniel Baluta wrote: > On Tue, Apr 26, 2016 at 4:14 PM, Yong Li wrote: >> I am thinking if there is any application is using this incorrect >> name, the application should be fix too > > The rule is: "Don't break the userspace ABI". So, if we got this wrong > from the begi

Re: [PATCH] iio: tmp006: Set correct iio name

2016-04-25 Thread Crestez Dan Leonard
On 04/25/2016 10:33 PM, Jonathan Cameron wrote: On 22/04/16 04:43, Yong Li wrote: When load the driver using the below command: echo tmp006 0x40 > /sys/bus/i2c/devices/i2c-0/new_device In sysfs, the i2c name is tmp006, however the iio name is 0-0040, they are inconsistent. With this patch, the

Re: [PATCH 3/5] iio: inv_mpu6050: Check WHO_AM_I register on probe

2016-04-25 Thread Crestez Dan Leonard
On 04/24/2016 02:14 PM, Jonathan Cameron wrote: > On 20/04/16 14:15, Crestez Dan Leonard wrote: >> This can be used to distinguish mpu6500. This is a warning rather than >> an error because the differences are mostly irrelevant and it's nice to >> avoid breaking users wi

Re: [PATCH] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-04-22 Thread Crestez Dan Leonard
On 04/21/2016 04:56 PM, Peter Rosin wrote: > Crestez Dan Leonard wrote: >> On 04/20/2016 11:31 PM, Peter Rosin wrote: >>> Crestez Dan Leonard wrote: >>>> Changes since that version: >>>> * Nest the adapter in inv_mpu6050_state instead of making it static

Re: [PATCH v7 00/24] i2c mux cleanup and locking update

2016-04-21 Thread Crestez Dan Leonard
orrectly, which > was evident from the crash in the mpu6050 driver (on a mpu9150 chip) > reported > by Crestez Dan Leonard. Also, it didn't make things all that much simpler > anyway (even if used correctly). > - Rename i2c_mux_core:adapters into i2c_mux_core:num_adapters.

Re: [PATCH] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-04-21 Thread Crestez Dan Leonard
On 04/20/2016 11:31 PM, Peter Rosin wrote: > Crestez Dan Leonard wrote: >> Changes since that version: >> * Nest the adapter in inv_mpu6050_state instead of making it static >> * Explicitly forward of_node "i2c-aux-master" to allow describing aux devices >>

Re: [PATCH] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-04-21 Thread Crestez Dan Leonard
https://github.com/0day-ci/linux/commits/Crestez-Dan-Leonard/iio-inv_mpu6050-Add-support-for-auxiliary-I2C-master/20160421-012042 > base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg > config: i386-randconfig-i1-201616 (attached as .config) > reproduce: >

[PATCH] iio: inv_mpu6050: Add support for auxiliary I2C master

2016-04-20 Thread Crestez Dan Leonard
interface and it has an interrupt that signals when data from slave to master arrived. Signed-off-by: Crestez Dan Leonard --- This is based on earlier work by Daniel Baluta : https://www.spinics.net/lists/linux-iio/msg23573.html Changes since that version: * Nest the adapter in inv_mpu6050_state

[PATCH 3/5] iio: inv_mpu6050: Check WHO_AM_I register on probe

2016-04-20 Thread Crestez Dan Leonard
This can be used to distinguish mpu6500. This is a warning rather than an error because the differences are mostly irrelevant and it's nice to avoid breaking users with slightly incorrect ACPI/DT. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c

[PATCH 1/5] iio: inv_mpu6050: Cleanup hw_info mapping

2016-04-20 Thread Crestez Dan Leonard
happened to work so far because the differences between the supported models are very minor. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 15 ++- drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 2 +- drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 18

[PATCH 2/5] iio: inv_mpu6050: Remove inv_mpu6050_hw.num_reg

2016-04-20 Thread Crestez Dan Leonard
This field was unused and incorrect for mpu6500. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 3 --- drivers/iio/imu/inv_mpu6050/inv_mpu_iio.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio

[PATCH 5/5] iio: inv_mpu6050: Add explicit support for MPU9150

2016-04-20 Thread Crestez Dan Leonard
This device is a package containing a MPU6050-like sensor and an AK8975 magnetometer. The magnetometer component is supported by the existing ak8975 driver. This patch also rephrases the Kconfig descriptions. Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/Kconfig

[PATCH 4/5] iio: inv_mpu6050: Add spi_device_id for INV_MPU6500

2016-04-20 Thread Crestez Dan Leonard
Signed-off-by: Crestez Dan Leonard --- drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c index 3972a46..a0f8df2 100644 --- a/drivers/iio/imu/inv_mpu6050

[PATCH 0/5] iio: inv_mpu6050: Cleanup chip types and add mpu9150

2016-04-20 Thread Crestez Dan Leonard
This adds support for mpu9150 explictly. This device includes a MPU60X0 and AK8975 inside the same package. It also cleans the chip_type <=> hw_info mappings which were just a mess. Crestez Dan Leonard (5): iio: inv_mpu6050: Cleanup hw_info mapping iio: inv_mpu6050:

Re: [PATCH v6 08/24] iio: imu: inv_mpu6050: convert to use an explicit i2c mux core

2016-04-19 Thread Crestez Dan Leonard
On 04/03/2016 11:52 AM, Peter Rosin wrote: > From: Peter Rosin > > Allocate an explicit i2c mux core to handle parent and child adapters > etc. Update the select/deselect ops to be in terms of the i2c mux core > instead of the child adapter. > > --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_acpi.c >

  1   2   >