For now this just wraps accessing struct counter_device::priv. However
this is about to change and converting drivers to this helper
individually makes fixing device lifetime issues result in easier to
review patches.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211230150300.72196-5-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The driver doesn't ever use platform_get_drvdata, so drop this unused
call.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211230150300.72196-4-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The driver doesn't ever use platform_get_drvdata, so drop this unused
call.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211230150300.72196-3-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The counter core uses drvdata to find a struct counter_device from a
struct device. However as the device is a member of struct counter_device,
the lookup can be done faster (and a bit type safe) using container_of.
There are no other users of drvdata, so the call to dev_set_drvdata can
go away, too.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211230150300.72196-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A bug exists if the user executes a COUNTER_ADD_WATCH_IOCTL ioctl call,
and then executes a COUNTER_DISABLE_EVENTS_IOCTL ioctl call. Disabling
the events should disable the 104-QUAD-8 interrupts, but because of this
bug the interrupts are not disabling.
The reason this bug is occurring is because quad8_events_configure() is
called when COUNTER_DISABLE_EVENTS_IOCTL is handled, but the
next_irq_trigger[] array has not been cleared before it is checked in
the loop.
This patch fixes the bug by removing the next_irq_trigger array and
instead utilizing a different algorithm of walking the events_list list
for the current requested events. When a COUNTER_DISABLE_EVENTS_IOCTL is
handled, events_list will be empty and thus all device channels end up
with interrupts disabled.
Fixes: 7aa2ba0df6 ("counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8")
Cc: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/5fd5731cec1c251acee30eefb7c19160d03c9d39.1640072891.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Using counter->priv is a memory read and so more expensive than
container_of which is only an addition. (In this case even a noop
because the offset is 0.)
So container_of is expected to be a tad faster, it's type-safe, and
produces smaller code (ARCH=arm allmodconfig):
$ source/scripts/bloat-o-meter drivers/counter/ti-eqep.o-pre drivers/counter/ti-eqep.o
add/remove: 0/0 grow/shrink: 0/9 up/down: 0/-108 (-108)
Function old new delta
ti_eqep_position_enable_write 132 120 -12
ti_eqep_position_enable_read 260 248 -12
ti_eqep_position_ceiling_write 132 120 -12
ti_eqep_position_ceiling_read 236 224 -12
ti_eqep_function_write 220 208 -12
ti_eqep_function_read 372 360 -12
ti_eqep_count_write 312 300 -12
ti_eqep_count_read 236 224 -12
ti_eqep_action_read 664 652 -12
Total: Before=4598, After=4490, chg -2.35%
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/4bde7cbd9e43a5909208102094444219d3154466.1640072891.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A race condition is possible when writing to events_queue_size where the
events kfifo is freed during the execution of a kfifo_in(), resulting in
a use-after-free. This patch prevents such a scenario by protecting the
events queue in operation with a spinlock and locking before performing
the events queue size adjustment.
The existing events_lock mutex is renamed to events_out_lock to reflect
that it only protects events queue out operations. Because the events
queue in operations can occur in an interrupt context, a new
events_in_lock spinlock is introduced and utilized.
Fixes: feff17a550 ("counter: Implement events_queue_size sysfs attribute")
Cc: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20211021103540.955639-1-vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
With the removal of the chrdev_lock atomic flag, the counter-sysfs.c and
counter-chrdev.c no longer needs to include the atomic.h header file.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20211021103514.955622-1-vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This removes the chrdev_lock from the counter subsystem. This was
intended to prevent opening the chrdev more than once. However, this
doesn't work in practice since userspace can duplicate file descriptors
and pass file descriptors to other processes. Since this protection
can't be relied on, it is best to just remove it.
Suggested-by: Greg KH <gregkh@linuxfoundation.org>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/20211017185521.3468640-1-david@lechnology.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
In the counter subsystem, we are already using sysfs_emit(), but there
were a few places where we were still using sprintf() in *_show()
functions. For consistency and added protections, use sysfs_emit()
everywhere.
Suggested-by: Greg KH <gregkh@linuxfoundation.org>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/20211017190106.3472645-1-david@lechnology.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Deals with
W=1 warning This comment starts with '/**', but isn't a kernel-doc comment.
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210930170347.101153-1-jic23@kernel.org
The LSI/CSI LS7266R1 chip provides programmable output via the FLG pins.
When interrupts are enabled on the ACCES 104-QUAD-8, they occur whenever
FLG1 is active. Four functions are available for the FLG1 signal: Carry,
Compare, Carry-Borrow, and Index.
Carry:
Interrupt generated on active low Carry signal. Carry
signal toggles every time the respective channel's
counter overflows.
Compare:
Interrupt generated on active low Compare signal.
Compare signal toggles every time respective channel's
preset register is equal to the respective channel's
counter.
Carry-Borrow:
Interrupt generated on active low Carry signal and
active low Borrow signal. Carry signal toggles every
time the respective channel's counter overflows. Borrow
signal toggles every time the respective channel's
counter underflows.
Index:
Interrupt generated on active high Index signal.
These four functions correspond respectivefly to the following four
Counter event types: COUNTER_EVENT_OVERFLOW, COUNTER_EVENT_THRESHOLD,
COUNTER_EVENT_OVERFLOW_UNDERFLOW, and COUNTER_EVENT_INDEX. Interrupts
push Counter events to event channel X, where 'X' is the respective
channel whose FLG1 activated.
This patch adds IRQ support for the ACCES 104-QUAD-8. The interrupt line
numbers for the devices may be configured via the irq array module
parameter.
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/e3a28e100840e3a336fa93fce77445f0e9d9a674.1632884256.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch replaces the mutex I/O lock with a spinlock. This is in
preparation for a subsequent patch adding IRQ support for 104-QUAD-8
devices; we can't sleep in an interrupt context, so we'll need to use a
spinlock instead.
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/3f74491dec66de10d062978bcb7b9c2b3bdea86c.1632884256.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The events_queue_size sysfs attribute provides a way for users to
dynamically configure the Counter events queue size for the Counter
character device interface. The size is in number of struct
counter_event data structures. The number of elements will be rounded-up
to a power of 2 due to a requirement of the kfifo_alloc function called
during reallocation of the queue.
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/c914b2db2ea0a2637633bcc3e86ded3c94783f2e.1632884256.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Generic Counter chrdev interface expects users to supply component
IDs in order to select extensions for requests. In order for users to
know what component ID belongs to which extension this information must
be exposed. The *_component_id attribute provides a way for users to
discover what component ID belongs to which respective extension.
Cc: David Lechner <david@lechnology.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/8961a11edbb882fc689e468194f5be75f572443e.1632884256.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Generic Counter chrdev interface expects users to supply component
IDs in order to select Synapses for requests. In order for users to know
what component ID belongs to which Synapse this information must be
exposed. The signalZ_action_component_id attribute provides a way for
users to discover what component ID belongs to the respective Synapse.
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/a6c81b2f1f5d0b8d59b1ebe4f0fed04914b07547.1632884256.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch introduces a character device interface for the Counter
subsystem. Device data is exposed through standard character device read
operations. Device data is gathered when a Counter event is pushed by
the respective Counter device driver. Configuration is handled via ioctl
operations on the respective Counter character device node.
Cc: David Lechner <david@lechnology.com>
Cc: Gwendal Grignou <gwendal@chromium.org>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/b8b8c64b4065aedff43699ad1f0e2f8d1419c15b.1632884256.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The Counter subsystem architecture and driver implementations have
changed in order to handle Counter sysfs interactions in a more
consistent way. This patch updates the Generic Counter interface
header file comments to reflect the changes.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/19da8ae0c05381b0967c8a334b67f86b814eb880.1630031207.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This is a reimplementation of the Generic Counter driver interface.
There are no modifications to the Counter subsystem userspace interface,
so existing userspace applications should continue to run seamlessly.
The purpose of this patch is to internalize the sysfs interface code
among the various counter drivers into a shared module. Counter drivers
pass and take data natively (i.e. u8, u64, etc.) and the shared counter
module handles the translation between the sysfs interface and the
device drivers. This guarantees a standard userspace interface for all
counter drivers, and helps generalize the Generic Counter driver ABI in
order to support the Generic Counter chrdev interface (introduced in a
subsequent patch) without significant changes to the existing counter
drivers.
Note, Counter device registration is the same as before: drivers
populate a struct counter_device with components and callbacks, then
pass the structure to the devm_counter_register function. However,
what's different now is how the Counter subsystem code handles this
registration internally.
Whereas before callbacks would interact directly with sysfs data, this
interaction is now abstracted and instead callbacks interact with native
C data types. The counter_comp structure forms the basis for Counter
extensions.
The counter-sysfs.c file contains the code to parse through the
counter_device structure and register the requested components and
extensions. Attributes are created and populated based on type, with
respective translation functions to handle the mapping between sysfs and
the counter driver callbacks.
The translation performed for each attribute is straightforward: the
attribute type and data is parsed from the counter_attribute structure,
the respective counter driver read/write callback is called, and sysfs
I/O is handled before or after the driver read/write function is called.
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: David Lechner <david@lechnology.com>
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> # for stm32
Link: https://lore.kernel.org/r/c68b4a1ffb195c1a2f65e8dd5ad7b7c14e79c6ef.1630031207.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The STM32 timer permits configuration of the counter encoder mode via
the slave mode control register (SMCR) slave mode selection (SMS) bits.
This patch provides preprocessor defines for the supported encoder
modes.
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/ad3d9cd7af580d586316d368f74964cbc394f981.1630031207.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The STM32 low-power timer permits configuration of the clock polarity
via the LPTIMX_CFGR register CKPOL bits. This patch provides
preprocessor defines for the supported clock polarities.
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/a111c8905c467805ca530728f88189b59430f27e.1630031207.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The phrase "Counter Count function" is verbose and unintentionally
implies that function is a Count extension. This patch adjusts the
Counter subsystem code to use the more direct "Counter function" phrase
to make the intent of this code clearer.
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: David Lechner <david@lechnology.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/8268c54d6f42075a19bb08151a37831e22652499.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signal values will always be levels so let's be explicit it about it to
make the intent of the code clear.
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/3f17010abe2415859cea9a5fddabd3c97f635ff5.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
ERANGE is a semantically better error code to return when an argument
value falls outside the supported limit range of a device.
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: David Lechner <david@lechnology.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/ae8d3b20b8b02c96b1c9898ffa2f9fa5d99edc81.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Only a select set of modes (function, action, etc.) are valid for a
given device configuration. This patch ensures that invalid modes result
in a return -EINVAL. Such a situation should never occur in reality, but
it's good to define a default switch case for the sake of making the
intent of the code clear.
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Acked-by: David Lechner <david@lechnology.com>
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/7af82d4e39610da11edce0ee370285fe1cb1eac8.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The 104-QUAD-8 only has two count modes where a ceiling value makes
sense: Range Limit and Modulo-N. Outside of these two modes, setting a
ceiling value is an invalid operation -- so let's report it as such by
returning -EINVAL.
Fixes: fc06926226 ("counter: 104-quad-8: Add lock guards - generic interface")
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/a2147f022829b66839a1db5530a7fada47856847.1627990337.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
0-DAY CI Kernel Test Service reported following iwyu warning:
drivers/counter/intel-qep.c:11:1: iwyu: warning: superfluous #include <linux/bitops.h>
Remove that include since we don't seem to use anything from it.
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210629111657.2655688-1-jarkko.nikula@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch renames
interrupt_cnt_synapse_actionss to interrupt_cnt_synapse_actions and adds
a const qualifier to match actions_list.
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20210610013642.149961-1-vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Use to_pci_dev() helper instead of container_of(d, struct pci_dev, dev);
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210611115558.796338-2-jarkko.nikula@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Remove CONFIG_PM ifdef and mark PM callbacks with __maybe_unused.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210611115558.796338-1-jarkko.nikula@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch adds the const qualifier to the
stm32_synapse_actions to match actions_list.
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/9675edda958ee2ca371d271f46445d3e1934ba82.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch adds the const qualifier to the
stm32_lptim_cnt_synapse_actions to match actions_list.
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/785e0daa3633923ede42394f423fcf94c4469154.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch adds the const qualifier to the
mchp_tc_synapse_actions to match actions_list.
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/165f9682ce308a60a477aaa56fdae7bc949dc218.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch adds the const qualifier to the
ftm_quaddec_synapse_actions to match actions_list.
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/db1df2021efb1b98e6d1a50787be5a52a1896574.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_synapse actions_list member expects a const enum
counter_synapse_action array. This patch adds the const qualifier to the
quad8_index_actions_list and quad8_synapse_actions_list to match
actions_list.
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/776ba3ad0a3c609d3600cffe0ed6446baf29fee9.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_count functions_list member expects a const enum
counter_count_function array. This patch adds the const qualifier to the
stm32_count_functions to match functions_list.
Cc: Benjamin Gaignard <benjamin.gaignard@st.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/46a1e7096dd9280d8f241894186b3c903956a55f.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_count functions_list member expects a const enum
counter_count_function array. This patch adds the const qualifier to the
stm32_lptim_cnt_functions to match functions_list.
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/08830119594acdb3bc9d36ae2e65b2eb26589ade.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_count functions_list member expects a const enum
counter_count_function array. This patch adds the const qualifier to the
mchp_tc_count_functions to match functions_list.
Cc: Kamel Bouhara <kamel.bouhara@bootlin.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/74cb91ab7b459563762ec28633cd8808093aa2ad.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_count functions_list member expects a const enum
counter_count_function array. This patch adds the const qualifier to the
interrupt__cnt_functions to match functions_list.
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/86f7fb77f703cf2508a6b4ee9cf80aa523392976.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The struct counter_count functions_list member expects a const enum
counter_count_function array. This patch adds the const qualifier to the
quad8_count_functions_list to match functions_list.
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/6847da7553208e7f2554e6c7688e2021f7e19716.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
When the kernel is running in secure boot mode, we lock down the kernel to
prevent userspace from modifying the running kernel image. Whilst this
includes prohibiting access to things like /dev/mem, it must also prevent
access by means of configuring driver modules in such a way as to cause a
device to access or modify the kernel image.
To this end, annotate module_param* statements that refer to hardware
configuration and indicate for future reference what type of parameter they
specify. The parameter parser in the core sees this information and can
skip such parameters with an error message if the kernel is locked down.
The module initialisation then runs as normal, but just sees whatever the
default values for those parameters is.
Note that we do still need to do the module initialisation because some
drivers have viable defaults set in case parameters aren't specified and
some drivers support automatic configuration (e.g. PNP or PCI) in addition
to manually coded parameters.
This patch annotates the 104-QUAD-8 driver.
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/97ce79878a26809f0b15b2eac9a86ca39e0ecd74.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add support for Intel Quadrature Encoder Peripheral found on Intel
Elkhart Lake platform.
Initial implementation was done by Felipe Balbi while he was working at
Intel with later changes from Raymond Tan and me.
Co-developed-by: Felipe Balbi (Intel) <balbi@kernel.org>
Signed-off-by: Felipe Balbi (Intel) <balbi@kernel.org>
Co-developed-by: Raymond Tan <raymond.tan@intel.com>
Signed-off-by: Raymond Tan <raymond.tan@intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210602113259.158674-1-jarkko.nikula@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Big set in here from Alexandru Ardelean enabling multiple buffer support.
This includes providing a new directory per buffer that combines
what was previously in buffer/ and scan_elements/. Old interfaces still
in place for compatiblity.
Note immuatable branch for scmi patches to allow for some significant
rework going on in that subsystem. Merge required updating to reflect
some changes in IIO.
Late rebase to fix some wrong fixes tags due to some earlier rebases
made necessary by messing up the immutable branch.
IIO New Device Support
* adi,ad5686
- Add info to support AD5673R and AD5677R
* bosch,bmi088
- New driver supporting this accelerometer + gyroscope
* cros_ec_mkbp
- New driver for this proximity sensor that exposes a 'front'
sensor. Very simple switch like device, but driver allows it
to share interface with more sophisticated proximity sensors.
* iio_scmi
- New driver to support ARM SCMI protocol to expose underlying
accelerometers and gyroscopes via this firmware interface.
* st,st_magn
- Add ID for IISMDC magnetometer.
* ti,ads131e0
- New driver supporting ads131e04, ads131e06 and ads131e08 24 bit ADCs
Counter New Device Support
* IRQ or GPIO based counter
- New driver for a conceptually simple counter that uses interrupts
to perform the count.
Features
* core
- Dual buffer supprt including:
Various helpers to centralize handling of bufferer related elements.
Document existing and new IOCTLs
Register the IIO chrdev only if it can actually be used for anything.
Rework attribute group creation in the core (lots of patches)
Merge buffer/ and scan_elements/ entries into one list + maintain
backwards compatible set.
Introduce the internal logic and IOCTL to allow multiple buffers
+ access to an anon FD per buffer to actually read from it.
Tidy up tools/iio/iio_generic_buffer and switch to new interfaces.
Update ABI docs.
A few follow up fixes, unsuprising as this was a huge bit of rework.
- Move common case setting of trig->parent to the core.
- Provide an iio_read_channel_processed_scale() to avoid loss of
precision from iio_read_channel_processed() then applying integer
scale. Use it in ntc_thermistor driver in hwmon.
- Allow drivers to specify labels from elsewhere than DT. Use it for
bmc150 and kxcjk-1013 labels related to position on 2 in one tablets.
- Document label usage for proximity and accelerometer sensors.
- Some local variable renames for consistency
tools
- Add -a parameter to iio_event_monitor to allow autoenabling of events.
* acpi_als
- Add trigger support for devices that don't support notification method.
* adi,ad7124
- Allow more than 8 channels. This is a complex little device, but is
capable of supporting up to 16 channels if the share certain
configuration settings.
* hrtimer-trigger
- Support sampling frequency below 1Hz.
* mediatek,mt8195-auxadc
- Add compatible to binding docs (always also includes mt8173)
* st,stm32-adc
- Enable timetamps when not using DMA.
* vishay,vcnl3020
- Sampling frequency control.
Cleanup and minor fixes:
* treewide
- Use some getter and setter functions instead of opencoding.
- Set of fixes for pointless casts in various drivers.
- Avoid wrong kernel-doc marking on comment blocks.
- Fix various other minor kernel-doc issues shown by W=1
* core
- Use a signed temporary for IIO_VAL_FRACTIONAL_LOG2 to avoid odd casts.
- Fix IIO_VAL_FRACTIONAL_LOG2 for values between -1.0 and 0.0
- Add unit tests for iio_format_value()
* docs
- Fix formatting/typos in iio_configfs.rst and buffers.rst
- Add documentation of index in buffers.rst
- Fix scan element description
- Avoid some issues with HTML generation from ABI docs by moving
duplicated defintions to more generic files.
- Drop reference to long dead mailing list.
* 104-quad
- Remove left over deprecated IIO counter ABI.
* adi,adi-axi-adc
- Fix wrong bit of docs.
* adi,ad5791
- Typos
* adi,ad9834
- Switch to device managed functions in probe.
* adi,adis*
- Add and use helpers for locking to reduced duplication.
* adi,adis16480
- Fix calculation of sampling frequency when using pulse per second input.
* adi,adis16475
- Calculate the IMU scaled internal sampling rate and runtime depending
on sysfs based configuration rather than getting from DT. Drop now
unnecessary property from DT bindings doc.
* cros_ec
- Fix result of a series of recent changes that means extended buffer
attributes turn up in the wrong place. Too complex to revert the
various patches unfortunately so this is a bit messy.
* fsl,mma3452
- Indentation cleanup.
* hid-sensors
- Size of storage needs to increase for some parts when using quaternions.
- Move the get sensistivity attribute to hid-sensors-common to reduce
duplication. Enable it for more device types.
- Correctly handle relative sensitivity if reported that way including
documenting the new ABI.
* maxim,max517
- Use device managed functions in probe.
* mediatek,mt6360-adc
- Use asm/unaligned.h instead of directly including
unaligned/be_byteshift.h
* novuton,npcm-adc
- Local lock instead of missusing mlock.
* semtech,sx9500
- Typos
* st,sensor
- typo fix
* st,spear-adc
- Local lock instead of missusing mlock.
* st,stm32-adc
- Long standing HAS_IOMEM dependency fix.
* st,stm32-counter
- Remove left over deprecated IIO counter ABI.
* ti,palmas-adc
- Local lock instead of missusing mlock.
* ti,tmp007
- Switch to device managed functions in probe.
Other
* MAINTAINERS
- Move Peter Meerwald-Stadler to Credits at his request
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAmBdtl4RHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FogEhxAAuTWrEwun8rE5fQkQIlEkKYwZqEgUln4Q
tLKhrqeyfGcY/A1aX/HTpnn0TOtaOkUqRzLWsAW0thZih1u7yEL6Vc55KKh5WGL7
CvcvLWAkorsTjbtusgrBgFmjuoAMjW892Q+bbh1CJ/0qlezhFE9jrmJfmH2klI/p
nIoJsdyCE98+4oIdcOCxwJe7nTDDHP8BCF7WnKtHCLtn3T9Dzttises3T6HfKxlg
cdu3cy2N+pQpakYpv96tvjBGI9Ho3FX8R+dILUxJpVwCcLUjf8b1CFcgboJwxou2
tgPNwWToxd9OTYJa7EOsDaFPZD46NRProkUBGKgA58XPkhqSvLcSdvGokFPgKnPW
NorymGaUOC2qolH91nuFaWrd6c6hIf5NeWtGDo1GHJdcSgu21C0OdaU3K72EGhsB
YLnl0Wp8Bthwn7KS0Ck4TqUPN3D3Q9NCEz7sAUzqc3QBzm4U+dXVzCwRehI7hPdw
YlORAzbV1o7Z0skhAAth+NAYUUB6GywGZLaUi5oXWoJSYhNvI1K1uiHVVStVINWl
L7uor5FXTr4/czjrutWQbw7GQ0cfCODH6B1cbS9vNaDQ6wO9XGSaWgc3mK9Lgsqc
Y1ekYvXNSxKJw42FWvr4ylkeF7BV6h0oBFB4DLlZppYi1pKZb8oPsED8UpBrFnG1
uPqjNX9Tsqw=
=jeRJ
-----END PGP SIGNATURE-----
Merge tag 'iio-for-5.13a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
1st set of IIO/counter device support, features and cleanup in the 5.13 cycle
Big set in here from Alexandru Ardelean enabling multiple buffer support.
This includes providing a new directory per buffer that combines
what was previously in buffer/ and scan_elements/. Old interfaces still
in place for compatiblity.
Note immuatable branch for scmi patches to allow for some significant
rework going on in that subsystem. Merge required updating to reflect
some changes in IIO.
Late rebase to fix some wrong fixes tags due to some earlier rebases
made necessary by messing up the immutable branch.
IIO New Device Support
* adi,ad5686
- Add info to support AD5673R and AD5677R
* bosch,bmi088
- New driver supporting this accelerometer + gyroscope
* cros_ec_mkbp
- New driver for this proximity sensor that exposes a 'front'
sensor. Very simple switch like device, but driver allows it
to share interface with more sophisticated proximity sensors.
* iio_scmi
- New driver to support ARM SCMI protocol to expose underlying
accelerometers and gyroscopes via this firmware interface.
* st,st_magn
- Add ID for IISMDC magnetometer.
* ti,ads131e0
- New driver supporting ads131e04, ads131e06 and ads131e08 24 bit ADCs
Counter New Device Support
* IRQ or GPIO based counter
- New driver for a conceptually simple counter that uses interrupts
to perform the count.
Features
* core
- Dual buffer supprt including:
Various helpers to centralize handling of bufferer related elements.
Document existing and new IOCTLs
Register the IIO chrdev only if it can actually be used for anything.
Rework attribute group creation in the core (lots of patches)
Merge buffer/ and scan_elements/ entries into one list + maintain
backwards compatible set.
Introduce the internal logic and IOCTL to allow multiple buffers
+ access to an anon FD per buffer to actually read from it.
Tidy up tools/iio/iio_generic_buffer and switch to new interfaces.
Update ABI docs.
A few follow up fixes, unsuprising as this was a huge bit of rework.
- Move common case setting of trig->parent to the core.
- Provide an iio_read_channel_processed_scale() to avoid loss of
precision from iio_read_channel_processed() then applying integer
scale. Use it in ntc_thermistor driver in hwmon.
- Allow drivers to specify labels from elsewhere than DT. Use it for
bmc150 and kxcjk-1013 labels related to position on 2 in one tablets.
- Document label usage for proximity and accelerometer sensors.
- Some local variable renames for consistency
tools
- Add -a parameter to iio_event_monitor to allow autoenabling of events.
* acpi_als
- Add trigger support for devices that don't support notification method.
* adi,ad7124
- Allow more than 8 channels. This is a complex little device, but is
capable of supporting up to 16 channels if the share certain
configuration settings.
* hrtimer-trigger
- Support sampling frequency below 1Hz.
* mediatek,mt8195-auxadc
- Add compatible to binding docs (always also includes mt8173)
* st,stm32-adc
- Enable timetamps when not using DMA.
* vishay,vcnl3020
- Sampling frequency control.
Cleanup and minor fixes:
* treewide
- Use some getter and setter functions instead of opencoding.
- Set of fixes for pointless casts in various drivers.
- Avoid wrong kernel-doc marking on comment blocks.
- Fix various other minor kernel-doc issues shown by W=1
* core
- Use a signed temporary for IIO_VAL_FRACTIONAL_LOG2 to avoid odd casts.
- Fix IIO_VAL_FRACTIONAL_LOG2 for values between -1.0 and 0.0
- Add unit tests for iio_format_value()
* docs
- Fix formatting/typos in iio_configfs.rst and buffers.rst
- Add documentation of index in buffers.rst
- Fix scan element description
- Avoid some issues with HTML generation from ABI docs by moving
duplicated defintions to more generic files.
- Drop reference to long dead mailing list.
* 104-quad
- Remove left over deprecated IIO counter ABI.
* adi,adi-axi-adc
- Fix wrong bit of docs.
* adi,ad5791
- Typos
* adi,ad9834
- Switch to device managed functions in probe.
* adi,adis*
- Add and use helpers for locking to reduced duplication.
* adi,adis16480
- Fix calculation of sampling frequency when using pulse per second input.
* adi,adis16475
- Calculate the IMU scaled internal sampling rate and runtime depending
on sysfs based configuration rather than getting from DT. Drop now
unnecessary property from DT bindings doc.
* cros_ec
- Fix result of a series of recent changes that means extended buffer
attributes turn up in the wrong place. Too complex to revert the
various patches unfortunately so this is a bit messy.
* fsl,mma3452
- Indentation cleanup.
* hid-sensors
- Size of storage needs to increase for some parts when using quaternions.
- Move the get sensistivity attribute to hid-sensors-common to reduce
duplication. Enable it for more device types.
- Correctly handle relative sensitivity if reported that way including
documenting the new ABI.
* maxim,max517
- Use device managed functions in probe.
* mediatek,mt6360-adc
- Use asm/unaligned.h instead of directly including
unaligned/be_byteshift.h
* novuton,npcm-adc
- Local lock instead of missusing mlock.
* semtech,sx9500
- Typos
* st,sensor
- typo fix
* st,spear-adc
- Local lock instead of missusing mlock.
* st,stm32-adc
- Long standing HAS_IOMEM dependency fix.
* st,stm32-counter
- Remove left over deprecated IIO counter ABI.
* ti,palmas-adc
- Local lock instead of missusing mlock.
* ti,tmp007
- Switch to device managed functions in probe.
Other
* MAINTAINERS
- Move Peter Meerwald-Stadler to Credits at his request
* tag 'iio-for-5.13a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (119 commits)
iio: acpi_als: Add trigger support
iio: acpi_als: Add local variable dev in probe
iio: acpi_als: Add timestamp channel
iio: adc: ad7292: Modify the bool initialization assignment
iio: cros: unify hw fifo attributes without API changes
iio: kfifo: add devm_iio_triggered_buffer_setup_ext variant
iio: event_monitor: Enable events before monitoring
dt-bindings: iio: adc: Add compatible for Mediatek MT8195
iio:magnetometer: Add Support for ST IIS2MDC
dt-bindings: iio: st,st-sensors add IIS2MDC.
staging: iio: ad9832: kernel-doc fixes
iio:dac:max517.c: Use devm_iio_device_register()
iio:cros_ec_sensors: Fix a wrong function name in kernel doc.
iio: buffer: kfifo_buf: kernel-doc, typo in function name.
iio: accel: sca3000: kernel-doc fixes. Missing - and wrong function names.
iio: adc: adi-axi-adc: Drop false marking for kernel-doc
iio: adc: cpcap-adc: kernel-doc fix - that should be _ in structure name
iio: dac: ad5504: fix wrong part number in kernel-doc structure name.
iio: dac: ad5770r: kernel-doc fix case of letter R wrong in structure name
iio: adc: ti-adc084s021: kernel-doc fixes, missing function names
...
Add simple IRQ or GPIO base counter. This device is used to measure
rotation speed of some agricultural devices, so no high frequency on the
counter pin is expected.
The maximal measurement frequency depends on the CPU and system load. On
the idle iMX6S I was able to measure up to 20kHz without count drops.
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20210301080401.22190-3-o.rempel@pengutronix.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Currently, the STM32 LP Timer counter driver registers into both IIO and
counter subsystems, which is redundant.
Remove the IIO counter ABI and IIO registration from the STM32 LP Timer
counter driver since it's been superseded by the Counter subsystem
as discussed in [1].
Keep only the counter subsystem related part.
Move a part of the ABI documentation into a driver comment.
This also removes a duplicate ABI warning
$ scripts/get_abi.pl validate
...
/sys/bus/iio/devices/iio:deviceX/in_count0_preset is defined 2 times:
./Documentation/ABI/testing/sysfs-bus-iio-timer-stm32:100
./Documentation/ABI/testing/sysfs-bus-iio-lptimer-stm32:0
[1] https://lkml.org/lkml/2021/1/19/347
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/1611926542-2490-1-git-send-email-fabrice.gasnier@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Ceiling value may be miss-aligned with what's actually configured into the
ARR register. This is seen after probe as currently the ARR value is zero,
whereas ceiling value is set to the maximum. So:
- reading ceiling reports zero
- in case the counter gets enabled without any prior configuration,
it won't count.
- in case the function gets set by the user 1st, (priv->ceiling) is used.
Fix it by getting rid of the cached "priv->ceiling" variable. Rather use
the ARR register value directly by using regmap read or write when needed.
There should be no drawback on performance as priv->ceiling isn't used in
performance critical path.
There's also no point in writing ARR while setting function (sms), so
it can be safely removed.
Fixes: ad29937e20 ("counter: Add STM32 Timer quadrature encoder")
Suggested-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1614793789-10346-1-git-send-email-fabrice.gasnier@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ceiling value isn't checked before writing it into registers. The user
could write a value higher than the counter resolution (e.g. 16 or 32 bits
indicated by max_arr). This makes most significant bits to be truncated.
Fix it by checking the max_arr to report a range error [1] to the user.
[1] https://lkml.org/lkml/2021/2/12/358
Fixes: ad29937e20 ("counter: Add STM32 Timer quadrature encoder")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/1614696235-24088-1-git-send-email-fabrice.gasnier@foss.st.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
When in SLAVE_MODE_DISABLED mode, the count still increases if the
counter is enabled because an internal clock is used. This patch fixes
the stm32_count_function_get() and stm32_count_function_set() functions
to properly handle this behavior.
Fixes: ad29937e20 ("counter: Add STM32 Timer quadrature encoder")
Cc: Fabrice Gasnier <fabrice.gasnier@st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20210226012931.161429-1-vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The hardware doesn't support this. QPOSINIT is an initialization value
that is triggered by other things. When the counter overflows, it
always wraps around to zero.
Fixes: f213729f67 "counter: new TI eQEP driver"
Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20201214000927.1793062-1-david@lechnology.com
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ATMEL_TC_ETRGEDG_* defines are not masks but rather possible values
for CMR. This patch fixes the action_get() callback to properly check
for these values rather than mask them.
Fixes: 106b104137 ("counter: Add microchip TCB capture counter")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
Cc: <Stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201114232805.253108-1-vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The values given were the offset of the register after the last
register instead of the actual last register in each range. Fix
by using the correct last register of each range.
Fixes: f213729f67 ("counter: new TI eQEP driver")
Signed-off-by: David Lechner <david@lechnology.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20201025165122.607866-1-david@lechnology.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Replace commas with semicolons. What is done is essentially described by
the following Coccinelle semantic patch (http://coccinelle.lip6.fr/):
// <smpl>
@@ expression e1,e2; @@
e1
-,
+;
e2
... when any
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/1601233948-11629-16-git-send-email-Julia.Lawall@inria.fr
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The only usage of mchp_tc_ops is to assign its address to the ops field
in the counter_device struct which is a const pointer. Make it const to
allow the compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/20200922201941.41328-1-rikard.falkeborn@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This should be testing "regmap" instead of "priv->regmap". The
"priv->regmap" variable is always zero so it's not an error pointer.
Fixes: 106b104137 ("counter: Add microchip TCB capture counter")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This drivers allows to use the capture mode of the Timer Counter Block
hardware block available in Microchip SoCs through the counter subsystem.
Two functions of the counter are supported for the moment: period
capture and quadrature decoder. The latter is only supported by the
SAMA5 series of SoCs.
For the period capture mode a basic setup has been chosen that will
reset the counter each time the period is actually reached. Of course
the device offers much more possibilities.
For quadrature mode, both channel 0 and 1 must be configured even if we
only capture the position (no revolution/rotation).
Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAl8UzA4eHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGQ7cH/3v+Gv+SmHJCvaT2
CSu0+7okVnYbY3UTb3hykk7/aOqb6284KjxR03r0CWFzsEsZVhC5pvvruASSiMQg
Pi04sLqv6CsGLHd1n+pl4AUYEaxq6k4KS3uU3HHSWxrahDDApQoRUx2F8lpOxyj8
RiwnoO60IMPA7IFJqzcZuFqsgdxqiiYvnzT461KX8Mrw6fyMXeR2KAj2NwMX8dZN
At21Sf8+LSoh6q2HnugfiUd/jR10XbfxIIx2lXgIinb15GXgWydEQVrDJ7cUV7ix
Jd0S+dtOtp+lWtFHDoyjjqqsMV7+G8i/rFNZoxSkyZqsUTaKzaR6JD3moSyoYZgG
0+eXO4A=
=9EpR
-----END PGP SIGNATURE-----
Merge 5.8-rc6 into staging-next
We need the staging fixes in here, and it resolves a merge issue with an
iio driver.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add lock protection from race conditions to the 104-quad-8 counter
driver for filter clock prescaler code changes. Mutex calls used for
protection.
Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
Fixes: de65d05563 ("counter: 104-quad-8: Support Filter Clock Prescaler")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add lock protection from race conditions to 104-quad-8 counter driver
for differential encoder status code changes. Mutex lock calls used for
protection.
Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
Fixes: 954ab5cc5f ("counter: 104-quad-8: Support Differential Encoder Cable Status")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This patch applies the semantic patch:
@@
expression I, P, SP;
@@
I = devm_iio_device_alloc(P, SP);
...
- I->dev.parent = P;
It updates 302 files and does 307 deletions.
This semantic patch also removes some comments like
'/* Establish that the iio_dev is a child of the i2c device */'
But this is is only done in case where the block is left empty.
The patch does not seem to cover all cases. It looks like in some cases a
different variable is used in some cases to assign the parent, but it
points to the same reference.
In other cases, the block covered by ... may be just too big to be covered
by the semantic patch.
However, this looks pretty good as well, as it does cover a big bulk of the
drivers that should remove the parent assignment.
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ACCES 104-QUAD-8 series provides status information about the
connection state of the differential encoder cable inputs. This patch
implements support to expose such information from these devices.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The ACCES 104-QUAD-8 series does active filtering on the quadrature
input signals via the PC/104 bus clock (OSC 14.318 MHz). This patch
exposes the filter clock prescaler available on each channel.
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The stm32-timer-cnt driver doesn't use the iio interface. The iio headers
aren't relevant and can be removed as reported by William in [1].
With this change, mod_devicetable.h needs to be added to define the
'of_device_id' struct.
[1] https://lkml.org/lkml/2020/2/10/1516
Reported-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Add suspend/resume PM sleep ops. When going to low power, enforce the
counter isn't active. Gracefully restore its state upon resume in case
it's been left enabled prior to suspend.
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
The count_read and count_write callbacks are simplified to pass val as
unsigned long rather than as an opaque data structure. The opaque
counter_count_read_value and counter_count_write_value structures,
counter_count_value_type enum, and relevant counter_count_read_value_set
and counter_count_write_value_get functions, are removed as they are no
longer used.
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Acked-by: David Lechner <david@lechnology.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Immutable branch being merged in. Created as this also involves
moving some dependencies around, outside of the counter subsystem.
It's possible it will want to be pulled into other trees.
This adds a new counter driver for the Texas Instruments Enhanced
Quadrature Encoder Pulse (eQEP) module.
Only very basic functionality is currently implemented - only enough to
be able to read the position. The actual device has many more features
which can be added to the driver on an as-needed basis.
It is not possible to read the QEPA/B signal values in hardware, so
that feature is omitted.
The TI_PWMSS kernel option is selected in Kconfig to enable the parent
bus, which is needed for power management.
Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
There is an if statement that is indented one level too deeply,
remove the extraneous tabs.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Make use of devm_counter_register.
Then we can remove redundant unregistration API
usage to make code simpler.
Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Here is the big Staging and IIO driver update for 5.3-rc1.
Lots of new IIO drivers are in here, along with loads of tiny staging
driver cleanups and fixes. Overall we almost break even with the same
lines added as removed.
Full details are in the shortlog, they are too large to list here.
All of these changes have been in linux-next for a while with no
reported issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-----BEGIN PGP SIGNATURE-----
iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXSXlWA8cZ3JlZ0Brcm9h
aC5jb20ACgkQMUfUDdst+ym5lgCgwNVvum2lwWzAVPkVEMqpGYLZPLgAoJqegC9o
JsdX6tFoAC8q8+FXWgZ4
=di3h
-----END PGP SIGNATURE-----
Merge tag 'staging-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging and IIO driver updates from Greg KH:
"Here is the big Staging and IIO driver update for 5.3-rc1.
Lots of new IIO drivers are in here, along with loads of tiny staging
driver cleanups and fixes. Overall we almost break even with the same
lines added as removed.
Full details are in the shortlog, they are too large to list here.
All of these changes have been in linux-next for a while with no
reported issues"
* tag 'staging-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (608 commits)
staging: kpc2000: simplify comparison to NULL in fileops.c
staging: kpc2000: simplify comparison to NULL in dma.c
staging: kpc2000: simplify comparison to NULL in kpc2000_spi.c
staging: rtl8723bs: hal: remove redundant assignment to packetType
staging: rtl8723bs: Change return type of hal_btcoex_IsBtDisabled()
staging: rtl8723bs: Remove rtw_btcoex_DisplayBtCoexInfo()
staging: rtl8723bs: Remove function rtw_btcoex_GetDBG()
staging: rtl8723bs: Remove function rtw_btcoex_SetDBG()
staging: rtl8723bs: Remove rtw_btcoex_IsBTCoexCtrlAMPDUSize()
staging: rtl8723bs: Remove rtw_btcoex_BtInfoNotify()
staging: rtl8723bs: Remove rtw_btcoex_ScanNotify()
staging: rtl8723bs: Remove rtw_btcoex_SetSingleAntPath()
staging: rtl8723bs: Remove rtw_btcoex_SetPGAntNum()
staging: rtl8192e: remove redundant initialization of rtstatus
staging: rtl8723bs: Remove rtw_btcoex_GetRaMask()
staging: rtl8723bs: Remove rtw_btcoex_SetChipType()
staging: rtl8723bs: Remove rtw_btcoex_ConnectNotify()
staging: rtl8723bs: Remove rtw_btcoex_SetBTCoexist()
staging: rtl8723bs: Remove rtw_btcoex_IsBtDisabled()
staging: rtl8723bs: Remove rtw_btcoex_IsBtControlLps()
...
A few bits for the counters subsystem mixed in here as well.
There are some late breaking fixes as well, which aren't so urgent
they can't wait for the merge window.
New Device Support
* adf4371
- New driver + bindings.
- Support the adf4372 PLL. Mostly ID and bindings.
* ad8366 (note includes rework of driver needed to allow support for these).
- Support the ADL5240 variable gain amplifier (VGA).
- Support the ADA4961 digital gain amplifier (DGA).
* dps310
- New driver, in several parts from different authors for this temp
and pressure sensor.
- Includes errata workaround for a temperature reading issue.
* stk3310
- Support the stk3335, mostly ID.
Features and cleanups
* core
- drop error handling on debugfs registration.
- harden by making sure we don't overrun iio_chan_info_postfix.
* docs
- convert remaining docs to rst. At somepoint we'll fit these few
into the main IIO docs.
- improve sampling_frequency_available docs but explaining the
range form.
* ad_sigma_delta
- Drop a pointless goto.
* ad2s1210
- Drop pointless platform data null check seeing as we don't actually
use platform data anymore.
* ad7124
- Relax limitation on channel numbers to allow pseudo different channels.
- Support control of whether the input is buffered via DT.
- Use dynamic allocation for channel configuration to make it easier
to support new devices.
- YAML binding conversion.
* ad7150
- Comment tidy up.
- Consistent and simple if (ret) handling of i2c errors.
- FIELD_GET and GENMASK.
- Ternary rather than !!(condition) for readability.
- Use macros to avoid repetition of channel definitions.
* ad7606
- Add software channel config (rather that pin controlled)
- Refactor to simplify addition of new part in future.
* ad7746
- of_deivce_id table.
* ad7780
- MAINTAINERS entry
- YAML DT bindings.
* ad8366
- Stop using core mlock in favour of well scoped local lock.
- SPDX + copyright date update.
* ad9834
- of_device_id table
* adf4371
- Add support for output stage muting before lock on has occured.
* adis library
- MAINTAINERS entry to reflect that this now Alexandru's problem ;)
* adis162xx:
- Fix a slightly incorrect set of comments and print statements on
minimum supported voltage.
* adis16203
- of_device_id table.
* adis16240
- Add of_device_id table (in two parts as first patch only used it for
MODULE_DEVICE_TABLE.)
* adt7316-spi
- of_device_id table
* adxl372
- YAML DT binding conversion.
- Cleanup use of buffer callback functions (precursor to core rework).
* bh1710
- Simplify getting the i2c adapter from the client.
* dht11
- Mote to newer GPIO consumer interface.
* kxcjk-1013.c
- Add binding for sensor in display of some ultrabooks after userspace
tools updated for it not be a problem to report two similar sensors.
* imx7d
- drop unused variables.
- white space
- define instead of variable for clock frequency that is fixed.
- drop pointless error message.
* messon_saradc
- SPDX
* sps30
- MAINTAINERS entry
- YAML binding conversion.
* st_accel
- Tidy up ordering in various buffer related callbacks. This is
part of a long running effort to simplify the core code.
* stm32-dfsdm:
- Manage the resolution cleanly in triggerd modes.
- Add fast mode support which allows more flexible filter choices.
- Add a comment on the reason for a 16 bit record when technically
not 'required'.
* st_lsm6dsx
- Embed device name in the sensor_settings struct as i3c doesn't
have a convenient name field to use for this.
* xilinx-adc
- Relax constraints on supported platforms to reflect that this
can used with FPGAs on PCIe cards and hence many architectures.
* counters/ftm-quaddec
- Fix some formatting io MODULE_AUTHOR
- MAINTAINERS entry
Fixes
* tools
- fix incorrect handling of 32 bit channels.
* sca3000
- Potential endian bug that is unlikely to bite anyone (be64 host
seems unlikely for this old part).
* stm32-adc
- Add vdda-supply. On some boards it needs to be turned on to supply
the ADC. DT bindings included.
* stm32-dfsdm
- Fix output resolution to work with filter orders other than 3.
- Fix output datatype as it's signed and previously claimed not to be.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl0VHIkRHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0FojyxhAAgrLRy2wlHjQCAh0S6J22LKs02uPX1qvY
nm1aI/av2DGcMCV2NF6J1sW2Mocvtt5a79/1f/wRqDzOHBrTpFr0Q0Ngwijv9bzc
fv6NwfHlWolmXynKx8wK4b6Sa3KVCkltojEVpEVbhkuMkafSQ+pQzYF1Uf7enOrX
j3Gq6NYaCks4YtFZsBphgzo3DC0mh7CfunlPiOdVcgcg4Pj/KZY9QCX86fJx972x
YI3BRFHnDSMDOxOTjeqeKvMiqU2zLPlqLSEOCUw2XCrh6HI9qFiU+LVsYx6SP0tx
aJ2q+qYc9raOTANHk7O2JZYWv/52JXvtKcFSLiuQdABjaAI20xEr1QAZYVYUiXmg
dFH6lBsWvQyAy5F/SyZ5tavZvTfGsNDB5LhlpEggeO2W6cIIL4CLfHimB2EcxFSH
utqEA72HQZosEUKut1jbmG6iYMiRnHS72pLOqkJ6HC/2/pZfoEWlEH9x/S3xbBsW
918ISs9852VwjebQwck96+Dh0LwiKOl8Aii5ONzfNObJB6/JbULPoKKArsMdENQA
mqDXLOMz6GspY3JgiVDCXAwg2x2Ht/ictR6svRJtOTLiBU2Iybpm/HRkPePhoePF
HLw8fhwE+mOSWr22KhzjUJBHEAkoejo/14XOgKSTkO9V6amLlOWRDV3uK2PksmdI
7DQyYhX9Tos=
=a3vh
-----END PGP SIGNATURE-----
Merge tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second set of IIO device support, features, cleanups and minor fixes for 5.3.
A few bits for the counters subsystem mixed in here as well.
There are some late breaking fixes as well, which aren't so urgent
they can't wait for the merge window.
New Device Support
* adf4371
- New driver + bindings.
- Support the adf4372 PLL. Mostly ID and bindings.
* ad8366 (note includes rework of driver needed to allow support for these).
- Support the ADL5240 variable gain amplifier (VGA).
- Support the ADA4961 digital gain amplifier (DGA).
* dps310
- New driver, in several parts from different authors for this temp
and pressure sensor.
- Includes errata workaround for a temperature reading issue.
* stk3310
- Support the stk3335, mostly ID.
Features and cleanups
* core
- drop error handling on debugfs registration.
- harden by making sure we don't overrun iio_chan_info_postfix.
* docs
- convert remaining docs to rst. At somepoint we'll fit these few
into the main IIO docs.
- improve sampling_frequency_available docs but explaining the
range form.
* ad_sigma_delta
- Drop a pointless goto.
* ad2s1210
- Drop pointless platform data null check seeing as we don't actually
use platform data anymore.
* ad7124
- Relax limitation on channel numbers to allow pseudo different channels.
- Support control of whether the input is buffered via DT.
- Use dynamic allocation for channel configuration to make it easier
to support new devices.
- YAML binding conversion.
* ad7150
- Comment tidy up.
- Consistent and simple if (ret) handling of i2c errors.
- FIELD_GET and GENMASK.
- Ternary rather than !!(condition) for readability.
- Use macros to avoid repetition of channel definitions.
* ad7606
- Add software channel config (rather that pin controlled)
- Refactor to simplify addition of new part in future.
* ad7746
- of_deivce_id table.
* ad7780
- MAINTAINERS entry
- YAML DT bindings.
* ad8366
- Stop using core mlock in favour of well scoped local lock.
- SPDX + copyright date update.
* ad9834
- of_device_id table
* adf4371
- Add support for output stage muting before lock on has occured.
* adis library
- MAINTAINERS entry to reflect that this now Alexandru's problem ;)
* adis162xx:
- Fix a slightly incorrect set of comments and print statements on
minimum supported voltage.
* adis16203
- of_device_id table.
* adis16240
- Add of_device_id table (in two parts as first patch only used it for
MODULE_DEVICE_TABLE.)
* adt7316-spi
- of_device_id table
* adxl372
- YAML DT binding conversion.
- Cleanup use of buffer callback functions (precursor to core rework).
* bh1710
- Simplify getting the i2c adapter from the client.
* dht11
- Mote to newer GPIO consumer interface.
* kxcjk-1013.c
- Add binding for sensor in display of some ultrabooks after userspace
tools updated for it not be a problem to report two similar sensors.
* imx7d
- drop unused variables.
- white space
- define instead of variable for clock frequency that is fixed.
- drop pointless error message.
* messon_saradc
- SPDX
* sps30
- MAINTAINERS entry
- YAML binding conversion.
* st_accel
- Tidy up ordering in various buffer related callbacks. This is
part of a long running effort to simplify the core code.
* stm32-dfsdm:
- Manage the resolution cleanly in triggerd modes.
- Add fast mode support which allows more flexible filter choices.
- Add a comment on the reason for a 16 bit record when technically
not 'required'.
* st_lsm6dsx
- Embed device name in the sensor_settings struct as i3c doesn't
have a convenient name field to use for this.
* xilinx-adc
- Relax constraints on supported platforms to reflect that this
can used with FPGAs on PCIe cards and hence many architectures.
* counters/ftm-quaddec
- Fix some formatting io MODULE_AUTHOR
- MAINTAINERS entry
Fixes
* tools
- fix incorrect handling of 32 bit channels.
* sca3000
- Potential endian bug that is unlikely to bite anyone (be64 host
seems unlikely for this old part).
* stm32-adc
- Add vdda-supply. On some boards it needs to be turned on to supply
the ADC. DT bindings included.
* stm32-dfsdm
- Fix output resolution to work with filter orders other than 3.
- Fix output datatype as it's signed and previously claimed not to be.
* tag 'iio-for-5.3b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (68 commits)
iio: iio-utils: Fix possible incorrect mask calculation
iio: frequency: adf4371: Add support for output stage mute
dt-bindings: iio: frequency: Add ADF4372 PLL documentation
iio: frequency: adf4371: Add support for ADF4372 PLL
dt-bindings: iio: adc: Add buffered input property
Convert AD7124 bindings documentation to YAML format.
iio: adc: ad7124: Shift to dynamic allocation for channel configuration
iio: adc: ad7124: Add buffered input support
iio: adc: ad7124: Remove input number limitation
MAINTAINERS: add ADIS IMU driver library entry
iio: adis162xx: fix low-power docs & reports
counter/ftm-quaddec: Add missing '>' in MODULE_AUTHOR
iio: core: no need to check return value of debugfs_create functions
docs: iio: convert to ReST
iio: adc: stm32-adc: add missing vdda-supply
dt-bindings: iio: adc: stm32: add missing vdda supply
iio: adc: stm32-dfsdm: add comment for 16 bits record
iio: adc: stm32-dfsdm: add fast mode support
iio: adc: stm32-dfsdm: manage data resolution in trigger mode
iio: adc: stm32-dfsdm: fix data type
...
The last '>' chars were missing in the MODULE_AUTHOR entries.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Fixes: a3b9a99980 ("counter: add FlexTimer Module Quadrature decoder counter driver")
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* ad7150
- sense of bit for controlling adaptive vs fixed threshold was flipped.
* adt7316
- Fix a build issue due to wrong headers for gpio usage.
* lsm6dsx
- correctly suspend / resume i2c slaves when the host goes to sleep.
* mlx90632
- relax a compatability check to allow for newer devices.
Also one counters fix
* counter/ftm-quaddec
- missing dependencies in Kconfig.
-----BEGIN PGP SIGNATURE-----
iQJFBAABCAAvFiEEbilms4eEBlKRJoGxVIU0mcT0FogFAl0H5PURHGppYzIzQGtl
cm5lbC5vcmcACgkQVIU0mcT0Foh7bhAAqF/VG9KhIioY4ov5U+Exh5OGzirhTLKC
TyuK4fnSHO9avql1lTAc9b/tt2tBdE4f0vel6CSP+1GlbwfG01AYUu+ZW7j/GkgT
D09o4IH1TspqH5nIc2JunZwYqPJG2v7Fis9IMtS13eTJ+csf9EhVCuIf8tnaPwyM
/OH7t3JdSqxtsxHECEsZhl5IDrqZKyQI3+7MtlpcnuQpNjrrwxey4B54csZamUH8
nhefM7CtI+roaT+Ydp5oNpvpVXhNH54rVKwEkJfeuhiuviHoO7SgUF59u4vp9JYa
5dVo+T8+b2gsAt1w4jDCNDALTrFYL1d4XCyHuW+ZvpTGfb99E0g2QRStuBJp0Nyn
9s9K05KTdcHi3HBUxx+pKh7MDUBzKSm5T5euq4ZHRUKF3vjfBhsoN4iVh31IHa53
Nv28vnnxUd7RXHZonoi9wIT0zoDSY1IvpNGtwJaOjBJNcUjtDQivV2KqqvvvSfj0
g7KswaUB5icRR/mtL4Jj2j0voD2e+mMXgknRmHJthXKBKzs4lQHFPqI1rZQy8DRg
2YCi5zJNPBmf7hNbMqyt5YEkflZST3zzOUBRxdju4w3lwKZl6+bQd5B82ET6DZSr
n99WXsGcdck/JEWomUhGb5uTbS2LAgsVLIXJTDzgzwQqE4Vp7FFYIHDNeTJx43Cm
bEvNn0cT6a8=
=2i3G
-----END PGP SIGNATURE-----
Merge tag 'iio-fixes-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
Second set of IIO fixes for the 5.2 cycle.
* ad7150
- sense of bit for controlling adaptive vs fixed threshold was flipped.
* adt7316
- Fix a build issue due to wrong headers for gpio usage.
* lsm6dsx
- correctly suspend / resume i2c slaves when the host goes to sleep.
* mlx90632
- relax a compatability check to allow for newer devices.
Also one counters fix
* counter/ftm-quaddec
- missing dependencies in Kconfig.
* tag 'iio-fixes-for-5.2b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
counter/ftm-quaddec: Add missing dependencies in Kconfig
staging: iio: adt7316: Fix build errors when GPIOLIB is not set
iio: temperature: mlx90632 Relax the compatibility check
iio: imu: st_lsm6dsx: fix PM support for st_lsm6dsx i2c controller
staging:iio:ad7150: fix threshold mode config bit
This driver uses devm_ioremap and of* functions. This fixes a
linking failure with e.g. ARCH=um.
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Fixes: a3b9a99 ("counter: add FlexTimer Module Quadrature decoder counter driver")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Fix sparse warning:
drivers/counter/104-quad-8.c:836:26: warning:
symbol 'quad8_ops' was not declared. Should it be static?
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add SPDX license identifiers to all Make/Kconfig files which:
- Have no license information of any form
These files fall under the project license, GPL v2 only. The resulting SPDX
license identifier is:
GPL-2.0-only
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This driver exposes the counter for the quadrature decoder of the
FlexTimer Module, present in the LS1021A soc.
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Add support for new counter device to stm32-lptimer.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Implement counter part of the STM32 timer hardware block by using
counter API. Hardware only supports X2 and X4 quadrature modes. A
ceiling value can be set to define the maximum value reachable by the
counter.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@st.com>
Co-authored-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch adds support for the Generic Counter interface to the
104-QUAD-8 driver. The existing 104-QUAD-8 device interface should not
be affected by this patch; all changes are intended as supplemental
additions as perceived by the user.
Generic Counter Counts are created for the eight quadrature channel
counts, as well as their respective quadrature A and B Signals (which
are associated via respective Synapse structures) and respective index
Signals.
The new Generic Counter interface sysfs attributes are intended to
expose the same functionality and data available via the existing
104-QUAD-8 IIO device interface; the Generic Counter interface serves
to provide the respective functionality and data in a standard way
expected of counter devices.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch introduces the Generic Counter interface for supporting
counter devices.
In the context of the Generic Counter interface, a counter is defined as
a device that reports one or more "counts" based on the state changes of
one or more "signals" as evaluated by a defined "count function."
Driver callbacks should be provided to communicate with the device: to
read and write various Signals and Counts, and to set and get the
"action mode" and "count function" for various Synapses and Counts
respectively.
To support a counter device, a driver must first allocate the available
Counter Signals via counter_signal structures. These Signals should
be stored as an array and set to the signals array member of an
allocated counter_device structure before the Counter is registered to
the system.
Counter Counts may be allocated via counter_count structures, and
respective Counter Signal associations (Synapses) made via
counter_synapse structures. Associated counter_synapse structures are
stored as an array and set to the the synapses array member of the
respective counter_count structure. These counter_count structures are
set to the counts array member of an allocated counter_device structure
before the Counter is registered to the system.
A counter device is registered to the system by passing the respective
initialized counter_device structure to the counter_register function;
similarly, the counter_unregister function unregisters the respective
Counter. The devm_counter_register and devm_counter_unregister functions
serve as device memory-managed versions of the counter_register and
counter_unregister functions respectively.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>