All of lore.kernel.org
 help / color / mirror / Atom feed
From: vishakha.joshi@intel.com
To: thierry.reding@gmail.com
Cc: u.kleine-koenig@pengutronix.de, lee.jones@linaro.org,
	linux-pwm@vger.kernel.org, linux-kernel@vger.kernel.org,
	andriy.shevchenko@linux.intel.com, jarkko.nikula@linux.intel.com,
	vijayakannan.ayyathurai@intel.com, bala.senthil@intel.com,
	tamal.saha@intel.com, lakshmi.bai.raja.subramanian@intel.com,
	vishakha.joshi@intel.com
Subject: [PATCH v1 2/2] pwm: Update the REPEAT_COUNT value
Date: Mon,  3 Jan 2022 13:46:10 +0530	[thread overview]
Message-ID: <20220103081610.6656-3-vishakha.joshi@intel.com> (raw)
In-Reply-To: <20220103081610.6656-1-vishakha.joshi@intel.com>

From: Vishakha Joshi <vishakha.joshi@intel.com>

Update the count value in the PWM_LEADIN register.

Signed-off-by: Vishakha Joshi <vishakha.joshi@intel.com>
---
 drivers/pwm/pwm-keembay.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-keembay.c b/drivers/pwm/pwm-keembay.c
index 733811b05721..4494e54e23b8 100644
--- a/drivers/pwm/pwm-keembay.c
+++ b/drivers/pwm/pwm-keembay.c
@@ -128,11 +128,14 @@ static int keembay_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
 	if (state->polarity != PWM_POLARITY_NORMAL)
 		return -EINVAL;
 
+	if (state->count > KMB_PWM_COUNT_MAX)
+		return -EINVAL;
+
 	/*
-	 * Configure the pwm repeat count as infinite at (15:0) and leadin
-	 * low time as 0 at (30:16), which is in terms of clock cycles.
+	 * Configure the PWM repeat count at (15:0) and LEADIN low time as 0 at
+	 * (30:16), which is in terms of clock cycles.
 	 */
-	keembay_pwm_update_bits(priv, KMB_PWM_LEADIN_MASK, 0,
+	keembay_pwm_update_bits(priv, KMB_PWM_LEADIN_MASK, state->count,
 				KMB_PWM_LEADIN_OFFSET(pwm->hwpwm));
 
 	keembay_pwm_get_state(chip, pwm, &current_state);
-- 
2.17.1


      parent reply	other threads:[~2022-01-03  8:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-03  8:16 [PATCH v1 0/2] pwm: Add count to sysfs for Intel PWM driver vishakha.joshi
2022-01-03  8:16 ` [PATCH v1 1/2] " vishakha.joshi
2022-01-03 12:14   ` Uwe Kleine-König
2022-01-04 13:58     ` Andy Shevchenko
2022-01-13 14:11       ` Uwe Kleine-König
2022-01-03  8:16 ` vishakha.joshi [this message]

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=20220103081610.6656-3-vishakha.joshi@intel.com \
    --to=vishakha.joshi@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bala.senthil@intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=lakshmi.bai.raja.subramanian@intel.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=tamal.saha@intel.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vijayakannan.ayyathurai@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.