mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 11:13:58 +08:00
ASoC: Prepare SOC_SINGLE_XR_SX controls for regmap
SOC_SINGLE_XR_SX controls currently only work with CODECs that set the 'reg_word_size' field in their snd_soc_codec_driver struct. Going forward support for ASoC level IO will eventually be removed and all drivers will be converted to regmap. Preparing for the transition this patch adds support for CODECs using regmap for IO to the SOC_SINGLE_XR_SX control. We already have the val_bytes field in the CODEC struct which holds the number of bytes per word, but it is only initialized when regmap is used. Also initialize it for drivers still using legacy IO and update the SOC_SINGLE_XR_SX handlers to use it. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
parent
f6272ff8a5
commit
6137a5ca32
@ -3343,7 +3343,7 @@ int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
unsigned int regbase = mc->regbase;
|
||||
unsigned int regcount = mc->regcount;
|
||||
unsigned int regwshift = codec->driver->reg_word_size * BITS_PER_BYTE;
|
||||
unsigned int regwshift = codec->val_bytes * BITS_PER_BYTE;
|
||||
unsigned int regwmask = (1<<regwshift)-1;
|
||||
unsigned int invert = mc->invert;
|
||||
unsigned long mask = (1UL<<mc->nbits)-1;
|
||||
@ -3389,7 +3389,7 @@ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
unsigned int regbase = mc->regbase;
|
||||
unsigned int regcount = mc->regcount;
|
||||
unsigned int regwshift = codec->driver->reg_word_size * BITS_PER_BYTE;
|
||||
unsigned int regwshift = codec->val_bytes * BITS_PER_BYTE;
|
||||
unsigned int regwmask = (1<<regwshift)-1;
|
||||
unsigned int invert = mc->invert;
|
||||
unsigned long mask = (1UL<<mc->nbits)-1;
|
||||
@ -4292,6 +4292,7 @@ int snd_soc_register_codec(struct device *dev,
|
||||
codec->dev = dev;
|
||||
codec->driver = codec_drv;
|
||||
codec->num_dai = num_dai;
|
||||
codec->val_bytes = codec_drv->reg_word_size;
|
||||
mutex_init(&codec->mutex);
|
||||
|
||||
for (i = 0; i < num_dai; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user