From nobody Wed Dec 17 17:24:16 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 841D6C77B75 for ; Tue, 18 Apr 2023 10:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231156AbjDRKes (ORCPT ); Tue, 18 Apr 2023 06:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231148AbjDRKep (ORCPT ); Tue, 18 Apr 2023 06:34:45 -0400 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796874223 for ; Tue, 18 Apr 2023 03:34:40 -0700 (PDT) Received: by mail-ej1-x62b.google.com with SMTP id a5so15365303ejb.6 for ; Tue, 18 Apr 2023 03:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1681814079; x=1684406079; 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=hM2bBHeuxBAL+DDlwpzy9mMXdD/d67LP1Ods6dYdRvw=; b=G/Yr8UnshxTTU0x/fkPRKMujQ5ZWfMqshcIz2TQ3RQAAtRxNkhI3oclzOj3Q5cA4Hh mihM+AezDm1OAID5iOA8ChjjMRi6WJm0hhbIH8wIf55PHLoX6sswIT4tqh4lNxEhTv9w L6YQf860x++r7n8E2pNadit5bEl8IvEe/SCmJI3F3kdZ9ymST2IhXIrv5jh/pzre0/Kv 7nCd8npP1WIBP3cmBdctmg19vhTj793hODD7kmnViW7nD2wKPBU3JEKV5vb6lNiuejIr ejlBvdESwqatIhZ+CWTjnYBrqiMYzXx0hXE4cbYrXMyM2euAkxrqVyJDtFqcOPP96Wk9 6RRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681814079; x=1684406079; 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=hM2bBHeuxBAL+DDlwpzy9mMXdD/d67LP1Ods6dYdRvw=; b=ePrGGfebZLNeyx+SFMXyCa+FXsbBwcWJNX0IzaEaOzmLbjlOlsF7dRwlUMuR2x8Spt MrQnpjz/dzOs8ChzyzxxupFWfB+gWVNTt2+bVpybvz3ad5yCiBngOwSq3NxSR5TBgMQM eqgQce+ZHoQT+9OY4s2yuEUHhTn9h66BH64loLidqp5PDxFRBkMk4fgQbHQVpjbu73P9 vZakjNOzIMFSKBYCrAarY+lHbcdcZkBeQw6Z28ONqPKcP43vNF0/ARvfHJe8ZvrkMg5q F1HRaXiGthN5GRSKoM5JW9QvighUu5dD7NT/S/hSIk8Q3JzYS/iDNHWw3G1LbD5oV+UR 0M4g== X-Gm-Message-State: AAQBX9flPyzTGVFVRSo5gy7YzZVkGYzKhhuSSnxhu9g7TrhaGFoY06vc k/84jAiV2I9bDyy+SfXKuPoq0fWsOGZUq3ZdudQ= X-Google-Smtp-Source: AKy350aTCH+B8Ums8L23m06EJw4GP871eBtakETBhkR0nRfLJuZ+KFWJZrT1ruET6duNnnziUc+QmA== X-Received: by 2002:a17:906:f14f:b0:94a:a6f0:876a with SMTP id gw15-20020a170906f14f00b0094aa6f0876amr10247396ejb.1.1681814078906; Tue, 18 Apr 2023 03:34:38 -0700 (PDT) Received: from fedora.sec.9e.network (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id a12-20020a170906368c00b0094e8de89111sm7787126ejc.201.2023.04.18.03.34.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 03:34:38 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin , Laurent Pinchart Cc: Patrick Rudolph , Rob Herring , Krzysztof Kozlowski , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 1/4] dt-bindings: i2c: pca954x: Correct interrupt support Date: Tue, 18 Apr 2023 12:34:26 +0200 Message-Id: <20230418103430.966278-2-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418103430.966278-1-patrick.rudolph@9elements.com> References: <20230418103430.966278-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 Wed Dec 17 17:24:16 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 896D0C77B75 for ; Tue, 18 Apr 2023 10:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230202AbjDRKez (ORCPT ); Tue, 18 Apr 2023 06:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231168AbjDRKes (ORCPT ); Tue, 18 Apr 2023 06:34:48 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0799F30E4 for ; Tue, 18 Apr 2023 03:34:41 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id xi5so71870406ejb.13 for ; Tue, 18 Apr 2023 03:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1681814080; x=1684406080; 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=I7Q1JsgF5Q04kUmYGB7Jt2UNKAI2tCihr6khAmdtiX8=; b=E147n00VExPQSNJ++tUlOlM70gBbXjleKxyZ1iWbuwaJeJd18cm+FhcnaOeQs+rqT5 W8RxMeZuYM2jaMtRVyV/ARsRYb7sWYmNN2OlA5UrHBFqY/lnAlRGOkDw9oe4pcTROOVS oABKwfL/Rdn8tYkVCEfQwpbZeeBujR7SBh/8cf/HI7swbEu2jMuxGp5P/ZNkhUXSk8bV i67KEKuKBvE3j0ZA+IVt7Hpn7KHSuaZ5utLoL+YewSQcpff93L2i62+MAHUoZ7M2y+M5 ufDFwDkfh6IlnDNMqp2y20rrkADGOtECr07Vi8l9LcRTkAmIycpNAm6jXrc8qVFJbH7I zhxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681814080; x=1684406080; 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=I7Q1JsgF5Q04kUmYGB7Jt2UNKAI2tCihr6khAmdtiX8=; b=jJhozv1l4jdnII9sjYKJhholSDw50Pm3NQpAJsBflcwxaMkYw2EXUW0gyPHAdlJl/Z 56zOWPkBQfz9c54NTDrQQ5UubjdY4fhKayz2N0d+HkStJYLCgvybkNR2wSUcfePEdF2c 4kqMGHdX615MaD/2OqPbCcZok4uIdtoDteA05hSzZzeIGtgfW6bYf2WXbGlHDMbkF6+o 6WKgzC5SEVI3pyQrbAyRyNM7zhZMlNd2qt83RohorMJd8p6OVYcm11rx1XiWTYaAdcim n7ayvYrWLl5RWh0SoNeNJ8JYYxlp9KuNVwR2JShVKC72LGH59KoMRXPy/MsqjdG6Uazg TOAg== X-Gm-Message-State: AAQBX9eSwCbethYHcb4PIrb5hliVBPU84N9+UBMay9U/UVFl2UenUd75 JucB4On9HxiesT4TQBpiSTS6Xg== X-Google-Smtp-Source: AKy350bB9a4FZVMGgxt+ZPo0xrQxGBbC9/uSQs20HG+NZM0U83LT3Rs1hQpE3X0g9z/AJ17E2Nh3sA== X-Received: by 2002:a17:907:6d11:b0:94f:59aa:8a7c with SMTP id sa17-20020a1709076d1100b0094f59aa8a7cmr7714130ejc.20.1681814080301; Tue, 18 Apr 2023 03:34:40 -0700 (PDT) Received: from fedora.sec.9e.network (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id a12-20020a170906368c00b0094e8de89111sm7787126ejc.201.2023.04.18.03.34.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 03:34:39 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin , Laurent Pinchart Cc: Patrick Rudolph , Rob Herring , Krzysztof Kozlowski , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 2/4] dt-bindings: i2c: Add Maxim MAX735x/MAX736x variants Date: Tue, 18 Apr 2023 12:34:27 +0200 Message-Id: <20230418103430.966278-3-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418103430.966278-1-patrick.rudolph@9elements.com> References: <20230418103430.966278-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 Wed Dec 17 17:24:16 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 908F1C77B71 for ; Tue, 18 Apr 2023 10:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230120AbjDRKe7 (ORCPT ); Tue, 18 Apr 2023 06:34:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231183AbjDRKet (ORCPT ); Tue, 18 Apr 2023 06:34:49 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12C5AE75 for ; Tue, 18 Apr 2023 03:34:43 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id dx24so27874499ejb.11 for ; Tue, 18 Apr 2023 03:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1681814081; x=1684406081; 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=ptbjamGhMyu09RNJTMyfQz+iG/jOM+udvXtxjHUIUcQ=; b=BGH5TTCPBlLOvjyXLuFPDThsjptdWeLPpodanSEk2daW6X2XzAJ/EeCMnjFmYJv1f0 v+uTruNoP+7WSw17DSAhAq1gs/yzpl+MH+U4Jro4EsOvXfDIjVhMZYDxFX4D3niRxZQR Wk1boEJZCOZjz+PcHWE9a4iJYmhB66zu3PcsmCsJi1yAwMuTv2w89Cs3k/Eg2B70fSks 95sMhJVK+xNbb6iw/QfJpGKWrraLu3G+jPTenDngKXojnil/dCDKdktCEkXcULti7AH7 dA/iq2pSLi3TigHYaU41pnyrJX7PSNg8it2mqiXuOmyuMK9c34XFR0HM/riFsvesy+XT lN4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681814081; x=1684406081; 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=ptbjamGhMyu09RNJTMyfQz+iG/jOM+udvXtxjHUIUcQ=; b=huR9UFuYUvvn33QqZXa0uIoBEvqYb3m6iwn9GA7FL9qTrULZ+xugC52gOK80Ej41mN t5SgEkxGOYOildf1fyMZbX0RMw/+wA8pzuYYi2s+VCToUxOssV//w9vi6wt44TmwvXJA 02LPkmaFPfK+/7L4H8Auo5eu/4IDjMx7qM4IC4OEUPe+eQ4ovwg0hrAE5pEgbTtoWCQq cuIA3p/UkcEh1Ht4sxQ/lvlOXXqsUBWDICB8h5WVuvNjtjmRkx+z4UbQ3uEfR7Wi0pXL EGMFM7T1V6wpoGb7xA0nSYMfO8gz68pOM10kDTeYBW4HW+4/P45/aQy0zp2zEywyf3K0 i/Yw== X-Gm-Message-State: AAQBX9fGJPzlh6EPsqZUg6u8jsTBYON81KTNxjO4WTswgk/MOa7RPnAL J5QuGtUC9v4BWojKY+JmPdvBhQ== X-Google-Smtp-Source: AKy350YPjgsyG6LSirb9K3wB69rtNtz5St2WE6vUpTCaLWl/n+8Q6+RZkMgZP7rtUbuMx7cAPZ8XZQ== X-Received: by 2002:a17:906:6816:b0:951:786f:e3b3 with SMTP id k22-20020a170906681600b00951786fe3b3mr2049767ejr.34.1681814081609; Tue, 18 Apr 2023 03:34:41 -0700 (PDT) Received: from fedora.sec.9e.network (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id a12-20020a170906368c00b0094e8de89111sm7787126ejc.201.2023.04.18.03.34.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 03:34:41 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin Cc: Patrick Rudolph , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 3/4] i2c: muxes: pca954x: Add MAX735x/MAX736x support Date: Tue, 18 Apr 2023 12:34:28 +0200 Message-Id: <20230418103430.966278-4-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418103430.966278-1-patrick.rudolph@9elements.com> References: <20230418103430.966278-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 Reviewed-by: Andi Shyti =20 --- drivers/i2c/muxes/Kconfig | 6 +-- drivers/i2c/muxes/i2c-mux-pca954x.c | 60 ++++++++++++++++++++++++++++- 2 files changed, 62 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..a9195d1547f1 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,41 @@ 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 }, + }, + [max_7358] =3D { + .nchans =3D 8, + .muxtype =3D pca954x_isswi, + .id =3D { .manufacturer_id =3D I2C_DEVICE_ID_NONE }, + }, + [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 +223,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 +246,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 Wed Dec 17 17:24:16 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 F2D17C77B75 for ; Tue, 18 Apr 2023 10:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229533AbjDRKfI (ORCPT ); Tue, 18 Apr 2023 06:35:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231187AbjDRKet (ORCPT ); Tue, 18 Apr 2023 06:34:49 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C24126A5 for ; Tue, 18 Apr 2023 03:34:44 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id xi5so71870677ejb.13 for ; Tue, 18 Apr 2023 03:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1681814082; x=1684406082; 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=Ml1nedlrXgWfNGvpKNjoDJf5JKupI4N1yItZ011XKWE=; b=BON11A64Y1B8bvrfHmnxxqy2xkhp2EHBMOU1eOLDje3/DfAairJHN4KeyE/lqCshf5 Lm5TxwIaa5TGjpOTm+cWWJAihOI64Fxmgd1xM+GdUbMMU7FiOApVe8Ec++warn3IBr4z PE+oU0kQYwgWCgLddUjuVIPKdMP4mC1cTvrjMY0xl/r+eLlBbSYg6hCEXOhW39boQIhU 19DYMTCe6VtkSGE2jjtOAeFrrLHIrqaBN5mrKyJhRY0KyJVd0QTTxdVxuBBuHzZM5Urr Kw6SHZeEgFFjfOoVISZcpyXAy5snPr68fnhxNFbWs2Wy4xZCPBuZzCGve6PJbODCh21Z qwtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681814082; x=1684406082; 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=Ml1nedlrXgWfNGvpKNjoDJf5JKupI4N1yItZ011XKWE=; b=d7ficGiu3rhZ+tX1K+pXgsd9hdhpFrMSXbOexJsfHM53q51vXP56hjeJ9XqiLrgQtQ pvYYFL26YxGhSceGcRAmIoj/lo9HkAn2j6YMIeKPuRbA6Yd28WQgfkcLU7zDVfs2y08+ XuRTSdYmOZvuREWpqy2IEFU3XMC96D3gsWCL4tFRZPAc8zpKNyk57r6XY0nCsnJutICJ r+Ifedw37bkqEWoAs0NJ491/RSP2dNKTnc/o8U1plKpB+hG1bC8dnUzarMZbAutAXsAU XeF+hw1dmW6+IQiarMTXLQdeZIG9gqQni9RxGKvT9dPY2qkN79TXVqLEuI75QlFFLhT0 DRkA== X-Gm-Message-State: AAQBX9eD9lSSy7MSaDdZphzgM1/LtrJd9DFeP3u+BqmvXkkxutZyl6Ed LMPbtUdQxgA92H5kZasmUGen4XDGdRXCZWnSXHw= X-Google-Smtp-Source: AKy350bPKU4OdS+klRmOWNR8bkLPj+3uDBrJAHLQi3R7lTVgk8ARhBx107G8MSkeiS6LlAbKBIjdoA== X-Received: by 2002:a17:906:4e0b:b0:8f5:8da0:a482 with SMTP id z11-20020a1709064e0b00b008f58da0a482mr10678683eju.25.1681814082708; Tue, 18 Apr 2023 03:34:42 -0700 (PDT) Received: from fedora.sec.9e.network (ip-095-222-150-251.um34.pools.vodafone-ip.de. [95.222.150.251]) by smtp.gmail.com with ESMTPSA id a12-20020a170906368c00b0094e8de89111sm7787126ejc.201.2023.04.18.03.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 03:34:42 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin Cc: Patrick Rudolph , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v13 4/4] i2c: muxes: pca954x: Add regulator support Date: Tue, 18 Apr 2023 12:34:29 +0200 Message-Id: <20230418103430.966278-5-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418103430.966278-1-patrick.rudolph@9elements.com> References: <20230418103430.966278-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 =20 --- 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 a9195d1547f1..ae98e76e0733 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 = */ @@ -440,6 +442,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); @@ -492,10 +496,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); @@ -512,7 +528,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 || @@ -520,7 +536,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 @@ -539,7 +556,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