1
0
Fork 0
Commit Graph

23 Commits (fec2f3335c637ca95166a9eb753fe2b49aee4e71)

Author SHA1 Message Date
Adriana Reus c2472d0bbc iio: inv_mpu6050: Remove unused parameter
The inv_check_and_setup_chip function does not use the i2c_device_id
parameter. Therefore remove it.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-01-30 17:17:37 +00:00
Greg Kroah-Hartman ed15e8880f Merge 4.2-rc3 into staging-next
We need the staging fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-20 13:21:28 -07:00
Krzysztof Kozlowski 2155971a66 iio: Drop owner assignment from i2c_driver
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-11 18:50:07 +01:00
Adriana Reus a858c7dab4 iio: inv-mpu: Export scale_available attributes
Export the available scales for accel and gyro in order
to hint the user-space as to what are the available valid values.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-13 19:01:05 +01:00
Adriana Reus 6a3c45bb5a iio: inv-mpu: Specify the expected format/precision for write channels
The gyroscope needs IIO_VAL_INT_PLUS_NANO for the scale channel and
unless specified write returns MICRO by default.
This needs to be properly specified so that write operations into scale
have the expected behaviour.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-13 18:57:53 +01:00
Greg Kroah-Hartman c610f7f772 Merge 4.0-rc7 into staging-next
We want those fixes (iio primarily) into the -next branch to help with
merge and testing issues.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-07 11:03:02 +02:00
Greg Kroah-Hartman dc5f2c5f6a First set of new drivers, cleanups and functionality for IIO in the 4.1 cycle.
New drivers
 * CM3323 color sensor.
 * MS5611 pressure and temperature sensor.
 
 New functionality
 * mup6050 - create mux clients for devices described via ACPI. The reasoning
      and approach taken in this patch are complex.  Basically there is no
      otherway of finding out what is there than by some esoteric look ups in
      the ACPI data.
 * cm3232 - PM support
 * itg3200 - suspend/resume support
 * mcp320x - add more ADCs to the kconfig to reflect what the driver supports
      (this patch and the bindings got left behind when the support was added
       a while back).
 
 Docs / utils
 * ti-adc128s052 - DT bindings.
 * mcp3422 - DT bindings.
 * mcp320x - DT bindings
 * ABI docs for event threshold scale attributes, in_magn_offset, proximity
   scan_element and thresh falling/rising values for accelerometers.  All
   elements long in use that have slipped by being explicitly documented.
 * Tidy up the tools previously in drivers/staging/iio/Documentation and move
   them out to /tools/iio. Yet another move that should have happened long ago.
   This time Roberta Dobrescu did the leg work.  Thanks!
 
 Core Cleanups
 * Export userspace IIO headers.  We should have done the appropriate header
   splitting a long time ago. Thanks to Daniel for sorting this out.
 
 * Refactor the registring of attributes for buffers to move all non-custom
   ones to a vector allowing easier additions to the current set in the future.
 
 Driver Cleanups
 * gpiod related cleanups.  Make use of the additional parameter to specify
   	initial direciton to avoid extra code.
 * bmc150 - Various refactorings to reduce code repitition and prepare for
            hardware buffer support.  Some of these cleanups are good even
 	   without the new functionality.
 * kmx61 - direct use of index to an array avoiding a structure element which
           was always the index to an element in an array of that structure.
 * vf610 - avoid incorrect type for return from wait_for_completion_timeout.
 * gp2ap020a00f - use put_unaligned_le32 for slight code simplification.
 * ade7754 - improve error handling including suppressing some build warnings.
 * ade7759 - improve error handling including suppressing some build warnings.
 * hmc5843 - Long line and indentation fixes. Also some constifying of various
       constant data.
 * ade7854 - 80+ character line splitting.
 * ad2s1210 - fix wrong printf format string.
 * mxs-lradc - fix wrong printf format string.
 * ade7954-i2c - code alignment fixes and other trivial but worthwhile bits.
 * periodic rtc trigger - make the frequency type an unsigned int as it
   is always treated as such.
 * jsa1212 - constify struct regmap_config as it is constant.
 * ad7793 - typo in the MODULE_DESCRIPTION
 * mma9551 - check gpiod_to_irq errors.  Note that this doesn't actually cause
     any trouble but is worth tidying up as obviously incorrect.
 * mlx90614 - refactor the register symbols to make it clear which reads are to
     RAM not PROM.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJVBe4zAAoJEFSFNJnE9BaISXAP+wcVdU9PyiLdpjh7D73qbbV0
 KnKJHdO+aKe4hCv6Xl0fWIbJcsxTn8ALPHkkxHnu06hd2Q9zANgdJ5dER5XB34fX
 vw+EjsIdiyCDmoOVGzP5SsmbSoO3gNoR5GdWmjKFKjr0eSxinh3AmAesTVSC2T9Y
 vHkjgDj3KaqN735brd2GneeG/s3jY8ZZaiTZ0jFotCtSmBAiPi8uYwIwMLmVpsVu
 M3tcUPWKithRoyKBmO4tiDg2Qwnj0IhN8zyIYiUBftxCIIY7tSlQkYgRzDmrxGG2
 HCITf33Ss87UH0IF1BOm5PXjQ3ClI3idtCwqCeXscAo6IXmoe/+BsXR/m2JqUTdp
 EOrORyzsHc0WkJK8dnp1h1XfiBR4UQpiwce5xGFbni2ycfNBw1/J0l7QTi45D6Z7
 SdGXTgt1AWd8MoWxcxMhWMPQlHsxK/XMPh10O5wD5icxo5EHvnPP0ObZ15Ax6T/V
 kcO+NEJCEHH2Q/kna2M6h4FdUVBxvzjjwhdZVs8PGGfJNDij2cVwspT81lKMauwf
 07S0KHEjhqbRSM0TvsMyf2li1Xwv5eu+G2FTkopESJ4a2zyaLobt/QgTu9dzg4Gh
 QDJFx4xdmNv4OQ+psZuoDznjM/EV+eQR+swH7P6UDyef0jghLwVkqHxM/HYChiyP
 OvZCCnHDB4EiC8jx+c43
 =BmiY
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.1a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

First set of new drivers, cleanups and functionality for IIO in the 4.1 cycle.

New drivers
* CM3323 color sensor.
* MS5611 pressure and temperature sensor.

New functionality
* mup6050 - create mux clients for devices described via ACPI. The reasoning
     and approach taken in this patch are complex.  Basically there is no
     otherway of finding out what is there than by some esoteric look ups in
     the ACPI data.
* cm3232 - PM support
* itg3200 - suspend/resume support
* mcp320x - add more ADCs to the kconfig to reflect what the driver supports
     (this patch and the bindings got left behind when the support was added
      a while back).

Docs / utils
* ti-adc128s052 - DT bindings.
* mcp3422 - DT bindings.
* mcp320x - DT bindings
* ABI docs for event threshold scale attributes, in_magn_offset, proximity
  scan_element and thresh falling/rising values for accelerometers.  All
  elements long in use that have slipped by being explicitly documented.
* Tidy up the tools previously in drivers/staging/iio/Documentation and move
  them out to /tools/iio. Yet another move that should have happened long ago.
  This time Roberta Dobrescu did the leg work.  Thanks!

Core Cleanups
* Export userspace IIO headers.  We should have done the appropriate header
  splitting a long time ago. Thanks to Daniel for sorting this out.

* Refactor the registring of attributes for buffers to move all non-custom
  ones to a vector allowing easier additions to the current set in the future.

Driver Cleanups
* gpiod related cleanups.  Make use of the additional parameter to specify
  	initial direciton to avoid extra code.
* bmc150 - Various refactorings to reduce code repitition and prepare for
           hardware buffer support.  Some of these cleanups are good even
	   without the new functionality.
* kmx61 - direct use of index to an array avoiding a structure element which
          was always the index to an element in an array of that structure.
* vf610 - avoid incorrect type for return from wait_for_completion_timeout.
* gp2ap020a00f - use put_unaligned_le32 for slight code simplification.
* ade7754 - improve error handling including suppressing some build warnings.
* ade7759 - improve error handling including suppressing some build warnings.
* hmc5843 - Long line and indentation fixes. Also some constifying of various
      constant data.
* ade7854 - 80+ character line splitting.
* ad2s1210 - fix wrong printf format string.
* mxs-lradc - fix wrong printf format string.
* ade7954-i2c - code alignment fixes and other trivial but worthwhile bits.
* periodic rtc trigger - make the frequency type an unsigned int as it
  is always treated as such.
* jsa1212 - constify struct regmap_config as it is constant.
* ad7793 - typo in the MODULE_DESCRIPTION
* mma9551 - check gpiod_to_irq errors.  Note that this doesn't actually cause
    any trouble but is worth tidying up as obviously incorrect.
* mlx90614 - refactor the register symbols to make it clear which reads are to
    RAM not PROM.
2015-03-24 22:53:52 +01:00
Adriana Reus af5e1a6831 iio:inv-mpu6050: Fix inconsistency for the scale channel
Fix inconsistency in the semantics of the scale attribute.
For scale the write_raw function was considering the scale table index
and writing the appropriate value into the range register, while
for read_raw it was outputting the actual scale.
Fix this behaviour and adhere to the iio ABI specification.

Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Reviewed-by: Viorel Suman <viorel.suman@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-14 18:36:21 +00:00
Greg Kroah-Hartman d582cb7926 First round of fixes for IIO in the 4.0 cycle. Note a followup
set dependent on patches in the recent merge windows will follow shortly.
 
 * dht11 - fix a read off the end of an array, add some locking to prevent
           the read function being interrupted and make sure gpio/irq lines
 	  are not enabled for irqs during output.
 * iadc - timeout should be in jiffies not msecs
 * mpu6050 - avoid a null id from ACPI emumeration being dereferenced.
 * mxs-lradc - fix up some interaction issues between the touchscreen driver
               and iio driver.  Mostly about making sure that the adc driver
               only affects channels that are not being used for the
               touchscreen.
 * ad2s1200 - sign extension fix for a result of c type promotion.
 * adis16400 - sign extension fix for a result of c type promotion.
 * mcp3422 - scale table was transposed.
 * ad5686 - use _optional regulator get to avoid a dummy reg being allocate
            which would cause the driver to fail to initialize.
 * gp2ap020a00f - select REGMAP_I2C
 * si7020 - revert an incorrect cleanup up and then fix the issue that made
            that cleanup seem like a good idea.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJU8aP7AAoJEFSFNJnE9BaIr7oQAKUtw6ScwBnCGDV+3ttEvUAl
 8oSNVNKoWdBiuQK5XZHJVVVm7/n7Okt6rT8X+LjY5JsVP6lZRItAtOkwNibyyS5Q
 MZk3on8E7qEaASTOPPb+Izb+d2azevUaZptqTlQSaFJgs8HuBm89DwJ9H6SKZKAy
 kqZdjiDLx95XNAMSKiM7531Dv+TKU0BGPP8Zc0vIviUQbAcFQ6hHtfaFwU2m/hlx
 Cyn4UB3i2jbZmuvfL5zwHZBIjTpczlLuihQFpNAMq73pwROgbwVuQ6azBz5ib0dE
 gHE5AG/c/uLXO0IFvPlUmkLqQyPoTJ8dsgrjozOi+GPqWGfaBf1Iet0zfqVcJWjE
 jCpJqlNfcukvBnAsSMwQM/mHGVdGXd07alKjCoZsQkm0aG/DQxLn2QRWVAUno8eL
 zbuDCpk3rH8c5U9Ytb0likBRurM8UyTTkUhCJOpdS1iyNRe+pK8Krp/STMhc3a96
 YWQxpO3p127yyc8EXdEl5N5kJwtWaV0W09vGV4oSk8A9fF7MTR2fe31pw7Si+sb3
 gTsRMC1bPqF2f8UMcjxqd72IKz5GKvaIOh+J6hdN0UaITsQr+dWbPj1oAkgRQgdJ
 EC57hqVLJTl3S1AYtev98+LgemOARbsBYbc/FVlhTpaZPhxXOLyMsvaQ93Fa7jFr
 HXPJZailkvt7TgLiuoW6
 =iNyv
 -----END PGP SIGNATURE-----

Merge tag 'iio-fixes-for-4.0a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus

Jonathan writes:

First round of fixes for IIO in the 4.0 cycle. Note a followup
set dependent on patches in the recent merge windows will follow shortly.

* dht11 - fix a read off the end of an array, add some locking to prevent
          the read function being interrupted and make sure gpio/irq lines
	  are not enabled for irqs during output.
* iadc - timeout should be in jiffies not msecs
* mpu6050 - avoid a null id from ACPI emumeration being dereferenced.
* mxs-lradc - fix up some interaction issues between the touchscreen driver
              and iio driver.  Mostly about making sure that the adc driver
              only affects channels that are not being used for the
              touchscreen.
* ad2s1200 - sign extension fix for a result of c type promotion.
* adis16400 - sign extension fix for a result of c type promotion.
* mcp3422 - scale table was transposed.
* ad5686 - use _optional regulator get to avoid a dummy reg being allocate
           which would cause the driver to fail to initialize.
* gp2ap020a00f - select REGMAP_I2C
* si7020 - revert an incorrect cleanup up and then fix the issue that made
           that cleanup seem like a good idea.
2015-02-28 07:15:09 -08:00
Srinivas Pandruvada a35c5d1aa9 iio: imu: inv_mpu6050: Create mux clients for ACPI
This is a follow up patches after adding i2c mux adapter for bypass
mode. Potentially many different types of sensor can be attached to
INVMPU6XXX device, which can be connected to main cpu i2c bus in
bypass mode.
Why do we need this?
The system ACPI table entry will consist of only one device for
INV6XXX, assuming that this driver will handle all connected sensors.
That is not true for the Linux driver. There are bunch of IIO drivers
for each sensors, hence we created a mux on this device. So to load
these additional drivers, we need to create i2c devices for them
in this driver using this mux adapter.

There are multiple options:
1. Use the auto detect feature, this needs a new i2c class for the
adapter as the existing HWMON class is not acceptable. Also the
autodetect has overhead of executing detect method for each
matching class of adapters.
This is a simple implementation. This option was previously submitted
with not a happy feedback.

2. Option is use ACPI magic and parse the configuration data. What
we need to create a i2c device at a minimum is address and a name.
Address can be obtained for secondary device in more or less in a
standard way from using _CRS element. But there is no name. To get
name we need to process proprietary vendor data. Not having name is
not fun, as you have to create device using the device name of
INVN6XXXX, respecting driver duplicate name space restriction.
Also each client driver needs to have this name in the id table.
Since multiple driver can be loaded, the driver should be able to
detect its presence and gracefully exit for the other client driver
to take it over.
So we use two step process:
- Use DMI to id platform and parse propritery data. This is not uncommon
for many x86 platform specific driver. We will get both name and address.
The change created necessary infrastructure to add more properitery vendor
data parsing.
- If DMI match fails, then create device on INV6XXX-client (we can't
create with same name as INV6XXX as it will cause duplicate name and driver
model will reject.) With this each client sensor driver which needs to get
attached via INV6XXXX, need this name in the id table and detect the
physical presence of sensor in probe and exit if not found.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-02-25 12:02:59 +00:00
Srinivas Pandruvada 4f33fbae55 iio: imu: inv_mpu6050: Prevent dereferencing NULL
When id is null, with ACPI enumeration, don't dereference it.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-10 22:07:50 +00:00
Srinivas Pandruvada 6ed5ac50a3 iio: imu: inv_mpu6050: ACPI enumeration
Added changes so that the module can be enumerated via ACPI.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26 12:38:47 +00:00
Srinivas Pandruvada 3a2ecc3d2d iio: imu: inv_mpu6050: Add i2c mux for by pass
This chip allows some limited number of sensors connected to it as
slaves, which can be directly accessed by register interface of this
driver.But the current upstream driver doesn't support such mode.
To attach such slaves to main processor i2c bus, chip has to be set
up in bypass mode. This change adds i2c mux, which will enable/disable
this mode for transaction to/from such slave devices.
This was discussed for a while in mailing list, this was the outcome:
Reference:
http://www.spinics.net/lists/linux-iio/msg12126.html
http://comments.gmane.org/gmane.linux.kernel.iio/11470

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12 12:28:26 +00:00
Jingoo Han 63d1157ded iio: imu: inv_mpu6050: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-08-30 10:31:46 +01:00
Greg Kroah-Hartman 69c1f05379 Merge 3.15-rc6 into staging-next.
This resolves the conflicts in the files:
	drivers/iio/adc/Kconfig
	drivers/staging/rtl8723au/os_dep/usb_ops_linux.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-22 23:27:17 +09:00
Atilla Filiz b9b3a41893 iio:imu:mpu6050: Fixed segfault in Invensens MPU driver due to null dereference
The driver segfaults when the kernel boots with device tree as the
platform data is then not present and the pointer is deferenced without
checking it is not null.  This patch introduces such a check avoiding the
crash.

Signed-off-by: Atilla Filiz <atilla.filiz@essensium.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Cc: Stable@vger.kernel.org
2014-04-26 11:14:51 +01:00
Srinivas Pandruvada 6f174fd312 iio: imu: inv_mpu6050: Add compatibity with MPU6500
Adding MPU6500 in target list for this driver.

Description:
Source
Document: MPU-6500 Register Map and Descriptions Revision 2.1
Section 3: Register Map

This section describes difference in terms device programmability
between MPU6050 and MPU6500.
These are different registers, which differs between MPU6050 and
MPU6500.

Addr	Name
---------------------
1E 	LP_ACCEL_ODR
6C	PWR_MGMT_2
77	XA_OFFSET_H
78	XA_OFFSET_L
7A	YA_OFFSET_H
7B	YA_OFFSET_L
7D	ZA_OFFSET_H
7E	ZA_OFFSET_L

But the current MPU6050 driver doesn't use registers which are different
except PWR_MGMT_2. The difference is support of "LP_WAKE_CTRL" at bit6-7
in MPU6050 mode. In MPU6500 they are not defined.
In current mpu6050 driver, only values used for this register are for
standby mode for gyro and accelerometer.
In both case frequency of wakeups is set to default and not using
bit 6-7.

So this driver van as well support MPU6500. In addition MPU6500 can
run MPU6050 mode by changing device trim settings.

So changing config comments to allow MPU6500 to use this driver.
When the driver is enhanced to support more functions, i2c driver
data INV_MPU6500 or "WHO_AM_I" register can be used to add additional
functionality.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-03-29 10:45:09 +00:00
Manuel Stahl 7da773e618 iio: imu: inv_mpu6050: Fix typo and formatting
Signed-off-by: Manuel Stahl <manuel.stahl@iis.fraunhofer.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-08 12:29:40 +00:00
Paul Gortmaker 36eb8cc2ce iio: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives
and hence don't need to include <linux/init.h>.  Most are just a
left over from __devinit and __cpuinit removal, or simply due to
code getting copied from one driver to the next.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11 11:59:00 +00:00
Sachin Kamat 452204ae53 iio: imu: inv_mpu6050: Use devm_iio_device_alloc
Using devm_iio_device_alloc makes code simpler. While at
it include missing iio.h header file and do some cleanup.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:55:24 +01:00
Peter Meerwald 2ffdcd3dec iio: use I2C_FUNC_SMBUS_I2C_BLOCK macro
I do not see why the driver requires I2C_FUNC_SMBUS_I2C_BLOCK,
actually only single bytes or words are transferred

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Cc: Ge Gao <ggao@invensense.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03 18:40:29 +01:00
Jonathan Cameron 0b1f8da3ac iio:imu:mpu6050 move to info_mask_(shared_by_type/separate)
The original info_mask is going away in favour of the broken out versions.

Signed-off-by: Jonathan Cameron <jic23@kernel.org>
cc: Ge Gao <ggao@invensense.com>
2013-03-17 19:49:36 +00:00
Ge Gao 09a642b785 Invensense MPU6050 Device Driver.
This the basic functional Invensense MPU6050 Device driver.

Signed-off-by: Ge Gao <ggao@invensense.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-10 17:42:43 +00:00