static int had_read_register(struct snd_intelhad *intelhaddata,
u32 offset, u32 *data)
{
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ if (!intelhaddata->connected)
return -ENODEV;
mid_hdmi_audio_read(intelhaddata, offset, data);
static int had_write_register(struct snd_intelhad *intelhaddata,
u32 offset, u32 data)
{
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ if (!intelhaddata->connected)
return -ENODEV;
fixup_dp_config(intelhaddata, offset, &data);
{
u32 val_tmp;
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ if (!intelhaddata->connected)
return -ENODEV;
mid_hdmi_audio_read(intelhaddata, offset, &val_tmp);
struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
struct snd_intelhad *intelhaddata = info->private_data;
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ if (!intelhaddata->connected)
return -ENODEV;
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = HAD_MAX_CHANNEL;
int i;
const struct snd_pcm_chmap_elem *chmap;
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED)
+ if (!intelhaddata->connected)
return -ENODEV;
mutex_lock(&intelhaddata->mutex);
pm_runtime_get_sync(intelhaddata->dev);
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
+ if (!intelhaddata->connected) {
dev_dbg(intelhaddata->dev, "%s: HDMI cable plugged-out\n",
__func__);
retval = -ENODEV;
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
case SNDRV_PCM_TRIGGER_RESUME:
/* Disable local INTRs till register prgmng is done */
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
+ if (!intelhaddata->connected) {
dev_dbg(intelhaddata->dev,
"_START: HDMI cable plugged-out\n");
retval = -ENODEV;
intelhaddata = snd_pcm_substream_chip(substream);
runtime = substream->runtime;
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
+ if (!intelhaddata->connected) {
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)
+ if (!intelhaddata->connected)
return SNDRV_PCM_POS_XRUN;
/* Use a hw register to calculate sub-period position reports.
intr_count = 1;
spin_lock_irqsave(&intelhaddata->had_spinlock, flags);
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
+ if (!intelhaddata->connected) {
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags);
dev_dbg(intelhaddata->dev,
"%s:Device already disconnected\n", __func__);
spin_unlock_irqrestore(&intelhaddata->had_spinlock, flags);
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
+ if (!intelhaddata->connected) {
dev_dbg(intelhaddata->dev, "HDMI cable plugged-out\n");
return 0;
}
struct pcm_stream_info *stream;
struct snd_pcm_substream *substream;
unsigned long flags;
- int drv_status;
+ int connected;
stream = &intelhaddata->stream_info;
spin_lock_irqsave(&intelhaddata->had_spinlock, flags);
buf_id = intelhaddata->curr_buf;
intelhaddata->buff_done = buf_id;
- drv_status = intelhaddata->drv_status;
+ connected = intelhaddata->connected;
if (stream->running)
intelhaddata->curr_buf = HAD_BUF_TYPE_A;
snd_intelhad_handle_underrun(intelhaddata);
- if (drv_status == HAD_DRV_DISCONNECTED) {
+ if (!connected) {
dev_dbg(intelhaddata->dev,
"%s:Device already disconnected\n", __func__);
return 0;
struct snd_pcm_substream *substream;
spin_lock_irq(&intelhaddata->had_spinlock);
- if (intelhaddata->drv_status == HAD_DRV_CONNECTED) {
+ if (intelhaddata->connected) {
dev_dbg(intelhaddata->dev, "Device already connected\n");
spin_unlock_irq(&intelhaddata->had_spinlock);
return;
buf_id = intelhaddata->curr_buf;
intelhaddata->buff_done = buf_id;
- intelhaddata->drv_status = HAD_DRV_CONNECTED;
+ intelhaddata->connected = true;
dev_dbg(intelhaddata->dev,
"%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_CONNECTED\n",
__func__, __LINE__);
spin_lock_irq(&intelhaddata->had_spinlock);
- if (intelhaddata->drv_status == HAD_DRV_DISCONNECTED) {
+ if (!intelhaddata->connected) {
dev_dbg(intelhaddata->dev, "Device already disconnected\n");
spin_unlock_irq(&intelhaddata->had_spinlock);
goto out;
snd_intelhad_enable_audio_int(intelhaddata, false);
snd_intelhad_enable_audio(substream, intelhaddata, false);
- intelhaddata->drv_status = HAD_DRV_DISCONNECTED;
+ intelhaddata->connected = false;
dev_dbg(intelhaddata->dev,
"%s @ %d:DEBUG PLUG/UNPLUG : HAD_DRV_DISCONNECTED\n",
__func__, __LINE__);
ctx = card->private_data;
spin_lock_init(&ctx->had_spinlock);
mutex_init(&ctx->mutex);
- ctx->drv_status = HAD_DRV_DISCONNECTED;
+ ctx->connected = false;
ctx->dev = &pdev->dev;
ctx->card = card;
ctx->aes_bits = SNDRV_PCM_DEFAULT_CON_SPDIF;
{
struct snd_intelhad *ctx = platform_get_drvdata(pdev);
- if (ctx->drv_status != HAD_DRV_DISCONNECTED)
+ if (ctx->connected)
snd_intelhad_enable_audio_int(ctx, false);
snd_card_free(ctx->card);
return 0;