[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-05 Thread Mark Brown
On Tue, Aug 02, 2016 at 03:14:57PM +0200, Daniel Vetter wrote:

> Archit Tajena is the maintainer of last resort for anything related to
> drm_bridge.

That's Archit Taneja  (note spelling of surname)
for anyone else who's confused.  Can we get him listed in MAINTAINERS
please so it's easier for people to work this out and send patches to
him?  
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: 



[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-03 Thread Kuninori Morimoto

Hi Daniel

> > > > Mark, Thierry, Daniel
> > > > I wonder who can be maintainer for this patch ??
> > > 
> > > It's a DRM patch so I'd expect someone in the DRM subsystem.
> > 
> > OK, I see.
> > But, I will keep Cc to you for this patch-set.
> 
> Archit Tajena is the maintainer of last resort for anything related to
> drm_bridge.

Thank you.
I will re-post these patches with To: Archit



[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-02 Thread Daniel Vetter
On Tue, Aug 02, 2016 at 12:47:46AM +, Kuninori Morimoto wrote:
> 
> Hi Mark
> 
> > > Mark, Thierry, Daniel
> > > I wonder who can be maintainer for this patch ??
> > 
> > It's a DRM patch so I'd expect someone in the DRM subsystem.
> 
> OK, I see.
> But, I will keep Cc to you for this patch-set.

Archit Tajena is the maintainer of last resort for anything related to
drm_bridge.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-02 Thread Kuninori Morimoto

Hi Mark

> > Mark, Thierry, Daniel
> > I wonder who can be maintainer for this patch ??
> 
> It's a DRM patch so I'd expect someone in the DRM subsystem.

OK, I see.
But, I will keep Cc to you for this patch-set.



[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-02 Thread Kuninori Morimoto

Hi Russell

> > +static int snd_dw_hdmi_probe(struct platform_device *pdev)
> > +{
> > +   struct dw_hdmi_i2s_audio_data *audio = pdev->dev.platform_data;
> > +   struct platform_device_info pdevinfo;
> > +   struct hdmi_codec_pdata pdata;
> > +
> > +   pdata.ops   = _hdmi_i2s_ops;
> > +   pdata.i2s   = 1;
> > +   pdata.max_i2s_channels  = 6;
> > +   pdata.data  = audio;
> > +
> > +   memset(, 0, sizeof(pdevinfo));
> > +   pdevinfo.parent = pdev->dev.parent;
> > +   pdevinfo.id = PLATFORM_DEVID_AUTO;
> > +   pdevinfo.name   = HDMI_CODEC_DRV_NAME;
> > +   pdevinfo.data   = 
> > +   pdevinfo.size_data  = sizeof(pdata);
> > +   pdevinfo.dma_mask   = DMA_BIT_MASK(32);
> > +
> > +   return IS_ERR_OR_NULL(platform_device_register_full());
> 
> This is certainly wrong.  You're returning a 0/1 value rather than
> an error code when platform_device_register_full() fails.

Thanks.
I forgot why I added this ??
I will fix it on v2 patch


[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-01 Thread Mark Brown
On Mon, Aug 01, 2016 at 04:57:07AM +, Kuninori Morimoto wrote:

> Mark, Thierry, Daniel
> I wonder who can be maintainer for this patch ??

It's a DRM patch so I'd expect someone in the DRM subsystem.
-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: 



[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-01 Thread Russell King - ARM Linux
On Fri, Jun 24, 2016 at 11:40:44AM +0900, Kuninori Morimoto wrote:
> +static int snd_dw_hdmi_probe(struct platform_device *pdev)
> +{
> + struct dw_hdmi_i2s_audio_data *audio = pdev->dev.platform_data;
> + struct platform_device_info pdevinfo;
> + struct hdmi_codec_pdata pdata;
> +
> + pdata.ops   = _hdmi_i2s_ops;
> + pdata.i2s   = 1;
> + pdata.max_i2s_channels  = 6;
> + pdata.data  = audio;
> +
> + memset(, 0, sizeof(pdevinfo));
> + pdevinfo.parent = pdev->dev.parent;
> + pdevinfo.id = PLATFORM_DEVID_AUTO;
> + pdevinfo.name   = HDMI_CODEC_DRV_NAME;
> + pdevinfo.data   = 
> + pdevinfo.size_data  = sizeof(pdata);
> + pdevinfo.dma_mask   = DMA_BIT_MASK(32);
> +
> + return IS_ERR_OR_NULL(platform_device_register_full());

This is certainly wrong.  You're returning a 0/1 value rather than
an error code when platform_device_register_full() fails.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.


[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-01 Thread Jose Abreu
Hi,

On 01-08-2016 05:57, Kuninori Morimoto wrote:
> Hi Jose
> Cc: Mark, Thierry, Daniel
>
>>> From: Kuninori Morimoto 
>>>
>>> Current dw-hdmi is supporting sound via AHB bus, but it has
>>> I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
>>> This HDMI I2S is supported by using ALSA SoC common HDMI encoder
>>> driver.
>>>
>>> Signed-off-by: Kuninori Morimoto 
>>> ---
>>>
>> I just tested this patch and everything seems ok. Should I give
>> my tested-by?
> Thank you for your test. I'm happy if it could have it.
>
> Mark, Thierry, Daniel
> I wonder who can be maintainer for this patch ??
>
> Best regards
> ---
> Kuninori Morimoto

Tested-by: Jose Abreu 

Best regards,
Jose Miguel Abreu


[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-08-01 Thread Kuninori Morimoto

Hi Jose
Cc: Mark, Thierry, Daniel

> > From: Kuninori Morimoto 
> >
> > Current dw-hdmi is supporting sound via AHB bus, but it has
> > I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
> > This HDMI I2S is supported by using ALSA SoC common HDMI encoder
> > driver.
> >
> > Signed-off-by: Kuninori Morimoto 
> > ---
> >
> 
> I just tested this patch and everything seems ok. Should I give
> my tested-by?

Thank you for your test. I'm happy if it could have it.

Mark, Thierry, Daniel
I wonder who can be maintainer for this patch ??

Best regards
---
Kuninori Morimoto


[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-07-28 Thread Jose Abreu
Hi,


On 24-06-2016 03:40, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
>
> Current dw-hdmi is supporting sound via AHB bus, but it has
> I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
> This HDMI I2S is supported by using ALSA SoC common HDMI encoder
> driver.
>
> Signed-off-by: Kuninori Morimoto 
> ---
>

I just tested this patch and everything seems ok. Should I give
my tested-by?

Best regards,
Jose Miguel Abreu


[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-06-29 Thread Yakir Yang
Kuninori,

On 06/24/2016 10:40 AM, Kuninori Morimoto wrote:
> From: Kuninori Morimoto 
>
> Current dw-hdmi is supporting sound via AHB bus, but it has
> I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
> This HDMI I2S is supported by using ALSA SoC common HDMI encoder
> driver.
>
> Signed-off-by: Kuninori Morimoto 
> ---
>   drivers/gpu/drm/bridge/Kconfig |   8 ++
>   drivers/gpu/drm/bridge/Makefile|   1 +
>   drivers/gpu/drm/bridge/dw-hdmi-audio.h |   7 ++
>   drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c | 123 
> +
>   drivers/gpu/drm/bridge/dw-hdmi.c   |  22 +-
>   drivers/gpu/drm/bridge/dw-hdmi.h   |  21 +
>   6 files changed, 180 insertions(+), 2 deletions(-)
>   create mode 100644 drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
>
> diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
> index 8f7423f..8e2a22d 100644
> --- a/drivers/gpu/drm/bridge/Kconfig
> +++ b/drivers/gpu/drm/bridge/Kconfig
> @@ -32,6 +32,14 @@ config DRM_DW_HDMI_AHB_AUDIO
> Designware HDMI block.  This is used in conjunction with
> the i.MX6 HDMI driver.
>   
> +config DRM_DW_HDMI_I2S_AUDIO
> + tristate "Synopsis Designware I2S Audio interface"
> + depends on DRM_DW_HDMI
> + select SND_SOC_HDMI_CODEC
> + help
> +   Support the I2S Audio interface which is part of the Synopsis
> +   Designware HDMI block.
> +
>   config DRM_NXP_PTN3460
>   tristate "NXP PTN3460 DP/LVDS bridge"
>   depends on OF
> diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
> index 96b13b3..1af92ad 100644
> --- a/drivers/gpu/drm/bridge/Makefile
> +++ b/drivers/gpu/drm/bridge/Makefile
> @@ -3,6 +3,7 @@ ccflags-y := -Iinclude/drm
>   obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
>   obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o
>   obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o
> +obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o
>   obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
>   obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
>   obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi-audio.h 
> b/drivers/gpu/drm/bridge/dw-hdmi-audio.h
> index 91f631b..fd1f745 100644
> --- a/drivers/gpu/drm/bridge/dw-hdmi-audio.h
> +++ b/drivers/gpu/drm/bridge/dw-hdmi-audio.h
> @@ -11,4 +11,11 @@ struct dw_hdmi_audio_data {
>   u8 *eld;
>   };
>   
> +struct dw_hdmi_i2s_audio_data {
> + struct dw_hdmi *hdmi;
> +
> + void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
> + u8 (*read)(struct dw_hdmi *hdmi, int offset);
> +};
> +
>   #endif
> diff --git a/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c 
> b/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
> new file mode 100644
> index 000..df1519c
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
> @@ -0,0 +1,123 @@
> +/*
> + * dw-hdmi-i2s-audio.c
> + *
> + * Copyright (c) 2016 Kuninori Morimoto 
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +#include 
> +
> +#include 
> +
> +#include "dw-hdmi.h"
> +#include "dw-hdmi-audio.h"
> +
> +#define DRIVER_NAME "dw-hdmi-i2s-audio"
> +
> +static inline void hdmi_write(struct dw_hdmi_i2s_audio_data *audio, u8 val, 
> int offset)
> +{
> + struct dw_hdmi *hdmi = audio->hdmi;
> +
> + audio->write(hdmi, val, offset);
> +}
> +
> +static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset)
> +{
> + struct dw_hdmi *hdmi = audio->hdmi;
> +
> + return audio->read(hdmi, offset);
> +}
> +
> +static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
> +  struct hdmi_codec_daifmt *fmt,
> +  struct hdmi_codec_params *hparms)
> +{
> + struct dw_hdmi_i2s_audio_data *audio = data;
> + struct dw_hdmi *hdmi = audio->hdmi;
> + u8 conf0 = 0;
> + u8 conf1 = 0;
> + u8 inputclkfs = 0;
> +
> + /* it cares I2S only */
> + if ((fmt->fmt != HDMI_I2S) ||
> + (fmt->bit_clk_master | fmt->frame_clk_master)) {
> + dev_err(dev, "unsupported format/settings\n");
> + return -EINVAL;
> + }
> +
> + inputclkfs  = HDMI_AUD_INPUTCLKFS_64FS;
> + conf0   = HDMI_AUD_CONF0_I2S_ALL_ENABLE;
> +
> + switch(hparms->sample_width) {
> + case 16:
> + conf1 = HDMI_AUD_CONF1_WIDTH_16;
> + break;
> + case 24:
> + case 32:
> + conf1 = HDMI_AUD_CONF1_WIDTH_24;
> + break;
> + }
> +
> + dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate);
> +
> + hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS);
> + hdmi_write(audio, conf0, HDMI_AUD_CONF0);
> + hdmi_write(audio, conf1, HDMI_AUD_CONF1);
> +
> + dw_hdmi_audio_enable(hdmi);
> +
> + return 

[PATCH 1/3] drm: bridge: add DesignWare HDMI I2S audio support

2016-06-24 Thread Kuninori Morimoto

From: Kuninori Morimoto 

Current dw-hdmi is supporting sound via AHB bus, but it has
I2S audio feature too. This patch adds I2S audio support to dw-hdmi.
This HDMI I2S is supported by using ALSA SoC common HDMI encoder
driver.

Signed-off-by: Kuninori Morimoto 
---
 drivers/gpu/drm/bridge/Kconfig |   8 ++
 drivers/gpu/drm/bridge/Makefile|   1 +
 drivers/gpu/drm/bridge/dw-hdmi-audio.h |   7 ++
 drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c | 123 +
 drivers/gpu/drm/bridge/dw-hdmi.c   |  22 +-
 drivers/gpu/drm/bridge/dw-hdmi.h   |  21 +
 6 files changed, 180 insertions(+), 2 deletions(-)
 create mode 100644 drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c

diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
index 8f7423f..8e2a22d 100644
--- a/drivers/gpu/drm/bridge/Kconfig
+++ b/drivers/gpu/drm/bridge/Kconfig
@@ -32,6 +32,14 @@ config DRM_DW_HDMI_AHB_AUDIO
  Designware HDMI block.  This is used in conjunction with
  the i.MX6 HDMI driver.

+config DRM_DW_HDMI_I2S_AUDIO
+   tristate "Synopsis Designware I2S Audio interface"
+   depends on DRM_DW_HDMI
+   select SND_SOC_HDMI_CODEC
+   help
+ Support the I2S Audio interface which is part of the Synopsis
+ Designware HDMI block.
+
 config DRM_NXP_PTN3460
tristate "NXP PTN3460 DP/LVDS bridge"
depends on OF
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
index 96b13b3..1af92ad 100644
--- a/drivers/gpu/drm/bridge/Makefile
+++ b/drivers/gpu/drm/bridge/Makefile
@@ -3,6 +3,7 @@ ccflags-y := -Iinclude/drm
 obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
 obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o
 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o
+obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o
 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o
 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
 obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
diff --git a/drivers/gpu/drm/bridge/dw-hdmi-audio.h 
b/drivers/gpu/drm/bridge/dw-hdmi-audio.h
index 91f631b..fd1f745 100644
--- a/drivers/gpu/drm/bridge/dw-hdmi-audio.h
+++ b/drivers/gpu/drm/bridge/dw-hdmi-audio.h
@@ -11,4 +11,11 @@ struct dw_hdmi_audio_data {
u8 *eld;
 };

+struct dw_hdmi_i2s_audio_data {
+   struct dw_hdmi *hdmi;
+
+   void (*write)(struct dw_hdmi *hdmi, u8 val, int offset);
+   u8 (*read)(struct dw_hdmi *hdmi, int offset);
+};
+
 #endif
diff --git a/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c 
b/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
new file mode 100644
index 000..df1519c
--- /dev/null
+++ b/drivers/gpu/drm/bridge/dw-hdmi-i2s-audio.c
@@ -0,0 +1,123 @@
+/*
+ * dw-hdmi-i2s-audio.c
+ *
+ * Copyright (c) 2016 Kuninori Morimoto 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include 
+
+#include 
+
+#include "dw-hdmi.h"
+#include "dw-hdmi-audio.h"
+
+#define DRIVER_NAME "dw-hdmi-i2s-audio"
+
+static inline void hdmi_write(struct dw_hdmi_i2s_audio_data *audio, u8 val, 
int offset)
+{
+   struct dw_hdmi *hdmi = audio->hdmi;
+
+   audio->write(hdmi, val, offset);
+}
+
+static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset)
+{
+   struct dw_hdmi *hdmi = audio->hdmi;
+
+   return audio->read(hdmi, offset);
+}
+
+static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
+struct hdmi_codec_daifmt *fmt,
+struct hdmi_codec_params *hparms)
+{
+   struct dw_hdmi_i2s_audio_data *audio = data;
+   struct dw_hdmi *hdmi = audio->hdmi;
+   u8 conf0 = 0;
+   u8 conf1 = 0;
+   u8 inputclkfs = 0;
+
+   /* it cares I2S only */
+   if ((fmt->fmt != HDMI_I2S) ||
+   (fmt->bit_clk_master | fmt->frame_clk_master)) {
+   dev_err(dev, "unsupported format/settings\n");
+   return -EINVAL;
+   }
+
+   inputclkfs  = HDMI_AUD_INPUTCLKFS_64FS;
+   conf0   = HDMI_AUD_CONF0_I2S_ALL_ENABLE;
+
+   switch(hparms->sample_width) {
+   case 16:
+   conf1 = HDMI_AUD_CONF1_WIDTH_16;
+   break;
+   case 24:
+   case 32:
+   conf1 = HDMI_AUD_CONF1_WIDTH_24;
+   break;
+   }
+
+   dw_hdmi_set_sample_rate(hdmi, hparms->sample_rate);
+
+   hdmi_write(audio, inputclkfs, HDMI_AUD_INPUTCLKFS);
+   hdmi_write(audio, conf0, HDMI_AUD_CONF0);
+   hdmi_write(audio, conf1, HDMI_AUD_CONF1);
+
+   dw_hdmi_audio_enable(hdmi);
+
+   return 0;
+}
+
+static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data)
+{
+   struct dw_hdmi_i2s_audio_data *audio = data;
+   struct dw_hdmi *hdmi = audio->hdmi;
+
+   dw_hdmi_audio_disable(hdmi);
+
+