Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5301963rwd; Mon, 5 Jun 2023 01:16:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4nSqaGMfEm5wC0TXPdA/QxpQyGR4dFGN5GiEPwYMFivlTFRUOyVI6c5NLolJLqxSCAHckW X-Received: by 2002:a05:6a00:16d3:b0:64d:632a:d0ac with SMTP id l19-20020a056a0016d300b0064d632ad0acmr25282122pfc.25.1685952992728; Mon, 05 Jun 2023 01:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685952992; cv=none; d=google.com; s=arc-20160816; b=0V2hdz8+sXCIyH35X8kmtj+wCpMMr0CbjWoMH7bKkA7NsCQUtkc2h6SRxbM14d2lR5 Qd9tnrG8LyA4+k0hqdGf17tmcyF5Wb8g8Byv4JhuG2O6rUOVKqXBDTK1gKTFD+vXhJnr P0fmmqilwZreDap1FGWoiDA+zIqN99NyMMm5+Kh9cmi092KUxm8LydsahZv85Eh697De N0HydiDeYBZBjYuBWDC9u8kvoXSthzh47VuYTfZO520wAq9WJgaQezyqnpqttvd26VPz ctp559paF0vWqRZSS7d7SNV0193uA+nvKvPEsITYfOMLdkTwR+8C4QBGY1rSMGkP3bcR QvSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=V8d/CwqouuLxaG0LwB2vxTfUNUKRJvZ3Bl8hzAINGsk=; b=raHw3mAmjHBKvo+dhTwkj7IxDygQUPyqGGoGtmmUMlNh4X/WAdGH54xqd0ZpfCddH0 sHPXwcLYuHXUBUdZrNldBbb8E5b6ZI9WXCRaRL8Yyy5maR87gDMjEm1nSmFnnEiMq77n qDfl513dfEshcV2OMOXm/APMXqSrUODc98FdhdhXOLaEiqL9SephNM1HGUl3w6OulF+1 FAO86vOlU146XZc9sc+JqM3LOWfpre4jVU7EbDUpPiG3uNFEz7QGTYjtROhTshX3BNu8 kF6jW/FIBVeI2lJX08OWQrVRyGcvyJdpEIQqGM69l9LGNVUqAgWjLmmK5fz1rm6zNWeW 74pg== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020aa78425000000b0064d35b6cdd8si4898684pfn.168.2023.06.05.01.16.20; Mon, 05 Jun 2023 01:16:32 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230156AbjFEIJE (ORCPT + 99 others); Mon, 5 Jun 2023 04:09:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229974AbjFEIJD (ORCPT ); Mon, 5 Jun 2023 04:09:03 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28636A1 for ; Mon, 5 Jun 2023 01:09:02 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q65Gn-00021e-UX; Mon, 05 Jun 2023 10:08:53 +0200 Received: from pza by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1q65Gi-0003OO-3S; Mon, 05 Jun 2023 10:08:48 +0200 Date: Mon, 5 Jun 2023 10:08:48 +0200 From: Philipp Zabel To: Keith Zhao Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Emil Renner Berthing , Paul Walmsley , Palmer Dabbelt , Albert Ou , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Sumit Semwal , christian.koenig@amd.com, Bjorn Andersson , Heiko Stuebner , Shawn Guo , Jagan Teki , Chris Morgan , Jack Zhu , Shengyang Chen , Changhuang Liang Subject: Re: [PATCH 9/9] drm/verisilicon: Add starfive hdmi driver Message-ID: <20230605080848.GA4802@pengutronix.de> References: <20230602074043.33872-1-keith.zhao@starfivetech.com> <20230602074043.33872-10-keith.zhao@starfivetech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230602074043.33872-10-keith.zhao@starfivetech.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: pza@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Hi Keith, On Fri, Jun 02, 2023 at 03:40:43PM +0800, Keith Zhao wrote: > Add HDMI dirver for StarFive SoC JH7110. > > Signed-off-by: Keith Zhao > --- > drivers/gpu/drm/verisilicon/Kconfig | 11 + > drivers/gpu/drm/verisilicon/Makefile | 1 + > drivers/gpu/drm/verisilicon/starfive_hdmi.c | 928 ++++++++++++++++++++ > drivers/gpu/drm/verisilicon/starfive_hdmi.h | 296 +++++++ > drivers/gpu/drm/verisilicon/vs_drv.c | 6 + > drivers/gpu/drm/verisilicon/vs_drv.h | 4 + > 6 files changed, 1246 insertions(+) > create mode 100644 drivers/gpu/drm/verisilicon/starfive_hdmi.c > create mode 100644 drivers/gpu/drm/verisilicon/starfive_hdmi.h > [...] > diff --git a/drivers/gpu/drm/verisilicon/starfive_hdmi.c b/drivers/gpu/drm/verisilicon/starfive_hdmi.c > new file mode 100644 > index 000000000000..128ecca03309 > --- /dev/null > +++ b/drivers/gpu/drm/verisilicon/starfive_hdmi.c > @@ -0,0 +1,928 @@ [...] > +static int starfive_hdmi_enable_clk_deassert_rst(struct device *dev, struct starfive_hdmi *hdmi) > +{ > + int ret; > + > + ret = clk_prepare_enable(hdmi->sys_clk); > + if (ret) { > + DRM_DEV_ERROR(dev, "Cannot enable HDMI sys clock: %d\n", ret); > + return ret; > + } > + > + ret = clk_prepare_enable(hdmi->mclk); > + if (ret) { > + DRM_DEV_ERROR(dev, "Cannot enable HDMI mclk clock: %d\n", ret); > + return ret; > + } > + ret = clk_prepare_enable(hdmi->bclk); > + if (ret) { > + DRM_DEV_ERROR(dev, "Cannot enable HDMI bclk clock: %d\n", ret); > + return ret; > + } > + ret = reset_control_deassert(hdmi->tx_rst); > + if (ret < 0) { > + dev_err(dev, "failed to deassert tx_rst\n"); The error paths should clk_disable_unprepare() enabled clocks. > + return ret; > + } > + return 0; > +} > + [...] > +static int starfive_hdmi_get_clk_rst(struct device *dev, struct starfive_hdmi *hdmi) > +{ > + hdmi->sys_clk = devm_clk_get(dev, "sysclk"); > + if (IS_ERR(hdmi->sys_clk)) { > + DRM_DEV_ERROR(dev, "Unable to get HDMI sysclk clk\n"); > + return PTR_ERR(hdmi->sys_clk); > + } > + hdmi->mclk = devm_clk_get(dev, "mclk"); > + if (IS_ERR(hdmi->mclk)) { > + DRM_DEV_ERROR(dev, "Unable to get HDMI mclk clk\n"); > + return PTR_ERR(hdmi->mclk); > + } > + hdmi->bclk = devm_clk_get(dev, "bclk"); > + if (IS_ERR(hdmi->bclk)) { > + DRM_DEV_ERROR(dev, "Unable to get HDMI bclk clk\n"); > + return PTR_ERR(hdmi->bclk); > + } > + hdmi->tx_rst = reset_control_get_shared(dev, "hdmi_tx"); Use devm_reset_control_get_shared() for consistency, otherwise this is missing a reset_control_put() somewhere. regards Philipp