summaryrefslogtreecommitdiff
path: root/drivers/staging/iio/magnetometer/hmc5843.c
AgeCommit message (Collapse)Author
2014-07-23staging:iio:hmc5843: Split hmc5843.c to multiple filesJosef Gajdusek
This patch splits hmc5843.c to multiple files - the interface-agnostic hmc5843_core.c, i2c specific hmc5843_i2c.c and header file hmc5843.h. This is another step to add support of SPI-enabled hmc5983. Signed-off-by: Josef Gajdusek <atx@atx.name> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-07-23staging:iio:hmc5843: Added regmap supportJosef Gajdusek
This patch changes hmc5843.c to use regmap. This provides transparent caching to the code as well as abstraction necessary to add support for SPI-based hmc5983. Signed-off-by: Josef Gajdusek <atx@atx.name> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-06-29staging: iio: hmc5843: Add all available models to device tree id table.Marek Belisko
Signed-off-by: Marek Belisko <marek@goldelico.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-24Merge tag 'iio-for-3.14b' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 2nd round of new IIO drivers, features and cleanups for the 3.14 cycle. New drivers * HID inclinometer driver. * DHT11 humidity driver. Note that previous humidity drivers have been in hwmon, but no one was ever entirely happy with that, and they should find a more comfortable home in IIO (their original placement in hwmon was my fault - oops). As this is our first humidity driver, core support is also added. New features * Two of mxs-lradc channels are internally wired to a temperature sensor, make this explicit in the driver by providing the relevant temperature channel. * Add support for blocking IO on buffers. * Add a data_available call back to the interface between buffer implementations and the core. This is much cleaner than the old, 'stufftoread' flag. Implemented in the kfifo buffer. Cleanups * Last user of the old event configuration interface is converted and the old interface dropped. Nice to be rid of this thanks to Lars-Peter's hard work! * Replace all remaining instances of the IIO_ST macro with explicit filling of the scan_type structure within struct iio_chan_spec. This macro was a bad idea, that rapidly ceased to cover all elements of the structure. Miss reading of the macro arguements has led to a number of bugs so lets just get rid of it. The final removal patch is awaiting for some fixes to make their way into mainline. In a couple of drivers, no elements of scan_type were even being used so in those case, it has been dropped entirely. * Drop a couple of of_match_ptr helper uses in drivers where devicetree is not optional and hence the structures being protected by this always exist. * Fix up some cases where data was read from a device in a particular byte order, but he code placed it into a s16 or similar. These were highlighted by Sparse. * Use the new ATTRIBUTE_GROUPS macro to drop some boiler plate in the triggers core code. * ad7746 and ad7280a - stop storing buffers on the stack, giving cleaner code and possibly avoiding issues with i2c bus drivers that assume they can dma directly into the buffer. Note that this cannot currently happen as the the i2c_smbus_read_i2c_block_data function has a memcpy from the buffer actually passed to the bus driver. I missed this element of the commit message and don't think it is major enough to rebase the iio tree. * ad5791 and ad5504 stop storing buffers on the stack for an SPI driver. Unlike the i2c drivers, this is a real issue for SPI drivers which can dma directly into the buffer supplied.
2013-12-24Merge 3.13-rc5 into staging-nextGreg Kroah-Hartman
This resolves a merge issue with drivers/staging/imx-drm/imx-drm-core.c Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-22staging: iio: hmc5843: Remove redundant of_match_ptr helperiio-for-3.14bSachin Kamat
'hmc5843_of_match' is always compiled in. Hence the helper macro is not needed. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-17staging:iio:mag:hmc5843 fix incorrect endianness of channel as a result of ↵Jonathan Cameron
missuse of the IIO_ST macro. This driver sets the shift value equal to IIO_BE (or 1) rather than setting that to 0 and specificying the endianness. This means the channel type is missreported as [be|le]:u16/16>>1 where the be|le is dependent on the cpu native endianness, rather than be:u16/16>>0 resulting in any userspace code using this information, miss converting the channel and generating thoroughly trashed data. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Cc: stable@vger.kernel.org
2013-11-24iio:magnetometer:hmc5843 - add basic dt supportNeilBrown
Compatible string, documenation and an optional gpio for the dataready pin. Signed-off-by: NeilBrown <neilb@suse.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Trivial cleanupPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Check initialization and chip identifierPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Introduce _set_range_gain()Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Rename _set_rate() to _set_samp_freq()Peter Meerwald
move locking inside _set() function Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Reorganize _set_meas_conf()Peter Meerwald
move locking inside _set() function Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Rename _configure() to _set_mode()Peter Meerwald
and be consistent with other setter functions in that first argument is hmc5843_data Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Remove ability to change operating modePeter Meerwald
only continuous mode is supported for now; the driver could/should be switched to single conversion mode operating mode should be determined by the way IIO accesses the device and not exposed explicitly Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Add trigger handlingPeter Meerwald
v3: * use __be16 instead of s16 v2 (thanks to Jonathan Cameron): * drop dynamic buffer allocation, buffer is in hmc5842_data * grab timestamp near data acquisition * restrict available scan masks (only read all axis) Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Always read all channels values otherwise no updatesPeter Meerwald
v2: * use __be16 instead of s16 Split out data ready/wait for read measurement fix bug in case reading status register fails Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Rename _check_samp_freq to get_samp_freq_indexPeter Meerwald
and drop/inline helper functions _check_int_plus_micros() and _show_int_plus_micros() Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-17staging:iio:hmc5843: Use SCALE instead of magn_rangePeter Meerwald
v3: * rename _check_scale() to _get_scale_index() v2: * use SCALE instead of CALIBSCALE to control the range/gain of measurements Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01staging:iio:hmc5843: Introduce helper functions to show/check list of int pairsPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01staging:iio:hmc5843: Tighten commentsPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01staging:iio:hmc5843: Remove unused LSB register #definesPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01staging:iio:hmc5843: Use INFO_SAMP_FREQPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01staging:iio:hmc5843: Rewrite init functionPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01staging:iio:hmc5843: Add pointer to i2c client to data structPeter Meerwald
and use it to simplify code Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-25Merge 3.12-rc2 into staging-next.Greg Kroah-Hartman
This resolves the merge problem with two iio drivers that Stephen Rothwell pointed out. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-18staging:iio:hmc5843: Fix measurement conversionPeter Meerwald
recently broken, cd6fe06588423ff4cca85c85c4402027b04dccf1 staging:iio:hmc5843: Use i2c_smbus_read_word_swapped() Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-11staging:iio:hmc5843: Use devm_iio_device_allocPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-07staging: iio: hmc5843: Fix a trivial typoSachin Kamat
Add a missing closing brace. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: Use i2c_smbus_read_word_swapped()iio-for-3.12aPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: Drop unneeded #includesPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: Device has 3 channels, no need to store separatelyPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: 'add' is a poor abbreviation for addressPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: Implement timeout in read functionPeter Meerwald
avoid polling data ready bit forever; msleep() may be too long for high sampling frequencies but the driver interface does not support buffering Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: Remove id register #defines, not used anymorePeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-04staging:iio:hmc5843: Drop I2C detection codePeter Meerwald
I2C is generally not probed for devices other than those commonly found on architectures where device treeor board files are not used. Note also that this implementation does not fill in the name field of the i2c_board_info structure as the documentation states it must. Hence it is unlikely anyone is actually using it. Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-17staging:iio:magnetometer:hmc5843 move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> cc: Shubhrajyoti D <shubhrajyoti@ti.com>
2012-11-21staging: iio: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: iio: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21staging: iio: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-10-19drivers/staging/iio: Remove unnecessary semicolonPeter Senna Tschudin
A simplified version of the semantic patch that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r1@ statement S; position p,p1; @@ S@p1;@p @script:python r2@ p << r1.p; p1 << r1.p1; @@ if p[0].line != p1[0].line_end: cocci.include_match(False) @@ position r1.p; @@ -;@p // </smpl> Signed-off-by: Peter Senna Tschudin <peter.senna@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-09-03staging:iio: Update email address for Jonathan Cameron.iio-for-v3.7bJonathan Cameron
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-06-05staging: iio: hmc5843: Make it behave better as modulesShubhrajyoti D
The memory regions of the probe and remove are move to __devinit and __devexit respectively. Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-17staging: iio: add support for hmc5883/hmc5883l to hmc5843 magnetometer driverPeter Meerwald
v3 addresses review comments: * rotate tables (Jonathan Cameron) * remove trailing space, add newline in sysfs output (Jonathan Cameron) * split out patch for reorganization of hmc5843_set_rate() (Jonathan Cameron) * use static table to describe chip variants (Jonathan Cameron) v2 addresses review comments: * fixes and cleanups have been split out (Jonathan Cameron) * constants are generally prefixed HMC5843_, except when related specifically to hmc5883 (Jonathan Cameron) * simplify code and avoid temp buffer in hmc5843_show_sampling_frequencies_available() (Lars-Peter Clausen) * use sysfs_streq() instead of strncmp()/strlen() in hmc5843_check_sampling_frequency() (Lars-Peter Clausen) Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-17staging: iio: reorganize hmc5843_set_rate()Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-17staging: iio: rename function/data to consistently start with hmc5843_Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-17staging: iio: cleanup and move comments in hmc5843Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-17staging: iio: add check for measurement configuration value passed to hmc5843Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-17staging: iio: rework sampling rate setting in hmc5843Peter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-16staging: iio: rename and prefix CONSTANTs to distinguish between HMC5843 and ↵Peter Meerwald
HMC5883 Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Acked-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>