All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org,
	Prasad Kumpatla <quic_pkumpatl@quicinc.com>,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Mark Brown <broonie@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.10 46/80] regmap-irq: Update interrupt clear register for proper reset
Date: Mon, 28 Feb 2022 18:24:27 +0100	[thread overview]
Message-ID: <20220228172317.218502231@linuxfoundation.org> (raw)
In-Reply-To: <20220228172311.789892158@linuxfoundation.org>

From: Prasad Kumpatla <quic_pkumpatl@quicinc.com>

[ Upstream commit d04ad245d67a3991dfea5e108e4c452c2ab39bac ]

With the existing logic where clear_ack is true (HW doesn’t support
auto clear for ICR), interrupt clear register reset is not handled
properly. Due to this only the first interrupts get processed properly
and further interrupts are blocked due to not resetting interrupt
clear register.

Example for issue case where Invert_ack is false and clear_ack is true:

    Say Default ISR=0x00 & ICR=0x00 and ISR is triggered with 2
    interrupts making ISR = 0x11.

    Step 1: Say ISR is set 0x11 (store status_buff = ISR). ISR needs to
            be cleared with the help of ICR once the Interrupt is processed.

    Step 2: Write ICR = 0x11 (status_buff), this will clear the ISR to 0x00.

    Step 3: Issue - In the existing code, ICR is written with ICR =
            ~(status_buff) i.e ICR = 0xEE -> This will block all the interrupts
            from raising except for interrupts 0 and 4. So expectation here is to
            reset ICR, which will unblock all the interrupts.

            if (chip->clear_ack) {
                 if (chip->ack_invert && !ret)
                  ........
                 else if (!ret)
                     ret = regmap_write(map, reg,
                            ~data->status_buf[i]);

So writing 0 and 0xff (when ack_invert is true) should have no effect, other
than clearing the ACKs just set.

Fixes: 3a6f0fb7b8eb ("regmap: irq: Add support to clear ack registers")
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20220217085007.30218-1-quic_pkumpatl@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/base/regmap/regmap-irq.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/base/regmap/regmap-irq.c b/drivers/base/regmap/regmap-irq.c
index ad5c2de395d1f..87c5c421e0f46 100644
--- a/drivers/base/regmap/regmap-irq.c
+++ b/drivers/base/regmap/regmap-irq.c
@@ -170,11 +170,9 @@ static void regmap_irq_sync_unlock(struct irq_data *data)
 				ret = regmap_write(map, reg, d->mask_buf[i]);
 			if (d->chip->clear_ack) {
 				if (d->chip->ack_invert && !ret)
-					ret = regmap_write(map, reg,
-							   d->mask_buf[i]);
+					ret = regmap_write(map, reg, UINT_MAX);
 				else if (!ret)
-					ret = regmap_write(map, reg,
-							   ~d->mask_buf[i]);
+					ret = regmap_write(map, reg, 0);
 			}
 			if (ret != 0)
 				dev_err(d->map->dev, "Failed to ack 0x%x: %d\n",
@@ -509,11 +507,9 @@ static irqreturn_t regmap_irq_thread(int irq, void *d)
 						data->status_buf[i]);
 			if (chip->clear_ack) {
 				if (chip->ack_invert && !ret)
-					ret = regmap_write(map, reg,
-							data->status_buf[i]);
+					ret = regmap_write(map, reg, UINT_MAX);
 				else if (!ret)
-					ret = regmap_write(map, reg,
-							~data->status_buf[i]);
+					ret = regmap_write(map, reg, 0);
 			}
 			if (ret != 0)
 				dev_err(map->dev, "Failed to ack 0x%x: %d\n",
@@ -745,13 +741,9 @@ int regmap_add_irq_chip_fwnode(struct fwnode_handle *fwnode,
 					d->status_buf[i] & d->mask_buf[i]);
 			if (chip->clear_ack) {
 				if (chip->ack_invert && !ret)
-					ret = regmap_write(map, reg,
-						(d->status_buf[i] &
-						 d->mask_buf[i]));
+					ret = regmap_write(map, reg, UINT_MAX);
 				else if (!ret)
-					ret = regmap_write(map, reg,
-						~(d->status_buf[i] &
-						  d->mask_buf[i]));
+					ret = regmap_write(map, reg, 0);
 			}
 			if (ret != 0) {
 				dev_err(map->dev, "Failed to ack 0x%x: %d\n",
-- 
2.34.1




  parent reply	other threads:[~2022-02-28 17:44 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-28 17:23 [PATCH 5.10 00/80] 5.10.103-rc1 review Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 01/80] cgroup/cpuset: Fix a race between cpuset_attach() and cpu hotplug Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 02/80] btrfs: tree-checker: check item_size for inode_item Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 03/80] btrfs: tree-checker: check item_size for dev_item Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 04/80] clk: jz4725b: fix mmc0 clock gating Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 05/80] vhost/vsock: dont check owner in vhost_vsock_stop() while releasing Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 06/80] parisc/unaligned: Fix fldd and fstd unaligned handlers on 32-bit kernel Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 07/80] parisc/unaligned: Fix ldw() and stw() unalignment handlers Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 08/80] KVM: x86/mmu: make apf token non-zero to fix bug Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 09/80] drm/amdgpu: disable MMHUB PG for Picasso Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 10/80] drm/amdgpu: check vm ready by amdgpu_vm->evicting flag Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 11/80] drm/i915: Correctly populate use_sagv_wm for all pipes Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 12/80] sr9700: sanity check for packet length Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 13/80] USB: zaurus: support another broken Zaurus Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 14/80] CDC-NCM: avoid overflow in sanity checking Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 15/80] netfilter: nf_tables_offload: incorrect flow offload action array size Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 16/80] x86/fpu: Correct pkru/xstate inconsistency Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 17/80] tee: export teedev_open() and teedev_close_context() Greg Kroah-Hartman
2022-02-28 17:23 ` [PATCH 5.10 18/80] optee: use driver internal tee_context for some rpc Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 19/80] ping: remove pr_err from ping_lookup Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 20/80] perf data: Fix double free in perf_session__delete() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 21/80] bnx2x: fix driver load from initrd Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 22/80] bnxt_en: Fix active FEC reporting to ethtool Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 23/80] hwmon: Handle failure to register sensor with thermal zone correctly Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 24/80] bpf: Do not try bpf_msg_push_data with len 0 Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 25/80] selftests: bpf: Check bpf_msg_push_data return value Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 26/80] bpf: Add schedule points in batch ops Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 27/80] io_uring: add a schedule point in io_add_buffers() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 28/80] net: __pskb_pull_tail() & pskb_carve_frag_list() drop_monitor friends Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 29/80] tipc: Fix end of loop tests for list_for_each_entry() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 30/80] gso: do not skip outer ip header in case of ipip and net_failover Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 31/80] openvswitch: Fix setting ipv6 fields causing hw csum failure Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 32/80] drm/edid: Always set RGB444 Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 33/80] net/mlx5e: Fix wrong return value on ioctl EEPROM query failure Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 34/80] net/sched: act_ct: Fix flow table lookup after ct clear or switching zones Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 35/80] net: ll_temac: check the return value of devm_kmalloc() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 36/80] net: Force inlining of checksum functions in net/checksum.h Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 37/80] nfp: flower: Fix a potential leak in nfp_tunnel_add_shared_mac() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 38/80] netfilter: nf_tables: fix memory leak during stateful obj update Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 39/80] net/smc: Use a mutex for locking "struct smc_pnettable" Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 40/80] surface: surface3_power: Fix battery readings on batteries without a serial number Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 41/80] udp_tunnel: Fix end of loop test in udp_tunnel_nic_unregister() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 42/80] net/mlx5: Fix possible deadlock on rule deletion Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 43/80] net/mlx5: Fix wrong limitation of metadata match on ecpf Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 44/80] net/mlx5e: kTLS, Use CHECKSUM_UNNECESSARY for device-offloaded packets Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 45/80] spi: spi-zynq-qspi: Fix a NULL pointer dereference in zynq_qspi_exec_mem_op() Greg Kroah-Hartman
2022-02-28 17:24 ` Greg Kroah-Hartman [this message]
2022-02-28 17:24 ` [PATCH 5.10 47/80] RDMA/rtrs-clt: Fix possible double free in error case Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 48/80] RDMA/rtrs-clt: Kill wait_for_inflight_permits Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 49/80] RDMA/rtrs-clt: Move free_permit from free_clt to rtrs_clt_close Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 50/80] configfs: fix a race in configfs_{,un}register_subsystem() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 51/80] RDMA/ib_srp: Fix a deadlock Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 52/80] tracing: Have traceon and traceoff trigger honor the instance Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 53/80] iio: adc: men_z188_adc: Fix a resource leak in an error handling path Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 54/80] iio: adc: ad7124: fix mask used for setting AIN_BUFP & AIN_BUFM bits Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 55/80] iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 56/80] iio: Fix error handling for PM Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 57/80] sc16is7xx: Fix for incorrect data being transmitted Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 58/80] ata: pata_hpt37x: disable primary channel on HPT371 Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 59/80] Revert "USB: serial: ch341: add new Product ID for CH341A" Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 60/80] usb: gadget: rndis: add spinlock for rndis response list Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 61/80] USB: gadget: validate endpoint index for xilinx udc Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 62/80] tracefs: Set the group ownership in apply_options() not parse_options() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 63/80] USB: serial: option: add support for DW5829e Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 64/80] USB: serial: option: add Telit LE910R1 compositions Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 65/80] usb: dwc2: drd: fix soft connect when gadget is unconfigured Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 66/80] usb: dwc3: pci: Fix Bay Trail phy GPIO mappings Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 67/80] usb: dwc3: gadget: Let the interrupt handler disable bottom halves Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 68/80] xhci: re-initialize the HC during resume if HCE was set Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 69/80] xhci: Prevent futile URB re-submissions due to incorrect return value Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 70/80] driver core: Free DMA range map when device is released Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 71/80] RDMA/cma: Do not change route.addr.src_addr outside state checks Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 72/80] thermal: int340x: fix memory leak in int3400_notify() Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 73/80] riscv: fix oops caused by irqsoff latency tracer Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 74/80] tty: n_gsm: fix encoding of control signal octet bit DV Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 75/80] tty: n_gsm: fix proper link termination after failed open Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 76/80] tty: n_gsm: fix NULL pointer access due to DLCI release Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 77/80] tty: n_gsm: fix wrong tty control line for flow control Greg Kroah-Hartman
2022-02-28 17:24 ` [PATCH 5.10 78/80] tty: n_gsm: fix deadlock in gsmtty_open() Greg Kroah-Hartman
2022-02-28 17:25 ` [PATCH 5.10 79/80] gpio: tegra186: Fix chip_data type confusion Greg Kroah-Hartman
2022-02-28 17:25 ` [PATCH 5.10 80/80] memblock: use kfree() to release kmalloced memblock regions Greg Kroah-Hartman
2022-02-28 21:21 ` [PATCH 5.10 00/80] 5.10.103-rc1 review Pavel Machek
2022-02-28 21:39 ` Shuah Khan
2022-02-28 23:29 ` Florian Fainelli
2022-03-01  9:13 ` Jon Hunter
2022-03-01  9:38 ` Bagas Sanjaya
2022-03-01  9:57 ` Naresh Kamboju
2022-03-01 11:36 ` Sudip Mukherjee
2022-03-01 19:14 ` Guenter Roeck
2022-03-02  7:04 ` Slade Watkins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220228172317.218502231@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=quic_pkumpatl@quicinc.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.