Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2041032pxu; Fri, 18 Dec 2020 04:13:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJwdqXv7PxsVS475JcUenkDcZvSMrEOcPHd1XyyLOrReSYXPj8ZpMkJlKBpDbMHmtErzVapN X-Received: by 2002:a05:6402:45:: with SMTP id f5mr4045668edu.273.1608293587201; Fri, 18 Dec 2020 04:13:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608293587; cv=none; d=google.com; s=arc-20160816; b=kJ5gVdjybLc0XPaRmfjW+jX+P2VtvXZMH5QbsgZXfjP94sb4UBcQDAh0rQsnG5wf+C rRn3+cuG40iKJt8BCPj73jOJ51iDBgeuRoinYngwNBZOuajnCRdGlgnHxth2O7p9Z6IT JssaTUNPZ4iSdSZb86gY+QkYKeKmV7xNEUmi1FbCIWFW3GUY1Fw63ORBviBQAMHgBYiZ kv8wqVB9JUYnPDzgCA2yPUvG2qQQ35uKk6RmyAP4OlFJeBaKSuYXoxedwwQ9rCBHkRiw ojDjo1QqKRIPqHQ/RMrroV/D4nm8XI39Js9fg3lvQBjzbldkL38evTYmUfjsl5Mkb51u AZig== 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=aoWRWWsuuMiJYUiJ8ref+3sTcxGYyjAa+0+yB4BqHyE=; b=XNbVeVK/0bLQh0vUeNlcYdzc2t0gvXKzqkletSOaHoYeJKBNzklJ5MgIweUi0iLwru VvuTgVFVZ09tOy3XYAjTwJtSno+IErFvLevytfDLfo1UCA3OTL+Xg/1y6tPrH6sJU6/l +0uGvejuX1PeqDcQQS7pzNxXNVmA2LYnz4/fgVwEj9C5TXMo4uro7cimOAXqAABRhlmb ogJy2DA6lCtOijMOl4xjdipLVI2PBiJ43KHbAJxuW92U4DQgZBNrap9oJbTB08VuJujo TCQJHOdztJTmXDhtIl0C1v6NGM89mzVRTqQuxtqO4bc+Z6TwyPoNk11bZcgEtcbfiKHy HQgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=AvZqdIZu; 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 j1si6435736edn.611.2020.12.18.04.12.44; Fri, 18 Dec 2020 04:13:07 -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=AvZqdIZu; 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 S1726232AbgLRLis (ORCPT + 99 others); Fri, 18 Dec 2020 06:38:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725710AbgLRLis (ORCPT ); Fri, 18 Dec 2020 06:38:48 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 060F8C0617A7 for ; Fri, 18 Dec 2020 03:38:08 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id d13so1757299wrc.13 for ; Fri, 18 Dec 2020 03:38:07 -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=aoWRWWsuuMiJYUiJ8ref+3sTcxGYyjAa+0+yB4BqHyE=; b=AvZqdIZugmy8fz42MgEo3JGpxLGI1jqAzQ+K83/MQzqa8S0Ed/57+iVER2/DHBDud7 RK9Dmm3AKP7BsQWhlAU8iEYqlKmsylzmP7L8PpdEdABuLGw0LX09uu1SxKnkx9PZrKlu n3IxJGftbpq/p5tKuxrLfmqpYWSQyEec0DMPJpmiz3dT/5zN36m9naF/STFklDW4AD5D NZBPUcAL2zIFDG1PtCbydQ1FTAooZSn5+gfuFu4NT24GmEt3XdhmUJAdZi4hoChQ+ajk OuqvuOK690WL/3hVJ6c2NsoTtqa6OqYLbn3HAPUdH/ezxWmUatS5URoumFDqmUiGg6uV bcCg== 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=aoWRWWsuuMiJYUiJ8ref+3sTcxGYyjAa+0+yB4BqHyE=; b=oWXXhYNQ25RHjnvvB2F6OeoPXncSJ0JnrIjpmeIBS/YLcH1QOv3a0KCwrLe4sjV6fp rrQTCWBP8UmgNTygb7RBDEvmg/ykCwYviewOI3sN9QEw1V5pbnjYM71WpM89laFI600Y cyHlKApQXtEW672+Wd78HPBXZsC6CAyhTb2NbnKdA5rgK5aUk8YuEJJAPPYk3+xeZphM hoXtuy10QmoYtqui15M1WHzIiEoZbgnOXNJUiVuDkkwSpwjISGo0jweTmd2q0T0otHYA iX4E0tElM6ARvV5Nh44vdgBxREtZDvPLyyCdUfrXpgHq6vTCgso4HU1taUgdzc2HG9/y qk3A== X-Gm-Message-State: AOAM533kJ8xo6u853HNTshW02pAnyRKbDbYeEaFY+gTYO6E4dXAbrX82 gaUH1BywHRnOmVl/bcXCiKXCsx5KBXXtb2UqSgmtjg== X-Received: by 2002:adf:d18a:: with SMTP id v10mr3901140wrc.273.1608291486699; Fri, 18 Dec 2020 03:38:06 -0800 (PST) MIME-Version: 1.0 References: <20201210134648.272857-1-maxime@cerno.tech> <20201210134648.272857-9-maxime@cerno.tech> In-Reply-To: <20201210134648.272857-9-maxime@cerno.tech> From: Dave Stevenson Date: Fri, 18 Dec 2020 11:37:50 +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 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? Otherwise I'm happy with the patch. Dave > + > vc4_hdmi->reset = devm_reset_control_get(dev, NULL); > if (IS_ERR(vc4_hdmi->reset)) { > DRM_ERROR("Failed to get HDMI reset line\n"); > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h > index 720914761261..adc4bf33ff15 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.h > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h > @@ -155,6 +155,7 @@ struct vc4_hdmi { > bool cec_tx_ok; > bool cec_irq_was_rx; > > + struct clk *cec_clock; > struct clk *pixel_clock; > struct clk *hsm_clock; > struct clk *audio_clock; > -- > 2.28.0 >