summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAswin Murugan <[email protected]>2026-01-07 21:05:04 +0530
committerCasey Connolly <[email protected]>2026-01-14 16:25:09 +0100
commit7966d35b1fee1a3f4032379b08af7440a79c763b (patch)
tree366e4521ee40e517c67dc789a3856555562afd51 /drivers
parent9be4f2f5f4d0b8327befde42c743336fa63fc43b (diff)
spmi: msm: refine handling of multiple APID mappings
PMIC Arbiter may expose multiple owned and non-owned APIDs per SID/PID. - Keep current mapping if it is OWNED and a NON-OWNED appears. - Always update when a NEW OWNED APID appears (make writable). - If current is NON-OWNED and a new NON-OWNED appears, update to it (remain read-only). This avoids write-access violations when not using the newly discovered owned channels. Signed-off-by: Aswin Murugan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Casey Connolly <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/spmi/spmi-msm.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/spmi/spmi-msm.c b/drivers/spmi/spmi-msm.c
index faae54e9fef..f3cd98c3db8 100644
--- a/drivers/spmi/spmi-msm.c
+++ b/drivers/spmi/spmi-msm.c
@@ -274,10 +274,25 @@ static void msm_spmi_channel_map_v5(struct msm_spmi_priv *priv, unsigned int i,
priv->channel_map[slave_id][pid] = i | SPMI_CHANNEL_VALID;
if (owner != priv->owner)
priv->channel_map[slave_id][pid] |= SPMI_CHANNEL_READ_ONLY;
- } else if ((owner == priv->owner) && prev_read_only) {
- /* Read only and we found one we own, switch */
+
+ } else if (owner == priv->owner) {
+ /*
+ * Found a channel owned by our EE - ALWAYS switch to it!
+ * even if we already have a mapping, we must prefer the one
+ * owned by our EE to avoid hardware access violations.
+ */
priv->channel_map[slave_id][pid] = i | SPMI_CHANNEL_VALID;
+ /* Clear READ_ONLY flag since we own this channel */
+
+ } else if (prev_read_only) {
+ /*
+ * Previous mapping was read-only and this one is also not ours.
+ * Update to this channel.
+ */
+ priv->channel_map[slave_id][pid] = i | SPMI_CHANNEL_VALID | SPMI_CHANNEL_READ_ONLY;
+
}
+ /* else: Previous was writable and owned by us, this one isn't - keep previous */
}
static int msm_spmi_probe(struct udevice *dev)