linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Alexandre Courbot <gnurou@gmail.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Linus Walleij <linus.walleij@linaro.org>,
	kernel@pyra-handheld.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Kumar Gala <galak@codeaurora.org>,
	Discussions about the Letux Kernel <letux-kernel@openphoenux.org>
Subject: Re: [Letux-kernel] [PATCH v3 2/4] gpio: pca953x: add register definitions for pcal6524 and fix address calculation
Date: Wed, 25 Apr 2018 20:05:36 +0200	[thread overview]
Message-ID: <65085C47-CDA8-4F8C-8307-C145F21F7D19@goldelico.com> (raw)
In-Reply-To: <EDF7FA02-C79C-4ADF-A10C-F8C4DBFE5158@goldelico.com>

Hi Andy,

> Am 11.04.2018 um 07:00 schrieb H. Nikolaus Schaller <hns@goldelico.com>:
> 
> Hi Andy,
> 
>> Am 10.04.2018 um 20:06 schrieb Andy Shevchenko <andy.shevchenko@gmail.com>:
>> 
>> On Tue, Apr 10, 2018 at 7:07 PM, H. Nikolaus Schaller <hns@goldelico.com> wrote:
>>> PCAL chips ("L" seems to stand for "latched") have additional
>>> registers starting at address 0x40 to control the latches,
>>> interrupt mask, pull-up and pull down etc.
>>> 
>>> The constants are so far defined in a way that they fit for
>>> the pcal9555a when shifted by the number of banks, i.e. multiplied
>>> by 2.
>>> 
>>> Now the pcal6524 has 3 banks which means the relative offset
>>> must be multiplied by 4 which gives a wrong result if not done
>>> carefully, since the base offset is already included in the offset.
>>> 
>>> For the basic registers shared with all pca93xx/tca64xx chips
>>> there is no such offset.
>>> 
>>> Therefore, we add code to adjust the register number for exended
>>> registers to the 24 bit accessor functions.
>>> 
>>> And we add additional register offset constants (not yet used by
>>> the driver code) which are specific to the pcal6524.
>>> 
>> 
>> First of all, as I said, please split this to two patches. Don't mix the things.
> 
> Ok. Queued for v4.
> 
>> 
>> 
>>> +       /* adjust register address for pcal6524 */
>>> +       if (reg >= PCAL953X_OUT_STRENGTH)
>>> +               reg -= PCAL953X_OUT_STRENGTH >> 1;
>>> +
>> 
>> Give me some days to think about it.

Any news on this?

I am waiting for your advice before submitting v4 (with pending updates for the other patches).

> No problem. I'll wait with v4.
> 
> The only alternative I would see is to add new accessor function
> pointers for the extended registers and have 0x00 based offsets,
> but that is IMHO more ugly.
> 
> BR and thanks,
> Nikolaus

BR and thanks,
Nikolaus

  reply	other threads:[~2018-04-25 18:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 16:07 [PATCH v3 0/4] pcal6524 extensions and fixes for pca953x driver H. Nikolaus Schaller
2018-04-10 16:07 ` [PATCH v3 1/4] gpio: pca953x: set the PCA_PCAL flag also when matching by DT H. Nikolaus Schaller
2018-04-10 18:08   ` Andy Shevchenko
2018-04-10 18:10     ` Andy Shevchenko
2018-04-11  4:57       ` H. Nikolaus Schaller
2018-04-10 16:07 ` [PATCH v3 2/4] gpio: pca953x: add register definitions for pcal6524 and fix address calculation H. Nikolaus Schaller
2018-04-10 18:06   ` Andy Shevchenko
2018-04-11  5:00     ` H. Nikolaus Schaller
2018-04-25 18:05       ` H. Nikolaus Schaller [this message]
2018-04-26 10:06         ` [Letux-kernel] " Andy Shevchenko
2018-04-26 10:17           ` H. Nikolaus Schaller
2018-04-10 16:07 ` [PATCH v3 3/4] DTS: Bindings: pca953x add an optional vcc-supply property H. Nikolaus Schaller
2018-04-10 16:07 ` [PATCH v3 4/4] DTS: Bindings: pca953x: add example how to use interrupt-controller and gpio-controller H. Nikolaus Schaller
2018-04-13 15:18   ` Rob Herring

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=65085C47-CDA8-4F8C-8307-C145F21F7D19@goldelico.com \
    --to=hns@goldelico.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=gnurou@gmail.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@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;
as well as URLs for NNTP newsgroup(s).