From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 71C7B2C027F for ; Thu, 2 Oct 2025 14:42:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759416135; cv=none; b=SDpAIa+0rsUxA67UtNuS4idcYsuxYSmpzLDU658zyfHlWL6yUAfMmSnK61gw42sHTPVlrFiQE/ViH4Cx9lMI409FqB4Sh6bdfgnmLtdqAtoMrvIocLGbUS7CgNZum2qW8y0jcMkt66KQb4a8ydaCeu+zzl+Wp3Cy6HGgBSaAVr0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759416135; c=relaxed/simple; bh=39T0ma2tQY2ash6Qo2ada6hVH3JsIkkZza4MfO3ZBHI=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=u7/qaR1lZvk6kRitk0iTjuxXhQWUepFleaOIlmLh/JHsGJG4YlGAnH53pOMoX9aZm+37SNYaCQn+FRBuwcf472yzpX26sGYglxPKGk3EIJHzu22pvhskRViziNP1XXmbZLhhrjJgy8w9ezvl5DKvuWVC36rvz2KcNK8V4o9NX5Q= 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=V1SXI5zt; arc=none smtp.client-ip=209.85.208.170 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="V1SXI5zt" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-3652d7800a8so8469201fa.0 for ; Thu, 02 Oct 2025 07:42:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759416131; x=1760020931; 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=XkEhPQwNtmSlycuLC3g8JLSdLRDEM4aNuSFfkt353w8=; b=V1SXI5zt0jAlbFiOMt+KN1jh1J6lyRSz39JKswbHYwsXT5XlPZeybsgr4u+81nSYym i844+qSfp10r2gyTxzrvH6HGq/w5kAfeGaPzaE2XNF9EDhwzZW+1lRwPL8a4eWHwsCBX m32W+1FvtKn6NelcFQjCI5uvuk0+zgB1jCWrolaJ1YdGpzcQfQn9pNu8yNrzuC9jBGV7 Efy3IDt9r3j8y8YPAnTuBqi/wtcjQGEG6wVrMfJ+oAowz6go+KSd89fgHqwHXY9tmyfh xMEcau7OeadqZ3kT5m6X8XkBv8wIiNsuEArz4+mYYRkWb+sMSuiANxsWd+OFUqIbYiUg iROQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759416131; x=1760020931; 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=XkEhPQwNtmSlycuLC3g8JLSdLRDEM4aNuSFfkt353w8=; b=tP59fVlt7Gw3+Jy9SW4L1UX2OHqR1Ig5hzMOwG0CHQlKSBSJWF019LI12hNCfV0+Il y6/Niy5dguJGC5AqTP5oO9j2BtyaNtl2nsQDsFAtPgWgWBEzNMu3DSFmF+COTzO6A/sr 5fv/EBZwDF0lo4DSV6n/6eFXf4QSNUmIArT1pFXGzJBjjXeRrvEELExUyGPdCGVHmRX2 lSyKGEMg/4URx7Jn+GRZ6+nAgc++NCTcCpxSVZwPVHZhMSBbFahVJIOiTrHVxPizi8vG 8xzP33IH6sbZN82mut2JSXikSKBBMApLL3cYQQbcZfO9UH7WN+kbFM3eIjdo11IO22j/ 1KFA== X-Forwarded-Encrypted: i=1; AJvYcCV3VYoJhK1SpKqnDWwcg1KMdMhflVyxdZIp843rRK2R490ch7D/D3G6RgWLLw6BFKV9XmfF+Jg/vOgpzaA=@vger.kernel.org X-Gm-Message-State: AOJu0YzAX2gQawWLOI/HgI1fI1SRUt0T+mAX6y6GkkfytpznC71RcVoY 736kyJbs5M+iFu1KuLncyP+NmxW5noB2YUgn5ChvCuYl9ZLNByPHeo+6 X-Gm-Gg: ASbGncveZEf0kRZYwO0WyxHeMVEp8rumAN3eO8wXNbiGgP91cZ02k8M1cVZ43jcoEAc zs+fOw3kpXWWJz24X2j0roK8WGsy1lfUB43xOa4iu/k3cRVHbL4Zc9MO36IWvQvx5A5v4KmeAhB ytml/bKQSyrJHE6YYI1eFgZTBGEjjTgu5NzVKLKYLjjC39IdIJP1L31kZoo3RfjwNMcT4S1Qg3B t/UoaRyCDwUSXdHEdzBpr8Zz9dB/eufjvYXbKVjQcoC76mgOsXO0bMCs0aTqxXIMBF6pLSssUv3 iGirNlo0b5N9QAlFicsp2YEq+fi7edUQhxRgUXqxWvKGk9Ee6jlJrfkbg5E2MW0ZoluNLuyQbpx 50o0I8hw13a/AGDLrT3DNT+sJHuIj8zHyanWrlXfFuZJT5jq8M8Dpf8rXXaxvt9JSb7yQDFLS9C s68XDCzn13Oah3oOk= X-Google-Smtp-Source: AGHT+IEJrVmC9w57f3G5Kl4iwhrNotYoJdOTKctK4lxmuohghlxTqkB5k3mcuvU7EJGSvorrZ8awuQ== X-Received: by 2002:a05:6512:ea7:b0:57b:5f02:e9e9 with SMTP id 2adb3069b0e04-58af9eadd91mr2337387e87.7.1759416131104; Thu, 02 Oct 2025 07:42:11 -0700 (PDT) Received: from [192.168.1.166] (83-233-6-197.cust.bredband2.com. [83.233.6.197]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-58b0119e60fsm884712e87.94.2025.10.02.07.42.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 07:42:10 -0700 (PDT) From: Marcus Folkesson Subject: [PATCH v2 0/5] I2C Mux per channel bus speed Date: Thu, 02 Oct 2025 16:41:31 +0200 Message-Id: <20251002-i2c-mux-v2-0-b698564cd956@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=H4sIABuP3mgC/z3MQQrCMBCF4auUWRuZTGqxrryHdBGTsR2wrSQaK iV3NxZx+T8e3wqRg3CEU7VC4CRR5qkE7Spwg516VuJLAyEdsNVGCTk1vhZ1RWyMZ7JceyjvR+C bLJt06UoPEp9zeG9w0t/1ZxD9jaQVKjq6traNxtbguR+t3PduHqHLOX8Atnmbq54AAAA= 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=2455; i=marcus.folkesson@gmail.com; h=from:subject:message-id; bh=39T0ma2tQY2ash6Qo2ada6hVH3JsIkkZza4MfO3ZBHI=; b=owEBbQKS/ZANAwAKAYiATm9ZXVIyAcsmYgBo3o8jY8sNNc0W7j8+Y80la2dbww0CwGRU2EPcx iK+iv54Ty6JAjMEAAEKAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaN6PIwAKCRCIgE5vWV1S MtdpEADCljn+7Mdpkj70JlrseklPeiZHTd2xkmb6vlLy+z8HENjFXbtsU6NJjeswQ2kPPcJxlY3 2KC0ukpz1U+3e+iLYJmFRxA39N8xEWhYET6juCq57IDIwUsJU7e82ZDsGsPnJykYYJ/F2I0peC5 a68188K9FFLFR4q1zT5kANMW4ODO4Mkps1ohqYWjNAabOoazrEZL4g5HuzJe1UPHoC/1D/7u2X0 BDFjWcRKvbiIVT4t7pyvNRws7iCp9VCU3g7u0C6uzOud/zzhHVg2sjM7PCqa5b6WpKkbEmPxSBV wQX2NAV1dTcFoXst5RavMMtdKPcv1JIxYGCpZ+4wAQAJGr+hDS7sJP+lZi3g15qIJzCDJyyPy26 eQXldCCW4BZ/Ht6KFmrneaMeyKG3pJ3b8RKWzEI0D0KxYCvMEf0F7XitMahVf3+hkuCZ3T0XIKa vWWpYh6qSC7H1RlAL8CakxoOrW/+muBNEJP1bRyA1cq7VxX8eFzWgeY+ptSpzNHYDF9JOwgCN8F +cPFfC+6IHMO7v7MzifND4uvVXIiLIZY7FUam/wZtClm1zMXHqBAUW1OwPaUfBiHwNqwQgdK5C0 ToEo7rK7JUQZAWIWvnQSWV+NsZmGsHaWsccya3JAWbK9QZqw09u1e0ITEEu5i6bOINIO8qO2pzQ coHzCHjqmE1S8Ew== 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 v2: - Changed bus_freq field to bus_freq_hz in davinci_i2c_dev - Removed idle_state from mux core - 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 | 115 +++++++++++++++++++++--- include/linux/i2c.h | 13 +++ 4 files changed, 323 insertions(+), 22 deletions(-) --- base-commit: 22f20375f5b71f30c0d6896583b93b6e4bba7279 change-id: 20250913-i2c-mux-b0063de2ae4d Best regards, -- Marcus Folkesson