From patchwork Sat Oct 12 02:56:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1996326 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=dkimrelay header.b=PgYD/w/z; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:45d1:ec00::1; helo=ny.mirrors.kernel.org; envelope-from=linux-pwm+bounces-3610-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org [IPv6:2604:1380:45d1:ec00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XQSnD1smPz1xtp for ; Sat, 12 Oct 2024 13:56:32 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 5106A1C21749 for ; Sat, 12 Oct 2024 02:56:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49BE654FAD; Sat, 12 Oct 2024 02:56:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PgYD/w/z" X-Original-To: linux-pwm@vger.kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.208]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF87B481B3; Sat, 12 Oct 2024 02:56:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.208 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728701780; cv=none; b=Ky2DpGfMAYY/HMliICJitSm5sSMSTs0WV4IXJDubdm41KmisJrY9L6yH/NHaeLDAdAcwpbXdG4EpNqdG7NubcJSUJ2qW20Ffy/eLiBTFm7aepGln5eqGzfk10XQbnj128iK44vOG5YcFmNMpyNPhQMiBcBpBIoInn7rGVxzK5bQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728701780; c=relaxed/simple; bh=Abbcc8k9DiGUoOkzHxsND0zcdoWgeR778AZ6YENQdio=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XgSPFNpkojHFni7PZvr9+VdoPSHEJbptNpNCLHGfdL2AOfwAYdeP4KyCUXEOQJnoUrM0jkgnOE7wwHT2F2GONPEFx68EhWdgmabr3Ii0MFolVdxrT0TTGJ9lrl1/Jze0GxtlGc1/Xmyy8YHKI8QByKH/h41OiVMwrbVLAU/hC/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=PgYD/w/z; arc=none smtp.client-ip=192.19.144.208 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id 90639C0000FB; Fri, 11 Oct 2024 19:56:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com 90639C0000FB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1728701770; bh=Abbcc8k9DiGUoOkzHxsND0zcdoWgeR778AZ6YENQdio=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PgYD/w/zculjPxr1BZVdiTSOaT00rYUDn5DsbrVmXmpLGEv2vkISdhcN7De0DGEZy RNcSiNT/fdNMJNEjO0uhv5d5V4idr+r68LbUKU9VC0DmQS2MzYeLc34p4dgHEpXMWw j77CUvKkjz0KV8rRzBNapD1wz43WwyfRUyE1OSsQ= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id F19B718041CACA; Fri, 11 Oct 2024 19:56:09 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Broadcom internal kernel review list , Thierry Reding , linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), justin.chen@broadcom.com Subject: [PATCH 1/2] dt-bindings: pwm: brcm,bcm7038: Document the 'open-drain' property Date: Fri, 11 Oct 2024 19:56:02 -0700 Message-Id: <20241012025603.1644451-2-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012025603.1644451-1-florian.fainelli@broadcom.com> References: <20241012025603.1644451-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Document the 'open-drain' property that allows configuring the PWM controller outputs in open drain versus totem pole. Signed-off-by: Florian Fainelli --- Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml b/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml index 119de3d7f9dd..12851c43a612 100644 --- a/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml +++ b/Documentation/devicetree/bindings/pwm/brcm,bcm7038-pwm.yaml @@ -25,6 +25,12 @@ properties: clocks: maxItems: 1 + open-drain: + type: boolean + description: + Configure the outputs with open-drain structure, if omitted totem pole + structure is used. + required: - compatible - reg From patchwork Sat Oct 12 02:56:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 1996328 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=dkimrelay header.b=Y4qnNvNl; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=2604:1380:40f1:3f00::1; helo=sy.mirrors.kernel.org; envelope-from=linux-pwm+bounces-3611-incoming=patchwork.ozlabs.org@vger.kernel.org; receiver=patchwork.ozlabs.org) Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org [IPv6:2604:1380:40f1:3f00::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XQT016SHhz1xv6 for ; Sat, 12 Oct 2024 14:05:53 +1100 (AEDT) Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0D0FAB224CC for ; Sat, 12 Oct 2024 03:05:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BD9B839F4; Sat, 12 Oct 2024 03:05:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Y4qnNvNl" X-Original-To: linux-pwm@vger.kernel.org Received: from relay.smtp-ext.broadcom.com (relay.smtp-ext.broadcom.com [192.19.144.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6061224D7; Sat, 12 Oct 2024 03:05:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.19.144.207 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728702348; cv=none; b=eJ6PJZtKkXcHQubb+4aNfck9eal9SgD20yNMce8qd9SJkO3FMo0Ji13InR7sKweCx2oBOJFeAHBVWNT+rwHGxb1HRKbXNC/Y5Zjbt6OYKD9RCIvr0mNm1O8BPb4zy4ivR+4y6aebKtWILNF+8ZwJ1TgLPPM+PBbQw8JRQp8aHGw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728702348; c=relaxed/simple; bh=xcbxZozTzOOydjpY37v/9USjfCOMyBAeZHXAiSdCmSQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=LxI/OUXLy0Y8nGxrI4DlG2CxN3ato4EFLZF68NtXkNaORaqzojULJDJjP0PLqdEb91dmvI8H+DhIplzYWm/ooYuKCy2Dbq5M1BMTltHbh5sBKh3LLl4XyzDdA9S1kv20r7zJjUVsPTqWRjOcDVdDT7nMrqgWOgDID+5YMkTLhE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com; spf=fail smtp.mailfrom=broadcom.com; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b=Y4qnNvNl; arc=none smtp.client-ip=192.19.144.207 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Received: from mail-lvn-it-01.lvn.broadcom.net (mail-lvn-it-01.lvn.broadcom.net [10.36.132.253]) by relay.smtp-ext.broadcom.com (Postfix) with ESMTP id AEFE0C0000F1; Fri, 11 Oct 2024 19:56:10 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 relay.smtp-ext.broadcom.com AEFE0C0000F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1728701770; bh=xcbxZozTzOOydjpY37v/9USjfCOMyBAeZHXAiSdCmSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y4qnNvNlFxWS1FvRM9AXNoGD0hKC+Ezc+/DYFDglxWqw2lgE+y/nwbPwHxgbvxfLD cpnzcl+UiVnmTjCJUEJdIhVvP6vWuL4xMjFIjEmdnyPwgzbc+lyzaYGxBpCrDaGhWm duAAIAk1m/EhC02do1VBTXbYBskcBYHn6ZsuxraY= Received: from stbirv-lnx-1.igp.broadcom.net (stbirv-lnx-1.igp.broadcom.net [10.67.48.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail-lvn-it-01.lvn.broadcom.net (Postfix) with ESMTPSA id 5825318041CAC6; Fri, 11 Oct 2024 19:56:10 -0700 (PDT) From: Florian Fainelli To: linux-kernel@vger.kernel.org Cc: Florian Fainelli , =?utf-8?q?Uwe_Kleine-K?= =?utf-8?q?=C3=B6nig?= , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Broadcom internal kernel review list , Thierry Reding , linux-pwm@vger.kernel.org (open list:PWM SUBSYSTEM), devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS), linux-arm-kernel@lists.infradead.org (moderated list:BROADCOM BCM7XXX ARM ARCHITECTURE), justin.chen@broadcom.com Subject: [PATCH 2/2] pwm: brcmstb: Do not assume open drain configuration Date: Fri, 11 Oct 2024 19:56:03 -0700 Message-Id: <20241012025603.1644451-3-florian.fainelli@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241012025603.1644451-1-florian.fainelli@broadcom.com> References: <20241012025603.1644451-1-florian.fainelli@broadcom.com> Precedence: bulk X-Mailing-List: linux-pwm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Read the 'open-drain' property to determine whether the PWM controller output(s) should be configured in open-drain versus totem pole mode. Fixes: 3a9f5957020f ("pwm: Add Broadcom BCM7038 PWM controller support") Signed-off-by: Florian Fainelli --- drivers/pwm/pwm-brcmstb.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c index 0fdeb0b2dbf3..b7cecd36ed57 100644 --- a/drivers/pwm/pwm-brcmstb.c +++ b/drivers/pwm/pwm-brcmstb.c @@ -55,6 +55,7 @@ struct brcmstb_pwm { void __iomem *base; struct clk *clk; struct pwm_chip chip; + bool open_drain; }; static inline u32 brcmstb_pwm_readl(struct brcmstb_pwm *p, @@ -176,6 +177,7 @@ static int brcmstb_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm, static inline void brcmstb_pwm_enable_set(struct brcmstb_pwm *p, unsigned int channel, bool enable) { + u32 oe_mask = p->open_drain ? CTRL_OPENDRAIN : 0; unsigned int shift = channel * CTRL_CHAN_OFFS; u32 value; @@ -183,9 +185,9 @@ static inline void brcmstb_pwm_enable_set(struct brcmstb_pwm *p, if (enable) { value &= ~(CTRL_OEB << shift); - value |= (CTRL_START | CTRL_OPENDRAIN) << shift; + value |= (CTRL_START | oe_mask) << shift; } else { - value &= ~((CTRL_START | CTRL_OPENDRAIN) << shift); + value &= ~((CTRL_START | oe_mask) << shift); value |= CTRL_OEB << shift; } @@ -244,6 +246,7 @@ static int brcmstb_pwm_probe(struct platform_device *pdev) platform_set_drvdata(pdev, p); + p->open_drain = device_property_read_bool(&pdev->dev, "open-drain"); p->chip.dev = &pdev->dev; p->chip.ops = &brcmstb_pwm_ops; p->chip.npwm = 2;