[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230616135922.442979-10-tomi.valkeinen@ideasonboard.com>
Date: Fri, 16 Jun 2023 16:59:13 +0300
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-i2c@...r.kernel.org,
Luca Ceresoli <luca.ceresoli@...tlin.com>,
Andy Shevchenko <andriy.shevchenko@...el.com>,
Matti Vaittinen <Matti.Vaittinen@...rohmeurope.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Wolfram Sang <wsa@...nel.org>, Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Peter Rosin <peda@...ntia.se>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Michael Tretter <m.tretter@...gutronix.de>,
Hans Verkuil <hverkuil@...all.nl>,
Mike Pagano <mpagano@...too.org>,
Krzysztof HaĆasa <khalasa@...p.pl>,
Marek Vasut <marex@...x.de>,
Satish Nagireddy <satish.nagireddy@...cruise.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Ludwig Zenz <lzenz@...electronics.com>
Subject: [PATCH v14 09/18] media: i2c: ds90ub960: Fix use of UB960_SR_FWD_CTL1
The driver does not update the forwarding bits in the UB960_SR_FWD_CTL1
register for ports that won't be used. This might leave port forwardings
enabled for unused ports, which might cause issues.
Fix this by making sure all the port forwardings are disabled by
default, and only enable the ones that are used.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
Reported-by: Ludwig Zenz <lzenz@...electronics.com>
Link: https://lore.kernel.org/all/20230516123549.3120-1-lzenz@dh-electronics.com/
---
drivers/media/i2c/ds90ub960.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
index ff939300c918..e101bcf2356a 100644
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@ -2330,7 +2330,8 @@ static int ub960_enable_rx_port(struct ub960_data *priv, unsigned int nport)
dev_dbg(dev, "enable RX port %u\n", nport);
/* Enable forwarding */
- return ub960_update_bits(priv, UB960_SR_FWD_CTL1, BIT(4 + nport), 0);
+ return ub960_update_bits(priv, UB960_SR_FWD_CTL1,
+ UB960_SR_FWD_CTL1_PORT_DIS(nport), 0);
}
static void ub960_disable_rx_port(struct ub960_data *priv, unsigned int nport)
@@ -2340,8 +2341,9 @@ static void ub960_disable_rx_port(struct ub960_data *priv, unsigned int nport)
dev_dbg(dev, "disable RX port %u\n", nport);
/* Disable forwarding */
- ub960_update_bits(priv, UB960_SR_FWD_CTL1, BIT(4 + nport),
- BIT(4 + nport));
+ ub960_update_bits(priv, UB960_SR_FWD_CTL1,
+ UB960_SR_FWD_CTL1_PORT_DIS(nport),
+ UB960_SR_FWD_CTL1_PORT_DIS(nport));
}
/*
@@ -2467,7 +2469,11 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv,
/* Configure RX ports */
- fwd_ctl = 0;
+ /*
+ * Keep all port forwardings disabled by default. Forwarding will be
+ * enabled in ub960_enable_rx_port.
+ */
+ fwd_ctl = GENMASK(7, 4);
for (nport = 0; nport < priv->hw_data->num_rxports; nport++) {
struct ub960_rxport *rxport = priv->rxports[nport];
@@ -2515,10 +2521,6 @@ static int ub960_configure_ports_for_streaming(struct ub960_data *priv,
break;
}
- /* Forwarding */
-
- fwd_ctl |= BIT(4 + nport); /* forward disable */
-
if (rx_data[nport].tx_port == 1)
fwd_ctl |= BIT(nport); /* forward to TX1 */
else
--
2.34.1
Powered by blists - more mailing lists