From patchwork Wed Sep 4 11:51:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13790661 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C1455CD4849 for ; Wed, 4 Sep 2024 11:51:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1FF0F10E53E; Wed, 4 Sep 2024 11:51:49 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=tq-group.com header.i=@tq-group.com header.b="ieiD/Cmw"; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="H8m7fNcD"; dkim-atps=neutral Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 389A810E53E for ; Wed, 4 Sep 2024 11:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1725450707; x=1756986707; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9bZTQfFErD83ZpeUe8f6tUjcWK8u+2HNM0QEJ6Cyo2s=; b=ieiD/Cmw/JUkiM7mdqL2miv3qSU6BbkdUw+V9fsuEuAf/ZYohJ3Q82Cw rw9r9QM2/KTKjoWR5X60leVPZN7rc12X446WVFfFRTfmsSnx2B8wpIazT PhNRvY6PlqmJxQv5a+KDmmOeCwmF11DvBenUkTe4iLTfpJ3+DEJIqiW1x DweGcHeln7BGWZ8G5YbFCy49011CN+PkNHqAUUMG245jaQh6HNwVbd+mp /4hKnRJN8JhpGs33ZcxhDsYBOVOHeQ53tzs+D5xZF2+cG3YzsfpaRQ8zM 7KwC02Q6kWg5sPI62QhP10yIfmCm4Is9w6r04GdmRHYlPmv8CparR6I0q g==; X-CSE-ConnectionGUID: IW9Wr4ScQwiKaAfT2Jmmfw== X-CSE-MsgGUID: x6T6SRwUTl6+Zhy7GadJsw== X-IronPort-AV: E=Sophos;i="6.10,201,1719871200"; d="scan'208";a="38762014" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 04 Sep 2024 13:51:45 +0200 X-CheckPoint: {66D849D1-3-5FF8EC80-F6CEE9F8} X-MAIL-CPID: 99D071542BF70ABE41EF222ECB70A02A_0 X-Control-Analysis: str=0001.0A782F21.66D849D1.009F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id BB6F4160CE2; Wed, 4 Sep 2024 13:51:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1725450700; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=9bZTQfFErD83ZpeUe8f6tUjcWK8u+2HNM0QEJ6Cyo2s=; b=H8m7fNcDNEbr2UgXpYCbXLE6+bcLeWCbZZz7su+xMjkRotOqFgAhEmikqiKKJx+5XT1oYE bjjSyD4RShMLwboAMSKRUApxwGEuX1enHfHrZSjsHpAQIjZrGVgMhmXPpQjKISoE1hJdrx ag7k0gVjL+0HiAzQIDBltjQLPnL7wb7XbzCvRTVyViWFkDzehQufnXrEXcTHwA9IAT6LuA jMF867Ugo9ASI6NiSii4EyPKf8yJyYSUWlYZNmuUbcswdq6ipgaH62zeeZbQlO8udLagLz Cje9rXlMHttAuEPhCkqcEYzixcRmGLx8r0VMG5Pp4Eusv+wn9KkJ0LO9KyVGAQ== From: Alexander Stein To: Stefan Agner , Alison Wang , David Airlie , Daniel Vetter , Matthias Schiffer , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: Alexander Stein , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [RESEND 1/2] drm: fsl-dcu: Use dev_err_probe Date: Wed, 4 Sep 2024 13:51:34 +0200 Message-Id: <20240904115135.1843274-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" fsl_dcu_drm_modeset_init can return -EPROBE_DEFER, so use dev_err_probe to remove an invalid error message and add it to deferral description. Signed-off-by: Alexander Stein Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index a395f93449f3..90cbd18f096d 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -103,10 +103,8 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) int ret; ret = fsl_dcu_drm_modeset_init(fsl_dev); - if (ret < 0) { - dev_err(dev->dev, "failed to initialize mode setting\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev->dev, ret, "failed to initialize mode setting\n"); ret = drm_vblank_init(dev, dev->mode_config.num_crtc); if (ret < 0) { From patchwork Wed Sep 4 11:51:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13790662 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C12E3CD37B4 for ; Wed, 4 Sep 2024 11:51:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 37C2D10E552; Wed, 4 Sep 2024 11:51:52 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=tq-group.com header.i=@tq-group.com header.b="kNgEgRDJ"; dkim=fail reason="key not found in DNS" (0-bit key; unprotected) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="R8muNlAj"; dkim-atps=neutral Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2A29310E552 for ; Wed, 4 Sep 2024 11:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1725450711; x=1756986711; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ih/v3JlPgjnunjeMXetvHkaR0ZTTwffvOCV3Ri/27Bg=; b=kNgEgRDJpB2S+p9bP8y1p1SFMpWLEm/vqLpVLAHgGph2LHGovgfJOt1z PPHMk5saib3W/cSvLaRPch8jIBLZa4nHc1J2UveeGeQW0Mjxq99DVishJ FUbKC5e3mB0y/jw0LlbbRhY1ttv/n8VGepf1z2nkGlZOerTnWU5giaYFR JJaR8urau3LZs/tWx4Ws0orkioAhf/wux6FApx/sNpDyNXtMhJUbaTvlw RU9QH5rNjJruBVN8Qo+nbC7zaQAEBxf8XSjM19VQ/CAW2lWrcV9a7v4YB rRrK8zcw41RJlClDfd7lHWwR6jpc7pAyvFtQNvM4hyDAwjkqaLhsULRHv w==; X-CSE-ConnectionGUID: vxHa9s2wRZG41VrFBw4TXQ== X-CSE-MsgGUID: e6ujeLxoQTK0205HQGqfpQ== X-IronPort-AV: E=Sophos;i="6.10,201,1719871200"; d="scan'208";a="38762020" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 04 Sep 2024 13:51:50 +0200 X-CheckPoint: {66D849D6-F-C661815F-E221238E} X-MAIL-CPID: 9876011BF6E44B1ED856FEFA708AE4DA_1 X-Control-Analysis: str=0001.0A782F21.66D849D6.00E0, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id AD8A6160CE2; Wed, 4 Sep 2024 13:51:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1725450706; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=ih/v3JlPgjnunjeMXetvHkaR0ZTTwffvOCV3Ri/27Bg=; b=R8muNlAjk0m0tbrxDQOJLbgRwtkLvBXe29alHKw5jongGP59ZYi2r1pczqGmdTTL8nd3gn RY0VN3ymmkQKA7wG0DTj3zaxdbnKHwv+vD/ETS4qg6lxDu4BDlMZ4GZtRBf7uD26sUBU63 uZze6YK68t8nuc6h9wMAlIs/ueL2Zuz8O9+xVW3JEsRU7QlV3SSeU76+c4LYl+CtAQfrMM cUb9dMqysmfJvCCK4hgrKX/UDoG49DYsKf8+YLO0gBNbWdu0x4ezu+ERK2pUF7orNpMfcN kYjBwTZ3sFv9ozI2lCwiklWFEFLv16u80cHYGyLWgXtt7Zv/cx1RwRN/iEqkpA== From: Alexander Stein To: Stefan Agner , Alison Wang , David Airlie , Daniel Vetter , Matthias Schiffer , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Alexander Stein Subject: [RESEND 2/2] drm: fsl-dcu: enable PIXCLK on LS1021A Date: Wed, 4 Sep 2024 13:51:35 +0200 Message-Id: <20240904115135.1843274-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240904115135.1843274-1-alexander.stein@ew.tq-group.com> References: <20240904115135.1843274-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Matthias Schiffer The PIXCLK needs to be enabled in SCFG before accessing certain DCU registers, or the access will hang. Signed-off-by: Matthias Schiffer Signed-off-by: Alexander Stein --- drivers/gpu/drm/fsl-dcu/Kconfig | 1 + drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 14 ++++++++++++++ drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h | 3 +++ 3 files changed, 18 insertions(+) diff --git a/drivers/gpu/drm/fsl-dcu/Kconfig b/drivers/gpu/drm/fsl-dcu/Kconfig index 5ca71ef87325..c9ee98693b48 100644 --- a/drivers/gpu/drm/fsl-dcu/Kconfig +++ b/drivers/gpu/drm/fsl-dcu/Kconfig @@ -8,6 +8,7 @@ config DRM_FSL_DCU select DRM_PANEL select REGMAP_MMIO select VIDEOMODE_HELPERS + select MFD_SYSCON if SOC_LS1021A help Choose this option if you have an Freescale DCU chipset. If M is selected the module will be called fsl-dcu-drm. diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index 90cbd18f096d..283858350961 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -100,12 +100,26 @@ static void fsl_dcu_irq_uninstall(struct drm_device *dev) static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) { struct fsl_dcu_drm_device *fsl_dev = dev->dev_private; + struct regmap *scfg; int ret; ret = fsl_dcu_drm_modeset_init(fsl_dev); if (ret < 0) return dev_err_probe(dev->dev, ret, "failed to initialize mode setting\n"); + scfg = syscon_regmap_lookup_by_compatible("fsl,ls1021a-scfg"); + if (PTR_ERR(scfg) != -ENODEV) { + /* + * For simplicity, enable the PIXCLK unconditionally. Disabling + * the clock in PM or on unload could be implemented as a future + * improvement. + */ + ret = regmap_update_bits(scfg, SCFG_PIXCLKCR, SCFG_PIXCLKCR_PXCEN, + SCFG_PIXCLKCR_PXCEN); + if (ret < 0) + return dev_err_probe(dev->dev, ret, "failed to enable pixclk\n"); + } + ret = drm_vblank_init(dev, dev->mode_config.num_crtc); if (ret < 0) { dev_err(dev->dev, "failed to initialize vblank\n"); diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h index e2049a0e8a92..566396013c04 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.h @@ -160,6 +160,9 @@ #define FSL_DCU_ARGB4444 12 #define FSL_DCU_YUV422 14 +#define SCFG_PIXCLKCR 0x28 +#define SCFG_PIXCLKCR_PXCEN BIT(31) + #define VF610_LAYER_REG_NUM 9 #define LS1021A_LAYER_REG_NUM 10