From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E5A0273D76 for ; Fri, 13 Feb 2026 16:05:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770998726; cv=none; b=B64LSudECqqaJHliFLYxvYgJp5en0Prtw8EqBpZD3gfpXbf35LdfgOHkZ7Sagr0UFjhrCVh52AN9loJrZsNri3OHGHIw9nJstDA64H9PmXAeWhEd3KlbnVJtd0WPGjQG4H5qXsy8FC3dDXQzyrN6kPwOHw5+E7ej7q7SU50WGYk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770998726; c=relaxed/simple; bh=li8j2JEFVMm0scO35dahdaq9bPSooqZRS2P/W5cQdRk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u/NMfAvR2ssKeVlTrkfdtGtWDBLqY6D9A+Kw4EpCZTyrtj/CWGFnLeUVdI875XUfto5dh/97HRKCWccK5pJONO3odc9lBD1vJWTvIRlFnu347DEZhYoqc0e2L12i/1tGmMDWOnlIOWKdPC9IUdq4zot/Tm3lzWbS3XRKE20u7dQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aQnHkqzU; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aQnHkqzU" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-3870d178a9aso10136321fa.0 for ; Fri, 13 Feb 2026 08:05:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770998724; x=1771603524; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=smt2I3TIoGWQUiQ+jL/+iEqgzDTzVh0P/C3zq5KAyl0=; b=aQnHkqzUelNg9+rpsVO9nAVfewLlJCb5yY1nH0xG/r0c0zPXsFUnTMMDouyhDHuNHL GBTwQjIqcuFDFVn2honpGhgL96TsMEhQL6DpkSp/WpfBwkxtvz28vN9iqeeABetC7WMz BCdMiTBMx7mXsQZ3hltfJXzW5SbDC2Z7Qu2aKsusFPclvmmVDezSQ2H07NgAOzD0F0fJ sXYoJGJ1cIwLwEmIbiBvo5Rk8kdtW8GBkFnoEMArTEB+lbieFiGdmNrBep+v3TlM6oCn 0rj/DRj+eKFWgPwVC2quIOp1jdpxXRxbqvm8f5Rol5wZKcMid2Wvi6OAsG6a0B5vCrJM 4ljw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770998724; x=1771603524; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=smt2I3TIoGWQUiQ+jL/+iEqgzDTzVh0P/C3zq5KAyl0=; b=uDhjsmHnqMbguBR8ocmXsMp4VHrDt1T20y0lQ0FroEx57pc5J9/FOpxRux21dYouJA 4xlTBX36K4o93zqYNfkQwQFd0VXJ+2sF6FlztqFFDmO6F2NunLi9SXzgY5XV2eMRkL9U QnAw4T0TWVQs00xhCDCuDQtCOSp+4dsQ9RJcHx5/Qn3C4x69NXd4hIdPzt3FEVmdcc6v YiW5B+eIxnC078M5Wj4PS1RlTu7vFxEx7zJ3g+PmXs38mJUfM8CYgUKcME7XWUBATI1k qxl2V3PUE/5SL+1lqmRD1h6sS0aoUFnPLSduOpKCH9e9dIJqxQu3/bwm6v2+xL9F1iLd I8+w== X-Forwarded-Encrypted: i=1; AJvYcCUf9o6OqNgJbQEOhbF+AjrvTflk0VvKy9JXGV2DHy0HEOtpbmneQPyVJuGVscWtQL86GwTw7qKFbT1/7HQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwQgSUh0iQhdaGlL6tRvuTHh7wePSGLqmhCkwlx01Tmqdd2IhTh UsiVbKwgvqPcgHpMfa5UuNLswdHYJuPqC33XGcr7Cd9tOppp1Zj+PUER X-Gm-Gg: AZuq6aLBauV+0LmESLbR1yQcr4FvbmyxBjYaNXozKULe6B/jShDehC++HYRAXE/WgOk ggW8QBe5oD7SwplPRnXxoMf8HAbndxGJeWX+DyH+AX2ugGCHfo/d1QKRkBbRTI/c+zackaxOZeH a63RMXOhPVyg3a+LenjIKgIfnTCznfAX0oiBPGtOZ7+pW2PaiSf3G04fWQWuc86c7HTuiXZco4V oM9UKSZt4XIzwV2siNRBrXd3xmMW5bvIZOSUcg6EJjxFm3Yb7mL1tPji1TcpZnSiIEY2mK04Ski 1HRDsc6td7CiOlAgVyT/mNmayZ7WQ86b6UkYsdk64RACH6GR/bLD0ESH0aWXIX77opPfH99ygFi QLoJtah7C4J/dZyR28KmyJM1N4I8intOIoy+vDPviHbLKNbSwV8yUIqgFRqJub4E2u+M4XXJJtv bMd57RP+tfgEkjTuskLxcAP9JShbFZb33lZnZTfnbWntj3JFYDT+tlgdDbS+kx X-Received: by 2002:a05:651c:2210:b0:385:d162:bf3d with SMTP id 38308e7fff4ca-3881050bed6mr7426771fa.4.1770998722513; Fri, 13 Feb 2026 08:05:22 -0800 (PST) Received: from gmail.com (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-387068923aasm13048961fa.3.2026.02.13.08.05.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Feb 2026 08:05:21 -0800 (PST) Date: Fri, 13 Feb 2026 17:05:19 +0100 From: Marcus Folkesson To: Peter Rosin Cc: Wolfram Sang , Michael Hennerich , Bartosz Golaszewski , Andi Shyti , Bartosz Golaszewski , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v5 2/5] i2c: mux: add support for per channel bus frequency Message-ID: References: <20260213-i2c-mux-v5-0-fb2cbf9979b3@gmail.com> <20260213-i2c-mux-v5-2-fb2cbf9979b3@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="6fcNXqbn+kKd91zT" Content-Disposition: inline In-Reply-To: --6fcNXqbn+kKd91zT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Peter! On Fri, Feb 13, 2026 at 12:48:13PM +0100, Peter Rosin wrote: > Hi! >=20 [...] > > + if (priv->adap.clock_hz && priv->adap.clock_hz !=3D parent->clock_hz)= { > > + mux_locked_ancestor =3D i2c_mux_topmost_mux_locked(adap); > > + root =3D 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. > > + */ >=20 > 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; M= 1 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. >=20 >=20 > > + if (mux_locked_ancestor) > > + i2c_lock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER); > > + > > + ret =3D 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; > > + } > > + } > > + >=20 > Here, you set the frequency /before/ ->select. >=20 > > + return muxc->select(muxc, priv->chan_id); > > +} > > + > > +static void i2c_mux_deselect_chan(struct i2c_adapter *adap, u32 chan_i= d) > > +{ > > + struct i2c_mux_priv *priv =3D adap->algo_data; > > + struct i2c_mux_core *muxc =3D priv->muxc; > > + struct i2c_adapter *parent =3D muxc->parent; > > + struct i2c_mux_core *mux_locked_ancestor =3D NULL; > > + struct i2c_adapter *root; > > + int ret; >=20 > And here, you restore the frequency, but /before/ ->deselect. >=20 > Thers's no symmetry in that... Good point, I will change that. >=20 > Cheers, > Peter Best regards, Marcus Folkesson --6fcNXqbn+kKd91zT Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmmPS7sACgkQiIBOb1ld UjJCaA//X2a3lgD8Yp6cOmM9sQs3eZosPkXjeUxzy15UbQSZrNOGnU3D/Ujz2CSQ QMwdD+KJKws3jTcawHXesvP8P5zePLAo+/Gj78jqJb9QWK6zEdTi4mJLKBDdaSG8 L9UzSJF17NuHfolZ/nAVo3s84jooY4ZE3PU22FPoJzmwtRU28pyl7JKUQLTz8UT8 25AtgTtO8OfYrYiNXcNilZ2ZqwEgamhE9q8U6GKjErrsDJFG97Pal795bis3fUVu JChwmQ/HT2NZhK/aXBGxqVqEYIirQL/0MC7ZbN4wnEtK2MqNXkwKK5if2Or6pKbE tP4Ijg5OXrtQsqUhsRbmfxH3Jb5MJsgvmxbde8NPAi0s4nc4IAicL2Ld1ZyaHSXF pZ0LiekLFCN+BJH3adCaPWUmu6hIxK9oLqXkNTxtZVXEai2ealPBeq1v1F1QfBkx XrJhb6NRFI82H20vZnAXJyN5z80fVeJHhv527zNwfFpvUIr5itDfB9uDBprDNFiI jpqwdxILKG4eP6OglarXcBWrVLMrqx+1YsEhTQUOvSMlqa+P6JIDFDhYxR9B+sdM lser0vwQyOBt3mrLkyJJCC/HDjZcdbZ2Q0WRRjiSyUlWoiaRD7wPNXpBHZLfyAqW KdOHkIJOJa0QgDJ00I9RfuzhHi5Zv2JtHnzoOBNkpagfCbbh8hY= =AYL/ -----END PGP SIGNATURE----- --6fcNXqbn+kKd91zT--