From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) (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 CE8862FCFE8 for ; Wed, 25 Jun 2025 16:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.197 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750869990; cv=none; b=fInJnDG2MTiCoSCc8MWgZ6VooCNk9vUpImaYt8WJYhVqaWXLi2popPvA2s28nOECQHuDLUsrV6VQiNvCOi9hUJ5no69iu3BBgjOMIGOyPy5b1TlFdRKHpMdbg2v3ADyygSPIU0LSEsp+kq1J9jyAVwsgu7koRdpc6j1/h9YAHgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750869990; c=relaxed/simple; bh=j0l0ZjU43QQC4HrQG71y9KMmNZX2uOZiGpVn77BnE1A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mUa2AwHcP/GWZbszyFbZnnRhwuAWSOeJbmdPxgAXjzu0YUeohJ5pAJI3UWtV51aXlkRSRnxajI68tcVqUxer8JvT0H0bv/aPNi+5oWtRlugyzLBJv6Y+iKq1jAUa7JZ4dAigbTcD6Ed9EsBZu83T9peYHSad9fNgnsopCPELdhs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=f3ZG4WsA; arc=none smtp.client-ip=217.70.183.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="f3ZG4WsA" Received: by mail.gandi.net (Postfix) with ESMTPSA id C41094437E; Wed, 25 Jun 2025 16:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1750869987; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fWAgdYIhe6WRxC8lPfOBRIJNcNMxQ9jgzYlq7+Z1pYI=; b=f3ZG4WsAd8pCNZFsWigf1jN4+wCzNAyxyqy7bG4EkmH1wpIQ7NM9UJzwsLLMj7n/YqZbKQ fvTiBHGbpnHGz5FZBscC+Jrg4yOAViIKjVTl/I6haOGJJHCcJWoPL0k+Fu8ErB+zYpXl4U gf33JNIosj8d0suoHVPuL78ZmiK//2oHQJ+7ymWOKu2qplqhcQLrOyIapLEft1JZaXhpXx s+ihgISCTX9IEHZT3Regv4hRN2Q4VFn/dfH0wDjUMWbKF2DrnetgUGlFZu6V+MtBWxOs1W w5bBaaL2ol/9BW+9Wl9ChPitf5Y3wBbne7+XC5wYJuFaiOiRaqGddjRf4NbWmw== From: Luca Ceresoli Date: Wed, 25 Jun 2025 18:45:33 +0200 Subject: [PATCH 29/32] drm/bridge: synopsys: dw-mipi-dsi: convert to the .attach_new op 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-Transfer-Encoding: 7bit Message-Id: <20250625-drm-dsi-host-no-device-ptr-v1-29-e36bc258a7c5@bootlin.com> References: <20250625-drm-dsi-host-no-device-ptr-v1-0-e36bc258a7c5@bootlin.com> In-Reply-To: <20250625-drm-dsi-host-no-device-ptr-v1-0-e36bc258a7c5@bootlin.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Inki Dae , Jagan Teki , Marek Szyprowski , Jani Nikula , Dmitry Baryshkov Cc: Hui Pu , Thomas Petazzoni , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sunxi@lists.linux.dev, Luca Ceresoli X-Mailer: b4 0.14.2 X-GND-State: clean X-GND-Score: -100 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgddvfedvkecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephfffufggtgfgkfhfjgfvvefosehtjeertdertdejnecuhfhrohhmpefnuhgtrgcuvegvrhgvshholhhiuceolhhutggrrdgtvghrvghsohhlihessghoohhtlhhinhdrtghomheqnecuggftrfgrthhtvghrnhepieeiuedvffetgfeuudelheeutefggfejieettdetteekueeuueeukeevvedvueevnecukfhppedvrgdtvdemieejtdemvddtvddtmegvrgdtudemsggvgedumeelhegvjeemfeegfeemledufegvnecuvehluhhsthgvrhfuihiivgepvdeknecurfgrrhgrmhepihhnvghtpedvrgdtvdemieejtdemvddtvddtmegvrgdtudemsggvgedumeelhegvjeemfeegfeemledufegvpdhhvghloheplgduledvrdduieekrddujeekrdejhegnpdhmrghilhhfrhhomheplhhutggrrdgtvghrvghsohhlihessghoohhtlhhinhdrtghomhdpnhgspghrtghpthhtohepvddvpdhrtghpthhtohepjhhonhgrsheskhifihgsohhordhsvgdprhgtphhtthhopehthhhomhgrshdrphgvthgriiiiohhnihessghoohhtlhhinhdrtghomhdprhgtphhtthhopehlihhnuhigqdhsuhhngihisehlihhsthhsrdhlihhnuhigrdguvghvp dhrtghpthhtohepmhdrshiihihprhhofihskhhisehsrghmshhunhhgrdgtohhmpdhrtghpthhtoheprhhfohhssheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhgrrghrthgvnhdrlhgrnhhkhhhorhhstheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehnvghilhdrrghrmhhsthhrohhngheslhhinhgrrhhordhorhhgpdhrtghpthhtohepjhgrnhhirdhnihhkuhhlrgeslhhinhhugidrihhnthgvlhdrtghomh X-GND-Sasl: luca.ceresoli@bootlin.com This op does not pass any pointer to the DSI device, so the DSI host driver cannot store it. This requires propagating the change to the dw-mipi-dsi-specific host op in struct dw_mipi_dsi_host_ops and thus to the drivers based on dw-mipi-dsi.c. Among those, the meson driver uses the DSI device format parameters in various places outside the .attach op, and currently it does so by storing a pointer to the struct mipi_dsi_device. That's exactly what .attach_new aims at removing, so store a copy of the format parameters instead of the struct mipi_dsi_device pointer. Signed-off-by: Luca Ceresoli --- drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c | 4 ++-- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 18 +++++++++--------- drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 16 ++++++++-------- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 2 +- include/drm/bridge/dw_mipi_dsi.h | 3 ++- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c index bea8346515b8c8ce150040f58d288ac564eeb563..7bd48952cee571709a39fdf969f05ac61422862a 100644 --- a/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c @@ -816,11 +816,11 @@ static const struct dw_mipi_dsi_phy_ops imx93_dsi_phy_ops = { .get_timing = imx93_dsi_phy_get_timing, }; -static int imx93_dsi_host_attach(void *priv_data, struct mipi_dsi_device *device) +static int imx93_dsi_host_attach(void *priv_data, const struct mipi_dsi_bus_fmt *bus_fmt) { struct imx93_dsi *dsi = priv_data; - dsi->format = device->format; + dsi->format = bus_fmt->format; return 0; } diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c index 8fc2e282ff114db363a6cf0fe085684449b26438..ee84e773215c106651dad30de36e76a5be480553 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c @@ -315,23 +315,23 @@ static inline u32 dsi_read(struct dw_mipi_dsi *dsi, u32 reg) } static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, - struct mipi_dsi_device *device) + const struct mipi_dsi_bus_fmt *bus_fmt) { struct dw_mipi_dsi *dsi = host_to_dsi(host); const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; struct drm_bridge *bridge; int ret; - if (device->lanes > dsi->plat_data->max_data_lanes) { + if (bus_fmt->lanes > dsi->plat_data->max_data_lanes) { dev_err(dsi->dev, "the number of data lanes(%u) is too many\n", - device->lanes); + bus_fmt->lanes); return -EINVAL; } - dsi->lanes = device->lanes; - dsi->channel = device->channel; - dsi->format = device->format; - dsi->mode_flags = device->mode_flags; + dsi->lanes = bus_fmt->lanes; + dsi->channel = bus_fmt->channel; + dsi->format = bus_fmt->format; + dsi->mode_flags = bus_fmt->mode_flags; bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 1, 0); if (IS_ERR(bridge)) @@ -343,7 +343,7 @@ static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, drm_bridge_add(&dsi->bridge); if (pdata->host_ops && pdata->host_ops->attach) { - ret = pdata->host_ops->attach(pdata->priv_data, device); + ret = pdata->host_ops->attach(pdata->priv_data, bus_fmt); if (ret < 0) return ret; } @@ -537,7 +537,7 @@ static ssize_t dw_mipi_dsi_host_transfer(struct mipi_dsi_host *host, } static const struct mipi_dsi_host_ops dw_mipi_dsi_host_ops = { - .attach = dw_mipi_dsi_host_attach, + .attach_new = dw_mipi_dsi_host_attach, .detach = dw_mipi_dsi_host_detach, .transfer = dw_mipi_dsi_host_transfer, }; diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c index 4dc726cef5455075def7927a469ae23020ebfec7..b3354243a5b22d46f1cf3d8f75e602f4fc26081f 100644 --- a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c +++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c @@ -41,7 +41,7 @@ struct meson_dw_mipi_dsi { union phy_configure_opts phy_opts; struct dw_mipi_dsi *dmd; struct dw_mipi_dsi_plat_data pdata; - struct mipi_dsi_device *dsi_device; + struct mipi_dsi_bus_fmt bus_fmt; const struct drm_display_mode *mode; struct clk *bit_clk; struct clk *px_clk; @@ -110,7 +110,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data) return ret; } - switch (mipi_dsi->dsi_device->format) { + switch (mipi_dsi->bus_fmt.format) { case MIPI_DSI_FMT_RGB888: dpi_data_format = DPI_COLOR_24BIT; venc_data_width = VENC_IN_COLOR_24B; @@ -164,10 +164,10 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, mipi_dsi->mode = mode; - bpp = mipi_dsi_pixel_format_to_bpp(mipi_dsi->dsi_device->format); + bpp = mipi_dsi_pixel_format_to_bpp(mipi_dsi->bus_fmt.format); phy_mipi_dphy_get_default_config(mode->clock * 1000, - bpp, mipi_dsi->dsi_device->lanes, + bpp, mipi_dsi->bus_fmt.lanes, &mipi_dsi->phy_opts.mipi_dphy); *lane_mbps = DIV_ROUND_UP(mipi_dsi->phy_opts.mipi_dphy.hs_clk_rate, USEC_PER_SEC); @@ -220,21 +220,21 @@ static const struct dw_mipi_dsi_phy_ops meson_dw_mipi_dsi_phy_ops = { }; static int meson_dw_mipi_dsi_host_attach(void *priv_data, - struct mipi_dsi_device *device) + const struct mipi_dsi_bus_fmt *bus_fmt) { struct meson_dw_mipi_dsi *mipi_dsi = priv_data; int ret; - mipi_dsi->dsi_device = device; + mipi_dsi->bus_fmt = *bus_fmt; - switch (device->format) { + switch (bus_fmt->format) { case MIPI_DSI_FMT_RGB888: break; case MIPI_DSI_FMT_RGB666: break; case MIPI_DSI_FMT_RGB666_PACKED: case MIPI_DSI_FMT_RGB565: - dev_err(mipi_dsi->dev, "invalid pixel format %d\n", device->format); + dev_err(mipi_dsi->dev, "invalid pixel format %d\n", bus_fmt->format); return -EINVAL; } diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index 3398160ad75e4a9629082bc47491eab473caecc0..5d360d7bea9b4a6663133b440dd70cc19abee2f0 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1030,7 +1030,7 @@ static const struct component_ops dw_mipi_dsi_rockchip_ops = { }; static int dw_mipi_dsi_rockchip_host_attach(void *priv_data, - struct mipi_dsi_device *device) + const struct mipi_dsi_bus_fmt *bus_fmt) { struct dw_mipi_dsi_rockchip *dsi = priv_data; struct device *second; diff --git a/include/drm/bridge/dw_mipi_dsi.h b/include/drm/bridge/dw_mipi_dsi.h index 65d5e68065e3d8bd38986b993653c467a18e3a58..452218cb03d91fa4cdc9cd67004395bd20a9a748 100644 --- a/include/drm/bridge/dw_mipi_dsi.h +++ b/include/drm/bridge/dw_mipi_dsi.h @@ -15,6 +15,7 @@ #include #include #include +#include #include struct drm_display_mode; @@ -45,7 +46,7 @@ struct dw_mipi_dsi_phy_ops { struct dw_mipi_dsi_host_ops { int (*attach)(void *priv_data, - struct mipi_dsi_device *dsi); + const struct mipi_dsi_bus_fmt *bus_fmt); int (*detach)(void *priv_data, struct mipi_dsi_device *dsi); }; -- 2.49.0