diff mbox series

[03/13] media: i2c: ds90ub960: Fix use of non-existing registers on UB9702

Message ID 20241004-ub9xx-fixes-v1-3-e30a4633c786@ideasonboard.com
State Superseded
Headers show
Series media: i2c: ds90ub9xx: Misc fixes and improvements | expand

Commit Message

Tomi Valkeinen Oct. 4, 2024, 2:46 p.m. UTC
UB9702 doesn't have the registers for SP and EQ. Adjust the code in
ub960_rxport_wait_locks() to not use those registers for UB9702. As
these values are only used for a debug print here, there's no functional
change.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Fixes: afe267f2d368 ("media: i2c: add DS90UB960 driver")
---
 drivers/media/i2c/ds90ub960.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

Comments

Andy Shevchenko Oct. 10, 2024, 1:55 p.m. UTC | #1
On Fri, Oct 04, 2024 at 05:46:34PM +0300, Tomi Valkeinen wrote:
> UB9702 doesn't have the registers for SP and EQ. Adjust the code in
> ub960_rxport_wait_locks() to not use those registers for UB9702. As
> these values are only used for a debug print here, there's no functional
> change.

...

> +		if (priv->hw_data->is_ub9702) {
> +			dev_dbg(dev, "\trx%u: locked, freq %llu Hz\n",
> +				nport, (v * 1000000ULL) >> 8);

Perhaps HZ_PER_MHZ?

> +		} else {

...

> +			dev_dbg(dev,
> +				"\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n",
> +				nport, strobe_pos, eq_level,
> +				(v * 1000000ULL) >> 8);

Ditto.

> +		}
diff mbox series

Patch

diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c
index b1e848678218..24198b803eff 100644
--- a/drivers/media/i2c/ds90ub960.c
+++ b/drivers/media/i2c/ds90ub960.c
@@ -1577,16 +1577,24 @@  static int ub960_rxport_wait_locks(struct ub960_data *priv,
 
 		ub960_rxport_read16(priv, nport, UB960_RR_RX_FREQ_HIGH, &v);
 
-		ret = ub960_rxport_get_strobe_pos(priv, nport, &strobe_pos);
-		if (ret)
-			return ret;
+		if (priv->hw_data->is_ub9702) {
+			dev_dbg(dev, "\trx%u: locked, freq %llu Hz\n",
+				nport, (v * 1000000ULL) >> 8);
+		} else {
+			ret = ub960_rxport_get_strobe_pos(priv, nport,
+							  &strobe_pos);
+			if (ret)
+				return ret;
 
-		ret = ub960_rxport_get_eq_level(priv, nport, &eq_level);
-		if (ret)
-			return ret;
+			ret = ub960_rxport_get_eq_level(priv, nport, &eq_level);
+			if (ret)
+				return ret;
 
-		dev_dbg(dev, "\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n",
-			nport, strobe_pos, eq_level, (v * 1000000ULL) >> 8);
+			dev_dbg(dev,
+				"\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n",
+				nport, strobe_pos, eq_level,
+				(v * 1000000ULL) >> 8);
+		}
 	}
 
 	return 0;