From patchwork Tue Apr 18 10:34:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Rudolph X-Patchwork-Id: 675742 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 01F4BC77B7F for ; Tue, 18 Apr 2023 10:34:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbjDRKeq (ORCPT ); Tue, 18 Apr 2023 06:34:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230501AbjDRKep (ORCPT ); Tue, 18 Apr 2023 06:34:45 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79AB74234 for ; Tue, 18 Apr 2023 03:34:40 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id xi5so71870247ejb.13 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=S72d9cPJ7qgJLl+H3DS08iJKPNkoZMqd3VWimM01N8x0FzpObThrXDhI6e48infdLx PGZ+4IJ7yf3+hy9QS5WdZHjQllKb1Q8y79hgQ+Vhg9UCPB4MS+N2a8kWAcFmKnvzK+n6 VXqXq4sgLV9k6VuIk5i3D0DGqpex+T+6on833z8cwf41OGnSn26j5hzWGgHzYEpnO9VA ZFAvDq+d50x+Nt2rDfeTuMsepzehNf3kd/3vHtS9Fc6LdQCsR93mvNSMddbXA+vpsD4t jim4Y2hW9MHkRUEyfJuc4LV5s6Wd55vEEZysxsSW86vjoMEouwYojWa6pgcEe9Jawwd2 dKYg== X-Gm-Message-State: AAQBX9e3Yv8PiNx5rKhiCiarQcjedstcGkvK62YXTCxOdt1XkZT31tAT lLY17rZcBWnuNh7owub8Rou83g== 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 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 --- .../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/Documentation/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. -allOf: - - $ref: /schemas/i2c/i2c-mux.yaml# - properties: compatible: oneOf: @@ -63,6 +60,24 @@ required: - compatible - reg +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 examples: @@ -74,7 +89,7 @@ examples: #size-cells = <0>; i2c-mux@74 { - compatible = "nxp,pca9548"; + compatible = "nxp,pca9545"; #address-cells = <1>; #size-cells = <0>; reg = <0x74>; From patchwork Tue Apr 18 10:34:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Rudolph X-Patchwork-Id: 674869 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 57813C77B78 for ; Tue, 18 Apr 2023 10:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbjDRKeu (ORCPT ); Tue, 18 Apr 2023 06:34:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbjDRKeq (ORCPT ); Tue, 18 Apr 2023 06:34:46 -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 07BDC5274 for ; Tue, 18 Apr 2023 03:34:42 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id fw30so19108526ejc.5 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=QVWGLu43yS0qEQL1GB2vG4R/RSOU5sCAoIz8/8Bv2ggoyG0iyA1PqkZ2coe++FTzpZ 1GVr0jAOYgLrKYkIYZ5/zk8gjrwmt6dq3q66jII0zsV7OnlHiYRUrtNFYkYGlDsfxIqT lFPuvmPpwLbI+nhk5lj9It+bbI9hfRbkhdxnB/O2PTGbOpjY+HMDCkJLb42wqyZVmwcC hHYgKiJy7ESJXvDyLEnnbTK1MWV0ZvLiEzGEBO4Y63hsggYPxG4anR/UyndbdKq8A2F6 t7SMqBsBeluUaPfIJ+4hwkHEp48/tW0Nxy+t4lNvgvz9vNRyhQ5oEpriUOsYKwLJuZD3 SYdw== X-Gm-Message-State: AAQBX9coB9uU6NZDRa7NZ/KBedD8j0Y8dPNENPiTaikm7h20+Zh5hExn +HMqD8U59yWIaQSEopZg/jDdqA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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/Documentation/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# -title: NXP PCA954x I2C bus switch +title: NXP PCA954x I2C and compatible bus switches maintainers: - Laurent Pinchart 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. 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 + 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 = <0>; reg = <0x74>; + vdd-supply = <&p3v3>; + interrupt-parent = <&ipic>; interrupts = <17 IRQ_TYPE_LEVEL_LOW>; interrupt-controller; From patchwork Tue Apr 18 10:34:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Rudolph X-Patchwork-Id: 675741 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 94BBAC77B71 for ; Tue, 18 Apr 2023 10:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbjDRKey (ORCPT ); Tue, 18 Apr 2023 06:34:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231176AbjDRKet (ORCPT ); Tue, 18 Apr 2023 06:34:49 -0400 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1259810A for ; Tue, 18 Apr 2023 03:34:43 -0700 (PDT) Received: by mail-ej1-x634.google.com with SMTP id c9so33052624ejz.1 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=ZgNIW0Hn5C6qn47j+3uFf8DTSFAA2pIzgb22s41IzH1umDVa1H65Oatmh3A28JQlNC CH7NdlJR4D8d90J5sJSdokypgX5CDkWGtJiG6+P9rFLbc/uJ3EvHQpXiIkFYuxV0gRhD Ny2TFADi0CgVzN6eAOAfPbYZEWGsKe+tUlzjSI5jwVLMzDCS7qsGuG2CuvWy2QHvM3n/ 0aJJh8ECF+5LrWFEAe9XhG3p6yzdaW9/xz0dTs1FHJ/GvYr2PBAhlaxkEqcs1sted1in Ki8Sfj4aprnzVgRS04KN+jneu2Kr60EdK2ErWLB0zcmZqzQs5hLSUXR5cwCa6UMNNuwY OBTg== X-Gm-Message-State: AAQBX9fZHO8gps7Ul3X0RIN/oUXvWJuOV5ghN6UkKK9PQ18ZFtnDOnh2 GgjILpHq83qX9IUy2qFKLOSZmg== 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 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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 --- 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. 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. 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-mux-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 controlled + * 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 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; }; -/* 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[] = { + [max_7356] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [max_7357] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [max_7358] = { + .nchans = 8, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [max_7367] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .has_irq = 1, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [max_7368] = { + .nchans = 4, + .muxtype = pca954x_isswi, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, + [max_7369] = { + .nchans = 4, + .enable = 0x4, + .muxtype = pca954x_ismux, + .has_irq = 1, + .id = { .manufacturer_id = I2C_DEVICE_ID_NONE }, + }, [pca_9540] = { .nchans = 2, .enable = 0x4, @@ -177,6 +223,12 @@ static const struct chip_desc chips[] = { }; static const struct i2c_device_id pca954x_id[] = { + { "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[] = { MODULE_DEVICE_TABLE(i2c, pca954x_id); static const struct of_device_id pca954x_of_match[] = { + { .compatible = "maxim,max7356", .data = &chips[max_7356] }, + { .compatible = "maxim,max7357", .data = &chips[max_7357] }, + { .compatible = "maxim,max7358", .data = &chips[max_7358] }, + { .compatible = "maxim,max7367", .data = &chips[max_7367] }, + { .compatible = "maxim,max7368", .data = &chips[max_7368] }, + { .compatible = "maxim,max7369", .data = &chips[max_7369] }, { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, { .compatible = "nxp,pca9542", .data = &chips[pca_9542] }, { .compatible = "nxp,pca9543", .data = &chips[pca_9543] }, From patchwork Tue Apr 18 10:34:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Rudolph X-Patchwork-Id: 674868 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 4CB18C77B7D for ; Tue, 18 Apr 2023 10:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbjDRKez (ORCPT ); Tue, 18 Apr 2023 06:34:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230138AbjDRKet (ORCPT ); Tue, 18 Apr 2023 06:34:49 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 339B119D for ; Tue, 18 Apr 2023 03:34:44 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a5so15365690ejb.6 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=ZvBk7gEMb2+3jtyNDpr90yXdK8r8jwCeSdYo8GImIoM1EFYJ+CMTGd+xnphRycC7Ry 2TYbiq9WHIYcVCv0u6RT7yuNB8yO2DS3fzCy17kY2ZZ1nLoHTHtTwtNXINnpOUZ5+8U6 sqYTtvjVUZB5bUJeGCq/59aZZFWIYDzd+4NOkQ3rMxdQS0AZrY41MnJgCi5OxfZO336I spyh0noNFTykobPRyLY8twGZ/zbN0VT2hscjUiN+shfj8wV+lZg9x/Gq4kDDE/rj8wGc OYOWvruHn2tCVwNFz1bOjA5uAwnLedXjUkJf1ahrdIbCoubi3O1zCH7EsRCJ5CLTWBjA dogw== X-Gm-Message-State: AAQBX9enq9IDPmiQh+qWV95a+5pwsPrIbewfhIOo1ni9U8BVNqt+lKwy atMPjNAeZkcVlQ4CY0mE26sigA== 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 Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org 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-mux-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; }; /* 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 = i2c_mux_priv(muxc); int c, irq; + regulator_disable(data->supply); + if (data->irq) { for (c = 0; c < data->chip->nchans; c++) { irq = 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 = client; + data->supply = 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 = 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 = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); - if (IS_ERR(gpio)) - return PTR_ERR(gpio); + if (IS_ERR(gpio)) { + ret = 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) ret = i2c_get_device_id(client, &id); if (ret && ret != -EOPNOTSUPP) - return ret; + goto fail_cleanup; if (!ret && (id.manufacturer_id != 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 = -ENODEV; + goto fail_cleanup; } } @@ -539,7 +556,8 @@ static int pca954x_probe(struct i2c_client *client) ret = pca954x_init(client, data); if (ret < 0) { dev_warn(dev, "probe failed\n"); - return -ENODEV; + ret = -ENODEV; + goto fail_cleanup; } ret = pca954x_irq_setup(muxc);