Closed plbossart closed 2 months ago
Not really related to this patch, but since I have been poking through the code for this driver so much today in rt1320_set_gain_put:
/* Lch*/
regmap_write(rt1320->mbq_regmap, mc->reg, gain_l_val);
/* Rch */
regmap_write(rt1320->mbq_regmap, mc->rreg, gain_r_val);
regmap_read(rt1320->mbq_regmap, mc->reg, &read_l);
regmap_read(rt1320->mbq_regmap, mc->rreg, &read_r);
if (read_r == gain_r_val && read_l == gain_l_val)
return 1;
return -EIO;
This seems a little weird, it reads the registers it just wrote, so the if statement is redundant, even if the hardware sometimes rejected the write you would get values from the cache anyway. I suspect the reads should be removed and the if should be updated to use lvalue and rvalue from the top of the function.
compile-tested-only tentative solution built on top of PR #5087 to show how SDCA controls could be moved to the regmap_mbq
@charleskeepax @bardliao @shumingfan comments and verification welcome, I don't have any information or data sheet to do this change on my own.