Re: [PATCH 2/2] rainshadow-cec: new RainShadow Tech HDMI CEC driver

2017-04-05 Thread Hans Verkuil
On 04/05/2017 02:26 AM, Dmitry Torokhov wrote:
> Hi Hans,
> 
> On Fri, Feb 03, 2017 at 03:46:01PM +0100, Hans Verkuil wrote:
>> Hi Dmitry,
>>
>> Thanks for the feedback. See my comments below:
>>
>> On 03/01/17 07:51, Dmitry Torokhov wrote:
>>> Hi Hans,
>>>
>>> On Thu, Dec 15, 2016 at 02:02:07PM +0100, Hans Verkuil wrote:
 From: Hans Verkuil 

 This driver supports the RainShadow Tech USB HDMI CEC adapter.

 See: http://rainshadowtech.com/HdmiCecUsb.html

 Signed-off-by: Hans Verkuil 
 ---
 MAINTAINERS   |   7 +
 drivers/media/usb/Kconfig |   1 +
 drivers/media/usb/Makefile|   1 +
 drivers/media/usb/rainshadow-cec/Kconfig  |  10 +
 drivers/media/usb/rainshadow-cec/Makefile |   1 +
 drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 344 
 ++
 6 files changed, 364 insertions(+)
 create mode 100644 drivers/media/usb/rainshadow-cec/Kconfig
 create mode 100644 drivers/media/usb/rainshadow-cec/Makefile
 create mode 100644 drivers/media/usb/rainshadow-cec/rainshadow-cec.c

 diff --git a/MAINTAINERS b/MAINTAINERS
 index 52cc077..78ebc5d 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -10069,6 +10069,13 @@ L:linux-fb...@vger.kernel.org
 S: Maintained
 F: drivers/video/fbdev/aty/aty128fb.c

 +RAINSHADOW-CEC DRIVER
 +M:Hans Verkuil 
 +L:linux-media@vger.kernel.org
 +T:git git://linuxtv.org/media_tree.git
 +S:Maintained
 +F:drivers/media/usb/rainshadow-cec/*
 +
 RALINK MIPS ARCHITECTURE
 M: John Crispin 
 L: linux-m...@linux-mips.org
 diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
 index c9644b6..b24e753 100644
 --- a/drivers/media/usb/Kconfig
 +++ b/drivers/media/usb/Kconfig
 @@ -63,6 +63,7 @@ endif
 if MEDIA_CEC_SUPPORT
comment "USB HDMI CEC adapters"
 source "drivers/media/usb/pulse8-cec/Kconfig"
 +source "drivers/media/usb/rainshadow-cec/Kconfig"
 endif

 endif #MEDIA_USB_SUPPORT
 diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
 index 0f15e33..738b993 100644
 --- a/drivers/media/usb/Makefile
 +++ b/drivers/media/usb/Makefile
 @@ -25,3 +25,4 @@ obj-$(CONFIG_VIDEO_USBTV) += usbtv/
 obj-$(CONFIG_VIDEO_GO7007) += go7007/
 obj-$(CONFIG_DVB_AS102) += as102/
 obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/
 +obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/
 diff --git a/drivers/media/usb/rainshadow-cec/Kconfig 
 b/drivers/media/usb/rainshadow-cec/Kconfig
 new file mode 100644
 index 000..447291b
 --- /dev/null
 +++ b/drivers/media/usb/rainshadow-cec/Kconfig
 @@ -0,0 +1,10 @@
 +config USB_RAINSHADOW_CEC
 +  tristate "RainShadow Tech HDMI CEC"
 +  depends on USB_ACM && MEDIA_CEC_SUPPORT
 +  select SERIO
 +  select SERIO_SERPORT
 +  ---help---
 +This is a cec driver for the RainShadow Tech HDMI CEC device.
 +
 +To compile this driver as a module, choose M here: the
 +module will be called rainshadow-cec.
 diff --git a/drivers/media/usb/rainshadow-cec/Makefile 
 b/drivers/media/usb/rainshadow-cec/Makefile
 new file mode 100644
 index 000..a79fbc7
 --- /dev/null
 +++ b/drivers/media/usb/rainshadow-cec/Makefile
 @@ -0,0 +1 @@
 +obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o
 diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c 
 b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
 new file mode 100644
 index 000..dc7f287
 --- /dev/null
 +++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
 @@ -0,0 +1,344 @@
 +/*
 + * RainShadow Tech HDMI CEC driver
 + *
 + * Copyright 2016 Hans Verkuil 

Re: [PATCH 2/2] rainshadow-cec: new RainShadow Tech HDMI CEC driver

2017-04-04 Thread Dmitry Torokhov
Hi Hans,

On Fri, Feb 03, 2017 at 03:46:01PM +0100, Hans Verkuil wrote:
> Hi Dmitry,
> 
> Thanks for the feedback. See my comments below:
> 
> On 03/01/17 07:51, Dmitry Torokhov wrote:
> >Hi Hans,
> >
> >On Thu, Dec 15, 2016 at 02:02:07PM +0100, Hans Verkuil wrote:
> >>From: Hans Verkuil 
> >>
> >>This driver supports the RainShadow Tech USB HDMI CEC adapter.
> >>
> >>See: http://rainshadowtech.com/HdmiCecUsb.html
> >>
> >>Signed-off-by: Hans Verkuil 
> >>---
> >> MAINTAINERS   |   7 +
> >> drivers/media/usb/Kconfig |   1 +
> >> drivers/media/usb/Makefile|   1 +
> >> drivers/media/usb/rainshadow-cec/Kconfig  |  10 +
> >> drivers/media/usb/rainshadow-cec/Makefile |   1 +
> >> drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 344 
> >> ++
> >> 6 files changed, 364 insertions(+)
> >> create mode 100644 drivers/media/usb/rainshadow-cec/Kconfig
> >> create mode 100644 drivers/media/usb/rainshadow-cec/Makefile
> >> create mode 100644 drivers/media/usb/rainshadow-cec/rainshadow-cec.c
> >>
> >>diff --git a/MAINTAINERS b/MAINTAINERS
> >>index 52cc077..78ebc5d 100644
> >>--- a/MAINTAINERS
> >>+++ b/MAINTAINERS
> >>@@ -10069,6 +10069,13 @@ L: linux-fb...@vger.kernel.org
> >> S: Maintained
> >> F: drivers/video/fbdev/aty/aty128fb.c
> >>
> >>+RAINSHADOW-CEC DRIVER
> >>+M: Hans Verkuil 
> >>+L: linux-media@vger.kernel.org
> >>+T: git git://linuxtv.org/media_tree.git
> >>+S: Maintained
> >>+F: drivers/media/usb/rainshadow-cec/*
> >>+
> >> RALINK MIPS ARCHITECTURE
> >> M: John Crispin 
> >> L: linux-m...@linux-mips.org
> >>diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
> >>index c9644b6..b24e753 100644
> >>--- a/drivers/media/usb/Kconfig
> >>+++ b/drivers/media/usb/Kconfig
> >>@@ -63,6 +63,7 @@ endif
> >> if MEDIA_CEC_SUPPORT
> >>comment "USB HDMI CEC adapters"
> >> source "drivers/media/usb/pulse8-cec/Kconfig"
> >>+source "drivers/media/usb/rainshadow-cec/Kconfig"
> >> endif
> >>
> >> endif #MEDIA_USB_SUPPORT
> >>diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
> >>index 0f15e33..738b993 100644
> >>--- a/drivers/media/usb/Makefile
> >>+++ b/drivers/media/usb/Makefile
> >>@@ -25,3 +25,4 @@ obj-$(CONFIG_VIDEO_USBTV) += usbtv/
> >> obj-$(CONFIG_VIDEO_GO7007) += go7007/
> >> obj-$(CONFIG_DVB_AS102) += as102/
> >> obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/
> >>+obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/
> >>diff --git a/drivers/media/usb/rainshadow-cec/Kconfig 
> >>b/drivers/media/usb/rainshadow-cec/Kconfig
> >>new file mode 100644
> >>index 000..447291b
> >>--- /dev/null
> >>+++ b/drivers/media/usb/rainshadow-cec/Kconfig
> >>@@ -0,0 +1,10 @@
> >>+config USB_RAINSHADOW_CEC
> >>+   tristate "RainShadow Tech HDMI CEC"
> >>+   depends on USB_ACM && MEDIA_CEC_SUPPORT
> >>+   select SERIO
> >>+   select SERIO_SERPORT
> >>+   ---help---
> >>+ This is a cec driver for the RainShadow Tech HDMI CEC device.
> >>+
> >>+ To compile this driver as a module, choose M here: the
> >>+ module will be called rainshadow-cec.
> >>diff --git a/drivers/media/usb/rainshadow-cec/Makefile 
> >>b/drivers/media/usb/rainshadow-cec/Makefile
> >>new file mode 100644
> >>index 000..a79fbc7
> >>--- /dev/null
> >>+++ b/drivers/media/usb/rainshadow-cec/Makefile
> >>@@ -0,0 +1 @@
> >>+obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o
> >>diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c 
> >>b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
> >>new file mode 100644
> >>index 000..dc7f287
> >>--- /dev/null
> >>+++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
> >>@@ -0,0 +1,344 @@
> >>+/*
> >>+ * RainShadow Tech HDMI CEC driver
> >>+ *
> >>+ * Copyright 2016 Hans Verkuil  >>+ *
> >>+ * This program is free software; you can redistribute it and/or modify it
> >>+ * under the terms of the GNU General Public License as published by the
> >>+ * Free Software Foundation; either version of 2 of the License, or (at 
> >>your
> >>+ * option) any later version. See the file COPYING in the main directory of
> >>+ * this archive for more details.
> >>+ */
> >>+
> >>+/*
> >>+ * Notes:
> >>+ *
> >>+ * The higher level protocols are currently disabled. This can be added
> >>+ * later, similar to how this is done for the Pulse Eight CEC driver.
> >>+ *
> >>+ * Documentation of the protocol is available here:
> >>+ *
> >>+ * http://rainshadowtech.com/doc/HDMICECtoUSBandRS232v2.0.pdf
> >>+ */
> >>+
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+#include 
> >>+
> >>+#include 
> >>+
> >>+MODULE_AUTHOR("Hans Verkuil ");
> >>+MODULE_DESCRIPTION("RainShadow Tech HDMI CEC driver");
> >>+MODULE_LICENSE("GPL");
> >>+
> >>+static int 

Re: [PATCH 2/2] rainshadow-cec: new RainShadow Tech HDMI CEC driver

2017-02-03 Thread Hans Verkuil

Hi Dmitry,

Thanks for the feedback. See my comments below:

On 03/01/17 07:51, Dmitry Torokhov wrote:

Hi Hans,

On Thu, Dec 15, 2016 at 02:02:07PM +0100, Hans Verkuil wrote:

From: Hans Verkuil 

This driver supports the RainShadow Tech USB HDMI CEC adapter.

See: http://rainshadowtech.com/HdmiCecUsb.html

Signed-off-by: Hans Verkuil 
---
 MAINTAINERS   |   7 +
 drivers/media/usb/Kconfig |   1 +
 drivers/media/usb/Makefile|   1 +
 drivers/media/usb/rainshadow-cec/Kconfig  |  10 +
 drivers/media/usb/rainshadow-cec/Makefile |   1 +
 drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 344 ++
 6 files changed, 364 insertions(+)
 create mode 100644 drivers/media/usb/rainshadow-cec/Kconfig
 create mode 100644 drivers/media/usb/rainshadow-cec/Makefile
 create mode 100644 drivers/media/usb/rainshadow-cec/rainshadow-cec.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 52cc077..78ebc5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10069,6 +10069,13 @@ L: linux-fb...@vger.kernel.org
 S: Maintained
 F: drivers/video/fbdev/aty/aty128fb.c

+RAINSHADOW-CEC DRIVER
+M: Hans Verkuil 
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/usb/rainshadow-cec/*
+
 RALINK MIPS ARCHITECTURE
 M: John Crispin 
 L: linux-m...@linux-mips.org
diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
index c9644b6..b24e753 100644
--- a/drivers/media/usb/Kconfig
+++ b/drivers/media/usb/Kconfig
@@ -63,6 +63,7 @@ endif
 if MEDIA_CEC_SUPPORT
comment "USB HDMI CEC adapters"
 source "drivers/media/usb/pulse8-cec/Kconfig"
+source "drivers/media/usb/rainshadow-cec/Kconfig"
 endif

 endif #MEDIA_USB_SUPPORT
diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
index 0f15e33..738b993 100644
--- a/drivers/media/usb/Makefile
+++ b/drivers/media/usb/Makefile
@@ -25,3 +25,4 @@ obj-$(CONFIG_VIDEO_USBTV) += usbtv/
 obj-$(CONFIG_VIDEO_GO7007) += go7007/
 obj-$(CONFIG_DVB_AS102) += as102/
 obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/
+obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/
diff --git a/drivers/media/usb/rainshadow-cec/Kconfig 
b/drivers/media/usb/rainshadow-cec/Kconfig
new file mode 100644
index 000..447291b
--- /dev/null
+++ b/drivers/media/usb/rainshadow-cec/Kconfig
@@ -0,0 +1,10 @@
+config USB_RAINSHADOW_CEC
+   tristate "RainShadow Tech HDMI CEC"
+   depends on USB_ACM && MEDIA_CEC_SUPPORT
+   select SERIO
+   select SERIO_SERPORT
+   ---help---
+ This is a cec driver for the RainShadow Tech HDMI CEC device.
+
+ To compile this driver as a module, choose M here: the
+ module will be called rainshadow-cec.
diff --git a/drivers/media/usb/rainshadow-cec/Makefile 
b/drivers/media/usb/rainshadow-cec/Makefile
new file mode 100644
index 000..a79fbc7
--- /dev/null
+++ b/drivers/media/usb/rainshadow-cec/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o
diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c 
b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
new file mode 100644
index 000..dc7f287
--- /dev/null
+++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
@@ -0,0 +1,344 @@
+/*
+ * RainShadow Tech HDMI CEC driver
+ *
+ * Copyright 2016 Hans Verkuil ");
+MODULE_DESCRIPTION("RainShadow Tech HDMI CEC driver");
+MODULE_LICENSE("GPL");
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "debug level (0-1)");
+
+#define DATA_SIZE 256
+
+struct rain {
+   struct device *dev;
+   struct serio *serio;
+   struct cec_adapter *adap;
+   struct completion cmd_done;
+   struct work_struct work;
+   struct cec_msg rx_msg;
+   char data[DATA_SIZE];
+   char buf[DATA_SIZE];
+   unsigned int idx;
+   bool started;
+   struct mutex write_lock;
+};
+
+static void rain_irq_work_handler(struct work_struct *work)
+{
+   struct rain 

Re: [PATCH 2/2] rainshadow-cec: new RainShadow Tech HDMI CEC driver

2017-01-02 Thread Dmitry Torokhov
Hi Hans,

On Thu, Dec 15, 2016 at 02:02:07PM +0100, Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> This driver supports the RainShadow Tech USB HDMI CEC adapter.
> 
> See: http://rainshadowtech.com/HdmiCecUsb.html
> 
> Signed-off-by: Hans Verkuil 
> ---
>  MAINTAINERS   |   7 +
>  drivers/media/usb/Kconfig |   1 +
>  drivers/media/usb/Makefile|   1 +
>  drivers/media/usb/rainshadow-cec/Kconfig  |  10 +
>  drivers/media/usb/rainshadow-cec/Makefile |   1 +
>  drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 344 
> ++
>  6 files changed, 364 insertions(+)
>  create mode 100644 drivers/media/usb/rainshadow-cec/Kconfig
>  create mode 100644 drivers/media/usb/rainshadow-cec/Makefile
>  create mode 100644 drivers/media/usb/rainshadow-cec/rainshadow-cec.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 52cc077..78ebc5d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10069,6 +10069,13 @@ L:   linux-fb...@vger.kernel.org
>  S:   Maintained
>  F:   drivers/video/fbdev/aty/aty128fb.c
>  
> +RAINSHADOW-CEC DRIVER
> +M:   Hans Verkuil 
> +L:   linux-media@vger.kernel.org
> +T:   git git://linuxtv.org/media_tree.git
> +S:   Maintained
> +F:   drivers/media/usb/rainshadow-cec/*
> +
>  RALINK MIPS ARCHITECTURE
>  M:   John Crispin 
>  L:   linux-m...@linux-mips.org
> diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
> index c9644b6..b24e753 100644
> --- a/drivers/media/usb/Kconfig
> +++ b/drivers/media/usb/Kconfig
> @@ -63,6 +63,7 @@ endif
>  if MEDIA_CEC_SUPPORT
>   comment "USB HDMI CEC adapters"
>  source "drivers/media/usb/pulse8-cec/Kconfig"
> +source "drivers/media/usb/rainshadow-cec/Kconfig"
>  endif
>  
>  endif #MEDIA_USB_SUPPORT
> diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
> index 0f15e33..738b993 100644
> --- a/drivers/media/usb/Makefile
> +++ b/drivers/media/usb/Makefile
> @@ -25,3 +25,4 @@ obj-$(CONFIG_VIDEO_USBTV) += usbtv/
>  obj-$(CONFIG_VIDEO_GO7007) += go7007/
>  obj-$(CONFIG_DVB_AS102) += as102/
>  obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/
> +obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/
> diff --git a/drivers/media/usb/rainshadow-cec/Kconfig 
> b/drivers/media/usb/rainshadow-cec/Kconfig
> new file mode 100644
> index 000..447291b
> --- /dev/null
> +++ b/drivers/media/usb/rainshadow-cec/Kconfig
> @@ -0,0 +1,10 @@
> +config USB_RAINSHADOW_CEC
> + tristate "RainShadow Tech HDMI CEC"
> + depends on USB_ACM && MEDIA_CEC_SUPPORT
> + select SERIO
> + select SERIO_SERPORT
> + ---help---
> +   This is a cec driver for the RainShadow Tech HDMI CEC device.
> +
> +   To compile this driver as a module, choose M here: the
> +   module will be called rainshadow-cec.
> diff --git a/drivers/media/usb/rainshadow-cec/Makefile 
> b/drivers/media/usb/rainshadow-cec/Makefile
> new file mode 100644
> index 000..a79fbc7
> --- /dev/null
> +++ b/drivers/media/usb/rainshadow-cec/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o
> diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c 
> b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
> new file mode 100644
> index 000..dc7f287
> --- /dev/null
> +++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
> @@ -0,0 +1,344 @@
> +/*
> + * RainShadow Tech HDMI CEC driver
> + *
> + * Copyright 2016 Hans Verkuil  + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version of 2 of the License, or (at your
> + * option) any later version. See the file COPYING in the main directory of
> + * this archive for more details.
> + */
> +
> +/*
> + * Notes:
> + *
> + * The higher level protocols are currently disabled. This can be added
> + * later, similar to how this is done for the Pulse Eight CEC driver.
> + *
> + * Documentation of the protocol is available here:
> + *
> + * http://rainshadowtech.com/doc/HDMICECtoUSBandRS232v2.0.pdf
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +MODULE_AUTHOR("Hans Verkuil ");
> +MODULE_DESCRIPTION("RainShadow Tech HDMI CEC driver");
> +MODULE_LICENSE("GPL");
> +
> +static int debug;
> +module_param(debug, int, 0644);
> +MODULE_PARM_DESC(debug, "debug level (0-1)");
> +
> +#define DATA_SIZE 256
> +
> +struct rain {
> + struct device *dev;
> + struct serio *serio;
> + struct cec_adapter *adap;
> + struct completion cmd_done;
> + struct work_struct work;
> + struct cec_msg rx_msg;
> + char data[DATA_SIZE];
> + char buf[DATA_SIZE];
> + unsigned int idx;
> + 

[PATCH 2/2] rainshadow-cec: new RainShadow Tech HDMI CEC driver

2016-12-15 Thread Hans Verkuil
From: Hans Verkuil 

This driver supports the RainShadow Tech USB HDMI CEC adapter.

See: http://rainshadowtech.com/HdmiCecUsb.html

Signed-off-by: Hans Verkuil 
---
 MAINTAINERS   |   7 +
 drivers/media/usb/Kconfig |   1 +
 drivers/media/usb/Makefile|   1 +
 drivers/media/usb/rainshadow-cec/Kconfig  |  10 +
 drivers/media/usb/rainshadow-cec/Makefile |   1 +
 drivers/media/usb/rainshadow-cec/rainshadow-cec.c | 344 ++
 6 files changed, 364 insertions(+)
 create mode 100644 drivers/media/usb/rainshadow-cec/Kconfig
 create mode 100644 drivers/media/usb/rainshadow-cec/Makefile
 create mode 100644 drivers/media/usb/rainshadow-cec/rainshadow-cec.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 52cc077..78ebc5d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10069,6 +10069,13 @@ L: linux-fb...@vger.kernel.org
 S: Maintained
 F: drivers/video/fbdev/aty/aty128fb.c
 
+RAINSHADOW-CEC DRIVER
+M: Hans Verkuil 
+L: linux-media@vger.kernel.org
+T: git git://linuxtv.org/media_tree.git
+S: Maintained
+F: drivers/media/usb/rainshadow-cec/*
+
 RALINK MIPS ARCHITECTURE
 M: John Crispin 
 L: linux-m...@linux-mips.org
diff --git a/drivers/media/usb/Kconfig b/drivers/media/usb/Kconfig
index c9644b6..b24e753 100644
--- a/drivers/media/usb/Kconfig
+++ b/drivers/media/usb/Kconfig
@@ -63,6 +63,7 @@ endif
 if MEDIA_CEC_SUPPORT
comment "USB HDMI CEC adapters"
 source "drivers/media/usb/pulse8-cec/Kconfig"
+source "drivers/media/usb/rainshadow-cec/Kconfig"
 endif
 
 endif #MEDIA_USB_SUPPORT
diff --git a/drivers/media/usb/Makefile b/drivers/media/usb/Makefile
index 0f15e33..738b993 100644
--- a/drivers/media/usb/Makefile
+++ b/drivers/media/usb/Makefile
@@ -25,3 +25,4 @@ obj-$(CONFIG_VIDEO_USBTV) += usbtv/
 obj-$(CONFIG_VIDEO_GO7007) += go7007/
 obj-$(CONFIG_DVB_AS102) += as102/
 obj-$(CONFIG_USB_PULSE8_CEC) += pulse8-cec/
+obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec/
diff --git a/drivers/media/usb/rainshadow-cec/Kconfig 
b/drivers/media/usb/rainshadow-cec/Kconfig
new file mode 100644
index 000..447291b
--- /dev/null
+++ b/drivers/media/usb/rainshadow-cec/Kconfig
@@ -0,0 +1,10 @@
+config USB_RAINSHADOW_CEC
+   tristate "RainShadow Tech HDMI CEC"
+   depends on USB_ACM && MEDIA_CEC_SUPPORT
+   select SERIO
+   select SERIO_SERPORT
+   ---help---
+ This is a cec driver for the RainShadow Tech HDMI CEC device.
+
+ To compile this driver as a module, choose M here: the
+ module will be called rainshadow-cec.
diff --git a/drivers/media/usb/rainshadow-cec/Makefile 
b/drivers/media/usb/rainshadow-cec/Makefile
new file mode 100644
index 000..a79fbc7
--- /dev/null
+++ b/drivers/media/usb/rainshadow-cec/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_USB_RAINSHADOW_CEC) += rainshadow-cec.o
diff --git a/drivers/media/usb/rainshadow-cec/rainshadow-cec.c 
b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
new file mode 100644
index 000..dc7f287
--- /dev/null
+++ b/drivers/media/usb/rainshadow-cec/rainshadow-cec.c
@@ -0,0 +1,344 @@
+/*
+ * RainShadow Tech HDMI CEC driver
+ *
+ * Copyright 2016 Hans Verkuil ");
+MODULE_DESCRIPTION("RainShadow Tech HDMI CEC driver");
+MODULE_LICENSE("GPL");
+
+static int debug;
+module_param(debug, int, 0644);
+MODULE_PARM_DESC(debug, "debug level (0-1)");
+
+#define DATA_SIZE 256
+
+struct rain {
+   struct device *dev;
+   struct serio *serio;
+   struct cec_adapter *adap;
+   struct completion cmd_done;
+   struct work_struct work;
+   struct cec_msg rx_msg;
+   char data[DATA_SIZE];
+   char buf[DATA_SIZE];
+   unsigned int idx;
+   bool started;
+   struct mutex write_lock;
+};
+
+static void rain_irq_work_handler(struct work_struct *work)
+{
+   struct rain *rain =
+   container_of(work, struct rain, work);
+   struct cec_msg *msg = >rx_msg;
+   const char *data = rain->data + 3;
+   int stat = -1;
+
+