From: Mark Brown <broonie@kernel.org>
To: Anthony Olech <anthony.olech.opensource@diasemi.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
LKML <linux-kernel@vger.kernel.org>,
David Dajun Chen <david.chen@diasemi.com>
Subject: Re: [PATCH V1] new API regmap_multi_write()
Date: Thu, 10 Oct 2013 13:20:48 +0100 [thread overview]
Message-ID: <20131010122048.GI21581@sirena.org.uk> (raw)
In-Reply-To: <201310101053.r9AArpal039552@swsrvapps-02.lan>
[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]
On Thu, Oct 10, 2013 at 11:50:23AM +0100, Anthony Olech wrote:
> +/*
> + * regmap_multi_write(): Write multiple non sequential registers to the device
> + *
> + * @map: Register map to write to
> + * @reg: Array of registers to be written, all on the same page
Why all on the same page? That doesn't seem helpful for things trying
to build on top of this. We currently manage to split even block writes
up over page boundaries.
> + * @val: Block of data to be written, in native register size for device
> + * @reg_count: Number of registers to write
I'm not seeing anything here which says how the registers and values are
related to each other. I assume that the idea is that the same number
of registers are provided as values...
This really doesn't feel like an idiomatic abstraction - it's a bit
cumbersome to have the pair of arrays and try to line them up especially
in native register format, normally we do this with an array
reg_default. This would also mean that generic code like patches and
cache syncing could pick up on the same functionality.
> + /*
> + * Some devices do not support multi write, for
> + * them we have a series of single write operations.
> + */
> + if (map->use_single_rw) {
single_rw is somewhat relevant but this needs a separate flag since...
> + } else {
> + ret = _regmap_raw_multi_write(map,
> + reg_count,
> + reg,
> + wval);
> + }
...this will try to use the new functionality even if the device doesn't
support it. Indeed what this looks like is support for devices that can
only do single register writes but in the I2C case allow it to be done
without releasing the bus (it looks a lot like someone optimised things
to look like a bunch of SPI register writes, with SPI bouncing /CS is
much quicker than starting a new I2C transfer is).
I can see it being nice to have something like this but it needs more
thought on the API and implementation. I'd suggest splitting the API
addition from the underlying implementation to make things easier to
review (the API should work for any user even if it just ends up as a
series of separate register writes). Something like DAPM in ASoC could
use it for example, as well as the patch and cache sync code.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-10-10 12:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 10:50 Anthony Olech
2013-10-10 12:20 ` Mark Brown [this message]
2013-10-10 12:45 ` Opensource [Anthony Olech]
2013-10-10 14:08 ` Mark Brown
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=20131010122048.GI21581@sirena.org.uk \
--to=broonie@kernel.org \
--cc=anthony.olech.opensource@diasemi.com \
--cc=david.chen@diasemi.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®