From patchwork Wed Aug 2 08:42:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 9876269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08B8A6037D for ; Wed, 2 Aug 2017 08:42:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBC4128553 for ; Wed, 2 Aug 2017 08:42:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0AF9286A3; Wed, 2 Aug 2017 08:42:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6FD4328753 for ; Wed, 2 Aug 2017 08:42:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6AE86E218; Wed, 2 Aug 2017 08:42:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb1-smtp-cloud7.xs4all.net (lb1-smtp-cloud7.xs4all.net [194.109.24.24]) by gabe.freedesktop.org (Postfix) with ESMTPS id D74DF6E218 for ; Wed, 2 Aug 2017 08:42:47 +0000 (UTC) Received: from tschai.fritz.box ([212.251.195.8]) by smtp-cloud7.xs4all.net with ESMTPA id cpEodNfHAZNWkcpErdA85n; Wed, 02 Aug 2017 10:42:46 +0200 From: Hans Verkuil To: linux-media@vger.kernel.org Subject: [PATCH 0/3] cec-gpio: add HDMI CEC GPIO-based driver Date: Wed, 2 Aug 2017 10:42:39 +0200 Message-Id: <20170802084242.14947-1-hverkuil@xs4all.nl> X-Mailer: git-send-email 2.13.2 X-CMAE-Envelope: MS4wfDirG5g1n1Fx2maK+vooSisFpx8Kk2iOEB8Kn/EpdMBG6vhwH4a434Q3APkgQJdbGe4FY84T1ACkNPbRIqVhr1O2ryLzGqLbaTj5TD07lB6HSRD+w6VX BfswpEvDNFAtAa17RE4uL70D1juyMBKSa52bzTO4hPM4pCL1SkqGuonxOSLC6g8Fu4ly8Rd0D2+C4XTKgk8TVKZvwS1qlsRQS78onfYQx6nFjAAI2i5VeUX3 7n7DXskjSllp6Mr0Cb1PfNXXJddHI2w4bU0yxYc8Vm/lLjj0k83qKk1bRwPgFZzd Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Hans Verkuil This driver adds support for CEC implementations that use a pull-up GPIO pin. While SoCs exist that do this, the primary use-case is to turn a single-board computer into a cheap CEC debugger. Together with 'cec-ctl --monitor-pin' you can do low-level CEC bus monitoring and do protocol analysis. And error injection is also planned for the future. Here is an example using the Raspberry Pi 3: https://hverkuil.home.xs4all.nl/rpi3-cec.jpg A patch for the Raspberry Pi 2B/3 is added below for reference. It uses pin 7 aka BCM4 aka GPCLK0 on the GPIO pin header. While this example is for the Rpi, this driver will work for any SoC with a pull-up GPIO pin. I have one question: is there a generic way to check/force the gpio to pull-up mode? I have not found that, but I am no gpio-expert. Regards, Hans --- cut here --- diff --git a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts index bf19e8cfb9e6..8cb82a70f33d 100644 Hans Verkuil (3): dt-bindings: document the CEC GPIO bindings cec-gpio: add HDMI CEC GPIO driver MAINTAINERS: add cec-gpio entry .../devicetree/bindings/media/cec-gpio.txt | 18 ++ MAINTAINERS | 9 + drivers/media/platform/Kconfig | 10 ++ drivers/media/platform/Makefile | 2 + drivers/media/platform/cec-gpio/Makefile | 1 + drivers/media/platform/cec-gpio/cec-gpio.c | 190 +++++++++++++++++++++ 6 files changed, 230 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/cec-gpio.txt create mode 100644 drivers/media/platform/cec-gpio/Makefile create mode 100644 drivers/media/platform/cec-gpio/cec-gpio.c --- a/arch/arm/boot/dts/bcm2836-rpi-2-b.dts +++ b/arch/arm/boot/dts/bcm2836-rpi-2-b.dts @@ -24,6 +24,11 @@ linux,default-trigger = "default-on"; }; }; + + cec-gpio { + compatible = "cec-gpio"; + gpio = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; }; &gpio { diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts index 972f14db28ac..cd0ec70732f4 100644 --- a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts +++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b.dts @@ -17,6 +17,11 @@ gpios = <&gpio 47 0>; }; }; + + cec-gpio { + compatible = "cec-gpio"; + gpio = <&gpio 4 GPIO_ACTIVE_HIGH>; + }; }; &uart1 { --- cut here ---