<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:SimSun;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        text-align:justify;
        text-justify:inter-ideograph;
        font-size:10.5pt;
        font-family:DengXian;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:DengXian;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:DengXian;}
/* Page Definitions */
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="#0563C1" vlink="#954F72" style="word-wrap:break-word;text-justify-trim:punctuation">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">On Fri, Jan 20, 2023 at 01:00:18PM +0100, Uwe Kleine-König wrote:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> Most but not all PWMs drive the PWM pin to its inactive state when<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> disabled. However if there is no enable_gpio and no regulator the PWM<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> must drive the inactive state to actually disable the backlight.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> So keep the PWM on in this case.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> Note that to determine if there is a regulator some effort is required<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> because it might happen that there isn't actually one but the regulator<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> core gave us a dummy. (A nice side effect is that this makes the<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> regulator actually optional even on fully constrained systems.)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> This fixes backlight disabling e.g. on i.MX6 when an inverted PWM is<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> used.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> Hint for the future: If this change results in a regression, the bug is<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> in the lowlevel PWM driver.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">> Signed-off-by: Uwe Kleine-König <a href="mailto:u.kleine-koenig@pengutronix.de">
u.kleine-koenig@pengutronix.de</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">This patch broke imx7ulp suspend resume and got the following error:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Freezing remaining freezable tasks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Freezing remaining freezable tasks completed (elapsed 0.001 seconds)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">printk: Suspending console(s) (use no_console_suspend to debug)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">asix 1-1:1.0 eth0: Link is Down<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">imx7ulp-tpm-pwm 40250000.pwm: PM: dpm_run_callback(): platform_pm_suspend+0x0/0x48 returns -16<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">imx7ulp-tpm-pwm 40250000.pwm: PM: failed to suspend: error -16<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">…<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">It seems this patch changed the behavior of pwm_backlight_suspend a little bit in<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">pwm_backlight_power_off() that pwm state keep unchanged during suspend.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Then pwm_imx_tpm_suspend() will return -Ebusy due to tpm->enable_count > 0.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Was this intended behavior? Should we fix pwm core or the driver?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Aisheng<o:p></o:p></span></p>
</div>
</body>
</html>