From nobody Thu Dec 18 19:43:30 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F6F9C77B73 for ; Mon, 1 May 2023 09:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232260AbjEAJQG (ORCPT ); Mon, 1 May 2023 05:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232161AbjEAJQA (ORCPT ); Mon, 1 May 2023 05:16:00 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C3F1A2 for ; Mon, 1 May 2023 02:15:58 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-94a342f7c4cso467938566b.0 for ; Mon, 01 May 2023 02:15:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1682932556; x=1685524556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PeUBY+RnRkv7Uj0pwjxAuaeSePuTuD/H6MTh8BP5FD8=; b=RWaUwP59XBK+63XwUWLfDvqxBKaSL3rDdDGMwLeKpEBwQ7lvLmoJfHED60WMr/srbu 4Yyky5uTrOJN7dw5j1lru0fViJqe9u1l18BuZknA6LutocwXiorqhFfZJhl/FswqfNek evWwp3qoU66xKmE08Dpc+CAINLNHzg2vkGt2navJJ9sZS6ONZGS2W34vB9xT3K7aBzSm yuwGewFTogft2qWC2Su6i9F6fxLYtpcQ1Xq1cYPiJyiCJ4fkkN+iWbE9TM2ZYrq70M2o hIDw+neGnn7reT6A4w63Q4lzOful4kXtkHsLqC/QMCi1q57CIURV1wsN0CUL/+vq/G+x eXfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682932556; x=1685524556; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PeUBY+RnRkv7Uj0pwjxAuaeSePuTuD/H6MTh8BP5FD8=; b=gBWy9HYVw742V89QxkikWJ5PEJGS6hXhKTDTHQd+pz19I7Ht2F4471HKJPdQegicfe Q0Haiewt8paX64UC5l1XmO+FG74TIm4wE55wHP7fW/08FQznPaAdd9ciNa4VPcqzl7Qz V22UCE4GTPire//VXLBuuj3rldoMqjvXPBPTfi20g1ukBuCavoloaTTLArCexYIrtK72 JVrQQ7pUpMcrn5D3xymXSqDfNzORZR8PkVqVVm5Ru6EevE7kNClTIcTnzgRt0SQCQy/2 vF+5UGUw1Dhh2jXI5jhauQ9fWsjzq78NORvIeWjjSDLrYHqGHJKjFENtcQOmJ3wJL+Cr +L4A== X-Gm-Message-State: AC+VfDx4gH4f2szuyILT0rLtxhGB/+aY9N4k8cbNo+1akoBWxRxSBvpS vtQsR4wWtA3L8xfuPkrvPGA6iJnLeQGC6URETuE= X-Google-Smtp-Source: ACHHUZ55kwe8/6XT20zB2ulgxQiEN/YYVlqI6VPVVzj5ewpfI6sgsU+QwJug5O/jMSyUuIwD5hMXrw== X-Received: by 2002:a17:906:ee88:b0:961:800b:3f1e with SMTP id wt8-20020a170906ee8800b00961800b3f1emr3206640ejb.73.1682932556482; Mon, 01 May 2023 02:15:56 -0700 (PDT) Received: from fedora.. (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id xa3-20020a170907b9c300b0094e954fd015sm14714266ejc.175.2023.05.01.02.15.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 02:15:56 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin , Laurent Pinchart Cc: Patrick Rudolph , Krzysztof Kozlowski , Rob Herring , Krzysztof Kozlowski , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v14 1/4] dt-bindings: i2c: pca954x: Correct interrupt support Date: Mon, 1 May 2023 11:15:48 +0200 Message-Id: <20230501091552.847240-2-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501091552.847240-1-patrick.rudolph@9elements.com> References: <20230501091552.847240-1-patrick.rudolph@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Only some of the PCA954x compatible ICs have interrupt capability, but the binding advertises it on all ICs. Sync the dt-binding with the driver and only advertise it on: - nxp,pca9542 - nxp,pca9543 - nxp,pca9544 - nxp,pca9545 Signed-off-by: Patrick Rudolph Reviewed-by: Krzysztof Kozlowski --- .../bindings/i2c/i2c-mux-pca954x.yaml | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml b/D= ocumentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml index 9f1726d0356b..e5c1070903ef 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml @@ -12,9 +12,6 @@ maintainers: description: The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. =20 -allOf: - - $ref: /schemas/i2c/i2c-mux.yaml# - properties: compatible: oneOf: @@ -63,6 +60,24 @@ required: - compatible - reg =20 +allOf: + - $ref: /schemas/i2c/i2c-mux.yaml# + - if: + not: + properties: + compatible: + contains: + enum: + - nxp,pca9542 + - nxp,pca9543 + - nxp,pca9544 + - nxp,pca9545 + then: + properties: + interrupts: false + "#interrupt-cells": false + interrupt-controller: false + unevaluatedProperties: false =20 examples: @@ -74,7 +89,7 @@ examples: #size-cells =3D <0>; =20 i2c-mux@74 { - compatible =3D "nxp,pca9548"; + compatible =3D "nxp,pca9545"; #address-cells =3D <1>; #size-cells =3D <0>; reg =3D <0x74>; --=20 2.39.2 From nobody Thu Dec 18 19:43:30 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AB7CC77B61 for ; Mon, 1 May 2023 09:16:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232251AbjEAJQM (ORCPT ); Mon, 1 May 2023 05:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232214AbjEAJQB (ORCPT ); Mon, 1 May 2023 05:16:01 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4090B19D for ; Mon, 1 May 2023 02:15:59 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-95f4c5cb755so465956566b.0 for ; Mon, 01 May 2023 02:15:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1682932558; x=1685524558; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GuNFj/Sv0obKbqv7GFeCeV1CkO9oywslV9siQ5uNg7M=; b=G6Ljo2qfAMqmZZW+412uovfauTRrYJvv9XbHOxWasgjrYCdCbrKAxe2jxQEtxJkpDf oW7dLiA03YMw2DFnCyuHNrLwOBTRPFFwmkJoPc0tK2mFxsLVc3I9B+65Hco4JiEVd7yR wURptg0m9ofJIYbVpf1elrLNYCJG8oRT5CU+q7ZcbweYTJNAUP6iy4KOUaGgQWRn+73p EV5/MPs0knGVS2HpSLxLWBLTQOYuMGFP2B3t/k8kbhQ35Y8M5/WxSnrAHKmCa7TDtOa9 7EmESYC4I21ofK8d4Y07dSXYiAAhCyWZ4TNHTne7uqljTy9Dx+xgIu+EbH/e5iLzUJyl xP8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682932558; x=1685524558; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GuNFj/Sv0obKbqv7GFeCeV1CkO9oywslV9siQ5uNg7M=; b=PyJM9hnZaRdrYH7aFWeekRHZwirM0fqBD/zoUi1HGMkC/ErpKe4IBF9mmpxQ4hkPiE 5pgQcOxXlikiToIJ73oHzeAE2IaucCsqyzbgGNGBtLIshQNE+tk8RPSdc36WbtVa/Rue 8m+v2Zml3DrpIiv5IocflOD6BvpGT4RfELvKMMxtudVNGvuwbiByNuRhBi6VRECrI0pS rXGtYDFN9vAFQPqDWOm0WhcLWH6NVjMNn//uLNBsY9EtFlT0M4zaRwJw6GNMCHYq5B1a bkaDHunR+Hel6PCGxg/64uY1HWMr4K8Hm6yoxflSKIQCOE+3FlJXT9KUYY3t1zlEZkoC VF2Q== X-Gm-Message-State: AC+VfDw5iWVzEzMxZwhaVEqMmBDdOvSt1XLxK9/v0p+7VrsdyRNkeHn2 SwqiGxo2AG5pYVrfCRJUxikhyw== X-Google-Smtp-Source: ACHHUZ4IBapUB0VUpbuVU3+Bdvg9ufT5mMVCX0Qt3FnfosKNhfvchoLw6Amt7kC7GCxaY0oZYn33xA== X-Received: by 2002:a17:907:318e:b0:94f:9acc:65c9 with SMTP id xe14-20020a170907318e00b0094f9acc65c9mr11599423ejb.66.1682932557711; Mon, 01 May 2023 02:15:57 -0700 (PDT) Received: from fedora.. (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id xa3-20020a170907b9c300b0094e954fd015sm14714266ejc.175.2023.05.01.02.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 02:15:57 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin , Laurent Pinchart Cc: Patrick Rudolph , Krzysztof Kozlowski , Rob Herring , Krzysztof Kozlowski , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v14 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants Date: Mon, 1 May 2023 11:15:49 +0200 Message-Id: <20230501091552.847240-3-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501091552.847240-1-patrick.rudolph@9elements.com> References: <20230501091552.847240-1-patrick.rudolph@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Update the pca954x bindings to add support for the Maxim MAX735x/MAX736x chips. The functionality will be provided by the existing pca954x driver. For chips that are powered off by default add a regulator called vdd-supply. Signed-off-by: Patrick Rudolph Reviewed-by: Krzysztof Kozlowski --- .../bindings/i2c/i2c-mux-pca954x.yaml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml b/D= ocumentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml index e5c1070903ef..6fed6eae9c9b 100644 --- a/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml +++ b/Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml @@ -4,18 +4,29 @@ $id: http://devicetree.org/schemas/i2c/i2c-mux-pca954x.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# =20 -title: NXP PCA954x I2C bus switch +title: NXP PCA954x I2C and compatible bus switches =20 maintainers: - Laurent Pinchart =20 description: - The binding supports NXP PCA954x and PCA984x I2C mux/switch devices. + The NXP PCA954x and compatible devices are I2C bus + multiplexer/switches that share the same functionality + and register layout. + The devices usually have 4 or 8 child buses, which are + attached to the parent bus by using the SMBus "Send Byte" + command. =20 properties: compatible: oneOf: - enum: + - maxim,max7356 + - maxim,max7357 + - maxim,max7358 + - maxim,max7367 + - maxim,max7368 + - maxim,max7369 - nxp,pca9540 - nxp,pca9542 - nxp,pca9543 @@ -56,6 +67,9 @@ properties: description: if present, overrides i2c-mux-idle-disconnect $ref: /schemas/mux/mux-controller.yaml#/properties/idle-state =20 + vdd-supply: + description: A voltage regulator supplying power to the chip. + required: - compatible - reg @@ -68,6 +82,8 @@ allOf: compatible: contains: enum: + - maxim,max7367 + - maxim,max7369 - nxp,pca9542 - nxp,pca9543 - nxp,pca9544 @@ -94,6 +110,8 @@ examples: #size-cells =3D <0>; reg =3D <0x74>; =20 + vdd-supply =3D <&p3v3>; + interrupt-parent =3D <&ipic>; interrupts =3D <17 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; --=20 2.39.2 From nobody Thu Dec 18 19:43:30 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2242C77B61 for ; Mon, 1 May 2023 09:16:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232335AbjEAJQU (ORCPT ); Mon, 1 May 2023 05:16:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232231AbjEAJQD (ORCPT ); Mon, 1 May 2023 05:16:03 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B660AB9 for ; Mon, 1 May 2023 02:16:00 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-95f4c5cb755so465965466b.0 for ; Mon, 01 May 2023 02:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1682932559; x=1685524559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cQeLaD3HUZbD2Ee3JfwMlwyfJrMSNuv/+sgPjlCpSVc=; b=TvhGRJGTK89DC0+U4lIRW+jv5IeBkYB5JNILcUIgu1mHGLN14ptqmmQHWK4CMX8JYU GokEDh2j1R9NWkT16/PSOYTLWtkd8tw3TRfImrsNREAAK3Gspkg94QAJQcbXXU4jvVkd 8pyKNjDa3hnTq10wo0V6muWENjUTBn2uo/bsp+Fu59Zi/0uF5ETm5AEZNXlo8mVnaoZ2 Fcvcttmm2Kt63DVk4+pwJq4c7eIFSKYE7jySDK8sl7L+L8TnTUIF1UKr2mXVFiuTxV/4 2pNTlLMaVJeUEjwXYHVLVC1iLvTRyVdRTSwh/UemlcchVAEpSpfZRfPt3g1szDP7sDUN qVKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682932559; x=1685524559; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cQeLaD3HUZbD2Ee3JfwMlwyfJrMSNuv/+sgPjlCpSVc=; b=HM5343nwksQXbW0ZMaU7weMC8L5Llp1CS1qIp6FJhASQFYu8nP3ptjSHWr7umgqSWg rehIU62AIgtwSS92hXoJo73L8IKtGRdTewvnsvWNobWaj1VroT5RlKYda/Q6ddB0uxA+ sSaOr1WodUFIeR4Z/exJ3h2kGgHVQ+RHhSdqKXOHSgKpCUPJSN/ZbiaAwkQ2ubXmB18Z 6QxFn/mZKAt9b6X/uS9kaPOA201UMqJse6T222NOoDv/TyndM94Iu5dG+ziLvPUk+/mt Lwp7CkoVlNs0kfgUnFgV68JMncMrvmVDqk98YWmmXqbMmDmC5SnD9HfmtT84YCKg4Ba1 6S6g== X-Gm-Message-State: AC+VfDxlz2XL3oiA7iXnjUJBtEcfqLUrfNpM48TeT9ZEB7z2ak43ShB7 +srvCgvQCYzjI11OD4G72kDBLQ== X-Google-Smtp-Source: ACHHUZ7LMzO3p4PsUnv9BbyEsQ4mDxsTpVPrsv8tedfXsc2elSsmvw1CgHgA2MrnBJuWb0QFwYyIJg== X-Received: by 2002:a17:907:1b08:b0:961:be96:b0e6 with SMTP id mp8-20020a1709071b0800b00961be96b0e6mr317390ejc.68.1682932559076; Mon, 01 May 2023 02:15:59 -0700 (PDT) Received: from fedora.. (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id xa3-20020a170907b9c300b0094e954fd015sm14714266ejc.175.2023.05.01.02.15.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 02:15:58 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin Cc: Patrick Rudolph , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v14 3/4] i2c: muxes: pca954x: Add MAX735x/MAX736x support Date: Mon, 1 May 2023 11:15:50 +0200 Message-Id: <20230501091552.847240-4-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501091552.847240-1-patrick.rudolph@9elements.com> References: <20230501091552.847240-1-patrick.rudolph@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add support for the following Maxim chips using the existing PCA954x driver: - MAX7356 - MAX7357 - MAX7358 - MAX7367 - MAX7368 - MAX7369 All added Maxim chips behave like the PCA954x, where a single SMBUS byte write selects up to 8 channels to be bridged to the primary bus. While the MAX7357/MAX7358 have interrupt support, they don't act as interrupt controller like the PCA9545 does. Thus don't enable IRQ support and handle them like the PCA9548. Tested using the MAX7357. Signed-off-by: Patrick Rudolph --- drivers/i2c/muxes/Kconfig | 6 +-- drivers/i2c/muxes/i2c-mux-pca954x.c | 64 ++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index ea838dbae32e..db1b9057612a 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig @@ -65,11 +65,11 @@ config I2C_MUX_PCA9541 will be called i2c-mux-pca9541. =20 config I2C_MUX_PCA954x - tristate "NXP PCA954x and PCA984x I2C Mux/switches" + tristate "NXP PCA954x/PCA984x and Maxim MAX735x/MAX736x I2C Mux/switches" depends on GPIOLIB || COMPILE_TEST help - If you say yes here you get support for the NXP PCA954x - and PCA984x I2C mux/switch devices. + If you say yes here you get support for NXP PCA954x/PCA984x + and Maxim MAX735x/MAX736x I2C mux/switch devices. =20 This driver can also be built as a module. If so, the module will be called i2c-mux-pca954x. diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mu= x-pca954x.c index 0ccee2ae5720..968111442625 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -4,6 +4,7 @@ * * Copyright (c) 2008-2009 Rodolfo Giometti * Copyright (c) 2008-2009 Eurotech S.p.A. + * Copyright (c) 2022 9elements GmbH * * This module supports the PCA954x and PCA984x series of I2C multiplexer/= switch * chips made by NXP Semiconductors. @@ -11,6 +12,12 @@ * PCA9540, PCA9542, PCA9543, PCA9544, PCA9545, PCA9546, PCA9547, * PCA9548, PCA9846, PCA9847, PCA9848 and PCA9849. * + * It's also compatible to Maxims MAX735x I2C switch chips, which are cont= rolled + * as the NXP PCA9548 and the MAX736x chips that act like the PCA9544. + * + * This includes the: + * MAX7356, MAX7357, MAX7358, MAX7367, MAX7368 and MAX7369 + * * These chips are all controlled via the I2C bus itself, and all have a * single 8-bit register. The upstream "parent" bus fans out to two, * four, or eight downstream busses or channels; which of these @@ -51,6 +58,12 @@ #define PCA954X_IRQ_OFFSET 4 =20 enum pca_type { + max_7356, + max_7357, + max_7358, + max_7367, + max_7368, + max_7369, pca_9540, pca_9542, pca_9543, @@ -90,8 +103,45 @@ struct pca954x { raw_spinlock_t lock; }; =20 -/* Provide specs for the PCA954x types we know about */ +/* Provide specs for the MAX735x, PCA954x and PCA984x types we know about = */ static const struct chip_desc chips[] =3D { + [max_7356] =3D { + .nchans =3D 8, + .muxtype =3D pca954x_isswi, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + }, + [max_7357] =3D { + .nchans =3D 8, + .muxtype =3D pca954x_isswi, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + /* No interrupt controller support. + The interrupt provides information about stuck channels. */ + }, + [max_7358] =3D { + .nchans =3D 8, + .muxtype =3D pca954x_isswi, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + /* No interrupt controller support. + The interrupt provides information about stuck channels. */ + }, + [max_7367] =3D { + .nchans =3D 4, + .muxtype =3D pca954x_isswi, + .has_irq =3D 1, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + }, + [max_7368] =3D { + .nchans =3D 4, + .muxtype =3D pca954x_isswi, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + }, + [max_7369] =3D { + .nchans =3D 4, + .enable =3D 0x4, + .muxtype =3D pca954x_ismux, + .has_irq =3D 1, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + }, [pca_9540] =3D { .nchans =3D 2, .enable =3D 0x4, @@ -177,6 +227,12 @@ static const struct chip_desc chips[] =3D { }; =20 static const struct i2c_device_id pca954x_id[] =3D { + { "max7356", max_7356 }, + { "max7357", max_7357 }, + { "max7358", max_7358 }, + { "max7367", max_7367 }, + { "max7368", max_7368 }, + { "max7369", max_7369 }, { "pca9540", pca_9540 }, { "pca9542", pca_9542 }, { "pca9543", pca_9543 }, @@ -194,6 +250,12 @@ static const struct i2c_device_id pca954x_id[] =3D { MODULE_DEVICE_TABLE(i2c, pca954x_id); =20 static const struct of_device_id pca954x_of_match[] =3D { + { .compatible =3D "maxim,max7356", .data =3D &chips[max_7356] }, + { .compatible =3D "maxim,max7357", .data =3D &chips[max_7357] }, + { .compatible =3D "maxim,max7358", .data =3D &chips[max_7358] }, + { .compatible =3D "maxim,max7367", .data =3D &chips[max_7367] }, + { .compatible =3D "maxim,max7368", .data =3D &chips[max_7368] }, + { .compatible =3D "maxim,max7369", .data =3D &chips[max_7369] }, { .compatible =3D "nxp,pca9540", .data =3D &chips[pca_9540] }, { .compatible =3D "nxp,pca9542", .data =3D &chips[pca_9542] }, { .compatible =3D "nxp,pca9543", .data =3D &chips[pca_9543] }, --=20 2.39.2 From nobody Thu Dec 18 19:43:30 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73FB1C77B73 for ; Mon, 1 May 2023 09:16:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232287AbjEAJQP (ORCPT ); Mon, 1 May 2023 05:16:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229688AbjEAJQC (ORCPT ); Mon, 1 May 2023 05:16:02 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A03961AB for ; Mon, 1 May 2023 02:16:00 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-94a342f7c4cso467945466b.0 for ; Mon, 01 May 2023 02:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1682932560; x=1685524560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=deLhqHNlkRGaOVPkjyoMd684bHUV64uU06CP2w8Rkjc=; b=gj0WDZrvDo6kdPGp5lFtedx5wR7mFPU8FR0fdP8cVEhniVnsLG1KeCwwwnzFaUILX0 Caa1boWYSK1UkDkNcEXV0Pc9oOEvhyrWlWtdpazA65ypqCGKOEGgDVbYW9zt6w/uscZ9 yiolFislJzxwOdEH2pXWnabryAs8MJhTu1XTkMqe7OjGXxIhYJXgWVocGoPv1VfJHb1w V7RDc2/LQOjrHEpUAD4LShHCLdq2Jzr2BNUy8ldShYiUQ4I5rajthijHF0DJYtJXVTfX ZU7C/FCiyJo7d8YuIUjM2+i5eIq1Dg5oOO/VS5eBdofjNK+o4h4W+761L9A8EH5GxYEh zHhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682932560; x=1685524560; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=deLhqHNlkRGaOVPkjyoMd684bHUV64uU06CP2w8Rkjc=; b=JsWGqglT133CZDtF8dwshWCJjFrYLlv1zOSKH2A7kyMHIiSFhOnfLDDglkntg+qEdg lNpYclYjQCrkCf+oKTxT3GW+Npy9HaM/d3gK4i8QpxrQF0WKYsDwFvR38DqD0ZwkvHCG RtDgfPPcQCtkLp1U4x4HpdsfqvjXT30u52K1umbddnUD2V9ggkRngbLs6X8Cd8c9qxRq RAKwv0ookdEnL91oC1MLxI31vR7q2HJoT7uVBumXmgKKOKitfJXBz35dppt4ofym0Ma4 ELZ7Xvti1TzM9rrAijRV+9QrDZFBd5me1LIo9SXXVK6XCubq4c7U/z5TnIPasLKJoFso OfkA== X-Gm-Message-State: AC+VfDxlp5es6Pyeg1SumUVDun9jyvYarNll+QyrnSERGbv9CqSZsJ7b 3Kfwi24DnG49H2ExI8B/d7QRRA== X-Google-Smtp-Source: ACHHUZ4Y4cbO7jqnHQ+V0Unb725qqsrtAckf2/0TSgsaBOt3rZZjTc6hfx4mrxGzT5lGMzWBvvT1uA== X-Received: by 2002:a17:907:728d:b0:95f:2046:d20d with SMTP id dt13-20020a170907728d00b0095f2046d20dmr12568044ejc.2.1682932560217; Mon, 01 May 2023 02:16:00 -0700 (PDT) Received: from fedora.. (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id xa3-20020a170907b9c300b0094e954fd015sm14714266ejc.175.2023.05.01.02.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 May 2023 02:15:59 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin Cc: Patrick Rudolph , Andi Shyti , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v14 4/4] i2c: muxes: pca954x: Add regulator support Date: Mon, 1 May 2023 11:15:51 +0200 Message-Id: <20230501091552.847240-5-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230501091552.847240-1-patrick.rudolph@9elements.com> References: <20230501091552.847240-1-patrick.rudolph@9elements.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Add a vdd regulator and enable it for boards that have the mux powered off by default. Signed-off-by: Patrick Rudolph Reviewed-by: Andi Shyti --- drivers/i2c/muxes/i2c-mux-pca954x.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mu= x-pca954x.c index 968111442625..b863f7b18190 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include #include @@ -101,6 +102,7 @@ struct pca954x { struct irq_domain *irq; unsigned int irq_mask; raw_spinlock_t lock; + struct regulator *supply; }; =20 /* Provide specs for the MAX735x, PCA954x and PCA984x types we know about = */ @@ -444,6 +446,8 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc) struct pca954x *data =3D i2c_mux_priv(muxc); int c, irq; =20 + regulator_disable(data->supply); + if (data->irq) { for (c =3D 0; c < data->chip->nchans; c++) { irq =3D irq_find_mapping(data->irq, c); @@ -496,10 +500,22 @@ static int pca954x_probe(struct i2c_client *client) i2c_set_clientdata(client, muxc); data->client =3D client; =20 + data->supply =3D devm_regulator_get(dev, "vdd"); + if (IS_ERR(data->supply)) + return dev_err_probe(dev, PTR_ERR(data->supply), + "Failed to request regulator\n"); + + ret =3D regulator_enable(data->supply); + if (ret) + return dev_err_probe(dev, ret, + "Failed to enable vdd supply\n"); + /* Reset the mux if a reset GPIO is specified. */ gpio =3D devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(gpio)) - return PTR_ERR(gpio); + if (IS_ERR(gpio)) { + ret =3D PTR_ERR(gpio); + goto fail_cleanup; + } if (gpio) { udelay(1); gpiod_set_value_cansleep(gpio, 0); @@ -516,7 +532,7 @@ static int pca954x_probe(struct i2c_client *client) =20 ret =3D i2c_get_device_id(client, &id); if (ret && ret !=3D -EOPNOTSUPP) - return ret; + goto fail_cleanup; =20 if (!ret && (id.manufacturer_id !=3D data->chip->id.manufacturer_id || @@ -524,7 +540,8 @@ static int pca954x_probe(struct i2c_client *client) dev_warn(dev, "unexpected device id %03x-%03x-%x\n", id.manufacturer_id, id.part_id, id.die_revision); - return -ENODEV; + ret =3D -ENODEV; + goto fail_cleanup; } } =20 @@ -543,7 +560,8 @@ static int pca954x_probe(struct i2c_client *client) ret =3D pca954x_init(client, data); if (ret < 0) { dev_warn(dev, "probe failed\n"); - return -ENODEV; + ret =3D -ENODEV; + goto fail_cleanup; } =20 ret =3D pca954x_irq_setup(muxc); --=20 2.39.2