From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 A5B583A8F7 for ; Mon, 20 Oct 2025 07:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760944680; cv=none; b=GWOudBK0N4zAWLyixy/zv+bqUHUKx7ibrlS0KPvTX9I9Rv7DO/Nf9mWCuF60egJJdEzkmmGLhE16u9y/kDn7SZd/XaQaeP6Zluybk+qFwG8ALgY75Ukt+MwLcvX3FSQPBJs5z6JO9UAWplvm/vDD2Iv6XKKzX0B+oid/vauoS94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760944680; c=relaxed/simple; bh=4QBKB6Il0FtSYd/ap/LeXMOphioqXNw9dMPyFWJ8QJI=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=OdRexVnkBO4mN8cyskSy/6+VuBIVjmmzHTDA6+H+i33UR98kThZz7wVRyUskJ2FxwtEGulAPlEsV4JMlf0Ijtfx85gCjxewgjgEhFAqUVO+WvHPopMioGHOr56MYG/DgiLnCOiLD6BxM0Sr0k7tH04wkexmVdgJeoXSAm3o4tjs= 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=Kp3MTYtF; arc=none smtp.client-ip=209.85.167.50 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="Kp3MTYtF" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-58d29830058so4770838e87.0 for ; Mon, 20 Oct 2025 00:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1760944677; x=1761549477; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:from:to:cc:subject:date:message-id:reply-to; bh=dc0V6uSK5r5A6NQwmKa55NukJxjqQrLEAaKU2mAU2+s=; b=Kp3MTYtFbQWv9evS7ICdGO5yTpVshRKROtwczbTJS4kABgjbCeRi18QOYLd8n2fjK6 vqg0KF8uTquy2FH0xg+ssPGkTH6SJA7nsuGKXf2chIu9cPhUNS7EcIVXCX71ruY8Kx33 2d7ZIakaeHxOB9Syt2dU7yZ+w9WIBD/2BQUVtS/x4fNhK0YU73RO6kN0CtdeHUAF7fgi 8AuJ4SRzOt6bhUHE6KZcDMYIw93ML3l3/s9L+w+KRQyvicyzT3S2f3UY/3ogsAtOPDIz 10HthIYF/vupwVqlLWZ1qqJKuxcMYlIrs2s2Hnx3chd119MaiIbaMc/mUGgRXmu4X566 9zmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760944677; x=1761549477; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dc0V6uSK5r5A6NQwmKa55NukJxjqQrLEAaKU2mAU2+s=; b=ck8GE9Vb+3szpiCdr8inV7XAscq5l85IrfQVk41FbApOSiovno6o4AiazbZlbpIL+T /miWUmhaXh8DceUDM0iCBIGZXomhhOMozIFyMvI7EqCosxihDX7fWPcoTKmrM3W8eNXC YVKU26JI1q0FlmMKXcBUzvMT37DrCTQ11zK35oPJiTHRBCaEwqRGxN6G7udLXoKuri4C 37TFlBbjOcVTZYkQDT5pVqxBclH/fxha8AMJxzZon2xwORsUoO7ykFQmDOXU3mWJ4doG yk1ZELLZyr/gDBYWPcBRlIBhrUkk9LvJaVWUaIiMjWEIoreS+8oqU7QY3quNPW+qcO7d bBnQ== X-Forwarded-Encrypted: i=1; AJvYcCXOnrR8JYwpkot8AWq4fFvO35Oczf/Wp1q2Awbm9BmzMEWSnY5fwZg2EfqW6VO399Evim9HWloyYpcrJtQ=@vger.kernel.org X-Gm-Message-State: AOJu0Yymqi+WjU6veGdDEQkeOcxGF4KYVX2lpSLxXL02aJDJ47co8rAh UBlr57+lmgmB+vIncEko8I4v5eHDvSUGHoycWLVwPr04aZ+4H9An8Lxb X-Gm-Gg: ASbGncvSwmOHwMDa0CAEjn1VveFfPEv4ayeD0jWsrJS9ST/VxW0UxyQ3Q7ewkWwXBfp iVMhktjj86ZDXWm7R04uT7ycKka1DC05GqxtQFFGvEJNIJSQ7j7aJ93xgIHGAdhidycIMB7ZStd Ss1XKwu7HnnVPCmRYnaFAIKYo/62rtwjNdV+C/6/jif5so6URmHNgsT/0beTo2o+nzA0Q6utLQS ZpC/WS7c2SUZD1gS2DwqUwBCylsUjIYIH3/W6R1Tjpp4gPKUktKEDMhUxt5G6KblnolWbNQRRAl eOIbMTnMR8NglEod5KgS/yrkb+3cn4nIfBTsTI1WiP8MtLonZK15HHMXbvrtZg3kztsUrZCslEv wm3QZ+kbt2qJqIADWSiXG+2oN88MNo1L0eFl2+v/tEhHBUYM73/4yShPQM6tTYnvkFgYRPeQAC+ zt1Xd3dL0D5aTmbedc/dmh0fJTtj8Xle93n4OlYaLHT23RG/LBQPzYK+Y= X-Google-Smtp-Source: AGHT+IFIUr81RYs1HnZHUDaeh17UXtMO+MIIH4Sl+yVvk+zd3TV85RaBPn3bfogTKTF+CcTwgZ/zgg== X-Received: by 2002:a2e:be88:0:b0:36d:a459:f0a4 with SMTP id 38308e7fff4ca-3779782374emr39869861fa.5.1760944676478; Mon, 20 Oct 2025 00:17:56 -0700 (PDT) Received: from [192.168.1.168] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-377a921ae62sm18863341fa.21.2025.10.20.00.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Oct 2025 00:17:55 -0700 (PDT) From: Marcus Folkesson Subject: [PATCH v3 0/5] I2C Mux per channel bus speed Date: Mon, 20 Oct 2025 09:17:23 +0200 Message-Id: <20251020-i2c-mux-v3-0-908ac5cf9223@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAPi9WgC/02MwQ6CMBAFf4X0bM12Cw315H8YD6WtsImAabXBE P7dQgzhOC9vZmbRB/KRXYqZBZ8o0jhkkKeC2c4MrefkMjMErEALyQkt7z8TbwCUdB6NLx3L71f wD5q20u2euaP4HsN3Cyexrv8G4t5IggPH2urSKAFawrXtDT3PduzZ2ki4ewLg4GH2GqXrSpXW6 UodvWVZfl4u8ojWAAAA X-Change-ID: 20250913-i2c-mux-b0063de2ae4d To: Wolfram Sang , Peter Rosin , Michael Hennerich , Bartosz Golaszewski , Andi Shyti Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Marcus Folkesson , Bartosz Golaszewski X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2666; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=4QBKB6Il0FtSYd/ap/LeXMOphioqXNw9dMPyFWJ8QJI=; b=owEBbQKS/ZANAwAKAYiATm9ZXVIyAcsmYgBo9eIEheq7Rqmcp7HaHOoJV1mtgdBS1lD+tswqa CBMXmGlcneJAjMEAAEKAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaPXiBAAKCRCIgE5vWV1S MtfnD/9lcCqltRfYcuFLqJaGS85PuVBltcB/MmI4glYwIypiT86qEbIRd/znRNdYvwN5eUJw9m/ 1smtKC9UIIZ0brBXY+kGiNagQ3TZMxVu5tkMPuYWwRsr9Ew8bIQgZ7KDrzKHGjkvLGSg04lV21g sahrz1WrWqNkiPYqx+cs14PLmDCejJ+I4cA5CdWItiGHuFWnP5a+A1Y9ybeNYqviGmTZU22v2kO rsud7o993aMfWsb2qKz08cPr51wR/qIhoqdLK5vwlNOWXovKcPAYj+xA+w4++hV45tXM/UDnkOi DJ0MCxAfBGt1+tX4HgugIDJbCoWZ9m9wwyB9rABvR+Lc+AmvQ9z4uuAHOZl+xehPq1hrG/G34HC L3GhqXsuq7DVMdmS/OTF1gXskhLY5vYb+mWWUTiC1/CAlm4Ww7948aiJfZi3byW2cFSq2JSdcpv se73CpFn3fAI4jnTqNeOq+UN+JiaRdAaHFSAy+PWTap5YGwEFKaczF04MgpWheKBIcVt19l90IE hSYoqKrnOfjvcvWuLY5IrYuCwlEU7/qG4SNjpMNNjOoZcjfErHNzlKiNmuBehPq5bymf1f8eYD7 uWm6x9IJJSEjc4bGO2cy6mc7bpVr2e7T70dT0uPI/XoOJDpcnnCzYzYr86CLLs5x+2fBTinYFR3 iUOLAlBmvPYXRHA== X-Developer-Key: i=marcus.folkesson@gmail.com; a=openpgp; fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127 This was a RFC on how to implement a feature to have different bus speeds on different channels with an I2C multiplexer/switch. As no major complaints on the design came up during the review, I decided to submit the series without the RFC tag. The benefit with this feature is that you may group devices after the fastest bus speed they can handle. A real-world example is that you could have e.g. a display running @400kHz and a smart battery running @100kHz using the same I2C controller. There are many corner cases where this may cause a problem for some hardware topologies. I've tried to describe those I could think of in the documentation, see Patch #5. E.g. one risk is that if the mux driver does not disconnect channels when Idle, this may cause a higher frequency to "leak" through to devices that are supposed to run at lower bus speed. This is not only a "problem" for changing bus speed but could also be an issue for potential address conflicts. The implementation is split up into several patches: Patch #1 Introduce a callback for the i2c controller to set bus speed Patch #2 Introduce functionality to adjust bus speed depending on mux channel. Patch #3 Cleanup i2c-davinci driver a bit to prepare it for set_clk_freq Parch #4 Implement set_clk_freq for the i2c-davinci driver Parch #5 Update documentation with this feature Signed-off-by: Marcus Folkesson --- Changes in v3: - Return -EINVAL if channel is faster than parent (kernel test robot) - Link to v2: https://lore.kernel.org/r/20251002-i2c-mux-v2-0-b698564cd956@gmail.com Changes in v2: - Changed bus_freq field to bus_freq_hz in davinci_i2c_dev (Bartosz Golaszewski) - Removed idle_state from mux core (Peter Rosin) - Link to v1: https://lore.kernel.org/r/20250922-i2c-mux-v1-0-28c94a610930@gmail.com --- Marcus Folkesson (5): i2c: core: add callback to change bus frequency i2c: mux: add support for per channel bus frequency i2c: davinci: calculate bus freq from Hz instead of kHz i2c: davinci: add support for setting bus frequency docs: i2c: i2c-topology: add section about bus speed Documentation/i2c/i2c-topology.rst | 176 +++++++++++++++++++++++++++++++++++++ drivers/i2c/busses/i2c-davinci.c | 41 ++++++--- drivers/i2c/i2c-mux.c | 116 +++++++++++++++++++++--- include/linux/i2c.h | 13 +++ 4 files changed, 324 insertions(+), 22 deletions(-) --- base-commit: 22f20375f5b71f30c0d6896583b93b6e4bba7279 change-id: 20250913-i2c-mux-b0063de2ae4d Best regards, -- Marcus Folkesson