Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* ASoC: regmap_config.max_register value wrong?
@ 2015-05-25 20:46 Sergej Sawazki
  2015-05-26  6:42 ` Lars-Peter Clausen
  0 siblings, 1 reply; 4+ messages in thread
From: Sergej Sawazki @ 2015-05-25 20:46 UTC (permalink / raw)
  To: Mark Brown, Charles Keepax, Lars-Peter Clausen, dan.carpenter; +Cc: alsa-devel

Dear all,

The following snippet is from the wm8741 codec driver. Shouldn't the
.max_register field be set to WM8741_REGISTER_COUNT-1 (10) instead of
WM8741_MAX_REGISTER (0x20)?

[...]
static const struct regmap_config wm8741_regmap = {
	.reg_bits = 7,
	.val_bits = 9,
	.max_register = WM8741_MAX_REGISTER,
[...]

WM8741_MAX_REGISTER is the address of the last register.
WM8741_REGISTER_COUNT is the number of registers.

The regmap_config documentation says: "@max_register: Optional,
specifies the maximum valid register index."

So it should be the *register index* and not the register address.
Do I understand it correctly?

Many thanks in advance.
Best regards,
Sergej

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ASoC: regmap_config.max_register value wrong?
  2015-05-25 20:46 ASoC: regmap_config.max_register value wrong? Sergej Sawazki
@ 2015-05-26  6:42 ` Lars-Peter Clausen
  2015-05-26  8:14   ` Charles Keepax
  0 siblings, 1 reply; 4+ messages in thread
From: Lars-Peter Clausen @ 2015-05-26  6:42 UTC (permalink / raw)
  To: Sergej Sawazki, Mark Brown, Charles Keepax, dan.carpenter; +Cc: alsa-devel

On 05/25/2015 10:46 PM, Sergej Sawazki wrote:
> Dear all,
>
> The following snippet is from the wm8741 codec driver. Shouldn't the
> .max_register field be set to WM8741_REGISTER_COUNT-1 (10) instead of
> WM8741_MAX_REGISTER (0x20)?
>
> [...]
> static const struct regmap_config wm8741_regmap = {
>      .reg_bits = 7,
>      .val_bits = 9,
>      .max_register = WM8741_MAX_REGISTER,
> [...]
>
> WM8741_MAX_REGISTER is the address of the last register.
> WM8741_REGISTER_COUNT is the number of registers.
>
> The regmap_config documentation says: "@max_register: Optional,
> specifies the maximum valid register index."
>
> So it should be the *register index* and not the register address.
> Do I understand it correctly?

What the documentation means is the index into the physical register map, 
which is the address. So the code is probably correct.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ASoC: regmap_config.max_register value wrong?
  2015-05-26  6:42 ` Lars-Peter Clausen
@ 2015-05-26  8:14   ` Charles Keepax
  2015-05-27 17:05     ` Sergej Sawazki
  0 siblings, 1 reply; 4+ messages in thread
From: Charles Keepax @ 2015-05-26  8:14 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: Sergej Sawazki, alsa-devel, Mark Brown, dan.carpenter

On Tue, May 26, 2015 at 08:42:58AM +0200, Lars-Peter Clausen wrote:
> On 05/25/2015 10:46 PM, Sergej Sawazki wrote:
>> Dear all,
>>
>> The following snippet is from the wm8741 codec driver. Shouldn't the
>> .max_register field be set to WM8741_REGISTER_COUNT-1 (10) instead of
>> WM8741_MAX_REGISTER (0x20)?
>>
>> [...]
>> static const struct regmap_config wm8741_regmap = {
>>      .reg_bits = 7,
>>      .val_bits = 9,
>>      .max_register = WM8741_MAX_REGISTER,
>> [...]
>>
>> WM8741_MAX_REGISTER is the address of the last register.
>> WM8741_REGISTER_COUNT is the number of registers.
>>
>> The regmap_config documentation says: "@max_register: Optional,
>> specifies the maximum valid register index."
>>
>> So it should be the *register index* and not the register address.
>> Do I understand it correctly?
>
> What the documentation means is the index into the physical register map, 
> which is the address. So the code is probably correct.
>

Yeah the documentation there is maybe not entirely clear here, but
the code is correct.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ASoC: regmap_config.max_register value wrong?
  2015-05-26  8:14   ` Charles Keepax
@ 2015-05-27 17:05     ` Sergej Sawazki
  0 siblings, 0 replies; 4+ messages in thread
From: Sergej Sawazki @ 2015-05-27 17:05 UTC (permalink / raw)
  To: Charles Keepax, Lars-Peter Clausen; +Cc: alsa-devel, Mark Brown, dan.carpenter



Am 26. Mai 2015 10:14:46 MESZ, schrieb Charles Keepax <ckeepax@opensource.wolfsonmicro.com>:
>On Tue, May 26, 2015 at 08:42:58AM +0200, Lars-Peter Clausen wrote:
>> On 05/25/2015 10:46 PM, Sergej Sawazki wrote:
>>> Dear all,
>>>
>>> The following snippet is from the wm8741 codec driver. Shouldn't the
>>> .max_register field be set to WM8741_REGISTER_COUNT-1 (10) instead
>of
>>> WM8741_MAX_REGISTER (0x20)?
>>>
>>> [...]
>>> static const struct regmap_config wm8741_regmap = {
>>>      .reg_bits = 7,
>>>      .val_bits = 9,
>>>      .max_register = WM8741_MAX_REGISTER,
>>> [...]
>>>
>>> WM8741_MAX_REGISTER is the address of the last register.
>>> WM8741_REGISTER_COUNT is the number of registers.
>>>
>>> The regmap_config documentation says: "@max_register: Optional,
>>> specifies the maximum valid register index."
>>>
>>> So it should be the *register index* and not the register address.
>>> Do I understand it correctly?
>>
>> What the documentation means is the index into the physical register
>map, 
>> which is the address. So the code is probably correct.
>>
>
>Yeah the documentation there is maybe not entirely clear here, but
>the code is correct.

Lars-Peter, Charles,

many thanks for your replies.

Sergej

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-27 17:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-25 20:46 ASoC: regmap_config.max_register value wrong? Sergej Sawazki
2015-05-26  6:42 ` Lars-Peter Clausen
2015-05-26  8:14   ` Charles Keepax
2015-05-27 17:05     ` Sergej Sawazki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox