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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux