[alsa-devel] [Patch v6 6/7] regmap: add SLIMBUS support

Jonathan Neuschäfer j.neuschaefer at gmx.net
Sat Oct 7 07:02:42 CEST 2017


Hi,

On Fri, Oct 06, 2017 at 05:51:35PM +0200, srinivas.kandagatla at linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
> 
> This patch adds support to read/write slimbus value elements.
> Currently it only supports byte read/write. Adding this support in
> regmap would give codec drivers more flexibility when there are more
> than 2 control interfaces like slimbus, i2c.
> 
> Without this patch each codec driver has to directly call slimbus value
> element apis, and this could would get messy once we want to add i2c
> interface to it.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
> ---
[...]
> +static int regmap_slimbus_byte_reg_read(void *context, unsigned int reg,
> +					unsigned int *val)
> +{
> +	struct slim_device *slim = context;
> +	struct slim_val_inf msg = {0,};
> +
> +	msg.start_offset = reg;
> +	msg.num_bytes = 1;
> +	msg.rbuf = (void *)val;
> +
> +	return slim_request_val_element(slim, &msg);
> +}

This looks like it won't work on big-endian systems. I know big endian
is pretty uncommon in devices that will likely have SLIMBus, but it's
better to be endian-independent.

> +static int regmap_slimbus_byte_reg_write(void *context, unsigned int reg,
> +					 unsigned int val)
> +{
> +	struct slim_device *slim = context;
> +	struct slim_val_inf msg = {0,};
> +
> +	msg.start_offset = reg;
> +	msg.num_bytes = 1;
> +	msg.wbuf = (void *)&val;
> +
> +	return slim_change_val_element(slim, &msg);
> +}

dito

> +static struct regmap_bus regmap_slimbus_bus = {
> +	.reg_write = regmap_slimbus_byte_reg_write,
> +	.reg_read = regmap_slimbus_byte_reg_read,
> +};


Thanks,
Jonathan Neuschäfer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20171007/d50d6b94/attachment-0001.sig>


More information about the Alsa-devel mailing list