[alsa-devel] [PATCH - try2] ASoC: Codec driver for Texas Instruments tlv320dac33 codec
Eero Nurkkala
ext-eero.nurkkala at nokia.com
Tue Oct 13 14:41:38 CEST 2009
On Tue, 2009-10-13 at 14:03 +0200, Ujfalusi Peter (Nokia-D/Tampere)
wrote:
> +static int dac33_write_locked(struct snd_soc_codec *codec, unsigned int reg,
> + unsigned int value)
> +{
> + struct tlv320dac33_priv *dac33 = codec->private_data;
> + u8 data[2];
> + int ret = 0;
> +
> + /*
> + * data is
> + * D15..D8 dac33 register offset
> + * D7...D0 register data
> + */
> + data[0] = reg & 0xff;
> + data[1] = value & 0xff;
> +
> + dac33_write_reg_cache(codec, data[0], data[1]);
> + mutex_lock(&dac33->mutex);
> + if (dac33->chip_power) {
> + ret = codec->hw_write(codec->control_data, data, 2);
> + if (ret != 2)
> + dev_err(codec->dev, "Write failed (%d)\n", ret);
> + else
> + ret = 0;
> + }
> + mutex_unlock(&dac33->mutex);
> +
> + return ret;
> +}
Mark, aren't all codec bits updated within the snd_soc_update_bits() by
DAPM? It always takes the io_mutex. Does it make sense if we proposed a
new item to struct snd_soc_codec, something like io_mutex? then
snd_soc_update_bits() would check the presence of this codec->io_mutex,
and if it was present, it would only use that instead of io_mutex.
Just an idea... (I'd help here, no need for double locking like now)
More information about the Alsa-devel
mailing list