From patchwork Mon Aug 21 06:20:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Rudolph X-Patchwork-Id: 715594 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 C028CEE49AE for ; Mon, 21 Aug 2023 06:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233384AbjHUGVK (ORCPT ); Mon, 21 Aug 2023 02:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233374AbjHUGVJ (ORCPT ); Mon, 21 Aug 2023 02:21:09 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9D2CBE for ; Sun, 20 Aug 2023 23:21:04 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4ff8cf11b90so4458130e87.1 for ; Sun, 20 Aug 2023 23:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1692598863; x=1693203663; 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=VIjrnEwaKeqGTU5grAtJfqf2YP8aALmcmlloCUUh95k=; b=glceY5R7NLTH1At17OhMFATBfpYlKbRgzThJz1rQhvSb+8bW+pKrL5bXzdlzW8toOO QD80zDtwRI9PPMaxtPWwVFyN8yDcd9bGdtsB9uPVA8iWoEfaxKOSDLb9+6pIb5L17Eto 55UVFcX/sY837HwMdRuFr6xsqxB5mjkJCX+kqU+vJukdToA+58+Oe94eS6BpXkGokE4A YxBiKVpkEeu81V0M+nJ8DGu63VPUEvmYu9sjrCjVOW/lEcbA11y4W7IqQQo88CHShlVN YnOnN1sAfpqG83WTcXx6YCMddSryG/yKBhCDnTL7xZ2sR6hN0rGPXuMSrYPgV4IwJjXj V49Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692598863; x=1693203663; 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=VIjrnEwaKeqGTU5grAtJfqf2YP8aALmcmlloCUUh95k=; b=gx5X7jr4QP/ehI0H155S6orPGch7gGDH0bNJC8NNTwvW7Mz+4CjFtg8ydK/U3pfUDh 7N+fIBeDLQ4+qCSRfd15QGAKUwq0S/nQk+P5ZJRNbCdvf4jdOD8FZS0m2aWm7iXESlbi g3ciI2oVe767HhiPo6MIo4irr7fx2uFCrGnk6p5VacrdOdWSeZir/KuegZrYQSMWDxN8 Akyjn2aLh7Yvvzj81ZgqJhc74QNzjwa1ADJGyrzke9gOtjaVlDezCrWu5X/5oEplNccx vBEbUuskNyTitXdF32wMzEf45doQrrpMae+RqEiSq9crAi5SoaBNkWOKFk7dXg/WLvLR S4wQ== X-Gm-Message-State: AOJu0Ywjm3alpSQ9rbl1iqBPT4BMKZYlPSpzof+T6+AAJkOcet4V7GA3 vSfs5yi+02AGn4eDmOsWfhXhLg== X-Google-Smtp-Source: AGHT+IFIQbWRDBMaVNqei5iytuBBv71VukpPeFNpEVR6BikwZiVmxNwYheSJXndTuCqbtUQv0/bSrg== X-Received: by 2002:ac2:4c82:0:b0:4ff:87f6:6ee5 with SMTP id d2-20020ac24c82000000b004ff87f66ee5mr3107820lfl.10.1692598863092; Sun, 20 Aug 2023 23:21:03 -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 c4-20020aa7df04000000b00523b1335618sm5455003edy.97.2023.08.20.23.21.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 23:21:02 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin , Laurent Pinchart Cc: naresh.solanki@9elements.com, Patrick Rudolph , Krzysztof Kozlowski , Rob Herring , Krzysztof Kozlowski , linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v16 1/4] dt-bindings: i2c: pca954x: Correct interrupt support Date: Mon, 21 Aug 2023 08:20:21 +0200 Message-ID: <20230821062027.2631725-2-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821062027.2631725-1-patrick.rudolph@9elements.com> References: <20230821062027.2631725-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 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/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 Mon Aug 21 06:20:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Rudolph X-Patchwork-Id: 715593 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 77995EE49A8 for ; Mon, 21 Aug 2023 06:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233396AbjHUGVM (ORCPT ); Mon, 21 Aug 2023 02:21:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233392AbjHUGVL (ORCPT ); Mon, 21 Aug 2023 02:21:11 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D6DA7 for ; Sun, 20 Aug 2023 23:21:08 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-522bd411679so3557212a12.0 for ; Sun, 20 Aug 2023 23:21:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=9elements.com; s=google; t=1692598866; x=1693203666; 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=mhOUt2tzecxNC3yGDp4EJrCLbLTReEQeCvGgn9oNECQ=; b=ZQM1yvfOVOjcoGQYSEeUL61W/8qjmfX75t6ywcuimb4Z5OGEh+9xLJMqBdpWickwAC 71wVipcSDAzKllbVAhHEo6e6Bz6I3d7K8q6NChgRFhgqpMzs2cVlqCEIp2NTeJQ64tky udzhZ1+M34yeWCFYABh20rXqNcxAZ7rXX3iWN7EhSZ7pLOMdT7iYgwR0rc4uonLqyIkq gz3hvFU/ThRccrx3ROnG0QhiipwJDS5QYu8O7kya9BlqrkNXBLSS9/8WYv1jsPXk9tjd yhe6EKSmgUV6oaB1SMXRjblNUpxzB500FYclY0VQ+BswO9nUO4Kb98+hCmPdo+kpM0HI /igw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692598866; x=1693203666; 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=mhOUt2tzecxNC3yGDp4EJrCLbLTReEQeCvGgn9oNECQ=; b=hC2C4TC1MdIltB7fdTxmS0HWrKO5JadLJzy+B79ke0IDWPykMyb5hmfAo8u94RlIMK GDU8/8vBxnTDUAf+i2pSPD3ZRO5glK7iU9mdkBBQM2aGYQG+mTwRJD5reYZZwP+ji/Rd ZRsINK8CUDDxZ8P2FDzanRMo1Ejy2AaKuI0l8pQK2GfN1BjbHpPn5ByjU0QdFzp4Ry3L UaewiWaA9VEIM4p0hmHSK77Su/IzQWFg8WeHOR+6gx7/OL+1eYCC3K01JyKdTMtji9oT 7heFjDqE/GoIuL+f7B3surwWihkmMi8qqq2y1+ifoFawQCpsIBZNjmjMEBa3xZC98smS OvmQ== X-Gm-Message-State: AOJu0YxyF/Dm4rueGg/YN6FyaXd9P7hYywPvYNJL0h0gucZLHjDlUaTZ i4g5kb07x79D7FbGL0qvw67ubg== X-Google-Smtp-Source: AGHT+IEZ1WGJCViXYgku7ZS537iNI1j7BtgGYKhrahmtuPd9m/nuY+r0npj3vob2/C6pkRBxjSVxWA== X-Received: by 2002:a05:6402:60f:b0:51d:fa7c:c330 with SMTP id n15-20020a056402060f00b0051dfa7cc330mr3787050edv.26.1692598866798; Sun, 20 Aug 2023 23:21:06 -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 c4-20020aa7df04000000b00523b1335618sm5455003edy.97.2023.08.20.23.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Aug 2023 23:21:06 -0700 (PDT) From: Patrick Rudolph To: Peter Rosin Cc: naresh.solanki@9elements.com, Patrick Rudolph , Andi Shyti , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [v16 4/4] i2c: muxes: pca954x: Add regulator support Date: Mon, 21 Aug 2023 08:20:24 +0200 Message-ID: <20230821062027.2631725-5-patrick.rudolph@9elements.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821062027.2631725-1-patrick.rudolph@9elements.com> References: <20230821062027.2631725-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 32873df56e33..f36a26acb0d2 100644 --- a/drivers/i2c/muxes/i2c-mux-pca954x.c +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -100,6 +101,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 */ @@ -447,6 +449,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); @@ -499,10 +503,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); @@ -519,7 +535,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 || @@ -527,7 +543,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; } } @@ -546,7 +563,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);