Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp175798lqp; Wed, 22 May 2024 00:33:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWV67pj/98N8GDVc6s/gtYesPEtk9Eb1gUPfv5no17RqhfB+9APtCcS0A+xGg+0b/dQrK/Qf2NC9wi5em+MrAhXp/bdFCp3+v+vn2KkfA== X-Google-Smtp-Source: AGHT+IHxJgeS+HAa72B5FMACRGKhPlHepQoC9/KC8q7tyxpEQEbACHtJI4smX1V1eiDd4Wj51/Bm X-Received: by 2002:a19:ac02:0:b0:523:93e8:1ced with SMTP id 2adb3069b0e04-526c0d491eamr571072e87.53.1716363198149; Wed, 22 May 2024 00:33:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716363198; cv=pass; d=google.com; s=arc-20160816; b=Rc06/NDiWaeCreCRScxN8NgiK26H74To6IH8+TZiByCnm91MhhwFKJd01ng8S2SGFd IYoHeYU9TXVnl7Ze5QlphHtvQ/lIhr+u+zjpmwTMsEbG0Kf86rlDl+G90gO0+WGunAeP ObpEu2RjE5C7tFzIkUhvhi5uQLsMxACgk89femCteYZYg0NVBC4iw3EFN/WbBuqQ++cr 8JDYr/mGkv5oV8J0QUElWp+4fY5HXok0jl3ARtPD7fnY18LuI4Q1IW+Y3dfqEMwiKhiA qcVnHBt6rkp626ubjMcylSqCxDRNyKYGa4vxeQAOU5/7l5yVGV8m3iG66O/r+uBrxl05 siLw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tPxuy6D7kMsZznQjZGgFY9Q+7xg+RL2451gUE3Gojs4=; fh=e1A6gP3FgdUtpXz+sdQmGv/jav4bqU0mM3/fZ5T492U=; b=X+KJQaMz3q9nNs0G4SjifWmKO23gnHjlfbGQIwGqhGHE05U0MBIUpSM6+bMiNMRaSp X8f1tCrTm1yyw7N0YzUPFldqhHEuu5ZZg343fZ1yxn5Wfy4RTNsuP43yb+fOFJW5tDML fe+8pDrlAl0EqTlhK/VWb41YpFn7IPWHOrXgKurbPYGxYcK7MWH6njUUM5oJXOpEkoaD p8QWbHb0y43OPSqCdWOdc2JlEb6KrTP1RWUDccd6kzoxr4Lmuw3L194FybyGvnjCyUHV RPT06prwMojlanF1fvR7IIBMpJqygSiSdp8MJg4W0ZNwcR1CvY0rEABEf88jtTNYYAmK nyOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=FG7iqI6d; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-185862-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185862-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c362bfesi15199034a12.511.2024.05.22.00.33.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 00:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185862-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=FG7iqI6d; arc=pass (i=1 spf=pass spfdomain=ideasonboard.com dkim=pass dkdomain=ideasonboard.com); spf=pass (google.com: domain of linux-kernel+bounces-185862-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185862-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A6FA01F21B77 for ; Wed, 22 May 2024 07:33:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15B463BBC9; Wed, 22 May 2024 07:33:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FG7iqI6d" Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4042819470; Wed, 22 May 2024 07:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.167.242.64 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716363188; cv=none; b=RRP0AlbTqRjU8kl9DCpmYcL5eGyNLSczo9BAciLSGZ2oYwtWmTyUVLURqUyn/7hu6fMg/yiwmtedwblqhXet5xlDxKLXoQvnPMvn5wiZ5/UgBtBvA5UOkZGrFytO/DAU6zls1TkUQmlDMTsj0maz8zHOi20qavhh6bmCi/9mDjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716363188; c=relaxed/simple; bh=/CP+fbgEX5XFpkxvApNtr2U9BrvlM+4DperW6OziTxQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WfkTSYvyN8BZHbhhQ1z4oKk7OywSlbGF25PFA5+u3cQk/VI22fWaI0XkrIG+e2WX2RCsCleQ339QbZ+k0WA0DWlgdmtiUVPNdQ7WNWM+GwnJwMR3uHC5kqXX+3zLyyHGF5a03M9t4Eo1Oz/ZdNF1adVHgY+s7N4ZyRwPShGMtUM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com; spf=pass smtp.mailfrom=ideasonboard.com; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b=FG7iqI6d; arc=none smtp.client-ip=213.167.242.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 05152581; Wed, 22 May 2024 09:32:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1716363171; bh=/CP+fbgEX5XFpkxvApNtr2U9BrvlM+4DperW6OziTxQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FG7iqI6d6LiRahUeHDB38CN5sHl/Q3UAaiplBz/Pit6ghjpZHChzof2jV2Rh/Jf7v FENvCM2RsExg7/C1GxV5pxbvo+wJKsLPOtoGdMPXkdk+/3IUH0axyxIvZRG1bs8HMJ KY92D21Kq9loYMC8EazNLkHHhchWDzEmMZN71Y54= Date: Wed, 22 May 2024 10:32:53 +0300 From: Laurent Pinchart To: Keith Zhao Cc: Alex Bee , "andrzej.hajda@intel.com" , "neil.armstrong@linaro.org" , "rfoss@kernel.org" , "jonas@kwiboo.se" , "jernej.skrabec@gmail.com" , "maarten.lankhorst@linux.intel.com" , "mripard@kernel.org" , "tzimmermann@suse.de" , "airlied@gmail.com" , "daniel@ffwll.ch" , "robh@kernel.org" , "krzk+dt@kernel.org" , "conor+dt@kernel.org" , "hjc@rock-chips.com" , "heiko@sntech.de" , "andy.yan@rock-chips.com" , Xingyu Wu , "p.zabel@pengutronix.de" , Jack Zhu , Shengyang Chen , "dri-devel@lists.freedesktop.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [PATCH v4 02/10] drm/bridge: add common api for inno hdmi Message-ID: <20240522073253.GF8863@pendragon.ideasonboard.com> References: <20240521105817.3301-1-keith.zhao@starfivetech.com> <20240521105817.3301-3-keith.zhao@starfivetech.com> <58ddfc8f-1995-4f41-9d63-35a00c6f92b9@gmail.com> <20240521154206.GA1935@pendragon.ideasonboard.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Keith, On Wed, May 22, 2024 at 05:58:00AM +0000, Keith Zhao wrote: > Hi Alex, Laurent: > > I want to make as few changes as possible on the current basis, and add bridge_fun, > > On 2024年5月21日 23:42, Laurent Pinchart wrote: > > On Tue, May 21, 2024 at 05:36:43PM +0200, Alex Bee wrote: > > > Hi Keith, > > > > > > thanks a lot for working on this. See some general remarks below > > > > > > Am 21.05.24 um 12:58 schrieb keith: > > > > Add INNO common api so that it can be used by vendor drivers which > > > > implement vendor specific extensions to Innosilicon HDMI. > > > > > > > > Signed-off-by: keith > > > > --- > > > > MAINTAINERS | 2 + > > > > drivers/gpu/drm/bridge/Kconfig | 2 + > > > > drivers/gpu/drm/bridge/Makefile | 1 + > > > > drivers/gpu/drm/bridge/innosilicon/Kconfig | 6 + > > > > drivers/gpu/drm/bridge/innosilicon/Makefile | 2 + > > > > .../gpu/drm/bridge/innosilicon/inno-hdmi.c | 587 ++++++++++++++++++ > > > > .../gpu/drm/bridge/innosilicon/inno-hdmi.h | 97 +++ > > > > include/drm/bridge/inno_hdmi.h | 69 ++ > > > > 8 files changed, 766 insertions(+) > > > > create mode 100644 drivers/gpu/drm/bridge/innosilicon/Kconfig > > > > create mode 100644 drivers/gpu/drm/bridge/innosilicon/Makefile > > > > create mode 100644 drivers/gpu/drm/bridge/innosilicon/inno-hdmi.c > > > > create mode 100644 drivers/gpu/drm/bridge/innosilicon/inno-hdmi.h > > > > create mode 100644 include/drm/bridge/inno_hdmi.h > > > > > > > .... > > > > > > > + drm_encoder_helper_add(encoder, pdata->helper_private); > > > > + > > > > + hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; > > > > + > > > > + drm_connector_helper_add(&hdmi->connector, > > > > + &inno_hdmi_connector_helper_funcs); > > > > + > > > > + drmm_connector_init(drm, &hdmi->connector, > > > > + &inno_hdmi_connector_funcs, > > > > + DRM_MODE_CONNECTOR_HDMIA, > > > > + hdmi->ddc); > > > > + > > > > > > I really don't want to anticipate bridge maintainer's feedback, but > > > new bridge drivers must not contain connector creation. That must > > > happen somewhere else. > > > > You're absolutely right :-) Connector creation should be handled by the > > drm_bridge_connector helper. The HDMI bridge driver should focus on the > > HDMI bridge itself. > > static int inno_bridge_attach(struct drm_bridge *bridge, > enum drm_bridge_attach_flags flags) > { > struct inno_hdmi *hdmi = bridge_to_inno(bridge); > > if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { > DRM_ERROR("Fix bridge driver to make connector optional!"); > return -EINVAL; > } This kind of code was added to existing bridge drivers when we transitioned to the new model where bridges don't create the connectors, because we couldn't fix all the existing bridges in one go. New bridges must do the opposite. See imx8qxp-pixel-link.c for instance, it has this code instead in its attach function: if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { DRM_DEV_ERROR(pl->dev, "do not support creating a drm_connector\n"); return -EINVAL; } (I would personally drop the DRM_DEV_ERROR message) > hdmi->connector.polled = DRM_CONNECTOR_POLL_HPD; > > drm_connector_helper_add(&hdmi->connector, > &inno_hdmi_connector_helper_funcs); > > drmm_connector_init(drm, &hdmi->connector, > &inno_hdmi_connector_funcs, > DRM_MODE_CONNECTOR_HDMIA, > hdmi->ddc); > > drm_connector_attach_encoder(&hdmi->connector, encoder); > } > > static const struct drm_bridge_funcs inno_bridge_attach = { > .attach = inno_bridge_attach, > }; > > Connector creation is handled by the drm_bridge_funcs ->attach. > Is it ok? No, the connector should be created by the display controller driver by calling drm_brige_connector_init(). It should not be created by the bridge driver. The bridge driver should provide the bridge functions (drm_bridge_funcs), but not create any connector. > > > Also I'm neither seeing any drm_brige struct nor drm_bridge_funcs, > > > which are both essential for a bridge driver. I don't think moving a > > > part of a driver to .../drm/bridge/ makes it a bridge driver. > > > > > > > + drm_connector_attach_encoder(&hdmi->connector, encoder); > > > > + > > > > + return 0; > > > > +} > > > > + > > > .... > > > -- Regards, Laurent Pinchart