From patchwork Mon May 15 06:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuijing Li X-Patchwork-Id: 93906 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6723888vqo; Mon, 15 May 2023 00:09:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5qmzRnvlKi48bb33RXzsvsBG3roM0Faf3aW/e0EpJ2U/0OKgD+KDtS587DjgBWzZ/T9x99 X-Received: by 2002:a05:6a00:b49:b0:648:b185:efd9 with SMTP id p9-20020a056a000b4900b00648b185efd9mr24586455pfo.11.1684134576411; Mon, 15 May 2023 00:09:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684134576; cv=none; d=google.com; s=arc-20160816; b=D2lE67L/UtrOCvt+FL4gmbrkYi4tJUDYyVkAU0dJZBWW0zFqe4iPw6Fg5bFbIYCbDg YtdGYqHOd9QfPxpbrI990V+lCvMYcPGGneJEkIiIekJNgMdJZzI4HboPk4ZBH2t2lqle i2/AlJQPU9byZRVru2UOrk3f4VHclAvWPc2f7LoLiwqPhNgR46o7VWTsCWY7wzLIDKqc 8Ku+YYoiV58USVdblOO/JM5ps5nlyT0LKsoLudtamX1ZSTiYIiD1k2YwByLGS9RqEPuJ al8NFSuKAeoc0YzTTsBfIJfkklYlR4ShRJn00qHIooi0BB4tAJYvXVsp08EnkfTN2M0Z YGBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=1DzBxETsAAtn/WkXHPbWWEDwRESy0yoELlXkiZv6Fr8=; b=H9VgQqiWlHg6DLBhabGW/n2UmXRlNDKDhEeu2G2nxADc8LiArSOOFhsZXdYVAJAeZ+ QYYuH1hvECbShQECPIrpB1QsXGVLDKvr608Yhb3V1O097Oa8LPzGW1o3BNWnXp6PbSen PukI2DGtdrZSMDHRGlqPcSMW+fMgXH5O2RMb+SVYQMtPdkuAYFeP5Gn4ibwtm5cFIfQp T1zhgWOmh1IBmOuoDMAyIwKuikbGFcGmRAQbzLIs/cgvritk90EzZyZ/BGwLjjrODhbQ WDKtNydWIWGGYohn3UMjHwB5eZQBkZa8lfg5MK+KkV6pqmYTQyXAsEs9tIf11KHzT/K8 euMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PjwgAdJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h8-20020aa796c8000000b00643a2b0c6c8si16323065pfq.106.2023.05.15.00.09.23; Mon, 15 May 2023 00:09:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=PjwgAdJ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239487AbjEOGS7 (ORCPT + 99 others); Mon, 15 May 2023 02:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239442AbjEOGSh (ORCPT ); Mon, 15 May 2023 02:18:37 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 735021BF9; Sun, 14 May 2023 23:18:28 -0700 (PDT) X-UUID: 4b63faaef2e811ed9cb5633481061a41-20230515 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=1DzBxETsAAtn/WkXHPbWWEDwRESy0yoELlXkiZv6Fr8=; b=PjwgAdJ39n1Tj1JRb7ywvJgjWrMWQoGgmXxfa8IxkPc/fhGVs2oFN2YoEAfK94SMD1bJJw74tx6my3Vvdzr4SOjcZzN2eQiDvfLiOOIBY28r/M5O6cEDYwCSXQyTjF4g5vLrp4kxxWG4duyK0h2rpUwdJ5QLKDZfIYe01EDc0To=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.24,REQID:c0055105-3491-48fb-afe2-4e1142d3bffb,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:100 X-CID-INFO: VERSION:1.1.24,REQID:c0055105-3491-48fb-afe2-4e1142d3bffb,IP:0,URL :0,TC:0,Content:0,EDM:0,RT:0,SF:100,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:100 X-CID-META: VersionHash:178d4d4,CLOUDID:5503d9c0-e32c-4c97-918d-fbb3fc224d4e,B ulkID:230515141824V4BZ34CF,BulkQuantity:1,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:11|1,File:nil,Bulk:40,QS:nil,BEC:nil,COL :0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 4b63faaef2e811ed9cb5633481061a41-20230515 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1293574623; Mon, 15 May 2023 14:18:22 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Mon, 15 May 2023 14:18:22 +0800 Received: from mszsdhlt06.gcn.mediatek.inc (10.16.6.206) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Mon, 15 May 2023 14:18:22 +0800 From: Shuijing Li To: , , CC: , , , , , , , Shuijing Li Subject: [PATCH] pwm: mtk_disp: Fix the disable flow of disp_pwm Date: Mon, 15 May 2023 14:18:45 +0800 Message-ID: <20230515061845.10241-1-shuijing.li@mediatek.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765943097498961571?= X-GMAIL-MSGID: =?utf-8?q?1765943097498961571?= There is a flow error in the original mtk_disp_pwm_apply() function. If this function is called when the clock is disabled, there will be a chance to operate the disp_pwm register, resulting in disp_pwm exception. Fix this accordingly. Signed-off-by: Shuijing Li --- drivers/pwm/pwm-mtk-disp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c index 79e321e96f56..cb699fa9a5ae 100644 --- a/drivers/pwm/pwm-mtk-disp.c +++ b/drivers/pwm/pwm-mtk-disp.c @@ -80,10 +80,9 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, return -EINVAL; if (!state->enabled) { - mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask, - 0x0); - if (mdp->enabled) { + mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, + mdp->data->enable_mask, 0x0); clk_disable_unprepare(mdp->clk_mm); clk_disable_unprepare(mdp->clk_main); }