devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Lee Jones <lee.jones@linaro.org>
Cc: Richard Fitzgerald <rf@opensource.cirrus.com>,
	Charles Keepax <ckeepax@opensource.cirrus.com>,
	mturquette@baylibre.com, sboyd@kernel.org,
	linus.walleij@linaro.org, robh+dt@kernel.org,
	mark.rutland@arm.com, lgirdwood@gmail.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@opensource.cirrus.com, linux-clk@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2 2/5] mfd: lochnagar: Add support for the Cirrus Logic Lochnagar
Date: Mon, 29 Oct 2018 12:57:29 +0000	[thread overview]
Message-ID: <20181029125729.GW2103@sirena.org.uk> (raw)
In-Reply-To: <20181029110439.GS4870@dell>

[-- Attachment #1: Type: text/plain, Size: 2626 bytes --]

On Mon, Oct 29, 2018 at 11:04:39AM +0000, Lee Jones wrote:
> On Fri, 26 Oct 2018, Mark Brown wrote:

> > There's no *requirement* to provide the data even if you're using the
> > cache (and the cache support is entirely optional), there's just costs
> > to not providing it in terms of what features you can get from the
> > regmap API and the performance of the system.  Not every device is going
> > to be bothered by those costs, many devices don't provide all of the
> > data they could.

> So what do we do in the case where, due to the size of the device, the
> amount of lines required by these tables go from crazy to grotesque?

My recommendation when the tables get in the way of the rest of the
driver is to move them into a separate file that contains only tables,
these get big but they're sitting in a separate file that only contains
big data tables so they're fairly simple to look at (and generate or
whatever) and people working on the active code don't need to look at
them.

> > That doesn't work, we need to know both if the register has a default
> > value and what that value is - there's no great value in only supplying
> > the defaults for registers with non-zero values.

> All registers have a default value.  Why can't we assume that if a
> register is writable and a default value was omitted then the default
> is zero?

There are volatile registers which can't be part of the cache as the
hardware might change the state, and we have things like device
identification registers which are fixed but which we want to read from
the device.  This second set of registers can usually be modelled quite
happily as volatile registers though, we don't tend to read them often.

There's also registers where the user just didn't tell us what's going
on, either through oversight or because there's some code that touches
undocumented test registers at runtime for quirk reasons using a read,
modify write cycle.  We could try to insist that the device drivers
always provide a default or mark things as volatile but that's likely to
be an uphill struggle and more error prone.

> Ah wait!  As I was typing the above, I just had a thought.  We don't
> actually provide a list of writable registers do we?  Only a the
> ability to verify if one is writable (presumably) before a write.

> That's frustrating!

You can provide the writability information either with the function or
with data.  The tables code doesn't currently scale very well to large,
sparse register maps but that could in theory be optimized.  Few devices
bother providing distinct writability information as it's not often an
issue.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2018-10-29 12:57 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 13:25 [PATCH v2 1/5] mfd: lochnagar: Add initial binding documentation Charles Keepax
2018-10-08 13:25 ` [PATCH v2 2/5] mfd: lochnagar: Add support for the Cirrus Logic Lochnagar Charles Keepax
2018-10-25  7:44   ` Lee Jones
2018-10-25  8:26     ` Charles Keepax
2018-10-25  9:28       ` Richard Fitzgerald
2018-10-25 10:12         ` Mark Brown
2018-10-25 10:56           ` Charles Keepax
2018-10-25 11:42         ` Lee Jones
2018-10-25 12:49           ` Charles Keepax
2018-10-25 13:20             ` Charles Keepax
2018-10-25 13:47               ` Richard Fitzgerald
2018-10-26 15:49                 ` Mark Brown
2018-10-26  7:33             ` Lee Jones
2018-10-26 15:47             ` Mark Brown
2018-10-25 13:40           ` Richard Fitzgerald
2018-10-26  8:00             ` Lee Jones
2018-10-26 20:32               ` Mark Brown
2018-10-29 11:04                 ` Lee Jones
2018-10-29 11:52                   ` Richard Fitzgerald
2018-10-29 12:36                   ` Richard Fitzgerald
2018-10-29 12:57                   ` Mark Brown [this message]
2018-11-01 10:28                   ` Charles Keepax
2018-11-01 11:40                     ` Richard Fitzgerald
2018-11-01 12:04                       ` Mark Brown
2018-11-01 12:01                     ` Mark Brown
2018-11-01 14:17                     ` Richard Fitzgerald
2018-10-08 13:25 ` [PATCH v2 3/5] clk: " Charles Keepax
2018-10-11  7:00   ` Stephen Boyd
2018-10-11 13:26     ` Charles Keepax
2018-10-12 15:59       ` Stephen Boyd
2018-10-15 10:49         ` Charles Keepax
2018-10-15 16:39           ` Stephen Boyd
2018-10-15 16:55             ` Mark Brown
2018-10-15 21:53               ` Stephen Boyd
2018-10-11 14:54     ` Mark Brown
2018-10-11 19:36       ` Stephen Boyd
2018-10-12 16:52         ` Mark Brown
2018-10-08 13:25 ` [PATCH v2 4/5] regulator: " Charles Keepax
2018-10-08 13:25 ` [PATCH v2 5/5] pinctrl: " Charles Keepax
2018-10-12 22:08 ` [PATCH v2 1/5] mfd: lochnagar: Add initial binding documentation 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=20181029125729.GW2103@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=patches@opensource.cirrus.com \
    --cc=rf@opensource.cirrus.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@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).