From patchwork Fri Jul 17 09:04:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669575 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 09A6013A4 for ; Fri, 17 Jul 2020 09:04:41 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DB6B620829 for ; Fri, 17 Jul 2020 09:04:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="ieC1FUwD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DB6B620829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A2D066ED63; Fri, 17 Jul 2020 09:04:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 242AB6ED63 for ; Fri, 17 Jul 2020 09:04:38 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id g75so13872023wme.5 for ; Fri, 17 Jul 2020 02:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TgzrsfFvUoedrrID9NxEXb6kwKd/nE4GpLl68MV7d2Y=; b=ieC1FUwDPTlp07j7WO655O98SifDjBbC8SRiRqcP5pZqh2AgC/JYK1uIYgM9dh3eRH vy/ChZhOl7ek1o/hgsskxKycdt0SMW0N5OTyTsotmfBL25GHLyh5FskqKCRisfoywOFH wdWOgrzeKTPqFSflbUrCCCEnwei9rSZsFKUao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TgzrsfFvUoedrrID9NxEXb6kwKd/nE4GpLl68MV7d2Y=; b=twWR2N76gpCiMzs9i3LBLts8lzcSBPdNuYOAmsVRdIzt0O3pcYEz2ftXZTZsnkrJTz o7geO4pcdHR+om0EsTRN9RmKjK64WGUaYh21dd7kXBm2/XAwmZKkkJgTcq+SLtC0K1J6 OLZ/UnbMq4Dk9n7pSW0ASAKVhHPk6gZ3G3oa1WBWivfLdT2b/3BsuCyZwDHfnjejcoO4 ldByBrR1NLr7722tHx6rdD7PEamXzSdSrSz99QRATssDsPnsPiE1T94j8E3Lr26O3KOK 8SP7eGsiJp3H2oDP1kClE4zq6em1qJ4D+44RsViyH3mRcvY+dVmYor6nzmME4jYAMv/n 8FYg== X-Gm-Message-State: AOAM531t/bpLB+yZ8IRchNJeZITbkUr066CbHYZq9+TKqKAH0tMLGocw jmNCkMhvcuXRmDg3kMQJEURbQ+gHgpU= X-Google-Smtp-Source: ABdhPJyo4o1hXp3kz2XEAjJnFRCJ+eCHbR/ki25GAj3KGHhaoIfRPV1kwLcSZS2Wt6/ZoRICwHovhQ== X-Received: by 2002:a1c:1bc4:: with SMTP id b187mr8785078wmb.105.1594976676442; Fri, 17 Jul 2020 02:04:36 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:35 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 01/18] drm/armada: Use devm_drm_dev_alloc Date: Fri, 17 Jul 2020 11:04:13 +0200 Message-Id: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 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: , Cc: Daniel Vetter , Russell King , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Also remove the now no longer needed build bug on since that's already not needed anymore with drmm_add_final_kfree. Conversion to managed drm_device cleanup is easy, the final drm_dev_put() is already the last thing in both the bind unbind as in the unbind flow. Also, this relies on component.c correctly wrapping bind&unbind in separate devres groups, which it does. Signed-off-by: Daniel Vetter Cc: Russell King --- drivers/gpu/drm/armada/armada_drv.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index 5fc25c3f445c..a8d5908b3922 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -87,24 +87,13 @@ static int armada_drm_bind(struct device *dev) "armada-drm")) return -EBUSY; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) - return -ENOMEM; - - /* - * The drm_device structure must be at the start of - * armada_private for drm_dev_put() to work correctly. - */ - BUILD_BUG_ON(offsetof(struct armada_private, drm) != 0); - - ret = drm_dev_init(&priv->drm, &armada_drm_driver, dev); - if (ret) { - dev_err(dev, "[" DRM_NAME ":%s] drm_dev_init failed: %d\n", - __func__, ret); - kfree(priv); - return ret; + priv = devm_drm_dev_alloc(dev, &armada_drm_driver, + struct armada_private, drm); + if (IS_ERR(priv)) { + dev_err(dev, "[" DRM_NAME ":%s] devm_drm_dev_alloc failed: %li\n", + __func__, PTR_ERR(priv)); + return PTR_ERR(priv); } - drmm_add_final_kfree(&priv->drm, priv); /* Remove early framebuffers */ ret = drm_fb_helper_remove_conflicting_framebuffers(NULL, @@ -174,7 +163,6 @@ static int armada_drm_bind(struct device *dev) err_kms: drm_mode_config_cleanup(&priv->drm); drm_mm_takedown(&priv->linear); - drm_dev_put(&priv->drm); return ret; } @@ -194,8 +182,6 @@ static void armada_drm_unbind(struct device *dev) drm_mode_config_cleanup(&priv->drm); drm_mm_takedown(&priv->linear); - - drm_dev_put(&priv->drm); } static int compare_of(struct device *dev, void *data) From patchwork Fri Jul 17 09:04:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669583 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 752F860D for ; Fri, 17 Jul 2020 09:04:48 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 52E5C207FB for ; Fri, 17 Jul 2020 09:04:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="RhqMSrio" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52E5C207FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 735346ED6B; Fri, 17 Jul 2020 09:04:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DC356ED63 for ; Fri, 17 Jul 2020 09:04:39 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id c80so13896333wme.0 for ; Fri, 17 Jul 2020 02:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OjBvKZ5acKxCe2EZlASsDLLT4uETxOLijEWIw+9Sorw=; b=RhqMSriouNte48inGUAcDdsQFY12wGbm4x2sQ4dRPyBziUrodzSN7KszGcM7yjQ2ac BbA+CxWr0G4N0kWUdinJxizZMrhoMOpaQmr9EN5nB/h/Hz/68IeCh3bs8g9WUnrTbJWn c+BMqWntvukxOOSfefNFzI/WNOD5U17wWCfhg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OjBvKZ5acKxCe2EZlASsDLLT4uETxOLijEWIw+9Sorw=; b=Guzou2M1KCYZ7INem5+Jh0I5WV1kQg0WWVvZu/hKL9aoAP3i2hfrZ/JYoyXFDsvlF9 DXFEu3M2Adlbfk3gpVTr3cjMSTX3tqq+4g+5BashxdFysj+jlt8Zza8hYWGyirdcLn6A wjm34Ky1SsUaAEAQmE4M/yHjDZ+rPcd4P9gHbIwTVG4c2bIjlOAll4wj17LyGLmkjABS UscG6tqaJyJMoIeZDbqmB/eP2zB35qxgJ2P5fMKGzYsi0twLD8qwmZGlziL9yyF1Q6gN luMvJ9Mdps+Jt2tke5vO+lPGB+2mPmdrmZxzzAiRed2Zd8sR9UsAZCsWncM4golLmiKB XXHg== X-Gm-Message-State: AOAM530gRJV6P3MjuqsXBNP+hOdG64xD35CHGJAtbXUdYi6VfbVNlhBm A/pvxcL4/S981tMrrGPCbYDz5qakBsc= X-Google-Smtp-Source: ABdhPJwzYo0HfC0ZZtJvAsekUV2Etn5YNWnd+H4tuHfGF9zV81o7D2+PbdDa+UjYDEPgojKTRq+sLA== X-Received: by 2002:a7b:cc8b:: with SMTP id p11mr8876850wma.180.1594976677380; Fri, 17 Jul 2020 02:04:37 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:36 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 02/18] drm/armada: Don't use drm_device->dev_private Date: Fri, 17 Jul 2020 11:04:14 +0200 Message-Id: <20200717090430.1146256-2-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Russell King , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Upcasting using a container_of macro is more typesafe, faster and easier for the compiler to optimize. Signed-off-by: Daniel Vetter Cc: Russell King --- drivers/gpu/drm/armada/armada_crtc.c | 4 ++-- drivers/gpu/drm/armada/armada_debugfs.c | 2 +- drivers/gpu/drm/armada/armada_drm.h | 2 ++ drivers/gpu/drm/armada/armada_drv.c | 4 +--- drivers/gpu/drm/armada/armada_fbdev.c | 4 ++-- drivers/gpu/drm/armada/armada_gem.c | 4 ++-- drivers/gpu/drm/armada/armada_overlay.c | 8 ++++---- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index 38dfaa46d306..a887b6a5f8bd 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -757,7 +757,7 @@ static int armada_drm_crtc_cursor_move(struct drm_crtc *crtc, int x, int y) static void armada_drm_crtc_destroy(struct drm_crtc *crtc) { struct armada_crtc *dcrtc = drm_to_armada_crtc(crtc); - struct armada_private *priv = crtc->dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(crtc->dev); if (dcrtc->cursor_obj) drm_gem_object_put(&dcrtc->cursor_obj->obj); @@ -901,7 +901,7 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, struct resource *res, int irq, const struct armada_variant *variant, struct device_node *port) { - struct armada_private *priv = drm->dev_private; + struct armada_private *priv = drm_to_armada_dev(drm); struct armada_crtc *dcrtc; struct drm_plane *primary; void __iomem *base; diff --git a/drivers/gpu/drm/armada/armada_debugfs.c b/drivers/gpu/drm/armada/armada_debugfs.c index c6fc2f1d58e9..29f4b52e3c8d 100644 --- a/drivers/gpu/drm/armada/armada_debugfs.c +++ b/drivers/gpu/drm/armada/armada_debugfs.c @@ -19,7 +19,7 @@ static int armada_debugfs_gem_linear_show(struct seq_file *m, void *data) { struct drm_info_node *node = m->private; struct drm_device *dev = node->minor->dev; - struct armada_private *priv = dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(dev); struct drm_printer p = drm_seq_file_printer(m); mutex_lock(&priv->linear_lock); diff --git a/drivers/gpu/drm/armada/armada_drm.h b/drivers/gpu/drm/armada/armada_drm.h index a11bdaccbb33..6a5a87932576 100644 --- a/drivers/gpu/drm/armada/armada_drm.h +++ b/drivers/gpu/drm/armada/armada_drm.h @@ -73,6 +73,8 @@ struct armada_private { #endif }; +#define drm_to_armada_dev(dev) container_of(dev, struct armada_private, drm) + int armada_fbdev_init(struct drm_device *); void armada_fbdev_fini(struct drm_device *); diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c index a8d5908b3922..980d3f1f8f16 100644 --- a/drivers/gpu/drm/armada/armada_drv.c +++ b/drivers/gpu/drm/armada/armada_drv.c @@ -106,8 +106,6 @@ static int armada_drm_bind(struct device *dev) return ret; } - priv->drm.dev_private = priv; - dev_set_drvdata(dev, &priv->drm); /* Mode setting support */ @@ -169,7 +167,7 @@ static int armada_drm_bind(struct device *dev) static void armada_drm_unbind(struct device *dev) { struct drm_device *drm = dev_get_drvdata(dev); - struct armada_private *priv = drm->dev_private; + struct armada_private *priv = drm_to_armada_dev(drm); drm_kms_helper_poll_fini(&priv->drm); armada_fbdev_fini(&priv->drm); diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 0c4601275507..38f5170c0fea 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c @@ -117,7 +117,7 @@ static const struct drm_fb_helper_funcs armada_fb_helper_funcs = { int armada_fbdev_init(struct drm_device *dev) { - struct armada_private *priv = dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(dev); struct drm_fb_helper *fbh; int ret; @@ -151,7 +151,7 @@ int armada_fbdev_init(struct drm_device *dev) void armada_fbdev_fini(struct drm_device *dev) { - struct armada_private *priv = dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(dev); struct drm_fb_helper *fbh = priv->fbdev; if (fbh) { diff --git a/drivers/gpu/drm/armada/armada_gem.c b/drivers/gpu/drm/armada/armada_gem.c index 8005614d2e6b..ecf8a55e93d9 100644 --- a/drivers/gpu/drm/armada/armada_gem.c +++ b/drivers/gpu/drm/armada/armada_gem.c @@ -39,7 +39,7 @@ static size_t roundup_gem_size(size_t size) void armada_gem_free_object(struct drm_gem_object *obj) { struct armada_gem_object *dobj = drm_to_armada_gem(obj); - struct armada_private *priv = obj->dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(obj->dev); DRM_DEBUG_DRIVER("release obj %p\n", dobj); @@ -77,7 +77,7 @@ void armada_gem_free_object(struct drm_gem_object *obj) int armada_gem_linear_back(struct drm_device *dev, struct armada_gem_object *obj) { - struct armada_private *priv = dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(dev); size_t size = obj->obj.size; if (obj->page || obj->linear) diff --git a/drivers/gpu/drm/armada/armada_overlay.c b/drivers/gpu/drm/armada/armada_overlay.c index 07f0da4d9ba1..30e01101f59e 100644 --- a/drivers/gpu/drm/armada/armada_overlay.c +++ b/drivers/gpu/drm/armada/armada_overlay.c @@ -344,7 +344,7 @@ static int armada_overlay_set_property(struct drm_plane *plane, struct drm_plane_state *state, struct drm_property *property, uint64_t val) { - struct armada_private *priv = plane->dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(plane->dev); #define K2R(val) (((val) >> 0) & 0xff) #define K2G(val) (((val) >> 8) & 0xff) @@ -412,7 +412,7 @@ static int armada_overlay_get_property(struct drm_plane *plane, const struct drm_plane_state *state, struct drm_property *property, uint64_t *val) { - struct armada_private *priv = plane->dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(plane->dev); #define C2K(c,s) (((c) >> (s)) & 0xff) #define R2BGR(r,g,b,s) (C2K(r,s) << 0 | C2K(g,s) << 8 | C2K(b,s) << 16) @@ -505,7 +505,7 @@ static const struct drm_prop_enum_list armada_drm_colorkey_enum_list[] = { static int armada_overlay_create_properties(struct drm_device *dev) { - struct armada_private *priv = dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(dev); if (priv->colorkey_prop) return 0; @@ -539,7 +539,7 @@ static int armada_overlay_create_properties(struct drm_device *dev) int armada_overlay_plane_create(struct drm_device *dev, unsigned long crtcs) { - struct armada_private *priv = dev->dev_private; + struct armada_private *priv = drm_to_armada_dev(dev); struct drm_mode_object *mobj; struct drm_plane *overlay; int ret; From patchwork Fri Jul 17 09:04:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669577 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A3D7213A4 for ; Fri, 17 Jul 2020 09:04:43 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 81726207FB for ; Fri, 17 Jul 2020 09:04:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="EDmiEu0r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 81726207FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C8C406ED65; Fri, 17 Jul 2020 09:04:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 116136ED65 for ; Fri, 17 Jul 2020 09:04:40 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id w3so16057223wmi.4 for ; Fri, 17 Jul 2020 02:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wn9T+/DnSY96ofYSkqKamlWlLzsjFow5D1KfqhsmZIs=; b=EDmiEu0rfSiMa4kCMIRp5tZMVbFCb6gtbfgWhw+78mzIDjlBNe0JoJ3dHR89Kun2GV tkjVhvGumLvxj3BmlaVFwn00wJFLOtpZICORw3GpUDnMmKybpyKDND/d9hCtkg05L9Ub O0kTgbdV5adwmUDXLx+/U4XxgKlPU31TnQMXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wn9T+/DnSY96ofYSkqKamlWlLzsjFow5D1KfqhsmZIs=; b=r7sSr64fcWYRGfm48r4JF8yKzfFalHB5DkUH3tmVo9ypwy9FeqPeTqC8khjrbAPVmw H8Vtlq6v7LZGgx9JBns5pqvinzfFnxOZRQybdcMTvL88wxdHGLiYw8RhfXEYTlMMIxRg sbTYeC7KOsUOxyW5lNAASukMc80rJnmxjnkyIBMwdylH4dwcHBq2ZP7nnQSwOWX3Ybx/ ji3iGRVbvs4+uAXp4UENAF3q2lKkcxVGDgR7ta0CsKf3NjugNK1gboAyd6BHtCAzGnva KNPL7LXsuFdUL8Gnvy4GZribeZYxNSBvwpO/mkDmd3rU03/mO0xre1vxHSmEvSrfnU+Q Qfwg== X-Gm-Message-State: AOAM533kVLaxcEN4aRIZT/oHs4HdQFrd2iH+ySJvlx+rM5x5dzav/GE9 yUVaQ6REQzsvGPcsMN2FsiM+YbyqEKA= X-Google-Smtp-Source: ABdhPJx5ISrNtl5FTFfZyjdxKhbhN8+HsGfuap6rebBTzFUicTozdhcP00P25Q7XNhUNPZDs+kEtdw== X-Received: by 2002:a1c:7510:: with SMTP id o16mr7769745wmc.146.1594976678411; Fri, 17 Jul 2020 02:04:38 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:37 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 03/18] drm/arc: Switch to devm_drm_dev_alloc Date: Fri, 17 Jul 2020 11:04:15 +0200 Message-Id: <20200717090430.1146256-3-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" - Need to embedded the drm_device, but for now we keep the usual pointer chasing. - No more devm_kzalloc, which fixes a lifetime issues on driver remove. - No more drm_dev_put, that's done by devm_ now. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu.h | 1 + drivers/gpu/drm/arc/arcpgu_drv.c | 33 +++++++++++++------------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index 6aac44b953ad..cd9e932f501e 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -9,6 +9,7 @@ #define _ARCPGU_H_ struct arcpgu_drm_private { + struct drm_device drm; void __iomem *regs; struct clk *clk; struct drm_framebuffer *fb; diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index f164818ec477..68eb4a31c54b 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -42,18 +42,14 @@ static void arcpgu_setup_mode_config(struct drm_device *drm) DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops); -static int arcpgu_load(struct drm_device *drm) +static int arcpgu_load(struct arcpgu_drm_private *arcpgu) { - struct platform_device *pdev = to_platform_device(drm->dev); - struct arcpgu_drm_private *arcpgu; + struct platform_device *pdev = to_platform_device(arcpgu->drm.dev); struct device_node *encoder_node = NULL, *endpoint_node = NULL; + struct drm_device *drm = &arcpgu->drm; struct resource *res; int ret; - arcpgu = devm_kzalloc(&pdev->dev, sizeof(*arcpgu), GFP_KERNEL); - if (arcpgu == NULL) - return -ENOMEM; - drm->dev_private = arcpgu; arcpgu->clk = devm_clk_get(drm->dev, "pxlclk"); @@ -162,30 +158,28 @@ static struct drm_driver arcpgu_drm_driver = { static int arcpgu_probe(struct platform_device *pdev) { - struct drm_device *drm; + struct arcpgu_drm_private *arcpgu; int ret; - drm = drm_dev_alloc(&arcpgu_drm_driver, &pdev->dev); - if (IS_ERR(drm)) - return PTR_ERR(drm); + arcpgu = devm_drm_dev_alloc(&pdev->dev, &arcpgu_drm_driver, + struct arcpgu_drm_private, drm); + if (IS_ERR(arcpgu)) + return PTR_ERR(arcpgu); - ret = arcpgu_load(drm); + ret = arcpgu_load(arcpgu); if (ret) - goto err_unref; + return ret; - ret = drm_dev_register(drm, 0); + ret = drm_dev_register(&arcpgu->drm, 0); if (ret) goto err_unload; - drm_fbdev_generic_setup(drm, 16); + drm_fbdev_generic_setup(&arcpgu->drm, 16); return 0; err_unload: - arcpgu_unload(drm); - -err_unref: - drm_dev_put(drm); + arcpgu_unload(&arcpgu->drm); return ret; } @@ -196,7 +190,6 @@ static int arcpgu_remove(struct platform_device *pdev) drm_dev_unregister(drm); arcpgu_unload(drm); - drm_dev_put(drm); return 0; } From patchwork Fri Jul 17 09:04:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669581 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F6E660D for ; Fri, 17 Jul 2020 09:04:46 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0C52920829 for ; Fri, 17 Jul 2020 09:04:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="BCeqxk4M" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C52920829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4A7E16ED69; Fri, 17 Jul 2020 09:04:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA0366ED65 for ; Fri, 17 Jul 2020 09:04:40 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id f7so10214686wrw.1 for ; Fri, 17 Jul 2020 02:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+DeOJQxjFT12jCutejz7twUg3E8aYgkxeIDAHQ0KwEQ=; b=BCeqxk4ME8LC+0JqccmW8mZ7uAIaFVfYT4zQAT6LYTWY+L5SCjcW51zHxczAx3Snwj DV8hkFWZurij0XUBSZCzPEZc+33L2XONRXJRJ3fS/3DTv+2BJNOD+7Dboee1fB/ZZRNi qZdeoZpM+Vf8LHrvn20FllUWRSKyfrllsbg5c= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+DeOJQxjFT12jCutejz7twUg3E8aYgkxeIDAHQ0KwEQ=; b=hWPcwOPdGNFbifXT604nr6T6Mv5brsvBb6A82RQZQKt9SbbnbdaOVze7R48Ae07trx ItE0oBDfAp8rZh76drujUTkau+jxeYo7CRCwtm8fsQHRvvlr6bMiY5BUBPG6sthpgLaH ZYKxsOUIgbdNzQk+N/VQlwSCuRcShARqpBPJWS+lWuI/O2O48nzvwjuCvIHnCAXkKpad kg0bDP/Q6rDQrvei5tmfBVx4ECIVB8ySw9p8+BZmKSv+FLXm1BnUDXKorLtCcX8uu0D0 RXMb4AC0/JlDlfoZVJOYDX0BdMJ3J3Pqj4lSkGJRwLI08HnqHebkqOEcT6iY608Vr9Te zQxQ== X-Gm-Message-State: AOAM533RQWMVunlyJ+jQlyq0yT5b3VM7bkmbLLfuIseBp0IYBAOpBWnL XNtFC/gvJHPhHAP5klW7x/MTItUWHtA= X-Google-Smtp-Source: ABdhPJwiLK6S9Vscc2AmHoDgxO04KruoZblLzXBPPo0kzURYWFvcjBSPDs2XZM8bVToSTNcJR3Ke5g== X-Received: by 2002:adf:f784:: with SMTP id q4mr9204468wrp.397.1594976679269; Fri, 17 Jul 2020 02:04:39 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:38 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 04/18] drm/arc: Stop using drm_device->dev_private Date: Fri, 17 Jul 2020 11:04:16 +0200 Message-Id: <20200717090430.1146256-4-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Upcasting using a container_of macro is more typesafe, faster and easier for the compiler to optimize. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu.h | 2 ++ drivers/gpu/drm/arc/arcpgu_crtc.c | 4 ++-- drivers/gpu/drm/arc/arcpgu_drv.c | 4 +--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index cd9e932f501e..87821c91a00c 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -17,6 +17,8 @@ struct arcpgu_drm_private { struct drm_plane *plane; }; +#define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm) + #define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc) static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu, diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index be7c29cec318..ba796a216244 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -178,7 +178,7 @@ static const struct drm_plane_funcs arc_pgu_plane_funcs = { static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm) { - struct arcpgu_drm_private *arcpgu = drm->dev_private; + struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); struct drm_plane *plane = NULL; int ret; @@ -202,7 +202,7 @@ static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm) int arc_pgu_setup_crtc(struct drm_device *drm) { - struct arcpgu_drm_private *arcpgu = drm->dev_private; + struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); struct drm_plane *primary; int ret; diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 68eb4a31c54b..c6a8deb56b0f 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -50,8 +50,6 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) struct resource *res; int ret; - drm->dev_private = arcpgu; - arcpgu->clk = devm_clk_get(drm->dev, "pxlclk"); if (IS_ERR(arcpgu->clk)) return PTR_ERR(arcpgu->clk); @@ -120,7 +118,7 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void *arg) { struct drm_info_node *node = (struct drm_info_node *)m->private; struct drm_device *drm = node->minor->dev; - struct arcpgu_drm_private *arcpgu = drm->dev_private; + struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); unsigned long clkrate = clk_get_rate(arcpgu->clk); unsigned long mode_clock = arcpgu->crtc.mode.crtc_clock * 1000; From patchwork Fri Jul 17 09:04:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669589 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1212413A4 for ; Fri, 17 Jul 2020 09:04:52 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E39FD20829 for ; Fri, 17 Jul 2020 09:04:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="OqXQyjlL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E39FD20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F9536ED71; Fri, 17 Jul 2020 09:04:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id F40B96ED69 for ; Fri, 17 Jul 2020 09:04:41 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id z2so10234162wrp.2 for ; Fri, 17 Jul 2020 02:04:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8/C7LTabyP/9GYGp6X6gUqGdFf5QRFWdf1CwsFIoyY8=; b=OqXQyjlL1oq+SIaAXB910RR4gGeJfnmB94W/w7IjbhqqHxOacxm60kxxJj9IjKZ6bN RKqOFGFjOVI1YrNjjri3xo16u7XJlyDr0GRPUZvk5fLpvkOFE9Jy8yCwVojHeGOfUgqn FSG2nxlPtIYTeCt6bYsJBLEQ25DRPevkV8iX8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8/C7LTabyP/9GYGp6X6gUqGdFf5QRFWdf1CwsFIoyY8=; b=OrREb4PrbYQr5phuGOtMGfD52VtfgRg4F6pJLRNi0ju7r2mizyoOj8a2GxvYuF/fem wYjeoPOPDWqcv+A62DWKCWGwECBPA5080u3A9OaTQp0OYCdOWAuCGdEWsNAgXmuYFC+H gujixncusMvYwN5ANL+wHlsebjUktXvCYjVxXj+x40JMOzsDDjGsJlAlL3mo9/3zBWLh 0iblseWv8wnLZ364nOmeQbxmh4shAtLzg0XIUjbeq7sdRH8JhaEYQVuFUY3z4QB3k78i YJP/fREH6d4lEfXRV1OmdPGd0FD4W66RmPkUXAWMvN1uOuxm5ZexmgjmovLojsaO+OOX DXlA== X-Gm-Message-State: AOAM530lRY54m5OWZ+X0dixHfPc1cDWtdU/J8VThy0Mjs5Uz8NiAG9eO rU2SKzYY9lE6DM+dF4AzFXhlov4YthY= X-Google-Smtp-Source: ABdhPJyP8YGG5SbmFJ/IqHv2CqNMCgNkB2uSQvgvxoOsT0miCF4pmPRxlt0B0xRNC3w/M2laM7hGTg== X-Received: by 2002:a5d:5450:: with SMTP id w16mr2023495wrv.155.1594976680174; Fri, 17 Jul 2020 02:04:40 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:39 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 05/18] drm/arc: Delete arcpgu_priv->fb Date: Fri, 17 Jul 2020 11:04:17 +0200 Message-Id: <20200717090430.1146256-5-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Leftover from the conversion to the generic fbdev emulation. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index 87821c91a00c..ed77dd5dd5cb 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -12,7 +12,6 @@ struct arcpgu_drm_private { struct drm_device drm; void __iomem *regs; struct clk *clk; - struct drm_framebuffer *fb; struct drm_crtc crtc; struct drm_plane *plane; }; From patchwork Fri Jul 17 09:04:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669591 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AF45860D for ; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8BD9E207FB for ; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="ZIr2fwQy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8BD9E207FB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 07ED06ED70; Fri, 17 Jul 2020 09:04:45 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id D71B96ED6A for ; Fri, 17 Jul 2020 09:04:42 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id c80so13896522wme.0 for ; Fri, 17 Jul 2020 02:04:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xkOaolMH5Qi3O60vwtcPWTDOfZCMHTuou9vC5C8u3bI=; b=ZIr2fwQylnZ1p+YQ+YFCS4/mwUSiEIq56wgN7xlqD7QSlYX6SPfmkvCw+bKU8ztB69 6+xWPLXiz/Qcxi/egAR6uezDteNv4Vs60Rou2sc7fqPZdvqCyO9CY6zXkhXizmmyet5/ kBpjuZGOX7K5XvfmsYoGeZDuzmyXPdqGdFT5w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xkOaolMH5Qi3O60vwtcPWTDOfZCMHTuou9vC5C8u3bI=; b=dRQlIz4UDbeWEyDTjd0xTgk1pEoorSgnjq84lJDonLPPIy7vnG4T4FDo36sbgyJ7FB B16tN/oFSMB3LJlh9Y5Ga9Qmc0Iy7d/ss6y4f0JlRxPaCuCY97Jjf87/s0ezPl12A6Rx GZe8W7k6lovWU3mJJzFmRBsiQmPTzZyZuUa+B6MrRBLcdX7hJuZA5GWq7mmYFNK+nlIL gpfh6fvOzjdsvX15p/22FWQcMoK2p6/yjgzJhhJm+UK3RHNi0DDvq0lrxzaJ5F2diUHd wztE+mfx/Zq5m6olyKOnjKH7J6XXntZHBcAv4zqR3oiY56E2KjwfTEwEdfui84hPoRN1 +RBA== X-Gm-Message-State: AOAM530+IC7nqkMTG7dG8vzpRQtiIs/B1aNsjHSkX9SzAhHcfar67zfT QxkXuKkRjde9ooblr/pL/qlJtWp6qqQ= X-Google-Smtp-Source: ABdhPJyLNIvlvp+c/92PIVYY+vkrwayTyczswSCcqQZlvFWS8fbucNBXiHPTUgJKdjTpiYRorW6lIQ== X-Received: by 2002:a1c:7fd7:: with SMTP id a206mr8282351wmd.104.1594976681124; Fri, 17 Jul 2020 02:04:41 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:40 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 06/18] drm/arc: Embedded a drm_simple_display_pipe Date: Fri, 17 Jul 2020 11:04:18 +0200 Message-Id: <20200717090430.1146256-6-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This is a prep step to convert arc over to the simple kms helpers, for now we just use this as an embedding container to drop all the various allocations. Big change is the removal of the various devm_kzalloc, which have the wrong lifetimes anyway. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu.h | 7 ++++--- drivers/gpu/drm/arc/arcpgu_crtc.c | 9 +++------ drivers/gpu/drm/arc/arcpgu_drv.c | 2 +- drivers/gpu/drm/arc/arcpgu_hdmi.c | 5 ++--- drivers/gpu/drm/arc/arcpgu_sim.c | 5 ++--- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index ed77dd5dd5cb..52afd638a4d2 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -8,17 +8,18 @@ #ifndef _ARCPGU_H_ #define _ARCPGU_H_ +#include + struct arcpgu_drm_private { struct drm_device drm; void __iomem *regs; struct clk *clk; - struct drm_crtc crtc; - struct drm_plane *plane; + struct drm_simple_display_pipe pipe; }; #define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm) -#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc) +#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, pipe.crtc) static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu, unsigned int reg, u32 value) diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index ba796a216244..88ba2e284fc0 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -182,9 +182,7 @@ static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm) struct drm_plane *plane = NULL; int ret; - plane = devm_kzalloc(drm->dev, sizeof(*plane), GFP_KERNEL); - if (!plane) - return ERR_PTR(-ENOMEM); + plane = &arcpgu->pipe.plane; ret = drm_universal_plane_init(drm, plane, 0xff, &arc_pgu_plane_funcs, arc_pgu_supported_formats, @@ -195,7 +193,6 @@ static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm) return ERR_PTR(ret); drm_plane_helper_add(plane, &arc_pgu_plane_helper_funcs); - arcpgu->plane = plane; return plane; } @@ -210,13 +207,13 @@ int arc_pgu_setup_crtc(struct drm_device *drm) if (IS_ERR(primary)) return PTR_ERR(primary); - ret = drm_crtc_init_with_planes(drm, &arcpgu->crtc, primary, NULL, + ret = drm_crtc_init_with_planes(drm, &arcpgu->pipe.crtc, primary, NULL, &arc_pgu_crtc_funcs, NULL); if (ret) { arc_pgu_plane_destroy(primary); return ret; } - drm_crtc_helper_add(&arcpgu->crtc, &arc_pgu_crtc_helper_funcs); + drm_crtc_helper_add(&arcpgu->pipe.crtc, &arc_pgu_crtc_helper_funcs); return 0; } diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index c6a8deb56b0f..9020352816fa 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -120,7 +120,7 @@ static int arcpgu_show_pxlclock(struct seq_file *m, void *arg) struct drm_device *drm = node->minor->dev; struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); unsigned long clkrate = clk_get_rate(arcpgu->clk); - unsigned long mode_clock = arcpgu->crtc.mode.crtc_clock * 1000; + unsigned long mode_clock = arcpgu->pipe.crtc.mode.crtc_clock * 1000; seq_printf(m, "hw : %lu\n", clkrate); seq_printf(m, "mode: %lu\n", mode_clock); diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c index 52839934f2fb..dbad2c9237fe 100644 --- a/drivers/gpu/drm/arc/arcpgu_hdmi.c +++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c @@ -18,14 +18,13 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np) { + struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); struct drm_encoder *encoder; struct drm_bridge *bridge; int ret = 0; - encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL); - if (encoder == NULL) - return -ENOMEM; + encoder = &arcpgu->pipe.encoder; /* Locate drm bridge from the hdmi encoder DT node */ bridge = of_drm_find_bridge(np); diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c index 37d961668dfe..134afb9fa625 100644 --- a/drivers/gpu/drm/arc/arcpgu_sim.c +++ b/drivers/gpu/drm/arc/arcpgu_sim.c @@ -56,14 +56,13 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) { + struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); struct arcpgu_drm_connector *arcpgu_connector; struct drm_encoder *encoder; struct drm_connector *connector; int ret; - encoder = devm_kzalloc(drm->dev, sizeof(*encoder), GFP_KERNEL); - if (encoder == NULL) - return -ENOMEM; + encoder = &arcpgu->pipe.encoder; encoder->possible_crtcs = 1; encoder->possible_clones = 0; From patchwork Fri Jul 17 09:04:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669587 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5BAA813A4 for ; Fri, 17 Jul 2020 09:04:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3778D20829 for ; Fri, 17 Jul 2020 09:04:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="MPJaUip5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3778D20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E10916ED6C; Fri, 17 Jul 2020 09:04:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 781CB6ED6C for ; Fri, 17 Jul 2020 09:04:43 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id a6so6813253wmm.0 for ; Fri, 17 Jul 2020 02:04:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XO1QRsngG69i/SYmBA9xNZevjmrId/N3WszDady8dis=; b=MPJaUip5MbgOd1vDHYEymH7+k/uNfp8+4EV1SES09lwdemP7M9QNmoEe85iK7yVFbE EluP2J9SYwP1DPHlpCfyq9omcWfQ1uxG/1kJPaHTWXDshdxSNSaRrr98UutZ88rAMjqH FX7Xh89NWHCQGoBkwv1JGdY+2aNpIbNVe6Q8A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XO1QRsngG69i/SYmBA9xNZevjmrId/N3WszDady8dis=; b=cw1Uz62hDf9Ay1hy6Ha2Mzzxkl2EDR7k0oCkLGB7aU/61LsThn1c2iq10hiZHqsNal yv5E6BFOiqgzfRuyJIToB/oWx8YTehd3tlfoqz8vbKIUS82vTXZQHa/75R0FiC8QOjMq E+71XQQDiam3XQA0bjs2DtaICvoIiamIrV6DBZUDLsRYJkE2ETLpzzr+nKyqlCdUvu+Y 9q76UVgOW7zXcv+fDjsJ6JfZe4t7+dsU0ovKzLpzitSv9XibWZAEe3YKdBxaoSIN4DYB 3WeRCVXXSK7aYU9JDW6v/HK+l6hD0D/8NOSLclbxelpTCK9mIgZAIBstvnwdkWakJp2g Plbw== X-Gm-Message-State: AOAM531uI8Hih+f2UajZfMWVIEFXI1qCjWzRKO9bfGWswaySpcGyiO5i Yc+IYxep1BJXofTCNQmZZnPnv5spR9w= X-Google-Smtp-Source: ABdhPJwqaszmiWUrIMH0ASGH2nTT7dqmPzxs1O48vwilwGsGdomVD2e5DED3UF8rbcn0D3Zl4q8hNg== X-Received: by 2002:a05:600c:2202:: with SMTP id z2mr8724238wml.13.1594976682061; Fri, 17 Jul 2020 02:04:42 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:41 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 07/18] drm/arc: Embedd a drm_connector for sim case Date: Fri, 17 Jul 2020 11:04:19 +0200 Message-Id: <20200717090430.1146256-7-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Removes the last devm_kzalloc, which means we're now prepared to use drmm_mode_config_cleanup! Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu.h | 1 + drivers/gpu/drm/arc/arcpgu_sim.c | 14 +------------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index 52afd638a4d2..c52cdd2274e1 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -15,6 +15,7 @@ struct arcpgu_drm_private { void __iomem *regs; struct clk *clk; struct drm_simple_display_pipe pipe; + struct drm_connector sim_conn; }; #define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm) diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c index 134afb9fa625..e42fe5d05a3d 100644 --- a/drivers/gpu/drm/arc/arcpgu_sim.c +++ b/drivers/gpu/drm/arc/arcpgu_sim.c @@ -18,10 +18,6 @@ #define YRES_MAX 8192 -struct arcpgu_drm_connector { - struct drm_connector connector; -}; - static int arcpgu_drm_connector_get_modes(struct drm_connector *connector) { int count; @@ -57,7 +53,6 @@ static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) { struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct arcpgu_drm_connector *arcpgu_connector; struct drm_encoder *encoder; struct drm_connector *connector; int ret; @@ -72,14 +67,7 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) if (ret) return ret; - arcpgu_connector = devm_kzalloc(drm->dev, sizeof(*arcpgu_connector), - GFP_KERNEL); - if (!arcpgu_connector) { - ret = -ENOMEM; - goto error_encoder_cleanup; - } - - connector = &arcpgu_connector->connector; + connector = &arcpgu->sim_conn; drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs); ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs, From patchwork Fri Jul 17 09:04:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669601 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0568660D for ; Fri, 17 Jul 2020 09:05:00 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D736F208C7 for ; Fri, 17 Jul 2020 09:04:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="FgzDsA3Q" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D736F208C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 969E56ED6A; Fri, 17 Jul 2020 09:04:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 81E8C6ED6F for ; Fri, 17 Jul 2020 09:04:44 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id a6so10213047wrm.4 for ; Fri, 17 Jul 2020 02:04:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J8b5fVu/k5TLlf+36lHMvWs7MDKThz1c6LCWkolzeR8=; b=FgzDsA3QYkleTg7CX3mtGxL02kFU2ARb2viz2T9KB2fRmKwgKjaGAOTfRy0Xi8/Nwx 2AjNpuOUMrmBJu76I8VjtD4NkLNxQPD5MGDDiDhKhRl8v9JJ7woeYif22rDIAgneSK6h Fv6nuz51OdNCTwHcfeVMhArQxNCTn9nr8W1H8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J8b5fVu/k5TLlf+36lHMvWs7MDKThz1c6LCWkolzeR8=; b=iyrHo0VAyTTb3oLaq/jKs49a5y2ChJzHxMvNAGCC3ye6phgNaV3wvKjTe4xfpgqKai HBqI05zDZUFtr9oGdyR6+0Y5JXwt+pZ9rPVP4ollEpJAenOqxKmIB5I6ELZahgzYZ2ok u7dAq6+mjTywYC/qidLNFfzfT3wAIiAV7ZLmKHwUUSuEKwfaFnED1L6B/ZffgsDsJgNN 3mUnmltOihMIbHkSAw4lLZZ+NJASbbVasdhenjG5U19sccoLX2jjh19JNl9JF+UzQOtx MM4uqm3wye0TAJMLobqTWLWO5nxF+qdRGJcx1rU4TmIAUQMzwZ7EXI8W2POUwufGOuE8 Fksg== X-Gm-Message-State: AOAM5335vZW2gtiJ+MQAzrYaZ22B/nnaoQ6vVVdYKSNq3mLkGU8FHGt1 YPMlXsH4oj8RG3KJkW5li1h3SzL3RHE= X-Google-Smtp-Source: ABdhPJwgo0vP3eFSMb9J9ENXepuXC2RUnaZNJ5UMigc+qA0wfuJpRIZ0IycKTJiqiwXjzBf9kz8ypQ== X-Received: by 2002:adf:c142:: with SMTP id w2mr8754946wre.337.1594976682838; Fri, 17 Jul 2020 02:04:42 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:42 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 08/18] drm/arc: Drop surplus connector registration Date: Fri, 17 Jul 2020 11:04:20 +0200 Message-Id: <20200717090430.1146256-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_connector_register does nothing before drm_dev_register(), it is meant for hotpluggable connectors only. Same for the unregister side. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/arc/arcpgu_sim.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c index e42fe5d05a3d..3772df1647aa 100644 --- a/drivers/gpu/drm/arc/arcpgu_sim.c +++ b/drivers/gpu/drm/arc/arcpgu_sim.c @@ -29,7 +29,6 @@ static int arcpgu_drm_connector_get_modes(struct drm_connector *connector) static void arcpgu_drm_connector_destroy(struct drm_connector *connector) { - drm_connector_unregister(connector); drm_connector_cleanup(connector); } @@ -80,7 +79,6 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) ret = drm_connector_attach_encoder(connector, encoder); if (ret < 0) { dev_err(drm->dev, "could not attach connector to encoder\n"); - drm_connector_unregister(connector); goto error_connector_cleanup; } From patchwork Fri Jul 17 09:04:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669595 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2EDC960D for ; Fri, 17 Jul 2020 09:04:57 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0C997208C7 for ; Fri, 17 Jul 2020 09:04:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="IcquJZl1" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C997208C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9FE646ED6F; Fri, 17 Jul 2020 09:04:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7A3BA6ED72 for ; Fri, 17 Jul 2020 09:04:45 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id b6so10158316wrs.11 for ; Fri, 17 Jul 2020 02:04:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jdEfestflJ8davGwM7numFfsxBXDPZw6lvxhc4F+epk=; b=IcquJZl1WndmiB9+az0uPNCQnvbDXy7qmgNIAVy7tV7ltGm7GjUj7u4tAmVL53L8I9 aSHaNACPQYnbtHxHqW1vfuePnrPjRs0xrMp3Tphtb36aHmjDlu3prO77Of5hyaLGn9el YbG9LcWbGVjxZWJDKjr+IW0HqFOdC4UeIGSjk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jdEfestflJ8davGwM7numFfsxBXDPZw6lvxhc4F+epk=; b=OXUzDMC1sR2LJRvqWUJu+ajzaM0MktCbFHI57DkT1aC9CJiVwiyEPsEPPBAqHmyzO2 jkSDsv1N06fBpKb1U9ZK2MCIuORmJOXArBKGhSeEJa7lfrEXJs4dEya2cq1JTNu13tfL eZ7qAjz0k6oMjyQQhxt2hd/+DuSfyYnTDJw/gBsBOeB1okFBCdTN/aRbkOVIODCTeeBo Bu9JTMHf0/Z7pgjjnF7+fy0Ab972xAIlYSFE+DqJHdDR/FLbyWKZuZlAbyDfPBc8CaKD +SAP4/4m6o3dYZZAqHELAL2pfh3VR8w/tZvaj/M0e+zlA/cCZNOeiscUKKmYRcR5dRy+ 7Wrw== X-Gm-Message-State: AOAM530tDnU8GWxHdl1kR/Mwsck2vaeSCLFrZ8vmJTCd0X9kwcHt6JOx a7uVRSYg66AhXM9UqCPMo6CC5YbnjCE= X-Google-Smtp-Source: ABdhPJzlOfMfaAbMl9h9X3pMh9++NTB8fk4IFmiSwpbMAdLj9+mEnQlv2bZs6MFCWwbfW5pGoRfXOg== X-Received: by 2002:adf:fe4b:: with SMTP id m11mr9094905wrs.36.1594976683691; Fri, 17 Jul 2020 02:04:43 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:43 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 09/18] drm/arc: Use drmm_mode_config_cleanup Date: Fri, 17 Jul 2020 11:04:21 +0200 Message-Id: <20200717090430.1146256-9-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With autocleanup through drm_device management we can delete all the code. Possible now that there's no confusion against devm_kzalloc'ed structures anymore. I inlined arcpgu_setup_mode_config because it's tiny and the newly needed return value handling would have been more ... Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu_crtc.c | 4 +--- drivers/gpu/drm/arc/arcpgu_drv.c | 21 +++++++++------------ drivers/gpu/drm/arc/arcpgu_hdmi.c | 6 +----- drivers/gpu/drm/arc/arcpgu_sim.c | 11 ++--------- 4 files changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index 88ba2e284fc0..72719556debb 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -209,10 +209,8 @@ int arc_pgu_setup_crtc(struct drm_device *drm) ret = drm_crtc_init_with_planes(drm, &arcpgu->pipe.crtc, primary, NULL, &arc_pgu_crtc_funcs, NULL); - if (ret) { - arc_pgu_plane_destroy(primary); + if (ret) return ret; - } drm_crtc_helper_add(&arcpgu->pipe.crtc, &arc_pgu_crtc_helper_funcs); return 0; diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 9020352816fa..6349e9dc770e 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -30,16 +30,6 @@ static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = { .atomic_commit = drm_atomic_helper_commit, }; -static void arcpgu_setup_mode_config(struct drm_device *drm) -{ - drm_mode_config_init(drm); - drm->mode_config.min_width = 0; - drm->mode_config.min_height = 0; - drm->mode_config.max_width = 1920; - drm->mode_config.max_height = 1080; - drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs; -} - DEFINE_DRM_GEM_CMA_FOPS(arcpgu_drm_ops); static int arcpgu_load(struct arcpgu_drm_private *arcpgu) @@ -54,7 +44,15 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) if (IS_ERR(arcpgu->clk)) return PTR_ERR(arcpgu->clk); - arcpgu_setup_mode_config(drm); + ret = drmm_mode_config_init(drm); + if (ret) + return ret; + + drm->mode_config.min_width = 0; + drm->mode_config.min_height = 0; + drm->mode_config.max_width = 1920; + drm->mode_config.max_height = 1080; + drm->mode_config.funcs = &arcpgu_drm_modecfg_funcs; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); arcpgu->regs = devm_ioremap_resource(&pdev->dev, res); @@ -108,7 +106,6 @@ static int arcpgu_unload(struct drm_device *drm) { drm_kms_helper_poll_fini(drm); drm_atomic_helper_shutdown(drm); - drm_mode_config_cleanup(drm); return 0; } diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c index dbad2c9237fe..925d6d31bb78 100644 --- a/drivers/gpu/drm/arc/arcpgu_hdmi.c +++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c @@ -39,9 +39,5 @@ int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np) return ret; /* Link drm_bridge to encoder */ - ret = drm_bridge_attach(encoder, bridge, NULL, 0); - if (ret) - drm_encoder_cleanup(encoder); - - return ret; + return drm_bridge_attach(encoder, bridge, NULL, 0); } diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c index 3772df1647aa..afc34f8b4de0 100644 --- a/drivers/gpu/drm/arc/arcpgu_sim.c +++ b/drivers/gpu/drm/arc/arcpgu_sim.c @@ -73,21 +73,14 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) DRM_MODE_CONNECTOR_VIRTUAL); if (ret < 0) { dev_err(drm->dev, "failed to initialize drm connector\n"); - goto error_encoder_cleanup; + return ret; } ret = drm_connector_attach_encoder(connector, encoder); if (ret < 0) { dev_err(drm->dev, "could not attach connector to encoder\n"); - goto error_connector_cleanup; + return ret; } return 0; - -error_connector_cleanup: - drm_connector_cleanup(connector); - -error_encoder_cleanup: - drm_encoder_cleanup(encoder); - return ret; } From patchwork Fri Jul 17 09:04:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669599 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8850E14E3 for ; Fri, 17 Jul 2020 09:04:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6605F20829 for ; Fri, 17 Jul 2020 09:04:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="ALwYn273" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6605F20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE8F56ED72; Fri, 17 Jul 2020 09:04:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7DE126ED6F for ; Fri, 17 Jul 2020 09:04:46 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id o2so16115080wmh.2 for ; Fri, 17 Jul 2020 02:04:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ezYDdxg/7mPn9HTGFQP0CvWZcnlJPLHe1q3mg74ENb4=; b=ALwYn273RhTLJBZWUYezsHm5z+SEI4l4ikHUK3HiUhXTD2wYHnPG8cqY/v4bWi5EBg RF0HffJ5wSvyZO8CREtlXlSsB4rimzQCbdTw6kmYIwHxXG0rBi3S1WbVoz7LcdoCBA/1 xsuDZ7sZ/eINbNlCk+cyoA1ZXOPAEhKk8kuJI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ezYDdxg/7mPn9HTGFQP0CvWZcnlJPLHe1q3mg74ENb4=; b=O26VseKpCjsgxlLE2Dbl6Mn9ers2NND3/LRn1cV6GOTEH2B5oAGiq0asQYpPDG4CK9 VeDgGfQcpWTTEXwgxaHRQrsCm5HaOfc6pv1cvRulZ7Zc4/X4KFpoERSbNA22iQIzsQ9l EaqvA5oMFgFlB5t6g+l7P/rKkWjiVNy0OiUPA86cbBrEzRgBzGXk0JNIOPwM6BixQxTZ pZEN1+B8DLxRpwUSQSy9Yh/szg6cqAAJBD+G3hcN82SzFrOh/Hxdknowu6OTAOdV5dBi iTSnwQqjkPll0+to3MiLabSQ1GJ/tmh/G56u2Gvkil0JXizx8RlZxcMghrZ9DXlR744a BdZg== X-Gm-Message-State: AOAM530XgfhWWyAOBWkmODde2H4o8rb1Ng2a3TTUEg/I+IQ9WkcaXOlg ik7maFUqTeO+8GP6OuH8Ec0xtSmFEBY= X-Google-Smtp-Source: ABdhPJxjCXPrSYMXos5w7Z/yYLPe2nq9iilBnBTpidNYntr91zV04kjtM2D40ljy+AfoLi8M2kWM3w== X-Received: by 2002:a1c:2905:: with SMTP id p5mr8659909wmp.91.1594976684638; Fri, 17 Jul 2020 02:04:44 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:44 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 10/18] drm/arc: Align with simple pipe helpers Date: Fri, 17 Jul 2020 11:04:22 +0200 Message-Id: <20200717090430.1146256-10-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simple pipe helpers only have an enable and disable hook, no more mode_set_nofb. Call it from our enable hook to align with that conversions. Atomic helpers always call mode_set_nofb and enable together, so there's no functional change here. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu_crtc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index 72719556debb..c7769edeefdf 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -73,10 +73,9 @@ static enum drm_mode_status arc_pgu_crtc_mode_valid(struct drm_crtc *crtc, return MODE_NOCLOCK; } -static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc) +static void arc_pgu_mode_set(struct arcpgu_drm_private *arcpgu) { - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); - struct drm_display_mode *m = &crtc->state->adjusted_mode; + struct drm_display_mode *m = &arcpgu->pipe.crtc.state->adjusted_mode; u32 val; arc_pgu_write(arcpgu, ARCPGU_REG_FMT, @@ -110,7 +109,7 @@ static void arc_pgu_crtc_mode_set_nofb(struct drm_crtc *crtc) arc_pgu_write(arcpgu, ARCPGU_REG_STRIDE, 0); arc_pgu_write(arcpgu, ARCPGU_REG_START_SET, 1); - arc_pgu_set_pxl_fmt(crtc); + arc_pgu_set_pxl_fmt(&arcpgu->pipe.crtc); clk_set_rate(arcpgu->clk, m->crtc_clock * 1000); } @@ -120,6 +119,8 @@ static void arc_pgu_crtc_atomic_enable(struct drm_crtc *crtc, { struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); + arc_pgu_mode_set(arcpgu); + clk_prepare_enable(arcpgu->clk); arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) | @@ -139,7 +140,6 @@ static void arc_pgu_crtc_atomic_disable(struct drm_crtc *crtc, static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = { .mode_valid = arc_pgu_crtc_mode_valid, - .mode_set_nofb = arc_pgu_crtc_mode_set_nofb, .atomic_enable = arc_pgu_crtc_atomic_enable, .atomic_disable = arc_pgu_crtc_atomic_disable, }; From patchwork Fri Jul 17 09:04:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669611 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E0C213A4 for ; Fri, 17 Jul 2020 09:05:08 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0A6672083E for ; Fri, 17 Jul 2020 09:05:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="alN5kWHv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A6672083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB2F46ED7E; Fri, 17 Jul 2020 09:04:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 81F166ED6A for ; Fri, 17 Jul 2020 09:04:47 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id z13so10197380wrw.5 for ; Fri, 17 Jul 2020 02:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7pR9YKHp5+Lt/Q2+ufTvkK6NQ4xGvhYIWxEzAYNCfaE=; b=alN5kWHvKisa3LtUu/hdBUcVwrR4W41191KcfSFdWqVO1VLRGuDC4D44lW2PdfEQvT i04If4uIKv8iQKLxQ9ug7w27FWz5ZKi1FhXrxGiVgOtlFlyI5oUURwewQZB58vZcdvlm J5t/h0mWoUnsZsHg3uCqC2NvrEP2TRvfb0CE0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7pR9YKHp5+Lt/Q2+ufTvkK6NQ4xGvhYIWxEzAYNCfaE=; b=hzlejfHgPc9+vn3wJHxmGo1pkSpJOMq67VTGuxSGz6+wrnCaCoK+S6s1NBwpEppyQz Cbc5rSkUCGOMm3eo8uep+b6cKM1bV8P6ERbfFhjHJ2KTp7uQp0N6igmwnjcq0wlrMB4L HuQCq5lgj31R95jH5IgolD4lnJEd7IxNzC9JDCuwRcOYUxfRYSHW+xSMG3WP/3KJoss3 0IgawjaW21aOHJ/flehmBdA1B1jV9hZKMjnOGj+08X120RQYd0EhHajKNQYVaCt9x0mV QUBhXff63KDgWoNHDczPkSGWTRf7aRlWhNexZhb5wrueJwNzqkTHgrsCQMwtjd7j0CSW w3Ag== X-Gm-Message-State: AOAM5337iEIWPo289wNG28+XQBycApNA8lLMwyb/DoSOLeSyRkid9+2j Y3zs4zqjFejoSWGSYsWMDP64oY5jVUw= X-Google-Smtp-Source: ABdhPJxn+2kS3JgxgFpGi74qpgmrL8hzCXVUUERKP4qt/HDESLtXEi/50aUxOthGL78p/M+WdVQDqQ== X-Received: by 2002:adf:ef46:: with SMTP id c6mr9261399wrp.34.1594976685787; Fri, 17 Jul 2020 02:04:45 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:45 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 11/18] drm/arc: Convert to drm_simple_kms_pipe_helper Date: Fri, 17 Jul 2020 11:04:23 +0200 Message-Id: <20200717090430.1146256-11-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Really straighforward, only slight issue is that the sim connector is created after the pipe is set up, so can't use the helpers perfectly yet. Subsequent patches will fix that. Aside from lots of deleting code no functional changes in here. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu.h | 4 +- drivers/gpu/drm/arc/arcpgu_crtc.c | 102 ++++++++---------------------- drivers/gpu/drm/arc/arcpgu_drv.c | 2 +- drivers/gpu/drm/arc/arcpgu_hdmi.c | 18 +----- 4 files changed, 31 insertions(+), 95 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index c52cdd2274e1..b5c699d14f27 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -20,7 +20,7 @@ struct arcpgu_drm_private { #define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm) -#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, pipe.crtc) +#define pipe_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, pipe) static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu, unsigned int reg, u32 value) @@ -34,7 +34,7 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu, return ioread32(arcpgu->regs + reg); } -int arc_pgu_setup_crtc(struct drm_device *dev); +int arc_pgu_setup_pipe(struct drm_device *dev); int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np); int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np); diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index c7769edeefdf..5c6d7e34ca73 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -25,10 +25,9 @@ static const u32 arc_pgu_supported_formats[] = { DRM_FORMAT_ARGB8888, }; -static void arc_pgu_set_pxl_fmt(struct drm_crtc *crtc) +static void arc_pgu_set_pxl_fmt(struct arcpgu_drm_private *arcpgu) { - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); - const struct drm_framebuffer *fb = crtc->primary->state->fb; + const struct drm_framebuffer *fb = arcpgu->pipe.plane.state->fb; uint32_t pixel_format = fb->format->format; u32 format = DRM_FORMAT_INVALID; int i; @@ -59,10 +58,10 @@ static const struct drm_crtc_funcs arc_pgu_crtc_funcs = { .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, }; -static enum drm_mode_status arc_pgu_crtc_mode_valid(struct drm_crtc *crtc, - const struct drm_display_mode *mode) +static enum drm_mode_status arc_pgu_mode_valid(struct drm_simple_display_pipe *pipe, + const struct drm_display_mode *mode) { - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); + struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); long rate, clk_rate = mode->clock * 1000; long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec */ @@ -109,15 +108,16 @@ static void arc_pgu_mode_set(struct arcpgu_drm_private *arcpgu) arc_pgu_write(arcpgu, ARCPGU_REG_STRIDE, 0); arc_pgu_write(arcpgu, ARCPGU_REG_START_SET, 1); - arc_pgu_set_pxl_fmt(&arcpgu->pipe.crtc); + arc_pgu_set_pxl_fmt(arcpgu); clk_set_rate(arcpgu->clk, m->crtc_clock * 1000); } -static void arc_pgu_crtc_atomic_enable(struct drm_crtc *crtc, - struct drm_crtc_state *old_state) +static void arc_pgu_enable(struct drm_simple_display_pipe *pipe, + struct drm_crtc_state *crtc_state, + struct drm_plane_state *plane_state) { - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); + struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); arc_pgu_mode_set(arcpgu); @@ -127,10 +127,9 @@ static void arc_pgu_crtc_atomic_enable(struct drm_crtc *crtc, ARCPGU_CTRL_ENABLE_MASK); } -static void arc_pgu_crtc_atomic_disable(struct drm_crtc *crtc, - struct drm_crtc_state *old_state) +static void arc_pgu_disable(struct drm_simple_display_pipe *pipe) { - struct arcpgu_drm_private *arcpgu = crtc_to_arcpgu_priv(crtc); + struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); clk_disable_unprepare(arcpgu->clk); arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, @@ -138,80 +137,33 @@ static void arc_pgu_crtc_atomic_disable(struct drm_crtc *crtc, ~ARCPGU_CTRL_ENABLE_MASK); } -static const struct drm_crtc_helper_funcs arc_pgu_crtc_helper_funcs = { - .mode_valid = arc_pgu_crtc_mode_valid, - .atomic_enable = arc_pgu_crtc_atomic_enable, - .atomic_disable = arc_pgu_crtc_atomic_disable, -}; - -static void arc_pgu_plane_atomic_update(struct drm_plane *plane, - struct drm_plane_state *state) +static void arc_pgu_update(struct drm_simple_display_pipe *pipe, + struct drm_plane_state *state) { struct arcpgu_drm_private *arcpgu; struct drm_gem_cma_object *gem; - if (!plane->state->crtc || !plane->state->fb) + if (!pipe->plane.state->crtc || !pipe->plane.state->fb) return; - arcpgu = crtc_to_arcpgu_priv(plane->state->crtc); - gem = drm_fb_cma_get_gem_obj(plane->state->fb, 0); + arcpgu = pipe_to_arcpgu_priv(pipe); + gem = drm_fb_cma_get_gem_obj(pipe->plane.state->fb, 0); arc_pgu_write(arcpgu, ARCPGU_REG_BUF0_ADDR, gem->paddr); } -static const struct drm_plane_helper_funcs arc_pgu_plane_helper_funcs = { - .atomic_update = arc_pgu_plane_atomic_update, +static const struct drm_simple_display_pipe_funcs arc_pgu_pipe_funcs = { + .update = arc_pgu_update, + .mode_valid = arc_pgu_mode_valid, + .enable = arc_pgu_enable, + .disable = arc_pgu_disable, }; -static void arc_pgu_plane_destroy(struct drm_plane *plane) -{ - drm_plane_cleanup(plane); -} - -static const struct drm_plane_funcs arc_pgu_plane_funcs = { - .update_plane = drm_atomic_helper_update_plane, - .disable_plane = drm_atomic_helper_disable_plane, - .destroy = arc_pgu_plane_destroy, - .reset = drm_atomic_helper_plane_reset, - .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, -}; - -static struct drm_plane *arc_pgu_plane_init(struct drm_device *drm) +int arc_pgu_setup_pipe(struct drm_device *drm) { struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct drm_plane *plane = NULL; - int ret; - - plane = &arcpgu->pipe.plane; - - ret = drm_universal_plane_init(drm, plane, 0xff, &arc_pgu_plane_funcs, - arc_pgu_supported_formats, - ARRAY_SIZE(arc_pgu_supported_formats), - NULL, - DRM_PLANE_TYPE_PRIMARY, NULL); - if (ret) - return ERR_PTR(ret); - - drm_plane_helper_add(plane, &arc_pgu_plane_helper_funcs); - - return plane; -} - -int arc_pgu_setup_crtc(struct drm_device *drm) -{ - struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct drm_plane *primary; - int ret; - - primary = arc_pgu_plane_init(drm); - if (IS_ERR(primary)) - return PTR_ERR(primary); - - ret = drm_crtc_init_with_planes(drm, &arcpgu->pipe.crtc, primary, NULL, - &arc_pgu_crtc_funcs, NULL); - if (ret) - return ret; - drm_crtc_helper_add(&arcpgu->pipe.crtc, &arc_pgu_crtc_helper_funcs); - return 0; + return drm_simple_display_pipe_init(drm, &arcpgu->pipe, &arc_pgu_pipe_funcs, + arc_pgu_supported_formats, + ARRAY_SIZE(arc_pgu_supported_formats), + NULL, NULL); } diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 6349e9dc770e..222ab28efbd0 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -70,7 +70,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) if (dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32))) return -ENODEV; - if (arc_pgu_setup_crtc(drm) < 0) + if (arc_pgu_setup_pipe(drm) < 0) return -ENODEV; /* diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c index 925d6d31bb78..d430af686cbc 100644 --- a/drivers/gpu/drm/arc/arcpgu_hdmi.c +++ b/drivers/gpu/drm/arc/arcpgu_hdmi.c @@ -12,32 +12,16 @@ #include "arcpgu.h" -static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { - .destroy = drm_encoder_cleanup, -}; - int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np) { struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct drm_encoder *encoder; struct drm_bridge *bridge; - int ret = 0; - - encoder = &arcpgu->pipe.encoder; - /* Locate drm bridge from the hdmi encoder DT node */ bridge = of_drm_find_bridge(np); if (!bridge) return -EPROBE_DEFER; - encoder->possible_crtcs = 1; - encoder->possible_clones = 0; - ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs, - DRM_MODE_ENCODER_TMDS, NULL); - if (ret) - return ret; - /* Link drm_bridge to encoder */ - return drm_bridge_attach(encoder, bridge, NULL, 0); + return drm_simple_display_pipe_attach_bridge(&arcpgu->pipe, bridge); } From patchwork Fri Jul 17 09:04:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669605 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15B671392 for ; Fri, 17 Jul 2020 09:05:03 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E6F5220829 for ; Fri, 17 Jul 2020 09:05:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="GsT+igCu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6F5220829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E03696ED77; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5D65F6ED6A for ; Fri, 17 Jul 2020 09:04:48 +0000 (UTC) Received: by mail-wr1-x42b.google.com with SMTP id s10so10137321wrw.12 for ; Fri, 17 Jul 2020 02:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PM+GxM/lV46gJD6RsTGqviR3KLKvT4VxUg6rgM4uzu0=; b=GsT+igCu0nDndp3kmVTvwAzCs8C1Ww9LCERgOYPXlXSb27cpLZJCuEFHv+8nabqoQJ w2xpc+Kgu+CB7FM+TpTxj/6QJAq2MYGBuNgjPjiJSHBNmFOeKBH+8NajJe6ZRFAJD+17 jm03sObOkeQPZTXpk/aPUZD9LO6M77M+VHd58= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PM+GxM/lV46gJD6RsTGqviR3KLKvT4VxUg6rgM4uzu0=; b=nxFsrwnBREtdabpV2exy2Ebk8gyi28VvB36aL2R7yUkDSe609dIr8Tz1ZFyKB0RNuQ UHK1HQaRJo3lIrv9ZFtV/s/ex4V9kBln3jMsv7nD78nOjPWk7/2Zm+Q493DuUUOh8aJ8 kuoq0EnVzSLY+CT0GEDqvg6DF5fjKdCFfZX2sQQGwz74dROPyqagHks0MhNsFB7kGpx6 3UokkuFo4gP+FYgDCfUBH/xFXBEE4ffu8zU2hND4P7tBN9ep77xq9m4+pohtBZbvLI6Z eu9RFbWEeuGk9VxQqySwQSu9sdVReMJEibCCU0T55L7d6R9wFf2bkQqDgrm/D/n/Gi/b LzBA== X-Gm-Message-State: AOAM532IqGWb8plN9IMg3lAEE0fSVCCWoJPYX4NzhDcLl3Wbl0Hg9V3X acVSQFfSXXQPuZueHkiIUx9D1ES3VLw= X-Google-Smtp-Source: ABdhPJwWOBeIVMDFMKlZoJC19ismEn6ErZj1ineMpCf+0aKs4RF15egnR4NnD1PFk1offsJmfq1jeQ== X-Received: by 2002:a5d:6802:: with SMTP id w2mr8899472wru.88.1594976686710; Fri, 17 Jul 2020 02:04:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:46 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 12/18] drm/arc: Drop crtc check in arc_pgu_update Date: Fri, 17 Jul 2020 11:04:24 +0200 Message-Id: <20200717090430.1146256-12-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Eugeniy Paltsev , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It's redundant, drm core guarantees that state->fb is set iff state->crtc is set. v2: I had a misconception about simple helpers here and thought they filter this out. They don't. Issue reported by Eugeniy. Cc: Eugeniy Paltsev Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c index 5c6d7e34ca73..a72136ee4e46 100644 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ b/drivers/gpu/drm/arc/arcpgu_crtc.c @@ -143,7 +143,7 @@ static void arc_pgu_update(struct drm_simple_display_pipe *pipe, struct arcpgu_drm_private *arcpgu; struct drm_gem_cma_object *gem; - if (!pipe->plane.state->crtc || !pipe->plane.state->fb) + if (!pipe->plane.state->fb) return; arcpgu = pipe_to_arcpgu_priv(pipe); From patchwork Fri Jul 17 09:04:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669615 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DCF81392 for ; Fri, 17 Jul 2020 09:05:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3B9BA208C7 for ; Fri, 17 Jul 2020 09:05:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="BQaftZtm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B9BA208C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 710A96ED83; Fri, 17 Jul 2020 09:04:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id A76526ED6A for ; Fri, 17 Jul 2020 09:04:49 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id r12so10108460wrj.13 for ; Fri, 17 Jul 2020 02:04:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zqRWYELVQbyWR6OA3iLwzybjwxNH83m5O2BD/6WUTb8=; b=BQaftZtmq2X9L0CVXqRl2Pt5EAIkcfjPwjNT/vD3OU7DjUeIZQEnyr7GrLKSs8F+Al ZkvF01a3pDwZ5iYyxS/8FBtnW4HRiXRUNOe/NDL/Kn95y0/9CNgobaeendIWICSy1BTE TX3hBn9TVVUD4ncDbJX4FXE5h65dn57K108AE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zqRWYELVQbyWR6OA3iLwzybjwxNH83m5O2BD/6WUTb8=; b=WGm7oKT+e59YnpUI21qLyUTTLrRrfMObvIw7kxB4VnDSrO5SoGx4JhnDNIceIwFEUQ lCXDq4HByZac+wRtN+HxhbMWa8Knjp5LFb241GnVuPNnnVJEgqT1JmgG2i2d1aG4Jz50 8OhIj/Y5Z8n07OuFHm9qkL/9YlCdoNnu5cpVDSpawNsmyh8drIOEZEZJBeJ1vGdWNNfv I1zNfujkgEmLNcv4pw2e4Gsj34e/eK6xdIxzaNxWtun72aVbx3T26m+dnqFP1xJJ1pdx Q6jAoZrzZtlNOyYXOeIUuST4VU2+ea2qc3+qz31HxJLfVRr/Vt9mcT3O7PFGEUvI7xgv P0uA== X-Gm-Message-State: AOAM532uQK53wTgXaIXa6Bim8Qnq3F79GPE4qQxYkG/WzPTf2UzVJjvy lQdUn+bpH1h/nGnGsXmdkHFLwHevxQw= X-Google-Smtp-Source: ABdhPJz5bkKGwAcDaI76UK5IW0tPsqMQNQTai8y1WKsW+I1r13zQaJCrTmqNR92IWb60prtpYe5IxA== X-Received: by 2002:a5d:66ca:: with SMTP id k10mr9162657wrw.244.1594976687657; Fri, 17 Jul 2020 02:04:47 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:47 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 13/18] drm/arc: Inline arcpgu_crtc.c Date: Fri, 17 Jul 2020 11:04:25 +0200 Message-Id: <20200717090430.1146256-13-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Eugeniy Paltsev , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Really not big anymore. v2: Fixup update function, bug reported by Eugeniy Cc: Eugeniy Paltsev Signed-off-by: Daniel Vetter --- drivers/gpu/drm/arc/Makefile | 2 +- drivers/gpu/drm/arc/arcpgu.h | 1 - drivers/gpu/drm/arc/arcpgu_crtc.c | 169 ------------------------------ drivers/gpu/drm/arc/arcpgu_drv.c | 150 +++++++++++++++++++++++++- drivers/gpu/drm/arc/arcpgu_sim.c | 12 --- 5 files changed, 149 insertions(+), 185 deletions(-) delete mode 100644 drivers/gpu/drm/arc/arcpgu_crtc.c diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile index c7028b7427b3..c686e0287a71 100644 --- a/drivers/gpu/drm/arc/Makefile +++ b/drivers/gpu/drm/arc/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -arcpgu-y := arcpgu_crtc.o arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o +arcpgu-y := arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index b5c699d14f27..cee2448a07d6 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -34,7 +34,6 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu, return ioread32(arcpgu->regs + reg); } -int arc_pgu_setup_pipe(struct drm_device *dev); int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np); int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np); diff --git a/drivers/gpu/drm/arc/arcpgu_crtc.c b/drivers/gpu/drm/arc/arcpgu_crtc.c deleted file mode 100644 index a72136ee4e46..000000000000 --- a/drivers/gpu/drm/arc/arcpgu_crtc.c +++ /dev/null @@ -1,169 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * ARC PGU DRM driver. - * - * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "arcpgu.h" -#include "arcpgu_regs.h" - -#define ENCODE_PGU_XY(x, y) ((((x) - 1) << 16) | ((y) - 1)) - -static const u32 arc_pgu_supported_formats[] = { - DRM_FORMAT_RGB565, - DRM_FORMAT_XRGB8888, - DRM_FORMAT_ARGB8888, -}; - -static void arc_pgu_set_pxl_fmt(struct arcpgu_drm_private *arcpgu) -{ - const struct drm_framebuffer *fb = arcpgu->pipe.plane.state->fb; - uint32_t pixel_format = fb->format->format; - u32 format = DRM_FORMAT_INVALID; - int i; - u32 reg_ctrl; - - for (i = 0; i < ARRAY_SIZE(arc_pgu_supported_formats); i++) { - if (arc_pgu_supported_formats[i] == pixel_format) - format = arc_pgu_supported_formats[i]; - } - - if (WARN_ON(format == DRM_FORMAT_INVALID)) - return; - - reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL); - if (format == DRM_FORMAT_RGB565) - reg_ctrl &= ~ARCPGU_MODE_XRGB8888; - else - reg_ctrl |= ARCPGU_MODE_XRGB8888; - arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl); -} - -static const struct drm_crtc_funcs arc_pgu_crtc_funcs = { - .destroy = drm_crtc_cleanup, - .set_config = drm_atomic_helper_set_config, - .page_flip = drm_atomic_helper_page_flip, - .reset = drm_atomic_helper_crtc_reset, - .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, -}; - -static enum drm_mode_status arc_pgu_mode_valid(struct drm_simple_display_pipe *pipe, - const struct drm_display_mode *mode) -{ - struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); - long rate, clk_rate = mode->clock * 1000; - long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec */ - - rate = clk_round_rate(arcpgu->clk, clk_rate); - if ((max(rate, clk_rate) - min(rate, clk_rate) < diff) && (rate > 0)) - return MODE_OK; - - return MODE_NOCLOCK; -} - -static void arc_pgu_mode_set(struct arcpgu_drm_private *arcpgu) -{ - struct drm_display_mode *m = &arcpgu->pipe.crtc.state->adjusted_mode; - u32 val; - - arc_pgu_write(arcpgu, ARCPGU_REG_FMT, - ENCODE_PGU_XY(m->crtc_htotal, m->crtc_vtotal)); - - arc_pgu_write(arcpgu, ARCPGU_REG_HSYNC, - ENCODE_PGU_XY(m->crtc_hsync_start - m->crtc_hdisplay, - m->crtc_hsync_end - m->crtc_hdisplay)); - - arc_pgu_write(arcpgu, ARCPGU_REG_VSYNC, - ENCODE_PGU_XY(m->crtc_vsync_start - m->crtc_vdisplay, - m->crtc_vsync_end - m->crtc_vdisplay)); - - arc_pgu_write(arcpgu, ARCPGU_REG_ACTIVE, - ENCODE_PGU_XY(m->crtc_hblank_end - m->crtc_hblank_start, - m->crtc_vblank_end - m->crtc_vblank_start)); - - val = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL); - - if (m->flags & DRM_MODE_FLAG_PVSYNC) - val |= ARCPGU_CTRL_VS_POL_MASK << ARCPGU_CTRL_VS_POL_OFST; - else - val &= ~(ARCPGU_CTRL_VS_POL_MASK << ARCPGU_CTRL_VS_POL_OFST); - - if (m->flags & DRM_MODE_FLAG_PHSYNC) - val |= ARCPGU_CTRL_HS_POL_MASK << ARCPGU_CTRL_HS_POL_OFST; - else - val &= ~(ARCPGU_CTRL_HS_POL_MASK << ARCPGU_CTRL_HS_POL_OFST); - - arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, val); - arc_pgu_write(arcpgu, ARCPGU_REG_STRIDE, 0); - arc_pgu_write(arcpgu, ARCPGU_REG_START_SET, 1); - - arc_pgu_set_pxl_fmt(arcpgu); - - clk_set_rate(arcpgu->clk, m->crtc_clock * 1000); -} - -static void arc_pgu_enable(struct drm_simple_display_pipe *pipe, - struct drm_crtc_state *crtc_state, - struct drm_plane_state *plane_state) -{ - struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); - - arc_pgu_mode_set(arcpgu); - - clk_prepare_enable(arcpgu->clk); - arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, - arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) | - ARCPGU_CTRL_ENABLE_MASK); -} - -static void arc_pgu_disable(struct drm_simple_display_pipe *pipe) -{ - struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); - - clk_disable_unprepare(arcpgu->clk); - arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, - arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) & - ~ARCPGU_CTRL_ENABLE_MASK); -} - -static void arc_pgu_update(struct drm_simple_display_pipe *pipe, - struct drm_plane_state *state) -{ - struct arcpgu_drm_private *arcpgu; - struct drm_gem_cma_object *gem; - - if (!pipe->plane.state->fb) - return; - - arcpgu = pipe_to_arcpgu_priv(pipe); - gem = drm_fb_cma_get_gem_obj(pipe->plane.state->fb, 0); - arc_pgu_write(arcpgu, ARCPGU_REG_BUF0_ADDR, gem->paddr); -} - -static const struct drm_simple_display_pipe_funcs arc_pgu_pipe_funcs = { - .update = arc_pgu_update, - .mode_valid = arc_pgu_mode_valid, - .enable = arc_pgu_enable, - .disable = arc_pgu_disable, -}; - -int arc_pgu_setup_pipe(struct drm_device *drm) -{ - struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - - return drm_simple_display_pipe_init(drm, &arcpgu->pipe, &arc_pgu_pipe_funcs, - arc_pgu_supported_formats, - ARRAY_SIZE(arc_pgu_supported_formats), - NULL, NULL); -} diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 222ab28efbd0..25edb4e4dff2 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,147 @@ #include "arcpgu.h" #include "arcpgu_regs.h" +#define ENCODE_PGU_XY(x, y) ((((x) - 1) << 16) | ((y) - 1)) + +static const u32 arc_pgu_supported_formats[] = { + DRM_FORMAT_RGB565, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_ARGB8888, +}; + +static void arc_pgu_set_pxl_fmt(struct arcpgu_drm_private *arcpgu) +{ + const struct drm_framebuffer *fb = arcpgu->pipe.plane.state->fb; + uint32_t pixel_format = fb->format->format; + u32 format = DRM_FORMAT_INVALID; + int i; + u32 reg_ctrl; + + for (i = 0; i < ARRAY_SIZE(arc_pgu_supported_formats); i++) { + if (arc_pgu_supported_formats[i] == pixel_format) + format = arc_pgu_supported_formats[i]; + } + + if (WARN_ON(format == DRM_FORMAT_INVALID)) + return; + + reg_ctrl = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL); + if (format == DRM_FORMAT_RGB565) + reg_ctrl &= ~ARCPGU_MODE_XRGB8888; + else + reg_ctrl |= ARCPGU_MODE_XRGB8888; + arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, reg_ctrl); +} + +static const struct drm_crtc_funcs arc_pgu_crtc_funcs = { + .destroy = drm_crtc_cleanup, + .set_config = drm_atomic_helper_set_config, + .page_flip = drm_atomic_helper_page_flip, + .reset = drm_atomic_helper_crtc_reset, + .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, +}; + +static enum drm_mode_status arc_pgu_mode_valid(struct drm_simple_display_pipe *pipe, + const struct drm_display_mode *mode) +{ + struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); + long rate, clk_rate = mode->clock * 1000; + long diff = clk_rate / 200; /* +-0.5% allowed by HDMI spec */ + + rate = clk_round_rate(arcpgu->clk, clk_rate); + if ((max(rate, clk_rate) - min(rate, clk_rate) < diff) && (rate > 0)) + return MODE_OK; + + return MODE_NOCLOCK; +} + +static void arc_pgu_mode_set(struct arcpgu_drm_private *arcpgu) +{ + struct drm_display_mode *m = &arcpgu->pipe.crtc.state->adjusted_mode; + u32 val; + + arc_pgu_write(arcpgu, ARCPGU_REG_FMT, + ENCODE_PGU_XY(m->crtc_htotal, m->crtc_vtotal)); + + arc_pgu_write(arcpgu, ARCPGU_REG_HSYNC, + ENCODE_PGU_XY(m->crtc_hsync_start - m->crtc_hdisplay, + m->crtc_hsync_end - m->crtc_hdisplay)); + + arc_pgu_write(arcpgu, ARCPGU_REG_VSYNC, + ENCODE_PGU_XY(m->crtc_vsync_start - m->crtc_vdisplay, + m->crtc_vsync_end - m->crtc_vdisplay)); + + arc_pgu_write(arcpgu, ARCPGU_REG_ACTIVE, + ENCODE_PGU_XY(m->crtc_hblank_end - m->crtc_hblank_start, + m->crtc_vblank_end - m->crtc_vblank_start)); + + val = arc_pgu_read(arcpgu, ARCPGU_REG_CTRL); + + if (m->flags & DRM_MODE_FLAG_PVSYNC) + val |= ARCPGU_CTRL_VS_POL_MASK << ARCPGU_CTRL_VS_POL_OFST; + else + val &= ~(ARCPGU_CTRL_VS_POL_MASK << ARCPGU_CTRL_VS_POL_OFST); + + if (m->flags & DRM_MODE_FLAG_PHSYNC) + val |= ARCPGU_CTRL_HS_POL_MASK << ARCPGU_CTRL_HS_POL_OFST; + else + val &= ~(ARCPGU_CTRL_HS_POL_MASK << ARCPGU_CTRL_HS_POL_OFST); + + arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, val); + arc_pgu_write(arcpgu, ARCPGU_REG_STRIDE, 0); + arc_pgu_write(arcpgu, ARCPGU_REG_START_SET, 1); + + arc_pgu_set_pxl_fmt(arcpgu); + + clk_set_rate(arcpgu->clk, m->crtc_clock * 1000); +} + +static void arc_pgu_enable(struct drm_simple_display_pipe *pipe, + struct drm_crtc_state *crtc_state, + struct drm_plane_state *plane_state) +{ + struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); + + arc_pgu_mode_set(arcpgu); + + clk_prepare_enable(arcpgu->clk); + arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, + arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) | + ARCPGU_CTRL_ENABLE_MASK); +} + +static void arc_pgu_disable(struct drm_simple_display_pipe *pipe) +{ + struct arcpgu_drm_private *arcpgu = pipe_to_arcpgu_priv(pipe); + + clk_disable_unprepare(arcpgu->clk); + arc_pgu_write(arcpgu, ARCPGU_REG_CTRL, + arc_pgu_read(arcpgu, ARCPGU_REG_CTRL) & + ~ARCPGU_CTRL_ENABLE_MASK); +} + +static void arc_pgu_update(struct drm_simple_display_pipe *pipe, + struct drm_plane_state *state) +{ + struct arcpgu_drm_private *arcpgu; + struct drm_gem_cma_object *gem; + + if (!pipe->plane.state->fb) + return; + + arcpgu = pipe_to_arcpgu_priv(pipe); + gem = drm_fb_cma_get_gem_obj(pipe->plane.state->fb, 0); + arc_pgu_write(arcpgu, ARCPGU_REG_BUF0_ADDR, gem->paddr); +} + +static const struct drm_simple_display_pipe_funcs arc_pgu_pipe_funcs = { + .update = arc_pgu_update, + .mode_valid = arc_pgu_mode_valid, + .enable = arc_pgu_enable, + .disable = arc_pgu_disable, +}; + static const struct drm_mode_config_funcs arcpgu_drm_modecfg_funcs = { .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check, @@ -70,8 +212,12 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) if (dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32))) return -ENODEV; - if (arc_pgu_setup_pipe(drm) < 0) - return -ENODEV; + ret = drm_simple_display_pipe_init(drm, &arcpgu->pipe, &arc_pgu_pipe_funcs, + arc_pgu_supported_formats, + ARRAY_SIZE(arc_pgu_supported_formats), + NULL, NULL); + if (ret) + return ret; /* * There is only one output port inside each device. It is linked with diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c index afc34f8b4de0..1a63f0868504 100644 --- a/drivers/gpu/drm/arc/arcpgu_sim.c +++ b/drivers/gpu/drm/arc/arcpgu_sim.c @@ -45,10 +45,6 @@ static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static struct drm_encoder_funcs arcpgu_drm_encoder_funcs = { - .destroy = drm_encoder_cleanup, -}; - int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) { struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); @@ -58,14 +54,6 @@ int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) encoder = &arcpgu->pipe.encoder; - encoder->possible_crtcs = 1; - encoder->possible_clones = 0; - - ret = drm_encoder_init(drm, encoder, &arcpgu_drm_encoder_funcs, - DRM_MODE_ENCODER_VIRTUAL, NULL); - if (ret) - return ret; - connector = &arcpgu->sim_conn; drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs); From patchwork Fri Jul 17 09:04:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669603 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8815213A4 for ; Fri, 17 Jul 2020 09:05:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 6444B2083E for ; Fri, 17 Jul 2020 09:05:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="WHVqR2AI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6444B2083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5793F6ED75; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 17EC86ED6F for ; Fri, 17 Jul 2020 09:04:50 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id r12so10108481wrj.13 for ; Fri, 17 Jul 2020 02:04:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Njpphje98U3+SdW65R+757vXcpowDBWNDM4n7lCkJN8=; b=WHVqR2AIX2uOjaiO7NxFnhvWKjohX33YKhjzkKPrtvalc/qzIA5spdl0y6rb8Rbw6T XNo2Nx37kCB35IlcBlhq74muZqjF6tBNmyTtwxkSNagbMYZpHbAEPt7F/Rg26lJMxGko XmXbmAMlwHfn9xlIbzxiqEsMktRYU4oNVvZt0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Njpphje98U3+SdW65R+757vXcpowDBWNDM4n7lCkJN8=; b=l2oT3aoQwXNphID55rQG/eH18ccBs1k+BXJ97Bn6VZbhaw0LE3aYpMOEv7ER7H3EnK Y75x9iqLbEF6ho1WB+ocKhgpi3m+V0NBtGXh2KnAzkK6NpnoE8OaQtlKcCKrrnDreUBH d1flShCFYE3bCwAABMmW6Ylb9K8cqodLoJYwpdXPViqQPX/lTJxPtgBr2CVNNZ7/PY2A 6lZPpidOLjsC3tRthofQPMfsOkSZX6y9r5hH50xqrKxiNp5EcvJDbOmdoY7+pfG3P65u fa++h6KyAnpeo4Cy2gUoHib9eHcmr5xZMJLb/7iQbT3bqLDq1qwqR9oUG4x4JNVAhmtH +nZg== X-Gm-Message-State: AOAM533nBCbJp+/dtRDRmH15KgcRErNJpf4cEKva4JtSZrYYE/DkhwtE lm55Of2ns/sUViBtihDWXCUtssQc50w= X-Google-Smtp-Source: ABdhPJzoK+WO+JJy7zCApfsIY7GSwosIfQ+13upZ3FLTME2Eon2neRmeG/KZY8nJVbBena3ndC1PFQ== X-Received: by 2002:a5d:484b:: with SMTP id n11mr8918861wrs.320.1594976688444; Fri, 17 Jul 2020 02:04:48 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:47 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 14/18] drm/arc: Inline arcpgu_drm_hdmi_init Date: Fri, 17 Jul 2020 11:04:26 +0200 Message-Id: <20200717090430.1146256-14-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Really not worth the function, much less the separate file now that almost all the code is gone. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/arc/Makefile | 2 +- drivers/gpu/drm/arc/arcpgu.h | 1 - drivers/gpu/drm/arc/arcpgu_drv.c | 12 +++++++++--- drivers/gpu/drm/arc/arcpgu_hdmi.c | 27 --------------------------- 4 files changed, 10 insertions(+), 32 deletions(-) delete mode 100644 drivers/gpu/drm/arc/arcpgu_hdmi.c diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile index c686e0287a71..379a1145bc2f 100644 --- a/drivers/gpu/drm/arc/Makefile +++ b/drivers/gpu/drm/arc/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -arcpgu-y := arcpgu_hdmi.o arcpgu_sim.o arcpgu_drv.o +arcpgu-y := arcpgu_sim.o arcpgu_drv.o obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h index cee2448a07d6..7dce0c2313ba 100644 --- a/drivers/gpu/drm/arc/arcpgu.h +++ b/drivers/gpu/drm/arc/arcpgu.h @@ -34,7 +34,6 @@ static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu, return ioread32(arcpgu->regs + reg); } -int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np); int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np); #endif diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 25edb4e4dff2..40697cab0d03 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -230,9 +230,15 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) } if (encoder_node) { - ret = arcpgu_drm_hdmi_init(drm, encoder_node); - of_node_put(encoder_node); - if (ret < 0) + struct drm_bridge *bridge; + + /* Locate drm bridge from the hdmi encoder DT node */ + bridge = of_drm_find_bridge(encoder_node); + if (!bridge) + return -EPROBE_DEFER; + + ret = drm_simple_display_pipe_attach_bridge(&arcpgu->pipe, bridge); + if (ret) return ret; } else { dev_info(drm->dev, "no encoder found. Assumed virtual LCD on simulation platform\n"); diff --git a/drivers/gpu/drm/arc/arcpgu_hdmi.c b/drivers/gpu/drm/arc/arcpgu_hdmi.c deleted file mode 100644 index d430af686cbc..000000000000 --- a/drivers/gpu/drm/arc/arcpgu_hdmi.c +++ /dev/null @@ -1,27 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * ARC PGU DRM driver. - * - * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) - */ - -#include -#include -#include -#include - -#include "arcpgu.h" - -int arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np) -{ - struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct drm_bridge *bridge; - - /* Locate drm bridge from the hdmi encoder DT node */ - bridge = of_drm_find_bridge(np); - if (!bridge) - return -EPROBE_DEFER; - - /* Link drm_bridge to encoder */ - return drm_simple_display_pipe_attach_bridge(&arcpgu->pipe, bridge); -} From patchwork Fri Jul 17 09:04:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669607 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0469D1392 for ; Fri, 17 Jul 2020 09:05:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id D5CF320829 for ; Fri, 17 Jul 2020 09:05:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="DzX1OVt8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D5CF320829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A32D6ED7C; Fri, 17 Jul 2020 09:04:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 544CD6ED6A for ; Fri, 17 Jul 2020 09:04:51 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id q5so10191173wru.6 for ; Fri, 17 Jul 2020 02:04:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MPdKQmXR/4ZD7PaqTxpVccSIF/911K5feLgWyR6FutM=; b=DzX1OVt8U2NHXVZXUXwxusEte8d6X+mujC8uK/f1+xR4BDuCJL+dLLLgI57jJ0NLAw jvm74P01XvaTdfsiOcJzzwtDVDRgNCMaIFLCKVXTWkvXLR9Cm9dsDgglBrotFMt9L8jh vp2JL4WU4hMCbc8+VEGnAcGlkECM/qlTBEiv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MPdKQmXR/4ZD7PaqTxpVccSIF/911K5feLgWyR6FutM=; b=Iq+AaDhzFRYP0L/ZfYnOk+IEhHVp9DDtve33E8f2IGE9GcMZ2PsOkyP+XQJwI2DRca wnd+//Fv15bhJLZN+Eg3/mZEkd0J5s5fkrfJCV8QXcIIKyR2kqeplcKG5NmlmtHHeEkc tPnW4X1lkGD4872LquThMBCT0GNAR8T1INeFEYQUvTIG+Z4wuNAhl4AStQFJ61fadH4d pV/xsf+U6m29qay62r1A7usa9ECZVg1Z5Jg9mqFlcDrnQ+R5M85LIfl0oYihjbhR/YIs jT/y9mx/9V+hYoLjsgQiNzElCZBQfrRGNIpBKa9X/yun6zbNshsr1Q5vR1cNCIzTy4// Oytw== X-Gm-Message-State: AOAM530yyUm5G7t8aM/p0KRt3aOO0ANPEkkTZapm7NiGozO7/qJeeF4V BlDyhaHltaYlYLYPmQ5TY3txOI5OJ60= X-Google-Smtp-Source: ABdhPJxsSB6k920Ypp9qj+tHJTAjO6QF6XUC55WMdzyEJ5qOlnabOg/9i99VEPA1bWb+Ttt4haBX0w== X-Received: by 2002:a5d:4b45:: with SMTP id w5mr8844450wrs.4.1594976689302; Fri, 17 Jul 2020 02:04:49 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:48 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 15/18] drm/arc: Inline remaining files Date: Fri, 17 Jul 2020 11:04:27 +0200 Message-Id: <20200717090430.1146256-15-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" At less than 500 lines total feels like the right thing to do. Also noticed that the simple wrapper around drm_connector_cleanup can be dropped. Signed-off-by: Daniel Vetter --- drivers/gpu/drm/arc/Makefile | 2 +- drivers/gpu/drm/arc/arcpgu.h | 39 ------------ drivers/gpu/drm/arc/arcpgu_drv.c | 102 +++++++++++++++++++++++++++++- drivers/gpu/drm/arc/arcpgu_regs.h | 31 --------- drivers/gpu/drm/arc/arcpgu_sim.c | 74 ---------------------- 5 files changed, 101 insertions(+), 147 deletions(-) delete mode 100644 drivers/gpu/drm/arc/arcpgu.h delete mode 100644 drivers/gpu/drm/arc/arcpgu_regs.h delete mode 100644 drivers/gpu/drm/arc/arcpgu_sim.c diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile index 379a1145bc2f..b26f2495c532 100644 --- a/drivers/gpu/drm/arc/Makefile +++ b/drivers/gpu/drm/arc/Makefile @@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -arcpgu-y := arcpgu_sim.o arcpgu_drv.o +arcpgu-y := arcpgu_drv.o obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o diff --git a/drivers/gpu/drm/arc/arcpgu.h b/drivers/gpu/drm/arc/arcpgu.h deleted file mode 100644 index 7dce0c2313ba..000000000000 --- a/drivers/gpu/drm/arc/arcpgu.h +++ /dev/null @@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * ARC PGU DRM driver. - * - * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) - */ - -#ifndef _ARCPGU_H_ -#define _ARCPGU_H_ - -#include - -struct arcpgu_drm_private { - struct drm_device drm; - void __iomem *regs; - struct clk *clk; - struct drm_simple_display_pipe pipe; - struct drm_connector sim_conn; -}; - -#define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm) - -#define pipe_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, pipe) - -static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu, - unsigned int reg, u32 value) -{ - iowrite32(value, arcpgu->regs + reg); -} - -static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu, - unsigned int reg) -{ - return ioread32(arcpgu->regs + reg); -} - -int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np); - -#endif diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 40697cab0d03..3c44b9b4acec 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -17,13 +17,111 @@ #include #include #include +#include #include #include #include #include -#include "arcpgu.h" -#include "arcpgu_regs.h" +#define ARCPGU_REG_CTRL 0x00 +#define ARCPGU_REG_STAT 0x04 +#define ARCPGU_REG_FMT 0x10 +#define ARCPGU_REG_HSYNC 0x14 +#define ARCPGU_REG_VSYNC 0x18 +#define ARCPGU_REG_ACTIVE 0x1c +#define ARCPGU_REG_BUF0_ADDR 0x40 +#define ARCPGU_REG_STRIDE 0x50 +#define ARCPGU_REG_START_SET 0x84 + +#define ARCPGU_REG_ID 0x3FC + +#define ARCPGU_CTRL_ENABLE_MASK 0x02 +#define ARCPGU_CTRL_VS_POL_MASK 0x1 +#define ARCPGU_CTRL_VS_POL_OFST 0x3 +#define ARCPGU_CTRL_HS_POL_MASK 0x1 +#define ARCPGU_CTRL_HS_POL_OFST 0x4 +#define ARCPGU_MODE_XRGB8888 BIT(2) +#define ARCPGU_STAT_BUSY_MASK 0x02 + +struct arcpgu_drm_private { + struct drm_device drm; + void __iomem *regs; + struct clk *clk; + struct drm_simple_display_pipe pipe; + struct drm_connector sim_conn; +}; + +#define dev_to_arcpgu(x) container_of(x, struct arcpgu_drm_private, drm) + +#define pipe_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, pipe) + +static inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu, + unsigned int reg, u32 value) +{ + iowrite32(value, arcpgu->regs + reg); +} + +static inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu, + unsigned int reg) +{ + return ioread32(arcpgu->regs + reg); +} + +#define XRES_DEF 640 +#define YRES_DEF 480 + +#define XRES_MAX 8192 +#define YRES_MAX 8192 + +static int arcpgu_drm_connector_get_modes(struct drm_connector *connector) +{ + int count; + + count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX); + drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF); + return count; +} + +static const struct drm_connector_helper_funcs +arcpgu_drm_connector_helper_funcs = { + .get_modes = arcpgu_drm_connector_get_modes, +}; + +static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { + .reset = drm_atomic_helper_connector_reset, + .fill_modes = drm_helper_probe_single_connector_modes, + .destroy = drm_connector_cleanup, + .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, +}; + +static int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) +{ + struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); + struct drm_encoder *encoder; + struct drm_connector *connector; + int ret; + + encoder = &arcpgu->pipe.encoder; + + connector = &arcpgu->sim_conn; + drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs); + + ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs, + DRM_MODE_CONNECTOR_VIRTUAL); + if (ret < 0) { + dev_err(drm->dev, "failed to initialize drm connector\n"); + return ret; + } + + ret = drm_connector_attach_encoder(connector, encoder); + if (ret < 0) { + dev_err(drm->dev, "could not attach connector to encoder\n"); + return ret; + } + + return 0; +} #define ENCODE_PGU_XY(x, y) ((((x) - 1) << 16) | ((y) - 1)) diff --git a/drivers/gpu/drm/arc/arcpgu_regs.h b/drivers/gpu/drm/arc/arcpgu_regs.h deleted file mode 100644 index b689a382d556..000000000000 --- a/drivers/gpu/drm/arc/arcpgu_regs.h +++ /dev/null @@ -1,31 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * ARC PGU DRM driver. - * - * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) - */ - -#ifndef _ARC_PGU_REGS_H_ -#define _ARC_PGU_REGS_H_ - -#define ARCPGU_REG_CTRL 0x00 -#define ARCPGU_REG_STAT 0x04 -#define ARCPGU_REG_FMT 0x10 -#define ARCPGU_REG_HSYNC 0x14 -#define ARCPGU_REG_VSYNC 0x18 -#define ARCPGU_REG_ACTIVE 0x1c -#define ARCPGU_REG_BUF0_ADDR 0x40 -#define ARCPGU_REG_STRIDE 0x50 -#define ARCPGU_REG_START_SET 0x84 - -#define ARCPGU_REG_ID 0x3FC - -#define ARCPGU_CTRL_ENABLE_MASK 0x02 -#define ARCPGU_CTRL_VS_POL_MASK 0x1 -#define ARCPGU_CTRL_VS_POL_OFST 0x3 -#define ARCPGU_CTRL_HS_POL_MASK 0x1 -#define ARCPGU_CTRL_HS_POL_OFST 0x4 -#define ARCPGU_MODE_XRGB8888 BIT(2) -#define ARCPGU_STAT_BUSY_MASK 0x02 - -#endif diff --git a/drivers/gpu/drm/arc/arcpgu_sim.c b/drivers/gpu/drm/arc/arcpgu_sim.c deleted file mode 100644 index 1a63f0868504..000000000000 --- a/drivers/gpu/drm/arc/arcpgu_sim.c +++ /dev/null @@ -1,74 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * ARC PGU DRM driver. - * - * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com) - */ - -#include -#include -#include - -#include "arcpgu.h" - -#define XRES_DEF 640 -#define YRES_DEF 480 - -#define XRES_MAX 8192 -#define YRES_MAX 8192 - - -static int arcpgu_drm_connector_get_modes(struct drm_connector *connector) -{ - int count; - - count = drm_add_modes_noedid(connector, XRES_MAX, YRES_MAX); - drm_set_preferred_mode(connector, XRES_DEF, YRES_DEF); - return count; -} - -static void arcpgu_drm_connector_destroy(struct drm_connector *connector) -{ - drm_connector_cleanup(connector); -} - -static const struct drm_connector_helper_funcs -arcpgu_drm_connector_helper_funcs = { - .get_modes = arcpgu_drm_connector_get_modes, -}; - -static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { - .reset = drm_atomic_helper_connector_reset, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = arcpgu_drm_connector_destroy, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) -{ - struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct drm_encoder *encoder; - struct drm_connector *connector; - int ret; - - encoder = &arcpgu->pipe.encoder; - - connector = &arcpgu->sim_conn; - drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs); - - ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs, - DRM_MODE_CONNECTOR_VIRTUAL); - if (ret < 0) { - dev_err(drm->dev, "failed to initialize drm connector\n"); - return ret; - } - - ret = drm_connector_attach_encoder(connector, encoder); - if (ret < 0) { - dev_err(drm->dev, "could not attach connector to encoder\n"); - return ret; - } - - return 0; -} From patchwork Fri Jul 17 09:04:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669609 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A0AD1392 for ; Fri, 17 Jul 2020 09:05:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5782B2083E for ; Fri, 17 Jul 2020 09:05:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="h+JL5956" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5782B2083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BE35D6ED76; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1BF736ED6A for ; Fri, 17 Jul 2020 09:04:52 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id o11so10188566wrv.9 for ; Fri, 17 Jul 2020 02:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=G0zAY2PrfwIUmvif0VeV8OoxbY/ZKQMS2DyWIAYPMvc=; b=h+JL5956PvOCCsFj33TU9OTEZn8XBKwCqctMYLwiYyeiBoMeb9LwV21YMbhZoDt5kv Wr/J7AEdyTVc1AVnubRgdO9rYDSDJqnmHcthx9K6YpULrdXMbI8Yiw0MkGN0cbQqS+cm u0qmJcLeZzg3pkZIbGlLQ4Ql6p7SCG6YHiLHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G0zAY2PrfwIUmvif0VeV8OoxbY/ZKQMS2DyWIAYPMvc=; b=NPhIEp8ICSlg9JC2Y/dJ5QWykjRQzW/Be8e0t2ggYwqGkpZHDBnpIWSZrYpQoJxz7R GauEASDX5yYM+7cO6bmSFAobAjvFnV4xOI9Y3ly0rqzcFhefvYuarY4QNudq20qoPRNR N3+JF6iGW9KlMljB4S6GqITSpT9tMUScAYuZum0wXg15NXOMpXwinVQk5Dl0SKif8oQB SsKDBOwigfeejt2wkyM7L9oiElXY1rtqFA8Rota7kaXy23cTEolYkPrO2dVoJRGxBOMV C8c31cgGauIZZEpsK/9+aQaIT1gqUec3gLcr/fmraOh6sOGV/R/aeFqPCP5cJGEqvc27 Hfbg== X-Gm-Message-State: AOAM531loz16yLIXGu8QBbx6eVFPVakt5rdgaZO6XxeKX05X+LirW2wk 71kLfQ+0G/6KvbtE2f/u0yo04S8TgGE= X-Google-Smtp-Source: ABdhPJysc69jsJtnNWu4SjUtU1KRIsc72v9bs7lDww+QJoAUHQdWmwB0PpSFC7+rurXjE0dX8kmXEw== X-Received: by 2002:adf:f54d:: with SMTP id j13mr8869595wrp.427.1594976690139; Fri, 17 Jul 2020 02:04:50 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:49 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 16/18] drm/arc: Initialize sim connector before display pipe Date: Fri, 17 Jul 2020 11:04:28 +0200 Message-Id: <20200717090430.1146256-16-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" That way we can get rid of this final piece of init code, and use the simple pipe helpers as intended. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin --- drivers/gpu/drm/arc/arcpgu_drv.c | 51 ++++++++++---------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/arc/arcpgu_drv.c index 3c44b9b4acec..788101401701 100644 --- a/drivers/gpu/drm/arc/arcpgu_drv.c +++ b/drivers/gpu/drm/arc/arcpgu_drv.c @@ -95,32 +95,11 @@ static const struct drm_connector_funcs arcpgu_drm_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np) +static int arcpgu_drm_sim_init(struct drm_device *drm, struct drm_connector *connector) { - struct arcpgu_drm_private *arcpgu = dev_to_arcpgu(drm); - struct drm_encoder *encoder; - struct drm_connector *connector; - int ret; - - encoder = &arcpgu->pipe.encoder; - - connector = &arcpgu->sim_conn; drm_connector_helper_add(connector, &arcpgu_drm_connector_helper_funcs); - - ret = drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs, + return drm_connector_init(drm, connector, &arcpgu_drm_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL); - if (ret < 0) { - dev_err(drm->dev, "failed to initialize drm connector\n"); - return ret; - } - - ret = drm_connector_attach_encoder(connector, encoder); - if (ret < 0) { - dev_err(drm->dev, "could not attach connector to encoder\n"); - return ret; - } - - return 0; } #define ENCODE_PGU_XY(x, y) ((((x) - 1) << 16) | ((y) - 1)) @@ -276,6 +255,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) { struct platform_device *pdev = to_platform_device(arcpgu->drm.dev); struct device_node *encoder_node = NULL, *endpoint_node = NULL; + struct drm_connector *connector = NULL; struct drm_device *drm = &arcpgu->drm; struct resource *res; int ret; @@ -310,13 +290,6 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) if (dma_set_mask_and_coherent(drm->dev, DMA_BIT_MASK(32))) return -ENODEV; - ret = drm_simple_display_pipe_init(drm, &arcpgu->pipe, &arc_pgu_pipe_funcs, - arc_pgu_supported_formats, - ARRAY_SIZE(arc_pgu_supported_formats), - NULL, NULL); - if (ret) - return ret; - /* * There is only one output port inside each device. It is linked with * encoder endpoint. @@ -325,8 +298,21 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) if (endpoint_node) { encoder_node = of_graph_get_remote_port_parent(endpoint_node); of_node_put(endpoint_node); + } else { + connector = &arcpgu->sim_conn; + dev_info(drm->dev, "no encoder found. Assumed virtual LCD on simulation platform\n"); + ret = arcpgu_drm_sim_init(drm, connector); + if (ret < 0) + return ret; } + ret = drm_simple_display_pipe_init(drm, &arcpgu->pipe, &arc_pgu_pipe_funcs, + arc_pgu_supported_formats, + ARRAY_SIZE(arc_pgu_supported_formats), + NULL, connector); + if (ret) + return ret; + if (encoder_node) { struct drm_bridge *bridge; @@ -338,11 +324,6 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu) ret = drm_simple_display_pipe_attach_bridge(&arcpgu->pipe, bridge); if (ret) return ret; - } else { - dev_info(drm->dev, "no encoder found. Assumed virtual LCD on simulation platform\n"); - ret = arcpgu_drm_sim_init(drm, NULL); - if (ret < 0) - return ret; } drm_mode_config_reset(drm); From patchwork Fri Jul 17 09:04:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669613 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C92EB13A4 for ; Fri, 17 Jul 2020 09:05:09 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id A685F22B4D for ; Fri, 17 Jul 2020 09:05:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="XxFKPRx8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A685F22B4D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B6EC6ED82; Fri, 17 Jul 2020 09:04:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1CD5C6ED74 for ; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id r12so10108628wrj.13 for ; Fri, 17 Jul 2020 02:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2MKH1tJ9qSuHfCI8dt54bEoTHWg3poixNtCDKdvH1gQ=; b=XxFKPRx8LfXHA16pus5atxoDUpZPcUkKZ2LoWPgKri23uU3qI4XyE5Zc+dmIA0ZzYo QPEf1pRk2Vqt1IOKUbnWbuGDoDjLoGkSW8k3YpdGnM30MpUGA1x4q150kzEejsAzhQ7K fe8WYU4Ru4lvfApxCMefZTn8aIjI2dMpGmWqU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2MKH1tJ9qSuHfCI8dt54bEoTHWg3poixNtCDKdvH1gQ=; b=Or+9crsvsJpLL6AsqVA9ZUuVX51vUb8/qXYagfOuuvHeiAuekE1lAh70/dB4sGpH9m ZSsburdVMUZDomdqY1TO7I6MV368lw4lMr4EvsGZChFggS4PpR0H2sVVmPmKHZXWN/bs 3O8UZhrflgVT6GoAw7v2y6n7xDa8PNa3o6v96HSywCU+ech3+V8QW0dZagOnsLD8ZSoy 7djcM1GGLAAS8YLPyUkouj5Jz3zwGrwJHS//sekYfYUxEMfZrJm1RZCfNaeiLawAL10L j5I2a8ULSQTbxjVRaF9SbdgzjcDy3jW7P7js43kw4kzxsfxaQjNrZJDDPMc0IAKH5Byw kiZA== X-Gm-Message-State: AOAM531mbLFn6A7lQFTsRAY20SqfzfePjqtKvEfEBrvSg6R78PmfyY8h kZU+eA7Nd9oTkWV6X+iSTLd9a6ulGkU= X-Google-Smtp-Source: ABdhPJy87J04mCCJi3dPYXNTmym8RxU7SrkWeIvYHdcll3PmRtppmZAv5T80hzZacVjuiBt+YxLiWg== X-Received: by 2002:a5d:4e50:: with SMTP id r16mr9123202wrt.274.1594976691380; Fri, 17 Jul 2020 02:04:51 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:50 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 17/18] drm/arc: Move to drm/tiny Date: Fri, 17 Jul 2020 11:04:29 +0200 Message-Id: <20200717090430.1146256-17-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: Daniel Vetter , Alexey Brodkin , Daniel Vetter Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Because it is. Signed-off-by: Daniel Vetter Cc: Alexey Brodkin Reported-by: kernel test robot --- MAINTAINERS | 2 +- drivers/gpu/drm/Kconfig | 2 -- drivers/gpu/drm/Makefile | 1 - drivers/gpu/drm/arc/Kconfig | 10 ---------- drivers/gpu/drm/arc/Makefile | 3 --- drivers/gpu/drm/tiny/Kconfig | 10 ++++++++++ drivers/gpu/drm/tiny/Makefile | 1 + drivers/gpu/drm/{arc/arcpgu_drv.c => tiny/arcpgu.c} | 0 8 files changed, 12 insertions(+), 17 deletions(-) delete mode 100644 drivers/gpu/drm/arc/Kconfig delete mode 100644 drivers/gpu/drm/arc/Makefile rename drivers/gpu/drm/{arc/arcpgu_drv.c => tiny/arcpgu.c} (100%) diff --git a/MAINTAINERS b/MAINTAINERS index 415954a98934..0ed6c36004e4 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1322,7 +1322,7 @@ ARC PGU DRM DRIVER M: Alexey Brodkin S: Supported F: Documentation/devicetree/bindings/display/snps,arcpgu.txt -F: drivers/gpu/drm/arc/ +F: drivers/gpu/drm/tiny/arcpgu.c ARCNET NETWORK LAYER M: Michael Grzeschik diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index c4fd57d8b717..d44c6eac2c58 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -354,8 +354,6 @@ source "drivers/gpu/drm/vc4/Kconfig" source "drivers/gpu/drm/etnaviv/Kconfig" -source "drivers/gpu/drm/arc/Kconfig" - source "drivers/gpu/drm/hisilicon/Kconfig" source "drivers/gpu/drm/mediatek/Kconfig" diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 2c0e5a7e5953..e69eafbf9e39 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -109,7 +109,6 @@ obj-y += panel/ obj-y += bridge/ obj-$(CONFIG_DRM_FSL_DCU) += fsl-dcu/ obj-$(CONFIG_DRM_ETNAVIV) += etnaviv/ -obj-$(CONFIG_DRM_ARCPGU)+= arc/ obj-y += hisilicon/ obj-$(CONFIG_DRM_ZTE) += zte/ obj-$(CONFIG_DRM_MXSFB) += mxsfb/ diff --git a/drivers/gpu/drm/arc/Kconfig b/drivers/gpu/drm/arc/Kconfig deleted file mode 100644 index e8f3d63e0b91..000000000000 --- a/drivers/gpu/drm/arc/Kconfig +++ /dev/null @@ -1,10 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -config DRM_ARCPGU - tristate "ARC PGU" - depends on DRM && OF - select DRM_KMS_CMA_HELPER - select DRM_KMS_HELPER - help - Choose this option if you have an ARC PGU controller. - - If M is selected the module will be called arcpgu. diff --git a/drivers/gpu/drm/arc/Makefile b/drivers/gpu/drm/arc/Makefile deleted file mode 100644 index b26f2495c532..000000000000 --- a/drivers/gpu/drm/arc/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -arcpgu-y := arcpgu_drv.o -obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o diff --git a/drivers/gpu/drm/tiny/Kconfig b/drivers/gpu/drm/tiny/Kconfig index 2b6414f0fa75..9bbaa1a69050 100644 --- a/drivers/gpu/drm/tiny/Kconfig +++ b/drivers/gpu/drm/tiny/Kconfig @@ -1,5 +1,15 @@ # SPDX-License-Identifier: GPL-2.0-only +config DRM_ARCPGU + tristate "ARC PGU" + depends on DRM && OF + select DRM_KMS_CMA_HELPER + select DRM_KMS_HELPER + help + Choose this option if you have an ARC PGU controller. + + If M is selected the module will be called arcpgu. + config DRM_CIRRUS_QEMU tristate "Cirrus driver for QEMU emulated device" depends on DRM && PCI && MMU diff --git a/drivers/gpu/drm/tiny/Makefile b/drivers/gpu/drm/tiny/Makefile index 6ae4e9e5a35f..bef6780bdd6f 100644 --- a/drivers/gpu/drm/tiny/Makefile +++ b/drivers/gpu/drm/tiny/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_DRM_ARCPGU) += arcpgu.o obj-$(CONFIG_DRM_CIRRUS_QEMU) += cirrus.o obj-$(CONFIG_DRM_GM12U320) += gm12u320.o obj-$(CONFIG_TINYDRM_HX8357D) += hx8357d.o diff --git a/drivers/gpu/drm/arc/arcpgu_drv.c b/drivers/gpu/drm/tiny/arcpgu.c similarity index 100% rename from drivers/gpu/drm/arc/arcpgu_drv.c rename to drivers/gpu/drm/tiny/arcpgu.c From patchwork Fri Jul 17 09:04:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 11669617 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA31014E3 for ; Fri, 17 Jul 2020 09:05:12 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9802A2083E for ; Fri, 17 Jul 2020 09:05:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="kge1RFcN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9802A2083E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F316A6ED74; Fri, 17 Jul 2020 09:05:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id E290B6ED78 for ; Fri, 17 Jul 2020 09:04:53 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id z2so10234723wrp.2 for ; Fri, 17 Jul 2020 02:04:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+PgYCTE9+86LL8hmpo3wNDvQ3MAJhOxmPWFQosNnkp0=; b=kge1RFcNb3MA3gqeJzyuV24hUc8Wuu5d52T2gwyiKPKlVVFuua5swyDy6DIhvkNK5V O7aHOHvHI2g+W6rPUxi9EK/wSmgHDfpELQi/FWldTxF4LA5hKnx2XUn/hJYTg+GvKjKs 0ppARKzGJPOZVBBk6nxakp5DLfoTkaBi9D+gU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+PgYCTE9+86LL8hmpo3wNDvQ3MAJhOxmPWFQosNnkp0=; b=tCpy4lpvLQMPfd1hnb7io0Td4oUOtH7xrRxPUkuw7Bp/DKVE4jyECxqiHBV0t18bai rJf72S9SDKyYfX5t2I/d0BjGsFScp2SYMK6V+KgwK6ih869K7FGs6UGY8fmWggPopXp+ PxasiZGy6E7UHNKw3uI55Mw4WaGrxQ85tujUhbUynuX7GwVOCrVATZqsZuWGhWUX2/Qf lyMbfsiMRJEjyqpH+1xckuFZNDeEMW9ZiOe7u3rrcdMSV3PIPzHZRsfShTO57KVwrsfQ a4Enk2QjMyu2pustVZFf9f68clC9xraLa9lCT6NAnXCWanaPlFNri+t2OkMMTn/gpUYa l0AQ== X-Gm-Message-State: AOAM531acrCYX7XRf61FBjrICer+b+Pz6j/daMWWoNTvbxw6ca3bFBIb zRWZjWVCeM1DdY5RPqplBWcdF/3z0WE= X-Google-Smtp-Source: ABdhPJy+91Soji71zWg4yMwSROun4xr6l/lazz9FI4nvDy4dRbGGruyC/WVVdgCNY4lq5iOhkRtW/w== X-Received: by 2002:adf:fe4b:: with SMTP id m11mr9095443wrs.36.1594976692331; Fri, 17 Jul 2020 02:04:52 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l67sm14520833wml.13.2020.07.17.02.04.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2020 02:04:51 -0700 (PDT) From: Daniel Vetter To: DRI Development Subject: [PATCH 18/18] drm/aspeed: Use managed drmm_mode_config_cleanup Date: Fri, 17 Jul 2020 11:04:30 +0200 Message-Id: <20200717090430.1146256-18-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> References: <20200717090430.1146256-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 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: , Cc: linux-aspeed@lists.ozlabs.org, Andrew Jeffery , Daniel Vetter , Joel Stanley , Daniel Vetter , linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Since aspeed doesn't use devm_kzalloc anymore we can use the managed mode config cleanup. Signed-off-by: Daniel Vetter Cc: Joel Stanley Cc: Andrew Jeffery Cc: linux-aspeed@lists.ozlabs.org Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c index 903f4f304647..0e19523f2a06 100644 --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c @@ -63,15 +63,15 @@ static const struct drm_mode_config_funcs aspeed_gfx_mode_config_funcs = { .atomic_commit = drm_atomic_helper_commit, }; -static void aspeed_gfx_setup_mode_config(struct drm_device *drm) +static int aspeed_gfx_setup_mode_config(struct drm_device *drm) { - drm_mode_config_init(drm); - drm->mode_config.min_width = 0; drm->mode_config.min_height = 0; drm->mode_config.max_width = 800; drm->mode_config.max_height = 600; drm->mode_config.funcs = &aspeed_gfx_mode_config_funcs; + + return drmm_mode_config_init(drm); } static irqreturn_t aspeed_gfx_irq_handler(int irq, void *data) @@ -144,7 +144,9 @@ static int aspeed_gfx_load(struct drm_device *drm) writel(0, priv->base + CRT_CTRL1); writel(0, priv->base + CRT_CTRL2); - aspeed_gfx_setup_mode_config(drm); + ret = aspeed_gfx_setup_mode_config(drm); + if (ret < 0) + return ret; ret = drm_vblank_init(drm, 1); if (ret < 0) { @@ -179,7 +181,6 @@ static int aspeed_gfx_load(struct drm_device *drm) static void aspeed_gfx_unload(struct drm_device *drm) { drm_kms_helper_poll_fini(drm); - drm_mode_config_cleanup(drm); } DEFINE_DRM_GEM_CMA_FOPS(fops);