[PATCH 1/2] ASoC: sma1303: Add driver for Iron Device SMA1303 Amp

Mark Brown broonie at kernel.org
Wed Nov 16 16:21:10 CET 2022


On Thu, Sep 29, 2022 at 05:47:41AM +0000, Ki-Seok Jo wrote:

> >> + * Copyright 2022 Iron Device Corporation

> > Missing Copyright (c) ?

> I don't know this part exactly, so when I looked it up.
> Most of them use a mix of two cases. Which would be better? Using Symbol or not?

The (c) is meaningless, what you have is fine.

> >> +	val = (u8 *)ucontrol->value.bytes.data;
> >> +	for (i = 0; i < params->max; i++) {
> >> +		ret = regmap_read(sma1303->regmap, reg + i, &reg_val);
> >> +		if (ret < 0) {
> >> +			dev_err(component->dev,
> >> +				"Failed to read, register: %x ret: %d\n",
> >> +				reg + i, ret);
> >> +			return ret;
> >> +		}
> >> +		if (sizeof(reg_val) > 2)
> >> +			reg_val = cpu_to_le32(reg_val);
> >> +		else
> >> +			reg_val = cpu_to_le16(reg_val);
> >> +		memcpy(val + i, &reg_val, sizeof(u8));

> > I wasn't able to figure out what this code does. sizeof(reg_val) is a constant so the second branch is never taken, and you end-up using memcpy to copy one byte, so what is the issue with endianness?

> I'm sorry I don't understand this meaning.
> In 'regmap_read', the last of the parameters is 'unsigned int' format.
> So, I've considered the two format 2bytes or 4bytes according to the complier.
> And our chip has only 1 byte data of each register, so I copy the data and cast the size only one byte.
> Is there anything I thought wrong?

You might be looking for the regmap _raw interfaces if you're
trying to send raw byte streams to the device (eg, for firmware
or parameter load).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20221116/f996aeef/attachment.sig>


More information about the Alsa-devel mailing list