From patchwork Fri Jul 21 08:33:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 123699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp84713vqg; Fri, 21 Jul 2023 02:41:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlGZzjkATMyGMR2btZf8pSoGdC+tRQLu0xkZbitgD8yY3TCcE3S0c6sTmxvJZqJRhlvyzp5N X-Received: by 2002:aa7:d4c5:0:b0:51e:2d8b:454a with SMTP id t5-20020aa7d4c5000000b0051e2d8b454amr1148444edr.20.1689932503522; Fri, 21 Jul 2023 02:41:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689932503; cv=none; d=google.com; s=arc-20160816; b=wbL/1Z2YXvmoZ1VZ5V1cJypVARHf5oO8bi+gsZKYw+z+ZJbaUFvmA/pmcO1eCxIdNL qlL+cs8VWXB40BY7kAjsU409M9s08aS6kkyQMcRKIdCrmdGyooT+NWK1ww22YgNacBy4 5lvEZVuo9Dsjv919K6UzmMtvIa0ZnMWrYtnqBRH/kENPe7fK2QvAzlXQIl39Z0CGQIkN zPTKfL0uxtXGR08+IlOySa8njnrvIyHDpqNgfVvPrQqziY8+oVuk4kXhw0vRziHA1sgv rta+Ho3byl/1lvi1AyHsGyE/e3tI+Fwllk2x0MW33O7YlVUQ7VKN8pNcLN/U6iEuEorv YSqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=9bZTQfFErD83ZpeUe8f6tUjcWK8u+2HNM0QEJ6Cyo2s=; fh=h7zXXJh/osIdG2isekNd39XrU+SVJU5+XdQzHjBL3iU=; b=K8x5VIsoXcSe1nJLi7yeVuc06R3qk8GGSTLpLiuKU68Qahn/LL6oHx/4T7SdN7adUP +zlrW+v1qchkI78NXdXh8pEzG62dK8f10QzwYzyt1VzZ2ycBtmIda5o8z754G73GAIf0 3wAi7JgjJ4ivCQhCPXGHObZRyJbYJGJ8RhaWRmEj3x3fuSSwkdZKKd0Ga6jwPC2XTcxa +Q7i+UZZDdxGMs8nnpxu1piB7T3jwusYFtEJ7DgSBtuCErxgVUrrU8zSNXBebB0uDmlL UP9sDQ4TeWB47Y1ZgFq3bw2XYsAZMaZ8CaxX2IR9Fmx2TV/0rSsmvnOjFZcktRUOyQcl UtAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=LpwguBTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v14-20020aa7d64e000000b0051dd3314051si2025875edr.188.2023.07.21.02.41.19; Fri, 21 Jul 2023 02:41:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=LpwguBTA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbjGUIdZ (ORCPT + 99 others); Fri, 21 Jul 2023 04:33:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229476AbjGUIdW (ORCPT ); Fri, 21 Jul 2023 04:33:22 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03EAD2D4C for ; Fri, 21 Jul 2023 01:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1689928401; x=1721464401; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9bZTQfFErD83ZpeUe8f6tUjcWK8u+2HNM0QEJ6Cyo2s=; b=LpwguBTAWKOjNwnYG27VHqlnx5ZPbc8zw12789NNPJo9noS1yB1c8QjQ xGmHpknYGDVW4nwEpHFbW1cF/QLVKbxj+MY76+hqkq2heHDfmHRvB0f6C 55TbxX1CCJRf5TUtO/4EpV8CJDFp9gKMlUAEkkq9BjoekZnF9widRPUcB GxG1xC1EEwn9cexnWCBN37r8+Ayv7gM1fqtCDIY4Pe5EAs/h/+EaCc5vo BJwYxF0kRic4q2DvkYw6a3oPNRZ9oxfiLhxkmkVUJFZJ6/jSTY/fIG7nA u5t2irfb8lj61KCJFoBmU1kwBMgTQY0ydjgOrTl3ifxdrd9onMIagqqK/ Q==; X-IronPort-AV: E=Sophos;i="6.01,220,1684792800"; d="scan'208";a="32048649" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 21 Jul 2023 10:33:19 +0200 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 267F0280078; Fri, 21 Jul 2023 10:33:19 +0200 (CEST) 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: Fri, 21 Jul 2023 10:33:13 +0200 Message-Id: <20230721083314.1190614-1-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772022664637021180 X-GMAIL-MSGID: 1772022664637021180 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 Fri Jul 21 08:33:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 123666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp63702vqg; Fri, 21 Jul 2023 01:55:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlGDHmfkwvbdotkMoSWlnK1oUyKVak4yNMK7yu5rVvkQwhLdoB1q6/oW0Wx0JnfM96QKoSWl X-Received: by 2002:a05:6808:2392:b0:3a3:ed41:97d with SMTP id bp18-20020a056808239200b003a3ed41097dmr1796133oib.50.1689929724411; Fri, 21 Jul 2023 01:55:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689929724; cv=none; d=google.com; s=arc-20160816; b=m1GImTk7gCUDXEbBPO3epd7XVj0LcKLq8cTw5R7p5b4nCEmsNJISlgAHxvwORkyTgB jbAl6ci9QzFbxdjA5UX0fdWebDoVAclx7qeApX2Zx2FR2nuogQQ3gkjVj2cz/ykMTn1K dM/b4EypnRWTwnkH1DrhHd/KVwzkDwsFa2xOSiOOEiBgQLoi7+BpZmcskigQQ9kdTk/+ pixKl2ikKCdst+0AdCkPEyhjWL+iOGsThb1T06xkAppIcYbPT0naE4A+++jwP2FPfwtB b9VK7pCgLYb1evFW8HAQOSt4Pf3KxwvsgXSHLM+M65WBTuydBhdjUms2967VxqK6NX6f FDtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ih/v3JlPgjnunjeMXetvHkaR0ZTTwffvOCV3Ri/27Bg=; fh=ylbtes557l+ahMspLinQadCl8vEkqVplhqv9O+0vH+o=; b=fciShzbDJjJvmcN0w1gIh0ecSXsZMoch5G5yqTn7qBE5tIIuA48P+8Af3wJUxLvtI2 VvRcxvOpqZVfZRC0DLUjfjXxMYbDRcpjJpX8s2wAk5Do70iKswfwJGTh4iBi0A4hKhbl R2vZ/evN6048vfTPlsAitV1EIG/skkp24U7RhIJwlmn9LU1UyOyJ2jNkUiwS43DjXBou lafI4//VdKPVxmXFwznWWOhAlwkdL8IhbV4+wfRQUyk+BcSKSy+H+tIkdAP/iFr2DJdp uyO96Zw6kUW7j8wcCFvz7iyh53mEUUHG04AtgZ6mmHlY5N2sIOI8V4RzyZcM4obQE5CZ aOpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=LaMZ3XdE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mu6-20020a17090b388600b0025bea0a396asi5786955pjb.6.2023.07.21.01.55.09; Fri, 21 Jul 2023 01:55:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=LaMZ3XdE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230044AbjGUId2 (ORCPT + 99 others); Fri, 21 Jul 2023 04:33:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjGUIdY (ORCPT ); Fri, 21 Jul 2023 04:33:24 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB765273C for ; Fri, 21 Jul 2023 01:33:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1689928402; x=1721464402; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ih/v3JlPgjnunjeMXetvHkaR0ZTTwffvOCV3Ri/27Bg=; b=LaMZ3XdE5CM/s2nGGpEy97XOXujgIcVCiRuSre8jVMtVed/46GY+bdJn PzCtC06bJYhOfHcJudSuKB0SH6boR6Vnguv37/91Ee6ut5EfmLK2l0gaC mT0tIBUjnBDsZS0/g4nKv910UBsFdxR1vFe2qK3YvbNA3EdGql9NjMkhO JHIzM0MQJSUnUFDCahs9xFSs76+bwS3XgswQM184X6j7Ap6Nsa/4wX2gm MYFHL7STRWTCh/pV4NPCLYGhUTJyyjtkoaFvdal7C3pKZ1gyebkrVl7Hb FvNGR59OGBgxRC62DAFCQMWMqv8iqlp/860xJHzZYaLoZJGfs6xqwRBuv g==; X-IronPort-AV: E=Sophos;i="6.01,220,1684792800"; d="scan'208";a="32048650" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 21 Jul 2023 10:33:19 +0200 Received: from steina-w.tq-net.de (unknown [10.123.53.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 55D45280084; Fri, 21 Jul 2023 10:33:19 +0200 (CEST) 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: Fri, 21 Jul 2023 10:33:14 +0200 Message-Id: <20230721083314.1190614-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230721083314.1190614-1-alexander.stein@ew.tq-group.com> References: <20230721083314.1190614-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772019750281339270 X-GMAIL-MSGID: 1772019750281339270 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