Drop call to of_match_device, which is subsumed by the subsequent
call to of_device_get_match_data. The code becomes simpler, and a
temporary variable can be dropped.
The semantic match that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r@
local idexpression match;
identifier i;
expression x, dev, e, e1;
@@
- match@i = of_match_device(x, dev);
- if (match) e = of_device_get_match_data(dev);
- else e = e1;
+ e = of_device_get_match_data(dev);
+ if (!e) e = e1;
@@
identifier r.i;
@@
- const struct of_device_id *i;
... when != i
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
val2 is responsible for the floating part of the number to be
written to the device. We don't need the floating part
while writing the oversampling ratio for BME680 since the
available oversampling ratios are pure natural numbers.
So, add a sanity check to make sure val2 is 0.
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add an entry for mcp3911 ADC driver and add myself and
Kent Gustavsson as maintainers of this driver.
Co-Developed-by: Kent Gustavsson <kent@minoris.se>
Signed-off-by: Kent Gustavsson <kent@minoris.se>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
MCP3911 is a dual channel Analog Front End (AFE) containing two
synchronous sampling delta-sigma Analog-to-Digital Converters (ADC).
Co-Developed-by: Kent Gustavsson <kent@minoris.se>
Signed-off-by: Kent Gustavsson <kent@minoris.se>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
MCP3911 is a dual channel Analog Front End (AFE) containing two
synchronous sampling delta-sigma Analog-to-Digital Converters (ADC).
Co-developed-by: Kent Gustavsson <kent@minoris.se>
Signed-off-by: Kent Gustavsson <kent@minoris.se>
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fixes ef89f4b96a ("iio: adxl345: Add support for the ADXL375").
This was found via static checker.
After looking into the code a bit, it's unlikely that there will be a NULL
dereference if the `id` object in that specific code path.
However, it's safe to add a NULL (paranoid) check just to make sure and
remove any uncertainties.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Variable max44000_alstim_shift is defined but is never used hence it is
redundant and can be removed. This variable has been like this since
the driver was added back in 2016.
Cleans up clang warning:
warning: 'max44000_alstim_shift' defined but not used [-Wunused-const-variable=]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for the adxl372 FIFO. In order to accomplish this,
triggered buffers were used.
The number of FIFO samples which trigger the watermark interrupt can be
configured by using the buffer watermark. The FIFO format is determined by
configuring the scan elements for each axis. The FIFO data is pushed to the
IIO device's buffer.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Some devices have individual registers that don't autoincrement the
register address during bulk reads but instead repeatedly read the same
value, for example for monitoring GPIOs or ADCs. Add support for these.
-----BEGIN PGP SIGNATURE-----
iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAltsE8YTHGJyb29uaWVA
a2VybmVsLm9yZwAKCRAk1otyXVSH0DeLB/sHEWAdyUCz9dO9pDdpi6WfpnKXuCCd
ZFnx8VXBvzVLRCZYGXuMOUEzBQU2lTr2KPFDmE1k4FclyiWaI+hRIJ0s/x8FAl51
EFDoR4TM7t2n2aY0sPQCZKnoAhdQ9YPxlA9JjDUE57h0KoC76Dh8OB44dlAlxUAY
PUjkv64/7AtvkBX7UZPQxckaPOLKM00P/hXwCB9MZCkjqnSWkUGgNCWPgKn9j2yL
jiUQO0Wo9u8RkvYvndHPkh4NzgeH1sUFUdNys/Fopu6C2miIYBNKzvEo2OXhelHf
k5rsoMQXYdiPdy4vRbeaWFetyEeBjxKIAQHKD0WJviFPw8j+ET+2GNjx
=p0Mu
-----END PGP SIGNATURE-----
Merge tag 'regmap-noinc-read' into togreg
regmap: Support non-incrementing registers
Some devices have individual registers that don't autoincrement the
register address during bulk reads but instead repeatedly read the same
value, for example for monitoring GPIOs or ADCs. Add support for these.
Add the device tree binding documentation for the ADXL372 3-axis digital
accelerometer.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds basic support for Analog Devices ADXL372 SPI-Bus
Three-Axis Digital Accelerometer.
The device is probed and configured the with some initial default
values. With this basic driver, it is possible to read raw acceleration
data.
Datasheet:
http://www.analog.com/media/en/technical-documentation/data-sheets/ADXL372.pdf
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add ADC5_AMUX_THM2_100K_PU and ADC5_AMUX_THM4_100K_PU to the list of
rev2 ADC channels.
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
After finding a reasonable gain, the function converts the configured
gain to a gain configuration option selector enum max9611_csa_gain.
Make the conversion clearly visible by using an explicit cast. This
also avoids a warning seen with clang:
drivers/iio/adc/max9611.c:292:16: warning: implicit conversion from
enumeration type 'enum max9611_conf_ids' to different enumeration
type 'enum max9611_csa_gain' [-Wenum-conversion]
*csa_gain = gain_selectors[i];
~ ^~~~~~~~~~~~~~~~~
Signed-off-by: Stefan Agner <stefan@agner.ch>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This is already handled by SIMPLE_DEV_PM_OPS().
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This is already handled by SIMPLE_DEV_PM_OPS().
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This is already handled by SIMPLE_DEV_PM_OPS().
Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
In preparation to enabling -Wimplicit-fallthrough, mark switch cases
where we are expecting to fall through.
Notice that in this particular case, I placed the "fall through"
annotation at the bottom of the case, which is what GCC is expecting
to find.
Addresses-Coverity-ID: 1458342 ("Missing break in switch")
Addresses-Coverity-ID: 1458345 ("Missing break in switch")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Compatible strings tend to follow manufacturer,model format.
In case one wants to do a matching with manufacturer stripped
off he can still do so since SPI/I2C core will try id_table
based matching anyway.
Signed-off-by: Tomasz Duszynski <tduszyns@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Temperature, pressure and humidity all expose and oversampling setting
that works in the same way. Provide common handling for the
oversampling sysfs attributes.
Signed-off-by: David Frey <dpfrey@gmail.com>
Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com>
Tested-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Use the FIELD_GET macro instead of explicit mask and shift.
Signed-off-by: David Frey <dpfrey@gmail.com>
Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com>
Tested-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Convert all defines to use "MASK" instead of a mix of "MSK" and "MASK"
Signed-off-by: David Frey <dpfrey@gmail.com>
Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com>
Tested-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Use the full 80 char width to reduce the number of lines taken
by function calls.
Remove blank lines where it aids clarity by bringing together related
code blocks (such as read hi and low bytes and then combine them into
one value).
Signed-off-by: David Frey <dpfrey@gmail.com>
Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com>
Tested-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for the regulator framework to the tsl2772
driver. Driver was tested using a LG Nexus 5 (hammerhead) phone with
the two regulators and on a Raspberry Pi 2 without any regulators
controlling the power to the sensor.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds avago,apds9930 to the tsl2772 bindings.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for optionally reading the proximity led diode
and current settings from device tree. This was tested using a LG
Nexus 5 (hammerhead) which requires a different diode than the driver
default for the IR LED.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds the new properties amstaos,proximity-diodes and
led-max-microamp to the tsl2772 driver. This patch also removes the
driver from the trivial-devices.txt.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for the regulator framework to the mpu6050
driver.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch adds support for QCOM SPMI PMIC5 family
of ADC driver that supports hardware based offset and
gain compensation. The ADC peripheral can measure both
voltage and current channels whose input signal is
connected to the PMIC ADC AMUX.
The register set and configuration has been refreshed
compared to the prior QCOM PMIC ADC family. Register
ADC5 as part of the IIO framework.
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The regmap API usually assumes that bulk read operations will read a
range of registers but some I2C/SPI devices have certain registers for
which a such a read operation will return data from an internal FIFO
instead. Add an explicit API to support bulk read without range semantics.
Some linux drivers use regmap_bulk_read or regmap_raw_read for such
registers, for example mpu6050 or bmi150 from IIO. This only happens to
work because when caching is disabled a single regmap read op will map
to a single bus read op (as desired). This breaks if caching is enabled and
reg+1 happens to be a cacheable register.
Without regmap support refactoring a driver to enable regmap caching
requires separate I2C and SPI paths. This is exactly what regmap is
supposed to help avoid.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com>
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
PMIC5 ADC has support for clients to measure voltage and current
on inputs connected to the PMIC. Clients include reading voltage
phone power and on board system thermistors for thermal management.
ADC5 on certain PMIC has support to read battery current.
This change adds documentation.
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
fix spelling mistake in dev_err error message text
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
As Stephen Rothwell reported:
"After merging the staging tree, today's linux-next build (x86_64
allmodconfig) failed like this:
drivers/staging/erofs/super.c: In function 'erofs_read_super':
drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
sb->s_flags |= MS_RDONLY | MS_NOATIME;
^~~~~~~~~
IS_RDONLY
drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is reported only once for each function it appears in
drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first use in this function); did you mean 'S_NOATIME'?
sb->s_flags |= MS_RDONLY | MS_NOATIME;
^~~~~~~~~~
S_NOATIME
drivers/staging/erofs/super.c: In function 'erofs_mount':
drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
&priv, erofs_fill_super);
^~~~~~~~~~~~~~~~
In file included from include/linux/buffer_head.h:12:0,
from drivers/staging/erofs/super.c:14:
include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' but argument is of type 'int (*)(struct super_block *, void *, int)'
extern struct dentry *mount_bdev(struct file_system_type *fs_type,
^~~~~~~~~~
drivers/staging/erofs/super.c:500:9: error: too few arguments to function 'mount_bdev'
return mount_bdev(fs_type, flags, dev_name,
^~~~~~~~~~
In file included from include/linux/buffer_head.h:12:0,
from drivers/staging/erofs/super.c:14:
include/linux/fs.h:2151:23: note: declared here
extern struct dentry *mount_bdev(struct file_system_type *fs_type,
^~~~~~~~~~
drivers/staging/erofs/super.c: At top level:
drivers/staging/erofs/super.c:518:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.mount = erofs_mount,
^~~~~~~~~~~
drivers/staging/erofs/super.c:518:20: note: (near initialization for 'erofs_fs_type.mount')
drivers/staging/erofs/super.c: In function 'erofs_remount':
drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first use in this function); did you mean 'IS_RDONLY'?
*flags |= MS_RDONLY;
^~~~~~~~~
IS_RDONLY
drivers/staging/erofs/super.c: At top level:
drivers/staging/erofs/super.c:640:16: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.remount_fs = erofs_remount,
^~~~~~~~~~~~~
Caused by various commits creating erofs in the staging tree interacting
with various commits redoing the mount infrastructure in the vfs tree.
I have disabed CONFIG_EROFS_FS for now:"
The reason of compiling error is:
Since -next collects and merges developing patches including common vfs
stuff from multi-trees, but those patches didn't cover erofs, such as:
('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next&id=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3
("vfs: Require specification of size of mount data for internal mounts")
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next&id=0a191e4505a4f255e6513b49426213da69bf0e80
Above vfs related patches has not been merged in staging tree, if we
submit those erofs patches to staging mailing list and after including
them in staging-{test,nexts} tree, it can easily cause compiling error.
We worked out some patches to adjust those vfs change, but now we just
submit them to -next tree temporarily to avoid compiling error.
For potentail conflict in between erofs and vfs changes in incoming
merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
temporarily to pass merge window, and after that we can do restore by
reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
Greg confirmed this solution.
So, let's disable compiling erofs for a while.
Suggested-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Gao Xiang <gaoxiang25@huawei.com>
Reviewed-by: Gao Xiang <gaoxiang25@huawei.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Set default value of allow_power_save parameter to enable power save
mode, which is expected to be the state usually desired.
Signed-off-by: Marty Faltesek <mfaltesek@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Apex doesn't implement different types of resets based on the reset type
param passed through the gasket layer or from userspace via the
gasket_reset ioctl. The reset type is dropped from the gasket framework
in a previous patch due to a lack of present need and non-conforming use
of this parameter by the framework. Drop the parameter from the apex
driver as well.
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The "type of reset" parameter to the gasket device reset APIs isn't
required by the only gasket device submitted upstream, apex.
The framework documents the param as private to the device driver and a
pass-through at the gasket layer, but the gasket core calls the device
driver with a hardcoded reset type of zero, which is not documented as
having a predefined meaning.
In light of all this, remove the reset type parameter from the
framework. Remove the reset ioctl reset type parameter, and bump the
framework version number to reflect the interface change.
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A number of block comments have been changed to comply with the coding
standard. These are coding style changes which should have no impact
on runtime code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The macro IsACValid is renamed to resolve the checkpatch issue with
CamelCase naming. In addition the parameter has parenthesis added to
clear the checkpatch issue with precedence issues.
These changes are coding style changes and as such should have not
impact on runtime code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The macro UP2AC is commented out of the header file so the macro and its
associated comment are removed.
This is a coding style change which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename the structure octet_string's member variables Octet to octet and
Length to length. This change clears the checkpatch issue with CamelCase
naming of variables.
This is purely a coding style change which should have no impact on
runtime code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename the structure OCTET_STRING to octet_string. This is to comply
with the coding style of using lowercase for types. In addition the
typedef directive is removed to clear the checkpatch issue with
defining new types.
These are coding style changes which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Move the union QOS_TCLAS from the header file rtl819x_Qos.h to header
file rtl819x_TS.h, where the structure is actually used, as the member
of another structure.
This is a coding style change, which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A number of structures have been commented out of code. Obviously they
are not used and as a result have been removed from the code.
This is a coding style change which should have no impact on runtime
code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The member variables of the tspec_body have been renamed to clear the
checkpatch issue with CamelCase naming. As these member variables are
never used in the code the changes are combined into this single
patch.
These changes are coding style changes which should have no impact on
runtime code execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Rename TSInfo, the memeber variable of struct tspec_body to ts_info.
This change clears the checkpatch issue with CamelCase naming.
This is a coding style change which should not impact runtime code
execution.
Signed-off-by: John Whitmore <johnfwhitmore@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>