From patchwork Fri Sep 23 12:06:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WGlubGVpIExlZSAo5p2O5piV56OKKQ==?= X-Patchwork-Id: 12986498 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DE531ECAAD8 for ; Fri, 23 Sep 2022 12:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:MIME-Version: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=3eoJEqs9uN/ymOxu3OixLr1KvHOF0+k3IvPCigt2k00=; b=Vdczker9PAIX4bHhQ+y6e4lRL+ DfDUa373wmOC5x0EUONUaT7asxRd1qA6Wg6z9JZtqhy2Z2b56mv/7BlMJyVJm2LUuytiYANcodGZ0 l1WtG3u0YtIJoyd0q2R/KAoj72dd70UmPALlaUXqKOUZmSuUDQPvur/M0AHhLpA9aBrWd02poEAcd IqClJBPl240gk9mzSrzONBNLbpIJeDQ1nDGB65fswv0DPcuaEGeHg9KKevK/cFYG99pnllqch8yoL 8F5NqebkSxgAUjO9hlm+oJKbXBkjQ3E4rfw7LGKp2bVdXyPokj/x963MNm6o+2laJz86gMQ+xDzf3 8qS9wK2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obhSA-0044pK-Rl; Fri, 23 Sep 2022 12:06:46 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obhRs-0044jl-M5; Fri, 23 Sep 2022 12:06:29 +0000 X-UUID: 2d1fef7bcada4da486274e805f5dadb5-20220923 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=3eoJEqs9uN/ymOxu3OixLr1KvHOF0+k3IvPCigt2k00=; b=fds5X9dIYc7ZOqbYSHDSE8jeFtSMAb8TYlxjTcfzob0e8cIUtEMNCcOeyVJBvLz7NLa0n2ZsFESEVdc2QioiDJ94vXOdf0a9M2xu+iUlwRPfm1ECD+DY82q7CSpb6kyUMieFEAoafEAzbknb1W0M/u9Jk0Yq710o8ldFwDO6FCU=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:2b9ff241-31b7-46f2-8a2f-bee7e903cd07,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:39a5ff1,CLOUDID:ddabcf06-1cee-4c38-b21b-a45f9682fdc0,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:nil,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 2d1fef7bcada4da486274e805f5dadb5-20220923 Received: from mtkmbs11n1.mediatek.inc [(172.21.101.185)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 33112914; Fri, 23 Sep 2022 05:06:16 -0700 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.792.15; Fri, 23 Sep 2022 20:06:14 +0800 Received: from mszsdaap41.gcn.mediatek.inc (10.16.6.141) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.792.15 via Frontend Transport; Fri, 23 Sep 2022 20:06:13 +0800 From: To: , , CC: , , , , , , xinlei lee Subject: [PATCH,v2] pwm: mtk-disp: Fix the parameters calculated by the enabled flag of disp_pwm Date: Fri, 23 Sep 2022 20:06:11 +0800 Message-ID: <1663934771-15152-1-git-send-email-xinlei.lee@mediatek.com> X-Mailer: git-send-email 2.6.4 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220923_050628_749762_430CDDCA X-CRM114-Status: GOOD ( 12.14 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org From: xinlei lee In the original mtk_disp_pwm_get_state() function, the result of reading con0 & BIT(0) is enabled as disp_pwm. In order to conform to the register table, we should use the disp_pwm base address as the enabled judgment. Fixes: 3f2b16734914 ("pwm: mtk-disp: Implement atomic API .get_state()") Signed-off-by: xinlei lee --- Base on the branch of Linux-next/master. change since v1: 1. Modify the way to set disp_pwm enbale. --- --- drivers/pwm/pwm-mtk-disp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c index c605013..1a9880d 100644 --- a/drivers/pwm/pwm-mtk-disp.c +++ b/drivers/pwm/pwm-mtk-disp.c @@ -197,7 +197,7 @@ static void mtk_disp_pwm_get_state(struct pwm_chip *chip, rate = clk_get_rate(mdp->clk_main); con0 = readl(mdp->base + mdp->data->con0); con1 = readl(mdp->base + mdp->data->con1); - state->enabled = !!(con0 & BIT(0)); + state->enabled = !!(readl(mdp->base + DISP_PWM_EN) & BIT(0)); clk_div = FIELD_GET(PWM_CLKDIV_MASK, con0); period = FIELD_GET(PWM_PERIOD_MASK, con1); /*