From patchwork Mon Feb 19 12:24:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13562599 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 08924C48BF8 for ; Mon, 19 Feb 2024 12:25:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6E01D10E07A; Mon, 19 Feb 2024 12:25:02 +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="HnIggYjM"; 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="hFjUjvKR"; 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 22D5A10E07A for ; Mon, 19 Feb 2024 12:24:59 +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=1708345500; x=1739881500; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9bZTQfFErD83ZpeUe8f6tUjcWK8u+2HNM0QEJ6Cyo2s=; b=HnIggYjMmfXOgTgD8bqQdWdgihavrg3fSgSTvE7kpzeCdvTwIefo8erT XzYc9cknf/VMT5VrEbIUKplfi5b6hEgxPkdHHGskqXDqucB4/ACU2wwbH 6mHuEr7DEQ7S2OTbeNvc30+XYcscyrF8ITYS2JqfFIpFj8ZSiWqnBj2hS 8INUpZ7ygtJ7XHua29h7vm3u0Vof3MIfVuim+eHW3tKi79yzUot5yf3yR bi3cZrxJJBZh+n54srEBU+6QWD+QfIhWQ2/xRzn33a4SxEUGVB3Wfygcj 8aR6k9zrjQptnFsULvu21Vl1nAxt0m+Q48T7A6kg2ymTe88BGy5wp/diF Q==; X-IronPort-AV: E=Sophos;i="6.06,170,1705359600"; d="scan'208";a="35475550" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 19 Feb 2024 13:24:58 +0100 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 5077216F242; Mon, 19 Feb 2024 13:24:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1708345494; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=9bZTQfFErD83ZpeUe8f6tUjcWK8u+2HNM0QEJ6Cyo2s=; b=hFjUjvKR0JKs/dssdk3MOmFCIW3zrTofvZq+9VGGWnsKnyqLBoZPGYaUBP3GS8EXdr1DUl 7ypoTNyPVIx/0+aNooOCTkLGGDTb77pTqCqArMCw7b+mFHgRZZi9uvCNxcTBPREg9OoZQx ksdvTDvQe6oT1rnst6F03X0B3SLkhWUZEUv2aZhwIt2yeeZDCxo9aq2dmfZ+0Ew7+oLf2/ WJrP5yOehtVQAfPqWR9XQoddQ5Mk7ccY+SNhJ/uBinfZH7QYWETfKjLNgcl67vMRRqXT4F 6IxEumVeXKw/Z9XOG2BWLq4ZH0QBJSJmZ2uB7oFY6rPOlXgC7J2efvVFLuPiPA== From: Alexander Stein To: Stefan Agner , Alison Wang , David Airlie , Daniel Vetter , Matthias Schiffer 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: Mon, 19 Feb 2024 13:24:48 +0100 Message-Id: <20240219122449.3083748-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 --- 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 Mon Feb 19 12:24:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 13562600 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 99C75C48BF8 for ; Mon, 19 Feb 2024 12:25:07 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD04110E370; Mon, 19 Feb 2024 12:25:06 +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="Y4apTU12"; 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="J2+oV1ZK"; 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 EAC7F10E106 for ; Mon, 19 Feb 2024 12:25:02 +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=1708345503; x=1739881503; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ih/v3JlPgjnunjeMXetvHkaR0ZTTwffvOCV3Ri/27Bg=; b=Y4apTU12aCSaez35teYhzHY97MEuzyaBQasqkol54Z3sPG0K77dtKQH7 oDzI9PcVbDk6HODxCOCVILhJ+4Lv4Nhe8KzhuRm8Jj9lHYdLBj1i8bDRw h3xsxSyQgMJ5l8MUTFm8tIi96LfEH9zz1Nh2+iG7WNLb0htITqDIO7PCc WX8yDQo5cPoqW2FLKfWQ0Gw9jpBpPItMi/ytzknpCY3A7NsBo2DPvCE2a WJP565SGfMQeq5RHOZJ2aZLu6mBRkRpObcF2Rxcx2M2F9i66RaiAs6rR2 4UaS63ap8b/CpRrRCqKzO3mPmtRdv7aIMA/lYaEhyxhMSwNdA8AtjQ17Z A==; X-IronPort-AV: E=Sophos;i="6.06,170,1705359600"; d="scan'208";a="35475552" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 19 Feb 2024 13:25:02 +0100 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0CA3D16F763; Mon, 19 Feb 2024 13:24:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1708345498; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding:in-reply-to:references; bh=ih/v3JlPgjnunjeMXetvHkaR0ZTTwffvOCV3Ri/27Bg=; b=J2+oV1ZKOKLcn/qz2bJ4YrrX7urblOuYeRkmuWrGrDbzdB83S6EHxLju7VhlxI1o9gdH4P gOPTG5kfX1mapEHgwI8olPJSvd6Sa8WK+dLdHrcsR4q1ZPV4ufqTOyRTH4F/2Fc7bBGOtp mI+xwz2RrdckbZnKGrEnvt99ogvYyCo/e9XZYaHDKlmkXFtvDbWn3gdKnr7J3LmD3tfyq9 /5J2Ntk5yfaIdHw3vH/gxNUBr+G+1I7A88E6eom7g6dsY1DzEVdHekMeyS7jtj2NHDeYGZ IESZMabRoKToR7tODX+CySpQCeTl4bWR9MQVyqyMFQOglcj+IK+omsmIptYlFg== From: Alexander Stein To: Stefan Agner , Alison Wang , David Airlie , Daniel Vetter , Matthias Schiffer 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: Mon, 19 Feb 2024 13:24:49 +0100 Message-Id: <20240219122449.3083748-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240219122449.3083748-1-alexander.stein@ew.tq-group.com> References: <20240219122449.3083748-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