Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp283104rdh; Thu, 26 Oct 2023 01:57:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEQy9bH0EqNjsx5qCQyjFVxmjY3jcE4bqDbvJnwA4B0B22dPT7qXqkcNhaWHqcjrG3iDqe X-Received: by 2002:a25:688b:0:b0:da0:5eea:2414 with SMTP id d133-20020a25688b000000b00da05eea2414mr6346854ybc.51.1698310668725; Thu, 26 Oct 2023 01:57:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698310668; cv=none; d=google.com; s=arc-20160816; b=f+Le6wk0sLocrkG0ALVnZY5IxUwjdFx2J12FhP70lRq9SFj6+hSNJLkItK+RZcYbPw kIbRBRB0ifDhPOkysU5VqDoSFrB5FZr3YOtAXaYCGXmVGhdsDkugEaiSxYZSN7HOyEPs Qzo8R39Qj+xeM5YehZZpCkMC7gFDtYtJFlgt7dtbPCQ3+oPI1h1GKt64HnpJtslC3HIz OXDiTmTSa1MHdoy2hKWAqtTFUrRe4cJo6UaPybnGqtsQeewGS1ac77sS/EY+8YKcubGX Nb6o2HrWEJoiNAVi3LQf2YXarM0P6tSQq+NSj5J2187VPhyqOSINbSJb1PzJgaRLjOLR LclA== 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=d15OUBlXoCJoUgZsOraHwb/V6/eE2WDwET5ZkyPx89I=; fh=LeeKzdBIBp11YaiTAyHmstMAxFr48fLCdN47jYsIapk=; b=X7AqH/tYXOotBSkiCXEMKTJTvPQ1YBWajW/t3DPpN6zJ+evADed478J7qbdGnwVt7r EZf0gp2UTtM2BBCrAaY6z6CQ5qRLBG5ZGB0mMZSo8DsJotKIS1T/xKYNyjXsmpxnrN+/ McwVDJdyfgFVmke/eyUNPKrSwRWeCztYofEA8JyS83wcrZLM8F13NCNdPwZTSc/E5ha4 WIvE/Iu8xMVzc31CJuHSmmF6akNuXxIPtkL/H0HFViWSFrf2xwHIP7JuhOa8dCp9GMBd s1WrNLSgQnfSWaEV/F3TT7tWirIIS4cns9FFwFjG+iupQP3AeSGvjVwjdpqPTb2yJw9u g4JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VGdVAsYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h145-20020a25d097000000b00d9c8a979cf8si13769814ybg.294.2023.10.26.01.57.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 01:57:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VGdVAsYl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 090E18244E52; Thu, 26 Oct 2023 01:57:46 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229834AbjJZI5j (ORCPT + 99 others); Thu, 26 Oct 2023 04:57:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbjJZI5h (ORCPT ); Thu, 26 Oct 2023 04:57:37 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDFA31AB for ; Thu, 26 Oct 2023 01:57:34 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-d81d09d883dso457641276.0 for ; Thu, 26 Oct 2023 01:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698310654; x=1698915454; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=d15OUBlXoCJoUgZsOraHwb/V6/eE2WDwET5ZkyPx89I=; b=VGdVAsYlb1hiv6kYyLytVrbDKNuOdBKi4pUjHe7VTA0caJu5yvrVqPQRJ4t1D1W3eM KrRqxJbEzYlDOjvyawUifn1SAELQ0MzA1CNT+qdG7F41T8pZVVHyzMF4EK0XNDog02Kr yHB54LgJiZAn+ymc813OAcm6xilxRpqujqgyvNY9llbMF81w10IFXKTJRjE9yAWpaIQp XiAymVmXqElSI3X0gDuKN48mBnzthQxStmQ2YMj2TjTUKeV3NnqwTILbYfZzqCdtp4GB ZEEU7F4ZK3yoFqKZPb4f9IUKM/OBhoKizEliZRLh0UwVOXP48ehxQWuWMdY5PNFq7M18 JyHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698310654; x=1698915454; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=d15OUBlXoCJoUgZsOraHwb/V6/eE2WDwET5ZkyPx89I=; b=wHkk0sdotN2OePsC3x98RtKfvO1S3y5G1MIlBtcKKp4tsY58+33tIzbHbR7LcwBApY 7kTNQdDf8GD6PaMvY0HFrt9jgMDxPtRiwTfiSIbDEQ/viqpFTzDGdF9+AvZ6R8KHPr9v kNyFB2tlCtIRUURktPFjOKYXzH5rcZRMbMnIyMObdnQKKrvqkUFSY7ah4WASb6kcWphB uNNZ1ukWf1w3DZAP/gWmcWU2/8BCa9bVoB4t91x5i0ZQIl7oPB/VbqUGKsBKaKoQ6Mdp NwjmFJsoIUq6ieqCZM29DCGoBB9B+Se+x2Gg82klz7iopK3+2Nv2RahJGS3XFsES6iIO E0mg== X-Gm-Message-State: AOJu0YzNQSmXLSL1gK1dikGMrtDZposwIN0n216tGiExIIbLoOnDRa+4 p69k1X5IUBUy9+Jav8OXzblSrg/QTvdCmnInkzr26g== X-Received: by 2002:a25:fb01:0:b0:da0:9735:b012 with SMTP id j1-20020a25fb01000000b00da09735b012mr2234616ybe.11.1698310654073; Thu, 26 Oct 2023 01:57:34 -0700 (PDT) MIME-Version: 1.0 References: <20231025103957.3776-1-keith.zhao@starfivetech.com> <20231025103957.3776-7-keith.zhao@starfivetech.com> <70805ff2-56a8-45e1-a31c-ffb0e84749e5@linaro.org> <3twc4zoohon7uujypgjtlnryfmebx4osvpykagnwr5nemmqz2w@w4vw55uswebh> In-Reply-To: <3twc4zoohon7uujypgjtlnryfmebx4osvpykagnwr5nemmqz2w@w4vw55uswebh> From: Dmitry Baryshkov Date: Thu, 26 Oct 2023 11:57:22 +0300 Message-ID: Subject: Re: [PATCH v2 6/6] drm/vs: Add hdmi driver To: Maxime Ripard Cc: Keith Zhao , 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, Krzysztof Kozlowski , Sumit Semwal , Emil Renner Berthing , Shengyang Chen , Conor Dooley , Albert Ou , Thomas Zimmermann , Jagan Teki , Rob Herring , Chris Morgan , Paul Walmsley , Bjorn Andersson , Changhuang Liang , Jack Zhu , Palmer Dabbelt , Shawn Guo , christian.koenig@amd.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Thu, 26 Oct 2023 01:57:46 -0700 (PDT) On Thu, 26 Oct 2023 at 11:07, Maxime Ripard wrote: > > On Thu, Oct 26, 2023 at 01:23:53AM +0300, Dmitry Baryshkov wrote: > > > +static int starfive_hdmi_register(struct drm_device *drm, struct starfive_hdmi *hdmi) > > > +{ > > > + struct drm_encoder *encoder = &hdmi->encoder; > > > + struct device *dev = hdmi->dev; > > > + > > > + encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node); > > > + > > > + /* > > > + * If we failed to find the CRTC(s) which this encoder is > > > + * supposed to be connected to, it's because the CRTC has > > > + * not been registered yet. Defer probing, and hope that > > > + * the required CRTC is added later. > > > + */ > > > + if (encoder->possible_crtcs == 0) > > > + return -EPROBE_DEFER; > > > + > > > + drm_encoder_helper_add(encoder, &starfive_hdmi_encoder_helper_funcs); > > > + > > > + hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; > > > + > > > + drm_connector_helper_add(&hdmi->connector, > > > + &starfive_hdmi_connector_helper_funcs); > > > + drmm_connector_init(drm, &hdmi->connector, > > > + &starfive_hdmi_connector_funcs, > > > + DRM_MODE_CONNECTOR_HDMIA, > > > > On an embedded device one can not be so sure. There can be MHL or HDMI > > Alternative Mode. Usually we use drm_bridge here and drm_bridge_connector. > > On an HDMI driver, it's far from being a requirement, especially given > the limitations bridges have. It's a blessing that things like MHL / HDMI-in-USB-C / HDMI-to-MyDP are not widely used in the wild and are mostly non-existing except several phones that preate wide DP usage. Using drm_connector directly prevents one from handling possible modifications on the board level. For example, with the DRM connector in place, handling a separate HPD GPIO will result in code duplication from the hdmi-connector driver. Handling any other variations in the board design (which are pretty common in the embedded world) will also require changing the driver itself. drm_bridge / drm_bridge_connector save us from those issues. BTW: what are the limitations of the drm_bridge wrt. HDMI output? I'm asking because we heavily depend on the bridge infrastructure for HDMI output. Maybe we are missing something there, which went unnoticed to me and my colleagues. -- With best wishes Dmitry