Commit graph

212 commits

Author SHA1 Message Date
Greg Kroah-Hartman
1b56e7d465 Second set of Counter updates for 6.16
Adds compatible for STM32MP25 SoC and enables respective encoder
 capability for stm32-timer-cnt. Implements watch_validate callback for
 microchip-tcb-capture.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCaDBvtAAKCRC1SFbKvhIj
 K03PAP46u3SlttQbm2AqzEOMxNSX68a8Ll36BBGLniYsjgxnCgD9HvAlXt0IRE9V
 4rmnq/Hdvlx2Ib7sts6/lVcq/Db7AQY=
 =9ov0
 -----END PGP SIGNATURE-----

Merge tag 'counter-updates-for-6.16b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter into char-misc-next

William writes:

Second set of Counter updates for 6.16

Adds compatible for STM32MP25 SoC and enables respective encoder
capability for stm32-timer-cnt. Implements watch_validate callback for
microchip-tcb-capture.

* tag 'counter-updates-for-6.16b' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
  counter: microchip-tcb-capture: Add watch validation support
  counter: stm32-timer-cnt: add support for stm32mp25
2025-05-24 08:29:32 +02:00
Dharma Balasubiramani
ae3392c0f1 counter: microchip-tcb-capture: Add watch validation support
The Timer Counter Block (TCB) exposes several kinds of events to the
Counter framework, but not every event is meaningful on every hardware
channel. Add a `watch_validate()` callback so userspace may register only
the combinations actually supported:

* Channel 0 (COUNTER_MCHP_EVCHN_CV, COUNTER_MCHP_EVCHN_RA)
   - COUNTER_EVENT_CAPTURE
   - COUNTER_EVENT_CHANGE_OF_STATE
   - COUNTER_EVENT_OVERFLOW

* Channel 1 (COUNTER_MCHP_EVCHN_RB)
   - COUNTER_EVENT_CAPTURE

* Channel 2 (COUNTER_MCHP_EVCHN_RC)
   - COUNTER_EVENT_THRESHOLD

Any other request is rejected with `-EINVAL`.

Signed-off-by: Dharma Balasubiramani <dharma.b@microchip.com>
Link: https://lore.kernel.org/r/20250520-counter-tcb-v3-1-4631e2aff7ed@microchip.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-05-22 18:40:19 +09:00
Greg Kroah-Hartman
893579d9e3 Counter updates for 6.16
An update to allow for larger count values in interrupt-cnt.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCaCBJQgAKCRC1SFbKvhIj
 K//PAQC/De1TRyz47rMwHg3agdFZOiSKO7X0QqHBdX1lLpMgRQEAgcaxB+cYap9b
 8OfCqmvhbgO7YBZSRLslirC5fwlApA4=
 =N5JS
 -----END PGP SIGNATURE-----

Merge tag 'counter-updates-for-6.16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter into char-misc-next

William writes:

Counter updates for 6.16

An update to allow for larger count values in interrupt-cnt.

* tag 'counter-updates-for-6.16' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
  counter: interrupt-cnt: Convert atomic_t -> atomic_long_t
2025-05-21 14:07:53 +02:00
Fabrice Gasnier
ace2cd11a2 counter: stm32-timer-cnt: add support for stm32mp25
Add support for STM32MP25 SoC. There are new counter modes that may be
implemented in later. Still, use newly introduced compatible to handle
this new HW variant and avoid being blocked with existing compatible
in SoC dtsi file. Modes supported currently still remains compatible.
New timer 20 has encoder capability, add it to the list.

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20250110091922.980627-4-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-05-15 09:20:12 +09:00
Alexander Sverdlin
7351312632 counter: interrupt-cnt: Protect enable/disable OPs with mutex
Enable/disable seems to be racy on SMP, consider the following scenario:

CPU0					CPU1

interrupt_cnt_enable_write(true)
{
	if (priv->enabled == enable)
		return 0;

	if (enable) {
		priv->enabled = true;
					interrupt_cnt_enable_write(false)
					{
						if (priv->enabled == enable)
							return 0;

						if (enable) {
							priv->enabled = true;
							enable_irq(priv->irq);
						} else {
							disable_irq(priv->irq)
							priv->enabled = false;
						}
		enable_irq(priv->irq);
	} else {
		disable_irq(priv->irq);
		priv->enabled = false;
	}

The above would result in priv->enabled == false, but IRQ left enabled.
Protect both write (above race) and read (to propagate the value on SMP)
callbacks with a mutex.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Fixes: a55ebd47f2 ("counter: add IRQ or GPIO based counter")
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20250331163642.2382651-1-alexander.sverdlin@siemens.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-05-03 08:45:11 +09:00
Alexander Sverdlin
08e2a660b1 counter: interrupt-cnt: Convert atomic_t -> atomic_long_t
Convert the internal counter type to atomic_long_t, which:
- doesn't change much for existing in-tree users as they are 32-bit anyway
  (stm32/i.MX6)
- doesn't introduce performace penalty on 32-bit platforms
- provides 64-bit resolution on 64-bit platforms with virtually no
  preformance penalty

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@siemens.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/r/20250331152222.2263776-1-alexander.sverdlin@siemens.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-05-02 22:46:01 +09:00
Linus Torvalds
a0935e4ca3 Char/Misc fixes for 6.15-rc1
Here are 2 counter that I realized I never sent to you for 6.14-final.
 They have been in my for weeks, as well as linux-next, my fault for not
 sending them earlier.  They are:
   - bugfix for stm32-lptimer-cnt counter driver
   - bugfix for microchip-tcb-capture counter driver
 
 Again, these have been in linux-next for weeks with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZ+2WOQ8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymQagCfbKe+TdHELWZVMdWRV8ZGuuP9MmgAn1bi/3FK
 8bwV9pk+oqDAVnumFysU
 =iX58
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-6.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc fixes from Greg KH:
 "Here are two counter driver fixes that I realized I never sent to you
  for 6.14-final.

  They have been in my for weeks, as well as linux-next, my fault for
  not sending them earlier. They are:

   - bugfix for stm32-lptimer-cnt counter driver

   - bugfix for microchip-tcb-capture counter driver

  Again, these have been in linux-next for weeks with no reported
  issues"

* tag 'char-misc-6.15-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
  counter: microchip-tcb-capture: Fix undefined counter channel state on probe
  counter: stm32-lptimer-cnt: fix error handling when enabling
2025-04-02 18:03:34 -07:00
William Breathitt Gray
ba27a0247b counter: microchip-tcb-capture: Add support for RC Compare
In Capture mode, the RC register serves as a compare register for the
Timer Counter Channel. When a the Counter Value reaches the RC value, a
RC Compare event occurs (COUNTER_EVENT_THRESHOLD). This patch exposes
the RC register to userspace as the 'compare' Count extension, thus
allowing users to configure the threshold condition for these events.

Acked-by: Bence Csókás <csokas.bence@prolan.hu>
Link: https://lore.kernel.org/r/20250306-introduce-compare-component-v1-2-93993b3dca9c@kernel.org
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-03-10 18:20:32 +09:00
Bence Csókás
1adc6240a8 counter: microchip-tcb-capture: Add capture extensions for registers RA/RB
TCB hardware is capable of capturing the timer value to registers RA and
RB. Add these registers as capture extensions.

Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
Link: https://lore.kernel.org/r/20250306134441.582819-3-csokas.bence@prolan.hu
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-03-08 08:57:18 +09:00
Bence Csókás
e5d5813968 counter: microchip-tcb-capture: Add IRQ handling
Add interrupt servicing to allow userspace to wait for the following:
* Change-of-state caused by external trigger
* Capture of timer value into RA/RB
* Compare to RC register
* Overflow

Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
Link: https://lore.kernel.org/r/20250306134441.582819-2-csokas.bence@prolan.hu
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-03-08 08:57:02 +09:00
William Breathitt Gray
c0c9c73434 counter: microchip-tcb-capture: Fix undefined counter channel state on probe
Hardware initialize of the timer counter channel does not occur on probe
thus leaving the Count in an undefined state until the first
function_write() callback is executed. Fix this by performing the proper
hardware initialization during probe.

Fixes: 106b104137 ("counter: Add microchip TCB capture counter")
Reported-by: Csókás Bence <csokas.bence@prolan.hu>
Closes: https://lore.kernel.org/all/bfa70e78-3cc3-4295-820b-3925c26135cb@prolan.hu/
Link: https://lore.kernel.org/r/20250305-preset-capture-mode-microchip-tcb-capture-v1-1-632c95c6421e@kernel.org
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-03-06 23:04:50 +09:00
Fabrice Gasnier
8744dcd4fc counter: stm32-lptimer-cnt: fix error handling when enabling
In case the stm32_lptim_set_enable_state() fails to update CMP and ARR,
a timeout error is raised, by regmap_read_poll_timeout. It may happen,
when the lptimer runs on a slow clock, and the clock is gated only
few times during the polling.

Badly, when this happen, STM32_LPTIM_ENABLE in CR register has been set.
So the 'enable' state in sysfs wrongly lies on the counter being
correctly enabled, due to CR is read as one in stm32_lptim_is_enabled().

To fix both issues:
- enable the clock before writing CMP, ARR and polling ISR bits. It will
avoid the possible timeout error.
- clear the ENABLE bit in CR and disable the clock in the error path.

Fixes: d8958824cf ("iio: counter: Add support for STM32 LPTimer")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20250224170657.3368236-1-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-03-04 19:23:02 +09:00
David Lechner
c2a7566603 counter: ti-eqep: add direction support
Add support for reading the direction and for emitting direction change
events to the ti-eqep counter driver.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20250110-counter-ti-eqep-add-direction-support-v2-4-c6b6f96d2db9@baylibre.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2025-02-05 13:22:04 +09:00
Peter Zijlstra
cdd30ebb1b module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.

Scripted using

  git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
  do
    awk -i inplace '
      /^#define EXPORT_SYMBOL_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /^#define MODULE_IMPORT_NS/ {
        gsub(/__stringify\(ns\)/, "ns");
        print;
        next;
      }
      /MODULE_IMPORT_NS/ {
        $0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
      }
      /EXPORT_SYMBOL_NS/ {
        if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
  	if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
  	    $0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
  	    $0 !~ /^my/) {
  	  getline line;
  	  gsub(/[[:space:]]*\\$/, "");
  	  gsub(/[[:space:]]/, "", line);
  	  $0 = $0 " " line;
  	}

  	$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
  		    "\\1(\\2, \"\\3\")", "g");
        }
      }
      { print }' $file;
  done

Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 11:34:44 -08:00
Linus Torvalds
e70140ba0d Get rid of 'remove_new' relic from platform driver struct
The continual trickle of small conversion patches is grating on me, and
is really not helping.  Just get rid of the 'remove_new' member
function, which is just an alias for the plain 'remove', and had a
comment to that effect:

  /*
   * .remove_new() is a relic from a prototype conversion of .remove().
   * New drivers are supposed to implement .remove(). Once all drivers are
   * converted to not use .remove_new any more, it will be dropped.
   */

This was just a tree-wide 'sed' script that replaced '.remove_new' with
'.remove', with some care taken to turn a subsequent tab into two tabs
to make things line up.

I did do some minimal manual whitespace adjustment for places that used
spaces to line things up.

Then I just removed the old (sic) .remove_new member function, and this
is the end result.  No more unnecessary conversion noise.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-01 15:12:43 -08:00
Greg Kroah-Hartman
a32a8057af Counter fixes for 6.12
Fix device_node handling in stm32-timer-cnt by calling required
 of_node_put() after device node is no longer needed. Check and handle
 clk_enable() failures in stm32-timer-cnt and ti-ecap-capture.
 
 Signed-off-by: William Breathitt Gray <wbg@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCZyxlnwAKCRC1SFbKvhIj
 K9ZqAQD+qKOSu2VajfKZRhT7MZJSm4TXCPIELVBrjMs8iFBfPgD8DW+sdTBlm3tp
 XegnQW/cEqLskpD8/O3WBYuin69AFQ4=
 =GF8Q
 -----END PGP SIGNATURE-----

Merge tag 'counter-fixes-for-6.12' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter into char-misc-next

William writes:

Counter fixes for 6.12

Fix device_node handling in stm32-timer-cnt by calling required
of_node_put() after device node is no longer needed. Check and handle
clk_enable() failures in stm32-timer-cnt and ti-ecap-capture.

Signed-off-by: William Breathitt Gray <wbg@kernel.org>

* tag 'counter-fixes-for-6.12' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
  counter: ti-ecap-capture: Add check for clk_enable()
  counter: stm32-timer-cnt: Add check for clk_enable()
  counter: stm32-timer-cnt: fix device_node handling in probe_encoder()
2024-11-07 08:25:08 +01:00
Greg Kroah-Hartman
6cc685facb Counter updates for 6.13
Add MODULE_DEVICE_TABLE() for ftm-quaddec to autoload based on the alias
 from of_device_id table. Replace deprecated pcim_iomap_regions() and
 pcim_iomap_table() calls with pcim_iomap_region() in intel-eqp.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSNN83d4NIlKPjon7a1SFbKvhIjKwUCZyxh0wAKCRC1SFbKvhIj
 K7QQAQDhqiky38nbK1qoD1AbuUXWbbv7zgefd6E0F96aZETdXAEAsE26NV7+qPBW
 qpuzhHazfAGQoxtmDjPc1SIz0q+BVAY=
 =Nf3n
 -----END PGP SIGNATURE-----

Merge tag 'counter-updates-for-6.13' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter into char-misc-next

William writes:

Counter updates for 6.13

Add MODULE_DEVICE_TABLE() for ftm-quaddec to autoload based on the alias
from of_device_id table. Replace deprecated pcim_iomap_regions() and
pcim_iomap_table() calls with pcim_iomap_region() in intel-eqp.

* tag 'counter-updates-for-6.13' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
  counter: intel-qep: Replace deprecated PCI functions
  counter: ftm-quaddec: Enable module autoloading
2024-11-07 08:00:55 +01:00
Jiasheng Jiang
1437d9f1c5 counter: ti-ecap-capture: Add check for clk_enable()
Add check for the return value of clk_enable() in order to catch the
potential exception.

Fixes: 4e2f42aa00 ("counter: ti-ecap-capture: capture driver support for ECAP")
Reviewed-by: Julien Panis <jpanis@baylibre.com>
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Link: https://lore.kernel.org/r/20241104194059.47924-1-jiashengjiangcool@gmail.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-11-05 09:20:11 +09:00
Jiasheng Jiang
842c3755a6 counter: stm32-timer-cnt: Add check for clk_enable()
Add check for the return value of clk_enable() in order to catch the
potential exception.

Fixes: c5b8425514 ("counter: stm32-timer-cnt: add power management support")
Fixes: ad29937e20 ("counter: Add STM32 Timer quadrature encoder")
Signed-off-by: Jiasheng Jiang <jiashengjiangcool@gmail.com>
Link: https://lore.kernel.org/r/20241104191825.40155-1-jiashengjiangcool@gmail.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-11-05 09:15:20 +09:00
Philipp Stanner
522ae89b78 counter: intel-qep: Replace deprecated PCI functions
pcim_iomap_regions() and pcim_iomap_table() have been deprecated in
commit e354bb84a4 ("PCI: Deprecate pcim_iomap_table(),
pcim_iomap_regions_request_all()").

Replace these functions with pcim_iomap_region().

Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Link: https://lore.kernel.org/r/20241028091312.17045-2-pstanner@redhat.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-11-01 15:00:31 +09:00
Javier Carrasco
147359e23e counter: stm32-timer-cnt: fix device_node handling in probe_encoder()
Device nodes accessed via of_get_compatible_child() require
of_node_put() to be called when the node is no longer required to avoid
leaving a reference to the node behind, leaking the resource.

In this case, the usage of 'tnode' is straightforward and there are no
error paths, allowing for a single of_node_put() when 'tnode' is no
longer required.

Cc: stable@vger.kernel.org
Fixes: 29646ee33c ("counter: stm32-timer-cnt: add checks on quadrature encoder capability")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Link: https://lore.kernel.org/r/20241027-stm32-timer-cnt-of_node_put-v1-1-ebd903cdf7ac@gmail.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-11-01 13:46:54 +09:00
Al Viro
5f60d5f6bb move asm/unaligned.h to linux/unaligned.h
asm/unaligned.h is always an include of asm-generic/unaligned.h;
might as well move that thing to linux/unaligned.h and include
that - there's nothing arch-specific in that header.

auto-generated by the following:

for i in `git grep -l -w asm/unaligned.h`; do
	sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
done
for i in `git grep -l -w asm-generic/unaligned.h`; do
	sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
done
git mv include/asm-generic/unaligned.h include/linux/unaligned.h
git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
2024-10-02 17:23:23 -04:00
Liao Chen
a3911e087d counter: ftm-quaddec: Enable module autoloading
Add MODULE_DEVICE_TABLE(), so modules can be properly autoloaded based
on the alias from of_device_id table.

Signed-off-by: Liao Chen <liaochen4@huawei.com>
Link: https://lore.kernel.org/r/20240902122014.905237-1-liaochen4@huawei.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-09-30 22:27:59 +09:00
Al Viro
cb787f4ac0 [tree-wide] finally take no_llseek out
no_llseek had been defined to NULL two years ago, in commit 868941b144
("fs: remove no_llseek")

To quote that commit,

  At -rc1 we'll need do a mechanical removal of no_llseek -

  git grep -l -w no_llseek | grep -v porting.rst | while read i; do
	sed -i '/\<no_llseek\>/d' $i
  done

  would do it.

Unfortunately, that hadn't been done.  Linus, could you do that now, so
that we could finally put that thing to rest? All instances are of the
form
	.llseek = no_llseek,
so it's obviously safe.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-09-27 08:18:43 -07:00
Linus Torvalds
acc5965b9f Char/Misc and other driver changes for 6.11-rc1
Here is the "big" set of char/misc and other driver subsystem changes
 for 6.11-rc1.  Nothing major in here, just loads of new drivers and
 updates.  Included in here are:
   - IIO api updates and new drivers added
   - wait_interruptable_timeout() api cleanups for some drivers
   - MODULE_DESCRIPTION() additions for loads of drivers
   - parport out-of-bounds fix
   - interconnect driver updates and additions
   - mhi driver updates and additions
   - w1 driver fixes
   - binder speedups and fixes
   - eeprom driver updates
   - coresight driver updates
   - counter driver update
   - new misc driver additions
   - other minor api updates
 
 All of these, EXCEPT for the final Kconfig build fix for 32bit systems,
 have been in linux-next for a while with no reported issues.  The
 Kconfig fixup went in 29 hours ago, so might have missed the latest
 linux-next, but was acked by everyone involved.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCZppR4w8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykwoQCeIaW3nbOiNTmOupvEnZwrN3yVNs8An3Q5L+Br
 1LpTASaU6A8pN81Z1m5g
 =6U1z
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char / misc and other driver updates from Greg KH:
 "Here is the "big" set of char/misc and other driver subsystem changes
  for 6.11-rc1. Nothing major in here, just loads of new drivers and
  updates. Included in here are:

   - IIO api updates and new drivers added

   - wait_interruptable_timeout() api cleanups for some drivers

   - MODULE_DESCRIPTION() additions for loads of drivers

   - parport out-of-bounds fix

   - interconnect driver updates and additions

   - mhi driver updates and additions

   - w1 driver fixes

   - binder speedups and fixes

   - eeprom driver updates

   - coresight driver updates

   - counter driver update

   - new misc driver additions

   - other minor api updates

  All of these, EXCEPT for the final Kconfig build fix for 32bit
  systems, have been in linux-next for a while with no reported issues.
  The Kconfig fixup went in 29 hours ago, so might have missed the
  latest linux-next, but was acked by everyone involved"

* tag 'char-misc-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (330 commits)
  misc: Kconfig: exclude mrvl-cn10k-dpi compilation for 32-bit systems
  misc: delete Makefile.rej
  binder: fix hang of unregistered readers
  misc: Kconfig: add a new dependency for MARVELL_CN10K_DPI
  virtio: add missing MODULE_DESCRIPTION() macro
  agp: uninorth: add missing MODULE_DESCRIPTION() macro
  spmi: add missing MODULE_DESCRIPTION() macros
  dev/parport: fix the array out-of-bounds risk
  samples: configfs: add missing MODULE_DESCRIPTION() macro
  misc: mrvl-cn10k-dpi: add Octeon CN10K DPI administrative driver
  misc: keba: Fix missing AUXILIARY_BUS dependency
  slimbus: Fix struct and documentation alignment in stream.c
  MAINTAINERS: CC dri-devel list on Qualcomm FastRPC patches
  misc: fastrpc: use coherent pool for untranslated Compute Banks
  misc: fastrpc: support complete DMA pool access to the DSP
  misc: fastrpc: add missing MODULE_DESCRIPTION() macro
  misc: fastrpc: Add missing dev_err newlines
  misc: fastrpc: Use memdup_user()
  nvmem: core: Implement force_ro sysfs attribute
  nvmem: Use sysfs_emit() for type attribute
  ...
2024-07-19 15:55:08 -07:00
Linus Torvalds
c6e63a9882 pwm: Changes for v6.11-rc1
This contains the usual mix of fixes, cleanups, two new drivers and
 several dt binding updates. The fixes are for minor issues that are
 already old (4.11-rc1 and 3.9-rc1) and were found by code review and not
 during usage, so I didn't sent them for earlier inclusion.
 
 The changes to include/linux/mfd/stm32-timers.h and
 drivers/counter/stm32-timer-cnt.c are part of an immutable branch that
 will also be included in the mfd and counter PR. It changes some
 register definitions and affects the pwm-stm32 driver.
 
 Thanks go to Andy Shevchenko, AngeloGioacchino Del Regno, Conor Dooley,
 David Lechner, Dhruva Gole, Drew Fustini, Frank Li, Jeff Johnson, Junyi
 Zhao, Kelvin Zhang, Krzysztof Kozlowski, Lee Jones, Linus Walleij, Linus
 Walleij, Michael Hennerich, Nicola Di Lieto, Nicolas Ferre, Nuno Sa,
 Paul Cercueil, Raag Jadav, Rob Herring, Sean Anderson, Sean Young,
 Shenwei Wang, Stefan Wahren, Trevor Gamblin, Tzung-Bi Shih, Vincent
 Whitchurch and William Breathitt Gray for their contributions to this
 pull request; they authored changes, spend time reviewing changes and
 coordinated the above mentioned immutable branch.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmaUYxcACgkQj4D7WH0S
 /k7p9AgAsmKo97xC3XoXbWE2gvgK5LuqIoNfjFGGmcYZV6xsyfte2ZEoED6r6W63
 l/GwbBUKhGPZM/y+VL8QoXxWRRx/XmTjsawCX0d+jHJjw+nluSIVUKMDYmQpaCPg
 UehGaJKjAUqczPytxbTGrHEevArHPN1GieAcayfyOI7iqQomLklZ2VX3PKbgVcjC
 3EMfyAK9JPJ3x6IvMVZQeZa4/OhLv78p2p1mLWaXjpmp5GErPHujBz4ByPtqUAgt
 YWGFWlFOvy1EQsGwJ2qsUa/ZAfe5AkcmaJ4HwhBHe5Vv4pm8c9oC66DUUeKbyNMP
 O5QPPEN3gr9EWL9VQaGOyfY7JAfvaQ==
 =/dpI
 -----END PGP SIGNATURE-----

Merge tag 'pwm/for-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm updates from Uwe Kleine-König:
 "This contains the usual mix of fixes, cleanups, two new drivers and
  several dt binding updates. The fixes are for minor issues that are
  already old (4.11-rc1 and 3.9-rc1) and were found by code review and
  not during usage, so I didn't sent them for earlier inclusion.

  The changes to include/linux/mfd/stm32-timers.h and
  drivers/counter/stm32-timer-cnt.c are part of an immutable branch that
  will also be included in the mfd and counter pulls. It changes some
  register definitions and affects the pwm-stm32 driver.

  Thanks go to Andy Shevchenko, AngeloGioacchino Del Regno, Conor
  Dooley, David Lechner, Dhruva Gole, Drew Fustini, Frank Li, Jeff
  Johnson, Junyi Zhao, Kelvin Zhang, Krzysztof Kozlowski, Lee Jones,
  Linus Walleij, Linus Walleij, Michael Hennerich, Nicola Di Lieto,
  Nicolas Ferre, Nuno Sa, Paul Cercueil, Raag Jadav, Rob Herring, Sean
  Anderson, Sean Young, Shenwei Wang, Stefan Wahren, Trevor Gamblin,
  Tzung-Bi Shih, Vincent Whitchurch and William Breathitt Gray for their
  contributions to this pull request; they authored changes, spend time
  reviewing changes and coordinated the above mentioned immutable
  branch"

* tag 'pwm/for-6.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (38 commits)
  pwm: axi-pwmgen: add .max_register to regmap
  dt-bindings: pwm: at91: Add sama7d65 compatible string
  pwm: atmel-tcb: Make private data variable naming consistent
  pwm: atmel-tcb: Simplify checking the companion output
  pwm: Allow pwm state transitions from an invalid state
  pwm: xilinx: Simplify using devm_ functions
  pwm: Use guards for pwm_lookup_lock instead of explicity mutex_lock + mutex_unlock
  pwm: Use guards for export->lock instead of explicity mutex_lock + mutex_unlock
  pwm: Use guards for pwm_lock instead of explicity mutex_lock + mutex_unlock
  pwm: Register debugfs operations after the pwm class
  pwm: imx-tpm: Enable pinctrl setting for sleep state
  pwm: lpss: drop redundant runtime PM handles
  pwm: lpss: use devm_pm_runtime_enable() helper
  pwm-stm32: Make use of parametrised register definitions
  dt-bindings: pwm: imx: remove interrupt property from required
  pwm: meson: Add support for Amlogic S4 PWM
  pwm: Add GPIO PWM driver
  dt-bindings: pwm: Add pwm-gpio
  pwm: Drop pwm_apply_state()
  bus: ts-nbus: Use pwm_apply_might_sleep()
  ...
2024-07-15 17:42:28 -07:00
Judith Mendez
988609f2aa counter: ti-eqep: Allow eQEP driver to be built for K3 devices
TI K3 SoC's support eQEP hardware, so add ARCH_K3 to the depends
so the TI eQEP driver can be built for K3 devices.

Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/20240612135538.2447938-9-jm@ti.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-07-01 19:05:42 +09:00
Judith Mendez
210457b651 counter/ti-eqep: Add new ti-am62-eqep compatible
Add new compatible for ti-am62-eqep for TI K3 SoC's.

Signed-off-by: Judith Mendez <jm@ti.com>
Reviewed-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/20240612135538.2447938-3-jm@ti.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-07-01 10:40:27 +09:00
David Lechner
1a84aaadb0 counter: ti-eqep: remove counter_priv() wrapper
The ti_eqep_count_from_counter() function is just a wrapper around
counter_priv(). counter_priv() can be used directly, so we don't need
the wrapper function. Remove it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240609-ti-eqep-cleanup-v1-2-9d67939c763a@baylibre.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-07-01 10:31:42 +09:00
David Lechner
bc4666be63 counter: ti-eqep: remove unused struct member
Since commit 8817c2d03a ("counter: ti-eqep: Convert to counter_priv()
wrapper") the counter field in struct ti_eqep_cnt is not used anymore.
Remove it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Judith Mendez <jm@ti.com>
Link: https://lore.kernel.org/r/20240609-ti-eqep-cleanup-v1-1-9d67939c763a@baylibre.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-07-01 10:31:42 +09:00
David Lechner
10365dd4c1 counter: ti-eqep: implement over/underflow events
This adds support to the TI eQEP counter driver for subscribing to
overflow and underflow events using the counter chrdev interface.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240609-counter-ti-eqep-over-under-events-v1-1-74fe1632f5ab@baylibre.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-07-01 10:31:15 +09:00
Jeff Johnson
5f81aa7677 counter: ftm-quaddec: add missing MODULE_DESCRIPTION() macro
make allmodconfig && make W=1 C=1 reports:
WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/counter/ftm-quaddec.o

Add the missing invocation of the MODULE_DESCRIPTION() macro.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Link: https://lore.kernel.org/r/20240602-md-ftm-quaddec-v1-1-1bbdf705ad31@quicinc.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-07-01 10:29:47 +09:00
Uwe Kleine-König
9d7809aaea counter: stm32-timer-cnt: Use TIM_DIER_CCxIE(x) instead of TIM_DIER_CCxIE(x)
These two defines have the same purpose and this change doesn't
introduce any differences in drivers/counter/stm32-timer-cnt.o.

The only difference between the two is that

	TIM_DIER_CC_IE(1) == TIM_DIER_CC2IE

while

	TIM_DIER_CCxIE(1) == TIM_DIER_CC1IE

. That makes it necessary to have an explicit "+ 1" in the user code,
but IMHO this is a good thing as this is the code locatation that
"knows" that for software channel 1 you have to use TIM_DIER_CC2IE
(because software guys start counting at 0, while the relevant hardware
designer started at 1).

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
Acked-by: William Breathitt Gray <wbg@kernel.org>
Link: https://lore.kernel.org/r/126bd153a03f39e42645573eecf44ffab5354fc7.1718791090.git.u.kleine-koenig@baylibre.com
Signed-off-by: Lee Jones <lee@kernel.org>
2024-06-26 16:09:55 +01:00
David Lechner
0cf81c73e4 counter: ti-eqep: enable clock at probe
The TI eQEP clock is both a functional and interface clock. Since it is
required for the device to function, we should be enabling it at probe.

Up to now, we've just been lucky that the clock was enabled by something
else on the system already.

Fixes: f213729f67 ("counter: new TI eQEP driver")
Reviewed-by: Judith Mendez <jm@ti.com>
Signed-off-by: David Lechner <dlechner@baylibre.com>
Link: https://lore.kernel.org/r/20240621-ti-eqep-enable-clock-v2-1-edd3421b54d4@baylibre.com
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-06-22 13:48:11 +09:00
William Breathitt Gray
916baadd29 counter: ti-ecap-capture: Utilize COUNTER_COMP_FREQUENCY macro
Reduce boilerplate by leveraging the COUNTER_COMP_FREQUENCY() macro to
define the "frequency" extension.

Link: https://lore.kernel.org/r/ZfxhEKdSi1amfcJC@ishi
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-04-02 13:15:03 -04:00
Uwe Kleine-König
4b986b68e6 counter: ti-eqep: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: David Lechner <david@lechnology.com>
Link: https://lore.kernel.org/r/bf78595f6a49be0b6bb403b466c13177d72c02b7.1710057753.git.u.kleine-koenig@pengutronix.de
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-04-02 13:10:35 -04:00
Uwe Kleine-König
e9b4895fd1 counter: ti-ecap-capture: Convert to platform remove callback returning void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/f70902b2aabecaa9295c28629cd7a8a0e6eb06d0.1710057753.git.u.kleine-koenig@pengutronix.de
Signed-off-by: William Breathitt Gray <wbg@kernel.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
1aed15275b counter: stm32-timer-cnt: add support for capture events
Add support for capture events. Captured counter value for each channel
can be retrieved through CCRx register.
STM32 timers can have up to 4 capture channels (on input channel 1 to
channel 4), hence need to check the number of channels before reading
the capture data.
The capture configuration is hard-coded to capture signals on both edges
(non-inverted). Interrupts are used to report events independently for
each channel.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Acked-by: Lee Jones <lee@kernel.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-11-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
2c70ccd459 counter: stm32-timer-cnt: add support for overflow events
Add support overflow events. Also add the related validation and
configuration routine. Register and enable interrupts to push events.
STM32 Timers can have either 1 global interrupt, or 4 dedicated interrupt
lines. Request only the necessary interrupt, e.g. either global interrupt
that can report all event types, or update interrupt only for overflow
event.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-10-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
f7630270b6 counter: stm32-timer-cnt: probe number of channels from registers
Probe the number of capture compare channels, by writing CCER register bits
and read them back. Take care to restore the register original value.

This is a precursor patch to support capture channels.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-9-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
efec660d78 counter: stm32-timer-cnt: introduce channels
Simply add channels 3 and 4 that can be used for capture. Statically
add them, despite some timers doesn't have them. Rather rely on
stm32_action_read that will report "none" action for these currently.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-8-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
29646ee33c counter: stm32-timer-cnt: add checks on quadrature encoder capability
This is a precursor patch to support capture channels on all possible
channels and stm32 timer types. Original driver was intended to be used
only as quadrature encoder and simple counter on internal clock.

So, add a check on encoder capability, so the driver may be probed for
timer instances without encoder feature. This way, all timers may be used
as simple counter on internal clock, starting from here.

Encoder capability is retrieved by using the timer index (originally in
stm32-timer-trigger driver and dt-bindings). The need to keep backward
compatibility with existing device tree lead to parse aside trigger node.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-7-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
b73d03b347 counter: stm32-timer-cnt: add counter prescaler extension
There's a prescaler in between the selected input signal used for
counting (CK_PSC), and the counter input (CK_CNT).
So add the "prescaler" extension to the counter.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-6-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
7a6c69f2be counter: stm32-timer-cnt: introduce clock signal
Introduce the internal clock signal, used to count when in simple rising
function. Also add the "frequency" extension to the clock signal.

With this patch, signal action reports a consistent state when "increase"
function is used, and the counting frequency:
    $ echo increase > function
    $ grep -H "" signal*_action
    signal0_action:none
    signal1_action:none
    signal2_action:rising edge
    $ echo 1 > enable
    $ cat count
    25425
    $ cat count
    44439
    $ cat ../signal2/frequency
    208877930

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-5-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
5679d5f76c counter: stm32-timer-cnt: adopt signal definitions
Adopt signals definitions to ease later signals additions.
There are no intended functional changes here.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-4-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
752923ccfd counter: stm32-timer-cnt: rename counter
The STM32 timer may count on various sources or channels. The counter
isn't specifically counting on channe1 1. So rename it to avoid a
confusion.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-3-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Fabrice Gasnier
f7131297d6 counter: stm32-timer-cnt: rename quadrature signal
Drop the Quadrature convention in the signal name. On stm32-timer:
- Quadrature A signal corresponds to timer input ch1, hence "Channel 1"
- Quadrature B signal corresponds to timer input ch2, hence "Channel 2".
So name these signals after their channel. I suspect it referred to the
(unique) quadrature counter support earlier, but the physical input
really is CH1/CH2. This will be easier to support other counter modes.

Reviewed-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Link: https://lore.kernel.org/r/20240307133306.383045-2-fabrice.gasnier@foss.st.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Ricardo B. Marliere
e0363c0706 counter: constify the struct device_type usage
Since commit aed65af1cc ("drivers: make device_type const"), the driver
core can properly handle constant struct device_type. Move the
counter_device_type variable to be a constant structure as well, placing it
into read-only memory which can not be modified at runtime.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net>
Link: https://lore.kernel.org/r/20240219-device_cleanup-counter-v1-1-24d0316ae815@marliere.net
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:34 -04:00
Ricardo B. Marliere
6b0828ca8b counter: make counter_bus_type const
Now that the driver core can properly handle constant struct bus_type,
move the counter_bus_type variable to be a constant structure as well,
placing it into read-only memory which can not be modified at runtime.

Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: "Ricardo B. Marliere" <ricardo@marliere.net>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20240204-bus_cleanup-counter-v1-1-cef9dd719bdc@marliere.net
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-04-02 13:10:33 -04:00
Nuno Sa
c83ccdc958 counter: fix privdata alignment
Aligning to the L1 cache does not guarantee the same alignment as
kmallocing an object [1]. Furthermore, in some platforms, that
alignment is not sufficient for DMA safety (in case someone wants
to have a DMA safe buffer in privdata) [2].

Sometime ago, we had the same fixes in IIO.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/devres.c#n35
[2]: https://lore.kernel.org/linux-iio/20220508175712.647246-2-jic23@kernel.org/

Fixes: c18e276030 ("counter: Provide alternative counter registration functions")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240209-counter-align-fix-v2-1-5777ea0a2722@analog.com
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
2024-02-16 18:51:00 -05:00