From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from uho.ysoft.cz ([81.19.3.130]:52650 "EHLO uho.ysoft.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728696AbfJUNzf (ORCPT ); Mon, 21 Oct 2019 09:55:35 -0400 References: <20191021105830.1357795-1-thierry.reding@gmail.com> From: =?UTF-8?B?TWljaGFsIFZva8OhxI0=?= Message-ID: <35885da4-4172-4d1f-a05e-d094669535c9@ysoft.com> Date: Mon, 21 Oct 2019 15:55:34 +0200 MIME-Version: 1.0 In-Reply-To: <20191021105830.1357795-1-thierry.reding@gmail.com> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-pwm-owner@vger.kernel.org List-ID: Subject: Re: [PATCH] Revert "pwm: Let pwm_get_state() return the last implemented state" To: Thierry Reding Cc: =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Enric Balletbo i Serra , linux-pwm@vger.kernel.org On 21. 10. 19 12:58, Thierry Reding wrote: > It turns out that commit 01ccf903edd6 ("pwm: Let pwm_get_state() return > the last implemented state") causes backlight failures on a number of > boards. The reason is that some of the drivers do not write the full > state through to the hardware registers, which means that ->get_state() > subsequently does not return the correct state. Consumers which rely on > pwm_get_state() returning the current state will therefore get confused > and subsequently try to program a bad state. > > Before this change can be made, existing drivers need to be more > carefully audited and fixed to behave as the framework expects. Until > then, keep the original behaviour of returning the software state that > was applied rather than reading the state back from hardware. Backlight on our imx6dl-yapp4-draco board works fine again when this is reverted. Tested-by: Michal Vokáč > Signed-off-by: Thierry Reding > --- > drivers/pwm/core.c | 9 +-------- > 1 file changed, 1 insertion(+), 8 deletions(-) > > diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c > index 6ad51aa60c03..f877e77d9184 100644 > --- a/drivers/pwm/core.c > +++ b/drivers/pwm/core.c > @@ -472,14 +472,7 @@ int pwm_apply_state(struct pwm_device *pwm, const struct pwm_state *state) > if (err) > return err; > > - /* > - * .apply might have to round some values in *state, if possible > - * read the actually implemented value back. > - */ > - if (chip->ops->get_state) > - chip->ops->get_state(chip, pwm, &pwm->state); > - else > - pwm->state = *state; > + pwm->state = *state; > } else { > /* > * FIXME: restore the initial state in case of error. >