From: Sam Ravnborg <sam@ravnborg.org>
To: dri-devel@lists.freedesktop.org,
Andrzej Hajda <andrzej.hajda@intel.com>,
Neil Armstrong <narmstrong@baylibre.com>,
Robert Foss <robert.foss@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Jonas Karlman <jonas@kwiboo.se>,
Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>, Benson Leung <bleung@chromium.org>,
Cai Huoqing <cai.huoqing@linux.dev>,
chrome-platform@lists.linux.dev,
Chun-Kuang Hu <chunkuang.hu@kernel.org>,
Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
Daniel Vetter <daniel@ffwll.ch>, David Airlie <airlied@linux.ie>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Guenter Roeck <groeck@chromium.org>,
Jitao Shi <jitao.shi@mediatek.com>,
Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
linux-renesas-soc@vger.kernel.org,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Maxime Ripard <mripard@kernel.org>,
Philip Chen <philipchen@chromium.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Sam Ravnborg <sam@ravnborg.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Subject: [PATCH v1 06/12] drm/bridge: cros-ec-anx7688: Use drm_bridge_funcs.atomic_check
Date: Sun, 17 Jul 2022 19:44:48 +0200 [thread overview]
Message-ID: <20220717174454.46616-7-sam@ravnborg.org> (raw)
In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org>
Replace the deprecated drm_bridge_funcs.mode_fixup() with
drm_bridge_funcs.atomic_check().
drm_bridge_funcs.atomic_check() requires the atomic state operations,
update these to the default implementations.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Benson Leung <bleung@chromium.org>
Cc: Guenter Roeck <groeck@chromium.org>
Cc: chrome-platform@lists.linux.dev
---
drivers/gpu/drm/bridge/cros-ec-anx7688.c | 28 +++++++++++++++---------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/bridge/cros-ec-anx7688.c b/drivers/gpu/drm/bridge/cros-ec-anx7688.c
index 0f6d907432e3..fc19ea87926f 100644
--- a/drivers/gpu/drm/bridge/cros-ec-anx7688.c
+++ b/drivers/gpu/drm/bridge/cros-ec-anx7688.c
@@ -5,6 +5,7 @@
* Copyright 2020 Google LLC
*/
+#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_print.h>
#include <linux/i2c.h>
@@ -45,9 +46,10 @@ bridge_to_cros_ec_anx7688(struct drm_bridge *bridge)
return container_of(bridge, struct cros_ec_anx7688, bridge);
}
-static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
- const struct drm_display_mode *mode,
- struct drm_display_mode *adjusted_mode)
+static int cros_ec_anx7688_bridge_atomic_check(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
{
struct cros_ec_anx7688 *anx = bridge_to_cros_ec_anx7688(bridge);
int totalbw, requiredbw;
@@ -56,13 +58,13 @@ static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
int ret;
if (!anx->filter)
- return true;
+ return 0;
/* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */
ret = regmap_bulk_read(anx->regmap, ANX7688_DP_BANDWIDTH_REG, regs, 2);
if (ret < 0) {
DRM_ERROR("Failed to read bandwidth/lane count\n");
- return false;
+ return ret;
}
dpbw = regs[0];
lanecount = regs[1];
@@ -71,28 +73,34 @@ static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge,
if (dpbw > 0x19 || lanecount > 2) {
DRM_ERROR("Invalid bandwidth/lane count (%02x/%d)\n", dpbw,
lanecount);
- return false;
+ return -EINVAL;
}
/* Compute available bandwidth (kHz) */
totalbw = dpbw * lanecount * 270000 * 8 / 10;
/* Required bandwidth (8 bpc, kHz) */
- requiredbw = mode->clock * 8 * 3;
+ requiredbw = crtc_state->mode.clock * 8 * 3;
DRM_DEBUG_KMS("DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n",
totalbw, dpbw, lanecount, requiredbw);
if (totalbw == 0) {
DRM_ERROR("Bandwidth/lane count are 0, not rejecting modes\n");
- return true;
+ return 0;
}
- return totalbw >= requiredbw;
+ if (totalbw < requiredbw)
+ return -EINVAL;
+
+ return 0;
}
static const struct drm_bridge_funcs cros_ec_anx7688_bridge_funcs = {
- .mode_fixup = cros_ec_anx7688_bridge_mode_fixup,
+ .atomic_check = cros_ec_anx7688_bridge_atomic_check,
+ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+ .atomic_reset = drm_atomic_helper_bridge_reset,
};
static int cros_ec_anx7688_bridge_probe(struct i2c_client *client)
--
2.34.1
next prev parent reply other threads:[~2022-07-17 17:45 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-17 17:44 [PATCH v1 0/12] drm bridge updates Sam Ravnborg
2022-07-17 17:44 ` [PATCH v1 01/12] drm/bridge: ps8640: Use atomic variants of drm_bridge_funcs Sam Ravnborg
2022-09-19 15:17 ` Laurent Pinchart
2022-07-17 17:44 ` [PATCH v1 02/12] drm/bridge: Drop unused drm_bridge_chain functions Sam Ravnborg
2022-07-17 17:44 ` [PATCH v1 03/12] drm/mediatek: Drop chain_mode_fixup call in mode_valid() Sam Ravnborg
2022-09-18 4:45 ` Chun-Kuang Hu
2022-09-19 15:18 ` Laurent Pinchart
2022-07-17 17:44 ` [PATCH v1 04/12] drm/bridge: Drop drm_bridge_chain_mode_fixup Sam Ravnborg
2022-09-19 15:19 ` Laurent Pinchart
2022-07-17 17:44 ` [PATCH v1 05/12] drm/bridge: sii8620: Use drm_bridge_funcs.atomic_check Sam Ravnborg
2022-07-19 13:59 ` Dave Stevenson
2022-09-19 15:27 ` Laurent Pinchart
2022-07-17 17:44 ` Sam Ravnborg [this message]
2022-07-19 14:03 ` [PATCH v1 06/12] drm/bridge: cros-ec-anx7688: " Dave Stevenson
2022-09-19 15:28 ` Laurent Pinchart
2022-07-17 17:44 ` [PATCH v1 07/12] drm/bridge: tc358767: " Sam Ravnborg
2022-07-19 14:08 ` Dave Stevenson
2022-09-19 15:29 ` Laurent Pinchart
2022-09-19 15:38 ` Laurent Pinchart
2022-07-17 17:57 ` [PATCH v1 08/12] drm/mediatek: Drop mtk_hdmi_bridge_mode_fixup Sam Ravnborg
2022-07-17 17:57 ` [PATCH v1 09/12] drm/rcar-du: lvds: Use drm_bridge_funcs.atomic_check Sam Ravnborg
2022-07-19 14:11 ` Dave Stevenson
2022-09-19 15:31 ` Laurent Pinchart
2022-07-17 17:57 ` [PATCH v1 10/12] drm/omapdrm: " Sam Ravnborg
2022-09-19 15:33 ` Laurent Pinchart
2022-07-17 17:58 ` [PATCH v1 11/12] drm/bridge: Drop drm_bridge_funcs.mode_fixup Sam Ravnborg
2022-07-19 14:22 ` Dave Stevenson
2022-09-19 15:34 ` Laurent Pinchart
2022-07-17 17:58 ` [PATCH v1 12/12] drm/todo: Add bridge related todo items Sam Ravnborg
2022-07-18 10:27 ` Dave Stevenson
2022-07-18 18:00 ` Sam Ravnborg
2022-07-19 10:47 ` Dave Stevenson
2022-07-19 14:09 ` [PATCH v1 08/12] drm/mediatek: Drop mtk_hdmi_bridge_mode_fixup Dave Stevenson
2022-09-18 4:46 ` Chun-Kuang Hu
2022-09-19 15:30 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220717174454.46616-7-sam@ravnborg.org \
--to=sam@ravnborg.org \
--cc=airlied@linux.ie \
--cc=andrzej.hajda@intel.com \
--cc=arnd@arndb.de \
--cc=bleung@chromium.org \
--cc=cai.huoqing@linux.dev \
--cc=chrome-platform@lists.linux.dev \
--cc=chunkuang.hu@kernel.org \
--cc=dafna.hirschfeld@collabora.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=enric.balletbo@collabora.com \
--cc=groeck@chromium.org \
--cc=jernej.skrabec@gmail.com \
--cc=jitao.shi@mediatek.com \
--cc=jonas@kwiboo.se \
--cc=kieran.bingham+renesas@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthias.bgg@gmail.com \
--cc=mripard@kernel.org \
--cc=narmstrong@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=philipchen@chromium.org \
--cc=robert.foss@linaro.org \
--cc=tomi.valkeinen@ideasonboard.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox