Hi Peter! On Fri, Feb 13, 2026 at 12:48:13PM +0100, Peter Rosin wrote: > Hi! > [...] > > + if (priv->adap.clock_hz && priv->adap.clock_hz != parent->clock_hz) { > > + mux_locked_ancestor = i2c_mux_topmost_mux_locked(adap); > > + root = i2c_root_adapter(&adap->dev); > > + > > + /* > > + * If there's a mux-locked mux in our ancestry, lock the parent > > + * of the topmost one. Mux-locked muxes don't propagate locking > > + * to their parents, so we must explicitly acquire the lock above > > + * the highest mux-locked ancestor to reach the root adapter. > > + */ > > As may be more apparent from my recent v4 response(?), this is not > what you want. You want mux_locked_ancestor to be the nearest > mux-locked ancestor. Hrm, I think we are pointing at the same thing but naming it differently; M1 in this chain: Root - P1 - M1 - M2 - P2 - D1 I'm thinking 'topmost' means the one closest to the root (ancestor most far away), but I don't stick to that naming and I am happy to change it. > > > > + if (mux_locked_ancestor) > > + i2c_lock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER); > > + > > + ret = i2c_adapter_set_clk_freq(root, priv->adap.clock_hz); > > + > > + if (mux_locked_ancestor) > > + i2c_unlock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER); > > + > > + if (ret < 0) { > > + dev_err(&adap->dev, > > + "Failed to set clock frequency %dHz on root adapter %s: %d\n", > > + priv->adap.clock_hz, root->name, ret); > > + > > + return ret; > > + } > > + } > > + > > Here, you set the frequency /before/ ->select. > > > + return muxc->select(muxc, priv->chan_id); > > +} > > + > > +static void i2c_mux_deselect_chan(struct i2c_adapter *adap, u32 chan_id) > > +{ > > + struct i2c_mux_priv *priv = adap->algo_data; > > + struct i2c_mux_core *muxc = priv->muxc; > > + struct i2c_adapter *parent = muxc->parent; > > + struct i2c_mux_core *mux_locked_ancestor = NULL; > > + struct i2c_adapter *root; > > + int ret; > > And here, you restore the frequency, but /before/ ->deselect. > > Thers's no symmetry in that... Good point, I will change that. > > Cheers, > Peter Best regards, Marcus Folkesson