Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp411032rwl; Wed, 5 Apr 2023 02:28:20 -0700 (PDT) X-Google-Smtp-Source: AKy350YwgtjXwjbaFvZH5LGzvvE/CPA7CYy8xLRVfbOtv5+WtrKRW6v01TqjsOJqDOtSxzw1qJ0O X-Received: by 2002:a05:6a20:ba83:b0:d5:1c74:27af with SMTP id fb3-20020a056a20ba8300b000d51c7427afmr5150744pzb.29.1680686899953; Wed, 05 Apr 2023 02:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680686899; cv=none; d=google.com; s=arc-20160816; b=MVL7UveNKi4MZobOgjbzsx6FVtqNyUGJatQi+GY2YlMbL/Ud+v2IsLFlk9iE4OKgz6 JN8jg3MuTDpPKAF03qNiqZQfgESuMKpYNRX6UoUfo6rVbrOdm4pFR3WN/mHQIym8WVMf YMe2PvxaY4sNzvtr0n+TmWVBU8Tow+X8C8NiFiH+QGOg1lGL8OHF+QOLFuH6fpDGt5Zl pxjtooUlqXRLVe+3jEFyRUvHT9IjvNE8RgdT1eSFYFvy+G5np0URLDe3d0G/QdJUXkBK s71ocDlIym18YqKIVe/V77t4t/aHftd6ONBruxyqsN7YG8zDBMRAbUF9W8KhlVqICQ3C qvdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=j86FY1X3mQJSpSUEyPXpteWdgUQhvm2ft4SxXMxYnjA=; b=COsdUkG2YD8wvHo8RCe5bFclOkCRuZN+4mPtuJHDpzTbzkUOp/c2zMQXLPwl7EknLl X37+VjG+zfGo9dqOGFTlwK1ZoDGZKKbzPJHiJUga3vFVM2NWn/C5kbm9yC4Jp0Rhhz8s UBj2O2HHSHHMcI/AsGYcQf+LQZtlIyp3W8XsZ5rZ+Lh8NOp05+QVup5mEFAERnp4VvA8 Rvb4jlZIGoyJBloTN5RIAXjjzA5sviSfjUSU/DvkIW9eywIKpX0PVAMEoEo3qv6kPyns ZX3vUT/DWLmCSG0AxH2zOnexsv1yjf3G1TxqsDsmliz1oWJ0irFd6s14zr7mfZ7kS4Ud gEgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=JZe6wEae; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w62-20020a638241000000b004fc39adf481si12413125pgd.381.2023.04.05.02.28.08; Wed, 05 Apr 2023 02:28:19 -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=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=JZe6wEae; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237040AbjDEJ0h (ORCPT + 99 others); Wed, 5 Apr 2023 05:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237015AbjDEJ0g (ORCPT ); Wed, 5 Apr 2023 05:26:36 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA2DE4200 for ; Wed, 5 Apr 2023 02:26:33 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id e18so35488305wra.9 for ; Wed, 05 Apr 2023 02:26:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; t=1680686792; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=j86FY1X3mQJSpSUEyPXpteWdgUQhvm2ft4SxXMxYnjA=; b=JZe6wEaenAlkzh6A+1SZGKPIIY7+28I3FbXLdAPA642CT61U15GFayMED3USy2vRur cnbsEM61d76fdpGl1Fp43vpXgh/pbVd1RNpCtrcxKxodCsLRcn2TD10MV6TChmFOcmxq bAfQZN/1MLLqUqBa5MuDi80FDwDM9rsv3Cr8bzvonlV68Q2now/PCsJPotFN5h0SDUpi 1hSyWfVY6gTWtsYurymkF8JgnXpoxqfKd2QV368FNEQneJd0WzHoFGH6Q49synXoxzMC bduw8wIButE9cgIZUbMablcXnwTNxIbaY3B9Xb2wXBV6xb9UmOQhfaNb0MQWZikYiVMH FX1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680686792; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=j86FY1X3mQJSpSUEyPXpteWdgUQhvm2ft4SxXMxYnjA=; b=akIjI2ddLZHXF6lT038Dsi6v8NJDMovlZG3imordjArABcJvpPWFhgNmFRnPuN9TvV PF0AjSimBfqRi79rr5c6ZUobAL5p8rZPZc7Q2uxNcucExuta+WGtOja4csZMTSskIHwV LumLDINjNyjkjMN5HUkQzHMH6lLkqeJEFsIVkft5LpvWjGcql4PoxdqtJ4LdJods38wU kstb/fGAKY9I9QYPNXuKI9SfYDBy+41Ws3dXAgDf5ihV2KD3rCT4+9jDzsoMpZlm1Yii BcXmn6d7xlsNzYtkP2SS1yRk+MXaaJ2PKbCKu23ZL2QGE3j8l/ZnZa1l6uR/WL+BHL7I ouEw== X-Gm-Message-State: AAQBX9cwL5s+PyM7YVI00pVO/ELdWMB4833+RBf8i8ULWlkUjSLm/rJO w3CbP6U8gIrICou5CBwaFvBoHw== X-Received: by 2002:adf:e30e:0:b0:2c7:46f:c410 with SMTP id b14-20020adfe30e000000b002c7046fc410mr3314136wrj.36.1680686792347; Wed, 05 Apr 2023 02:26:32 -0700 (PDT) Received: from [192.168.1.172] (158.22.5.93.rev.sfr.net. [93.5.22.158]) by smtp.gmail.com with ESMTPSA id s12-20020adfeccc000000b002da1261aa44sm14576762wro.48.2023.04.05.02.26.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Apr 2023 02:26:31 -0700 (PDT) Message-ID: Date: Wed, 5 Apr 2023 11:26:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH RESEND 1/2] pwm: mtk-disp: Disable shadow registers before setting backlight values Content-Language: en-US To: AngeloGioacchino Del Regno , thierry.reding@gmail.com Cc: u.kleine-koenig@pengutronix.de, matthias.bgg@gmail.com, weiqing.kong@mediatek.com, jitao.shi@mediatek.com, linux-pwm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, wenst@chromium.org, =?UTF-8?Q?N=c3=adcolas_F_=2e_R_=2e_A_=2e_Prado?= References: <20230403133054.319070-1-angelogioacchino.delregno@collabora.com> <20230403133054.319070-2-angelogioacchino.delregno@collabora.com> From: Alexandre Mergnat In-Reply-To: <20230403133054.319070-2-angelogioacchino.delregno@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 On 03/04/2023 15:30, AngeloGioacchino Del Regno wrote: > If shadow registers usage is not desired, disable that before performing > any write to CON0/1 registers in the .apply() callback, otherwise we may > lose clkdiv or period/width updates. > > Fixes: cd4b45ac449a ("pwm: Add MediaTek MT2701 display PWM driver support") > Signed-off-by: AngeloGioacchino Del Regno > Reviewed-by: NĂ­colas F. R. A. Prado > Tested-by: NĂ­colas F. R. A. Prado > --- > drivers/pwm/pwm-mtk-disp.c | 24 +++++++++++++----------- > 1 file changed, 13 insertions(+), 11 deletions(-) > > diff --git a/drivers/pwm/pwm-mtk-disp.c b/drivers/pwm/pwm-mtk-disp.c > index 692a06121b28..82b430d881a2 100644 > --- a/drivers/pwm/pwm-mtk-disp.c > +++ b/drivers/pwm/pwm-mtk-disp.c > @@ -138,6 +138,19 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > high_width = mul_u64_u64_div_u64(state->duty_cycle, rate, div); > value = period | (high_width << PWM_HIGH_WIDTH_SHIFT); > > + if (mdp->data->bls_debug && !mdp->data->has_commit) { > + /* > + * For MT2701, disable double buffer before writing register > + * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH. > + */ > + mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug, > + mdp->data->bls_debug_mask, > + mdp->data->bls_debug_mask); > + mtk_disp_pwm_update_bits(mdp, mdp->data->con0, > + mdp->data->con0_sel, > + mdp->data->con0_sel); > + } > + > mtk_disp_pwm_update_bits(mdp, mdp->data->con0, > PWM_CLKDIV_MASK, > clk_div << PWM_CLKDIV_SHIFT); > @@ -152,17 +165,6 @@ static int mtk_disp_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, > mtk_disp_pwm_update_bits(mdp, mdp->data->commit, > mdp->data->commit_mask, > 0x0); > - } else { > - /* > - * For MT2701, disable double buffer before writing register > - * and select manual mode and use PWM_PERIOD/PWM_HIGH_WIDTH. > - */ > - mtk_disp_pwm_update_bits(mdp, mdp->data->bls_debug, > - mdp->data->bls_debug_mask, > - mdp->data->bls_debug_mask); > - mtk_disp_pwm_update_bits(mdp, mdp->data->con0, > - mdp->data->con0_sel, > - mdp->data->con0_sel); > } > > mtk_disp_pwm_update_bits(mdp, DISP_PWM_EN, mdp->data->enable_mask, Hi, I've made a non-regression test for the mt8365-evk (i350-evk) board. It's fine for me. Reviewed-by: Alexandre Mergnat Tested-by: Alexandre Mergnat Regards, Alex