- 06 May, 2018 13 commits
-
-
Brian Masney authored
The integration_time sysfs attribute did not report the correct time. Changing the integration time would cause the reported lux to change wildly. Once the integration time was corrected, all of the equations, and lux tables needed to be corrected to match what the data sheets expected. This patch corrects all of this, and adds some more comments about how some of the constants were derived. Here are the results from testing a TSL2772 hooked up to a Raspberry Pi 2: # cat in_intensity0_integration_time 0.002730 # watch -n .1 cat in_illuminance0_input ; Lux hovers around 55 # echo 0.65 > in_intensity0_integration_time # cat in_intensity0_integration_time 0.649740 # watch -n .1 cat in_illuminance0_input ; Lux hovers around 55 with noticeable lag to lux changes in watch ; process. ; Now test the ALS calibration routine. # cat in_intensity0_calibbias 1000 # cat in_illuminance0_target_input 150 # echo 1 > in_illuminance0_calibrate # cat in_intensity0_calibbias 2777 # watch -n .1 cat in_illuminance0_input ; Lux now hovers around 150-155 The returned lux values were tested on a TSL2772 in various lighting conditions and the results are within the lux ranges described at https://en.wikipedia.org/wiki/Lux. The driver was primarily tested using a TSL2772, however some quick tests were also ran against the devices TSL2771, TSL2572, and TMD2772. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The in_intensity0_calibscale_available sysfs attribute has code that checks the device type to determine which calibration scales are available. This check is not necessary since all of the supported ALS device types use the scales 1 8 16 120. This patch converts the sysfs attribute to use IIO_CONST_ATTR. The following device datasheets were checked: tsl2571, tsl2771, tmd2771, tsl2572, tsl2772, tmd2772. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The calibscale_available attribute is currently associated with the IIO_LIGHT channel but should be associated with the IIO_INTENSITY channel. This patch corrects that association and it also corrects lines that were unnecessarily split for the in_intensity0_integration_time sysfs attribute. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The driver would expose to userspace the events directory even if the interrupts were not configured. This patch changes the driver so that the events directory is not exposed to user space if interrupts are not configured. This patch also corrects the indentation of the chan_table_elements and info structure members. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The sysfs attributes in_illuminance0_target_input, in_illuminance0_calibrate, and in_proximity0_calibrate did not have proper range checking in place so this patch adds the correct range checks. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The summary text for the GPL is not needed since the SPDX identifier is a legally binding shorthand that can be used instead. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Sean Nyekjaer authored
Adding binding documentation for Texas Instruments DAC5571 Family Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Sean Nyekjaer authored
This patch adds support for the Texas Intruments DAC5571 Family. Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Martin Kelly authored
Just some minor grammar/spelling fixes of things I noticed while reading the code. Signed-off-by: Martin Kelly <mkelly@xevo.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
When in spi mode, we are setting i2c disable bit in user_ctrl register. But the register is overwritten after when turning fifo on. So save user_ctrl init value and always use it when updating the register. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
Implement generic skip first samples mechanism and use it to filter out first sample when gyro is on. The problem for these chips is that the first sample of the gyro is out of specs, because gyro is not completely stabilized. To ensure all data are within sensor specs, we just skip the first sample when turning gyro on. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
Detected by kernel circular locking dependency checker. We are locking iio mutex (iio_device_claim_direct_mode) after locking our internal mutex. But when the buffer starts, iio first locks its mutex and then we lock our internal one. To avoid possible deadlock, we need to use the same order everwhere. So we change the ordering by locking first iio mutex, then our internal mutex. Fixes: 68cd6e5b ("iio: imu: inv_mpu6050: fix lock issues by using our own mutex") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
icm20608 does not have i2c aux bus, so it does not make sense to allocate an i2c mux for this chip. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
- 28 Apr, 2018 27 commits
-
-
David Veenstra authored
The iio resolver drivers in staging use angle channels. This patch add missing documentation for this type of channel. As was discussed in [1], radians is chosen as the unit, to match the unit of angular velocity. [1] https://marc.info/?l=linux-driver-devel&m=152190078308330&w=2Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
David Veenstra authored
The manual states that the data is contained in the upper 12 bits of the 16 bits read by spi. The code that extracts these 12 bits is correct for both be and le machines, but this is not clear from a first glance. To improve readability the relevant expressions are replaced with equivalent expressions that use be16_to_cpup. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Peter Rosin authored
If an ADC channel measures the midpoint of a voltage divider, the interesting voltage is often the voltage over the full resistance. E.g. if the full voltage is too big for the ADC to handle. Likewise, if an ADC channel measures the voltage across a shunt resistor, with or without amplification, the interesting value is often the current through the resistor. This driver solves these problems by allowing to linearly scale a channel and/or by allowing changes to the type of the channel. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Peter Rosin authored
Similar to current sense shunts, but an amplifier enables the use of a smaller sense resistance. Signed-off-by: Peter Rosin <peda@axentia.se> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Peter Rosin authored
An ADC is often used to measure other quantities indirectly. This binding describe one cases, a "big" voltage measured with the help of a voltage divider. Signed-off-by: Peter Rosin <peda@axentia.se> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Peter Rosin authored
An ADC is often used to measure other quantities indirectly. This binding describe one cases, a current through a shunt resistor measured by the voltage over it. Signed-off-by: Peter Rosin <peda@axentia.se> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Charles Keepax authored
The regmap core now handles splitting up transactions according to max_raw_read, so this code is no longer required in client drivers. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
Delete the useless ored result and give a second chance to turn the chip back off at the end. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
Factorize reading channel data in its own function. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
Use devm_* for iio_triggered_buffer_setup, iio_device_register, iio_trigger_register. Delete unneeded inv_mpu6050_remove_trigger, inv_mpu_core_remove, and inv_mpu_remove for spi driver. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Jean-Baptiste Maneyrol authored
Some functions are turning the chip on and not back off in error path. With set_power function using a reference counter that would keep the chip on forever. Signed-off-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Fabrice Gasnier authored
spi-max-frequency is requested for SPI master mode (only), to tune output clock. It may happen requested frequency isn't reachable. Add explicit check, so probe fails with error in this case. Otherwise, output clock may simply be silently turned off (conversions fail). Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Fabrice Gasnier authored
reg property should be checked against number of available filters. BTW, dfsdm->num_fls wasn't used. But it can be used for this purpose. This prevents using data out of allocated dfsdm->fl_list array. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Fabrice Gasnier authored
Misc fixes & style improvements: - checkpatch warns about line over 80 characters. - remove extra spaces and a blank line (e.g. checkpatch --strict) - remove bad error message always printed in probe routine. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
David Veenstra authored
Add blank lines to improve readability. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
David Veenstra authored
Reorders the variable declarations to prefer a reverse Christmas tree order to improve readability. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
David Veenstra authored
This patches sorts all the includes in alphabetic order. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
David Veenstra authored
This patches removes unneeded slab.h header. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The configuration register on the device is represented with the prox_config member on the tsl2x7x_settings structure. According to the TSL2772 data sheet, this register can hold: 1) the proximity drive level, 2) ALS/Proximity long wait, and 3) the ALS gain level. This patch renames prox_config to als_prox_config since ALS settings can be stored here as well. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
This patch removes several unnecessary comments, changes some comments so that the use as much of the allowable 80 characters as possible, adds the proper whitespace, removes some structure members from the kernel docs that are no longer present, and improves the existing kernel doc information for some existing structure members. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
This patch changes the defaults of the als_time, prox_time and wait_time to match the defaults according to the TSL2772 datasheet. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The driver mostly uses the 'prox' naming convention for most of the proximity settings, however prx_time and tsl2x7x_prx_gain was present. This patch renames these to prox_time and tsl2x7x_prox_gain for consistency with everything else in the driver. The kernel documentation for prx_gain is corrected to prox_gain so that it matches what is actually in the structure. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
The power and diode defines are needed for the platform data so this patch moves the defines out of the .c file and into the header file. A comment for the diode is also cleaned up while this code is touched. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
This patch renames tsl2x7x_device_id() to tsl2x7x_device_id_verif(), removes the unnecessary pointer on the id parameter, and only calls the verification function once. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
tsl2x7x_write_interrupt_config() has an unnecessary return value check at the end of the function. This patch changes the function to just return the value from the call to tsl2x7x_invoke_change(). Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
tsl2x7x_suspend() and tsl2x7x_resume() both check to see what the current chip status is. These checks are not necessary so this patch removes those checks. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
Brian Masney authored
tsl2x7x_clear_interrupts() takes a reg argument but there are only two callers to this function and both callers pass the same value. Since this function was introduced, interrupts are now working properly for this driver, and several unnecessary calls to tsl2x7x_clear_interrupts() were removed. This patch removes the tsl2x7x_clear_interrupts() function and replaces the two callers with the i2c_smbus_write_byte() call instead. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-