Octal permissions should be used instead of symbolic ones for easier
reading.
Signed-off-by: Julián de Gortari <kiototeko@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
These stand-alone trigger drivers were using iio_trigger_put()
where they should have been using iio_trigger_free(). The
iio_trigger_put() adds a module_put which is bad since they
never did a module_get.
In the sysfs driver, module_get/put's are used as triggers are
added & removed. This extra module_put() occurs on an error path
in the probe routine (probably rare).
In the bfin-timer & interrupt trigger drivers, the module resources
are not explicitly managed, so it's doing a put on something that
was never get'd. It occurs on the probe error path and on the
remove path (not so rare).
Tested with the sysfs trigger driver.
The bfin & interrupt drivers were build tested & inspected only.
Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch adds runtime power management support to the isl29028 driver.
It defaults to powering off the device after two seconds of inactivity.
isl29028_chip_init_and_power_on() currently only zeros the CONFIGURE
register on the chip, which will cause the chip to turn off. This patch
also renames that function to isl29028_clear_configure_reg() since it is
now used in several places.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_chip_init_and_power_on() calls isl29028_set_als_scale() and
this is not needed until the user actually needs to take a reading from
the ALS/IR sensor. This patch moves the isl29028_set_als_scale() call
from isl29028_chip_init_and_power_on() to isl29028_set_als_ir_mode().
This sets the stage for faster resume times from runtime power
management if the user is only querying the proximity sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_chip_init_and_power_on() calls isl29028_set_proxim_sampling()
and this is not needed until the user actually needs to take a proximity
reading. This patch moves the isl29028_set_proxim_sampling() call from
isl29028_chip_init_and_power_on() to isl29028_enable_proximity().
This sets the stage for faster resume times from the runtime power
management if the user is only querying the ALS/IR sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_enable_proximity() has a boolean argument named enable. This
function is only called once and the enable flag is set to true in that
call. This patch removes the enable parameter from that function.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_write_raw() contains unnecessary parenthesis when checking to
see if the passed in lux scale is valid. This patch removes the
unnecessary parenthesis.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
If the call to devm_iio_device_alloc() fails, then isl29028_probe()
logs a message saying that memory cannot be allocated. The user's system
most likely has larger issues at this point. This patch removes that
error message since the error code is passed on and the message is not
necessary.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
If the call to isl29028_chip_init_and_power_on() in isl29028_probe()
fails, then isl29028_probe() will log an error message. All of the
error paths in that call path already have error logging in place. This
patch removes the unnecessary logging.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The wording and style of the different error messages was not
consistent. This patch makes the wording and style consistent
throughout the driver.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
When isl29028_set_als_scale() fails, it was up to both callers to log
the failure message. This patch moves the logging into
isl29028_set_als_scale() to reduce the overall amount of code in the
driver.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
When isl29028_set_proxim_sampling() fails, it was up to both callers to
log the failure message. This patch moves the logging into
isl29028_set_proxim_sampling() to reduce the overall amount of code in
the driver.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The #define ISL29028_DEV_ATTR was not used so this patch removes the
unnecessary code.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
The alignment of the variables in the struct isl29028_chip is not
consistent. This changes all of the variables to use consistent
alignment to improve the code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_proxim_get() checks to see if the promixity needs to be
enabled on the chip and then calls isl29028_read_proxim(). There
are no other callers of isl29028_read_proxim(). The naming between
these two functions can be confusing so this patch combines the
two to avoid the confusion.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Two separate calls to regmap_update_bits() in isl29028_set_als_scale()
and isl29028_set_als_ir_mode() did not have their function arguments
on the next line aligned correctly to the open parenthesis. This patch
corrects the alignment.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Fixes style issue where Alignment doesn't match open parenthesis
Signed-off-by: Scott Matheina <scott@matheina.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
As a precursor to splitting buffer.h, lets make sure all drivers
include the relevant headers rather than relying on picking them
up from kfifo_buf.h.
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Eliminate the non-standard attributes in_voltage_range and
in_voltage_range_available. Implement in_voltage_scale_available in place
of these attributes and update the SCALE accordingly. The array
scale_avail is introduced to hold the available scale values.
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The alignment of the #defines at the top of the file is not consistent.
This changes all of the defines to use consistent alignment to improve
the code readability.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
isl29028_chip_init() contains the device driver defaults and
two I2C calls that detect the presence of the chip. This patch
moves these into isl29028_probe() so that this function can
be used by the power management runtinme in a followup patch. This
patch also renames isl29028_chip_init() to
isl29028_chip_init_and_power_on().
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
There are two callers to the function isl29028_set_als_ir_mode() and
both instances use a nested if statement to only change the chip state
if it is not in the proper mode. This patch moves this check into the
isl29028_set_als_ir_mode() function to remove the nested if
statements.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
At the end of function ad7150_write_event_config(), directly returns 0.
As a result, the errors will be ignored by the callers. It may be better
to return variable "ret".
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This patch fixes the following checkpatch.pl warning in ad7150.c
WARNING: Symbolic permissions 'S_IRUGO | S_IWUSR' are not preferred
Occured during build.
Signed-off-by: Amit Kushwaha <kushwaha.a@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
msleep(1~20) may not do what the caller intends, and will often sleep longer.
(~20 ms actual sleep for any value given in the 1~20ms range)
This is not the desired behaviour for many cases like device resume time,
device suspend time, device enable time, data reading time, etc.
Thus, change msleep to usleep_range for precise wakeups.
Signed-off-by: Aniroop Mathur <a.mathur@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The module descriptions for the ADIS 16201, 16203 and 16209 drivers do not
match the actual function of the devices. Update them accordingly to fix
this.
Signed-off-by: Reto Schneider <code@reto-schneider.ch>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Move tsl2580, tsl2581, tsl2583 driver out of staging into mainline.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add Brian Masney's copyright to the header and to the MODULE_AUTHOR
for all of the staging cleanups that has been done to this driver.
The original MODULE_AUTHOR() did not have a space between his name and
email address. This patch also adds the missing space.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The ret variable in tsl2583_suspend() and tsl2583_resume() was
initialized to 0. This is not necessary so this patch removes the
initialization.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
The entries in the lux table (als_device_lux) can be updated via sysfs
through the function in_illuminance_lux_table_store(). The last row in
the table must be terminated with values that are zero. The sysfs code
already ensures that the last row is all zeros. The call to memset to
clear out the table is not needed so this patch removes the unnecessary
call.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>