[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-04-08 Thread Ville Syrjälä
On Thu, Mar 07, 2013 at 02:44:12PM +0100, Thierry Reding wrote:
> On Thu, Mar 07, 2013 at 02:32:51PM +0100, Lucas Stach wrote:
> > Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
> > > On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrj?l? wrote:
> > > > On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
> > > [...]
> > > > > diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> > > > > new file mode 100644
> > > > > index 000..ab23c9b
> > > > > --- /dev/null
> > > > > +++ b/drivers/video/hdmi.c
> > > > > @@ -0,0 +1,308 @@
> > > > > +/*
> > > > > + * Copyright (C) 2012 Avionic Design GmbH
> > > > > + *
> > > > > + * 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.
> > > > > + */
> > > > 
> > > > BTW was there any discussion about the license? drm is generally MIT.
> > > > Are people OK with depending on GPL code for infoframe support?
> > > 
> > > I wasn't aware of that. I don't know how much of an issue it is really
> > > since all symbols are exported non-GPL.
> > > 
> > > Thierry
> > 
> > It's not about the export of the symbols, but more about porting DRM to
> > other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
> > lot harder and they are already struggling really hard to keep up with
> > the pace of Linux. So if you don't care too much it would be nice to use
> > MIT here.
> 
> Sure, I'll relicense it under MIT then.

It seems these got merged as GPL. Do you want to provide a patch for
changing the license?

-- 
Ville Syrj?l?
Intel OTC


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-04-08 Thread Thierry Reding
On Mon, Apr 08, 2013 at 02:52:40PM +0300, Ville Syrj?l? wrote:
> On Thu, Mar 07, 2013 at 02:44:12PM +0100, Thierry Reding wrote:
> > On Thu, Mar 07, 2013 at 02:32:51PM +0100, Lucas Stach wrote:
> > > Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
> > > > On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrj?l? wrote:
> > > > > On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
> > > > [...]
> > > > > > diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> > > > > > new file mode 100644
> > > > > > index 000..ab23c9b
> > > > > > --- /dev/null
> > > > > > +++ b/drivers/video/hdmi.c
> > > > > > @@ -0,0 +1,308 @@
> > > > > > +/*
> > > > > > + * Copyright (C) 2012 Avionic Design GmbH
> > > > > > + *
> > > > > > + * 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.
> > > > > > + */
> > > > > 
> > > > > BTW was there any discussion about the license? drm is generally MIT.
> > > > > Are people OK with depending on GPL code for infoframe support?
> > > > 
> > > > I wasn't aware of that. I don't know how much of an issue it is really
> > > > since all symbols are exported non-GPL.
> > > > 
> > > > Thierry
> > > 
> > > It's not about the export of the symbols, but more about porting DRM to
> > > other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
> > > lot harder and they are already struggling really hard to keep up with
> > > the pace of Linux. So if you don't care too much it would be nice to use
> > > MIT here.
> > 
> > Sure, I'll relicense it under MIT then.
> 
> It seems these got merged as GPL. Do you want to provide a patch for
> changing the license?

Yes, I have the patch locally but had forgotten to send it out. Done
now. Thanks for reminding me.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 



Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-04-08 Thread Ville Syrjälä
On Thu, Mar 07, 2013 at 02:44:12PM +0100, Thierry Reding wrote:
 On Thu, Mar 07, 2013 at 02:32:51PM +0100, Lucas Stach wrote:
  Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
   On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrjälä wrote:
On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
   [...]
 diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
 new file mode 100644
 index 000..ab23c9b
 --- /dev/null
 +++ b/drivers/video/hdmi.c
 @@ -0,0 +1,308 @@
 +/*
 + * Copyright (C) 2012 Avionic Design GmbH
 + *
 + * 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.
 + */

BTW was there any discussion about the license? drm is generally MIT.
Are people OK with depending on GPL code for infoframe support?
   
   I wasn't aware of that. I don't know how much of an issue it is really
   since all symbols are exported non-GPL.
   
   Thierry
  
  It's not about the export of the symbols, but more about porting DRM to
  other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
  lot harder and they are already struggling really hard to keep up with
  the pace of Linux. So if you don't care too much it would be nice to use
  MIT here.
 
 Sure, I'll relicense it under MIT then.

It seems these got merged as GPL. Do you want to provide a patch for
changing the license?

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-04-08 Thread Thierry Reding
On Mon, Apr 08, 2013 at 02:52:40PM +0300, Ville Syrjälä wrote:
 On Thu, Mar 07, 2013 at 02:44:12PM +0100, Thierry Reding wrote:
  On Thu, Mar 07, 2013 at 02:32:51PM +0100, Lucas Stach wrote:
   Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrjälä wrote:
 On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
[...]
  diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
  new file mode 100644
  index 000..ab23c9b
  --- /dev/null
  +++ b/drivers/video/hdmi.c
  @@ -0,0 +1,308 @@
  +/*
  + * Copyright (C) 2012 Avionic Design GmbH
  + *
  + * 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.
  + */
 
 BTW was there any discussion about the license? drm is generally MIT.
 Are people OK with depending on GPL code for infoframe support?

I wasn't aware of that. I don't know how much of an issue it is really
since all symbols are exported non-GPL.

Thierry
   
   It's not about the export of the symbols, but more about porting DRM to
   other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
   lot harder and they are already struggling really hard to keep up with
   the pace of Linux. So if you don't care too much it would be nice to use
   MIT here.
  
  Sure, I'll relicense it under MIT then.
 
 It seems these got merged as GPL. Do you want to provide a patch for
 changing the license?

Yes, I have the patch locally but had forgotten to send it out. Done
now. Thanks for reminding me.

Thierry


pgpaCzht1Ajlg.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-07 Thread Thierry Reding
On Thu, Mar 07, 2013 at 02:32:51PM +0100, Lucas Stach wrote:
> Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
> > On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrj?l? wrote:
> > > On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
> > [...]
> > > > diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> > > > new file mode 100644
> > > > index 000..ab23c9b
> > > > --- /dev/null
> > > > +++ b/drivers/video/hdmi.c
> > > > @@ -0,0 +1,308 @@
> > > > +/*
> > > > + * Copyright (C) 2012 Avionic Design GmbH
> > > > + *
> > > > + * 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.
> > > > + */
> > > 
> > > BTW was there any discussion about the license? drm is generally MIT.
> > > Are people OK with depending on GPL code for infoframe support?
> > 
> > I wasn't aware of that. I don't know how much of an issue it is really
> > since all symbols are exported non-GPL.
> > 
> > Thierry
> 
> It's not about the export of the symbols, but more about porting DRM to
> other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
> lot harder and they are already struggling really hard to keep up with
> the pace of Linux. So if you don't care too much it would be nice to use
> MIT here.

Sure, I'll relicense it under MIT then.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 



[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-07 Thread Lucas Stach
Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
> On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrj?l? wrote:
> > On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
> [...]
> > > diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> > > new file mode 100644
> > > index 000..ab23c9b
> > > --- /dev/null
> > > +++ b/drivers/video/hdmi.c
> > > @@ -0,0 +1,308 @@
> > > +/*
> > > + * Copyright (C) 2012 Avionic Design GmbH
> > > + *
> > > + * 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.
> > > + */
> > 
> > BTW was there any discussion about the license? drm is generally MIT.
> > Are people OK with depending on GPL code for infoframe support?
> 
> I wasn't aware of that. I don't know how much of an issue it is really
> since all symbols are exported non-GPL.
> 
> Thierry

It's not about the export of the symbols, but more about porting DRM to
other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
lot harder and they are already struggling really hard to keep up with
the pace of Linux. So if you don't care too much it would be nice to use
MIT here.

Regards,
Lucas



Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-07 Thread Lucas Stach
Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
 On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrjälä wrote:
  On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
 [...]
   diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
   new file mode 100644
   index 000..ab23c9b
   --- /dev/null
   +++ b/drivers/video/hdmi.c
   @@ -0,0 +1,308 @@
   +/*
   + * Copyright (C) 2012 Avionic Design GmbH
   + *
   + * 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.
   + */
  
  BTW was there any discussion about the license? drm is generally MIT.
  Are people OK with depending on GPL code for infoframe support?
 
 I wasn't aware of that. I don't know how much of an issue it is really
 since all symbols are exported non-GPL.
 
 Thierry

It's not about the export of the symbols, but more about porting DRM to
other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
lot harder and they are already struggling really hard to keep up with
the pace of Linux. So if you don't care too much it would be nice to use
MIT here.

Regards,
Lucas

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-07 Thread Thierry Reding
On Thu, Mar 07, 2013 at 02:32:51PM +0100, Lucas Stach wrote:
 Am Montag, den 04.03.2013, 16:02 +0100 schrieb Thierry Reding:
  On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrjälä wrote:
   On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
  [...]
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
new file mode 100644
index 000..ab23c9b
--- /dev/null
+++ b/drivers/video/hdmi.c
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2012 Avionic Design GmbH
+ *
+ * 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.
+ */
   
   BTW was there any discussion about the license? drm is generally MIT.
   Are people OK with depending on GPL code for infoframe support?
  
  I wasn't aware of that. I don't know how much of an issue it is really
  since all symbols are exported non-GPL.
  
  Thierry
 
 It's not about the export of the symbols, but more about porting DRM to
 other UNIXes like BSD. Using the GPL here makes life for the BSD guys a
 lot harder and they are already struggling really hard to keep up with
 the pace of Linux. So if you don't care too much it would be nice to use
 MIT here.

Sure, I'll relicense it under MIT then.

Thierry


pgpGWILTvYYlX.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-04 Thread Ville Syrjälä
On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
> Add generic helpers to pack HDMI infoframes into binary buffers.
> 
> Signed-off-by: Thierry Reding 
> ---
> Changes in v2:
> - add support for audio, vendor-specific and SPD infoframes
> - add various validity checks on infoframes
> - factor out checksum computation
> 
> Changes in v3:
> - introduce HDMI_INFOFRAME_HEADER_SIZE
> - fix SPD infoframe SDI field offset
> 
> Changes in v4:
> - remove needless checks for input parameters
> - use memcpy() instead of manual copy loop
> - update SPD SPI enum to include HD-DVD and PMP as per CEA-861-E
> - add audio coding type extension support
> - match audio coding type names to those in CEA-861-E
> 
>  drivers/video/Kconfig  |   3 +
>  drivers/video/Makefile |   1 +
>  drivers/video/hdmi.c   | 308 
> +
>  include/linux/hdmi.h   | 231 +
>  4 files changed, 543 insertions(+)
>  create mode 100644 drivers/video/hdmi.c
>  create mode 100644 include/linux/hdmi.h
> 
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 09f1a18..b11eeab 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -52,6 +52,9 @@ config OF_VIDEOMODE
>   help
> helper to get videomodes from the devicetree
>  
> +config HDMI
> + bool
> +
>  menuconfig FB
>   tristate "Support for frame buffer devices"
>   ---help---
> diff --git a/drivers/video/Makefile b/drivers/video/Makefile
> index f592f3b..0b50082 100644
> --- a/drivers/video/Makefile
> +++ b/drivers/video/Makefile
> @@ -5,6 +5,7 @@
>  # Each configuration option enables a list of files.
>  
>  obj-$(CONFIG_VGASTATE)+= vgastate.o
> +obj-$(CONFIG_HDMI)+= hdmi.o
>  obj-y += fb_notify.o
>  obj-$(CONFIG_FB)  += fb.o
>  fb-y  := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
> diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> new file mode 100644
> index 000..ab23c9b
> --- /dev/null
> +++ b/drivers/video/hdmi.c
> @@ -0,0 +1,308 @@
> +/*
> + * Copyright (C) 2012 Avionic Design GmbH
> + *
> + * 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.
> + */

BTW was there any discussion about the license? drm is generally MIT.
Are people OK with depending on GPL code for infoframe support?

-- 
Ville Syrj?l?
Intel OTC


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-04 Thread Thierry Reding
On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrj?l? wrote:
> On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
[...]
> > diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
> > new file mode 100644
> > index 000..ab23c9b
> > --- /dev/null
> > +++ b/drivers/video/hdmi.c
> > @@ -0,0 +1,308 @@
> > +/*
> > + * Copyright (C) 2012 Avionic Design GmbH
> > + *
> > + * 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.
> > + */
> 
> BTW was there any discussion about the license? drm is generally MIT.
> Are people OK with depending on GPL code for infoframe support?

I wasn't aware of that. I don't know how much of an issue it is really
since all symbols are exported non-GPL.

Thierry
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: 



Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-04 Thread Ville Syrjälä
On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
 Add generic helpers to pack HDMI infoframes into binary buffers.
 
 Signed-off-by: Thierry Reding thierry.red...@avionic-design.de
 ---
 Changes in v2:
 - add support for audio, vendor-specific and SPD infoframes
 - add various validity checks on infoframes
 - factor out checksum computation
 
 Changes in v3:
 - introduce HDMI_INFOFRAME_HEADER_SIZE
 - fix SPD infoframe SDI field offset
 
 Changes in v4:
 - remove needless checks for input parameters
 - use memcpy() instead of manual copy loop
 - update SPD SPI enum to include HD-DVD and PMP as per CEA-861-E
 - add audio coding type extension support
 - match audio coding type names to those in CEA-861-E
 
  drivers/video/Kconfig  |   3 +
  drivers/video/Makefile |   1 +
  drivers/video/hdmi.c   | 308 
 +
  include/linux/hdmi.h   | 231 +
  4 files changed, 543 insertions(+)
  create mode 100644 drivers/video/hdmi.c
  create mode 100644 include/linux/hdmi.h
 
 diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
 index 09f1a18..b11eeab 100644
 --- a/drivers/video/Kconfig
 +++ b/drivers/video/Kconfig
 @@ -52,6 +52,9 @@ config OF_VIDEOMODE
   help
 helper to get videomodes from the devicetree
  
 +config HDMI
 + bool
 +
  menuconfig FB
   tristate Support for frame buffer devices
   ---help---
 diff --git a/drivers/video/Makefile b/drivers/video/Makefile
 index f592f3b..0b50082 100644
 --- a/drivers/video/Makefile
 +++ b/drivers/video/Makefile
 @@ -5,6 +5,7 @@
  # Each configuration option enables a list of files.
  
  obj-$(CONFIG_VGASTATE)+= vgastate.o
 +obj-$(CONFIG_HDMI)+= hdmi.o
  obj-y += fb_notify.o
  obj-$(CONFIG_FB)  += fb.o
  fb-y  := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
 diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
 new file mode 100644
 index 000..ab23c9b
 --- /dev/null
 +++ b/drivers/video/hdmi.c
 @@ -0,0 +1,308 @@
 +/*
 + * Copyright (C) 2012 Avionic Design GmbH
 + *
 + * 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.
 + */

BTW was there any discussion about the license? drm is generally MIT.
Are people OK with depending on GPL code for infoframe support?

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-03-04 Thread Thierry Reding
On Mon, Mar 04, 2013 at 04:49:46PM +0200, Ville Syrjälä wrote:
 On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
[...]
  diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
  new file mode 100644
  index 000..ab23c9b
  --- /dev/null
  +++ b/drivers/video/hdmi.c
  @@ -0,0 +1,308 @@
  +/*
  + * Copyright (C) 2012 Avionic Design GmbH
  + *
  + * 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.
  + */
 
 BTW was there any discussion about the license? drm is generally MIT.
 Are people OK with depending on GPL code for infoframe support?

I wasn't aware of that. I don't know how much of an issue it is really
since all symbols are exported non-GPL.

Thierry


pgpGPAGsnjlc5.pgp
Description: PGP signature
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-02-22 Thread Ville Syrjälä
On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:

> +enum hdmi_audio_coding_type {
> + HDMI_AUDIO_CODING_TYPE_STREAM,
> + HDMI_AUDIO_CODING_TYPE_PCM,
> + HDMI_AUDIO_CODING_TYPE_AC3,
> + HDMI_AUDIO_CODING_TYPE_MPEG1,
> + HDMI_AUDIO_CODING_TYPE_MP3,
> + HDMI_AUDIO_CODING_TYPE_MPEG2,
> + HDMI_AUDIO_CODING_TYPE_AAC_LC,
> + HDMI_AUDIO_CODING_TYPE_DTS,
> + HDMI_AUDIO_CODING_TYPE_ATRAC,
> + HDMI_AUDIO_CODING_TYPE_DSD,
> + HDMI_AUDIO_CODING_TYPE_EAC3,
> + HDMI_AUDIO_CODING_TYPE_DTS_HD,
> + HDMI_AUDIO_CODING_TYPE_MLP,
> + HDMI_AUDIO_CODING_TYPE_DST,
> + HDMI_AUDIO_CODING_TYPE_WMA_PRO,

+ HDMI_AUDIO_CODING_TYPE_EXT or something like it?

> +};
> +
> +enum hdmi_audio_sample_size {
> + HDMI_AUDIO_SAMPLE_SIZE_STREAM,
> + HDMI_AUDIO_SAMPLE_SIZE_16,
> + HDMI_AUDIO_SAMPLE_SIZE_20,
> + HDMI_AUDIO_SAMPLE_SIZE_24,
> +};
> +
> +enum hdmi_audio_sample_frequency {
> + HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_32000,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_44100,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_48000,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_88200,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_96000,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_176400,
> + HDMI_AUDIO_SAMPLE_FREQUENCY_192000,
> +};
> +
> +enum hdmi_audio_coding_type_ext {
> + HDMI_AUDIO_CODING_TYPE_EXT_STREAM,

The spec is a bit confusing w.r.t. this value, but I think this is
correct. Any other value is illegal when CT!=15, and when CT==15,
CXT=0 means that look at CT (infinite loop anyone?), or stream header.
Since the infinite loop option doesn't make sense, looking at the
stream header is the only option. Although I think it would be
generally safer to avoid that specific combination. I'm sure some
"clever" guy would actually implement the infinite loop instead.

> + HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
> + HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
> + HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND,
> +};
> +

-- 
Ville Syrj?l?
Intel OTC


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-02-22 Thread Thierry Reding
Add generic helpers to pack HDMI infoframes into binary buffers.

Signed-off-by: Thierry Reding 
---
Changes in v2:
- add support for audio, vendor-specific and SPD infoframes
- add various validity checks on infoframes
- factor out checksum computation

Changes in v3:
- introduce HDMI_INFOFRAME_HEADER_SIZE
- fix SPD infoframe SDI field offset

Changes in v4:
- remove needless checks for input parameters
- use memcpy() instead of manual copy loop
- update SPD SPI enum to include HD-DVD and PMP as per CEA-861-E
- add audio coding type extension support
- match audio coding type names to those in CEA-861-E

 drivers/video/Kconfig  |   3 +
 drivers/video/Makefile |   1 +
 drivers/video/hdmi.c   | 308 +
 include/linux/hdmi.h   | 231 +
 4 files changed, 543 insertions(+)
 create mode 100644 drivers/video/hdmi.c
 create mode 100644 include/linux/hdmi.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 09f1a18..b11eeab 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -52,6 +52,9 @@ config OF_VIDEOMODE
help
  helper to get videomodes from the devicetree

+config HDMI
+   bool
+
 menuconfig FB
tristate "Support for frame buffer devices"
---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index f592f3b..0b50082 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -5,6 +5,7 @@
 # Each configuration option enables a list of files.

 obj-$(CONFIG_VGASTATE)+= vgastate.o
+obj-$(CONFIG_HDMI)+= hdmi.o
 obj-y += fb_notify.o
 obj-$(CONFIG_FB)  += fb.o
 fb-y  := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
new file mode 100644
index 000..ab23c9b
--- /dev/null
+++ b/drivers/video/hdmi.c
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2012 Avionic Design GmbH
+ *
+ * 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 
+#include 
+#include 
+
+static void hdmi_infoframe_checksum(void *buffer, size_t size)
+{
+   u8 *ptr = buffer;
+   u8 csum = 0;
+   size_t i;
+
+   /* compute checksum */
+   for (i = 0; i < size; i++)
+   csum += ptr[i];
+
+   ptr[3] = 256 - csum;
+}
+
+/**
+ * hdmi_avi_infoframe_init() - initialize an HDMI AVI infoframe
+ * @frame: HDMI AVI infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame)
+{
+   memset(frame, 0, sizeof(*frame));
+
+   frame->type = HDMI_INFOFRAME_TYPE_AVI;
+   frame->version = 2;
+   frame->length = 13;
+
+   return 0;
+}
+EXPORT_SYMBOL(hdmi_avi_infoframe_init);
+
+/**
+ * hdmi_avi_infoframe_pack() - write HDMI AVI infoframe to binary buffer
+ * @frame: HDMI AVI infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a binary
+ * representation that can be written into the corresponding controller
+ * registers. Also computes the checksum as required by section 5.3.5 of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
+   size_t size)
+{
+   u8 *ptr = buffer;
+   size_t length;
+
+   length = HDMI_INFOFRAME_HEADER_SIZE + frame->length;
+
+   if (size < length)
+   return -ENOSPC;
+
+   memset(buffer, 0, length);
+
+   ptr[0] = frame->type;
+   ptr[1] = frame->version;
+   ptr[2] = frame->length;
+   ptr[3] = 0; /* checksum */
+
+   /* start infoframe payload */
+   ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+   ptr[0] = ((frame->colorspace & 0x3) << 5) | (frame->scan_mode & 0x3);
+
+   if (frame->active_info_valid)
+   ptr[0] |= BIT(4);
+
+   if (frame->horizontal_bar_valid)
+   ptr[0] |= BIT(3);
+
+   if (frame->vertical_bar_valid)
+   ptr[0] |= BIT(2);
+
+   ptr[1] = ((frame->colorimetry & 0x3) << 6) |
+((frame->picture_aspect & 0x3) << 4) |
+(frame->active_aspect & 0xf);
+
+   ptr[2] = ((frame->extended_colorimetry & 0x7) << 4) |
+((frame->quantization_range & 0x3) << 2) |
+(frame->nups & 0x3);
+
+   if (frame->itc)
+   ptr[2] |= BIT(7);
+
+   ptr[3] = frame->video_code & 0x7f;
+
+   ptr[4] = ((frame->ycc_quantization_range & 0x3) << 6) |
+((frame->content_type & 0x3) << 4) |
+(frame->pixel_repeat & 0xf);
+
+   ptr[5] = frame->top_bar 

Re: [PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-02-22 Thread Ville Syrjälä
On Fri, Feb 22, 2013 at 08:03:26AM +0100, Thierry Reding wrote:
snip
 +enum hdmi_audio_coding_type {
 + HDMI_AUDIO_CODING_TYPE_STREAM,
 + HDMI_AUDIO_CODING_TYPE_PCM,
 + HDMI_AUDIO_CODING_TYPE_AC3,
 + HDMI_AUDIO_CODING_TYPE_MPEG1,
 + HDMI_AUDIO_CODING_TYPE_MP3,
 + HDMI_AUDIO_CODING_TYPE_MPEG2,
 + HDMI_AUDIO_CODING_TYPE_AAC_LC,
 + HDMI_AUDIO_CODING_TYPE_DTS,
 + HDMI_AUDIO_CODING_TYPE_ATRAC,
 + HDMI_AUDIO_CODING_TYPE_DSD,
 + HDMI_AUDIO_CODING_TYPE_EAC3,
 + HDMI_AUDIO_CODING_TYPE_DTS_HD,
 + HDMI_AUDIO_CODING_TYPE_MLP,
 + HDMI_AUDIO_CODING_TYPE_DST,
 + HDMI_AUDIO_CODING_TYPE_WMA_PRO,

+ HDMI_AUDIO_CODING_TYPE_EXT or something like it?

 +};
 +
 +enum hdmi_audio_sample_size {
 + HDMI_AUDIO_SAMPLE_SIZE_STREAM,
 + HDMI_AUDIO_SAMPLE_SIZE_16,
 + HDMI_AUDIO_SAMPLE_SIZE_20,
 + HDMI_AUDIO_SAMPLE_SIZE_24,
 +};
 +
 +enum hdmi_audio_sample_frequency {
 + HDMI_AUDIO_SAMPLE_FREQUENCY_STREAM,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_32000,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_44100,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_48000,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_88200,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_96000,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_176400,
 + HDMI_AUDIO_SAMPLE_FREQUENCY_192000,
 +};
 +
 +enum hdmi_audio_coding_type_ext {
 + HDMI_AUDIO_CODING_TYPE_EXT_STREAM,

The spec is a bit confusing w.r.t. this value, but I think this is
correct. Any other value is illegal when CT!=15, and when CT==15,
CXT=0 means that look at CT (infinite loop anyone?), or stream header.
Since the infinite loop option doesn't make sense, looking at the
stream header is the only option. Although I think it would be
generally safer to avoid that specific combination. I'm sure some
clever guy would actually implement the infinite loop instead.

 + HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC,
 + HDMI_AUDIO_CODING_TYPE_EXT_HE_AAC_V2,
 + HDMI_AUDIO_CODING_TYPE_EXT_MPEG_SURROUND,
 +};
 +

-- 
Ville Syrjälä
Intel OTC
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v5 4/9] video: Add generic HDMI infoframe helpers

2013-02-21 Thread Thierry Reding
Add generic helpers to pack HDMI infoframes into binary buffers.

Signed-off-by: Thierry Reding thierry.red...@avionic-design.de
---
Changes in v2:
- add support for audio, vendor-specific and SPD infoframes
- add various validity checks on infoframes
- factor out checksum computation

Changes in v3:
- introduce HDMI_INFOFRAME_HEADER_SIZE
- fix SPD infoframe SDI field offset

Changes in v4:
- remove needless checks for input parameters
- use memcpy() instead of manual copy loop
- update SPD SPI enum to include HD-DVD and PMP as per CEA-861-E
- add audio coding type extension support
- match audio coding type names to those in CEA-861-E

 drivers/video/Kconfig  |   3 +
 drivers/video/Makefile |   1 +
 drivers/video/hdmi.c   | 308 +
 include/linux/hdmi.h   | 231 +
 4 files changed, 543 insertions(+)
 create mode 100644 drivers/video/hdmi.c
 create mode 100644 include/linux/hdmi.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 09f1a18..b11eeab 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -52,6 +52,9 @@ config OF_VIDEOMODE
help
  helper to get videomodes from the devicetree
 
+config HDMI
+   bool
+
 menuconfig FB
tristate Support for frame buffer devices
---help---
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index f592f3b..0b50082 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -5,6 +5,7 @@
 # Each configuration option enables a list of files.
 
 obj-$(CONFIG_VGASTATE)+= vgastate.o
+obj-$(CONFIG_HDMI)+= hdmi.o
 obj-y += fb_notify.o
 obj-$(CONFIG_FB)  += fb.o
 fb-y  := fbmem.o fbmon.o fbcmap.o fbsysfs.o \
diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
new file mode 100644
index 000..ab23c9b
--- /dev/null
+++ b/drivers/video/hdmi.c
@@ -0,0 +1,308 @@
+/*
+ * Copyright (C) 2012 Avionic Design GmbH
+ *
+ * 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 linux/bitops.h
+#include linux/errno.h
+#include linux/export.h
+#include linux/hdmi.h
+#include linux/string.h
+
+static void hdmi_infoframe_checksum(void *buffer, size_t size)
+{
+   u8 *ptr = buffer;
+   u8 csum = 0;
+   size_t i;
+
+   /* compute checksum */
+   for (i = 0; i  size; i++)
+   csum += ptr[i];
+
+   ptr[3] = 256 - csum;
+}
+
+/**
+ * hdmi_avi_infoframe_init() - initialize an HDMI AVI infoframe
+ * @frame: HDMI AVI infoframe
+ *
+ * Returns 0 on success or a negative error code on failure.
+ */
+int hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame)
+{
+   memset(frame, 0, sizeof(*frame));
+
+   frame-type = HDMI_INFOFRAME_TYPE_AVI;
+   frame-version = 2;
+   frame-length = 13;
+
+   return 0;
+}
+EXPORT_SYMBOL(hdmi_avi_infoframe_init);
+
+/**
+ * hdmi_avi_infoframe_pack() - write HDMI AVI infoframe to binary buffer
+ * @frame: HDMI AVI infoframe
+ * @buffer: destination buffer
+ * @size: size of buffer
+ *
+ * Packs the information contained in the @frame structure into a binary
+ * representation that can be written into the corresponding controller
+ * registers. Also computes the checksum as required by section 5.3.5 of
+ * the HDMI 1.4 specification.
+ *
+ * Returns the number of bytes packed into the binary buffer or a negative
+ * error code on failure.
+ */
+ssize_t hdmi_avi_infoframe_pack(struct hdmi_avi_infoframe *frame, void *buffer,
+   size_t size)
+{
+   u8 *ptr = buffer;
+   size_t length;
+
+   length = HDMI_INFOFRAME_HEADER_SIZE + frame-length;
+
+   if (size  length)
+   return -ENOSPC;
+
+   memset(buffer, 0, length);
+
+   ptr[0] = frame-type;
+   ptr[1] = frame-version;
+   ptr[2] = frame-length;
+   ptr[3] = 0; /* checksum */
+
+   /* start infoframe payload */
+   ptr += HDMI_INFOFRAME_HEADER_SIZE;
+
+   ptr[0] = ((frame-colorspace  0x3)  5) | (frame-scan_mode  0x3);
+
+   if (frame-active_info_valid)
+   ptr[0] |= BIT(4);
+
+   if (frame-horizontal_bar_valid)
+   ptr[0] |= BIT(3);
+
+   if (frame-vertical_bar_valid)
+   ptr[0] |= BIT(2);
+
+   ptr[1] = ((frame-colorimetry  0x3)  6) |
+((frame-picture_aspect  0x3)  4) |
+(frame-active_aspect  0xf);
+
+   ptr[2] = ((frame-extended_colorimetry  0x7)  4) |
+((frame-quantization_range  0x3)  2) |
+(frame-nups  0x3);
+
+   if (frame-itc)
+   ptr[2] |= BIT(7);
+
+   ptr[3] = frame-video_code  0x7f;
+
+   ptr[4] = ((frame-ycc_quantization_range  0x3)  6) |
+((frame-content_type  0x3)  4) |
+