Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2040922pxu; Fri, 18 Dec 2020 04:12:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLoRTd+i3N1VcUR7M3TLhkql5ZK+Ss8qX2cVge0wCuV7SsgQMn3fN6L6502K5Ac/0TVSsx X-Received: by 2002:aa7:c3cd:: with SMTP id l13mr4035216edr.97.1608293577763; Fri, 18 Dec 2020 04:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608293577; cv=none; d=google.com; s=arc-20160816; b=gaJnl6nH5WUZX4Io2a2A/Rmqv+3Zddf0kOV1tL4euvcgBj8NgE/R8r52yJIhg47YST HcUSeYIU0K8ygsKCKdhfb6t+7s/HEsxjs96ORZZP6LdIFke6wH8pm065RC9jTygipGBF Jsfg6M1+4Ln1RdIKiO7Oa4dUTffFdgQ28rP9UqEwDo2/4rpxDcuo/Y4qeuxi2mqCCb6B rf0uY1e8/NOvJLG6im5srs0ffQ2vrtv50qUSbGwpjTfDkLPokcnrtrKaybv1Q/TWh5uv rdAp/h8X4Elk5yKrVqPp9HwBHTa/o7WPpj//itJNDCT9OOyPo7iUdE9IoRS2yw44DZyB uIKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=llHW0DBcsKI4xlBf5BlOjoI6hCuZnmrZ4dlRgFFGbPI=; b=u8XciFug4E7eOF+Tn/RWpGZiPAymA45txMhnVCYNSoDXjb7cqeV+7VmaWqWWBK3nel 7RH/ZuEsxfC8Wkd0ZPU+pBE5CE++rcui09W0uZzwc07P1HGvArOvB63loTX9gj9e0MIU 2bfOw7biBHWxVZuZ49tfExAJjQHlrmms2LnVrkxX7xcyjuSihctkricgUrkrFmiq7RvY lveu4CM/UT8vk6pTbD1ivrEbXg9F3W8j/rQiqOo+GNPAjsDlyNPQSsMQSMMokGJg/FZH U0WxT+RfKi9ssW9Dxf2oVl5D6m6UWVr+ogGEb8hwl635v6kx7Q7EBGd28MgHH/P5mpJG /Uxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=hn0pAdns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si6284838edy.153.2020.12.18.04.12.33; Fri, 18 Dec 2020 04:12:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=hn0pAdns; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=raspberrypi.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725778AbgLRLb0 (ORCPT + 99 others); Fri, 18 Dec 2020 06:31:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgLRLb0 (ORCPT ); Fri, 18 Dec 2020 06:31:26 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97A51C0617A7 for ; Fri, 18 Dec 2020 03:30:45 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id d13so1735471wrc.13 for ; Fri, 18 Dec 2020 03:30:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=llHW0DBcsKI4xlBf5BlOjoI6hCuZnmrZ4dlRgFFGbPI=; b=hn0pAdnsaIXVrnwj/Tky6J7bEbs1Dk4WuING5W/EnDn+19RWSVIF2VylblcK6A5SUx w2gKVOsEDpjx1+iVK6Y8sBIOzqvDfWr7sljsMVxXUvKogzbJ6gye93m3jRjP5zi9EVyF kH9Ymlf2/OPpwFI647e+04mUG1zeLr+xGdls6EmLnB3rpgYjhSyajYgc/JDXXORyqRJw xkSkNXd99kDxZrmjnDTNRGDpXYSbXN9bzUb8rIGILCk5rDSYojiihMu2BXLq4nVvGdlG 8kbaEWh0pZrf34hY1r6ivf/HDX8Qz0YrardDH9Sap1PR7mk6WIgkOBH6fDzlCxI0850L axEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=llHW0DBcsKI4xlBf5BlOjoI6hCuZnmrZ4dlRgFFGbPI=; b=l5zeIizYivC0MZg//jGVyc64hSaFItTdZkzAD/6ob0OohHkzE44kdROQOXGgRwo1XI /v08cC4z3BTSJet5IFrjZ5LoVS6Yebk/q2tD6BOCJkx5hM5L+eiJKR2sYbWUObhJYLhU 1nPJ8MetB81zOSHKARXX6zYV3yCmnuf82vCKt3QVzEhx8/YO3dv7vrPneJlOdjFjeKZw oYdSAXnhUyEgJuLuG92UZVN9oRYKjOIfiur2xuWAg/YbGqQjpsC52Wh4OhiakhgHX37D jy83iXydmXBDy4eM0Xu/U9EcmnXZk4L+Dr+3PL2xhpTfDqjCX/cblMrL1e3NIru5QL0r NE4g== X-Gm-Message-State: AOAM530SS/UqkY9PM21+awxVZ+khpEK3KEZbo0JspNt589nh6cy3RCPG 2ulycFokLoZ3MgoKHWQsR22lxE50/Uys3fLa1W48pw== X-Received: by 2002:adf:d18a:: with SMTP id v10mr3865608wrc.273.1608291044405; Fri, 18 Dec 2020 03:30:44 -0800 (PST) MIME-Version: 1.0 References: <20201210134648.272857-1-maxime@cerno.tech> <20201210134648.272857-7-maxime@cerno.tech> In-Reply-To: <20201210134648.272857-7-maxime@cerno.tech> From: Dave Stevenson Date: Fri, 18 Dec 2020 11:30:27 +0000 Message-ID: Subject: Re: [PATCH 06/15] drm/vc4: hdmi: Compute the CEC clock divider from the clock rate To: Maxime Ripard Cc: Eric Anholt , Maarten Lankhorst , Thomas Zimmermann , Daniel Vetter , David Airlie , Jason Cooper , bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, Marc Zyngier , Linux Media Mailing List , Hans Verkuil , LKML , Mauro Carvalho Chehab , Thomas Gleixner , linux-rpi-kernel@lists.infradead.org, DRI Development Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxime On Thu, 10 Dec 2020 at 13:47, Maxime Ripard wrote: > > The CEC clock divider needs to output a frequency of 40kHz from the HSM > rate on the BCM2835. The driver used to have a fixed frequency for it, > but that changed and we now need to compute it dynamically to maintain > the proper rate. > > Fixes: cd4cb49dc5bb ("drm/vc4: hdmi: Adjust HSM clock rate depending on pixel rate") > Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson (To be a total pedant it's still a fixed frequency on vc4, but it's configurable via the variant entry). > --- > drivers/gpu/drm/vc4/vc4_hdmi.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index eff3bac562c6..0c53d7427d15 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -1586,6 +1586,7 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) > { > struct cec_connector_info conn_info; > struct platform_device *pdev = vc4_hdmi->pdev; > + u16 clk_cnt; > u32 value; > int ret; > > @@ -1611,8 +1612,9 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi) > * divider: the hsm_clock rate and this divider setting will > * give a 40 kHz CEC clock. > */ > + clk_cnt = clk_get_rate(vc4_hdmi->hsm_clock) / CEC_CLOCK_FREQ; > value |= VC4_HDMI_CEC_ADDR_MASK | > - (4091 << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT); > + (clk_cnt << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT); > HDMI_WRITE(HDMI_CEC_CNTRL_1, value); > ret = devm_request_threaded_irq(&pdev->dev, platform_get_irq(pdev, 0), > vc4_cec_irq_handler, > -- > 2.28.0 >