From patchwork Sun Sep 24 19:26:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 144209 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp994841vqu; Sun, 24 Sep 2023 22:38:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/ESVYe/rz03Dwn0aSdFZfr7O/Lm2uCU6/B1zTt5DBp7NNo5av1fY1mPn9wBt3unNesWuk X-Received: by 2002:a05:6a20:1451:b0:153:63b9:8bf9 with SMTP id a17-20020a056a20145100b0015363b98bf9mr7650396pzi.0.1695620330232; Sun, 24 Sep 2023 22:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695620330; cv=none; d=google.com; s=arc-20160816; b=LQrJiAKpXfx1dPC5p/GBFOGZMYUnesmx5gep9dzTl9mF7D+OUs8LEOZgrxVULFjk25 q34tPiU7I90ux8PGWAnt4iAXmjaGhguqm681Fi7IrxKwcUe2dlWETgp5RbOGxCh8rB2y NNWlQmuPZBGG7upb6Kf/zxQkMUntzcsNsUl9VZ4VWjt/JurYk+7LS3zixbwzQoUCKlg1 Vdd9jtQjGrlvxJ6BBqWiTCzhO5L9WiBvdmsMlziSfZl/EL/QcAsyjcWoPbryrMw12HQh WQtVUI8NNQwFKZnJtjPDHIvbd23iJD2sbGzKjS3znsxF6aYy9p2r/5S88HKQw8+qzOPU 9Dvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8y8h3EEz9VirQFhjmojPuvqBkQuqu/oUUWDuJnG4W+c=; fh=ythuQA64SNE7wujD11OFYiH8HaGGRVN0m1KGJA3eIXU=; b=MEMPllXY7w3hfD+FNk6BmGQC/kBqIOj99wGtE8bmpKUeQJxpRkObaaz+ngv/pC7Yh1 6vmwQVhoYHg0yANSpIiJLlrIaZWK2Od0mmTzqCj2XGUqsa2hm16Mzxy7U0bBmRIDK52Y XKNOvcZ5oU9MVHW42LgswCvdtzPVquq8ZWxB7BDAj/iUM/1fXBCt6wdF/O3f3CTFp27u 1SRd6GIQh5p5OSbWmEeBnQaZO2wPBYjG/GpAb9wpvPbmynlyqhHcrmAUN1ZPxq3RlJaS DDo2ThWDjZ0qkzzppbcnzwf6Ct00f40/8z/IegJrCPn90o9eYPoYRxTJ4Szy2sleFL+2 y/fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=M490nm+Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id br12-20020a17090b0f0c00b002773af24826si3383056pjb.123.2023.09.24.22.38.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 22:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=M490nm+Y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8D9FF807D8CD; Sun, 24 Sep 2023 12:26:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230090AbjIXT0h (ORCPT + 30 others); Sun, 24 Sep 2023 15:26:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230289AbjIXT03 (ORCPT ); Sun, 24 Sep 2023 15:26:29 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1FC6103 for ; Sun, 24 Sep 2023 12:26:21 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c108e106f0so83255011fa.1 for ; Sun, 24 Sep 2023 12:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695583580; x=1696188380; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8y8h3EEz9VirQFhjmojPuvqBkQuqu/oUUWDuJnG4W+c=; b=M490nm+YnzsS6uGhB710H9q5n9pSWJMhz7Du4/0xk4nZK0Ys+uQn4Rm8otYw8m9+1k u9xbfRQn1GzqHGa1iKRf6xcTxJzMbHVvJac+dMci9JaGylp++6jSvxebueL4FBTQxqvm dHpQ5ybxVUrq87WFvtFvt46SdGr1qYOuTqO2HtH7UH9Z7nB4iuBdMXj5O42c92goH7Nf +ak19+ncEObB/QnBYQHPJ6o8ucjL6Ync/7Vo1ZfqN9En8mKIEvahRPbkY0c5n4ICKTJM E0dKoHjHlFvHD7KTrFs/jAgx3/qAJW3yLpejl3eLAnGUvWqjt1/4wtwROgkNhPVRisUy YspA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695583580; x=1696188380; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8y8h3EEz9VirQFhjmojPuvqBkQuqu/oUUWDuJnG4W+c=; b=t+hP4j/ZlJBzOa1G3qZH/WS0/foeZ4OUZvm6f+nlfBe+EzBt/3+g/d5CPOZzwqhoyQ yrWb/5esaqa8yd5YJ4lBzyYl40+bGvWT0CN9+EclO9qJHPZKk43OMYqfX8PsGN2lD+JZ nALUaNVVFLEVCjUDvxeB6zLETOljcyQYTi+4GRBco6D46jmZEEX/IJXNQ1vmXd2dgUrJ 6rzSeiGGmAiAplmxOJyu5pWuhcKPK1WOsKw8yT8QHxWD+UXsrhahmm7pfN+dps1JMc9b qvaDsRYZyY8IlxKGBGzLQo2FW/5+P5EU/j3PsNWuGeLH4HVg0X2TzyDHHSADrgq8ffZJ AdmA== X-Gm-Message-State: AOJu0Ywfm2lQhyrqwjGwXFnusC3KFDL9mkYEyu45O/o9Myaauhy9j/ze D5R4zMRFJz6dduOqnTR0nmQ= X-Received: by 2002:a2e:2417:0:b0:2c0:2ab7:9ab5 with SMTP id k23-20020a2e2417000000b002c02ab79ab5mr4174912ljk.12.1695583579523; Sun, 24 Sep 2023 12:26:19 -0700 (PDT) Received: from localhost.localdomain (82-149-12-148.dynamic.telemach.net. [82.149.12.148]) by smtp.gmail.com with ESMTPSA id z21-20020a1709063a1500b0099d0c0bb92bsm5317632eje.80.2023.09.24.12.26.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 12:26:19 -0700 (PDT) From: Jernej Skrabec To: mripard@kernel.org, wens@csie.org Cc: airlied@gmail.com, daniel@ffwll.ch, samuel@sholland.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH 7/7] drm/sun4i: dw-hdmi: check for phy device first Date: Sun, 24 Sep 2023 21:26:04 +0200 Message-ID: <20230924192604.3262187-8-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230924192604.3262187-1-jernej.skrabec@gmail.com> References: <20230924192604.3262187-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 24 Sep 2023 12:26:45 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777986783222929495 X-GMAIL-MSGID: 1777986783222929495 Let's check for phy device first. Since it uses much of the same clocks and resets it also lowers amount of possible deferred probes. While at it, don't report error for deferred phy probe. Signed-off-by: Jernej Skrabec Acked-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 35 +++++++++++++-------------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index 41f815a1faec..c1becd964326 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -173,11 +173,24 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, struct device_node *phy_node; struct drm_encoder *encoder; struct sun8i_dw_hdmi *hdmi; + struct sun8i_hdmi_phy *phy; int ret; if (!pdev->dev.of_node) return -ENODEV; + phy_node = of_parse_phandle(dev->of_node, "phys", 0); + if (!phy_node) { + dev_err(dev, "Can't find PHY phandle\n"); + return -EINVAL; + } + + phy = sun8i_hdmi_phy_get(phy_node); + of_node_put(phy_node); + if (IS_ERR(phy)) + return dev_err_probe(dev, PTR_ERR(phy), + "Couldn't get the HDMI PHY\n"); + hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL); if (!hdmi) return -ENOMEM; @@ -185,6 +198,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, plat_data = &hdmi->plat_data; hdmi->dev = &pdev->dev; encoder = &hdmi->encoder; + hdmi->phy = phy; hdmi->quirks = of_device_get_match_data(dev); @@ -232,22 +246,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, goto err_assert_ctrl_reset; } - phy_node = of_parse_phandle(dev->of_node, "phys", 0); - if (!phy_node) { - dev_err(dev, "Can't found PHY phandle\n"); - ret = -EINVAL; - goto err_disable_clk_tmds; - } - - hdmi->phy = sun8i_hdmi_phy_get(phy_node); - of_node_put(phy_node); - if (IS_ERR(hdmi->phy)) { - dev_err(dev, "Couldn't get the HDMI PHY\n"); - ret = PTR_ERR(hdmi->phy); - goto err_disable_clk_tmds; - } - - ret = sun8i_hdmi_phy_init(hdmi->phy); + ret = sun8i_hdmi_phy_init(phy); if (ret) goto err_disable_clk_tmds; @@ -259,7 +258,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, plat_data->mode_valid = hdmi->quirks->mode_valid; plat_data->use_drm_infoframe = hdmi->quirks->use_drm_infoframe; plat_data->output_port = 1; - sun8i_hdmi_phy_set_ops(hdmi->phy, plat_data); + sun8i_hdmi_phy_set_ops(phy, plat_data); platform_set_drvdata(pdev, hdmi); @@ -310,7 +309,7 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, drm_bridge_remove(&hdmi->enc_bridge); dw_hdmi_remove(hdmi->hdmi); err_deinit_phy: - sun8i_hdmi_phy_deinit(hdmi->phy); + sun8i_hdmi_phy_deinit(phy); err_disable_clk_tmds: clk_disable_unprepare(hdmi->clk_tmds); err_assert_ctrl_reset: