lkml.org 
[lkml]   [2018]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v6 1/2] media: imx274: use regmap_bulk_write to write multybyte registers
On Wed, Jul 25, 2018 at 06:24:54PM +0200, Luca Ceresoli wrote:
> Currently 2-bytes and 3-bytes registers are set by very similar
> functions doing the needed shift & mask manipulation, followed by very
> similar for loops setting one byte at a time over I2C.
>
> Replace all of this code by a unique helper function that calls
> regmap_bulk_write(), which has two advantages:
> - sets all the bytes in a unique I2C transaction
> - removes lots of now unused code.
>
> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
>
...
> +/**
> + * Write a multibyte register.
> + *
> + * Uses a bulk write where possible.
> + *
> + * @priv: Pointer to device structure
> + * @addr: Address of the LSB register. Other registers must be
> + * consecutive, least-to-most significant.
> + * @val: Value to be written to the register (cpu endianness)
> + * @nbytes: Number of bits to write (range: [1..3])
> + */
> +static int imx274_write_mbreg(struct stimx274 *priv, u16 addr, u32 val,
> + size_t nbytes)

Should nbytes be called nbits, or is nbytes a 'Number of bytes' ?

Philippe
--
Philippe De Muyter +32 2 6101532 Macq SA rue de l'Aeronef 2 B-1140 Bruxelles

\
 
 \ /
  Last update: 2018-08-28 11:03    [W:0.086 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site