From nobody Mon Jun 8 04:29:03 2026 Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42]) (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 797412F0680 for ; Sun, 7 Jun 2026 08:21:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780820464; cv=none; b=ju+16Xauagjsno8Dea+D1YDOAAdXvdZoqi4FKHDiSG4k/qynggyrVXm2tW1NTW83oJtnGDR/aWEl4aBnIeXMHLffWJtlNQL+YtyoGsDAV75o4RPTTcD/ACO36Y+otyQGoSwR/WMrC+K7D4ga3lKz9hxDO+YgY8Dt1w4tqfIr9oA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780820464; c=relaxed/simple; bh=XaIH/tdA/VTfND3mpkqGBSmm806lREpUi5+nvDjYaoo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VOvOXP/sq7arsRmzUP/cLveaOBlfYyaNrnU50q5GuQ7PKKKKH3pb3+sNM2KNeRn9cw8nRLxmqfv27PhQpSooRm3qt/FlB6wqSgjW0RRgHfqaIHSJPUZGcN4OxcY8GqTVssRZBiGZWTpJW4S/zmACibQovnmgGZUbrOMxmjzoY6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=RcvraqHq; arc=none smtp.client-ip=74.125.82.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="RcvraqHq" Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-1363e78746eso3464910c88.1 for ; Sun, 07 Jun 2026 01:21:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1780820463; x=1781425263; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n/xWxoztuolS/ZK9hptFI5IvqarIJl0DesoQ958DqkU=; b=RcvraqHqwhkrL/dhgGhClTpe1pmQJ4z7dABaE7b1qeBevAJEOZV65Z3kcIOFS5Kh/0 063dtGANGx5n4aSg3IW7tDrmV4IRDXI3Ncw1OBhx7qQ5p/8K1JXirYvBTmwqCEtTnSZU zNZEMZQCC2MilV3TOa7KE5eYrU2dx8viXCdb/F3H71HnZlfjpdGqmH+a3rUwvZ+Mz7NU 7mSX4Rg8/SucnqXRoAWfdNo2GNJsVXLIsl9IVptxPHj4K5q0hDLrfbIt2nJDam+xtI6d DEBa9SusGKFODlzR24w8FKPcPlyGYk0QItUqhACUrbGb6bte50zUvvNo0idFezJbjRFz TzkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780820463; x=1781425263; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=n/xWxoztuolS/ZK9hptFI5IvqarIJl0DesoQ958DqkU=; b=SkYYXSKHSP9zRNi0loyUuvRbYsedJkDcBbRG7vqzG1t4fCyRXhuMSG//37wOHbFJQs ajgZn/Pcft6x9AcgCn9YvgOJI14iNko649r1hJhII1dfH6Eb9sSHGMTlwR6uwpY3nMWe gLKI+4zQoxw2HY/xdOOHJzc0/kpljni7NGZGmgHzzOpMX5bGLQ1zN7s1+/OTXh4nONDn Blu9sY/Kn6rgbLOplzTT7YT8Cyzt4eJJO4bgsJLu3hUpFH6vspjjef3R+F34DQfTy3p6 uNmRajTKtv88whLhZqAKytT5Qj3OgTmETLzL0cLsA2F0wbd7YLl6ylxL+WqfV9WO5ZH7 /rJA== X-Forwarded-Encrypted: i=1; AFNElJ+zeKxLr6wAYvQ3Abr7i1RutPoR2yk1UIIAWVC4lq/10F+VV3W2f65dGAmht7u0I8zqS590axrBRDnFUj0=@vger.kernel.org X-Gm-Message-State: AOJu0YwQLa8yfsZDT8zctvr5V7I8A0lzOR/wBWqFSK6r2UHI8xlNmeyZ 6kv0trRS+6vPxsY5bGys4TyKcvw5eT7dDGgiPiMP4NaDx9gSYVKoKd68WZiKDWUPTdc= X-Gm-Gg: Acq92OFBr5rWubRnZ2QHowiSg7bl7oyHSArBvjMc/r7u0HJCcDqg0kLDLL4oRwrzrjI xpUAidrwfn4K/C3qOHKDRU48P/AfosGtIcBXXQuu4O2VUDZp7a/AcPAWsZ+bjCggugSMDFfAvYW 7p/lLuG7Rco7YWUbw/oTY1R4U59nkcTm7JpVTfm5vi1Jc2u3QO5SoCQhyqTSYhpS3p1Mq2xLCe5 RFoFMtjfWZYtmu3/o8P4xdzkl764+u6+TTrvAws/SiIq27sU9RodtjM+0tMN4LoXV9OvFaAuac7 pSG3ncFA1ApcfLbioT5VtmFr359Lie9fPl4oB7T/swxgx6pf4wyOTUb7jJOj7Cmsx5NdDk1D53/ XNeVSHQntXPa5glGKDTqrjWv3msh9BQ5tlkVVVfnmDoYL+pG8pEdUV93SaqFkRQ9jk/QPOc/+47 3YmnyVXZs80+H6CKMT/5CCb4/qJq0CDoY6ylBFBNUJ22N9CHg= X-Received: by 2002:a05:7022:6ba1:b0:136:d237:b42f with SMTP id a92af1059eb24-1380671e4f7mr5539508c88.32.1780820462533; Sun, 07 Jun 2026 01:21:02 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-137f5489d17sm9439232c88.1.2026.06.07.01.21.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 01:21:01 -0700 (PDT) From: Abdurrahman Hussain Date: Sun, 07 Jun 2026 01:20:55 -0700 Subject: [PATCH 1/2] dt-bindings: i2c: convert i2c-mux-reg to DT schema 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: quoted-printable Message-Id: <20260607-i2c-mux-reg-base-bus-num-v1-1-f193b5a8fedc@nexthop.ai> References: <20260607-i2c-mux-reg-base-bus-num-v1-0-f193b5a8fedc@nexthop.ai> In-Reply-To: <20260607-i2c-mux-reg-base-bus-num-v1-0-f193b5a8fedc@nexthop.ai> To: Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780820459; l=7006; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=XaIH/tdA/VTfND3mpkqGBSmm806lREpUi5+nvDjYaoo=; b=C+ibZQ+gsmsrAvsymoBk+kltJIaMIG2c48b1dcSIFmRXC4kaNlSUsBa0652Tuh3i3hW16XpDB Hvz0eR4j8g+DurUyhYeszzYQ+sC0B5KJX/DIQH6ziBr1OxW04Lb7Ixx X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= Convert Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt to the YAML schema so the i2c-mux-reg binding is validated by dt_binding_check. Also document a new optional "base-bus-num" property: when present, child adapter N is registered as Linux i2c bus number (base-bus-num + reg), so static references such as sensors.conf stanzas remain stable across boots. The matching driver support is added in the following patch. Signed-off-by: Abdurrahman Hussain --- .../devicetree/bindings/i2c/i2c-mux-reg.txt | 74 -------------- .../devicetree/bindings/i2c/i2c-mux-reg.yaml | 110 +++++++++++++++++= ++++ 2 files changed, 110 insertions(+), 74 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt b/Docume= ntation/devicetree/bindings/i2c/i2c-mux-reg.txt deleted file mode 100644 index b9d9755e4172..000000000000 --- a/Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt +++ /dev/null @@ -1,74 +0,0 @@ -Register-based I2C Bus Mux - -This binding describes an I2C bus multiplexer that uses a single register -to route the I2C signals. - -Required properties: -- compatible: i2c-mux-reg -- i2c-parent: The phandle of the I2C bus that this multiplexer's master-si= de - port is connected to. -* Standard I2C mux properties. See i2c-mux.yaml in this directory. -* I2C child bus nodes. See i2c-mux.yaml in this directory. - -Optional properties: -- reg: this pair of specifies the register to control the mu= x. - The depends on its parent node. It can be any memory-mapped - address. The size must be either 1, 2, or 4 bytes. If reg is omitted, the - resource of this device will be used. -- little-endian: The existence indicates the register is in little endian. -- big-endian: The existence indicates the register is in big endian. - If both little-endian and big-endian are omitted, the endianness of the - CPU will be used. -- write-only: The existence indicates the register is write-only. -- idle-state: value to set the muxer to when idle. When no value is - given, it defaults to the last value used. - -Whenever an access is made to a device on a child bus, the value set -in the relevant node's reg property will be output to the register. - -If an idle state is defined, using the idle-state (optional) property, -whenever an access is not being made to a device on a child bus, the -register will be set according to the idle value. - -If an idle state is not defined, the most recently used value will be -left programmed into the register. - -Example of a mux on PCIe card, the host is a powerpc SoC (big endian): - - i2c-mux { - /* the depends on the address translation - * of the parent device. If omitted, device resource - * will be used instead. The size is to determine - * whether iowrite32, iowrite16, or iowrite8 will be used. - */ - reg =3D <0x6028 0x4>; - little-endian; /* little endian register on PCIe */ - compatible =3D "i2c-mux-reg"; - #address-cells =3D <1>; - #size-cells =3D <0>; - i2c-parent =3D <&i2c1>; - i2c@0 { - reg =3D <0>; - #address-cells =3D <1>; - #size-cells =3D <0>; - - si5338: clock-generator@70 { - compatible =3D "silabs,si5338"; - reg =3D <0x70>; - /* other stuff */ - }; - }; - - i2c@1 { - /* data is written using iowrite32 */ - reg =3D <1>; - #address-cells =3D <1>; - #size-cells =3D <0>; - - si5338: clock-generator@70 { - compatible =3D "silabs,si5338"; - reg =3D <0x70>; - /* other stuff */ - }; - }; - }; diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-reg.yaml b/Docum= entation/devicetree/bindings/i2c/i2c-mux-reg.yaml new file mode 100644 index 000000000000..7fadedabde70 --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-reg.yaml @@ -0,0 +1,110 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/i2c-mux-reg.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Register-based I2C Bus Mux + +maintainers: + - Peter Rosin + +description: | + This binding describes an I2C bus multiplexer that uses a single + memory-mapped register to route the I2C signals. + + Whenever an access is made to a device on a child bus, the value + set in the relevant node's reg property is output to the register. + + If an idle state is defined via the idle-state property, the + register is set to that value whenever no access is being made. + Otherwise the most recently used value is left programmed. + +allOf: + - $ref: /schemas/i2c/i2c-mux.yaml# + +properties: + compatible: + const: i2c-mux-reg + + reg: + maxItems: 1 + description: | + Offset and size of the register that selects the active child + bus, relative to the parent node's address space. The size + determines the access width and must be 1, 2, or 4 bytes. If + omitted, the platform device's own memory resource is used + instead. + + i2c-parent: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle of the I2C bus that this multiplexer's master-side port + is connected to. + + little-endian: + type: boolean + description: Register is accessed in little-endian byte order. + + big-endian: + type: boolean + description: Register is accessed in big-endian byte order. + + write-only: + type: boolean + description: + Register is write-only; the driver must not read back the + current selection. + + idle-state: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + Value to write to the register when no child bus is selected. + + base-bus-num: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Base Linux i2c-adapter number for the child buses. Child N is + registered as bus (base-bus-num + reg). When unset, child + adapters are allocated dynamically by the i2c core. + +required: + - compatible + - i2c-parent + +unevaluatedProperties: false + +examples: + - | + i2c-mux@6028 { + compatible =3D "i2c-mux-reg"; + reg =3D <0x6028 0x4>; + little-endian; + #address-cells =3D <1>; + #size-cells =3D <0>; + i2c-parent =3D <&i2c1>; + base-bus-num =3D <16>; + + i2c@0 { + reg =3D <0>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + clock-generator@70 { + compatible =3D "silabs,si5338"; + reg =3D <0x70>; + }; + }; + + i2c@1 { + reg =3D <1>; + #address-cells =3D <1>; + #size-cells =3D <0>; + + clock-generator@70 { + compatible =3D "silabs,si5338"; + reg =3D <0x70>; + }; + }; + }; +... --=20 2.54.0 From nobody Mon Jun 8 04:29:03 2026 Received: from mail-dl1-f44.google.com (mail-dl1-f44.google.com [74.125.82.44]) (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 23EF136F8F5 for ; Sun, 7 Jun 2026 08:21:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780820466; cv=none; b=SO/24XXoWq7NvaVdi7EEp6Vu+2HpWJDAMfZM8qYX8/4+IvTGQOjl9C4Ge3zRMDUarKF0g83Pfzo719cJo3sGXHAKStK+HCCe8GTeMkkdCGgXF5TI06Fk2FJR7uavqfiCmRjm+Ve3InmYBvg6tmOYbWb0QdwDC6ui3GIhLJzpqSM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780820466; c=relaxed/simple; bh=YQERmjO6hBoH6+GdyySBEbETr2FTBTtGkTU+7Ccv33E=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u1W48VWMvvl4YbSwkyqgwRH2kiSbQ9n7W4h41nDl9fj73AH75L2Wr/yTzry+b+weLKnygKpY1xOqRTj74fgXkZIjeascct2MNay1//u2t7McWT/FYL7BgbbYGthz8BXBTbMQFGNVdbBDPSrJuIiHQSxnjwG83i2gswjCIiYvGwE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai; spf=pass smtp.mailfrom=nexthop.ai; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b=bdwOH6CA; arc=none smtp.client-ip=74.125.82.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nexthop.ai Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nexthop.ai header.i=@nexthop.ai header.b="bdwOH6CA" Received: by mail-dl1-f44.google.com with SMTP id a92af1059eb24-138129a622dso3732839c88.0 for ; Sun, 07 Jun 2026 01:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexthop.ai; s=google; t=1780820464; x=1781425264; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fXENIPE1x+qpwB7xDgysn50NyxQ6tMkm/oN0K3KXyn0=; b=bdwOH6CA3MEm4icejJUJyYT50xPCnyTJczYxHbjgj8rN8tah5IIh+5eQ8YCgJ3CEhg uI4CpTox0e5V/hdhDblZhYdum7d3DRyFVxvMZxW1O6ShC0buxyTv9fef1aqOO84stQwm 9dOF1tRx+zTnwGQjORkBi6TVwrogUiTUtAn2Wvgp2lKnI8vfufQ9YmWJQM8VJr36APGE dOUiiHhwTqDAhU7UQcmKVU2qbjdiPetc0SxQ3hicYoB0yhiCHV7LTnIqtHqcVVbKkfqI vnhDoHsv7QP+IKKTpGCBSm1UKOoeAKeDVcLODpm7X4Sk1WlpdaUecbs6N9bIj0cglqP+ NPVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780820464; x=1781425264; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=fXENIPE1x+qpwB7xDgysn50NyxQ6tMkm/oN0K3KXyn0=; b=LARaOgWJMARlJhgZluN/eqZ9j5wmrODzjaPB8PG+6zq2GmVJvZa+JFaY3lZCbZzm4j Ygyto9Mud7dRjYi1cU6ddAdvNU1LB0TUvz3pLRaW86m2CfUIORkC0ruy8FXiX6MmFXM7 utZtAW6LUIHUDK43XLW/Q0soNiCoAncXnlI0f9hFYYIcvn6m4bSrclw5AJQxe8ELKNFE Cz3Dbk4tncXgsNPL44wgx8sB0HjJCdaiV+djTRZrsp/pY2rzacq58Ewgc4IK9x+bYKva bXWXDiz9pv8zvp0R6rqOpg7y0E/g9WfM/VPHfjUClRmCSJzHNIvH2Cjp4p4YJNN6dhU+ tkGA== X-Forwarded-Encrypted: i=1; AFNElJ/73C6QLyQzAQKB9nSP4WplTZshEAfYk2QzYdypamYAP+FzPCjr0O+1eywmdA+v09m208MVS01T0oCz3HM=@vger.kernel.org X-Gm-Message-State: AOJu0YzEUlb5uf5XVtSNjsFKl1qOobcxLhwBJpBbq4ap0Fdczu2CvG8I IzbMQC55655i5ZWRwxXHJ7YfXcxLBARGU5+oSBaOvBePo6wtqx5gLB9UltbHEzGW3H6Q7OrnwN5 GiRWd X-Gm-Gg: Acq92OEH4C+3AXmzlEaNBDR5fbn1fe1m9Hy/l41liSM6tDHmQKH/7REXS6t8Q8n6yNp cQ0A8TLw8Goy5oJRAS0T1hej0s3fi+ZNEAQsN+1fQ+RQI3fmOHJi3u3J5LdKOvP6PA9iTPsK+ph dNbu7X7ATCsUrCgi5Z2xpZx+Vp4qht19jwJ/FJju2OMjgrxT8pJx0reqHmiGsw3ylVvtj29ypMv 1iggSkoUmPyUKJoaPYnwEZpxpR8O1vY0bnpdaBxWId8kEk+800AOgcVXJh3AYcl6XhgTxoEFzE5 LvHL2HKTHBSdhFgXAnlLYQSn44IK6iiWnF8NGdIMtDfUmBZWD04GJwyxu/jezdjg2XxdsiCQ/XS ncnZjv6rVFRPJ7G8if1g0smIp6eg1HdxcQIGD8hXfn41IbSQmHaVkpOiu9S7W+bVlyMrIfgS/w6 0mukWBNGVd/hSI9qLC+KJppbGCmOHkVPo/HQBC X-Received: by 2002:a05:7022:6081:b0:137:f4b6:b39a with SMTP id a92af1059eb24-1380672d9a7mr5614612c88.32.1780820464140; Sun, 07 Jun 2026 01:21:04 -0700 (PDT) Received: from [127.0.0.2] ([50.145.100.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-137f5489d17sm9439232c88.1.2026.06.07.01.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jun 2026 01:21:03 -0700 (PDT) From: Abdurrahman Hussain Date: Sun, 07 Jun 2026 01:20:56 -0700 Subject: [PATCH 2/2] i2c: mux: reg: allow fixing the base bus number via fwnode 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: quoted-printable Message-Id: <20260607-i2c-mux-reg-base-bus-num-v1-2-f193b5a8fedc@nexthop.ai> References: <20260607-i2c-mux-reg-base-bus-num-v1-0-f193b5a8fedc@nexthop.ai> In-Reply-To: <20260607-i2c-mux-reg-base-bus-num-v1-0-f193b5a8fedc@nexthop.ai> To: Peter Rosin , Andi Shyti , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Abdurrahman Hussain X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1780820459; l=2252; i=abdurrahman@nexthop.ai; s=20260510; h=from:subject:message-id; bh=YQERmjO6hBoH6+GdyySBEbETr2FTBTtGkTU+7Ccv33E=; b=GA4/wUnezdHhRk5QO3A6zO2xlwtE/AQK4Dg9ix7np0jTjZ2PELt7nH+Osff1G+z1/gLUEHpv6 0wUC3LwQGXqChAqwQG6JCLVs4v1MsRgJ3iEr7UXdPd4pvM1DDsWuOsl X-Developer-Key: i=abdurrahman@nexthop.ai; a=ed25519; pk=omTm9cCAbO0ZhS32aKfJDKue0W3sQGpG9ub5eYHif8I= i2c_mux_reg supports per-channel force_nr through mux->data.base_nr (when set, the channel-N adapter is registered as i2c_add_numbered_adapter(base_nr + N)), but the only way to populate base_nr was the legacy i2c_mux_reg_platform_data path. DT/ACPI/swnode instances have always defaulted to dynamic allocation, which makes sensors.conf bus stanzas and other static references break across boots whenever the i2c-core pool shifts. Read base_nr from the new "base-bus-num" device property in i2c_mux_reg_probe_fw(). When the property is absent, base_nr stays zero and the existing dynamic-allocation behaviour is preserved. Anchor the per-channel bus number to the channel index (values[i] =3D=3D the child node's reg) rather than the iteration counter: nr =3D base_nr ? base_nr + values[i] : 0 values[i] is the channel id encoded in the child node's reg property (0..n-1), which is also what i2c_mux_add_adapter() receives as chan_id. Using values[i] makes the mapping deterministic across fwnode-iteration orderings (some OF kernels walk children in reverse source order) and across DTS gaps (e.g. a mux that wires channels 0, 1, 3 still gets sane, consecutive bus numbers). Signed-off-by: Abdurrahman Hussain --- drivers/i2c/muxes/i2c-mux-reg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/muxes/i2c-mux-reg.c b/drivers/i2c/muxes/i2c-mux-re= g.c index 13da757100fe..5ea59ecb4ae5 100644 --- a/drivers/i2c/muxes/i2c-mux-reg.c +++ b/drivers/i2c/muxes/i2c-mux-reg.c @@ -141,6 +141,8 @@ static int i2c_mux_reg_probe_fw(struct regmux *mux, str= uct device *dev) if (!device_property_read_u32(dev, "idle-state", &mux->data.idle)) mux->data.idle_in_use =3D true; =20 + device_property_read_u32(dev, "base-bus-num", &mux->data.base_nr); + return 0; } =20 @@ -197,7 +199,7 @@ static int i2c_mux_reg_probe(struct platform_device *pd= ev) muxc->deselect =3D i2c_mux_reg_deselect; =20 for (i =3D 0; i < mux->data.n_values; i++) { - nr =3D mux->data.base_nr ? (mux->data.base_nr + i) : 0; + nr =3D mux->data.base_nr ? (mux->data.base_nr + mux->data.values[i]) : 0; =20 ret =3D i2c_mux_add_adapter(muxc, nr, mux->data.values[i]); if (ret) --=20 2.54.0