- 13 Nov, 2016 30 commits
-
-
Brian Masney authored
The comment for tsl2583_probe() does not provide any useful value. This patch removes the comment. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The comment that describes the code that clears the interrupt bit was vague and didn't provide much value. This patch adds more detail about why that bit needs to be cleared. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The header only listed the tsl2580 and tsl2581 devices as supported by this driver. This patch adds the tsl2583 since it is also supported by this driver. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The driver contains a global lux table that can be updated via sysfs. Change this to a per device lux table so that multiple devices can be hooked up to the same system with different lux tables. There are 10 entries, plus 1 for the termination segment, set aside for the entries in the lux table. When updating the lux table via sysfs, only 9 entries, plus the terminator, could be added. This changes the code to allow for the 10 entries, plus the terminator. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
in_illuminance_lux_table_store assumes that an unsigned int is 32 bits. Replace this with sizeof(value[1]). Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
in_illuminance_lux_table_store() contains some unnecessary parentheses. This patch removes them since they provide no value. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
tsl2583_als_calibrate() returns the newly computed gain_trim if the calibration was successful. This function is only called by in_illuminance_calibrate_store() and the return value inside that sysfs attribute is only checked to see if an error was returned. This patch changes tsl2583_als_calibrate() to return 0 on success. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The check for ch1lux > ch0lux inside tsl2583_get_lux is only valid if the ratio is not equal to zero. Move the code block inside the else statement. This does away with the need to initialize the variables to zero. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
If channel 0 does not have any data, then the code sets the lux to zero. The corresponding comment says that the last value is returned. This updates the comment to correctly reflect what the code does. It also clarifies the comment about why 0 is returned. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The definition of the tsl2583_device_lux struct has a series of single line comments. There are two other cases where the multiline comments did not have an initial blank line. Change these comments to use the proper multiline syntax. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
There are two separate files describing the tsl2583 sysfs attributes. Combine the two files into one. Updated the name of the sysfs attributes to match the current ABI. Signed-off-by:
Brian Masney <masneyb@onstation.org> Suggested-by:
Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
Add and remove newlines to improve code readability in preparation for moving the driver out of staging. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
Fixed warning found by make W=2: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
Most of the values in the #defines have their values aligned on a single column, but some do not. This changes the remaining defines to use consistent alignment with the majority to improve code readability. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
Some functions and variables were prefixed with either taos, tsl258x, taos2583, or tsl2583. Change everything to use the tsl2583 prefix since that is the name of the .c file. The taos_settings member inside the taos_settings struct was renamed to als_settings. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
There are several places in the code where the function name is hardcoded in the log message. Use the __func__ constant string to build the log message. This also clarifies some of the error messages to match the code and ensures that the correct priority is used since the message is already being changed. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
Address warning from checkpatch: CHECK: Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
taos_probe() calls i2c_smbus_write_byte() to select the control register, however there are no subsequent calls to i2c_smbus_read_byte(). The write call is unnecessary and is removed by this patch. Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The current chip state is represented as a tristate (working, suspended, and unknown). The unknown state was not used. This patch changes the chip state so that it is now represented as a single boolean value (suspended). Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
The device probing and the suspend/resume code checks a flag internal to the driver that determines whether or not the chip is in a working state. These checks are not needed. This patch removes the unnecessary checks. It will do no harm to the hardware if the chip is reinitialized if it is already powered on. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
taos_get_lux checks to see if the chip is in a working state. This check is not necessary since it is only called from tsl2583_read_raw and in_illuminance_calibrate_store (via taos_als_calibrate). The chip state is already checked by these functions. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
in_illuminance_calibrate_store() did not check to see if the chip is in a working state. This patch adds the proper check. The return value from taos_als_calibrate() was also not checked in this function, so the proper check was also added while changes are being made here. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
The DAC is used to find the peak level of an alternating voltage input signal by a binary search using the output of a comparator wired to an interrupt pin. Like so: _ | \ input +------>-------|+ \ | \ .-------. | }---. | | | / | | dac|-->--|- / | | | |_/ | | | | | | | | irq|------<-------' | | '-------' Signed-off-by:
Peter Rosin <peda@axentia.se> Acked-by:
Thomas Gleixner <tglx@linutronix.de> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
Acked-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
It is assumed that the dpot is used as a voltage divider between the current dpot wiper setting and the maximum resistance of the dpot. The divided voltage is provided by a vref regulator. .------. .-----------. | | | vref |--' .---. | regulator |--. | | '-----------' | | d | | | p | | | o | wiper | | t |<---------+ | | | | '---' dac output voltage | | '------+------------+ Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
Acked-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
Acked-by:
Rob Herring <robh@kernel.org> Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
Example: $ cat '/sys/bus/iio/devices/iio:device0/out_resistance_raw_available' [0 1 256] Meaning: min 0, step 1 and max 256. Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
Specifically a helper for reading the available maximum raw value of a channel and a helper for forwarding read_avail requests for raw values from one iio driver to an iio channel that is consumed. These rather specific helpers are in turn built with generic helpers making it easy to build more helpers for available values as needed. Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Jonathan Cameron authored
A large number of attributes can only take a limited range of values. Currently in IIO this is handled by directly registering additional *_available attributes thus providing this information to userspace. It is desirable to provide this information via the core for much the same reason this was done for the actual channel information attributes in the first place. If it isn't there, then it can only really be accessed from userspace. Other in kernel IIO consumers have no access to what valid parameters are. Two forms are currently supported: * list of values in one particular IIO_VAL_* format. e.g. 1.300000 1.500000 1.730000 * range specification with a step size: e.g. [1.000000 0.500000 2.500000] equivalent to 1.000000 1.5000000 2.000000 2.500000 An addition set of masks are used to allow different sharing rules for the *_available attributes generated. This allows for example: in_accel_x_offset in_accel_y_offset in_accel_offset_available. We could have gone with having a specification for each and every info_mask element but that would have meant changing the existing userspace ABI. This approach does not. Signed-off-by:
Jonathan Cameron <jic23@kernel.org> [forward ported, added some docs and fixed buffer overflows /peda] Acked-by:
Daniel Baluta <daniel.baluta@intel.com> Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
- 12 Nov, 2016 8 commits
-
-
Brian Masney authored
When updating the in_illuminance_calibscale and in_illuminance_integration_time sysfs attributes, these values were not actually written to the chip. The chip would continue to use the old parameters. Extracted out tsl2583_set_als_gain() and tsl2583_set_als_time() functions that are now called when these sysfs attributes are updated. The chip initialization also calls these these new functions. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Brian Masney authored
taos_chip_on() reads an eight member array called taos_config that contains the desired state of the chip's registers. Only four of the registers actually need to be written to. The four that do not need to be written to are for the {low,high} byte of the lower interrupt threshold and the {low,high} byte of the upper interrupt threshold. Interrupts are currently not supported by this driver so there is no need to write to these registers. This patch removes the taos_config array and separates out the i2c calls that write to the CONTROL, TIMING, INTERRUPT and ANALOG registers. This is part of a larger refactor that was split up to make the code review easier. Signed-off-by:
Brian Masney <masneyb@onstation.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Linus Walleij authored
We have #defines for all the individual sensor registers and value/mask pairs #defined at the top of the file and used at exactly one spot. This is usually good if the #defines give a meaning to the opaque magic numbers. However in this case, the semantic meaning is inherent in the name of the C99-addressable fields, and that means duplication of information, and only makes the code hard to maintain since you every time have to add a new #define AND update the site where it is to be used. Get rid of the #defines and just open code the values into the appropriate struct elements. Make sure to explicitly address the .hz and .value fields in the st_sensor_odr_avl struct so that the meaning of all values is clear. This patch is purely syntactic should have no semantic effect. Signed-off-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Linus Walleij authored
We have #defines for all the individual sensor registers and value/mask pairs #defined at the top of the file and used at exactly one spot. This is usually good if the #defines give a meaning to the opaque magic numbers. However in this case, the semantic meaning is inherent in the name of the C99-addressable fields, and that means duplication of information, and only makes the code hard to maintain since you every time have to add a new #define AND update the site where it is to be used. Get rid of the #defines and just open code the values into the appropriate struct elements. Make sure to explicitly address the .hz and .value fields in the st_sensor_odr_avl struct so that the meaning of all values is clear. This patch is purely syntactic should have no semantic effect. Signed-off-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Linus Walleij authored
We have #defines for all the individual sensor registers and value/mask pairs #defined at the top of the file and used at exactly one spot. This is usually good if the #defines give a meaning to the opaque magic numbers. However in this case, the semantic meaning is inherent in the name of the C99-addressable fields, and that means duplication of information, and only makes the code hard to maintain since you every time have to add a new #define AND update the site where it is to be used. Get rid of the #defines and just open code the values into the appropriate struct elements. Make sure to explicitly address the .hz and .value fields in the st_sensor_odr_avl struct so that the meaning of all values is clear. This patch is purely syntactic should have no semantic effect. Signed-off-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Peter Rosin authored
The i2c mux core can then take appropriate action depending on if it is used for an actual i2c mux, or for an arbitrator or gate. In this case it is used as a gate. This will make devicetree bindings simpler when they are eventually added. Signed-off-by:
Peter Rosin <peda@axentia.se> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Colin Ian King authored
status is a u8 hence the check if status is less than zero has no effect. Fix this by replacing status with int ret so the less than zero compare will correctly detect errors. Issue found with static analysis with CoverityScan, CID 1375919 Signed-off-by:
Colin Ian King <colin.king@canonical.com> Fixes: 974e6f02 ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub") Reviewed-by:
Guenter Roeck <groeck@chromium.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Dan Carpenter authored
We should be testing "ret" here. Fixes: aa16c6bd ("iio:adc: Add support for AD7766/AD7767") Signed-off-by:
Dan Carpenter <dan.carpenter@oracle.com> Acked-by:
Lars-Peter Clausen <lars@metafoo.de> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
- 08 Nov, 2016 2 commits
-
-
Arnd Bergmann authored
The new mpu3050 driver fails to build if I2C is disabled: drivers/iio/built-in.o: In function `mpu3050_i2c_driver_exit': mpu3050-i2c.c:(.exit.text+0x17f): undefined reference to `i2c_del_driver' drivers/iio/built-in.o: In function `mpu3050_i2c_driver_init': mpu3050-i2c.c:(.init.text+0x215): undefined reference to `i2c_register_driver' This adds a Kconfig dependency to ensure we only build it when I2C is available. Fixes: 3904b28e ("iio: gyro: Add driver for the MPU-3050 gyroscope") Signed-off-by:
Arnd Bergmann <arnd@arndb.de> Acked-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-
Arnd Bergmann authored
The newly added mpu3050 driver has two initializations for the module owner, which causes a warning for 'make W=1': include/linux/export.h:37:21: error: initialized field overwritten [-Werror=override-init] drivers/iio/gyro/mpu3050-core.c:749:19: note: in expansion of macro 'THIS_MODULE' This removes one of the two. Fixes: 3904b28e ("iio: gyro: Add driver for the MPU-3050 gyroscope") Signed-off-by:
Arnd Bergmann <arnd@arndb.de> Acked-by:
Linus Walleij <linus.walleij@linaro.org> Signed-off-by:
Jonathan Cameron <jic23@kernel.org>
-