* bad audio. The fix is to always write the AUD_CONFIG[6:4] with
* appropriate value when doing read-modify of AUD_CONFIG register.
*/
-static void had_enable_audio(struct snd_pcm_substream *substream,
- struct snd_intelhad *intelhaddata,
+static void had_enable_audio(struct snd_intelhad *intelhaddata,
bool enable)
{
- union aud_cfg cfg_val = {.regval = 0};
- u8 channels;
- u32 mask, val;
-
- /*
- * If substream is NULL, there is no active stream.
- * In this case just set channels to 2
- */
- channels = substream ? substream->runtime->channels : 2;
- dev_dbg(intelhaddata->dev, "enable %d, ch=%d\n", enable, channels);
-
- cfg_val.regx.num_ch = channels - 2;
- if (enable)
- cfg_val.regx.aud_en = 1;
- mask = AUD_CONFIG_CH_MASK | 1;
-
- had_read_register(intelhaddata, AUD_CONFIG, &val);
- val &= ~mask;
- val |= cfg_val.regval;
- had_write_register(intelhaddata, AUD_CONFIG, val);
+ /* update the cached value */
+ intelhaddata->aud_config.regx.aud_en = enable;
+ had_write_register(intelhaddata, AUD_CONFIG,
+ intelhaddata->aud_config.regval);
}
/* forcibly ACKs to both BUFFER_DONE and BUFFER_UNDERRUN interrupts */
}
had_write_register(intelhaddata, AUD_CONFIG, cfg_val.regval);
+ intelhaddata->aud_config = cfg_val;
return 0;
}
/* Handle Underrun interrupt within Audio Unit */
had_write_register(intelhaddata, AUD_CONFIG, 0);
+ intelhaddata->aud_config.regval = 0;
/* Reset buffer pointers */
had_reset_audio(intelhaddata);
/* Enable Audio */
had_ack_irqs(intelhaddata); /* FIXME: do we need this? */
- had_enable_audio(substream, intelhaddata, true);
+ had_enable_audio(intelhaddata, true);
break;
case SNDRV_PCM_TRIGGER_STOP:
intelhaddata->stream_info.running = false;
spin_unlock(&intelhaddata->had_spinlock);
/* Disable Audio */
- had_enable_audio(substream, intelhaddata, false);
+ had_enable_audio(intelhaddata, false);
/* Reset buffer pointers */
had_reset_audio(intelhaddata);
break;
return 0;
/* Disable Audio */
- had_enable_audio(substream, intelhaddata, false);
+ had_enable_audio(intelhaddata, false);
/* Update CTS value */
disp_samp_freq = intelhaddata->tmds_clock_speed;
n_param, intelhaddata);
/* Enable Audio */
- had_enable_audio(substream, intelhaddata, true);
+ had_enable_audio(intelhaddata, true);
out:
had_substream_put(intelhaddata);
}
/* Disable Audio */
- had_enable_audio(substream, intelhaddata, false);
+ had_enable_audio(intelhaddata, false);
intelhaddata->connected = false;
dev_dbg(intelhaddata->dev,