Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2052401pxu; Fri, 18 Dec 2020 04:30:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyWx/l9bJs6nshY8t7YZXzKCl4BGxDbUleKKIXrxmpxzYeq53r47zaR9OMC++iFqPLyVizW X-Received: by 2002:a50:8e19:: with SMTP id 25mr2417691edw.263.1608294636915; Fri, 18 Dec 2020 04:30:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608294636; cv=none; d=google.com; s=arc-20160816; b=sJv36zmt6agE0Y1l9Z06SbjM7+oEEYRELJvALTxXDangap6XmDQFNakLKOE2n6Wruv WVmGlrFld+EVQA2hM0yJ3A8Wox4xB/rJWJP2yTztssfy31nVcXXdcEIpQYZ3HU3w5cDj oSRyAGQhT0/lr3SzfmuCWDHfzRnSWlDGnRD6JLO6/4AfGwA+8OeNSq4R9EzYUdk9NXfO UCZlFrhdXQVyK24/3d1GmXtLEnydtfI+5TydBZpGAfouDgE/q1kqVZPXubJGvRAM38lT Im406LZzS0T6LZ+xz5/0Kpsow6dWSe44JanHBKP4GGE5yd2JGQHFx8FBjFZk85vBBd/z PFHQ== 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=zptP6/C3RZis9BrFo7fAAZrKYnn57+H7GBHOg14Q8CI=; b=Kd3aLXxE9jDbWtD2iGxOVikKjvvDRv0tupXrBQcnYQvTtsyucei6HqsXBvE/txL0sA /vCJqoKMDzf+lxl8bK7FlA3yh2JvUZDKA/9+ELkqTjJPPJnHN73Basj6vGYzrSFqK2QR Z5zOf9yJ6AwL0I4Hri0PPrm9Ah7MHRj5FxzOTPAVeRL7HHAHDeWuSf1YmmpNVeMQWIpR YcLTSm/4Lv3DJ01VUDZ43h6wOCAfbvRzyeshmyjXVjOQ/EZ29Xhx2LTedHJvAKttTD+d U3sHy9Oc0ZFZqmfQ3VVhpe97fnKF5vfmu7L1YhPl/zETFW5XjMi3WWE60ePwyp8FkvvH qeZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=jCWOZpsv; 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 h12si4455768eje.122.2020.12.18.04.30.14; Fri, 18 Dec 2020 04:30:36 -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=jCWOZpsv; 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 S1726335AbgLRMZ7 (ORCPT + 99 others); Fri, 18 Dec 2020 07:25:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726104AbgLRMZ7 (ORCPT ); Fri, 18 Dec 2020 07:25:59 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA90C0617A7 for ; Fri, 18 Dec 2020 04:25:18 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id g185so2355470wmf.3 for ; Fri, 18 Dec 2020 04:25:18 -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=zptP6/C3RZis9BrFo7fAAZrKYnn57+H7GBHOg14Q8CI=; b=jCWOZpsvN/MFYNTDjM8lTtODa80v6w0yqKS0T+vYL+j/9oECDChQ+pPaaqz9Vt5Vw6 fKD4fcfJQu+yVAShZxEaqJTEdeVuI2JnSTybq/58dqu8QYcrDG/CUNabvUKUA+QIttf8 8wuxAg6wJ+BW4yqEEptP/q+ZRbkw3kJTD5SDXJ8lLJE3riADWybY9IVlI84BUrP3a8xG QNiabjyYkR4AOvwiJ5TMiQzoxrlZQDJEvhKl/04DAqpzxx8qABrdU0aFt+ZHSzkbRrv2 Guu+H/FNRD3M06EdvdXUojrlDS3i7aMQEx7uBKEgZHgH3k5xaBECBXUHb6eU83eDxixM fwfg== 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=zptP6/C3RZis9BrFo7fAAZrKYnn57+H7GBHOg14Q8CI=; b=jy9Ou7Zmvol+0zO//6T5I2R9/cxpWiu/0S5vuOkBGwFufv3dRxkbfHJAvZ0YdCtj0S YUSzF4s6ZwfeYt58iZ47PNJsSmefTPm6bhObzT8Z0wjNoqb1NeqqqqBrJYKFxnXwvhf5 RoEsi8pu+eAv4xm2f394VdykSU8gy/8ZDAPFBR88obMCTE0hd1ER0dQew37s03P+iicR vt4v/tx7Uf1V6yUtF9uj0L/Xk1Ur4tENG7MtwbiUfoIWyj5jHqwbqvaA5pYrII5G4nqT NosgXDJSSjX0i+sMgd8qyeKK4AP7DbgcR6vNAD4NZU50jjp9nNDxR4fwHVnbkS/JM7F5 6PdQ== X-Gm-Message-State: AOAM532szIyDQm/LWxki3Lm2DeJDsUeLjg2AhP7jFhvgPQ9lJf2iaMOL EV5Q5TL0jBEAWzBbG6HYNnpibZ/hlQsdi23dQV2yAYtQtto= X-Received: by 2002:a1c:27c3:: with SMTP id n186mr4038981wmn.96.1608294317336; Fri, 18 Dec 2020 04:25:17 -0800 (PST) MIME-Version: 1.0 References: <20201210134648.272857-1-maxime@cerno.tech> <20201210134648.272857-9-maxime@cerno.tech> <20201218122334.tvdeslyyuus4hp4y@gilmour> In-Reply-To: <20201218122334.tvdeslyyuus4hp4y@gilmour> From: Dave Stevenson Date: Fri, 18 Dec 2020 12:25:00 +0000 Message-ID: Subject: Re: [PATCH 08/15] drm/vc4: hdmi: Introduce a CEC clock 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 On Fri, 18 Dec 2020 at 12:23, Maxime Ripard wrote: > > Hi Dave, > > On Fri, Dec 18, 2020 at 11:37:50AM +0000, Dave Stevenson wrote: > > Hi Maxime > > > > On Thu, 10 Dec 2020 at 13:47, Maxime Ripard wrote: > > > > > > While the BCM2835 had the CEC clock derived from the HSM clock, the > > > BCM2711 has a dedicated parent clock for it. > > > > > > Let's introduce a separate clock for it so that we can handle both > > > cases. > > > > > > Signed-off-by: Maxime Ripard > > > --- > > > drivers/gpu/drm/vc4/vc4_hdmi.c | 9 ++++++++- > > > drivers/gpu/drm/vc4/vc4_hdmi.h | 1 + > > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > > > index b93ee3e26e2b..0debd22bc992 100644 > > > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > > > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > > > @@ -145,7 +145,7 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) > > > * Set the clock 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; > > > + clk_cnt = clk_get_rate(vc4_hdmi->cec_clock) / CEC_CLOCK_FREQ; > > > value |= clk_cnt << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT; > > > HDMI_WRITE(HDMI_CEC_CNTRL_1, value); > > > } > > > @@ -1740,6 +1740,7 @@ static int vc4_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) > > > return PTR_ERR(vc4_hdmi->hsm_clock); > > > } > > > vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock; > > > + vc4_hdmi->cec_clock = vc4_hdmi->hsm_clock; > > > > > > return 0; > > > } > > > @@ -1833,6 +1834,12 @@ static int vc5_hdmi_init_resources(struct vc4_hdmi *vc4_hdmi) > > > return PTR_ERR(vc4_hdmi->audio_clock); > > > } > > > > > > + vc4_hdmi->cec_clock = devm_clk_get(dev, "cec"); > > > + if (IS_ERR(vc4_hdmi->cec_clock)) { > > > + DRM_ERROR("Failed to get CEC clock\n"); > > > + return PTR_ERR(vc4_hdmi->cec_clock); > > > + } > > > > Aren't we adding to the DT binding here and breaking backwards compatibility? > > Admittedly CEC didn't work before (and was masked out) for vc5, but do > > we need to worry about those with existing DT files that currently > > work happily? > > The DT compatibility is not a worry here: I made sure the CEC clock and > range were part of the binding since it's been introduced: > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2e3725b05b785e73482a194b99bff3d5a1c85140 > > So we were not using it so far, but it was in the DT all along I guess I should have read it then :-) In which case Reviewed-by: Dave Stevenson