| Message ID | 20211122065223.88059-5-jagan@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD7MFH7A7EEBB4X45SGAMGQE77TCANA@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 340A33F15A for <linux-amarula@patchwork.amarulasolutions.com>; Mon, 22 Nov 2021 07:53:40 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id b8-20020a17090a10c800b001a61dff6c9dsf5500232pje.5 for <linux-amarula@patchwork.amarulasolutions.com>; Sun, 21 Nov 2021 22:53:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564019; cv=pass; d=google.com; s=arc-20160816; b=dFR3mSaX3FN/MG6kr8UoBdZ6mjp1lXdfXh9plyAZw9hXrl0mFYKsks/hW8Vb3thav1 OjY2jabO2uUkM5y6ZskG7KVmGE5KGFcFQwODoRDHt8RitjU3XV2OElRxX5EBFUqq2a98 6lFGjoN0IkvH5BswEdgv+ihf4VXp7ssEsXJiTMEUVI3I4YWK1/d7cyDb4FR1zdi4kXpo GZoFLTSdKsx3d1ygXotz5TUvh+Bj2SGSE6C7r4CzDHjrpPIQqGpMVM7IA+vWfBhExhZQ JCJUEMDigT8dZFqLFHVr5JCSbwOylZaIq7aiPEDbXAQrdUy4ESsCOQymbLOnTBVf1mri xD5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5lPxhlMyKjftImxO9PdCwhCYlbmhBGJs5oDaXwoJC9c=; b=yK/n+Lfv0oguZy3eULTutnbf0X6fiCQwFePN25AeSPDq6A1n3P0aIk+94zaCtYgJ8w 2KVOGkDcUDnyxVoW3UmH2AaT6XNg0UNJHdLEYGgnO2YuxO4S5iyEWnY6Fv0gRMfIUH2W 5IvttqShH1KkJZdEFSSaN3aUQ3nBS1hqkjXfgY47ex0Z/Bdd9mSZOAY8kz9/ptuOtTO5 mn0U0T8m7kQ13JfpR9bxMDGz+3te3VFkrzUxWyk12ftrBLSjL0+xFiFvS9E88d/4Z6l8 Afn+4fqT2sOKvLXWgJ2TGphVo+1vc2BtlolNRLit8OeWpCCtdyNYI6+Wf1A6u2qpj6SB tfmA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bIadhJCz; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=5lPxhlMyKjftImxO9PdCwhCYlbmhBGJs5oDaXwoJC9c=; b=dMSCFrxSawH6T8KVbdpTyWDXZ89P4M6ECzFEhFWQFjJhi8VcJFYwTB4UaUc0vHR+uN LT9lbKRUKfg15mZ7srYM/Aqdu1QslVUe3ceyWnHsNfpfFl+//GOUYCn7ZpyTSCtf6heU tTrZNlZKgzQD2JqWF9xDy8x/jnEBUqTCQ9TyU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=5lPxhlMyKjftImxO9PdCwhCYlbmhBGJs5oDaXwoJC9c=; b=VbUCBrKAqjADxjFklFDHpkXh6pJU1Y886LCv9u0ZbbtpRCrzo2vnX154AFF7iVmmnj JdlcMiBXRrEZcxSXz45ZwokyMw0pHVJlVyHRupXWfoaO8d4oxWYmFxgSfE1Uh8yTjyCm EF4PN30xVNXCclypdCou6Pn8oR+OkwZDFro1g07+FCp9foRpKJ9z8k3vQ4N3IGw6o7LU Ef2O9zxVgP4lnjc3YY/cFXK2aeRycAIQRC4VlBahW6yjPKNz6w+1fDXBtzDFNQHAmGLn rNmrvVuFLcKlHwudHnra2a1vU932Q6peWzxYMtuQXxY+YMGi98YWOzDOjgnHA5un7pep 56xQ== X-Gm-Message-State: AOAM532gEJhfWg5NDWzKZMDKQru38YMmSPnYDdMVMY6aiNs0YEPQ9M0j AzXty2Nj0P3Naf3ouIr1nyjUrTIP X-Google-Smtp-Source: ABdhPJwsMBj+fgp29XOoGEnoBjwYQfluu1pgKRiFe2lX53NZv2wvJzd2YWhJEHD2EjHtP0DVO4dsJg== X-Received: by 2002:a17:902:c245:b0:141:f279:1c72 with SMTP id 5-20020a170902c24500b00141f2791c72mr103361082plg.18.1637564018956; Sun, 21 Nov 2021 22:53:38 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:a81:: with SMTP id b1ls2397254pfl.3.gmail; Sun, 21 Nov 2021 22:53:38 -0800 (PST) X-Received: by 2002:a63:5646:: with SMTP id g6mr31226652pgm.216.1637564018289; Sun, 21 Nov 2021 22:53:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564018; cv=none; d=google.com; s=arc-20160816; b=yNz9hOdrJ9P0/K8b0JlD5Ou8L1p5d7nvGwStHqOTzIcPtEBpgo79qSrT34yB0zZwQa fU8V0BTVyrLfPXkwUMSOU5r3ZhdWEV9RoB9DQ4G0dkUVV29JrpPPVFDUif7gbLoJLZaL v4raEoiJHMXrkHyjoIUbcwprRon+pvCDexXF6yKYd5X0vg0FlyNsIjh96p53TOWD5dwE WCsH5avsaOBChpvyStAd2XhapSWBlP26n8f7+gRl/I8aj5YnVZO5XUsjkXfc3hCwgRDw dxU6Eolw/DL11T+h+yOL3a6KGnQQyY5iUjyR1USjzq+ACyEpTsrSZoXZTsdaxh1XSvtZ iJog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=wJ/t6jM/jyN5QXpQAEFQjSGSqfZWlxA85S7ihcjleN4=; b=lkl8OMBKRH/urNNIP4wMo/R5QFoJS9odoEtadCH/xclRNHVUe5eXkW4/mpSLdLISGw aLkNzjJNIDLV0xKqWo8clcBJ2QrVannG0TUbLVbLeuPBe+XZFHGy1ul6MFAr8nCg9wLH JCO4x9Y3HujkrYhfsdX9tTMx5IllB+ukoT+R+yG0dY2GTe6MWbt8HZrZsZuz2cecK3dR EjsoP5UmADzFhWLsatx8yK7psXBw/7BVBkYT/aHaE1Ag9QIAl1haooV4zCH08ms7qEd7 FTfBJlv8JhJCzdH+v+xewUy9e1gUNQ9kLbSmoN62KE6jOCykeWm+47q20EaAJcLLr8ky Wpew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bIadhJCz; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id na2sor12331534pjb.43.2021.11.21.22.53.38 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Sun, 21 Nov 2021 22:53:38 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90a:e7ca:: with SMTP id kb10mr28171937pjb.8.1637564018014; Sun, 21 Nov 2021 22:53:38 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:37 -0800 (PST) From: Jagan Teki <jagan@amarulasolutions.com> To: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Neil Armstrong <narmstrong@baylibre.com>, Robert Foss <robert.foss@linaro.org>, Sam Ravnborg <sam@ravnborg.org> Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki <jagan@amarulasolutions.com> Subject: [PATCH v5 4/7] drm: sun4i: dsi: Add mode_set function Date: Mon, 22 Nov 2021 12:22:20 +0530 Message-Id: <20211122065223.88059-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bIadhJCz; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
drm: sun4i: dsi: Convert drm bridge
|
|
Commit Message
Jagan Teki
Nov. 22, 2021, 6:52 a.m. UTC
Get the display mode settings via mode_set bridge function
instead of explicitly de-reference.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v5:
- new patch
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++-
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
Comments
On Mon, Nov 22, 2021 at 12:22:20PM +0530, Jagan Teki wrote: > Get the display mode settings via mode_set bridge function > instead of explicitly de-reference. What's wrong with dereferencing the mode? Maxime
On Mon, Nov 22, 2021 at 3:38 PM Maxime Ripard <maxime@cerno.tech> wrote: > > On Mon, Nov 22, 2021 at 12:22:20PM +0530, Jagan Teki wrote: > > Get the display mode settings via mode_set bridge function > > instead of explicitly de-reference. > > What's wrong with dereferencing the mode? Nothing wrong with dereferencing, however we have built-in API to that job. Jagan.
On Mon, Nov 22, 2021 at 06:35:58PM +0530, Jagan Teki wrote: > On Mon, Nov 22, 2021 at 3:38 PM Maxime Ripard <maxime@cerno.tech> wrote: > > > > On Mon, Nov 22, 2021 at 12:22:20PM +0530, Jagan Teki wrote: > > > Get the display mode settings via mode_set bridge function > > > instead of explicitly de-reference. > > > > What's wrong with dereferencing the mode? > > Nothing wrong with dereferencing, however we have built-in API to that job. That's not an API though? It's perfectly valid to dereference the pointer in atomic_enable, and that patch would consume memory for no particular reason. Maxime
Hi Maxime, On Mon, Nov 22, 2021 at 6:58 PM Maxime Ripard <maxime@cerno.tech> wrote: > > On Mon, Nov 22, 2021 at 06:35:58PM +0530, Jagan Teki wrote: > > On Mon, Nov 22, 2021 at 3:38 PM Maxime Ripard <maxime@cerno.tech> wrote: > > > > > > On Mon, Nov 22, 2021 at 12:22:20PM +0530, Jagan Teki wrote: > > > > Get the display mode settings via mode_set bridge function > > > > instead of explicitly de-reference. > > > > > > What's wrong with dereferencing the mode? > > > > Nothing wrong with dereferencing, however we have built-in API to that job. > > That's not an API though? May be we can call it bridge or encoding function, I usually call these ops are API's. > > It's perfectly valid to dereference the pointer in atomic_enable, and > that patch would consume memory for no particular reason. Again, I'm not pointing any mistake in dereference and certainly not understand about what memory consumption issue here. I'm doing it here since I'm doing it via mode_set in other drivers. No problem for me either way. Thanks, Jagan.
On Mon, Nov 22, 2021 at 07:21:57PM +0530, Jagan Teki wrote: > > It's perfectly valid to dereference the pointer in atomic_enable, and > > that patch would consume memory for no particular reason. > > Again, I'm not pointing any mistake in dereference and certainly not > understand about what memory consumption issue here. You add a struct drm_display_mode field to struct sun6i_dsi. It increases the size of struct sun6i_dsi of sizeof(struct drm_display_mode). > I'm doing it here since I'm doing it via mode_set in other drivers. No > problem for me either way. But *why* are you doing so? There might be a valid reason in other drivers, but there's none here (that you mentioned at least). Maxime
On Mon, Nov 22, 2021 at 7:39 PM Maxime Ripard <maxime@cerno.tech> wrote: > > On Mon, Nov 22, 2021 at 07:21:57PM +0530, Jagan Teki wrote: > > > It's perfectly valid to dereference the pointer in atomic_enable, and > > > that patch would consume memory for no particular reason. > > > > Again, I'm not pointing any mistake in dereference and certainly not > > understand about what memory consumption issue here. > > You add a struct drm_display_mode field to struct sun6i_dsi. It > increases the size of struct sun6i_dsi of sizeof(struct > drm_display_mode). > > > I'm doing it here since I'm doing it via mode_set in other drivers. No > > problem for me either way. > > But *why* are you doing so? > > There might be a valid reason in other drivers, but there's none here > (that you mentioned at least). The reason is to use existing bridge function instead of dereference ie what I've mentioned. I don't have any other reasons. Jagan.
On Mon, Nov 22, 2021 at 08:01:47PM +0530, Jagan Teki wrote: > On Mon, Nov 22, 2021 at 7:39 PM Maxime Ripard <maxime@cerno.tech> wrote: > > > > On Mon, Nov 22, 2021 at 07:21:57PM +0530, Jagan Teki wrote: > > > > It's perfectly valid to dereference the pointer in atomic_enable, and > > > > that patch would consume memory for no particular reason. > > > > > > Again, I'm not pointing any mistake in dereference and certainly not > > > understand about what memory consumption issue here. > > > > You add a struct drm_display_mode field to struct sun6i_dsi. It > > increases the size of struct sun6i_dsi of sizeof(struct > > drm_display_mode). > > > > > I'm doing it here since I'm doing it via mode_set in other drivers. No > > > problem for me either way. > > > > But *why* are you doing so? > > > > There might be a valid reason in other drivers, but there's none here > > (that you mentioned at least). > > The reason is to use existing bridge function instead of dereference > ie what I've mentioned. I don't have any other reasons. This discussion is going in circles. Unless you have a reason other than "because we can", NAK for the reasons already stated above. Maxime
On Mon, Nov 22, 2021 at 8:36 PM Maxime Ripard <maxime@cerno.tech> wrote: > > On Mon, Nov 22, 2021 at 08:01:47PM +0530, Jagan Teki wrote: > > On Mon, Nov 22, 2021 at 7:39 PM Maxime Ripard <maxime@cerno.tech> wrote: > > > > > > On Mon, Nov 22, 2021 at 07:21:57PM +0530, Jagan Teki wrote: > > > > > It's perfectly valid to dereference the pointer in atomic_enable, and > > > > > that patch would consume memory for no particular reason. > > > > > > > > Again, I'm not pointing any mistake in dereference and certainly not > > > > understand about what memory consumption issue here. > > > > > > You add a struct drm_display_mode field to struct sun6i_dsi. It > > > increases the size of struct sun6i_dsi of sizeof(struct > > > drm_display_mode). > > > > > > > I'm doing it here since I'm doing it via mode_set in other drivers. No > > > > problem for me either way. > > > > > > But *why* are you doing so? > > > > > > There might be a valid reason in other drivers, but there's none here > > > (that you mentioned at least). > > > > The reason is to use existing bridge function instead of dereference > > ie what I've mentioned. I don't have any other reasons. > > This discussion is going in circles. Unless you have a reason other than > "because we can", NAK for the reasons already stated above. Agreed your point. Thanks, Jagan.
diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index a6a272b55f77..731af31e2bde 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -718,7 +718,7 @@ static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); - struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; + struct drm_display_mode *mode = &dsi->mode; struct mipi_dsi_device *device = dsi->device; union phy_configure_opts opts = { }; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; @@ -854,6 +854,15 @@ static const struct drm_connector_funcs sun6i_dsi_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; +static void sun6i_dsi_bridge_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) +{ + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); + + drm_mode_copy(&dsi->mode, adjusted_mode); +} + static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { @@ -872,6 +881,7 @@ static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = sun6i_dsi_bridge_atomic_enable, .atomic_disable = sun6i_dsi_bridge_atomic_disable, + .mode_set = sun6i_dsi_bridge_mode_set, .attach = sun6i_dsi_bridge_attach, }; diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index d269304691c9..acdd586a4157 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -20,6 +20,7 @@ struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder; struct mipi_dsi_host host; + struct drm_display_mode mode; struct clk *bus_clk; struct clk *mod_clk;