linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Gruber <clemens.gruber@pqgruber.com>
To: linux-pwm@vger.kernel.org
Cc: Thierry Reding <thierry.reding@gmail.com>,
	u.kleine-koenig@pengutronix.de, Lee Jones <lee.jones@linaro.org>,
	linux-kernel@vger.kernel.org,
	Sven Van Asbroeck <TheSven73@gmail.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	David Jander <david@protonic.nl>,
	Clemens Gruber <clemens.gruber@pqgruber.com>
Subject: [PATCH v3 2/4] pwm: pca9685: Set full OFF bits in probe
Date: Tue, 24 Nov 2020 19:10:12 +0100	[thread overview]
Message-ID: <20201124181013.162176-2-clemens.gruber@pqgruber.com> (raw)
In-Reply-To: <20201124181013.162176-1-clemens.gruber@pqgruber.com>

The full OFF bits are set by default in the PCA9685 LEDn_OFF_H
registers at POR. LEDn_ON_L/H and LEDn_OFF_L default to 0.

The datasheet states that LEDn_OFF and LEDn_ON should never be both set
to the same values.

This patch removes the clearing of the full OFF bit in the probe
function. We still clear the rest of the OFF regs but now we set the
full OFF bit to avoid having both OFF and ON registers set to 0 and
start up in a safe default state.

Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
---

Changes since v1:
- Rebased

 drivers/pwm/pwm-pca9685.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c
index 4cfbf1467f15..2b82b35ff0de 100644
--- a/drivers/pwm/pwm-pca9685.c
+++ b/drivers/pwm/pwm-pca9685.c
@@ -475,9 +475,9 @@ static int pca9685_pwm_probe(struct i2c_client *client,
 	reg &= ~(MODE1_ALLCALL | MODE1_SUB1 | MODE1_SUB2 | MODE1_SUB3);
 	regmap_write(pca->regmap, PCA9685_MODE1, reg);
 
-	/* Clear all "full off" bits */
+	/* Reset OFF registers to HW default (only full OFF bit is set) */
 	regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_L, 0);
-	regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_H, 0);
+	regmap_write(pca->regmap, PCA9685_ALL_LED_OFF_H, LED_FULL);
 
 	pca->chip.ops = &pca9685_pwm_ops;
 	/* Add an extra channel for ALL_LED */
-- 
2.29.2


  reply	other threads:[~2020-11-24 18:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 18:10 [PATCH v3 1/4] pwm: pca9685: Switch to atomic API Clemens Gruber
2020-11-24 18:10 ` Clemens Gruber [this message]
2020-11-24 18:10 ` [PATCH v3 3/4] pwm: pca9685: Support staggered output ON times Clemens Gruber
2020-11-25  3:51   ` Sven Van Asbroeck
2020-11-25  8:40     ` Clemens Gruber
2020-11-25  3:49 ` [PATCH v3 1/4] pwm: pca9685: Switch to atomic API Sven Van Asbroeck
2020-11-25  8:35   ` Clemens Gruber
2020-11-25 14:04     ` Clemens Gruber
2020-11-25 15:04       ` Sven Van Asbroeck
2020-11-25 17:28         ` Clemens Gruber
2020-11-25 19:46           ` Sven Van Asbroeck
2020-11-25 19:54             ` Sven Van Asbroeck

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=20201124181013.162176-2-clemens.gruber@pqgruber.com \
    --to=clemens.gruber@pqgruber.com \
    --cc=TheSven73@gmail.com \
    --cc=david@protonic.nl \
    --cc=lee.jones@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).