On Thu, Oct 29, 2015 at 11:17:26AM +0000, Bard Liao wrote:
Something like case RT5650_DEVICE_ID:
rt5645->regmap-> reg_defaults = rt5650_reg;
rt5645->codec_type = CODEC_TYPE_RT5650; break;rt5645->regmap-> num_reg_defaults = ARRAY_SIZE(rt5650_reg)
Is that ok?
No, that's not OK - the config needs to be constant and...
Or should I use different regmap_config? There is one question if I use different regmap_config. We will know which codec it is by regmap_read. So, regmap is init before we know which codec it is. Assume rt5645_regmap is used and what should I do once rt5650 is detected?
...you definitely can't change it after you registered the CODEC, regmap will ignore that. What should be happening here is that the devices should be being registered using different identifiers so that before we try to create the regmap we know what device is being used.
If there are buggy BIOSs out there that don't do that what I'd recommend doing is creating a temporary regmap with no defaults or anything, just the basic I/O. Use that to read the identification registers from the device and then create a second regmap with the actual configuration for the device.