Re: [PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-03-26 Thread Mark Brown
On Sat, Feb 28, 2015 at 09:59:20PM -0500, Yakir Yang wrote:

> codec driver creat an standard alsa device, than config audio
> and report jack status through some callback interfaces that
> dw_hdmi driver support.

Looking at this it's not althogether clear to me how specific this is to
the Designware hardware - it looks like it's all callbacks into the main
driver doing pretty generic things apart from the fact that we request
an interrupt here (but then use it to do another callback into the
driver).

Please also try to only CC relevant people on mails - you've got a
*very* large list of people there and for a lot of them it's hard to
understand why you've copied them.  Copying people adds to the amount of
mail they need to read so it's good to try to stay relevant.

> + if (jack_status != hdmi->jack_status) {
> + snd_soc_jack_report(>jack, jack_status,
> + SND_JACK_LINEOUT);

We may need a new jack type here, or perhaps we ought to just be
reporting the jack status via extcon?

> + hdmi->jack_status = jack_status;
> +
> + dev_info(hdmi->dev, "jack report [%d]\n", hdmi->jack_status);

Please remove this and all the other prints, it's far too noisy.

> +/* we don't want this irq mark with IRQF_ONESHOT flags,
> + * so we build an irq_default_primary_handler here */
> +static irqreturn_t snd_dw_hdmi_hardirq(int irq, void *dev_id)
> +{
> + return IRQ_WAKE_THREAD;
> +}

Why do we not want to use IRQF_ONESHOT?

> +static int dw_hdmi_audio_remove(struct platform_device *pdev)
> +{
> + struct snd_dw_hdmi *hdmi = platform_get_drvdata(pdev);
> +
> + snd_soc_unregister_codec(>dev);
> + devm_free_irq(>dev, hdmi->data.irq, hdmi);
> + devm_kfree(>dev, hdmi);

Explicitly freeing devm_ things seems to be missing the point a bit...

> +static const struct of_device_id dw_hdmi_audio_ids[] = {
> + { .compatible = DRV_NAME, },
> + { }
> +};

Your driver name didn't have a vendor prefix, this is broken - you
should probably just remove DRV_NAME and use the string directly in the
few places it's used.  It's also not clear to me that this is a separate
device from the parent device and should therefore appear separately in
DT at all.

> +static struct platform_driver dw_hdmi_audio_driver = {
> + .driver = {
> + .name = DRV_NAME,
> + .owner = THIS_MODULE,

No need to assign owner any more.


signature.asc
Description: Digital signature


Re: [PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-03-26 Thread Mark Brown
On Sat, Feb 28, 2015 at 09:59:20PM -0500, Yakir Yang wrote:

 codec driver creat an standard alsa device, than config audio
 and report jack status through some callback interfaces that
 dw_hdmi driver support.

Looking at this it's not althogether clear to me how specific this is to
the Designware hardware - it looks like it's all callbacks into the main
driver doing pretty generic things apart from the fact that we request
an interrupt here (but then use it to do another callback into the
driver).

Please also try to only CC relevant people on mails - you've got a
*very* large list of people there and for a lot of them it's hard to
understand why you've copied them.  Copying people adds to the amount of
mail they need to read so it's good to try to stay relevant.

 + if (jack_status != hdmi-jack_status) {
 + snd_soc_jack_report(hdmi-jack, jack_status,
 + SND_JACK_LINEOUT);

We may need a new jack type here, or perhaps we ought to just be
reporting the jack status via extcon?

 + hdmi-jack_status = jack_status;
 +
 + dev_info(hdmi-dev, jack report [%d]\n, hdmi-jack_status);

Please remove this and all the other prints, it's far too noisy.

 +/* we don't want this irq mark with IRQF_ONESHOT flags,
 + * so we build an irq_default_primary_handler here */
 +static irqreturn_t snd_dw_hdmi_hardirq(int irq, void *dev_id)
 +{
 + return IRQ_WAKE_THREAD;
 +}

Why do we not want to use IRQF_ONESHOT?

 +static int dw_hdmi_audio_remove(struct platform_device *pdev)
 +{
 + struct snd_dw_hdmi *hdmi = platform_get_drvdata(pdev);
 +
 + snd_soc_unregister_codec(pdev-dev);
 + devm_free_irq(pdev-dev, hdmi-data.irq, hdmi);
 + devm_kfree(pdev-dev, hdmi);

Explicitly freeing devm_ things seems to be missing the point a bit...

 +static const struct of_device_id dw_hdmi_audio_ids[] = {
 + { .compatible = DRV_NAME, },
 + { }
 +};

Your driver name didn't have a vendor prefix, this is broken - you
should probably just remove DRV_NAME and use the string directly in the
few places it's used.  It's also not clear to me that this is a separate
device from the parent device and should therefore appear separately in
DT at all.

 +static struct platform_driver dw_hdmi_audio_driver = {
 + .driver = {
 + .name = DRV_NAME,
 + .owner = THIS_MODULE,

No need to assign owner any more.


signature.asc
Description: Digital signature


Re: [PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-03-02 Thread Yakir Yang



在 2015/3/2 17:15, Paul Bolle 写道:

On Sat, 2015-02-28 at 21:59 -0500, Yakir Yang wrote:

--- /dev/null
+++ b/sound/soc/codecs/dw-hdmi-audio.c
@@ -0,0 +1,379 @@
+/*
+ * dw-hdmi-codec.c

Doesn't match the filename. Is this line needed?


Thanks, this comment are good for read, and seems others codec driver 
also content this comment,

so I think we can keep this comment.
I will correct the file name it in next version.

Thanks for you reply :)



+ * DesignerWare ALSA SoC DAI driver for DW HDMI audio.
+ * Copyright (c) 2014,  CORPORATION. All rights reserved.
+ * Authors: Yakir Yang 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .*
+ *
+ */

This states that the license is plain GPL v2.

(Missing empty line here.)


Okay, thanks, correct it in next version.

Thanks :)

+#include 

[...]


+MODULE_LICENSE("GPL");

So you probably want
 MODULE_LICENSE("GPL v2");

here.

Okay, thanks, correct it in next version.

Thanks :)

Yakir Yang
Best regards.



Paul Bolle







--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-03-02 Thread Paul Bolle
On Sat, 2015-02-28 at 21:59 -0500, Yakir Yang wrote:
> --- /dev/null
> +++ b/sound/soc/codecs/dw-hdmi-audio.c
> @@ -0,0 +1,379 @@
> +/*
> + * dw-hdmi-codec.c

Doesn't match the filename. Is this line needed?

> + * DesignerWare ALSA SoC DAI driver for DW HDMI audio.
> + * Copyright (c) 2014,  CORPORATION. All rights reserved.
> + * Authors: Yakir Yang 
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see .*
> + *
> + */

This states that the license is plain GPL v2.

(Missing empty line here.)

> +#include 

[...]

> +MODULE_LICENSE("GPL");

So you probably want
MODULE_LICENSE("GPL v2");

here.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-03-02 Thread Paul Bolle
On Sat, 2015-02-28 at 21:59 -0500, Yakir Yang wrote:
 --- /dev/null
 +++ b/sound/soc/codecs/dw-hdmi-audio.c
 @@ -0,0 +1,379 @@
 +/*
 + * dw-hdmi-codec.c

Doesn't match the filename. Is this line needed?

 + * DesignerWare ALSA SoC DAI driver for DW HDMI audio.
 + * Copyright (c) 2014,  CORPORATION. All rights reserved.
 + * Authors: Yakir Yang y...@rock-chips.com
 + *
 + * This program is free software; you can redistribute it and/or modify it
 + * under the terms and conditions of the GNU General Public License,
 + * version 2, as published by the Free Software Foundation.
 + *
 + * This program is distributed in the hope it will be useful, but WITHOUT
 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 + * more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program.  If not, see http://www.gnu.org/licenses/.*
 + *
 + */

This states that the license is plain GPL v2.

(Missing empty line here.)

 +#include linux/init.h

[...]

 +MODULE_LICENSE(GPL);

So you probably want
MODULE_LICENSE(GPL v2);

here.


Paul Bolle

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-03-02 Thread Yakir Yang



在 2015/3/2 17:15, Paul Bolle 写道:

On Sat, 2015-02-28 at 21:59 -0500, Yakir Yang wrote:

--- /dev/null
+++ b/sound/soc/codecs/dw-hdmi-audio.c
@@ -0,0 +1,379 @@
+/*
+ * dw-hdmi-codec.c

Doesn't match the filename. Is this line needed?


Thanks, this comment are good for read, and seems others codec driver 
also content this comment,

so I think we can keep this comment.
I will correct the file name it in next version.

Thanks for you reply :)



+ * DesignerWare ALSA SoC DAI driver for DW HDMI audio.
+ * Copyright (c) 2014,  CORPORATION. All rights reserved.
+ * Authors: Yakir Yang y...@rock-chips.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.*
+ *
+ */

This states that the license is plain GPL v2.

(Missing empty line here.)


Okay, thanks, correct it in next version.

Thanks :)

+#include linux/init.h

[...]


+MODULE_LICENSE(GPL);

So you probably want
 MODULE_LICENSE(GPL v2);

here.

Okay, thanks, correct it in next version.

Thanks :)

Yakir Yang
Best regards.



Paul Bolle







--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-02-28 Thread Yakir Yang
codec driver creat an standard alsa device, than config audio
and report jack status through some callback interfaces that
dw_hdmi driver support.

Signed-off-by: Yakir Yang 
---
Changes in v4:
- Replace delaywork with irq thread, and add suspend/resume interfaces,
  Replace "dw-hdmi-audio" with consecutive strings.

Changes in v3:
- Keep audio format config function in dw-hdmi-audio driver
  and remove audio_config & get_connect_status functions,
  move jack control to dw-hdmi-audio completely.

Changes in v2:
- Update dw_hdmi audio control interfaces, and adjust jack report process

 sound/soc/codecs/Kconfig |   4 +
 sound/soc/codecs/Makefile|   2 +
 sound/soc/codecs/dw-hdmi-audio.c | 379 +++
 sound/soc/codecs/dw-hdmi-audio.h |  74 
 4 files changed, 459 insertions(+)
 create mode 100644 sound/soc/codecs/dw-hdmi-audio.c
 create mode 100644 sound/soc/codecs/dw-hdmi-audio.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 8349f98..b34dd12 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -75,6 +75,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_MC13783 if MFD_MC13XXX
select SND_SOC_ML26124 if I2C
select SND_SOC_HDMI_CODEC
+   select SND_SOC_DW_HDMI_AUDIO
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM1792A if SPI_MASTER
select SND_SOC_PCM3008
@@ -459,6 +460,9 @@ config SND_SOC_MAX98095
 config SND_SOC_MAX9850
tristate
 
+config SND_SOC_DW_HDMI_AUDIO
+   tristate
+
 config SND_SOC_PCM1681
tristate "Texas Instruments PCM1681 CODEC"
depends on I2C
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index bbdfd1e..0ebb664 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -68,6 +68,7 @@ snd-soc-max9850-objs := max9850.o
 snd-soc-mc13783-objs := mc13783.o
 snd-soc-ml26124-objs := ml26124.o
 snd-soc-hdmi-codec-objs := hdmi.o
+snd-soc-dw-hdmi-audio-objs := dw-hdmi-audio.o
 snd-soc-pcm1681-objs := pcm1681.o
 snd-soc-pcm1792a-codec-objs := pcm1792a.o
 snd-soc-pcm3008-objs := pcm3008.o
@@ -249,6 +250,7 @@ obj-$(CONFIG_SND_SOC_MAX9850)   += snd-soc-max9850.o
 obj-$(CONFIG_SND_SOC_MC13783)  += snd-soc-mc13783.o
 obj-$(CONFIG_SND_SOC_ML26124)  += snd-soc-ml26124.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
+obj-$(CONFIG_SND_SOC_DW_HDMI_AUDIO) += snd-soc-dw-hdmi-audio.o
 obj-$(CONFIG_SND_SOC_PCM1681)  += snd-soc-pcm1681.o
 obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
 obj-$(CONFIG_SND_SOC_PCM3008)  += snd-soc-pcm3008.o
diff --git a/sound/soc/codecs/dw-hdmi-audio.c b/sound/soc/codecs/dw-hdmi-audio.c
new file mode 100644
index 000..352a4c3
--- /dev/null
+++ b/sound/soc/codecs/dw-hdmi-audio.c
@@ -0,0 +1,379 @@
+/*
+ * dw-hdmi-codec.c
+ *
+ * DesignerWare ALSA SoC DAI driver for DW HDMI audio.
+ * Copyright (c) 2014,  CORPORATION. All rights reserved.
+ * Authors: Yakir Yang 
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .*
+ *
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include "dw-hdmi-audio.h"
+
+#define DRV_NAME "dw-hdmi-audio"
+
+struct snd_dw_hdmi {
+   struct device *dev;
+   struct dw_hdmi_audio_data data;
+
+   u8 jack_status;
+   bool is_jack_ready;
+   struct snd_soc_jack jack;
+
+   bool is_playback_status;
+   struct hdmi_audio_fmt fmt;
+};
+
+int snd_dw_hdmi_jack_detect(struct snd_dw_hdmi *hdmi)
+{
+   u8 jack_status;
+
+   if (!hdmi->is_jack_ready)
+   return -EINVAL;
+
+   jack_status = !!(hdmi->data.read(hdmi->data.dw, HDMI_PHY_STAT0)&
+ HDMI_PHY_HPD) ? SND_JACK_LINEOUT : 0;
+
+   if (jack_status != hdmi->jack_status) {
+   snd_soc_jack_report(>jack, jack_status,
+   SND_JACK_LINEOUT);
+   hdmi->jack_status = jack_status;
+
+   dev_info(hdmi->dev, "jack report [%d]\n", hdmi->jack_status);
+   }
+
+   return 0;
+}
+
+/* we don't want this irq mark with IRQF_ONESHOT flags,
+ * so we build an irq_default_primary_handler here */
+static irqreturn_t snd_dw_hdmi_hardirq(int irq, void *dev_id)
+{
+   return IRQ_WAKE_THREAD;
+}
+
+static irqreturn_t snd_dw_hdmi_irq(int irq, void *dev_id)
+{
+   struct snd_dw_hdmi *hdmi = dev_id;
+
+   

[PATCH v4 13/15] ASoC: codec/dw-hdmi-audio: add codec driver for dw hdmi audio

2015-02-28 Thread Yakir Yang
codec driver creat an standard alsa device, than config audio
and report jack status through some callback interfaces that
dw_hdmi driver support.

Signed-off-by: Yakir Yang y...@rock-chips.com
---
Changes in v4:
- Replace delaywork with irq thread, and add suspend/resume interfaces,
  Replace dw-hdmi-audio with consecutive strings.

Changes in v3:
- Keep audio format config function in dw-hdmi-audio driver
  and remove audio_config  get_connect_status functions,
  move jack control to dw-hdmi-audio completely.

Changes in v2:
- Update dw_hdmi audio control interfaces, and adjust jack report process

 sound/soc/codecs/Kconfig |   4 +
 sound/soc/codecs/Makefile|   2 +
 sound/soc/codecs/dw-hdmi-audio.c | 379 +++
 sound/soc/codecs/dw-hdmi-audio.h |  74 
 4 files changed, 459 insertions(+)
 create mode 100644 sound/soc/codecs/dw-hdmi-audio.c
 create mode 100644 sound/soc/codecs/dw-hdmi-audio.h

diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 8349f98..b34dd12 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -75,6 +75,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_MC13783 if MFD_MC13XXX
select SND_SOC_ML26124 if I2C
select SND_SOC_HDMI_CODEC
+   select SND_SOC_DW_HDMI_AUDIO
select SND_SOC_PCM1681 if I2C
select SND_SOC_PCM1792A if SPI_MASTER
select SND_SOC_PCM3008
@@ -459,6 +460,9 @@ config SND_SOC_MAX98095
 config SND_SOC_MAX9850
tristate
 
+config SND_SOC_DW_HDMI_AUDIO
+   tristate
+
 config SND_SOC_PCM1681
tristate Texas Instruments PCM1681 CODEC
depends on I2C
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index bbdfd1e..0ebb664 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -68,6 +68,7 @@ snd-soc-max9850-objs := max9850.o
 snd-soc-mc13783-objs := mc13783.o
 snd-soc-ml26124-objs := ml26124.o
 snd-soc-hdmi-codec-objs := hdmi.o
+snd-soc-dw-hdmi-audio-objs := dw-hdmi-audio.o
 snd-soc-pcm1681-objs := pcm1681.o
 snd-soc-pcm1792a-codec-objs := pcm1792a.o
 snd-soc-pcm3008-objs := pcm3008.o
@@ -249,6 +250,7 @@ obj-$(CONFIG_SND_SOC_MAX9850)   += snd-soc-max9850.o
 obj-$(CONFIG_SND_SOC_MC13783)  += snd-soc-mc13783.o
 obj-$(CONFIG_SND_SOC_ML26124)  += snd-soc-ml26124.o
 obj-$(CONFIG_SND_SOC_HDMI_CODEC) += snd-soc-hdmi-codec.o
+obj-$(CONFIG_SND_SOC_DW_HDMI_AUDIO) += snd-soc-dw-hdmi-audio.o
 obj-$(CONFIG_SND_SOC_PCM1681)  += snd-soc-pcm1681.o
 obj-$(CONFIG_SND_SOC_PCM1792A) += snd-soc-pcm1792a-codec.o
 obj-$(CONFIG_SND_SOC_PCM3008)  += snd-soc-pcm3008.o
diff --git a/sound/soc/codecs/dw-hdmi-audio.c b/sound/soc/codecs/dw-hdmi-audio.c
new file mode 100644
index 000..352a4c3
--- /dev/null
+++ b/sound/soc/codecs/dw-hdmi-audio.c
@@ -0,0 +1,379 @@
+/*
+ * dw-hdmi-codec.c
+ *
+ * DesignerWare ALSA SoC DAI driver for DW HDMI audio.
+ * Copyright (c) 2014,  CORPORATION. All rights reserved.
+ * Authors: Yakir Yang y...@rock-chips.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.*
+ *
+ */
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/device.h
+#include linux/moduleparam.h
+
+#include sound/pcm.h
+
+#include sound/soc.h
+#include sound/core.h
+#include sound/jack.h
+#include sound/initval.h
+#include sound/pcm_params.h
+
+#include drm/bridge/dw_hdmi.h
+#include dw-hdmi-audio.h
+
+#define DRV_NAME dw-hdmi-audio
+
+struct snd_dw_hdmi {
+   struct device *dev;
+   struct dw_hdmi_audio_data data;
+
+   u8 jack_status;
+   bool is_jack_ready;
+   struct snd_soc_jack jack;
+
+   bool is_playback_status;
+   struct hdmi_audio_fmt fmt;
+};
+
+int snd_dw_hdmi_jack_detect(struct snd_dw_hdmi *hdmi)
+{
+   u8 jack_status;
+
+   if (!hdmi-is_jack_ready)
+   return -EINVAL;
+
+   jack_status = !!(hdmi-data.read(hdmi-data.dw, HDMI_PHY_STAT0)
+ HDMI_PHY_HPD) ? SND_JACK_LINEOUT : 0;
+
+   if (jack_status != hdmi-jack_status) {
+   snd_soc_jack_report(hdmi-jack, jack_status,
+   SND_JACK_LINEOUT);
+   hdmi-jack_status = jack_status;
+
+   dev_info(hdmi-dev, jack report [%d]\n, hdmi-jack_status);
+   }
+
+   return 0;
+}
+
+/* we don't want this irq mark with IRQF_ONESHOT flags,
+ * so we build an irq_default_primary_handler here */
+static irqreturn_t