public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Raag Jadav <raag.jadav@intel.com>
To: ukleinek@kernel.org, mika.westerberg@linux.intel.com,
	andriy.shevchenko@linux.intel.com, jarkko.nikula@linux.intel.com
Cc: linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Raag Jadav <raag.jadav@intel.com>
Subject: [PATCH v1] pwm: lpss: wait_for_update() before configuring pwm
Date: Mon, 19 Aug 2024 13:34:12 +0530	[thread overview]
Message-ID: <20240819080412.15115-1-raag.jadav@intel.com> (raw)

Wait for SW_UPDATE bit to clear before configuring pwm channel instead of
failing right away, which will reduce failure rates on early access.

Signed-off-by: Raag Jadav <raag.jadav@intel.com>
---
 drivers/pwm/pwm-lpss.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c
index 867e2bc8c601..4a634a43b133 100644
--- a/drivers/pwm/pwm-lpss.c
+++ b/drivers/pwm/pwm-lpss.c
@@ -111,16 +111,6 @@ static int pwm_lpss_wait_for_update(struct pwm_device *pwm)
 	return err;
 }
 
-static inline int pwm_lpss_is_updating(struct pwm_device *pwm)
-{
-	if (pwm_lpss_read(pwm) & PWM_SW_UPDATE) {
-		dev_err(pwmchip_parent(pwm->chip), "PWM_SW_UPDATE is still set, skipping update\n");
-		return -EBUSY;
-	}
-
-	return 0;
-}
-
 static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm,
 			     int duty_ns, int period_ns)
 {
@@ -168,7 +158,7 @@ static int pwm_lpss_prepare_enable(struct pwm_lpss_chip *lpwm,
 {
 	int ret;
 
-	ret = pwm_lpss_is_updating(pwm);
+	ret = pwm_lpss_wait_for_update(pwm);
 	if (ret)
 		return ret;
 
-- 
2.35.3


             reply	other threads:[~2024-08-19  8:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-19  8:04 Raag Jadav [this message]
2024-08-19  8:21 ` [PATCH v1] pwm: lpss: wait_for_update() before configuring pwm Andy Shevchenko
2024-08-20  5:50   ` Raag Jadav
2024-08-20  9:56     ` Andy Shevchenko
2024-08-22  8:55       ` Raag Jadav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240819080412.15115-1-raag.jadav@intel.com \
    --to=raag.jadav@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=ukleinek@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox