summaryrefslogtreecommitdiff
path: root/drivers/staging
AgeCommit message (Collapse)Author
2018-04-28staging: iio: ad2s1200: Improve readability with be16_to_cpupDavid Veenstra
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>
2018-04-28staging: iio: ad2s1200: Add blank linesDavid Veenstra
Add blank lines to improve readability. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28staging: iio: ad2s1200: Reverse Christmas tree orderingDavid Veenstra
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>
2018-04-28staging: iio: ad2s1200: Sort includes alphabeticallyDavid Veenstra
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>
2018-04-28staging: iio: ad2s1200: Remove unneeded includeDavid Veenstra
This patches removes unneeded slab.h header. Signed-off-by: David Veenstra <davidjulianveenstra@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28staging: iio: tsl2x7x: rename prox_config to als_prox_configBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: various comment cleanupsBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: use device defaults for als_time, prox_time and wait_timeBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: rename prx to prox for consistencyBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: move power and diode settings into header fileBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: simplify device id verificationBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: simplify tsl2x7x_write_interrupt_config returnBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: remove unnecessary chip status checks in suspend/resumeBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: simplify tsl2x7x_clear_interrupts functionBrian Masney
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>
2018-04-28staging: iio: tsl2x7x: don't return error in IRQ handlerBrian Masney
tsl2x7x_event_handler() could return an error and this could cause the interrupt to remain masked. We shouldn't return an error in the interrupt handler so this patch always returns IRQ_HANDLED. An error will be logged if one occurs. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28staging: iio: tsl2x7x: move integration_time* attributes to IIO_INTENSITY ↵Brian Masney
channel The integration_time* attributes are currently associated with the IIO_LIGHT channel but should be associated with the IIO_INTENSITY channel. Directory listing of the sysfs attributes for a TSL2772 with this patch applied: dev events in_illuminance0_calibrate in_illuminance0_calibscale_available in_illuminance0_input in_illuminance0_lux_table in_illuminance0_target_input in_intensity0_calibbias in_intensity0_calibscale in_intensity0_integration_time in_intensity0_integration_time_available in_intensity0_raw in_intensity1_raw in_proximity0_calibrate in_proximity0_calibscale in_proximity0_calibscale_available in_proximity0_raw name of_node power subsystem uevent Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28staging: iio: adc: simplify getting .drvdataWolfram Sang
We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-21staging: iio: ad7746: Fix bound checkingsHernán Gonzalez
Also remove unnecessary parenthesis Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15staging: iio: ad7746: Reorder variable declarationsHernán Gonzalez
Reorder some variable declarations in an inverse-pyramid scheme. Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15staging: iio: ad7746: Reorder includes alphabeticallyHernán Gonzalez
Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15staging: iio: ad7746: Fix multiple line dereferenceHernán Gonzalez
Clear checkpatch.pl WARNING about multiple line derefence but creates a new one of line over 80 characters. In my opinion, it improves readability. Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15staging: iio: ad7746: Adjust arguments to match open parenthesisHernán Gonzalez
Clear a couple more checkpatch.pl CHECKS. Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-15staging: iio: ad7746: Automatically swap values in readings/writingsHernán Gonzalez
Data to read or write was being handled with the swab16() macro instead of using i2c_smbus_{read,write}_swapped. Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30Staging: iio: adis16209: Move adis16209 driver out of stagingShreeya Patel
Move the adis16209 driver out of staging directory and merge to the mainline IIO subsystem. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30Staging: iio: adis16209: Use GENMASKShreeya Patel
Use GENMASK to improve readability and remove the local variables used to store intermediate data. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30Staging: iio: adis16209: Remove unused headersShreeya Patel
Remove few unused header files since the adis core handles the sysfs and buffer support. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30Staging: iio: adis16209: Add a blank line after return statementsShreeya Patel
Add a blank line after return statements to improve the code readability. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30Staging: iio: adis16209: Prefer reverse christmas tree orderingShreeya Patel
Prefer reverse christmas tree ordering of declarations to improve readability. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30Staging: iio: adis16209: Indent the field definitionsShreeya Patel
Have indentation in field definitions to make them clearly different from the register addresses. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-25staging: iio: tsl2x7x: use either direction for IIO_EV_INFO_{ENABLE,PERIOD}Brian Masney
The events IIO_EV_INFO_VALUE and IIO_EV_INFO_ENABLE currently have a falling and rising direction configured. There does not need to be a separate distinction so this patch changes these to use the either direction. Directory listing of event sysfs attributes for a TSL2772 with this patch applied: in_intensity0_thresh_either_en in_intensity0_thresh_either_period in_intensity0_thresh_falling_value in_intensity0_thresh_rising_value in_proximity0_thresh_either_en in_proximity0_thresh_either_period in_proximity0_thresh_falling_value in_proximity0_thresh_rising_value Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-25staging: iio: tsl2x7x: use auto increment I2C protocolBrian Masney
The hardware supports 16-bit ALS and proximity readings, however the datasheet recommends using the I2C auto increment protocol so that the correct high and low bytes are read even if the integration cycle ends between reading the lower and upper registers. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24Staging: iio: accel: adis16201: Move adis16201 driver out of stagingHimanshu Jha
Move adis16201 driver out of staging and merge into mainline IIO subsystem. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24Staging: iio: accel: adis16201: Fix 80 character line limitHimanshu Jha
Split the line over 80 characters limit to fix checkpatch warning. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24Staging: iio: accel: adis16201: Use GENMASKHimanshu Jha
Use GENMASK to improve readability and remove the local variables used to store intermediate data. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24Staging: iio: accel: adis16201: Remove unused headersHimanshu Jha
Remove few unused headers files since the adis core handles the buffer and sysfs support. Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: add copyrightBrian Masney
Add Brian Masney's copyright and to the list of module authors for all of the staging cleanups. This patch also update's Jon Brenner's current work email address since AMS now owns TAOS. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: put local variables in reverse Christmas tree orderBrian Masney
This patch ensures that all of the local variable declarations are in reverse Christmas tree order where possible to increase code readability. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: remove ch0 and ch1 variables from tsl2x7x_get_lux()Brian Masney
Remove the ch0 and ch1 variables from tsl2x7x_get_lux() and write those values directly into the chip->als_cur_info.als_ch0 and chip->als_cur_info.als_ch01 variables. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: remove unused variables from tsl2x7x_get_lux()Brian Masney
tsl2x7x_get_lux() has a ch0lux and ch1lux variables that are not used so this patch removes them. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: split out als and prox persistence settingsBrian Masney
The struct tsl2x7x_settings contained a persistence member that contained both the ALS and proximity persistence fields. This patch splits this out into two separate fields so that the bitmasks in several parts of the code are no longer necessary. The default persistence settings are also changed by this patch from: - Proximity: 0 (Every proximity cycle generates an interrupt) - ALS: 255 (60 consecutive values out of range) to something a little more reasonable based on my testing: - Proximity: 1 (1 proximity value out of range) - ALS: 1 (1 value outside of threshold range) Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: make logging consistent and correct newlinesBrian Masney
This patch updates all of the logging commands so that they are consistent with the other messages, includes __func__ in the message, and all of the messages include newlines. This patch also removes some debug log messages. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: split out als and prox interrupt settingsBrian Masney
The struct tsl2x7x_settings contained an interrupts_en member that was a bitmask for which interrupts are enabled. This required having bitmasks in several parts of the code. This patch splits this field out into two booleans to remove most of the bitmasks in the code. This patch also fixes a bug where if an interrupt pin was configured, but proximity interrupts were disabled, then the proximity value could not be polled. This patch also removes an unnecessary second call to writing the control register in tsl2x7x_chip_on(). Driver tested using a TSL2772 hooked up to a Raspberry Pi 2. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: simplify tsl2x7x_prox_cal()Brian Masney
tsl2x7x_prox_cal() would set the interrupt flag, and reset the device to start doing the calibration routine. However, this did not actually affect the readings since they are polled. This patch drops the interrupt code. This patch also drops the function tsl2x7x_prox_calculate() and removes support for the standard deviation and min sample since those values were not used. Driver was tested using a TSL2772 hooked up to a Raspberry Pi 2. I performed the following testing at various distances: - Put hand in front of sensor and keep the sensor and hand stationary. - Perform calibration routine. - Run iio_event_monitor. - Verify that a proximity event is triggered when my hand comes anywhere between the sensor and where I performed the calibration routine. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: no need to clear interrupt flag when getting luxBrian Masney
tsl2x7x_get_lux() does not need to clear the interrupt flag when querying the ALS. The interrupt flag is cleared in tsl2x7x_event_handler(). This patches removes the unnecessary code. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: correct interrupt handler triggerBrian Masney
tsl2x7x_event_handler() was not called as expected when the device was asserting a hardware interrupt. This patch changes the interrupt line trigger from rising to falling. The driver was tested on a TSL2772 hooked up to a Raspberry Pi 2. The interrupt pin also had a 10K pull-up resistor per the requirements from the datasheet. The relevant device tree binding: &i2c1 { tsl2772@39 { compatible = "amstaos,tsl2772"; reg = <0x39>; interrupt-parent = <&gpio>; interrupts = <22 0x2>; }; }; With this patch, iio_event_monitor now shows the events when the channels are outside the defined interrupt thresholds. $ sudo ./iio_event_monitor tsl2772 Found IIO device with name tsl2772 with device number 0 Event: time: 1478193460053760446, type: proximity, channel: 0, evtype: thresh, direction: either ... Event: time: 1478193463020270185, type: illuminance, channel: 0, evtype: thresh, direction: either ... Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging: iio: tsl2x7x: remove unnecessary codeBrian Masney
As a follow up to the work in commit a0722d05a195 ("staging: iio: tsl2x7x: convert mutex_trylock() to mutex_lock()"), this patch removes the unnecessary calls to tsl2x7x_get_prox() and tsl2x7x_get_lux() in tsl2x7x_event_handler(). Previously, these functions were locked with mutex_trylock(), but that is no longer the case. This patch also removes a comment that is no longer relevant about returning the last sample. Signed-off-by: Brian Masney <masneyb@onstation.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Remove read_reg_* duplicationsRodrigo Siqueira
The original code had a read function per data size; after updates, all read functions tasks were centralized in a single function, but the old signature was kept to maintain the module working without problems. This patch removes a set of duplications associated with read_reg_*, and update the areas that calling the old interface by the new one. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Rework SPI read functionRodrigo Siqueira
Rework read SPI function to reduce the code duplication and centralizes all the task in a single function. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Rework I2C read functionRodrigo Siqueira
The read operation for the I2C function has many duplications that can be generalized into a single function. This patch reworks the read operation for I2C to centralizes all similar code in a single function. It is possible to remove all the old interface to use the new one, however, for keeping the things simple and working this patch maintain legacy interface. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-24staging:iio:ade7854: Remove write_reg_* duplicationsRodrigo Siqueira
This patch removes code duplications related to the write_reg_* functions and centralizes them in a single function. Also, it eliminates the legacy functions and replaces them by a unique signature that is used by SPI and I2C. Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>