From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 A3396221FD0 for ; Tue, 2 Dec 2025 08:11:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764663072; cv=none; b=JVSjQasRIyEW9+DqMlE9HkH7/Q5cupKqf1qg2KUnXh9wusoROsDeFmL+Y2B5CgkOF0A3BXF/dk0yjBZ4N3ymndfrNAp3R9UuQ/mCV+pt7I27rZfPbbez7cZPWdMm1IX+vAPW+6xrCelMemiWTsRMlw6sRdWQvprwMxUATZnvIDw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764663072; c=relaxed/simple; bh=4QBKB6Il0FtSYd/ap/LeXMOphioqXNw9dMPyFWJ8QJI=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=jZt6QO9Q/dZ89Ggy3Oo83mbTZZt0fT8VRCZ/K+0WllYrfN/7ME4uCkzXo5yxcObSDswE+8p/7jsUuCMpiPDRPpUJu+hVOCMlI4fFLOptTnutCI/wSjKl0EbNTysERogRU4QpjRWGAnToHEkMhBtFXTL7XdpEliufrDjvc7lKBAc= 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=QsPy9Mrs; arc=none smtp.client-ip=209.85.167.46 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="QsPy9Mrs" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-59428d2d975so5169931e87.3 for ; Tue, 02 Dec 2025 00:11:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764663068; x=1765267868; 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=QsPy9Mrs3ntd2vBB3gHW5+w5Vuq5eMUPpuIiAArPz65YPxnHdbdNN/hlmLxp7j+cYA KgdHXp8/haCeykxWwXc4pQkI+108ld9ITbHZJfSl9pk+o4xAqbrzsJhqFSa75MUQTTtb Smc5L+l4KejzkkEayDzWX5an6vNHiu+2CdfGLankfazQKLzrFjcDkHnQdw7sTuXV6ZlW 0UJ5v9SfM9pH6TPeRxJn3FVpopfnJ/6XoIgJNCuqNXk3GOhAWX5QMoasr0ehIq7k9uR6 Harm3xOOpN1ou9mwAe1IJxBC6ejamQEiQlh4QhAj8CEJ1UdV8GR7RTQj0UUlpLqvWhPM KshA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764663068; x=1765267868; h=cc:to:content-transfer-encoding:mime-version:message-id:date :subject:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dc0V6uSK5r5A6NQwmKa55NukJxjqQrLEAaKU2mAU2+s=; b=RpTcmzzBxgevhuAzM0nMTVy0OBgLhKgBtErAoI94B2eMWxhTk2rZLrycRUlOwWjm4W xyJy4MONmIPmr99SRyRLp+X5aLU63tdCAY96DUIt4Xy9rcYxvMSc8nQKiXUsusCk/hom je22OkApX+tqU/aAm7+2dDv4J7AFR1quZYJb7ifZxtfbaZi3ftcl1wivo4TA7U3W9hz6 nslJKwJMxUMTTkShQktt8he5fXlqokU4Zi8mLhTPHg1JwupjBe/gHEwKuyMvrjKxgInx 55SIuhr29HEtWbSAvhoJzGga4xKHLarvsPPvVgKonLr8a+Hx+NTDPOgiODUzkM5F/i74 oEAA== X-Forwarded-Encrypted: i=1; AJvYcCWnmxLhZ9ypSEsVkjKZM2ULDSKUwhQH3ut7/R/lpscbNoW0RpLrFXwkqr8kyNROrmOQwKfF+CJkQVC5vNg=@vger.kernel.org X-Gm-Message-State: AOJu0YzRGm79JCepNyhHLMKhi16ESYYhsPo6MQha9LNwsBxCfURMwSDO xHeb4j75lzjZLM2vQ7O8U8qA7/mYChn8jlk+fZxZigIF9uFaARBH7/Ys X-Gm-Gg: ASbGncsLb5qI5icj48TlVxiTjf+ExL4O9V794isMMBbFu4c2axGQES53DXlypNi9zF6 sNOn/oWPoR1cBFSWYRYz7M32c/nYZtcexT+S77Cd+60VfoK+L254/7qtm3k3/QTkHz3WXRZ3UGS 1R+nZ2o8BCZqv8CDKbqaXht4tvypEemkHI3S6gySmgkRsQxlEkPK32ZvCktbk7jMee62RQDWVEq KG+XbAhVu4THoHD4knR06FtJFThkGP01gofdFu+eSKst9l8P2icdGaatn0t9T92XzJw5UCWdTzR xOvJau9VsPbc1qqZMWuIZynz8tIR0ESm5fTT0rPUYDqdKcUoriisYTosQjEP/jdtV7mXdhL0OTD jEFANpPjC6kNUc9IuoTWULH1rRAHyvNB2od4LzLyHtspfdsMaVBEfi69BvaFUAerKHm46wvK6wc Uyq/NmPUcUVqyp3aS2dvWH2USACLwo3FjIfQ3/VpuKeSEsR4ix9YHaKquX X-Google-Smtp-Source: AGHT+IGcS7CAMpFll0HDY1O5Zc12OFfNXQCkOaMz5QDXoS3vLroZPpTO+QAD1qGXjYgUcQjKN8+L0Q== X-Received: by 2002:a05:6512:238c:b0:595:81c1:c55 with SMTP id 2adb3069b0e04-596b4e5291amr9885439e87.8.1764663067375; Tue, 02 Dec 2025 00:11:07 -0800 (PST) Received: from [192.168.1.168] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-596bfa4f8a2sm4342412e87.88.2025.12.02.00.11.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 00:11:06 -0800 (PST) From: Marcus Folkesson Subject: [PATCH RESEND v3 0/5] I2C Mux per channel bus speed Date: Tue, 02 Dec 2025 09:09:47 +0100 Message-Id: <20251202-i2c-mux-v3-0-877dcf478a9f@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 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.3 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/ZANAwAKAYiATm9ZXVIyAcsmYgBpLp78pYwoet71tdqujVKWQY+kM7X6WyKFAkliF Xjst0GN/jCJAjMEAAEKAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaS6e/AAKCRCIgE5vWV1S Mv1QD/wMhwHoL7P0C1vQazs6dCzVgyo/k425LFs4zXAn+5CKQ2bz66GMez+ydkttdb5SJBWqSlQ 8MZcZ9f3oMizlyyRkpWSXhfaxWaNjOCX6MZhXu7nblI3jQQQ0xODz3Sr74G+W2iuGJ74gEO4ye9 s7+LGvIJ6eJ8DwyRwkYQmaJQA6mRfY6SxH2dMHhPOUNCCRf4QuA4AEnejDhk8QIsqzKZcRpYK4Q 4+W88jRIDFUF4hwbml/Yc+LtLaTJjdWeLKDVatv+/Dq6/RhUHsF8u723mt3+5li4rUk/FVN/fVq 0RMarYoOByISWXzB9D8cbcvJt22Voc5ab3yxWBBgRKApHR7v20CGTG7q6LKq0ONKKkmbZl12OGW Iwy9rB3SDae4gnConpK+1+qmfZQ61MmlnRhbIBO/P1tIZRHh3t/O80FapUz3uP+WTJqvwqn4Oxi CrNZl/bJCNlJrT2OWTJWoTW0D92OD2AfVTsMg+OmDrtlUDthA5U5bDXDotDCwQraaM24TA3KS3J 69tXDM9D+ThyovYITVrMauPapqr2Sp8Taf6RDm3S8b0gJN9GoDkJunVEfXEn+REu4uBJ1brW1AE TLV5T9QspmWzZdq3bT5LzBWgYiTNw0b77foXsHAjZtZyss0T2FzOuJaA5ia5H/M2UGVs+NXV0jP Qqk6GHTaggq6Vlw== 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