};
/* Register access functions */
-static int had_get_hwstate(struct snd_intelhad *intelhaddata)
-{
- /* Check for device presence -SW state */
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
- return -ENODEV;
-
- return 0;
-}
-
static inline void
mid_hdmi_audio_read(struct snd_intelhad *ctx, u32 reg, u32 *val)
{
static int had_read_register(struct snd_intelhad *intelhaddata,
u32 offset, u32 *data)
{
- int retval;
-
- retval = had_get_hwstate(intelhaddata);
- if (retval)
- return retval;
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ return -ENODEV;
mid_hdmi_audio_read(intelhaddata, offset, data);
return 0;
static int had_write_register(struct snd_intelhad *intelhaddata,
u32 offset, u32 data)
{
- int retval;
-
- retval = had_get_hwstate(intelhaddata);
- if (retval)
- return retval;
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ return -ENODEV;
fixup_dp_config(intelhaddata, offset, &data);
mid_hdmi_audio_write(intelhaddata, offset, data);
u32 data, u32 mask)
{
u32 val_tmp;
- int retval;
- retval = had_get_hwstate(intelhaddata);
- if (retval)
- return retval;
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ return -ENODEV;
mid_hdmi_audio_read(intelhaddata, offset, &val_tmp);
val_tmp &= ~mask;
static void snd_intelhad_handle_underrun(struct snd_intelhad *intelhaddata)
{
- u32 hdmi_status, i = 0;
+ u32 hdmi_status = 0, i = 0;
/* Handle Underrun interrupt within Audio Unit */
had_write_register(intelhaddata, AUD_CONFIG, 0);
pm_runtime_get(intelhaddata->dev);
- if (had_get_hwstate(intelhaddata)) {
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
dev_dbg(intelhaddata->dev, "%s: HDMI cable plugged-out\n",
__func__);
retval = -ENODEV;
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
/* Disable local INTRs till register prgmng is done */
- if (had_get_hwstate(intelhaddata)) {
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
dev_dbg(intelhaddata->dev,
"_START: HDMI cable plugged-out\n");
retval = -ENODEV;
runtime = substream->runtime;
had_stream = &intelhaddata->stream_data;
- if (had_get_hwstate(intelhaddata)) {
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
dev_dbg(intelhaddata->dev, "%s: HDMI cable plugged-out\n",
__func__);
retval = -ENODEV;
intelhaddata = snd_pcm_substream_chip(substream);
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ return SNDRV_PCM_POS_XRUN;
+
if (intelhaddata->flag_underrun) {
intelhaddata->flag_underrun = false;
return SNDRV_PCM_POS_XRUN;
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flag_irqs);
- if (had_get_hwstate(intelhaddata)) {
+ if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
dev_dbg(intelhaddata->dev, "HDMI cable plugged-out\n");
return 0;
}