[alsa-devel] [PATCH RFT] ASoC: ak4642: Fix up max_register setting

Axel Lin axel.lin at ingics.com
Tue Jun 30 13:25:57 CEST 2015


2015-06-30 18:46 GMT+08:00 Mark Brown <broonie at kernel.org>:
> On Sun, Jun 28, 2015 at 10:46:51AM +0800, Axel Lin wrote:
>
>>  static const struct regmap_config ak4642_regmap = {
>>       .reg_bits               = 8,
>>       .val_bits               = 8,
>> -     .max_register           = ARRAY_SIZE(ak4642_reg) + 1,
>> +     .max_register           = FIL1_3,
>>       .reg_defaults           = ak4642_reg,
>> -     .num_reg_defaults       = ARRAY_SIZE(ak4642_reg),
>> +     .num_reg_defaults       = FIL1_3 + 1,
>
> This change is incorrect, the number of register defaults must match the
> size of the array of register defaults being passed in.  Why are you
> changing this?

Because I reuse the same reg_default for ak4642 and ak4643.
According to the datasheet:
For ak4642, the valid registers are 0x0 ~ 0x1f (FIL1_3)
For ak4643, the valid registers are 0x0 ~ 0x24 (SPK_MS)
The default registers for 0x0 ~ 0x1f are the same for ak4642 and ak4643.

That is why this patch set  .num_reg_defaults = FIL1_3 + 1 for ak4642.

Or do you prefer having separate reg_default for ak4642 and ak4643?
(Then it can use ARRAY_SIZE() here.)


More information about the Alsa-devel mailing list