Commit graph

69 commits

Author SHA1 Message Date
William Breathitt Gray
94a853eca7 counter: 104-quad-8: Describe member 'lock' in 'quad8'
This adds a kernel-doc comment line describing the 'lock' member of the
'quad8' structure.

Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/43b4acab9e238638c7067dd4a363a42f94c94ccb.1628511445.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-09 20:24:38 +01:00
William Breathitt Gray
394a0150a0 counter: Rename counter_count_function to counter_function
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>
2021-08-09 20:17:36 +01:00
William Breathitt Gray
493b938a14 counter: Rename counter_signal_value to counter_signal_level
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>
2021-08-09 20:17:36 +01:00
William Breathitt Gray
e2ff3198c5 counter: Standardize to ERANGE for limit exceeded errors
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>
2021-08-09 20:17:36 +01:00
William Breathitt Gray
b11eed1554 counter: Return error code on invalid modes
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>
2021-08-09 20:17:36 +01:00
William Breathitt Gray
728246e8f7 counter: 104-quad-8: Return error when invalid mode during ceiling_write
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>
2021-08-09 20:17:36 +01:00
Jarkko Nikula
62f9eb7079 counter: intel-qep: Remove linux/bitops.h include
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>
2021-07-13 19:07:10 +01:00
William Breathitt Gray
bc84957d31 counter: interrupt-cnt: Add const qualifier for actions_list array
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>
2021-06-13 17:00:18 +01:00
Jarkko Nikula
93466212b9 counter: intel-qep: Use to_pci_dev() helper
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>
2021-06-13 17:00:17 +01:00
Jarkko Nikula
ac3bd9d6b1 counter: intel-qep: Mark PM callbacks with __maybe_unused
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>
2021-06-13 17:00:17 +01:00
William Breathitt Gray
d0ce3d5cf7 counter: stm32-timer-cnt: Add const qualifier for actions_list array
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>
2021-06-09 16:32:47 +01:00
William Breathitt Gray
f83e6e5936 counter: stm32-lptimer-cnt: Add const qualifier for actions_list array
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>
2021-06-09 16:31:48 +01:00
William Breathitt Gray
0056a405c7 counter: microchip-tcb-capture: Add const qualifier for actions_list array
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>
2021-06-09 16:30:34 +01:00
William Breathitt Gray
9b2574f61c counter: ftm-quaddec: Add const qualifier for actions_list array
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>
2021-06-09 16:27:58 +01:00
William Breathitt Gray
6a9eb0e310 counter: 104-quad-8: Add const qualifier for actions_list array
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>
2021-06-09 16:26:57 +01:00
William Breathitt Gray
45af9ae84c counter: stm32-timer-cnt: Add const qualifier for functions_list array
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>
2021-06-09 16:24:39 +01:00
William Breathitt Gray
8a00fed665 counter: stm32-lptimer-cnt: Add const qualifier for functions_list array
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>
2021-06-09 16:23:54 +01:00
William Breathitt Gray
7e0dcfcefe counter: microchip-tcb-capture: Add const qualifier for functions_list array
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>
2021-06-09 16:22:33 +01:00
William Breathitt Gray
891b58b35f counter: interrupt-cnt: Add const qualifier for functions_list array
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>
2021-06-09 16:21:30 +01:00
William Breathitt Gray
fca2534fdd counter: 104-quad-8: Add const qualifier for functions_list array
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>
2021-06-09 16:20:20 +01:00
William Breathitt Gray
e612b60025 counter: 104-quad-8: Add const qualifiers for quad8_preset_register_set
Add some safety by qualifying the quad8_preset_register_set() function
parameters as const.

Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/050f1b518eeae8e3683f7d6d11f3219a137adf48.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-09 16:18:59 +01:00
William Breathitt Gray
af383bb146 counter: 104-quad-8: Annotate hardware config module parameter
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>
2021-06-09 16:16:19 +01:00
William Breathitt Gray
eb8eaa271f counter: 104-quad-8: Remove pointless comment
It is obvious that devm_counter_register() is used to register a Counter
device, so a comment stating such is pointless here.

Acked-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/77e9f3daa091d0ad0ee56b8973705dd03db85dd4.1623201081.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-09 16:01:59 +01:00
Jarkko Nikula
b711f687a1 counter: Add support for Intel Quadrature Encoder Peripheral
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>
2021-06-03 18:24:14 +01:00
Greg Kroah-Hartman
9c15db92a8 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
 -----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
  ...
2021-03-26 12:09:47 +01:00
Oleksij Rempel
a55ebd47f2 counter: add IRQ or GPIO based counter
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>
2021-03-25 19:13:51 +00:00
William Breathitt Gray
e357e81fcf counter: 104-quad-8: Remove IIO counter ABI
The IIO counter driver has been superseded by the Counter subsystem as
discussed in [1]. This patch removes the IIO counter ABI from the
104-QUAD-8 driver.

[1] https://lore.kernel.org/lkml/20210119104105.000010df@Huawei.com/

Cc: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Link: https://lore.kernel.org/r/98a39983d5df761c058a469d1346fd8ffdef8516.1611973018.git.vilhelm.gray@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11 20:46:56 +00:00
Fabrice Gasnier
01f68f067d counter: stm32-lptimer-cnt: remove iio counter abi
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>
2021-03-11 20:46:56 +00:00
Fabrice Gasnier
b14d72ac73 counter: stm32-timer-cnt: fix ceiling miss-alignment with reload register
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>
2021-03-06 16:48:09 +00:00
Fabrice Gasnier
e4c3e13329 counter: stm32-timer-cnt: fix ceiling write max value
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>
2021-03-06 16:47:03 +00:00
William Breathitt Gray
fae6f62e6a counter: stm32-timer-cnt: Report count function when SLAVE_MODE_DISABLED
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>
2021-02-27 16:10:28 +00:00
David Lechner
49a9565a7a counter:ti-eqep: remove floor
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>
2021-01-14 20:56:56 +00:00
William Breathitt Gray
3418bd7cfc counter: microchip-tcb-capture: Fix CMR value check
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>
2020-12-03 19:40:31 +00:00
David Lechner
271b339236 counter/ti-eqep: Fix regmap max_register
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>
2020-11-01 17:17:31 +00:00
Julia Lawall
bbbeac88fb counter: use semicolons rather than commas to separate statements
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>
2020-09-29 17:27:08 +01:00
Rikard Falkeborn
0854fa22b9 counter: microchip-tcb-capture: Constify mchp_tc_ops
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>
2020-09-23 20:53:58 +01:00
Dan Carpenter
ab3300deff counter: microchip-tcb-capture: check the correct variable
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>
2020-08-22 11:38:42 +01:00
Jonathan Cameron
1c2f21be65 Merge branch 'ib-5.8-tcb' into HEAD
Series needed as base for a clocksource tree hence immutable branch
2020-07-22 14:37:23 +01:00
Kamel Bouhara
106b104137 counter: Add microchip TCB capture counter
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>
2020-07-20 13:04:40 +01:00
Greg Kroah-Hartman
263771dbc8 Linux 5.8-rc6
-----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>
2020-07-20 09:37:31 +02:00
Syed Nayyar Waris
d5ed76adb9 counter: 104-quad-8: Add lock guards - filter clock prescaler
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>
2020-06-14 14:46:52 +01:00
Syed Nayyar Waris
708d989328 counter: 104-quad-8: Add lock guards - differential encoder
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>
2020-06-14 14:44:32 +01:00
Alexandru Ardelean
d3be83244c iio: remove explicit IIO device parent assignment
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>
2020-06-14 11:49:59 +01:00
Syed Nayyar Waris
fc06926226 counter: 104-quad-8: Add lock guards - generic interface
Add lock protection from race conditions to 104-quad-8 counter driver
generic interface code changes. Mutex calls used for protection.

Fixes: f1d8a071d4 ("counter: 104-quad-8: Add Generic Counter interface support")

Signed-off-by: Syed Nayyar Waris <syednwaris@gmail.com>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-04-19 17:50:00 +01:00
William Breathitt Gray
954ab5cc5f counter: 104-quad-8: Support Differential Encoder Cable Status
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>
2020-03-08 17:28:53 +00:00
William Breathitt Gray
de65d05563 counter: 104-quad-8: Support Filter Clock Prescaler
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>
2020-03-08 17:28:52 +00:00
Fabrice Gasnier
15e8573d3b counter: stm32-timer-cnt: remove iio headers
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>
2020-02-21 10:02:15 +00:00
Fabrice Gasnier
c5b8425514 counter: stm32-timer-cnt: add power management support
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>
2020-02-21 10:02:15 +00:00
William Breathitt Gray
d49e6ee2d6 counter: Simplify the count_read and count_write callbacks
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>
2019-10-18 19:47:27 +01:00
Jonathan Cameron
686191a7ea Merge branch 'ib-ti-eqep-5.4-rc1' into togreg
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.
2019-10-17 22:08:43 +01:00