From 9c9330a7ad5dab82517a3f712099f54a4a1a6f3e Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Thu, 14 Mar 2024 15:25:19 +0000
Subject: [PATCH 0963/1085] dtoverlays: Add a disconnect_on_idle override to
 i2c-mux

When running multiple muxes, in order to be able to reuse the
same address on child buses of different muxes you have to
disconnect the mux after every transaction.

Add an override to select that option.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README              | 3 +++
 arch/arm/boot/dts/overlays/i2c-mux-overlay.dts | 6 ++++++
 2 files changed, 9 insertions(+)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -2042,6 +2042,9 @@ Params: pca9542                 Select t
         i2c6                    Choose the I2C6 bus (configure with the i2c6
                                 overlay - BCM2711 only)
 
+        disconnect_on_idle      Force the mux to disconnect all child buses
+                                after every transaction.
+
 
 [ The i2c-mux-pca9548a overlay has been deleted. See i2c-mux. ]
 
--- a/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts
+++ b/arch/arm/boot/dts/overlays/i2c-mux-overlay.dts
@@ -3,6 +3,8 @@
 /dts-v1/;
 /plugin/;
 
+#include <dt-bindings/mux/mux.h>
+
 /{
 	compatible = "brcm,bcm2835";
 
@@ -169,5 +171,9 @@
 		       <&frag100>, "target-path=i2c5";
 		i2c6 = <&frag100>, "target?=0",
 		       <&frag100>, "target-path=i2c6";
+		disconnect_on_idle =
+			<&pca9542>,"idle-state:0=", <MUX_IDLE_DISCONNECT>,
+			<&pca9545>,"idle-state:0=", <MUX_IDLE_DISCONNECT>,
+			<&pca9548>,"idle-state:0=", <MUX_IDLE_DISCONNECT>;
 	};
 };
