From: Zahari Petkov <zahari@balena.io>
To: Pavel Machek <pavel@ucw.cz>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Dan Murphy <dmurphy@ti.com>, Zahari Petkov <zahari@balena.io>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] leds: pca963x: Fix open-drain initialization
Date: Mon, 18 Nov 2019 15:30:31 +0200 [thread overview]
Message-ID: <20191118133031.GA90092@majorz.localdomain> (raw)
In-Reply-To: <20191103170327.GA32107@duo.ucw.cz>
On Mon, Nov 04, 2019 at 10:09:53AM +0100, Pavel Machek wrote:
> On Mon 2019-10-14 15:36:04, Zahari Petkov wrote:
> > OUTDRV setting (bit 2) of Mode register 2 has a default value of 1.
> > During initialization when open-drain is used, instead of setting
> > OUTDRV to 0, the driver keeps it as 1. OUTDRV setting is now correctly
> > initialized to 0 when open-drain is used.
> >
> > Additionally the BIT macro is used for improved readibility.
>
> You change more than you describe in the changelog.
You are indeed correct. I will provide a more detailed and precise description.
>
> > +++ b/drivers/leds/leds-pca963x.c
> > @@ -438,12 +438,12 @@ static int pca963x_probe(struct i2c_client *client,
> > PCA963X_MODE2);
> > /* Configure output: open-drain or totem pole (push-pull) */
> > if (pdata->outdrv == PCA963X_OPEN_DRAIN)
> > - mode2 |= 0x01;
> > + mode2 &= ~BIT(2);
>
> | 0 -> & ~0x04;
>
> > else
> > - mode2 |= 0x05;
> > + mode2 |= BIT(2);
>
> | 5 -> | 0x04;
>
> Are you sure?
Yes, I need to explain this better in the updated description.
>
> Additionaly, we already have defines for bits in mode2 register:
>
> #define PCA963X_MODE2_DMBLNK 0x20 /* Enable blinking */
>
> So if you care about readability, perhaps you should add defines for
> invert/ open drain there, and then use them?
>
> Please keep using 0xab instead of BIT() for consistency with the rest
> of the driver.
I will update the code to use new defines instead of BIT().
Thanks a lot!
Zahari
prev parent reply other threads:[~2019-11-18 13:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-14 12:36 [PATCH] leds: pca963x: Fix open-drain initialization Zahari Petkov
2019-11-04 9:09 ` Pavel Machek
2019-11-18 13:30 ` Zahari Petkov [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=20191118133031.GA90092@majorz.localdomain \
--to=zahari@balena.io \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/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).