ASoC: regmap_config.max_register value wrong?
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
Quoted 13 lines · Sergej Sawazki
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,[...]
Quoted 8 lines
WM8741_MAX_REGISTERis the address of the last register.WM8741_REGISTER_COUNTis the number of registers.The
regmap_configdocumentation 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.
Quoted 17 lines · Lars-Peter Clausen
Quoted 16 lines · Sergej Sawazki
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_REGISTERis the address of the last register.WM8741_REGISTER_COUNTis the number of registers.
Quoted 9 lines
Quoted 5 lines
The
regmap_configdocumentation 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
Am 26. Mai 2015 10:14:46 MESZ, schrieb Charles Keepax <[email protected]>:
Quoted 25 lines · Lars-Peter Clausen
Quoted 5 lines · Sergej Sawazki
Quoted 4 lines
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
Quoted 18 lines
Quoted 17 lines
WM8741_MAX_REGISTER(0x20)?[...]
static const struct regmap_config wm8741_regmap = { .reg_bits = 7, .val_bits = 9, .max_register = WM8741_MAX_REGISTER,[...]
WM8741_MAX_REGISTERis the address of the last register.WM8741_REGISTER_COUNTis the number of registers.The
regmap_configdocumentation 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?
Quoted 7 lines
Quoted 1 line
What the documentation means is the index into the physical register
map,
Quoted 2 lines
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