From: Miquel Raynal <miquel.raynal@bootlin.com>
To: David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Sandy Huang <hjc@rock-chips.com>,
Heiko Stuebner <heiko@sntech.de>,
linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Miquel Raynal <miquel.raynal@bootlin.com>
Subject: [PATCH v2 07/11] drm/rockchip: lvds: Helpers should return decent values
Date: Tue, 24 Dec 2019 15:38:56 +0100 [thread overview]
Message-ID: <20191224143900.23567-8-miquel.raynal@bootlin.com> (raw)
In-Reply-To: <20191224143900.23567-1-miquel.raynal@bootlin.com>
Return errors instead of returning void from internal helpers. When
these helpers are called, check the returned value and print an error
message in this case.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
drivers/gpu/drm/rockchip/rockchip_lvds.c | 31 ++++++++++++++++++------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c
index 731aba25bec5..40fa49fe9fa5 100644
--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c
+++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c
@@ -214,8 +214,8 @@ struct drm_connector_helper_funcs rockchip_lvds_connector_helper_funcs = {
.get_modes = rockchip_lvds_connector_get_modes,
};
-static void rk3288_lvds_grf_config(struct drm_encoder *encoder,
- struct drm_display_mode *mode)
+static int rk3288_lvds_grf_config(struct drm_encoder *encoder,
+ struct drm_display_mode *mode)
{
struct rockchip_lvds *lvds = encoder_to_lvds(encoder);
u8 pin_hsync = (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 1 : 0;
@@ -240,10 +240,10 @@ static void rk3288_lvds_grf_config(struct drm_encoder *encoder,
val |= (pin_dclk << 8) | (pin_hsync << 9);
val |= (0xffff << 16);
ret = regmap_write(lvds->grf, RK3288_LVDS_GRF_SOC_CON7, val);
- if (ret != 0) {
+ if (ret)
DRM_DEV_ERROR(lvds->dev, "Could not write to GRF: %d\n", ret);
- return;
- }
+
+ return ret;
}
static int rk3288_lvds_set_vop_source(struct rockchip_lvds *lvds,
@@ -287,13 +287,28 @@ static void rk3288_lvds_encoder_enable(struct drm_encoder *encoder)
int ret;
drm_panel_prepare(lvds->panel);
+
ret = rk3288_lvds_poweron(lvds);
if (ret < 0) {
- DRM_DEV_ERROR(lvds->dev, "failed to power on lvds: %d\n", ret);
+ DRM_DEV_ERROR(lvds->dev, "failed to power on LVDS: %d\n", ret);
drm_panel_unprepare(lvds->panel);
+ return;
}
- rk3288_lvds_grf_config(encoder, mode);
- rk3288_lvds_set_vop_source(lvds, encoder);
+
+ ret = rk3288_lvds_grf_config(encoder, mode);
+ if (ret) {
+ DRM_DEV_ERROR(lvds->dev, "failed to configure LVDS: %d\n", ret);
+ drm_panel_unprepare(lvds->panel);
+ return;
+ }
+
+ ret = rk3288_lvds_set_vop_source(lvds, encoder);
+ if (ret) {
+ DRM_DEV_ERROR(lvds->dev, "failed to set VOP source: %d\n", ret);
+ drm_panel_unprepare(lvds->panel);
+ return;
+ }
+
drm_panel_enable(lvds->panel);
}
--
2.20.1
next prev parent reply other threads:[~2019-12-24 14:38 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-24 14:38 [PATCH v2 00/11] Add PX30 LVDS support Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 01/11] dt-bindings: display: rockchip-lvds: Declare PX30 compatible Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 02/11] dt-bindings: display: rockchip-lvds: Document PX30 PHY Miquel Raynal
2020-01-04 21:29 ` Rob Herring
2019-12-24 14:38 ` [PATCH v2 03/11] drm/rockchip: lvds: Fix indentation of a #define Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 04/11] drm/rockchip: lvds: Harmonize function names Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 05/11] drm/rockchip: lvds: Change platform data Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 06/11] drm/rockchip: lvds: Create an RK3288 specific probe function Miquel Raynal
2019-12-24 14:38 ` Miquel Raynal [this message]
2019-12-24 14:38 ` [PATCH v2 08/11] drm/rockchip: lvds: Pack functions together Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 09/11] drm/rockchip: lvds: Add PX30 support Miquel Raynal
2019-12-24 14:38 ` [PATCH v2 10/11] arm64: dts: rockchip: Add PX30 DSI DPHY Miquel Raynal
2019-12-31 11:56 ` Heiko Stuebner
2019-12-31 12:14 ` Heiko Stuebner
2019-12-31 15:41 ` Miquel Raynal
2019-12-24 14:39 ` [PATCH v2 11/11] arm64: dts: rockchip: Add PX30 LVDS Miquel Raynal
2020-01-06 11:50 ` Heiko Stuebner
2020-01-05 14:05 ` [PATCH v2 00/11] Add PX30 LVDS support Heiko Stuebner
2020-01-06 11:09 ` Heiko Stübner
2020-01-06 12:15 ` Miquel Raynal
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=20191224143900.23567-8-miquel.raynal@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maxime.chevallier@bootlin.com \
--cc=paul.kocialkowski@bootlin.com \
--cc=robh+dt@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/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;
as well as URLs for NNTP newsgroup(s).