Re: [PATCH 18/19] media: i2c: ds90ub960: Configure serializer using back-channel

From: Tomi Valkeinen
Date: Fri Jan 24 2025 - 08:30:02 EST


Hi,

On 15/01/2025 16:29, Sakari Ailus wrote:
Moi,

On Fri, Jan 10, 2025 at 11:14:18AM +0200, Tomi Valkeinen wrote:
@@ -2956,6 +3033,36 @@ static int ub960_init_rx_ports_ub9702(struct ub960_data *priv)
if (ret)
return ret;
+ for_each_active_rxport(priv) {
+ if (it.rxport->ser.addr >= 0) {
+ /*
+ * Set serializer's I2C address if set in the dts file,
+ * and freeze it to prevent updates from the FC.
+ */
+ ub960_rxport_write(priv, it.nport, UB960_RR_SER_ID,
+ it.rxport->ser.addr << 1 |
+ UB960_RR_SER_ID_FREEZE_DEVICE_ID,
+ &ret);
+ }
+
+ /* Set serializer I2C alias with auto-ack */
+ ub960_rxport_write(priv, it.nport, UB960_RR_SER_ALIAS_ID,
+ it.rxport->ser.alias << 1 |
+ UB960_RR_SER_ALIAS_ID_AUTO_ACK, &ret);
+
+ if (ret)
+ return ret;
+ }
+
+ for_each_active_rxport(priv) {
+ if (fwnode_device_is_compatible(it.rxport->ser.fwnode,
+ "ti,ds90ub971-q1")) {

I guess one instance is fine but consider using match data instead.

This is checking the model of the (remote) serializer, not the deserializer (which this driver deals with).

Unfortunately we need to do some early configuration before the serializer driver probes, and that configuration depends on the serializer model.

We could, perhaps, get the serializer models once and store it in the rxport data for later use.

Tomi