Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp4032216pxp; Tue, 15 Mar 2022 11:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRcVu6ZLu1rW0hlsoP1FIyCc8P9toVUWnua2bqYtLeOItJ2wiWNdXWqnn+cdlihBWECzPv X-Received: by 2002:a17:90b:17c5:b0:1c6:3639:7daf with SMTP id me5-20020a17090b17c500b001c636397dafmr5141099pjb.105.1647367237037; Tue, 15 Mar 2022 11:00:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647367237; cv=none; d=google.com; s=arc-20160816; b=smSTlJeOZxryvtbTaAaj66Dqkx5vIfDCQxRLO24y4xVRDL4UP5b6gvT7AeJ5MCeRq5 k7hZtNWjXgOnIa0BYn27ASEY2V/RIzhKReljH40j5UxbmxDujEmGWMCKDr+OFLqERHI3 Sq8UWu7cEzvHs16fetxYaMJ3BpufFqydZidoLpaFtdUT4alHV1CnaoDWKFuaYs1vLgpT VAn1q5VZJpantybCIo3KkTE1VhY91BYsjtioKbvphNPK2ucNeJ3a5/xSpb/5h40z5qlj uvWjBB1c1ug0nUSlXrlDbseN4m4/uNqDUWjdULacd2BBCZFlXBNALBDkS2PvEIk1itOf be+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id; bh=men53ebkU7Cs8TIvWmiWJot3ezCYxna+QztHMNc95YM=; b=mj26Yz11Ks7AE32FH0cE1eM6X0+FQIZnfAsbAFiUjUGz3/SSKEHs8eDu6tv8wYiUrL W2bzH8C1piqgy3OHqyAGVNn7Ec3OXFQNGOqpEhAmZ3IGkp2OjYzt1/UdfOvQ48msqvUG vJRmkutp2iSth2DRmi6oUnTc1A5882grvMaiGLqHPaOvdNz8v8Br/NDtcaqi5kFpgKj5 oAlR7YNoTt1SpMJ4D/SNpmtBOdZF+uvLCPf8ebUq2mpyve8MLmlg005gilNut53DN0uX 8arNOAqqT5r/iyomcA7zipAm0JHtvZjdjLv7qHGd2D7X+4F5FAABTLVB+Dya8LBKM5tN ACOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g26-20020aa7819a000000b004f76d35c207si14850201pfi.194.2022.03.15.11.00.22; Tue, 15 Mar 2022 11:00:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234982AbiCNQfn (ORCPT + 99 others); Mon, 14 Mar 2022 12:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232757AbiCNQfl (ORCPT ); Mon, 14 Mar 2022 12:35:41 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 25EF8627D for ; Mon, 14 Mar 2022 09:34:31 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6E5ED6E; Mon, 14 Mar 2022 09:34:30 -0700 (PDT) Received: from [10.57.42.204] (unknown [10.57.42.204]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C0F63F766; Mon, 14 Mar 2022 09:34:28 -0700 (PDT) Message-ID: <74afb713-0413-bd49-c3f1-f6a094df2e17@arm.com> Date: Mon, 14 Mar 2022 16:34:23 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] drm/bridge: synopsys/dw-hdmi: set cec clock rate Content-Language: en-GB From: Robin Murphy To: Peter Geis , Piotr Oniszczuk Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Pierre-Hugues Husson , Archit Taneja , Sascha Hauer , "open list:ARM/Rockchip SoC..." , =?UTF-8?Q?Heiko_St=c3=bcbner?= , dri-devel@lists.freedesktop.org, "linux-kernel@vger.kernel.org" References: <20220126202427.3047814-1-pgwipeout@gmail.com> <3AFD1DD4-AF0A-4ECC-B4F5-E6BD6B9F1BB7@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-03-14 11:31, Robin Murphy wrote: > On 2022-03-13 12:56, Peter Geis wrote: >> On Sun, Mar 13, 2022 at 6:13 AM Piotr Oniszczuk >> wrote: >>> >>> >>> >>>> Wiadomość napisana przez Peter Geis w dniu >>>> 26.01.2022, o godz. 21:24: >>>> >>>> The hdmi-cec clock must be 32khz in order for cec to work correctly. >>>> Ensure after enabling the clock we set it in order for the hardware to >>>> work as expected. >>>> Warn on failure, in case this is a static clock that is slighty off. >>>> Fixes hdmi-cec support on Rockchip devices. >>>> >>>> Fixes: ebe32c3e282a ("drm/bridge: synopsys/dw-hdmi: Enable cec clock") >>>> >>>> Signed-off-by: Peter Geis >>>> --- >>>> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 7 +++++++ >>>> 1 file changed, 7 insertions(+) >>>> >>>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> index 54d8fdad395f..1a96da60e357 100644 >>>> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c >>>> @@ -48,6 +48,9 @@ >>>> >>>> #define HDMI14_MAX_TMDSCLK    340000000 >>>> >>>> +/* HDMI CEC needs a clock rate of 32khz */ >>>> +#define HDMI_CEC_CLK_RATE    32768 >>>> + >>>> enum hdmi_datamap { >>>>        RGB444_8B = 0x01, >>>>        RGB444_10B = 0x03, >>>> @@ -3347,6 +3350,10 @@ struct dw_hdmi *dw_hdmi_probe(struct >>>> platform_device *pdev, >>>>                                ret); >>>>                        goto err_iahb; >>>>                } >>>> + >>>> +             ret = clk_set_rate(hdmi->cec_clk, HDMI_CEC_CLK_RATE); >>>> +             if (ret) >>>> +                     dev_warn(hdmi->dev, "Cannot set HDMI cec clock >>>> rate: %d\n", ret); >>>>        } >>>> >>>>        /* Product and revision IDs */ >>>> -- >>>> 2.25.1 >>>> >>>> >>>> _______________________________________________ >>>> Linux-rockchip mailing list >>>> Linux-rockchip@lists.infradead.org >>>> http://lists.infradead.org/mailman/listinfo/linux-rockchip >>> >>> Peter, >>> >>> On my 5.17-rc7 with applied rk356x VOP2 v8 series - this patch makes >>> CEC working on rk3566. >>> Unfortunately it breaks working ok CEC on rk3399 rockpi-4b. >>> >>> Reverting this patch brings back CEC on rk3399 - but rk3366 becomes >>> with non working CEC >>> >>> I'm not sure how to move forward with this.... >> >> I was worried about that, thanks for testing it. >> Can you send me the cec_clk rate before and after this patch? > > Hmm, looks like there might be a bug in the RK3399 clock driver - > although it's treated as having mux_pll_p as parents, according to the > public TRM the CEC clock appears unique in being backwards compared to > every other mux of those two inputs. I'm now tempted to test this on my > board tonight and see if I can see 24MHz on the CEC pin... :) Nope, turns out that's an error in the TRM and the mux is fine. The bug is between the clock driver blindly assuming xin32k is usable, and nearly all RK3399 boards forgetting to claim the pinctrl to actually enable the input :/ Robin.