From patchwork Tue Dec 12 14:37:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 10107645 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 00A4560327 for ; Tue, 12 Dec 2017 14:37:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E85AD2949B for ; Tue, 12 Dec 2017 14:37:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD2AA29BF3; Tue, 12 Dec 2017 14:37:31 +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 2C0FA2949B for ; Tue, 12 Dec 2017 14:37:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9A521898C6; Tue, 12 Dec 2017 14:37:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lb1-smtp-cloud9.xs4all.net (lb1-smtp-cloud9.xs4all.net [194.109.24.22]) by gabe.freedesktop.org (Postfix) with ESMTPS id A07A0898BC for ; Tue, 12 Dec 2017 14:37:27 +0000 (UTC) Received: from [192.168.1.10] ([80.101.105.217]) by smtp-cloud9.xs4all.net with ESMTPA id OlgPese6pnIXbOlgQe0uDW; Tue, 12 Dec 2017 15:37:25 +0100 From: Hans Verkuil Subject: Re: [PATCH v2 2/7] drm/i2c: tda998x: move CEC device initialisation later To: Russell King - ARM Linux References: <20171206123452.GA13127@n2100.armlinux.org.uk> <3fe761b0-a86c-a526-d14e-9c296b5fa5f7@xs4all.nl> <20171208115937.GB10595@n2100.armlinux.org.uk> Message-ID: Date: Tue, 12 Dec 2017 15:37:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20171208115937.GB10595@n2100.armlinux.org.uk> X-CMAE-Envelope: MS4wfDWkkGvZZkue/AaIYp40OHzqaDzl2lwLrapGzFtAfO+u0reBSZxZmLOh3NaL4+SuXnQRn7LmbZvuAx8FFdiCHwSA4Odd9OFpTewiCbdV3SLCiB07ce/T 0qyuFDRvBVmYjnx5Odm9xst0iNdxn8uVK27QcrzPVD0w2bZxL8AR4Znv1iryYsWEOFphhRMsJ6PsxzMami75B0QBnye75TNGuhnsb62ysZBQ+OkLA0Oq/yHP FYNoYtMUYB72hiY7pgRtYQ== Cc: David Airlie , dri-devel@lists.freedesktop.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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Hi Russell, On 08/12/17 12:59, Russell King - ARM Linux wrote: > On Wed, Dec 06, 2017 at 02:54:04PM +0100, Hans Verkuil wrote: >> On 12/06/17 13:35, Russell King wrote: >>> We no longer use the CEC client to access the CEC part itself, so we can >>> move this later in the initialisation sequence. >>> >>> Signed-off-by: Russell King >>> --- >>> drivers/gpu/drm/i2c/tda998x_drv.c | 7 ++++--- >>> 1 file changed, 4 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c >>> index 7f4dbca7f7f4..4aeac2127974 100644 >>> --- a/drivers/gpu/drm/i2c/tda998x_drv.c >>> +++ b/drivers/gpu/drm/i2c/tda998x_drv.c >>> @@ -1490,9 +1490,6 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) >>> priv->cec_addr = 0x34 + (client->addr & 0x03); >>> priv->current_page = 0xff; >>> priv->hdmi = client; >>> - priv->cec = i2c_new_dummy(client->adapter, priv->cec_addr); >>> - if (!priv->cec) >>> - return -ENODEV; >>> >>> /* wake up the device: */ >>> cec_write(priv, REG_CEC_ENAMODS, >>> @@ -1546,6 +1543,10 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) >>> CEC_FRO_IM_CLK_CTRL_GHOST_DIS | CEC_FRO_IM_CLK_CTRL_IMCLK_SEL); >>> >>> /* initialize the optional IRQ */ >>> + priv->cec = i2c_new_dummy(client->adapter, priv->cec_addr); >>> + if (!priv->cec) >>> + return -ENODEV; >>> + >> >> I'd move this up to before the 'initialize the optional IRQ' comment, since >> that should stay with the 'if (client->irq) {' line below. > > I've swapped the order of patches 2 and 3, and moved this further down > near where we add the real cec device in a later patch. This is > starting to get quite different from the patch series that I've tested, > and as I've already mentioned, testing is not going to happen for a > while. > I added support for this to am335x-boneblack-common.dtsi (see patch below), but it doesn't work. I suspect the calibration since I see these messages: gpio-57 (nxp,calib): gpiod_direction_output: tried to set a GPIO tied to an IRQ as output Which makes sense. I had a similar case in my cec-gpio driver and I had to completely free the interrupt before I could set the direction to output. I do get nice interrupts when a transmit is done, so the interrupt works correctly. And it correctly detects Ack/Nack. I looked a bit closer and I see that even without calibration the timings are reasonably OK: 2.3 ms for a bit period instead of the recommended 2.4 ms. Slightly off but within margins. But receiving messages fails: I get no interrupt at all. Not sure if the lack of calibration is the cause of that, or if it is something else. I can take another look once the calibration is fixed. Regards, Hans Signed-off-by: Hans Verkuil diff --git a/arch/arm/boot/dts/am335x-boneblack-common.dtsi b/arch/arm/boot/dts/am335x-boneblack-common.dtsi index 325daae40278..07e6b36d17c4 100644 --- a/arch/arm/boot/dts/am335x-boneblack-common.dtsi +++ b/arch/arm/boot/dts/am335x-boneblack-common.dtsi @@ -7,6 +7,7 @@ */ #include +#include &ldo3_reg { regulator-min-microvolt = <1800000>; @@ -91,6 +92,8 @@ tda19988: tda19988 { compatible = "nxp,tda998x"; reg = <0x70>; + nxp,calib-gpios = <&gpio1 25 0>; + interrupts-extended = <&gpio1 25 IRQ_TYPE_LEVEL_LOW>; pinctrl-names = "default", "off"; pinctrl-0 = <&nxp_hdmi_bonelt_pins>;