23 Feb, 2017
1 commit
-
Enable i.MX6SX adc driver. ADC driver will try getting ADC controller
channel number via device tree, because i.MX chip enable 4 channels
on each controller.Signed-off-by: Luwei Zhou
Signed-off-by: Fugang Duan
(cherry picked from commit 14a6a98f64e26702b1c0ecfc7d58a45ee5752d54)
09 Feb, 2017
5 commits
-
commit 828f84ee8f84710ea1818b3565add268bcb824c8 upstream.
FIFO was being read every sample after the "almost full" state was
reached. This was due to an incorrect placement of the parenthesis
in the while condition check.Note - the fixes tag is not actually correct, but the fix in this patch
would also be needed for it to function correctly so we'll go with that
one. Backports should pick up both.Signed-off-by: Matt Ranostay
Fixes: b74fccad7 ("iio: health: max30100: correct FIFO check condition")
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit 5c113b5e0082e90d2e1c7b12e96a7b8cf0623e27 upstream.
The DHT22 (AM2302) datasheet specifies that the LOW start pulse should not
exceed 20ms. However, observations with an oscilloscope of an RPi Model 2B
(rev 1.1) communicating with a DHT22 sensor showed that the driver was
consistently sending start pulses longer than 20ms:Kernel 4.7.10-v7+ (n=132):
Minimum pulse length: 20.20ms
Maximum: 29.84ms
Mean: 24.96ms
StDev: 2.82ms
Sensor response rate: 100%
Read success rate: 76%On kernel 4.8, the start pulse was so long that the sensor would not even
respond 97% of the time:Kernel 4.8.16-v7+ (n=100):
Minimum pulse length: 30.4ms
Maximum: 74.4ms
Mean: 39.3ms
StDev: 10.2ms
Sensor response rate: 3%
Read success rate: 3%The driver would return ETIMEDOUT and write log messages like this:
[ 51.430987] dht11 dht11@0: Only 1 signal edges detected
[ 66.311019] dht11 dht11@0: Only 0 signal edges detectedReplacing msleep(18) with usleep_range(18000, 20000) made the pulse length
sane again and restored responsiveness:Kernel 4.8.16-v7+ with usleep_range (n=123):
Minimum pulse length: 18.16ms
Maximum: 20.20ms
Mean: 19.85ms
StDev: 0.51ms
Sensor response rate: 100%
Read success rate: 84%Signed-off-by: John Brooks
Reviewed-by: Harald Geyer
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit a5badd1e97e6caeca78ad74191f12fc923c403a8 upstream.
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's. Replace it with spi
functions to get the correct iio_dev.Signed-off-by: Alison Schofield
Acked-by: Andrew F. Davis
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit 802ecfc113df1e15af1d028427cbbe785ae9cc4a upstream.
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's. Replace it with i2c
functions to get the correct iio_dev.Signed-off-by: Alison Schofield
Acked-by: Andrew F. Davis
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit d1aaf20ee655888c227d5137b7a63551f8d15416 upstream.
The suspend/resume functions were using dev_to_iio_dev() to get
the iio_dev. That only works on IIO dev's. Use dev_get_drvdata()
for a platform device to get the correct iio_dev.Signed-off-by: Alison Schofield
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
12 Jan, 2017
4 commits
-
commit 65e4345c8ef8811bbb4860fe5f2df10646b7f2e1 upstream.
The LIS3LV02 has a special bit that need to be set to get the
read values left aligned. Before this patch we get gibberish
like this:iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.010042 -0.642688 19155832931907
0.000000 -0.010042 -0.642688 19155858751073Which is because we read a raw value for 1g as 64 which is
the nominal 1024 for 1g shifted 4 bits to the left by being
right-aligned rather than left aligned.Since all other sensors are left aligned, add some code to
set the special DAS (data alignment setting) bit to 1 so that
the right value is now read like this:iio_generic_buffer -a -c10 -n lis3lv02dl_accel
(...)
0.000000 -0.147095 -10.120135 24761614364956
-0.029419 -0.176514 -10.120135 24761631624540The scaling was weird as well: we have a gain of 1000 for 1g
and 3000 for 6g. I don't even remember how I came up with the
old values but they are wrong.Fixes: 3acddf74f807 ("iio: st-sensors: add support for lis3lv02d accelerometer")
Cc: Lorenzo Bianconi
Cc: Giuseppe Barba
Cc: Denis Ciocca
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit 01d1f7a99e457952aa51849ed7c1cc4ced7bca4b upstream.
Datasheet specifies typical and maximum execution times for which CMD
register is occupied after previous command execution. We took these
values as minimum and maximum time for usleep_range() call before making
a new command execution.To be sure, that the CMD register is no longer occupied we need to wait
*at least* the maximum time specified by datasheet.Signed-off-by: Marcin Niestroj
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit b4e8a0eb718749455601fa7b283febc42cca8957 upstream.
According to the datasheet, the shortest available integration time for
ALS ADC conversion is 1.5625ms but illuminance_integration_time_available
sysfs file shows wrong value.Cc: Crestez Dan Leonard
Cc: Jonathan Cameron
Cc: Hartmut Knaack
Cc: Lars-Peter Clausen
Cc: Peter Meerwald-Stadler
Signed-off-by: Akinobu Mita
Fixes: d5d8f49b6 ("max44000: Expose ambient sensor scaling")
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit 65c8aea07de11b6507efa175edb44bd8b4488218 upstream.
Using realbits as i2c/spi read len, when that value is not byte aligned
(e.g 12 bits), lead to skip msb part of out data registers.
Fix this taking into account scan_type.shift in addition to
scan_type.realbits as read length:read_len = DIV_ROUND_UP(realbits + shift, 8)
This fix has been tested on 8, 12, 16, 24 bit sensors
Fixes: e7385de5291e ("iio:st_sensors: align on storagebits boundaries")
Signed-off-by: Lorenzo Bianconi
Tested-by: Linus Walleij
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
13 Nov, 2016
1 commit
-
As found by gcc -Wmaybe-uninitialized, having a storage_bytes value other
than 2 or 4 will result in undefined behavior:drivers/iio/temperature/maxim_thermocouple.c: In function 'maxim_thermocouple_read':
drivers/iio/temperature/maxim_thermocouple.c:141:5: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]This probably cannot happen, but returning -EINVAL here is appropriate
and makes gcc happy and the code more robust.Fixes: 231147ee77f3 ("iio: maxim_thermocouple: Align 16 bit big endian value of raw reads")
Signed-off-by: Arnd Bergmann
Signed-off-by: Jonathan Cameron
(cherry picked from commit 32cb7d27e65df9daa7cee8f1fdf7b259f214bee2)
Signed-off-by: Greg Kroah-Hartman
06 Nov, 2016
2 commits
-
While testing, it was observed that on some platforms the scale value
from iio sysfs for gyroscope is always 0 (E.g. Yoga 260). This results
in the final angular velocity component values to be zeros.This is caused by insufficient precision of scale value displayed in sysfs.
If the precision is changed to nano from current micro, then this is
sufficient to display the scale value on this platform.
Since this can be a problem for all other HID sensors, increase scale
precision of all HID sensors to nano from current micro.Results on Yoga 260:
name scale before scale now
--------------------------------------------
gyro_3d 0.000000 0.000000174
als 0.001000 0.001000000
magn_3d 0.000001 0.000001000
accel_3d 0.000009 0.000009806Signed-off-by: Song Hongyan
Acked-by: Srinivas Pandruvada
Cc:
Signed-off-by: Jonathan Cameron -
This fix makes newer ISH hubs work. Previous ones worked by lucky
coincidence.Rotation sensor function does not work due to miss PM function.
Add common hid sensor iio pm function for rotation sensor.Further clarification from Srinivas:
If CONFIG_PM is not defined, then this prevents this sensor to
function. So above commit caused this.This sensor was supposed to be always on to trigger wake up in prior
external hubs. But with the new ISH hub this is not the case.Signed-off-by: Song Hongyan
Fixes: 2b89635e9a9e ("iio: hid_sensor_hub: Common PM functions")
Cc:
Signed-off-by: Jonathan Cameron
31 Oct, 2016
1 commit
-
fix scale configuration/parsing for h3lis331dl accel driver
when sensitivity is higher than 1(m/s^2)/digitSigned-off-by: Lorenzo Bianconi
Fixes: 1e52fefc9b0c ("iio: accel: Add support for the h3lis331dl accelerometer")
Cc:
Signed-off-by: Jonathan Cameron
24 Oct, 2016
2 commits
-
…jic23/iio into staging-linus
Jonathan writes:
First set of IIO fixes for the 4.9 cycle.
* atlas chemical
- Fix alignment of big endian values in a larger storage (by using the right
size storage)
* maxim thermocouple
- Fix alignment of big endian values in larger (by using the correct
sized storage).
* sca3000
- Handle unexpected mode values.
* ti-adc081
- Select IIO_TRIGGERED_BUFFER to avoid build errors -
This will result in a random value being reported on big endian architectures.
(thanks to Lars-Peter Clausen for pointing out the effects of this bug)Only effects a value printed to the log, but as this reports the settings of
the probe in question it may be of direct interest to users.Also, fixes the following sparse endianness warnings:
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16
drivers/iio/chemical/atlas-ph-sensor.c:215:9: warning: cast to restricted __be16Signed-off-by: Sandhya Bankar
Fixes: e8dd92bfbff25 ("iio: chemical: atlas-ph-sensor: add EC feature")
Cc:
Signed-off-by: Jonathan Cameron
09 Oct, 2016
1 commit
-
Commit 08e05d1fce5c ("ti-adc081c: Initial triggered buffer support") added
triggered buffer support but that also requires CONFIG_IIO_TRIGGERED_BUFFER,
otherwise we get errors from linker such as:drivers/built-in.o: In function `adc081c_remove':
drivers/iio/adc/ti-adc081c.c:225: undefined reference to `iio_triggered_buffer_cleanup'Fix these by explicitly selecting both CONFIG_IIO_TRIGGERED_BUFFER and
CONFIG_IIO_BUFFER in Kconfig for the driver.Signed-off-by: Mika Westerberg
Signed-off-by: Jonathan Cameron
06 Oct, 2016
1 commit
-
Pull staging and IIO updates from Greg KH:
"Here is the big staging and IIO driver pull request for 4.9-rc1.There are a lot of patches in here, the majority due to the
drivers/staging/greybus/ subsystem being merged in with full
development history that went back a few years, in order to preserve
the work that those developers did over time.Lots and lots of tiny cleanups happened in the tree as well, due to
the Outreachy application process and lots of other developers showing
up for the first time to clean code up. Along with those changes, we
deleted a wireless driver, and added a raspberrypi driver (currently
marked broken), and lots of new iio drivers.Overall the tree still shrunk with more lines removed than added,
about 10 thousand lines removed in total. Full details are in the very
long shortlog below.All of this has been in the linux-next tree with no issues. There will
be some merge problems with other subsystem trees, but those are all
minor problems and shouldn't be hard to work out when they happen
(MAINTAINERS and some lustre build problems with the IB tree)"And furter from me asking for clarification about greybus:
"Right now there is a phone from Motorola shipping with this code (a
slightly older version, but the same tree), so even though Ara is not
alive in the same form, the functionality is happening. We are working
with the developers of that phone to merge the newer stuff in with
their fork so they can use the upstream version in future versions of
their phone product line.Toshiba has at least one chip shipping in their catalog that
needs/uses this protocol over a Unipro link, and rumor has it that
there might be more in the future.There are also other users of the greybus protocols, there is a talk
next week at ELC that shows how it is being used across a network
connection to control a device, and previous ELC talks have showed the
protocol stack being used over USB to drive embedded Linux boards.
I've also talked to some people who are starting to work to add a host
controller driver to control arduinos as the greybus PHY protocols are
very useful to control a serial/i2c/spio/whatever device across a
random physical link, as it is a way to have a self-describing device
be attached to a host without needing manual configuration.So yes, people are using it, and there is still the chance that it
will show up in a phone/laptop/tablet/whatever from Google in the
future as well, the tech isn't dead, even if the original large phone
project happens to be"* tag 'staging-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (3703 commits)
Staging: fbtft: Fix bug in fbtft-core
staging: rtl8188eu: fix double unlock error in rtw_resume_process()
staging:r8188eu: remove GEN_MLME_EXT_HANDLER macro
staging:r8188eu: remove GEN_DRV_CMD_HANDLER macro
staging:r8188eu: remove GEN_EVT_CODE macro
staging:r8188eu: remove GEN_CMD_CODE macro
staging:r8188eu: remove pkt_newalloc member of the recv_buf structure
staging:r8188eu: remove rtw_handle_dualmac declaration
staging:r8188eu: remove (RGTRY|BSSID)_(OFT|SZ) macros
staging:r8188eu: change rtl8188e_process_phy_info function argument type
Staging: fsl-mc: Remove blank lines
Staging: fsl-mc: Fix unaligned * in block comments
Staging: comedi: Align the * in block comments
Staging : ks7010 : Fix block comments warninig
Staging: vt6655: Remove explicit NULL comparison using Coccinelle
staging: rtl8188eu: core: rtw_xmit: Use macros instead of constants
staging: rtl8188eu: core: rtw_xmit: Move constant of the right side
staging: dgnc: Fix lines longer than 80 characters
Staging: dgnc: constify attribute_group structures
Staging: most: hdm-dim2: constify attribute_group structures
...
04 Oct, 2016
1 commit
-
Pull char/misc driver updates from Greg KH:
"Here's the "big" char and misc driver update for 4.9-rc1.Lots of little things here, all over the driver tree for subsystems
that flow through me. Nothing major that I can discern, full details
are in the shortlog.All have been in the linux-next tree with no reported issues"
* tag 'char-misc-4.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (144 commits)
drivers/misc/hpilo: Changes to support new security states in iLO5 FW
at25: fix debug and error messaging
misc/genwqe: ensure zero initialization
vme: fake: remove unexpected unlock in fake_master_set()
vme: fake: mark symbols static where possible
spmi: pmic-arb: Return an error code if sanity check fails
Drivers: hv: get rid of id in struct vmbus_channel
Drivers: hv: make VMBus bus ids persistent
mcb: Add a dma_device to mcb_device
mcb: Enable PCI bus mastering by default
mei: stop the stall timer worker if not needed
clk: probe common clock drivers earlier
vme: fake: fix build for 64-bit dma_addr_t
ttyprintk: Neaten and simplify printing
mei: me: add kaby point device ids
coresight: tmc: mark symbols static where possible
coresight: perf: deal with error condition properly
Drivers: hv: hv_util: Avoid dynamic allocation in time synch
fpga manager: Add hardware dependency to Zynq driver
Drivers: hv: utils: Support TimeSync version 4.0 protocol samples.
...
01 Oct, 2016
1 commit
-
Driver was reporting invalid raw read values for MAX6675 on big
endian architectures. MAX6675 buffered mode is not affected, nor
is the MAX31855.The driver was losing a 2 byte read value when it used a 32 bit
integer buffer to store a 16 bit big endian value. Use big endian
types to properly align buffers on big endian architectures.Fixes following sparse endianness warnings:
warning: cast to restricted __be16
warning: cast to restricted __be32
Fixes checkpatch issue:
CHECK: No space is necessary after a castSigned-off-by: sayli karnik
Fixes: 1f25ca11d84a ("iio: temperature: add support for Maxim
thermocouple chips")
Signed-off-by: Jonathan Cameron
19 Sep, 2016
2 commits
-
…t, uv index and proximity sensors
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
This was tested on si1143 and si1145Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org> -
Introduce driver for Murata ZPA2326 pressure and temperature sensor:
http://www.murata.com/en-us/products/productdetail?partno=ZPA2326-0311A-RSigned-off-by: Gregor Boirie
Signed-off-by: Jonathan Cameron
18 Sep, 2016
18 commits
-
Add an IIO driver for the mCube MC3230 3-axis accelerometer.
A datasheet for the mCube MC3230 can be found here:
http://www.mcubemems.com/wp-content/uploads/2014/10/MC3230_2-Datasheet-APS-048-0007v1.6.pdfSigned-off-by: Hans de Goede
Signed-off-by: Jonathan Cameron -
Add missing MODULE_DEVICE_TABLE(i2c) this fixes autoloading on
devicetree using systems.Signed-off-by: Hans de Goede
Signed-off-by: Jonathan Cameron -
Check for iio_info structures that are only stored in the info field of a
iio_dev structure. This field is declared const, so iio_info structures
that have this property can be declared as const also.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct iio_info i@p = { ... };@ok@
identifier r.i;
struct iio_dev e;
position p;
@@
e.info = &i@p;@bad@
position p != {r.p,ok.p};
identifier r.i;
struct iio_info e;
@@
e@i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct iio_info i = { ... };
//The result of size on this file before the change is:
text data bss dec hex filename
1245 344 0 1589 635
drivers/iio/gyro/ssp_gyro_sensor.oand after the change it is:
text data bss dec hex filename
1397 192 0 1589 635
drivers/iio/gyro/ssp_gyro_sensor.oSigned-off-by: Julia Lawall
Signed-off-by: Jonathan Cameron -
Check for iio_info structures that are only stored in the info field of a
iio_dev structure. This field is declared const, so iio_info structures
that have this property can be declared as const also.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct iio_info i@p = { ... };@ok@
identifier r.i;
struct iio_dev e;
position p;
@@
e.info = &i@p;@bad@
position p != {r.p,ok.p};
identifier r.i;
struct iio_info e;
@@
e@i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct iio_info i = { ... };
//The result of size on this file before the change is:
text data bss dec hex filename
1529 312 0 1841 731
drivers/iio/adc/men_z188_adc.oand after the change it is:
text data bss dec hex filename
1689 168 0 1857 741
drivers/iio/adc/men_z188_adc.oSigned-off-by: Julia Lawall
Signed-off-by: Jonathan Cameron -
Check for iio_info structures that are only stored in the info field of a
iio_dev structure. This field is declared const, so iio_info structures
that have this property can be declared as const also.The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)//
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct iio_info i@p = { ... };@ok@
identifier r.i;
struct iio_dev e;
position p;
@@
e.info = &i@p;@bad@
position p != {r.p,ok.p};
identifier r.i;
struct iio_info e;
@@
e@i@p@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct iio_info i = { ... };
//The result of size on this file before the change is:
text data bss dec hex filename
1265 344 0 1609 649
drivers/iio/accel/ssp_accel_sensor.oand after the change it is:
text data bss dec hex filename
1425 192 0 1617 651
drivers/iio/accel/ssp_accel_sensor.oSigned-off-by: Julia Lawall
Signed-off-by: Jonathan Cameron -
This adds support for the mounting matrix to the KXSD9 driver.
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
This deploys runtime and system PM in the KXSD9 driver:
- Use the force_runtime_suspend/resume callbacks as system PM
operations.- Add buffer prepare/unprepare callbacks to grab the runtime
PM while we're using buffered reads and put get/put_autosuspend
in these.- Insert get/put_autosuspend calls anywhere the IO is used from
the raw read/write callbacks.- Move the fullscale setting to be cached in the state container
so we can restore it properly when coming back from
system/runtime suspend.- Set the autosuspend delay to two orders of magnitude that of
the sensor start-up time (20ms) so we will autosuspend after
2s.- Register the callbacks in both the SPI and I2C subdrivers.
Tested with the I2C KXSD9 on the Qualcomm APQ8060 Dragonboard.
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
What is passed to the .probe() and .remove() functions is
technically the parent of the created IIO device but it becomes
a big confusion for the head to have it named like this since
it is usually clear from context the "dev" refers to the physical
device, and when next adding PM callbacks a clean
"struct device *dev" pointer is passed to these and that makes
it even more confused. Rename "parent" to "dev" like in most
other drivers.Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
This adds supply regulator handling for the VDD and IOVDD inputs
on the KXSD9 component, makes sure to bring the regulators online
during probe and disable them on remove or the errorpath.Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
There are some hardcoded register values etc in the code, define
proper bitfield definitions, and use them when getting and setting
the scale. Optimize a read/modify/write to use regmap_update_bits()
at the same time.Signed-off-by: Linus Walleij
Tested-by: Jonathan Cameron
Signed-off-by: Jonathan Cameron -
As is custom with all modern sensors, add a clever burst mode
that will just stream out values from the sensor and provide it
to userspace to do the proper offsetting and scaling.This is the result when tested with an HRTimer trigger:
$ generic_buffer -a -c 10 -n kxsd9 -t foo
/sys/bus/iio/devices/iio:device1 foo
0.371318 0.718680 9.869872 1795.000000 97545896129
-0.586922 0.179670 9.378775 2398.000000 97555864721
-0.299450 0.179670 10.348992 2672.000000 97565874055
0.371318 0.335384 11.103606 2816.000000 97575883240
0.179670 0.574944 10.540640 2847.000000 97585862351
0.335384 0.754614 9.953718 2840.000000 97595872425
0.179670 0.754614 10.732288 2879.000000 97605882351
0.000000 0.754614 10.348992 2872.000000 97615891832
-0.730658 0.574944 9.570422 2831.000000 97625871536
0.000000 1.137910 10.732288 2872.000000 97635881610Columns shown are x, y, z acceleration, so a positive acceleration
of ~9.81 (shaky due to bad calibration) along the z axis. The
fourth column is the AUX IN which is floating on this system,
it seems to float up to the 2.85V VDD voltage.To be able to cleanup the triggered buffer, we need to add .remove()
callbacks to the I2C and SPI subdrivers and call back into an
exported .remove() callback in the core.Signed-off-by: Linus Walleij
Tested-by: Jonathan Cameron
Signed-off-by: Jonathan Cameron -
This fixes several errors in the offset and scaling of the raw
values from the KXSD9 sensor:- The code did not convert the big endian value from the sensor
into the endianness of the host CPU. Fix this with
be16_to_cpu() on the raw obtained value.- The code did not regard the fact that only the upper 12 bits of
the accelerometer values are valid. Shift these
down four bits to yield the real raw value.- Further the sensor provides 2048 at zero g. This means that an
offset of 2048 must be subtracted from the raw value before
scaling. This was not taken into account by the driver,
yielding a weird value. Fix this by providing this offset in
sysfs.To house the scaling code better, the value reading code was
factored into the raw reading function.This proper scaling and offseting is necessary to get proper
values out of triggered buffer by offsetting, shifting and scaling
them.Signed-off-by: Linus Walleij
Tested-by: Jonathan Cameron
Signed-off-by: Jonathan Cameron -
The RX/TX buffers are gone so drop the lock (it should have been
in the transport struct anyway).Tested-by: Jonathan Cameron
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
This adds I2C regmap transport for the KXSD9 driver.
Tested on the KXSD9 sensor on the APQ8060 Dragonboard.Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
This converts the KXSD9 driver to drop the custom transport
mechanism and just use regmap like everything else.Tested-by: Jonathan Cameron
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron -
This is just a masquerading register write function, so use the
register write function instead.Signed-off-by: Linus Walleij
Tested-by: Jonathan Cameron
Signed-off-by: Jonathan Cameron -
This moves the KXSD9 SPI transport out to its own file and Kconfig
entry, so that we will be able to add another transport method.
We export the common probe and add a local header file for the
functionality shared between the main driver and the transport
driver.We make the SPI transport the default for the driver if SPI is
available and the KXSD9 driver was selected, so the oldconfig
upgrade path will be clear.Signed-off-by: Linus Walleij
Tested-by: Jonathan Cameron
Signed-off-by: Jonathan Cameron -
This makes it possible to later split the transport mechanism
using a generic probe() and a generic remove().Use dev_set_drvdata() and dev_get_drvdata() as a paired
accessor to operate on the abstract struct device * regardless
of the transport mechanism in use.Signed-off-by: Linus Walleij
Tested-by: Jonathan Cameron
Signed-off-by: Jonathan Cameron