From patchwork Mon Aug 19 23:02:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171730 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595651ily; Mon, 19 Aug 2019 16:03:27 -0700 (PDT) X-Received: by 2002:a17:90a:5887:: with SMTP id j7mr22973792pji.136.1566255807431; Mon, 19 Aug 2019 16:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255807; cv=none; d=google.com; s=arc-20160816; b=Dq2P3xW435aUCuMsPUpELAQjM7DiDbBxqE07uKTxO3WZfnv1awqevHXZUKExPVWnNz JzNkXRDXGey/TusfUR26jmdE+SbRbYBG09etSyQvx1JccuYalJdBfXN17CyYprRZOUeh lkFGud3r47TDRVx+8GQG2JrKfXs+iTMAVRWUnRNEOsop7Yrwz3NYtwQZ8ZLmxnf2ofT5 wM9KERtdF/zSvTasqpbF5RV6J9tAz9SGbwPNntNrUv9c3Can+k3AAHhMciGSybfCeJAr JDlqhSqJlpGQZINjEJlUqJ8y2D6brs7bcJA93aQB7aM5HXA/QQh1ix82aXYc8wBEshKK qIeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=q1UYVKf1UgYkHQbbceABIVFSdc5VY9rhqkw1qWPFE+g=; b=RZQtfml2tQizX3wAvXSGaAEM/IncaJtBB8oJw17JylVmAz04i0bPucnOQmfrUpsLFr EUo+znFbtCy2NwbMi46Fu+8JvxLtWMd7g1w4efJnd6A0yI/Wqe7eSfc6aeoA1UqaDa0T e2JBzSYPdx1tNxK7piH0eWXslcfNXIH08yoUMGoHiWg00jyfyke+JrxV2AMubP/Kk5G8 pk9t/qdtax6QSB6IwBi5lEOpe7Wd282e0G8Z7QfzK/hCU0gLml+YTQZ7JYZHkyTOjFxS Lap+e+8a3wBMSZGCNULKn6Gfup4G69LIjymY4zHzrUZ/i5JppbG2t0uzrCtGCWEprT+b w81A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ab9GXq7B; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d11sor2514207pjr.11.2019.08.19.16.03.27 for (Google Transport Security); Mon, 19 Aug 2019 16:03:27 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ab9GXq7B; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=q1UYVKf1UgYkHQbbceABIVFSdc5VY9rhqkw1qWPFE+g=; b=ab9GXq7B96HrAHyFfqyB0/SPavCGYM0CBq1M7QwaRzyzcOoG/3afd74oYCMfInshTg hLsyEwv60UKNsjwuct55PsKKKt/LAKLHOLVqL9Mj0cEXTXGHXes9s5sPWoiuurdNSIn7 NeQD+IVzTENa7LlNjPbWMcq7Yy1ZbkRtcy8KwdyPrpPX6Rb7IxVFUiPnqcDi5gbKcQcY ZJ4OZZ4rWPSYllkJ9V69GoBfhuRrQckHdmX4huxA34pVbHm38CUuOKoQfMnyY0fadCyQ x7PbuyTavmtPMYQG9lgXCL4Ay8L7QeMVU1lmEUSA9//y0YKtAD12EPaHuqYelCkVhPMD hN1Q== 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; bh=q1UYVKf1UgYkHQbbceABIVFSdc5VY9rhqkw1qWPFE+g=; b=RgJ+0/KHxJeTC8ohtcZxdzaGin7E9osqhxID3qYcE+4at1R8TaiTtppB0Q2GUm4RCU XiaXJlRoCw/r+8NAKdmxgY2CZsP6jFueAtINRDWbRWc9ZfcJaSwp/W/0t6hQLf867wid IWgEUaUo3SbRYHAGvtntOmeHczfFUemRn0SvRAJmJ8DQeiM5yrBoW52pjROGnGG/7zc6 9ZNiqvmX93L4jKpHieIt1r7rFHUdSIl4L3yvHZ/s7WSX4/vRPezY5fVoyEVOwGxTX1km Ex3u4u9d7/3MY/jBLp5xxRndekDnhb96rbiYXt29MiyNJnKXsIY1w5e5IUtbhPXly4bV xjLw== X-Gm-Message-State: APjAAAXbPo5STNvqolNfOXi3+7pgaAYbmb6M+tIt1w8wydM9ZoZwvpda HFvTBj5Q7p3ZIx53ucrucvbNYTLa X-Google-Smtp-Source: APXvYqyB8vL4FN4upHc3oHtcKzz/huky90s19ONqkA7aY0oJxDED+syrRBcbnqlw5cJ6oJHc8Ob/4A== X-Received: by 2002:a17:90a:c20e:: with SMTP id e14mr24271052pjt.0.1566255807044; Mon, 19 Aug 2019 16:03:27 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:26 -0700 (PDT) From: John Stultz To: lkml Cc: Da Lv , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , Yidong Lin , John Stultz Subject: [PATCH v4 01/25] drm: kirin: Fix for hikey620 display offset problem Date: Mon, 19 Aug 2019 23:02:57 +0000 Message-Id: <20190819230321.56480-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Da Lv The original HiKey (620) board has had a long running issue where when using a 1080p montior, the display would occasionally blink and come come back with a horizontal offset (usually also shifting the colors, depending on the value of the offset%4). After lots of analysis by HiSi developers, they found the issue was due to when running at 1080p, it was possible to hit the device memory bandwidth limits, which could cause the DSI signal to get out of sync. Unfortunately the DSI logic doesn't have the ability to automatically recover from this situation, but we can get a an LDI underflow interrupt when it happens. To then correct the issue, when we get an LDI underflow irq, we we can simply suspend and resume the display, which resets the hardware. Thus, this patch enables the ldi underflow interrupt, and initializes a workqueue that is used to suspend/resume the display to recover. Then when the irq occurs we clear it and schedule the workqueue to reset display engine. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Da Lv Signed-off-by: Yidong Lin [jstultz: Reworded the commit message, checkpatch cleanups] Signed-off-by: John Stultz --- v2: Minor cleanups v3: Rename workqueue entry for clarity (suggested by Sam) --- .../gpu/drm/hisilicon/kirin/kirin_ade_reg.h | 1 + .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h index e2ac09894a6d..0da860200410 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h @@ -83,6 +83,7 @@ #define VSIZE_OFST 20 #define LDI_INT_EN 0x741C #define FRAME_END_INT_EN_OFST 1 +#define UNDERFLOW_INT_EN_OFST 2 #define LDI_CTRL 0x7420 #define BPP_OFST 3 #define DATA_GATE_EN BIT(2) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0df1afdf319d..d972342527b8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -58,6 +58,7 @@ struct ade_hw_ctx { struct ade_crtc { struct drm_crtc base; struct ade_hw_ctx *ctx; + struct work_struct display_reset_wq; bool enable; u32 out_format; }; @@ -176,6 +177,7 @@ static void ade_init(struct ade_hw_ctx *ctx) */ ade_update_bits(base + ADE_CTRL, FRM_END_START_OFST, FRM_END_START_MASK, REG_EFFECTIVE_IN_ADEEN_FRMEND); + ade_update_bits(base + LDI_INT_EN, UNDERFLOW_INT_EN_OFST, MASK(1), 1); } static bool ade_crtc_mode_fixup(struct drm_crtc *crtc, @@ -345,6 +347,17 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) MASK(1), 0); } +static void drm_underflow_wq(struct work_struct *work) +{ + struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + display_reset_wq); + struct drm_device *drm_dev = (&acrtc->base)->dev; + struct drm_atomic_state *state; + + state = drm_atomic_helper_suspend(drm_dev); + drm_atomic_helper_resume(drm_dev, state); +} + static irqreturn_t ade_irq_handler(int irq, void *data) { struct ade_crtc *acrtc = data; @@ -362,6 +375,12 @@ static irqreturn_t ade_irq_handler(int irq, void *data) MASK(1), 1); drm_crtc_handle_vblank(crtc); } + if (status & BIT(UNDERFLOW_INT_EN_OFST)) { + ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, + MASK(1), 1); + DRM_ERROR("LDI underflow!"); + schedule_work(&acrtc->display_reset_wq); + } return IRQ_HANDLED; } @@ -1038,6 +1057,9 @@ static int ade_drm_init(struct platform_device *pdev) /* vblank irq init */ ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, IRQF_SHARED, dev->driver->name, acrtc); + + INIT_WORK(&acrtc->display_reset_wq, drm_underflow_wq); + if (ret) return ret; From patchwork Mon Aug 19 23:02:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171731 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595694ily; Mon, 19 Aug 2019 16:03:29 -0700 (PDT) X-Received: by 2002:a17:90a:f0c7:: with SMTP id fa7mr23605123pjb.115.1566255809741; Mon, 19 Aug 2019 16:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255809; cv=none; d=google.com; s=arc-20160816; b=LDeRVIPXrJ+Aqslym+L50Y4c2kRsBzt92TG93grfzbFKzMetw9E5yweNaiXc0wdhJN kzwSDq6jGIbcT3IyneXSlVQF9iMrD5qn8dd3L+9bG3Dzg5oHNVXu+rSbhVq7RSBbChhS LxgJ4iwpRP37nMsfMQusd+vylbbJ3EsacyBD6o8sd8aytL4jRtH7AnuGiwrnL/qzHrhb OESFzRizyNfiNt6yZojCXTey91zB5YAu6HOogoQ3TilAKr+OQHfa0si28zEPDeETaFsv QzZdcOv1lLfj1TIx0OlHLqNbqMMzsUGyEqPUA3mxvpkOcKrIzMSucL3dD3Xvq2G4VQAq 5Byw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rFkDVdxMKmvjHBJyGmUApN9b++k2zTF9quw3rYo2m6Q=; b=awEgc81Fuuy2JVR3YJgANo3yKNYeWHt7KLJ/nlCT6H3M2BBfGofKByWwEIy6qXfTYg aErxPS/4cd+ID81LZxnt294oeM56jJGVr3WoClXyANczY7yej5RKOJmMjOgTUnFa9/T1 jYliyNUJuxUlpE7LLFSBcuY093ukRmws8JQm9oI1Fm0y/eyuWZNMkDzyoEvmZLXjz8O5 Gm/C78ozClOUagEkAjHORyfQfeN4QcfQJ05oTUFiGehEjCzyALE6MEWSXwTKvSMrMU/l EZ4I0ZJ1Z+0/8tVkqy5BivtpJEg7msXyDWIsdav9afuR7vO5fLTg5/PXy3QL8vVqI5ye l5Bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ssMY1vMB; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f6sor2048392pfd.46.2019.08.19.16.03.29 for (Google Transport Security); Mon, 19 Aug 2019 16:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ssMY1vMB; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rFkDVdxMKmvjHBJyGmUApN9b++k2zTF9quw3rYo2m6Q=; b=ssMY1vMBnfYeQHZ6nmDqVi7HELDW9OJq5zbSs5hi/zO5WohansKLHoLyT6vZCgdmS5 y+MUgWtI7G5QQk354TwljfgSKN81Oh5F3pCuFAqUag8woabn0i2BKkxVwoGOKtonZ5v8 DuvmOf07K8pwmeF7yM3CuTrM5rFeK1D/5oVG+MseohPlAXVE+1zF/Ryh8cz0sQwV5ggH QWEZKhBNYi2hDaXgnsH6zoSfdgCcxe5DxE9Dqp44qcSr2qxJrZvyCAalA1aEKUV6hyu2 fCz8qdMyhY1r94feRwEO0f57ma5gBoDkxaxsja/NG8U1UQOUpWjHCVxqTW2acvn9RrTf aMQw== 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; bh=rFkDVdxMKmvjHBJyGmUApN9b++k2zTF9quw3rYo2m6Q=; b=B2QaklM3/8scsnPpOFId2tqP/xrJl82Mss6Ub52D0j3P2/b8nsOHxr/ED59fzecfh9 PWlB+1psZmroYnYHP3CsX2vIPXosTsiDLTRAeqaGiNC23nt/ishqZJB35LiAzwluW8+T Fur/JXGLvcLUFdkP8VprinKhRdeQXSiuTtR+uhvcO3pLuHD5sxcSZQdPNsSRm/Pn+0CE e6ppOLzZRMk3vjQhM8CMD7bdnrycBZoBKox7LjMx5othMv1UpETwSFFoVQqolnHYxqlM tP94XndfdMcKo1FY2HF+j3gaM5YzRpZknpY9/Lqap9LHrUrdpLWbNpkoGvVmGabbBJgI +ceg== X-Gm-Message-State: APjAAAVNyXYaOY4FPKa9X/xZdLN1Il4mdc3B1PaDmDC3McS03FptN/rY EG4cfCY9d/uo1vSXfxXeMnB+1lKA X-Google-Smtp-Source: APXvYqzTHLA7lx1VrFQUleoFllBiaEBYpVMyojNmAKc5BgBc6sj6Wpv2qDv54wM2tzLv9aWlq/ZHjQ== X-Received: by 2002:aa7:946d:: with SMTP id t13mr27405973pfq.121.1566255808902; Mon, 19 Aug 2019 16:03:28 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:28 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [PATCH v4 02/25] drm: kirin: Remove HISI_KIRIN_DW_DSI config option Date: Mon, 19 Aug 2019 23:02:58 +0000 Message-Id: <20190819230321.56480-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> The CONFIG_HISI_KIRIN_DW_DSI option is only used w/ kirin driver, so cut out the middleman and condense the config logic down. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/Kconfig | 10 +--------- drivers/gpu/drm/hisilicon/kirin/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/Kconfig b/drivers/gpu/drm/hisilicon/kirin/Kconfig index 0fa29af08ad0..290553e2f6b4 100644 --- a/drivers/gpu/drm/hisilicon/kirin/Kconfig +++ b/drivers/gpu/drm/hisilicon/kirin/Kconfig @@ -5,16 +5,8 @@ config DRM_HISI_KIRIN select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER - select HISI_KIRIN_DW_DSI + select DRM_MIPI_DSI help Choose this option if you have a hisilicon Kirin chipsets(hi6220). If M is selected the module will be called kirin-drm. -config HISI_KIRIN_DW_DSI - tristate "HiSilicon Kirin specific extensions for Synopsys DW MIPI DSI" - depends on DRM_HISI_KIRIN - select DRM_MIPI_DSI - help - This selects support for HiSilicon Kirin SoC specific extensions for - the Synopsys DesignWare DSI driver. If you want to enable MIPI DSI on - hi6220 based SoC, you should selet this option. diff --git a/drivers/gpu/drm/hisilicon/kirin/Makefile b/drivers/gpu/drm/hisilicon/kirin/Makefile index c0501fa3fe53..c50606cfbbdb 100644 --- a/drivers/gpu/drm/hisilicon/kirin/Makefile +++ b/drivers/gpu/drm/hisilicon/kirin/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only kirin-drm-y := kirin_drm_drv.o \ - kirin_drm_ade.o + kirin_drm_ade.o \ + dw_drm_dsi.o obj-$(CONFIG_DRM_HISI_KIRIN) += kirin-drm.o -obj-$(CONFIG_HISI_KIRIN_DW_DSI) += dw_drm_dsi.o From patchwork Mon Aug 19 23:02:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171732 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595712ily; Mon, 19 Aug 2019 16:03:30 -0700 (PDT) X-Received: by 2002:a17:902:e9:: with SMTP id a96mr9403446pla.169.1566255810393; Mon, 19 Aug 2019 16:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255810; cv=none; d=google.com; s=arc-20160816; b=wcQVCk1dq7Sf3gMAHy18DM00XLK+6nyK+/am5zqk5Iv9YZ3am+H8QetZ9pR6P0do93 EnbPyMztZrRSV5VNvyHxoXI8wV7C5p1u9Uq79L9KfRCmkzNgm1BP3e6+QCilctjDUGtv 3F7uak2UkuN0zY7TzX2j/JHW3/jGt7MWRM7fpNAW0xMQBuawR1isFU/lpiKQSFZkLfGt dfyQy9aIKCNqtFwKRr52HywuccALqjxHxD/Hk04o74lO/wBRCAzxY+JufnsXnK2i1UH4 7w5w7l8GH8ckL8w+Ft8uGr5Pd/c2A36ajTfMiHcmbSsbwxeDlbd97x3FV8GvdIeTBMje uuEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i6m141WDgWo2fEqKOTQPkh65ch/WaZ2zC8BGag2kGAk=; b=dVFI9t6+5RUi4ftimnvhiimmKcquJTag9qLKxYW8eUeG3CRVvd2bORI1U/nvdnJ9FX Z9msDrURc4l4nMXijKAStOEcu7sKcKfzlDZKE0rVNDt7LtZW+6xh6WODJYMGDtymdE1S GEGGzakMtdMmL7IuLvT4MoZYse5lZTYpqrjS0RlyZpuy/KaWRzpH/PK0v9ZxwUFyv5R7 UAnZgghEmWsACgu187aQT3XWVmPZo26jy8C1xRtVWOsNg4escUlLnPBJLQxcf9THpvfH SYcSKYcpUBHKjwPOgDHSZIsEdlusdC6g35DF4S57mmzWsEp1/2ZHou+j2N3amEaMGJoL AyiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuR2cIhj; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f10sor2068783pfq.72.2019.08.19.16.03.30 for (Google Transport Security); Mon, 19 Aug 2019 16:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuR2cIhj; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i6m141WDgWo2fEqKOTQPkh65ch/WaZ2zC8BGag2kGAk=; b=HuR2cIhjFWz+4JWrKq4LPu+TjN9IyLdmlpABHg6FpMPw8pF218Oqvf9YVNMUAgT+ZQ sLeCCgC3vmOwiPEZyMojK3wG0zhYyUADo4mCJA2OUb1yEg4s0eGV/cZUycvnm9GR8fJ0 Ufk4ce6n6CJ4LTnq4ttEKktmGl4lTrix5wNVKAGKa8Xxg2a/HdfZwWSMn1XyHStyImMX ArMe/zCWSjcBwhVq+ymr85UBC2LsCmjEKOE/xpvezdW1xE0a1Jxv0cbmaUzMKEduL6Qr I+pUxL83x/pgtjfyBOIACYuCJkkSGW9Wk2kM8d3mX3/9HXqoVqz8XmocHRndfednTYCy VVzg== 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; bh=i6m141WDgWo2fEqKOTQPkh65ch/WaZ2zC8BGag2kGAk=; b=Died9JyERgKhlzSPaKJzfF9XYqz4PhZDP1cWRe7fcy/WACoPgdYfYNj1mSNkKmCtYG YjMz0dMyGc5r3wUA3nB1hti6KJXDzYDIRaU8K6ezsY4ZRQt6Qxe56vgDHx4DCrV0xi/q 2bE4hg1HY5iDszbMqODNH0C9PWwWLhtbWWdZ2o8Rm2ITItDwHRyOR9BynTx3edCD4zdc 0xcnAlxY2v87m43s+/QdOlSg7roGQoHXwnaktScXovtnuw/9lVYmlo7tdlIDOW3sz4hZ hUSpQCC5xMFdfM30kibZuSJUaYfJPYwwdrbwJ+JPcGLIK8kiOJENp253zkpjms4N2Pdl M+2Q== X-Gm-Message-State: APjAAAWm0CdDCI+LGunvFNRaOJMjqpgwBJ+oEornBelN2WPgBAknr8C5 DQg2GXDCIjPfODRtfqEGjr0yhz4z X-Google-Smtp-Source: APXvYqwG9W4CfZHOjBvxvQuucJnsWPQbrgBVAkuIl+wmQF01BSo9fnI1CCwcy8t95kgUzAi6UtR7Qg== X-Received: by 2002:a62:35c6:: with SMTP id c189mr26730739pfa.96.1566255810038; Mon, 19 Aug 2019 16:03:30 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:29 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [PATCH v4 03/25] drm: kirin: Remove unreachable return Date: Mon, 19 Aug 2019 23:02:59 +0000 Message-Id: <20190819230321.56480-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> The 'return 0' in kirin_drm_platform_probe() is unreachable code, so remove it. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Suggested by: Xu YiPing Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 -- 1 file changed, 2 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 204c94c01e3d..fcdd6b1e167d 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -208,8 +208,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) of_node_put(remote); return component_master_add_with_match(dev, &kirin_drm_ops, match); - - return 0; } static int kirin_drm_platform_remove(struct platform_device *pdev) From patchwork Mon Aug 19 23:03:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171733 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595744ily; Mon, 19 Aug 2019 16:03:32 -0700 (PDT) X-Received: by 2002:a65:62c4:: with SMTP id m4mr21668933pgv.243.1566255811891; Mon, 19 Aug 2019 16:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255811; cv=none; d=google.com; s=arc-20160816; b=LPS9siiVEM8Cz3iqsaENrwpORTKRxjMxcLJ8pkovy7+O/2cq376auNPiJMf9CeHfkL ojMJG1+pGlhFd+NssL5Cq8GqJGgU/hc5RGq8JjhbywG9262lWpnGqHPe3DVQVbdPjdne xcOLQzV6koxxh6rq2GIlKmBdqPoqVXz6MYN9tk6KSiXZjTMv0krZgECONQ+m3lZrEsxH 4ZfOt7SWvn4VZR+Clenl9WH8i2JO2u47VgJk3moku0hIL2/cUKH84hETrGwQtvUA7cGb Iob3fksDcQDf8lBaY/fnDvA+Eb79FJgiU1Rkkol1dSLU3fy6gE6lbHTyjEp/hVtw1VSx Uu2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=sMMNrNPEyr5ojRnGMae00OuNvWMz/twMj42dMKt7nWI=; b=LtjLyuscPZG1qGehNfrEFeyXXdDMOjLoQQLR+QwrAzUPwMYReRsYEMgGaMjy0f21GY 5W48Aa4PUR1oAbWXysGhpO5oKy7B+eP5oAFccgfqKCrNGBUXsHUMpxCl8fMVZLtC61pn aGw2pI5zm4GJFdrBeXOtQohr6ZikdOdY7xgOkYPUJS1vqmewzCsk1x2d/C8G5sCboWtv 7lQggAAyoH0hBknXLWAiBGC4NPUEGE3Oqj4ieAw7wRhdBU0CwlINGr3qR1Sf5o/wbu8F nBYPgm5HQ3N0sDFC56we0a4eh/bXeq8srCHskZaLRHWGPcklB/pq0d3c1a7KpiJTp6du wutA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v1pVzeLV; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m133sor1860766pga.10.2019.08.19.16.03.31 for (Google Transport Security); Mon, 19 Aug 2019 16:03:31 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v1pVzeLV; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sMMNrNPEyr5ojRnGMae00OuNvWMz/twMj42dMKt7nWI=; b=v1pVzeLVL4i2QM63LjdIG16cVunIA1wDrcWnGZLbSWTLQuViS6sU6eb1I4/agTCUDc t+ZtZed/2TMX58/fHKD78fEnRgbm335xveJAkCf4IuL/CxHn5fjilap0t8YkgZxLj0qe 0bUhKZ5dwWZ0IdOmoETmqGDVV+rLoDNfdFgfidefk3MkiePU1eBGttWbh1PujCbR+A1u dR+mi7XMVr3BzexefjBdeM4Q3RhFtJT5LpJZWYnvW/OimWUTcNTYpKGLdLnhwwHTQjKH 8Rw5PJSi5pDJnKmKfkR7Vsm7n+MME4k4sIfpwYhJi5DVvKW126bvgv0PgVOxqlviKzFT /Sdg== 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; bh=sMMNrNPEyr5ojRnGMae00OuNvWMz/twMj42dMKt7nWI=; b=gzEj6zr2w1lHISWXubNYdxXHeieRau/HF1Q6lSBHYlyw4dv8FgUb22bbZdqyOq6+Aw /06tfEnHH5yqRbLy36JKgp95QBI6FGLqKlF8boZgraeG+z0lHvXxvn1MohQ9V7/t89iP Qoo0+FKXm9XeoWKFYYCJn6hTKrkiNmpaqBvYQc4quoceDFQy0YXPEb85FHFByfEECEem 8nISgNUp2qQ1d8xJv+QiYNX8sr5t9u9XJiEtCcEFO+hxZIZxASQQ/RachNrXyEOChePp BkaCYgAHDpnJbE0bMPhlCaohPVlbSQye7Fm48vEMk5rroCI2KXPycoy5Cjs/QYYD5pL2 E8Qw== X-Gm-Message-State: APjAAAXbEpLR+MuZD+J/bkbTOJqcpSwE/3j0HpI2nuc788L9Qj514bwR +J7+jmy0/lxl5SG7O8ZvzdywRb+s X-Google-Smtp-Source: APXvYqwb1NlOHGixTVWfKWtPeGyyczgYsv1+r1jQRk7O0IlMpAWvAHx5RA2P2qeq/kAH+R2FQKrW1Q== X-Received: by 2002:a65:6458:: with SMTP id s24mr21839142pgv.158.1566255811461; Mon, 19 Aug 2019 16:03:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:30 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 04/25] drm: kirin: Remove uncessary parameter indirection Date: Mon, 19 Aug 2019 23:03:00 +0000 Message-Id: <20190819230321.56480-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing In a few functions, we pass in a struct ade_crtc, which we only use to get to the underlying struct ade_hw_ctx. Thus this patch refactors the functions to just take the struct ade_hw_ctx directly. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index d972342527b8..45351934d919 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -210,11 +210,10 @@ static void ade_set_pix_clk(struct ade_hw_ctx *ctx, adj_mode->clock = clk_get_rate(ctx->ade_pix_clk) / 1000; } -static void ade_ldi_set_mode(struct ade_crtc *acrtc, +static void ade_ldi_set_mode(struct ade_hw_ctx *ctx, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) { - struct ade_hw_ctx *ctx = acrtc->ctx; void __iomem *base = ctx->base; u32 width = mode->hdisplay; u32 height = mode->vdisplay; @@ -301,9 +300,8 @@ static void ade_power_down(struct ade_hw_ctx *ctx) ctx->power_on = false; } -static void ade_set_medianoc_qos(struct ade_crtc *acrtc) +static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx) { - struct ade_hw_ctx *ctx = acrtc->ctx; struct regmap *map = ctx->noc_regmap; regmap_update_bits(map, ADE0_QOSGENERATOR_MODE, @@ -515,7 +513,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, return; } - ade_set_medianoc_qos(acrtc); + ade_set_medianoc_qos(ctx); ade_display_enable(acrtc); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); @@ -545,7 +543,7 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) if (!ctx->power_on) (void)ade_power_up(ctx); - ade_ldi_set_mode(acrtc, mode, adj_mode); + ade_ldi_set_mode(ctx, mode, adj_mode); } static void ade_crtc_atomic_begin(struct drm_crtc *crtc, @@ -558,7 +556,7 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc, if (!ctx->power_on) (void)ade_power_up(ctx); - ade_ldi_set_mode(acrtc, mode, adj_mode); + ade_ldi_set_mode(ctx, mode, adj_mode); } static void ade_crtc_atomic_flush(struct drm_crtc *crtc, From patchwork Mon Aug 19 23:03:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171734 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595761ily; Mon, 19 Aug 2019 16:03:33 -0700 (PDT) X-Received: by 2002:a17:902:ba0c:: with SMTP id j12mr14797128pls.231.1566255813295; Mon, 19 Aug 2019 16:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255813; cv=none; d=google.com; s=arc-20160816; b=vpV8F8qaMadzTckI8zUohMFmYh1Of+exfSNK1OQmPGId52U8VxKSaUAingP76bGENp 1VxK+9NLak7Tq3mw/pCoHqr7FwwKl2cZ+raZB4MtC3x5XtjxJHgg0xQb3H2ShdY82/Jg wtxg/+Bh/2c4R+QgmXZ5+IJMpQ4fMr+gRXFq/bYsCimzV5mBWv+BCCndnN2wZvfL4N16 +2fLku9im7buPa2W1noYowYlDmMAtVnQQYuojDSAbZpKNd6Ouqa5TMfDaQ1xOrNny93j 3dnjdoMAyeZ6faw+uXTmv2Srd2T7dQIlJOxAIUH3n41tELfiMt76SSDR8GXqSrMcYxGf yJAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IcvzzFr1yUCqUm7igC+fhVBaiFn8HJOuskJ5pNSj2cg=; b=WkhFbiw7hR7Cu7qd0hTj43Oj0hxd+GRE1S/mresNoHGZnNcjigeBho7Wl+pIvBfW6W RePFIDPKoCiXTeX0Cu9bL6Xpmk7Bb8bX60vCDS6d3JSbooeMbCxX0J5aOCUNbD5pvF2V m+wV+vTc36HwDfoWagxqlnO20IQK7Ey2RWUrX8arzxF+cKVDDBB6TWwNHCJnTC86SErW skTCsUnF4KqipRDXPFrfYWlFt1r6Wzi6hCa7J4XVyniJzGtw4iwhTSzuS/iG/qUS2XlM P5Dy9cv8cqYfiXgHRI+jFn9R7sFHa5jHhu3DfIzMMCo0gwqVShGZ+6ZfT+Wysg3t1xPe Np6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U4WeI325; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 31sor2525358plc.62.2019.08.19.16.03.33 for (Google Transport Security); Mon, 19 Aug 2019 16:03:33 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U4WeI325; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IcvzzFr1yUCqUm7igC+fhVBaiFn8HJOuskJ5pNSj2cg=; b=U4WeI3251DHI0T6iewjy1ZAE/Tc5MUMKKiHzuVnDn4qP3R+sfhglpWK8NOllEgsE/Q 9Od7X+IMIF29m6np2J9o7qEpvYklowBSUA9uzqONjTX3sMidJ9GbL7zWSKSMBcSsQ4KT VPtF9zelPzmK19fZtC/u8fOH5YhKuMXoHo0gwlIVhpuar4afvYQQFCYT2HsvuLZBdTkr AFn4988z8PfbRracVplm92ipaemHwq3W+Uu3Y7kc07ZL6JECVPQKuxJMIkfS9ZM9FImN P5WulyxgZGwP871nGDuMSEUpsU0cwAuZoGd9UoYlF5bCGpKOwKXC7socjuNCEGyTHOFT t3lg== 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; bh=IcvzzFr1yUCqUm7igC+fhVBaiFn8HJOuskJ5pNSj2cg=; b=m8X7+hj6DMhx+D5hnfBdTp94GyNOetzSzbmmWpcvxHr9+1Su8tOxGz8Z6IrmzPjEgo KdNM7Z0WSHiA7PZ84Bbk4fSMrZl8dkC2oILMm8XPrIKLA+WnsEqtCzelSyCXhgSabHw7 H0fgprT/Br1Sp6lMx2fDq4c0/NObdix+lpt7+Iij8Eoe421G4qr85J86gJAgfL9FmWaN YptjcGjtZ6ACmkAY9meax4H40CmbNbwZBo9V9BqWqaaPhAWtbYbD1pgn7mF4ZZEyQFxI fnH5eK2rydX25xYdq/y9C1z4xJrpjg+S+U0AQrnlKF5YavvSoYMdjRcuSNGURw81e2ed 4ZgA== X-Gm-Message-State: APjAAAW2cWVhrs4FsGZpPY0HNSOsZvSCYbl+v2daIq2NJRP0S25De7r+ Fciliy9Y8G+yibVkpraBTfSR5d5l X-Google-Smtp-Source: APXvYqy/9b7QWfSgj3BIIPDwjkoJZHMNmpA/Rmy6iIYI573jdO2gK9EuSuIV7vpseihMBWmjyCA99g== X-Received: by 2002:a17:902:2be6:: with SMTP id l93mr25408789plb.0.1566255812927; Mon, 19 Aug 2019 16:03:32 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:32 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 05/25] drm: kirin: Remove out_format from ade_crtc Date: Mon, 19 Aug 2019 23:03:01 +0000 Message-Id: <20190819230321.56480-6-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch removes the out_format field in the struct ade_crtc, which was only ever set to LDI_OUT_RGB_888. Thus this patch removes the field and instead directly uses LDI_OUT_RGB_888. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 45351934d919..65f1a57f7304 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -60,7 +60,6 @@ struct ade_crtc { struct ade_hw_ctx *ctx; struct work_struct display_reset_wq; bool enable; - u32 out_format; }; struct ade_plane { @@ -383,11 +382,10 @@ static irqreturn_t ade_irq_handler(int irq, void *data) return IRQ_HANDLED; } -static void ade_display_enable(struct ade_crtc *acrtc) +static void ade_display_enable(struct ade_hw_ctx *ctx) { - struct ade_hw_ctx *ctx = acrtc->ctx; void __iomem *base = ctx->base; - u32 out_fmt = acrtc->out_format; + u32 out_fmt = LDI_OUT_RGB_888; /* enable output overlay compositor */ writel(ADE_ENABLE, base + ADE_OVLYX_CTL(OUT_OVLY)); @@ -514,7 +512,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, } ade_set_medianoc_qos(ctx); - ade_display_enable(acrtc); + ade_display_enable(ctx); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); acrtc->enable = true; @@ -1024,7 +1022,6 @@ static int ade_drm_init(struct platform_device *pdev) ctx = &ade->ctx; acrtc = &ade->acrtc; acrtc->ctx = ctx; - acrtc->out_format = LDI_OUT_RGB_888; ret = ade_dts_parse(pdev, ctx); if (ret) From patchwork Mon Aug 19 23:03:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171735 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595781ily; Mon, 19 Aug 2019 16:03:34 -0700 (PDT) X-Received: by 2002:a62:35c6:: with SMTP id c189mr26731121pfa.96.1566255814832; Mon, 19 Aug 2019 16:03:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255814; cv=none; d=google.com; s=arc-20160816; b=SbSiMOCrCS4Hh8/rkkS5QnUjbREfqCsCUeHs2bJlouIkGNO9VqGfuTmGqRCklmxjCt Ktu3ugvciZCgwKXobTUmfHXyuMr8dp9f34CZeHgQ4MllZqvMMOnSRMjQnBnNKkEFyUb/ eiqf8aiwWwuJ5qhSpWuZ2WQx/+0fABFxTH1RyV5t37FyciRsfMLgJ/LglgVvxY0TxRAf cjmYCodRibOSAGUKEv0dQS4QvbukQkHV4mnTa0bXVHzrE24HQYLjAHYXHq+X0YIB2Xhh GEFCdMJxXgBbv1BFUmu58WClSVIfJvWrmY6ODoJNdQjrWHhOiYRh+lzA2gjO2yzkiyh0 TEyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wDN5Qh2/00dJZLoF3M4SXeIuODTG/TUr5/kEaW32ueQ=; b=PbruDQTk1YvmyR4nolIlWaqnK88Q82EQrDVRwjAvdtBefrWfHyWjP8tq3ybbtvIm0m OkXUCrOxhYozP0foOegmVwJgqYh4NUylcw7qeroevFSHM+S63IG+aWZVcQhe2+NjCvDA MnnnODEmjuZU4Ckd+xpC+3wiFw5dQGy65Xgw9DWz9Oy3JDWA4SNfyiKM1BvRRF2c22Is VpK/f+0LZBsQrScaIRYWf4OyzYcuHFBm9bKmRf9FYE/fxM1DWtoOEOkBEDAEv1L7J4Np SI/asdAZNkiEAanKUAkwbzEAt2Oy2QpNySS5E0jRck5jIvtuYZRgDZwAWhx/2LD84f/y smpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S91jDQRL; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id p9sor2590262plr.10.2019.08.19.16.03.34 for (Google Transport Security); Mon, 19 Aug 2019 16:03:34 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S91jDQRL; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wDN5Qh2/00dJZLoF3M4SXeIuODTG/TUr5/kEaW32ueQ=; b=S91jDQRL9jZ6o61WERsOkpAq735GpQEx7mzFBahSeaojGWei75IuZ9lEJt4JNDB4DJ +Qr5LZTcdcOTP03dWfYoRxmJzhUpATZIidl+Naurvc/3Q2fryCIrFfafS/lqf2LolT4E A76Sttwj2xZ3n54YuwLd0LWJWdK+zXNK9GTuP3CTxChgWfDk2OvIwmmSGRID53MVITfx vIdJ3NxIZn0Vjp9j6CK/9L/jFys6iXz0o6uZHqRTYTk3BX0/J6WRPvarOgOD+HooDfgd YtwB9UT/PQ2R0S/HDKJn8m7SqFfUUSUzSA60L9yxxlSSs0IP7CoLYWmdrzq6ZuA5zmd5 YbJw== 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; bh=wDN5Qh2/00dJZLoF3M4SXeIuODTG/TUr5/kEaW32ueQ=; b=d+PVNCC7ybxSZrLLS+/4CmOs355DCT/5WdyxGMX6WZNh/xPWSJc61zvtzpb97tLpaV 3KiKkFuW6wffL3cxzTsFyxDCAg7f5pF4AYlgEwck9e+hVo39Dp4J/poOrN6x0M1Nz+Ex JJ3fmt2gwFKZ41car767S22W0cnJYUaXOw5zbEMEvVZoPqJOxc7r0/jEJppL6qP7OLSQ qM6UD0RFNzdzEvQsFOk6EEsmbbzg1f6cZA7IbjKZcjY8w4cEtTyR1sbBxLzhBOYEFx4A RQojQ4XakOaFq4rNCtE8ilgSRVoAQNbylhjHpfCmItAIypiVVTie74uP1WY6wrKEb3Bt UKqQ== X-Gm-Message-State: APjAAAVGEJ0vtMvLPNZYT9e8nJoE2zNrv4lR56fxBrryJP8mg7HSQ9dd GObGKOFrhj+iG9dfZV1aoCCTtWyB X-Google-Smtp-Source: APXvYqwFdxnlTiQNtFl98XWDzM4ANhPbVaXntyLUFZXzFhZG7o1TCYiMLoHN+uSOuXSnAf8SCO07Iw== X-Received: by 2002:a17:902:bb94:: with SMTP id m20mr24644877pls.336.1566255814406; Mon, 19 Aug 2019 16:03:34 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:33 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 06/25] drm: kirin: Rename ade_plane to kirin_plane Date: Mon, 19 Aug 2019 23:03:02 +0000 Message-Id: <20190819230321.56480-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct ade_plane to kirin_plane. The struct kirin_plane will later used by both kirin620 and future kirin960 driver, and will be moved to a common kirin_drm_drv.h in a future patch Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 65f1a57f7304..19d279167694 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -41,8 +41,9 @@ #define to_ade_crtc(crtc) \ container_of(crtc, struct ade_crtc, base) -#define to_ade_plane(plane) \ - container_of(plane, struct ade_plane, base) +#define to_kirin_plane(plane) \ + container_of(plane, struct kirin_plane, base) + struct ade_hw_ctx { void __iomem *base; @@ -62,15 +63,15 @@ struct ade_crtc { bool enable; }; -struct ade_plane { +struct kirin_plane { struct drm_plane base; - void *ctx; - u8 ch; /* channel */ + void *hw_ctx; + u32 ch; }; struct ade_data { struct ade_crtc acrtc; - struct ade_plane aplane[ADE_CH_NUM]; + struct kirin_plane planes[ADE_CH_NUM]; struct ade_hw_ctx ctx; }; @@ -795,16 +796,16 @@ static void ade_compositor_routing_disable(void __iomem *base, u32 ch) /* * Typicaly, a channel looks like: DMA-->clip-->scale-->ctrans-->compositor */ -static void ade_update_channel(struct ade_plane *aplane, +static void ade_update_channel(struct kirin_plane *kplane, struct drm_framebuffer *fb, int crtc_x, int crtc_y, unsigned int crtc_w, unsigned int crtc_h, u32 src_x, u32 src_y, u32 src_w, u32 src_h) { - struct ade_hw_ctx *ctx = aplane->ctx; + struct ade_hw_ctx *ctx = kplane->hw_ctx; void __iomem *base = ctx->base; u32 fmt = ade_get_format(fb->format->format); - u32 ch = aplane->ch; + u32 ch = kplane->ch; u32 in_w; u32 in_h; @@ -828,11 +829,11 @@ static void ade_update_channel(struct ade_plane *aplane, ade_compositor_routing_set(base, ch, crtc_x, crtc_y, in_w, in_h, fmt); } -static void ade_disable_channel(struct ade_plane *aplane) +static void ade_disable_channel(struct kirin_plane *kplane) { - struct ade_hw_ctx *ctx = aplane->ctx; + struct ade_hw_ctx *ctx = kplane->hw_ctx; void __iomem *base = ctx->base; - u32 ch = aplane->ch; + u32 ch = kplane->ch; DRM_DEBUG_DRIVER("disable channel%d\n", ch + 1); @@ -894,10 +895,10 @@ static int ade_plane_atomic_check(struct drm_plane *plane, static void ade_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct drm_plane_state *state = plane->state; - struct ade_plane *aplane = to_ade_plane(plane); + struct drm_plane_state *state = plane->state; + struct kirin_plane *kplane = to_kirin_plane(plane); - ade_update_channel(aplane, state->fb, state->crtc_x, state->crtc_y, + ade_update_channel(kplane, state->fb, state->crtc_x, state->crtc_y, state->crtc_w, state->crtc_h, state->src_x >> 16, state->src_y >> 16, state->src_w >> 16, state->src_h >> 16); @@ -906,9 +907,9 @@ static void ade_plane_atomic_update(struct drm_plane *plane, static void ade_plane_atomic_disable(struct drm_plane *plane, struct drm_plane_state *old_state) { - struct ade_plane *aplane = to_ade_plane(plane); + struct kirin_plane *kplane = to_kirin_plane(plane); - ade_disable_channel(aplane); + ade_disable_channel(kplane); } static const struct drm_plane_helper_funcs ade_plane_helper_funcs = { @@ -926,7 +927,7 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int ade_plane_init(struct drm_device *dev, struct ade_plane *aplane, +static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, enum drm_plane_type type) { const u32 *fmts; @@ -934,18 +935,18 @@ static int ade_plane_init(struct drm_device *dev, struct ade_plane *aplane, int ret = 0; /* get properties */ - fmts_cnt = ade_get_channel_formats(aplane->ch, &fmts); + fmts_cnt = ade_get_channel_formats(kplane->ch, &fmts); if (ret) return ret; - ret = drm_universal_plane_init(dev, &aplane->base, 1, &ade_plane_funcs, + ret = drm_universal_plane_init(dev, &kplane->base, 1, &ade_plane_funcs, fmts, fmts_cnt, NULL, type, NULL); if (ret) { - DRM_ERROR("fail to init plane, ch=%d\n", aplane->ch); + DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; } - drm_plane_helper_add(&aplane->base, &ade_plane_helper_funcs); + drm_plane_helper_add(&kplane->base, &ade_plane_helper_funcs); return 0; } @@ -1007,7 +1008,7 @@ static int ade_drm_init(struct platform_device *pdev) struct ade_data *ade; struct ade_hw_ctx *ctx; struct ade_crtc *acrtc; - struct ade_plane *aplane; + struct kirin_plane *kplane; enum drm_plane_type type; int ret; int i; @@ -1033,19 +1034,19 @@ static int ade_drm_init(struct platform_device *pdev) * need to do. */ for (i = 0; i < ADE_CH_NUM; i++) { - aplane = &ade->aplane[i]; - aplane->ch = i; - aplane->ctx = ctx; + kplane = &ade->planes[i]; + kplane->ch = i; + kplane->hw_ctx = ctx; type = i == PRIMARY_CH ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; - ret = ade_plane_init(dev, aplane, type); + ret = ade_plane_init(dev, kplane, type); if (ret) return ret; } /* crtc init */ - ret = ade_crtc_init(dev, &acrtc->base, &ade->aplane[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &acrtc->base, &ade->planes[PRIMARY_CH].base); if (ret) return ret; From patchwork Mon Aug 19 23:03:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171736 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595845ily; Mon, 19 Aug 2019 16:03:37 -0700 (PDT) X-Received: by 2002:aa7:8007:: with SMTP id j7mr26610780pfi.154.1566255817676; Mon, 19 Aug 2019 16:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255817; cv=none; d=google.com; s=arc-20160816; b=j9siepKr2zabmsCvLQVWNDd/OzZHaonP4bZd55pXQr8e5afK3tIXfWDgGssyS6hhDq PDyfFR7MsaqmauWBU8Rh5L43+Qpe+QOXt/uW7YycRlzx1wjKdYmNle4B3+zYWGJ7mYjG 9h4OzT9r0eb0/falsR54QR0LATfiJL+5a+gA6H9hlCd0O24b68RtjiOCNJRy+sqn3zy0 /Zi7rFUmDpS7WGdFduIrmwlJ8cuopPckIraLS7quYHEXGRljlsXm7+zKVzMJkX6MLASX SuZtWb/Tq9aUD9T4y+C+5pPvVhkLFlsy5n9rIrKILgugyYtou3cP44LjnThKMz3hhaG9 FQEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/TlFFqIFbnuilFAvaZfscTqwSZVj/Gq+GQdJwcM1CA0=; b=hO9qfbuzXiDp/+7dHBRO1cjLcIuRMP3e6mRVRPf06PP+JJlp1RQz45z0uw1CP0ff5q B8Mb485fT9GRpnr+gCH2eKc+UZg/49iYZ7H5rwWimtFLRZJUMUPtJ1g6R/BvHZ9QWqQJ 5objONk8T4aBDb+eSjlcBLRSxwXbu03szdxsR+7iTr2THwiR5COu7SRGhZukTSY7c4pk SkpbGLyN2y93zdVGAvexQy496OzKgrrtJRgbOgvsOKDhgjOGV9BHCAytqp5hxvbXhcYC LiXvWKPDGuNl0Xl/BuMy32DzkVsikjs4RepGCID80+TQTquCd/UeOkuvFVV3u1GQ4Ini XVcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hgcwVUUF; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id c13sor2090577pfn.38.2019.08.19.16.03.37 for (Google Transport Security); Mon, 19 Aug 2019 16:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hgcwVUUF; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/TlFFqIFbnuilFAvaZfscTqwSZVj/Gq+GQdJwcM1CA0=; b=hgcwVUUFRgX2aXe6K9MjaC4D+BanRss2Q2jrB1rrfCaADjTGn5sDv45eNjCcFyKLIe PIvYw89RcFgIn81zquWXrnuIUpzGxzJtQUtvEyNosp9u+9O3t3gIEgbk1aZihbQcZTwh 4fgPQ3madaFPBa+0VTrK2bKZd6MXpkDQ07NcXmikunyUGTBw6GBZ/edjVUT3iRiGrlZR JmRZ4jC8OrPe4WC6cHNXI18P9S66KgwPlv5+OmKp/4tmvLqnY09VpNDvcyxgyn/A7jpB DJcPeA+nnEyZ7p4oGU1SQ4sc80J9YwV8BTIoHgux3TWBzOPHNpdmiqxLEmKO10DQelVM HdDQ== 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; bh=/TlFFqIFbnuilFAvaZfscTqwSZVj/Gq+GQdJwcM1CA0=; b=k7UrcfEuxzVj8M7E6NU9HazBm0P8iHAsKEpMW0MPAccB+Xz4DwG/L8uW8FnkMzOkVy y1pCkIIQTRa8Rc0xQOWkfer5ctK7JY5lk/uL89NyBHPj1MJtJCUzanBHwoeKxq/VfFe8 61Efwq+3aRUkN5Y7HMoEnGCKGv9P6WzGPZQbExmM1CSRLBNv+7h0P4KHGBUynmDCpL1M 6sc1ley+KwsN2zmEVKWvMh4NDjlg8zsyrIxYSRGwxRy3twbXJ/pRiZgyKq/BUQTtGX7y +3Ax8HBAjABvoHuOU4NJNEfoyfAL06kjcrDKUllvyKFXEKCgr8C6/MEZjiP7iTUgeaCY fc0w== X-Gm-Message-State: APjAAAXyxTqBYpx1Gjy/5xzWLm17fb8RGX5TT3G6C1DReJHa7dqjO7xu m0V5ZMRwSKJDsN4LZQmilwiHljbIeeKWAg== X-Google-Smtp-Source: APXvYqyWqYQNrDuG8LREU+B0avmfYSvzuL9p3zVo2uDjdgihR2paZfBlw3v2n8AwccWd68HPPn+P0w== X-Received: by 2002:a62:1a45:: with SMTP id a66mr27430092pfa.142.1566255815916; Mon, 19 Aug 2019 16:03:35 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:35 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 07/25] drm: kirin: Rename ade_crtc to kirin_crtc Date: Mon, 19 Aug 2019 23:03:03 +0000 Message-Id: <20190819230321.56480-8-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct ade_crtc to kirin_crtc. The struct kirin_crtc will later used by both kirin620 and future kirin960 driver, and will be moved to a common kirin_drm_drv.h in a future patch Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 19d279167694..fce374ec69e8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -38,8 +38,8 @@ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 -#define to_ade_crtc(crtc) \ - container_of(crtc, struct ade_crtc, base) +#define to_kirin_crtc(crtc) \ + container_of(crtc, struct kirin_crtc, base) #define to_kirin_plane(plane) \ container_of(plane, struct kirin_plane, base) @@ -56,9 +56,9 @@ struct ade_hw_ctx { int irq; }; -struct ade_crtc { +struct kirin_crtc { struct drm_crtc base; - struct ade_hw_ctx *ctx; + void *hw_ctx; struct work_struct display_reset_wq; bool enable; }; @@ -70,7 +70,7 @@ struct kirin_plane { }; struct ade_data { - struct ade_crtc acrtc; + struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; struct ade_hw_ctx ctx; }; @@ -184,8 +184,8 @@ static bool ade_crtc_mode_fixup(struct drm_crtc *crtc, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; adjusted_mode->clock = clk_round_rate(ctx->ade_pix_clk, mode->clock * 1000) / 1000; @@ -317,8 +317,8 @@ static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx) static int ade_crtc_enable_vblank(struct drm_crtc *crtc) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; void __iomem *base = ctx->base; if (!ctx->power_on) @@ -332,8 +332,8 @@ static int ade_crtc_enable_vblank(struct drm_crtc *crtc) static void ade_crtc_disable_vblank(struct drm_crtc *crtc) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; void __iomem *base = ctx->base; if (!ctx->power_on) { @@ -347,7 +347,7 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) static void drm_underflow_wq(struct work_struct *work) { - struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, display_reset_wq); struct drm_device *drm_dev = (&acrtc->base)->dev; struct drm_atomic_state *state; @@ -358,9 +358,9 @@ static void drm_underflow_wq(struct work_struct *work) static irqreturn_t ade_irq_handler(int irq, void *data) { - struct ade_crtc *acrtc = data; - struct ade_hw_ctx *ctx = acrtc->ctx; - struct drm_crtc *crtc = &acrtc->base; + struct kirin_crtc *kcrtc = data; + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; + struct drm_crtc *crtc = &kcrtc->base; void __iomem *base = ctx->base; u32 status; @@ -377,7 +377,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, MASK(1), 1); DRM_ERROR("LDI underflow!"); - schedule_work(&acrtc->display_reset_wq); + schedule_work(&kcrtc->display_reset_wq); } return IRQ_HANDLED; @@ -499,11 +499,11 @@ static void ade_dump_regs(void __iomem *base) { } static void ade_crtc_atomic_enable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; int ret; - if (acrtc->enable) + if (kcrtc->enable) return; if (!ctx->power_on) { @@ -516,27 +516,27 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, ade_display_enable(ctx); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); - acrtc->enable = true; + kcrtc->enable = true; } static void ade_crtc_atomic_disable(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; - if (!acrtc->enable) + if (!kcrtc->enable) return; drm_crtc_vblank_off(crtc); ade_power_down(ctx); - acrtc->enable = false; + kcrtc->enable = false; } static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; struct drm_display_mode *mode = &crtc->state->mode; struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode; @@ -548,8 +548,8 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) static void ade_crtc_atomic_begin(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; struct drm_display_mode *mode = &crtc->state->mode; struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode; @@ -562,13 +562,13 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); - struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); + struct ade_hw_ctx *ctx = kcrtc->hw_ctx; struct drm_pending_vblank_event *event = crtc->state->event; void __iomem *base = ctx->base; /* only crtc is enabled regs take effect */ - if (acrtc->enable) { + if (kcrtc->enable) { ade_dump_regs(base); /* flush ade registers */ writel(ADE_ENABLE, base + ADE_EN); @@ -1007,7 +1007,7 @@ static int ade_drm_init(struct platform_device *pdev) struct drm_device *dev = platform_get_drvdata(pdev); struct ade_data *ade; struct ade_hw_ctx *ctx; - struct ade_crtc *acrtc; + struct kirin_crtc *kcrtc; struct kirin_plane *kplane; enum drm_plane_type type; int ret; @@ -1021,8 +1021,8 @@ static int ade_drm_init(struct platform_device *pdev) platform_set_drvdata(pdev, ade); ctx = &ade->ctx; - acrtc = &ade->acrtc; - acrtc->ctx = ctx; + kcrtc = &ade->crtc; + kcrtc->hw_ctx = ctx; ret = ade_dts_parse(pdev, ctx); if (ret) @@ -1046,15 +1046,15 @@ static int ade_drm_init(struct platform_device *pdev) } /* crtc init */ - ret = ade_crtc_init(dev, &acrtc->base, &ade->planes[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &kcrtc->base, &ade->planes[PRIMARY_CH].base); if (ret) return ret; /* vblank irq init */ ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, - IRQF_SHARED, dev->driver->name, acrtc); + IRQF_SHARED, dev->driver->name, kcrtc); - INIT_WORK(&acrtc->display_reset_wq, drm_underflow_wq); + INIT_WORK(&kcrtc->display_reset_wq, drm_underflow_wq); if (ret) return ret; From patchwork Mon Aug 19 23:03:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171737 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595852ily; Mon, 19 Aug 2019 16:03:38 -0700 (PDT) X-Received: by 2002:a63:6888:: with SMTP id d130mr21119547pgc.197.1566255817779; Mon, 19 Aug 2019 16:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255817; cv=none; d=google.com; s=arc-20160816; b=G0lNjgh9Dgi0YTe1fJ3AvlIKgTkIJtDmTUeVIxDQwj7s0RBWB6AEAFJ5rhU/P5H1c+ Hj+ZR53JKwWriJ4CEQHFTvvxb+fE4c19lA8YlssSTCt3WzPgscM9aglY/dySZllDQDrH pycQyhfXgszpWdBAeFINJKvj1ekWI91zrVMFYYZ4Ul9Tfom3vEoLj+MtJzmYnM276BIl XRzjmG5BdHSVqmTTldOPjOvPwu8jqsKMcjP5thB+Jp6RdYnNo0Q/q3aSD1duMlbGbymy BnecVaOtQNOiF6Zsj3RZaZ0wkRzsd5lWLHqT0fu5QPBOj0SisQG/63ishHAbRe7lsr61 N+oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JD7m4tZwO+IDa1xgX/FwZAd/NdHORHjMi+i9qNb5uKs=; b=Tt18LemRN1CwAuER4b88DpjcvpYJ9X5z1DjHpF+Xx60tmy3XgcKbc60dkC85M1eSPw A4OBji/lzvcoVt/epnV7cU0uNdfyBlE6Q7+EOuNnaI5JE9BMQqKRg5IRznIvpipcvYeu Op/4tJpH19yaHAe6R3BRdf00NQ6gMT6bpzOt8qgKdThhUVNeDrc2FWDlZy03YBjcB00W j1YQsXKA47yWKg/cWavPZQ9T6ebsbElDJorQXkzBr4c7T576+Bd/Q3ewa3AOrFa1AwAi +LY+bp9cTO7a9bsX47rkm08GUD4MzvgfVU2xhPb16cjvv15S/guBBxnBS3i8out8BLzI 4K8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K8UBp8pF; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y134sor2083487pfc.16.2019.08.19.16.03.37 for (Google Transport Security); Mon, 19 Aug 2019 16:03:37 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K8UBp8pF; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JD7m4tZwO+IDa1xgX/FwZAd/NdHORHjMi+i9qNb5uKs=; b=K8UBp8pFTBCLS2af/ixfreNcrk0g7xTA0YI6qqiBVZtEfdhK+Ayf3sDdZ3ha3RVNzs MOq+rEP5I4yPMf1Jfbi4kDCsCkDVDbxLFnpbEIwdegzvs42kZPhm7l+/f1H4qgWj2TAD rgO7v7U5Z25QFpzo7q8f3cG/2uSP20a/P0mP0V/I55s18uALYAZUXMMG1dSjVNNlPPp+ ULIwvEi9955TpK1QayL6VVQyXfjs9CwOxA6LZsLA1QJ1W9YCQ6Qjo6+nVuiYdOhE629W jMwbc02cMB2VVM99ZOpbwLrTY7ykc6ngFn3+jR/Wo9K3Jew7CKF0Mhnpwil/kkl5eVuo 5L1w== 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; bh=JD7m4tZwO+IDa1xgX/FwZAd/NdHORHjMi+i9qNb5uKs=; b=QAqPxyRt333EGfK352Qr4fzhe2DMSiyUTDcrPGkr097a7TZRzqABcfqK5mNGJB8Zf4 7PCYLz7cw04MolKxeKHxOSPK+UCsQSkN/ZZJq/J+eNWiwhnEksKbn+Af5Agj47O4XRYn Fobuj/MRfl8Xg+kDyXDrslYHMFNncCBNFoXzBjEKkwA6T6W2Sjre4eKM3RFrIu7A5V1n fL/4Oo8Lkq1V9P0HNrGYFEVKfm4/koAoXOG57rhGl16mAE3YJypg2744mIItVWy/DQaW aKYWnruNttC+YCFKAtuLHvLWBrE75KJr5cDOx2sr/brbJWlrJSpwF7Ew0OZm2siZVGjA vOtg== X-Gm-Message-State: APjAAAUoOUUHo+DIhAm7vfjN2pJKC6IoUcIzOkGVyZezlOdw65da+clu 1G9plP3YdOz9xfuajuY49FYe2Ijx X-Google-Smtp-Source: APXvYqyqpP1PwbnaQJr6HO5/U9c9TYoGinZSl4NN8syYf4BdEDDa9pVcGA6gwkSAMsFc948LLVbWTQ== X-Received: by 2002:a62:83c9:: with SMTP id h192mr26119646pfe.57.1566255817313; Mon, 19 Aug 2019 16:03:37 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:36 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 08/25] drm: kirin: Dynamically allocate the hw_ctx Date: Mon, 19 Aug 2019 23:03:04 +0000 Message-Id: <20190819230321.56480-9-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch modifies the initialization function to dynamically allocate the ade_hw_ctx structure previously kept as part of struct ade_data. This is done so that later we can have the hw_ctx point to hardware revision specific ctx structures. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 39 ++++++++++++------- 1 file changed, 24 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index fce374ec69e8..ecb507985fea 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -72,7 +72,7 @@ struct kirin_plane { struct ade_data { struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; - struct ade_hw_ctx ctx; + struct ade_hw_ctx *hw_ctx; }; /* ade-format info: */ @@ -951,55 +951,62 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, return 0; } -static int ade_dts_parse(struct platform_device *pdev, struct ade_hw_ctx *ctx) +static void *ade_hw_ctx_alloc(struct platform_device *pdev) { struct resource *res; struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; + struct ade_hw_ctx *ctx = NULL; + + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) { + DRM_ERROR("failed to alloc ade_hw_ctx\n"); + return ERR_PTR(-ENOMEM); + } res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctx->base = devm_ioremap_resource(dev, res); if (IS_ERR(ctx->base)) { DRM_ERROR("failed to remap ade io base\n"); - return PTR_ERR(ctx->base); + return ERR_PTR(-EIO); } ctx->reset = devm_reset_control_get(dev, NULL); if (IS_ERR(ctx->reset)) - return PTR_ERR(ctx->reset); + return ERR_PTR(-ENODEV); ctx->noc_regmap = syscon_regmap_lookup_by_phandle(np, "hisilicon,noc-syscon"); if (IS_ERR(ctx->noc_regmap)) { DRM_ERROR("failed to get noc regmap\n"); - return PTR_ERR(ctx->noc_regmap); + return ERR_PTR(-ENODEV); } ctx->irq = platform_get_irq(pdev, 0); if (ctx->irq < 0) { DRM_ERROR("failed to get irq\n"); - return -ENODEV; + return ERR_PTR(-ENODEV); } ctx->ade_core_clk = devm_clk_get(dev, "clk_ade_core"); if (IS_ERR(ctx->ade_core_clk)) { DRM_ERROR("failed to parse clk ADE_CORE\n"); - return PTR_ERR(ctx->ade_core_clk); + return ERR_PTR(-ENODEV); } ctx->media_noc_clk = devm_clk_get(dev, "clk_codec_jpeg"); if (IS_ERR(ctx->media_noc_clk)) { DRM_ERROR("failed to parse clk CODEC_JPEG\n"); - return PTR_ERR(ctx->media_noc_clk); + return ERR_PTR(-ENODEV); } ctx->ade_pix_clk = devm_clk_get(dev, "clk_ade_pix"); if (IS_ERR(ctx->ade_pix_clk)) { DRM_ERROR("failed to parse clk ADE_PIX\n"); - return PTR_ERR(ctx->ade_pix_clk); + return ERR_PTR(-ENODEV); } - return 0; + return ctx; } static int ade_drm_init(struct platform_device *pdev) @@ -1020,14 +1027,16 @@ static int ade_drm_init(struct platform_device *pdev) } platform_set_drvdata(pdev, ade); - ctx = &ade->ctx; + ctx = ade_hw_ctx_alloc(pdev); + if (IS_ERR(ctx)) { + DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); + return -EINVAL; + } + ade->hw_ctx = ctx; + kcrtc = &ade->crtc; kcrtc->hw_ctx = ctx; - ret = ade_dts_parse(pdev, ctx); - if (ret) - return ret; - /* * plane init * TODO: Now only support primary plane, overlay planes From patchwork Mon Aug 19 23:03:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171738 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595889ily; Mon, 19 Aug 2019 16:03:39 -0700 (PDT) X-Received: by 2002:a17:902:1a7:: with SMTP id b36mr24425318plb.115.1566255819794; Mon, 19 Aug 2019 16:03:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255819; cv=none; d=google.com; s=arc-20160816; b=Z4jS90ZsD5cP5bU+TY/PmawTdqr1GA3BzGS56dKCJwn3Q/brxo+/wtrFi2PeBEnJz5 fXr6mHHtfKtkBU6ftZNLjaiVDRTy10YQhqa9WCXFxxTEsu5AK8vy67zePp3XtC0N8wql segIHlY8fzAacg4d7udSpVaRMs43fTAEb5RP2liWZ20UHa51p4JRXaKyw7SD03UMrxlw NfRmOEpxSmSnAnfNsHMyK+rYSrcCTWqunJYk7/ZegggI3RGAH5VPl+sWlto5JZnUuMr9 9L/N7DK6Ek5j2XrJhemAvINbRK5WbG+tfM161/IAPK17NHNYaYbpfoxmbp2xImWTcbBN 3YJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8Jq6l1FXpLUKi4y0ukkZjfUNLVxrsbhJoVkVUyhyG+Y=; b=Wq0oubtKlORejWzt5jKQQ1vW0LJjHGsDhm1bBVunxXi67tRfqKKK7cQyvI5/+KFVBb L00CfLEA3VotZ0BO+HvTvI5pBBsFuwshSi2GA+iRttd9fNpsIl5Og0QL+ZZyWAA77C5w oJYAfKWQ4dDbaN+lWEbECPmHbNdTtaKBMdkIDDTNVgSjF1aBHihCCIH4smnWIyB74Zax W0Zda/uIlr4kn6jhgL/3k6H4ngkBpc9hebjvVUbLEJnXpiqDtN8QjP0lh7klAgW7EK7S CSz6oTHe2HzUWL/u11WF4ae91OZslrr8LpJNYxP3fJ5HcYzfYcE55kTpsqzp2tgJ8q8i 2B8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KmcmVW5o; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id l10sor1797116pgp.54.2019.08.19.16.03.39 for (Google Transport Security); Mon, 19 Aug 2019 16:03:39 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KmcmVW5o; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=8Jq6l1FXpLUKi4y0ukkZjfUNLVxrsbhJoVkVUyhyG+Y=; b=KmcmVW5o6nlWHLv5N441j5ii+RJTTMgVMXvLq2wCJoJXBsnG12O8XAireGrEqi1Hq/ lFRMcr9k0p3AOU6lVpGDyqJfbp68NIA4/9RgeypfClUu2WoJUcW2cH8R4BC8tNsv1IXh jPhS+KP/uNOeu5VaEVIyRJiq3mcGqT0PLX5hKUSI3+jHDkkf+vw805WswK7LltHxitRB Xa5Z00HvWzZZW9ruhK5uz6MD695mc1zN7+U0PnEkiJDYBmdjJyQs2GOSSfIphnE6oqK6 dmMFMWXT4BPaOy6bLDV0tPUqTfB8/LSuBO25NVUfEZzmpwSIyFWA+Mhx1ddaDgDE3/1o wrYg== 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; bh=8Jq6l1FXpLUKi4y0ukkZjfUNLVxrsbhJoVkVUyhyG+Y=; b=Xg80Lh+okEZ7uFTzf8KakV/HSeY3UD/niW/QVUNvoFMkrqdT53WxlkqwqiySb7hati SFO+7J85PNcVyKzviAn6F/FQl4O7yyXAQGfU9Ub/QWW32QC4wo4236QgcEY7McbCnCZl H68mEKRcz9cPlqBcGCDiAiT5E0afjtrOVi6n+pNmv0QarxHa2+7TZ45Nfbrn7rAsgN/D eB5NH/R4nUvXMwIp/1os69JbIRAdI16rfqS52YMiHrxdf56uNeyY/6L7TAWo+j7GV9uN UIrxqwvNS2fCM8S2EiDbRgwMgtt6zWXxHjgltyzb9N5o7eyIA5EPeT3UWO6Mqiw0zIPv sIuQ== X-Gm-Message-State: APjAAAU/y0keWOeXhZrRbs1r/qvV2AXgbXe+s2uWAK9jXDo17IFodL4j l8Z9NxqQkNelWsZvCtd9HbSGefhI X-Google-Smtp-Source: APXvYqyssV7Yl36O/h3piEFBGll2PogOEaA6fDHOBNyofENn2V/AyPUh8Qfxll3ZysECErjqMdjx/Q== X-Received: by 2002:a65:50c8:: with SMTP id s8mr21967673pgp.339.1566255818787; Mon, 19 Aug 2019 16:03:38 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:37 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 09/25] drm: kirin: Move request irq handle in ade hw ctx alloc Date: Mon, 19 Aug 2019 23:03:05 +0000 Message-Id: <20190819230321.56480-10-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch modifies the initialization routines so the devm_request_irq() function is called as part of the allocation function. This will be needed in the future when we will have different allocation functions to allocate hardware specific hw_ctx structures, which will setup the vblank irq differently. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index ecb507985fea..8f50115a22d8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -54,6 +54,8 @@ struct ade_hw_ctx { struct reset_control *reset; bool power_on; int irq; + + struct drm_crtc *crtc; }; struct kirin_crtc { @@ -358,9 +360,9 @@ static void drm_underflow_wq(struct work_struct *work) static irqreturn_t ade_irq_handler(int irq, void *data) { - struct kirin_crtc *kcrtc = data; - struct ade_hw_ctx *ctx = kcrtc->hw_ctx; - struct drm_crtc *crtc = &kcrtc->base; + struct ade_hw_ctx *ctx = data; + struct drm_crtc *crtc = ctx->crtc; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); void __iomem *base = ctx->base; u32 status; @@ -951,12 +953,14 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, return 0; } -static void *ade_hw_ctx_alloc(struct platform_device *pdev) +static void *ade_hw_ctx_alloc(struct platform_device *pdev, + struct drm_crtc *crtc) { struct resource *res; struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; struct ade_hw_ctx *ctx = NULL; + int ret; ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { @@ -1006,6 +1010,14 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev) return ERR_PTR(-ENODEV); } + /* vblank irq init */ + ret = devm_request_irq(dev, ctx->irq, ade_irq_handler, + IRQF_SHARED, dev->driver->name, ctx); + if (ret) + return ERR_PTR(-EIO); + + ctx->crtc = crtc; + return ctx; } @@ -1027,7 +1039,7 @@ static int ade_drm_init(struct platform_device *pdev) } platform_set_drvdata(pdev, ade); - ctx = ade_hw_ctx_alloc(pdev); + ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); return -EINVAL; @@ -1059,15 +1071,8 @@ static int ade_drm_init(struct platform_device *pdev) if (ret) return ret; - /* vblank irq init */ - ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, - IRQF_SHARED, dev->driver->name, kcrtc); - INIT_WORK(&kcrtc->display_reset_wq, drm_underflow_wq); - if (ret) - return ret; - return 0; } From patchwork Mon Aug 19 23:03:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171739 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595919ily; Mon, 19 Aug 2019 16:03:41 -0700 (PDT) X-Received: by 2002:a65:6891:: with SMTP id e17mr22557450pgt.305.1566255821370; Mon, 19 Aug 2019 16:03:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255821; cv=none; d=google.com; s=arc-20160816; b=eZM5oflTEi/F6VT8qHXK3UvL8rtH/9kxqqhDBJzQnP3PhC1G3kkIRsF0QTlA29Zor5 ECr4a2RdSm6rEOryCRQdfBh5PqDQbwTZxf1Xp1wTPQ5I4aCxkdQLqFl0fadhIVGcArT0 xpXAjy4q9xDyP2cho5Ost+Y4xp6FfUiTF9Yv+f2Vho+aLoUIfcG9rJv/AtLtmKVxM6Sq dKM3KtH7A7g0kmzbL5POBiUNqrGPFFPA9ZP4KuuCDzgC9/UKJRb3fE+fHs7LGOXD2ZJU glXy0pURjY6U15awgPbTLCJLXy/X/0K1vfKbWfMD+DnKKeUo9/xTssRjJo3AqegM2EqZ hUsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+HPcPs0/zlCUibj+7sx/QSMq53DKHKeHt3X4baMNzZs=; b=B+pwIVmz2q+CRTZx5FVGmPIEnUSkUD9OEUWq4o6ZKy5o+83mbHm0s+/xI3D0UP+any XmqEI48RhPs1N+Nds07OjJsQtw29cLm8CIvm4QYdBgr6Qxku6ceVq58G5q1OMeQrKdXH RCFXnUiJcOnbRjx39dmGsec40CdHJHJppctTU4HEF5nKceBthPWEOZr5+4zkwU+iSIyR qVUeK1hFWlkkVEVf5feOuqTjJhXn9UyQtAE63A8r0FG6gILcG+mHEz1/x4SqIRMyWbAl 4kN5mykUz94jgJKNst32t7pJZjWg+a8UfeUviw3hsc4Mch9SKMmFk4pCMM0Nzfa2+Bn1 LliQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l2V9cPKg; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id bt15sor2450152pjb.26.2019.08.19.16.03.41 for (Google Transport Security); Mon, 19 Aug 2019 16:03:41 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=l2V9cPKg; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+HPcPs0/zlCUibj+7sx/QSMq53DKHKeHt3X4baMNzZs=; b=l2V9cPKgC+xQf+M9Eq7V3R8A3hyhWD12bHUmsJxWIyt0fstaXxqCmLfeGxRgmVOXqy 7B1Apsgv8PJHo4NM/w9wVyo2A83K3EejfwDWpzf/9jW7IpeJTjDRkJKdwAvN4ABQVs/T fVyIrAOR44GEq3ZqXg6hS5HgyrNA1aO74nqpvIdI2IG9dSUUkVeBZtCx9SCoI3eEe25L AYrm9KmrTi6I0zf05rvkRW/Qcdwl8mYmmX0sGPiRfgn10oRr9LFfYeWsQjU6v3kbpzvT xAWummgxsvsYfQWrtNRvuIYBsP92PNtkufKW7vNvuhVChCUj0Bmg+T+zSHkPFrlvsBEz yTLQ== 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; bh=+HPcPs0/zlCUibj+7sx/QSMq53DKHKeHt3X4baMNzZs=; b=YD4LnYXrV7w+NN5nQkT+Sjg6UK1yufPT6udDDJbcmec4rL3Ahly9ihs/cxQRa3gnSM chLCyypJYKMJ2Y07uU5iEocgSzngWS34pFIZUjueHC1AjZ7xSSKEhZg3vSV6tksuxMI2 2ESr3kMjDmgKl9a25c9YeVIOA/e1R6ATQmUlqJEDV7M8zPXp0JInHWj6SLE0hFVLjJCW tAFPonpQBmRbtwxICn3Ems451gwAphs3ejm7lnl0Bx+kchueM78bE4MHDGQZxh1wsa8T snZmFOg2rkMUhU5NhhbTIuWRzObUOCtNR8HO+2bSt0I7LBmT2dLBqrLGVPOnnh91GQWs 2y1g== X-Gm-Message-State: APjAAAWcR0vt3p9mO0nmCpc9TWPuKZ7+MZlMwDtSpEmytOqdwjWxlxUa AQIuN6agx2dD/uu2RQaiqLmr6hCy X-Google-Smtp-Source: APXvYqyw7LbadLphD6JSmUioN4e4iV4Ibw8oT+is92wCfKEWMmhG+Ndg2xlLGksLs39nRlBJXygTng== X-Received: by 2002:a17:90b:8c5:: with SMTP id ds5mr23549322pjb.142.1566255820961; Mon, 19 Aug 2019 16:03:40 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:40 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [PATCH v4 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure Date: Mon, 19 Aug 2019 23:03:06 +0000 Message-Id: <20190819230321.56480-11-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> The workqueue used to reset the display when we hit an LDI underflow error is ADE specific, so since this patch series works to make the kirin_crtc structure more generic, move the workqueue to the ade_hw_ctx structure instead. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 8f50115a22d8..191ee59f68b6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -52,6 +52,7 @@ struct ade_hw_ctx { struct clk *media_noc_clk; struct clk *ade_pix_clk; struct reset_control *reset; + struct work_struct display_reset_wq; bool power_on; int irq; @@ -61,7 +62,6 @@ struct ade_hw_ctx { struct kirin_crtc { struct drm_crtc base; void *hw_ctx; - struct work_struct display_reset_wq; bool enable; }; @@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) static void drm_underflow_wq(struct work_struct *work) { - struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, + struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx, display_reset_wq); - struct drm_device *drm_dev = (&acrtc->base)->dev; + struct drm_device *drm_dev = ctx->crtc->dev; struct drm_atomic_state *state; state = drm_atomic_helper_suspend(drm_dev); @@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data) { struct ade_hw_ctx *ctx = data; struct drm_crtc *crtc = ctx->crtc; - struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); void __iomem *base = ctx->base; u32 status; @@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data) ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, MASK(1), 1); DRM_ERROR("LDI underflow!"); - schedule_work(&kcrtc->display_reset_wq); + schedule_work(&ctx->display_reset_wq); } return IRQ_HANDLED; @@ -1016,6 +1015,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev, if (ret) return ERR_PTR(-EIO); + INIT_WORK(&ctx->display_reset_wq, drm_underflow_wq); ctx->crtc = crtc; return ctx; @@ -1071,8 +1071,6 @@ static int ade_drm_init(struct platform_device *pdev) if (ret) return ret; - INIT_WORK(&kcrtc->display_reset_wq, drm_underflow_wq); - return 0; } From patchwork Mon Aug 19 23:03:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171740 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595944ily; Mon, 19 Aug 2019 16:03:43 -0700 (PDT) X-Received: by 2002:a63:6f81:: with SMTP id k123mr22582964pgc.12.1566255822902; Mon, 19 Aug 2019 16:03:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255822; cv=none; d=google.com; s=arc-20160816; b=Sjin7HCpDT+IArZtDBRU5S5fweDGaQP/e40OC3SWhN2mIJr3m15pKNwd4sZHqecDu6 4jvKWdPwUdNUSyjA1P3suKPpK8+q7vLNauskLJA/0XtGgQhz4nLagTge4Cl1gYANWs+F JVu7ckZ/RAhWj91fzLOSSvhjal6/U6ZFB0LOawLx783JdKDPu1OJJUBLcWjJjLY0j9Wc iudIk85qjzzCH1dre5xAKEUNnTwBe1RvQtndJVo7CxUcBiLKrj61N28zJebORi8lrIKc BUjlUXWVTBqihbMLMlhMMosBIkxmoGJ25SeVZWPu9UNacnflF9Nny7m7spGFR6w6fjQW wGyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vrHDYLfRzW5R44jwvLTf4dm77QaWrtDgYKn2YYHQH74=; b=t2I5gdRi1MTP32XUJ4C213SH1HcKhRQufzEKMWLeKxFmGDkFv2dJ62TSDJvyldwHVA nSHM+KCIb9QPhYO2FC51b0jBe3q+GU0ZDLiXhmUFlSey/tX6kvpxXEf05tnTQiVVc1S2 A2X0xdSgBMsauNL+xogK0tyiycBaJ6JM/UK6z3Lhj+bPlB5g6303eAt157yi2dztqRUe wd1JMmnUcD8DYRHG9SG4HI5MIzRBdNhB5tZg5ZxTZAHQKC7Sf5XAM4vuC7tz4AkX4/IV Ku8o7icbmzV+80FyDFt+XrspbIQfOeKsbw1Bj1z5UrNa7KDCwE8h5U/Iwb/FrmT9tcG8 ouaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hSGKNYO2; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m23sor2486656pjv.21.2019.08.19.16.03.42 for (Google Transport Security); Mon, 19 Aug 2019 16:03:42 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hSGKNYO2; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vrHDYLfRzW5R44jwvLTf4dm77QaWrtDgYKn2YYHQH74=; b=hSGKNYO20P3K6l7pCXNj+pRg4nPwis1eXt5blYJpY4Pd13rBJxlfZTBY5XeZNveOE+ UcI48q7qMofFEOXAAOZoMTBUVL1fA+w7wfU1eqWtUKUJZBNCrcd7Zv3xO7a0fjAeQM8o lWnLzpArAfeKekGoWf6srmyDA6wJ6rA05TyFCfTHQuJIrMrmDyQNkni6WiDiwle2rpgy sulinAi95dgsly+ty24sKVkF/i+cg35Eg3UDSxUZJ/C7DidqUt45YE07fFPYvTAq3WGM B5TS8kZZ/VIHarvElRbNRm2cCB5zoDGm64umt2zRUhhveN+LWBnJbfrbBNYl5vBj3Ccr NbEQ== 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; bh=vrHDYLfRzW5R44jwvLTf4dm77QaWrtDgYKn2YYHQH74=; b=fdVt4AMdT/Gqs5bGC5jt9fWxxmPpUdEPTE7qu8uX3TQzi3u6FcQQndGqIIchBxntGN FFdgtYagzK66QYQUKhrbBOpLVwbE/D/VRBhJ4wDrmbFPW3rksdXX7iVkegbDEvzm21Uc aTZYfY5tzplJZ9s9wEabAxFkJhVL2IG48yGHObLnYEJ/QvZBMb/hNp8k75uMj/SRAlTS ZLTB5GI27DFPGdKFZOBq6SiDS2Q82yl6GEwWq7imX7lcL4ovHkuj0VSavsVsPxJytR98 oH+kZnkgZ7kXrVEVc0Hdr70h3jvueaBs8L5a8AyXdO/Fk04+IvDGSHfNcSjUDXeX2LjM qilg== X-Gm-Message-State: APjAAAWYLGZu4lVNu0kdRUfC9kN1XKaccJSEffnp1m3a2iizSkT6eSHk lbkFtiSQvs9u80HIjtaOBzAEzFG/M9oKlg== X-Google-Smtp-Source: APXvYqxzysdkjNcO7urFjZ0W6hmbyN9GcPsmBs4XhQGHnyTxroGdpknUNGowoOf2aKbvYT+2chRN4Q== X-Received: by 2002:a17:90a:d58c:: with SMTP id v12mr22893267pju.7.1566255822491; Mon, 19 Aug 2019 16:03:42 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:41 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Mon, 19 Aug 2019 23:03:07 +0000 Message-Id: <20190819230321.56480-12-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves some shared structures and helpers to the common kirin_drm_drv.h These structures will later used by both kirin620 and future kirin960 driver Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++----------------- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 +++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 191ee59f68b6..d3088d374f8b 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -38,12 +38,6 @@ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 -#define to_kirin_crtc(crtc) \ - container_of(crtc, struct kirin_crtc, base) - -#define to_kirin_plane(plane) \ - container_of(plane, struct kirin_plane, base) - struct ade_hw_ctx { void __iomem *base; @@ -59,18 +53,6 @@ struct ade_hw_ctx { struct drm_crtc *crtc; }; -struct kirin_crtc { - struct drm_crtc base; - void *hw_ctx; - bool enable; -}; - -struct kirin_plane { - struct drm_plane base; - void *hw_ctx; - u32 ch; -}; - struct ade_data { struct kirin_crtc crtc; struct kirin_plane planes[ADE_CH_NUM]; @@ -78,12 +60,7 @@ struct ade_data { }; /* ade-format info: */ -struct ade_format { - u32 pixel_format; - enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = { /* 16bpp RGB: */ { DRM_FORMAT_RGB565, ADE_RGB_565 }, { DRM_FORMAT_BGR565, ADE_BGR_565 }, @@ -127,7 +104,7 @@ static u32 ade_get_format(u32 pixel_format) for (i = 0; i < ARRAY_SIZE(ade_formats); i++) if (ade_formats[i].pixel_format == pixel_format) - return ade_formats[i].ade_format; + return ade_formats[i].hw_format; /* not found */ DRM_ERROR("Not found pixel format!!fourcc_format= %d\n", diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 22d1291668cd..d47cbb427979 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -9,6 +9,30 @@ #define MAX_CRTC 2 +#define to_kirin_crtc(crtc) \ + container_of(crtc, struct kirin_crtc, base) + +#define to_kirin_plane(plane) \ + container_of(plane, struct kirin_plane, base) + +/* kirin-format translate table */ +struct kirin_format { + u32 pixel_format; + u32 hw_format; +}; + +struct kirin_crtc { + struct drm_crtc base; + void *hw_ctx; + bool enable; +}; + +struct kirin_plane { + struct drm_plane base; + void *hw_ctx; + u32 ch; +}; + /* display controller init/cleanup ops */ struct kirin_dc_ops { int (*init)(struct platform_device *pdev); From patchwork Mon Aug 19 23:03:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171741 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595974ily; Mon, 19 Aug 2019 16:03:44 -0700 (PDT) X-Received: by 2002:aa7:96bd:: with SMTP id g29mr27591392pfk.10.1566255824402; Mon, 19 Aug 2019 16:03:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255824; cv=none; d=google.com; s=arc-20160816; b=Z64VaUIegiXhfa3m8tPiOAP8favXvDDHVUMQdjgIlp3Bqvo/5EEDe2kgj3cOrlhVRj pGonbRih8oBjCs/nVvQ2JSY4obXhImgf/6/DYIoExp/pRYMrRTSqgHURDCY7ovus/iQT 5KzQgjI9Vjs9BjZlXKKVCDQ4qHXhpbVb20wpzGCiBZe80gMXJ4YiwBw/g66YGf8wruuO xr4IPIUJW+MkoR6HWdmYSZPD4MKPvXEoBKy80IWOHqrbcjWMXhHNGrdQxoG64tMavras NFFtqxV0iDgVHUKJPquqml+0RE40HqidY9woCgLCYTg/eo2BWQFX67xgcammrxhys/K3 W+yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=OZ+SrFkbIczithscsJHG1FWCWpuh75dF4XhR676L94A=; b=aq8NsTjNcsAk0OjeVNYOMQuVnCynojJSz3QdwIlcdiXgHfTL41ZJau7UZopFwqEFp2 N1Y+jL+XWgsa90i89jH275pmIy6yGACR+n1vIxpgZp0EvqFSVBjE8y8sEisJcgD3Xcd2 MulsgLuJTrpHpPjlEcS5zhy4tZbMTqifGFpA2TBeaHgyJvDw/GTblLRj/xPa0IIyHJuu AY+Ekb5D09B42gIvhkR413lRzNnotYqA0gSx0GnHpZMixr9lDpByPBWcT7+/SqUOt888 JLj/ljuFpDSSXBlGEqbW/jfsQRJuXR2ylme2ejxK/6REoWT7Qhm8O2QWozA7KsR9rCuZ +1Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mjobgqYQ; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id e124sor2044633pfa.50.2019.08.19.16.03.44 for (Google Transport Security); Mon, 19 Aug 2019 16:03:44 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mjobgqYQ; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OZ+SrFkbIczithscsJHG1FWCWpuh75dF4XhR676L94A=; b=mjobgqYQxYKyt0g7Fn2i+HuvXGBmy4AGRO8d7Lu3ApfY/9UOIR4i8FXL4AMyKz11ZT KlHYrk+3M6lRB26WOYHdkTAWOFO8L5GKlREj44pqANrdBEmIvDYTgEMwUwyXi/Vybpb3 KaR+KrhyaZa5/VyryYAlAS28YfpB/eW2GyMyyas0VVNRGaxC2//WckLHr0aNYwgluyE5 +7FjOjDh676cVeKl7tOnEAqeV2VFgtjcEgbruW29jWfuG+3tq4dVg3Zh1AZAJzCh/q8b IBfWBZMBea5u+UTq62wIq2XHnNuc3oseTUgP0FsJIZ2FFbFRGyEh8w2BpmenJ0d302G9 Aktg== 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; bh=OZ+SrFkbIczithscsJHG1FWCWpuh75dF4XhR676L94A=; b=eN0rpxp+wIyPOYmoBBKmR8x61WsFYD4oIUGnCKjz1xUeD89HId6DvcV+Y8+p6RDvev Tv7XR+xINyf+pLLLMgca5JGZ3XU0AXPKRHiRULw9eRdD+0jw+ich13kCcgpMk1Bbrxhk gWReEPrQxUwzLVYzfv8MIg8LAo5MbtjIWMH5li9jfsfy1i9D82j7wDMpN3711mB0Mfof kJ5TfNbL/2D0H2s1qLXdHxQ5CVI+VbLfht3yPfbSPecoLBO1Yw7/RfZT8wdf1S1HYBpZ INGPLDo9Aiuo2YlgA583sk8bjw37WzaQR3X+pa+ZAq35EZncULbDcjXaZb+HXtLSjx15 hf5w== X-Gm-Message-State: APjAAAVM/GRyGw1FKRw+/vseA8S3PruvlMMNK7XDlvCqRQKaDyMG3IDd KUNnAUWizn/3y5qQ+91Ki13CG/nX X-Google-Smtp-Source: APXvYqwOSNCDkrQVdRJH+eZGt+dB6nlpK3ZY8rde9Pp1Qt5pUgXfn7JPXbYf/ACC4arQgoukgOo6Fw== X-Received: by 2002:aa7:9907:: with SMTP id z7mr25847365pff.13.1566255824022; Mon, 19 Aug 2019 16:03:44 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:43 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 12/25] drm: kirin: Reanme dc_ops to kirin_drm_data Date: Mon, 19 Aug 2019 23:03:08 +0000 Message-Id: <20190819230321.56480-13-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct kirin_dc_ops to struct kirin_drm_data and cleans up the related variable names. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index d3088d374f8b..6ff8417943c6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1055,7 +1055,7 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } -const struct kirin_dc_ops ade_dc_ops = { +struct kirin_drm_data ade_driver_data = { .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index fcdd6b1e167d..3d22f944a840 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -29,12 +29,12 @@ #include "kirin_drm_drv.h" -static struct kirin_dc_ops *dc_ops; +static struct kirin_drm_data *driver_data; static int kirin_drm_kms_cleanup(struct drm_device *dev) { drm_kms_helper_poll_fini(dev); - dc_ops->cleanup(to_platform_device(dev->dev)); + driver_data->cleanup(to_platform_device(dev->dev)); drm_mode_config_cleanup(dev); return 0; @@ -68,7 +68,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) kirin_drm_mode_config_init(dev); /* display controller init */ - ret = dc_ops->init(to_platform_device(dev->dev)); + ret = driver_data->init(to_platform_device(dev->dev)); if (ret) goto err_mode_config_cleanup; @@ -99,7 +99,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) err_unbind_all: component_unbind_all(dev->dev, dev); err_dc_cleanup: - dc_ops->cleanup(to_platform_device(dev->dev)); + driver_data->cleanup(to_platform_device(dev->dev)); err_mode_config_cleanup: drm_mode_config_cleanup(dev); @@ -194,8 +194,8 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) struct component_match *match = NULL; struct device_node *remote; - dc_ops = (struct kirin_dc_ops *)of_device_get_match_data(dev); - if (!dc_ops) { + driver_data = (struct kirin_drm_data *)of_device_get_match_data(dev); + if (!driver_data) { DRM_ERROR("failed to get dt id data\n"); return -EINVAL; } @@ -213,13 +213,13 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) static int kirin_drm_platform_remove(struct platform_device *pdev) { component_master_del(&pdev->dev, &kirin_drm_ops); - dc_ops = NULL; + driver_data = NULL; return 0; } static const struct of_device_id kirin_drm_dt_ids[] = { { .compatible = "hisilicon,hi6220-ade", - .data = &ade_dc_ops, + .data = &ade_driver_data, }, { /* end node */ }, }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index d47cbb427979..cd2eaa653db7 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -34,11 +34,11 @@ struct kirin_plane { }; /* display controller init/cleanup ops */ -struct kirin_dc_ops { +struct kirin_drm_data { int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); }; -extern const struct kirin_dc_ops ade_dc_ops; +extern struct kirin_drm_data ade_driver_data; #endif /* __KIRIN_DRM_DRV_H__ */ From patchwork Mon Aug 19 23:03:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171742 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3595993ily; Mon, 19 Aug 2019 16:03:45 -0700 (PDT) X-Received: by 2002:a17:902:b08a:: with SMTP id p10mr25436410plr.83.1566255825647; Mon, 19 Aug 2019 16:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255825; cv=none; d=google.com; s=arc-20160816; b=alJHwR/XkxuVg/X+OsFXBCD4YwdxTggX8aXNEOj4SnXTJUmTfbsmoPt08c0f/XXeEw 01b11BA8FgYqLxMYJ7x4Q98ztwvIP0Qh2MMYR5RQy70F8GjItWEVi7kDQelrpEV6J6+q DLvZZchY3n3fVg5sWV8ZsVPAUdUy41HILBxj6mNCejUv4kRitP08l2WVegsnIWWuuywh yvQU9ABazvrnnLhvJkIcT29TU4v9bZ4WBObUzpvRl3LxlpNPiVqGlYFf+M9ZYd46iTET 4FXciFsqU6d4+Pv869zT+ret6tLb/KWfFmlvI1dO3f8Psaw0gA0JbcFoZkhlvVS/oyi8 5tIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Yj68sd1eYwpU86YtcH+RSFue4gqH76sT4KzX/dwyzO0=; b=IehZGSqx0ZqTV6vEzMX+Qa2OgnVAt9JcE7gwXPbMYrzrWDs5vPxz2cdl0kifHnm6uY GVFWT+9zb0Vbp8TrZ485Y21zO/Y3pTyUj3l/8XRYjbrfFLXALYejNZeqxH4xuDF7SiKT dz6AZhOVo+axpyqTtD/iuz6oyTryt1VRzbWviQidusrnUELw3Rj3c9vBCaOqAo+AnvZu mULSvO7VIns7cWTSZSYHqHL2BUkEKEgqSJf1FW2ic2azkFRuViQZf5yW0R32H3CZRIxl pvxtkibFdBmlRgDwXB5MZU2xYLYQxQqpDWoi2HYI2MIUHsImWLw1KUkX2sEkVfmSuCqU 0NnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWgmzgcM; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id ev15sor2532525pjb.14.2019.08.19.16.03.45 for (Google Transport Security); Mon, 19 Aug 2019 16:03:45 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWgmzgcM; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Yj68sd1eYwpU86YtcH+RSFue4gqH76sT4KzX/dwyzO0=; b=jWgmzgcM1i7NReZc5KCeo0QEYjt8aYxq4KuQ74NTGAlYRmuvYfF7LwkyS5FD/jBTQL OBgO+K8F+J8LV9REp0D4o5Dh2cXYJBL3QTEqYRBJhz9zzNVYyPWphz9l7xFYhvT18dCp pBdzcDxexJ5jPL7Sw+k7kAjQM5xfAmqkErQSv0ygKh65NYRuOzXyPfWdSe6AuOYpUfz9 pHgeDuP1V37a/81wG04A08EQTPGY/Zr/ALCQMAjVRPbO2hhQLyLaUHHYVc44DYHRQgV5 uTWevnSu3xP51+arFXtBI46wMZYGo6hrgcliqsp5gXAlb+PgO0vOsvxT37bYV/5eKlsx ditA== 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; bh=Yj68sd1eYwpU86YtcH+RSFue4gqH76sT4KzX/dwyzO0=; b=YOVZNf3gCG3Xjuo/v1GhBVJ7nE8s95DZ2mpXR9yftjX9egUkUAViBC8116xkeVEzg0 FOY3/5H0kcyZqIB4GNT7zXjW1g2l6VTxCW5GJ/2qme81keFE9E8rjUxTD7bDgBWQSXFk jrD/HmgEdnGwDRvJKfNcQ9OFtYgT1GmBTLnroM5PoYmjWQ3nEe2NaBRVLJkLj815f2vY Pblpcd3KHibp6cd/84tLA1mQi6L/f1EXKaip+/IAFAO2q5a6LMIqhSW1Sn7WvPSBqdoH Oj+IFE2rsYAC3GQzF1N2IXZXp3mIf+l0sytm7FR8lpP7wkU+ROZn8DCwnEjW+oiKEs1X 2IQA== X-Gm-Message-State: APjAAAUf2c//djqQusH9/4a5/aT1XSkWDAMbnUHk4zHid4lkCimrF11b UvVh/RraO1lAzTx5HzzTdmNNf7Vq X-Google-Smtp-Source: APXvYqyyG2JQKgW7zVTrCOsLct0kVEH3lEoOnZMn335h3DFOFhgEOXxgTuPRyfeU5wuq83dSWU5c6Q== X-Received: by 2002:a17:90a:c68c:: with SMTP id n12mr23289345pjt.33.1566255825237; Mon, 19 Aug 2019 16:03:45 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:44 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 13/25] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Mon, 19 Aug 2019 23:03:09 +0000 Message-Id: <20190819230321.56480-14-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the crtc and plane funcs/helper_funcs to the struct kirin_drm_data. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 15 ++++++++++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 6ff8417943c6..016a6057c5f6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -602,13 +602,13 @@ static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - &ade_crtc_funcs, NULL); + ade_driver_data.crtc_funcs, NULL); if (ret) { DRM_ERROR("failed to init crtc.\n"); return ret; } - drm_crtc_helper_add(crtc, &ade_crtc_helper_funcs); + drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs); return 0; } @@ -917,14 +917,15 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, if (ret) return ret; - ret = drm_universal_plane_init(dev, &kplane->base, 1, &ade_plane_funcs, - fmts, fmts_cnt, NULL, type, NULL); + ret = drm_universal_plane_init(dev, &kplane->base, 1, + ade_driver_data.plane_funcs, fmts, + fmts_cnt, NULL, type, NULL); if (ret) { DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; } - drm_plane_helper_add(&kplane->base, &ade_plane_helper_funcs); + drm_plane_helper_add(&kplane->base, ade_driver_data.plane_helper_funcs); return 0; } @@ -1056,6 +1057,10 @@ static void ade_drm_cleanup(struct platform_device *pdev) } struct kirin_drm_data ade_driver_data = { + .crtc_helper_funcs = &ade_crtc_helper_funcs, + .crtc_funcs = &ade_crtc_funcs, + .plane_helper_funcs = &ade_plane_helper_funcs, + .plane_funcs = &ade_plane_funcs, .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index cd2eaa653db7..70b04e65789c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -35,6 +35,11 @@ struct kirin_plane { /* display controller init/cleanup ops */ struct kirin_drm_data { + const struct drm_crtc_helper_funcs *crtc_helper_funcs; + const struct drm_crtc_funcs *crtc_funcs; + const struct drm_plane_helper_funcs *plane_helper_funcs; + const struct drm_plane_funcs *plane_funcs; + int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); }; From patchwork Mon Aug 19 23:03:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171746 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596179ily; Mon, 19 Aug 2019 16:03:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzTaTZyhjJ6SHi8V2cdMjDTQSStTR2Od6l7uftnwf3kGTWQFswvInEpUlw7f0uydvcpuqEm X-Received: by 2002:a63:1918:: with SMTP id z24mr21145464pgl.94.1566255834752; Mon, 19 Aug 2019 16:03:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255834; cv=none; d=google.com; s=arc-20160816; b=fHvDDrYicwdqyfkYsutfcaG/mN5dIwsOd2D67pQjtTvQVWaDiIMg3SbnxyqvBxEtbk vmE7tH2i/eT935/v4BZX8hARoFiR1FHnpkAAd3nF1Cd7oetUMuZfCvwx8hDScLGI1Urd U9FFOaH2yT0nKPPdubit0y5KAuUJ2uwhVV3HO7Kh1CWL/G8WKiJsaiwvaYfGwKIFq720 FXktmmLKFR6VR82UhRJDyHv9NhbpJHWf+3yZ6zFZ4U5ncRMOBYFKSqomjO9umo+DS6hF 563e/9h4CQJTEN9XA3qV5JFRqF6He1qdW1Q4/50Tq5UbrYxHI7mTZgANcOV4oJPsNUxQ 8gTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=HLpBk6XUcRfuXdq52l7Aj6EvNRXsKiox2i7zRtdxggg=; b=ACEhPRWDAK8mkyDN9grSOq1/X1Wb8jFeVgIUwS1UxuB0ZMOh6u+oTO0/qdxf9eigRa Eg6PE2rX8bFuzNlMW0zmZz6sG1rdCdwO0S7tjPimeZsbMTVaXxWIsHimcXuGZtXrqYlB DuWT0BBq3gYg73faDUVuYDgIDzyRAmVf3hyZNoTLwuUmPqebvshHNWtmMGdp6K59t2tL f5aZRSTMMAnjQpwKQf9vWzNHbGdIe709qT9aZo8F1/2qhABWanFQ4pAaMjQ228hpZc6d 8zdhUIALvoXi5ldKFd3Wg9h8p8NcEusaglkp3JR2e8zYXdA6cDmJmhZxBq9W43uyfiyR q8fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VdEltd1n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si11397240pfd.165.2019.08.19.16.03.54; Mon, 19 Aug 2019 16:03:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VdEltd1n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728900AbfHSXDx (ORCPT + 28 others); Mon, 19 Aug 2019 19:03:53 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:45730 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728838AbfHSXDs (ORCPT ); Mon, 19 Aug 2019 19:03:48 -0400 Received: by mail-pg1-f194.google.com with SMTP id o13so2026756pgp.12 for ; Mon, 19 Aug 2019 16:03:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=HLpBk6XUcRfuXdq52l7Aj6EvNRXsKiox2i7zRtdxggg=; b=VdEltd1nXZPR7DXTC3NOclmsoKQLEe6kXHPtTLjmLu2N/X61XZZY3vOgkdjnrBqUic 42+OUZZiChiJOxT0JN7pP7poX8DIkNMqbvOGrjMJN3zHQ2DBvicSZFdSQlnL2y9sNMyU WbizA8J8R1WTSjv4sLnqZRpRhunA7IidducUX67xTDkOJaQk9qRH0kJ1O08n4TZG5w/6 TXoc1VWk2NcoWGv0YroeT9MA0hepLh37DUMSAAR2KiS4JUs8ZNaCafwRhX0eqARtemwu 2ZRG2GjpflYIl2qLSzgbyiVeHn+WXP9ggrZmQSuz82p24q1htNqVqnoRJBOc5H6eChrk 8i5g== 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; bh=HLpBk6XUcRfuXdq52l7Aj6EvNRXsKiox2i7zRtdxggg=; b=ngrc0oOiyLMXEA7HH6pRX439ScNj9q3jk/lpruSrXGD9Bq//9p16F4TSqfOMO8ck/S 94EpLTqFee0jo/RcZh1LxNPRMjpTlkDyftUKQdmZQOzc8wBtfz+lUiAzO9lcOMCY/sJo glCoR9d2KVXAjQjd7aqXB2M2axl0PAYRsC1CDojscy+4kYYVV7iQskNnHR6YeEyYiqOQ UOjaogsDcPzY++e2j65UwgOPTQPASSHujB1mPzjg7V1cPQOI0NoMcczk5H1W6SdTPf/a P5rTBhZuyzn2oyZ6BK0KWW07YIJO1XquLg8PisgqRXGuLOlv9QB9TiTTBcwadKemO7C6 TMcA== X-Gm-Message-State: APjAAAW5XT6dQN9QUIFmSJfoDYFuH2+sujUcnafL9xthIL4uveHq4Ie3 DkqZhQ2Lzy8iN9EP0/T8hNpHsOQ0Vd8= X-Received: by 2002:a17:90a:bb01:: with SMTP id u1mr22678933pjr.92.1566255826646; Mon, 19 Aug 2019 16:03:46 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:45 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 14/25] drm: kirin: Move channel formats to driver data Date: Mon, 19 Aug 2019 23:03:10 +0000 Message-Id: <20190819230321.56480-15-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the channel format arrays into the kirin_drm_data structure. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 30 +++++-------------- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 3 ++ 2 files changed, 10 insertions(+), 23 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 016a6057c5f6..cf542430a659 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -76,7 +76,7 @@ static const struct kirin_format ade_formats[] = { { DRM_FORMAT_ABGR8888, ADE_ABGR_8888 }, }; -static const u32 channel_formats1[] = { +static const u32 channel_formats[] = { /* channel 1,2,3,4 */ DRM_FORMAT_RGB565, DRM_FORMAT_BGR565, DRM_FORMAT_RGB888, DRM_FORMAT_BGR888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888, @@ -84,19 +84,6 @@ static const u32 channel_formats1[] = { DRM_FORMAT_ABGR8888 }; -u32 ade_get_channel_formats(u8 ch, const u32 **formats) -{ - switch (ch) { - case ADE_CH1: - *formats = channel_formats1; - return ARRAY_SIZE(channel_formats1); - default: - DRM_ERROR("no this channel %d\n", ch); - *formats = NULL; - return 0; - } -} - /* convert from fourcc format to ade format */ static u32 ade_get_format(u32 pixel_format) { @@ -908,18 +895,13 @@ static struct drm_plane_funcs ade_plane_funcs = { static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, enum drm_plane_type type) { - const u32 *fmts; - u32 fmts_cnt; int ret = 0; - /* get properties */ - fmts_cnt = ade_get_channel_formats(kplane->ch, &fmts); - if (ret) - return ret; - ret = drm_universal_plane_init(dev, &kplane->base, 1, - ade_driver_data.plane_funcs, fmts, - fmts_cnt, NULL, type, NULL); + ade_driver_data.plane_funcs, + ade_driver_data.channel_formats, + ade_driver_data.channel_formats_cnt, + NULL, type, NULL); if (ret) { DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; @@ -1057,6 +1039,8 @@ static void ade_drm_cleanup(struct platform_device *pdev) } struct kirin_drm_data ade_driver_data = { + .channel_formats = channel_formats, + .channel_formats_cnt = ARRAY_SIZE(channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 70b04e65789c..66916502a9e6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -35,6 +35,9 @@ struct kirin_plane { /* display controller init/cleanup ops */ struct kirin_drm_data { + const u32 *channel_formats; + u32 channel_formats_cnt; + const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_funcs *crtc_funcs; const struct drm_plane_helper_funcs *plane_helper_funcs; From patchwork Mon Aug 19 23:03:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171743 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596059ily; Mon, 19 Aug 2019 16:03:48 -0700 (PDT) X-Received: by 2002:a17:90a:bf91:: with SMTP id d17mr16211969pjs.111.1566255828518; Mon, 19 Aug 2019 16:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255828; cv=none; d=google.com; s=arc-20160816; b=MqaPIZkyZFU05ukDA+RiGUnhjth3noQlHYnT8d7e/bGea9uVZixNloiwpTzNKUripq WX9D73uPBaGSk5wBHmth4Qa8hZ9lAEf5UBgZr6keL6nnJ+BRI46Bmx6kFRBaqaogBlG9 fOtMRnTxoiF97ijHBp8WgkHuEnk/YzoDtB9p/wVJGoG9TI2bN8JFxGpFpdQ1igBL+LKL BVXZy33N0V9OeNfqh4luR4UEDhDvwPb6G84SaR2T+Vb9Msbb6usNwtBznQX+TehxJudc HR52rJOArZsUK5wTEbHdTPdGbX7BCQFMGn9+MhI9ukFUggkAw8L4CoAbmgxpR467l6DB 4P9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2NFlgdlfXYiRYG1vxux+gKs5v2QugFjbBoZ8Pynyolg=; b=K2z6QlmvvdzMGVWISK3Ahok9SCHH5796/9vep3JxftRt9GMHCSNUxbojBzRSsJoSNg tlLEnl0I11zhyBFvOJMt3sN0U5NIdsAo3UBBgVM5kYyI1HJG3WOxi4DlZefrFPvjH6D9 fC4r2rnA4rd9GvzR5ZAd4KI1MLS4EvgOcrzUYo3QS88nNw8LZ35o9sQKSrMv3x5EJ1H3 dbNVil975TSbRqIDzbxTK7Q8qQp8mRfzvovpaerQ8/16rZ3RjFxTmG7f/aN3cpcZA3UD o4nNfSidxdXW2NhH6PjVKWE3e0TE9TbzCHp5hRFtkybayDIXoEs856C1iK1s1tQ+Uaw7 6Sqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mIK1wiCG; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id ca12sor2539568pjb.6.2019.08.19.16.03.48 for (Google Transport Security); Mon, 19 Aug 2019 16:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mIK1wiCG; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2NFlgdlfXYiRYG1vxux+gKs5v2QugFjbBoZ8Pynyolg=; b=mIK1wiCGCfCbW9eeYKsjGhEfiwX87TUJabWOr/z7riNobTnag2/wiOzDocjjPydHwk MHz7laeYwFopBqLOhN+pbIqU4csA2GjPSK+tnZ4KyZoz59wWajqDy9W5AkNjXNuIVQuX bjxvFHTVH7cEdxB+a7/i5rxeGf3k6Nxy8P9s3JmIxF/mBOzjXNiwFyTiSowA1cPRXJqC ULqerCtuQtvQjug5pS5mdfYhX0M/m4u7m3z8eZaZVYlrsaCQz53DrklKlBKInbP40o0l 3hAIviRyvG7f+95YRh5I6MEUEkjll7Bh0iKStDESsJABXxXjjFkQA1mn24z7wQYbM2wb 5UTQ== 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; bh=2NFlgdlfXYiRYG1vxux+gKs5v2QugFjbBoZ8Pynyolg=; b=ZJWCDp6DdL20GotdEdNaco/iE/4hetf4p/Gk0QnTul2y7sv54kJSfDpxz2gejih/8+ xYGsNc6OaJoCyua9PAjuBXbMNwGBAkWefvunLe1YNIA7q09GjNQU8yzgTpn1WJ4cO+i1 Y7xnhLyE4SmyRVRMNUG5HL75LDl9rzKnXSpmDdZ9VZz9j6j7bNeQuuFZeqcozrEG5ho5 iWaztdnOyCKPwEewMzmKafJpdxHgMXF+bwGQku76mW1OpefgNkaRTmS5jo+vrtAJQEZJ y1b1KV2HTLHOrIgUiicUk6RfYvhu+IIFW1q0JmoqQfI4W0n3YKyvmLotxQH6WEcVrSdy O4Eg== X-Gm-Message-State: APjAAAWRLFgLHFTyuM94XCbwDG0t2l1MbqxDIAnGiwlD68WMSf6hsD7N GagJveoqHdiq4FipiYh41eytRU8V X-Google-Smtp-Source: APXvYqxGlTATZutwqllpn0Cdq6dR8Gqs5Xkn+OaYXid2MpAdEyXcQQ11zpaOyj6EORGBwrrjFzG+hA== X-Received: by 2002:a17:90a:650c:: with SMTP id i12mr23034754pjj.11.1566255828114; Mon, 19 Aug 2019 16:03:48 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:47 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 15/25] drm: kirin: Move mode config function to driver_data Date: Mon, 19 Aug 2019 23:03:11 +0000 Message-Id: <20190819230321.56480-16-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the mode config initialization values into the kirin_drm_data structure. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index cf542430a659..4001f060e580 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "kirin_drm_drv.h" #include "kirin_ade_reg.h" @@ -1038,6 +1039,13 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } +static const struct drm_mode_config_funcs ade_mode_config_funcs = { + .fb_create = drm_gem_fb_create, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, + +}; + struct kirin_drm_data ade_driver_data = { .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), @@ -1045,6 +1053,8 @@ struct kirin_drm_data ade_driver_data = { .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, .plane_funcs = &ade_plane_funcs, + .mode_config_funcs = &ade_mode_config_funcs, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 3d22f944a840..25191824b64e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -40,12 +40,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { - .fb_create = drm_gem_fb_create, - .atomic_check = drm_atomic_helper_check, - .atomic_commit = drm_atomic_helper_commit, -}; - static void kirin_drm_mode_config_init(struct drm_device *dev) { dev->mode_config.min_width = 0; @@ -54,7 +48,7 @@ static void kirin_drm_mode_config_init(struct drm_device *dev) dev->mode_config.max_width = 2048; dev->mode_config.max_height = 2048; - dev->mode_config.funcs = &kirin_drm_mode_config_funcs; + dev->mode_config.funcs = driver_data->mode_config_funcs; } static int kirin_drm_kms_init(struct drm_device *dev) diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 66916502a9e6..ce9ddccc67a8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -42,7 +42,7 @@ struct kirin_drm_data { const struct drm_crtc_funcs *crtc_funcs; const struct drm_plane_helper_funcs *plane_helper_funcs; const struct drm_plane_funcs *plane_funcs; - + const struct drm_mode_config_funcs *mode_config_funcs; int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); }; From patchwork Mon Aug 19 23:03:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171744 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596091ily; Mon, 19 Aug 2019 16:03:50 -0700 (PDT) X-Received: by 2002:a17:902:aa08:: with SMTP id be8mr25457606plb.144.1566255830025; Mon, 19 Aug 2019 16:03:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255830; cv=none; d=google.com; s=arc-20160816; b=BHsLibPI//BfY0uhSUGLXwL/Hka2xW4bw9y4xinjd0Z1z3g3HSqFbLfn9o8WJRyhE3 GDID+HZvaSU9UAde4aDKWBvcO0FT7/Ekw5M7Y4fS3YTEHnb91u64Yg389EokI3jH73rm qy6h4Q8XuB87yOtd0hnMukzI2Cv7d7haWOKyppOhKzDmfrrJlOUkgOw+3xS9Hqy/uOYv z5cNw6CkK5syXYc5WytDEPTA7MV9JrYpF5eUxVPyx7WsQfQ6QTRgxN1oh9vZfxvYCDt2 945LBA38MvzW9E/m5kdS4CBiKpf8cgeStXcF1oZNIqW71BpSATKeuIBuaAgIaS4HYZNE f0Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BGaZCHgDYd2hveQf3FIs87y4ItjrwpXVDJprgquPOWQ=; b=ZZ8y7sZMblC0b/EVwqONv7cQnpNPNoszK+fVMrggftcd1GietRmAeFdvAOpqPbszQ/ 0CHHYR1XHzqWTF2wJiGgwIvEIi+Ul/SyYFa4btfKWdxcnx1OVaoqsgBur+nX82ez+L6E f7XE6CXu4vtUKg/0zpKiVMgg3ywMS1ueRwcc8e47AM9j1fg7wqFXJNapFfCnOWkgKC+H MVGX3sQwYA/035YWmEs5+u5/8l6fdAh5p6U5+qQHLP+zo5S2HCh3G8/+q4jbdtg1Zj8I icudvNA5RoOUqdSSvhYbbAlN/HVIGTcH699h/n42clyNey8gUbIP7VJ7pLcRnUqvkIdj iHJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PBubEr9V; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id h7sor2561676plr.26.2019.08.19.16.03.49 for (Google Transport Security); Mon, 19 Aug 2019 16:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PBubEr9V; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BGaZCHgDYd2hveQf3FIs87y4ItjrwpXVDJprgquPOWQ=; b=PBubEr9VLwe1O9i3u/1JpUbVWWVRe1sxgiti5t0bnIge4DbaYL+kNfFfr3IABo14vj Ncm9oya3aCG/2Y3Ey3oeC9b/qL8vZmHf8ia/uSGf57tOM6njQfvPd6r9duKDKQ3D3pqH rWidoMoYtbrsmy0PsZWEPMlTynETHD2DplN8jFwztf/vFyYlPEYFe3t9SuTcTCW0G1ic 094wbNixvL8via6KTKj5jJFwHa9ktPlmrWCXOT2RwqThxjXSgVg2M8WxXD1vFvACKL4W OiqlUl0/TaN8fRgAGqXjKANQz5oaahR15ABy6uRTbkvplNTXlOuT3Qbv9L7iyzjaSIDr T6Pw== 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; bh=BGaZCHgDYd2hveQf3FIs87y4ItjrwpXVDJprgquPOWQ=; b=Ao3UE5wNkMSeL5kr0w9dYflxCR8xY2Rj5X8RBivUMKpAACaFi5KifhTSifcsY6Q48p FxKhYr1VslWX8ylCDDEbb7OlQlMQlvRqoku//kK50KEYB1f44DoZS2xAG7IjKkucYxID BNO2ANZeAvTmyzGTW9mikpJEtvEtdX1w/N+xRbFIlXvlkcAkg8hO5PGLDay/Mkc8nxTH hkX7GAFyiRRzbNuf6adIsK+mYpBHt2dIpNf5h7sYtoeWyC3F98gQH5lIDE+Kxw+AwPKw oKUt8VnfZnb4ieEkvn33d8XDzph8ngZUNfZUsMIIJ415hNwkHxaGfBk/gEea8c6JTPfW 1xCw== X-Gm-Message-State: APjAAAWaGCflUnQRbAQcyuUYqQe5Dl76M4SKLt9yIKdcuMmsxedICl2T hgZBOj9j4/HPDfy5xCGf/VUm3QgpJbsE7w== X-Google-Smtp-Source: APXvYqz71dgcZoZ4RdSSvpDEAXlxbSAJ9jAS4G7wNm+chbPz8rUdCZt5PGcwWvgDU8KRYoVLnakEBQ== X-Received: by 2002:a17:902:24c:: with SMTP id 70mr16581568plc.331.1566255829603; Mon, 19 Aug 2019 16:03:49 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:48 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 16/25] drm: kirin: Move plane number and primay plane in driver data Date: Mon, 19 Aug 2019 23:03:12 +0000 Message-Id: <20190819230321.56480-17-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the number of planes and the primary plane value to the kirin_drm_data structure This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 21 ++++++++++++------- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 4001f060e580..8b1f3580cbd6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -35,7 +35,6 @@ #include "kirin_drm_drv.h" #include "kirin_ade_reg.h" -#define PRIMARY_CH ADE_CH1 /* primary plane */ #define OUT_OVLY ADE_OVLY2 /* output overlay compositor */ #define ADE_DEBUG 1 @@ -991,7 +990,7 @@ static int ade_drm_init(struct platform_device *pdev) struct kirin_plane *kplane; enum drm_plane_type type; int ret; - int i; + u32 ch; ade = devm_kzalloc(dev->dev, sizeof(*ade), GFP_KERNEL); if (!ade) { @@ -1015,12 +1014,15 @@ static int ade_drm_init(struct platform_device *pdev) * TODO: Now only support primary plane, overlay planes * need to do. */ - for (i = 0; i < ADE_CH_NUM; i++) { - kplane = &ade->planes[i]; - kplane->ch = i; + for (ch = 0; ch < ade_driver_data.num_planes; ch++) { + kplane = &ade->planes[ch]; + kplane->ch = ch; kplane->hw_ctx = ctx; - type = i == PRIMARY_CH ? DRM_PLANE_TYPE_PRIMARY : - DRM_PLANE_TYPE_OVERLAY; + + if (ch == ade_driver_data.prim_plane) + type = DRM_PLANE_TYPE_PRIMARY; + else + type = DRM_PLANE_TYPE_OVERLAY; ret = ade_plane_init(dev, kplane, type); if (ret) @@ -1028,7 +1030,8 @@ static int ade_drm_init(struct platform_device *pdev) } /* crtc init */ - ret = ade_crtc_init(dev, &kcrtc->base, &ade->planes[PRIMARY_CH].base); + ret = ade_crtc_init(dev, &kcrtc->base, + &ade->planes[ade_driver_data.prim_plane].base); if (ret) return ret; @@ -1047,6 +1050,8 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { }; struct kirin_drm_data ade_driver_data = { + .num_planes = ADE_CH_NUM, + .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index ce9ddccc67a8..2b660df60293 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -37,6 +37,8 @@ struct kirin_plane { struct kirin_drm_data { const u32 *channel_formats; u32 channel_formats_cnt; + u32 num_planes; + u32 prim_plane; const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_funcs *crtc_funcs; From patchwork Mon Aug 19 23:03:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171748 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596230ily; Mon, 19 Aug 2019 16:03:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwzMpU3kjgFfs7bwwRpx4ygu9SR9HauDFAHzxKB4JfcPcNTYidfDbuWIQIsSZkrg+tptFQY X-Received: by 2002:aa7:84d7:: with SMTP id x23mr4580849pfn.53.1566255837511; Mon, 19 Aug 2019 16:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255837; cv=none; d=google.com; s=arc-20160816; b=exHT49nFK22aFwg5KtsUJ6r7PC+bQ1CSIBt/mU5mR6DYMH9rfYPfe/nnyhUWeuZRqk PmZ5QL9ieFfsJfSo/yZ20fd6xWIsgi4P3MkWQeaxRVuMTGgW50QIz4HWtgEzfJ5XnEM8 omsdKQCWHkeGzTkWoI4LUNjebTUFldq+3VGI5QGNJkAG/0nj6Im4b5GpoF/J1R78CNAq BMWPM31aeMVZqcCnL5MaPmUtRlCZAexuddE/j8wDnSoQww6g2FiEtH3rCvuujW7OWoJA GVYmzT7v/OVdBmkd5RUV87OFr8yfeas5xs7WGoLCMvwGMZdIlRx9F6e0auR5GH0goXza +AOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=pasDqukoiYcSf22vVHmDhWNQxAqGGHKv3xKncmQla0E=; b=xgYlflLeupUDMGb4B3k2pgCLVRf5/X8gydHnVotwN9cya2tirYAucwpTXDQOlXoTLE RFgHDAURtfJ9KxCGn+TYlS6krrkmhYinmCJUPSR+/trutYTHxcOCmLZVLCxle1IclJYQ flf/NxyVsnLmcJzTfbpeRuj4xUVstsXXyxiKXTusx4Q6J3ha4GR5Ltv1r13aBaEUgVhS d0PVhtAEcLqKJuhSoyAe99W1GNC4etSHKq6CgT9AyB7ig450kjznQiw6ZpZhAJnLe3N3 xvpZ5bSDAjMoeHwkGZkIzvKnTspRKFJqxEsvu0WBt8J6XfmT8ITxEai43p3j7ippe1VO femQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaIepbIn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11si11397240pfd.165.2019.08.19.16.03.57; Mon, 19 Aug 2019 16:03:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MaIepbIn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728926AbfHSXD4 (ORCPT + 28 others); Mon, 19 Aug 2019 19:03:56 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37977 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728882AbfHSXDw (ORCPT ); Mon, 19 Aug 2019 19:03:52 -0400 Received: by mail-pl1-f193.google.com with SMTP id m12so1691200plt.5 for ; Mon, 19 Aug 2019 16:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=pasDqukoiYcSf22vVHmDhWNQxAqGGHKv3xKncmQla0E=; b=MaIepbInPrEkRgUnMBZxjlCw5OmylHzsQ0+yPqVTi9f3WOcTkgdKCOoNExu6/g5ads pwEJAhHKG3TAEsR9Dvi//KxBFG5p8Fk6+2VKznr1QllWCmyAphraoXUFE8ZocbZK2GfD fV7SqiAUaLg7Xl7APe5JcIEG6H+KYJLZYvUg1KIW8gYqxsdrO5JkWEitvJE5sCgprJtx ArMfpqBfeE9sQQHpRdCht6GYqczqGDNlX7M3niyiAXRZYg//ClWPJ7edADMX+ZkBxnNX vR/MBzNFRqj5mM0M6puKoHpfPXbiHk80T77hpv81PisrE5iccXEB4ophP/9d7THQ3KhM AweA== 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; bh=pasDqukoiYcSf22vVHmDhWNQxAqGGHKv3xKncmQla0E=; b=rkR7MNiESlrvBD+ObIVQ7hLAZmQlyKiDx1CSL1NkRkcmRHlIsudgdOaeSxpj+9EE/+ Pfrf7u4D7NRhPT0O0Nd/L/Lu2G6Ty+JERtWMiZB/HI/6j0x2X7Eh6ilbpBC28+R1lrXx unYt7jrN9xnHISeIgGeM1Mmb23DETJ107jjUOpHOpBbsl8vjalH+4Yl2CEGxKLSIaJ2+ FYD9wsdReEzsKnF2rn3fytTWK2k04oFhPhcDlhgzMJgI5+iRTwYZMRa1I/ii0VbArhG4 DQIzuCql+MdBYaOS78XAM7Eu1bB4AJlJ9y02WvLKCgIWUJY2lkWEWUc9JEBNCkEBh1Co Wphw== X-Gm-Message-State: APjAAAWTcCFLLxyRRaprmf3jd3JgUHhukqUr+Th9OougYA5H9wjXX7E3 mXEJEVf+hYJ3VBW73pefghi5SRiYUq4= X-Received: by 2002:a17:902:12d:: with SMTP id 42mr23814196plb.187.1566255831340; Mon, 19 Aug 2019 16:03:51 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:50 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 17/25] drm: kirin: Move config max_width and max_height to driver data Date: Mon, 19 Aug 2019 23:03:13 +0000 Message-Id: <20190819230321.56480-18-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the max_width and max_height values used in kirin_drm_mode_config_inita to hardware specific driver data. This will make it easier to add support for new devices via a new kirin_drm_data structure. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 ++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 17 +++++------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 3 files changed, 9 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 8b1f3580cbd6..2e29a228f3f4 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1054,6 +1054,8 @@ struct kirin_drm_data ade_driver_data = { .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), + .config_max_width = 2048, + .config_max_height = 2048, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 25191824b64e..2ab32c2e3f95 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -40,17 +40,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev) return 0; } -static void kirin_drm_mode_config_init(struct drm_device *dev) -{ - dev->mode_config.min_width = 0; - dev->mode_config.min_height = 0; - - dev->mode_config.max_width = 2048; - dev->mode_config.max_height = 2048; - - dev->mode_config.funcs = driver_data->mode_config_funcs; -} - static int kirin_drm_kms_init(struct drm_device *dev) { int ret; @@ -59,7 +48,11 @@ static int kirin_drm_kms_init(struct drm_device *dev) /* dev->mode_config initialization */ drm_mode_config_init(dev); - kirin_drm_mode_config_init(dev); + dev->mode_config.min_width = 0; + dev->mode_config.min_height = 0; + dev->mode_config.max_width = driver_data->config_max_width; + dev->mode_config.max_height = driver_data->config_max_width; + dev->mode_config.funcs = driver_data->mode_config_funcs; /* display controller init */ ret = driver_data->init(to_platform_device(dev->dev)); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 2b660df60293..43be65f82a03 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -37,6 +37,8 @@ struct kirin_plane { struct kirin_drm_data { const u32 *channel_formats; u32 channel_formats_cnt; + int config_max_width; + int config_max_height; u32 num_planes; u32 prim_plane; From patchwork Mon Aug 19 23:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171745 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596164ily; Mon, 19 Aug 2019 16:03:53 -0700 (PDT) X-Received: by 2002:a65:504c:: with SMTP id k12mr22333353pgo.252.1566255833263; Mon, 19 Aug 2019 16:03:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255833; cv=none; d=google.com; s=arc-20160816; b=t8AeSqxf6jp7cEV3FwYkiEiHYdRBvggrXl0/twXH4oO5+8adoVw1ttOVqKR+kz5roZ 0UXqFWTvuZrIk4vZ1iO3fmHYZkMY1Tn+5sKwWC7IvtPOBX5b++ee+U64BbKeCWYm44pb SlhJmMaGrr4VH9KT72fYV0x5P5/hCZoEGn6HPZNMY4l1TmRLRQTUfDf+ZIMP8w010Bxw q99yKLZhxwoX7zE2CqsM6nSiIzWrxyINp8xzT6qIKAc/5Kqh+wTYIOJPLopAfpSRk+b+ AlK8SVXtKY5901RrQjSwMeRPzI3tpDseLpmLTGMtbdOvmuFzU65mrVp1o4BW2fovD9yl 6iyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Xtc8YOCqaZZ1cFKsJ32BIebxmxyffX6TKZKTWf0ZB3U=; b=vvJ13m0L901Siqszm2CkAYWGqMmbwzduLaYJ+DP+ins1Ms9w0SMEnxEduXJnnLx/D3 Py/BFa3XfoLo/L1e2FJOnPXd02hVnUserG9bqCUuNM6STLz5I809xDKkc9kzi51K6D8t nwDgTx5ggpxuMz/h0ejiq8jJqP+iFxf7y2yD6EszOdZCke+9I5fPeXn4yVFZin1NhKMk D511/Z1h6CjbHmCJdkiEyWsOp1WK6skHWkaqk7eJWhfAkPW7MdVpH8RwX2SW3s0ugAMu OXDh2CAs4iu4sNX+XGrml6hhf/si4Gh4rdKadFI7488QIT1j9ju/0b5kr+z4k76zNfBe SZPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LDl7w3VE; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id s13sor2550344plr.24.2019.08.19.16.03.53 for (Google Transport Security); Mon, 19 Aug 2019 16:03:53 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LDl7w3VE; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Xtc8YOCqaZZ1cFKsJ32BIebxmxyffX6TKZKTWf0ZB3U=; b=LDl7w3VEwYJGEAWm+n9mH4b6C5mMs9WVT1LRZG+vOuZf25V5X133ACFSJU3htofPOw jQ6ufPJzGnkeWWdesKsOVhd2HLjxrnBLyOUfevOR9+0ovUgjxTorHsJwT1895rbKJv8I o6RcQXOv4mNwlJP1WvafJvsxSjlQl1bkQa6g7iADZJpP8YMppVPzrhtXFmbaQr+wKgau FIus3JIVGxA9Y6g7pfNBavmocUaT8F1d3dc4EE0uL0+MVwWi2/7t9BWERxCb+vWlaZKW S6hIBkVzNbtJUrDtZGpHoM27iFpmNmHTCqnGviGtSaXitUPrEexH4GbnrNmR8mCxSCpV 8rxA== 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; bh=Xtc8YOCqaZZ1cFKsJ32BIebxmxyffX6TKZKTWf0ZB3U=; b=WmCmv6ku/KZCc7hmXrt7+7Z1jUt7ojQufbgRDmtnDgqa3vW+vZxaw5KTSVLg1TRSxB KBPZZC3qYusxTwLipan60SPVxanK7OUxbfB1LwaPV39X2v3M1nfUTmxAK0vv9MoIO6Je khwUq1UKfP5D//h+Ta0xIitM278SiYfASHpPECfewRsldBpUGJdEfVOSQUyGOXUJHSty /pSVm0OhRWPHXGw/ZT7Xu/pIcWqpbcTYmlbc9dfm1uec4Vg2dwfmxXXoO0aEvdTbbcQj wWxCrQrOcjQv7koYQ1Rn/brFCwYBg9NSQ8bFzydFm26R8RMcxhie30iJWkXlozuWiqKe yngw== X-Gm-Message-State: APjAAAX7ucWpCIl3y1VwUl3ToCSFpJVQLzid2y9H0+yh/Wn8Q1Fr7Db4 qmpeTh9d9RVVt0undIErw11aH6Nj X-Google-Smtp-Source: APXvYqxoyTvVmfTWQisDIjAh1zW6bHXsxn85+zUFUhjXI22YOeaKbLw1toj8yQHSWNqNT4useLHjVw== X-Received: by 2002:a17:902:20b:: with SMTP id 11mr25514788plc.78.1566255832855; Mon, 19 Aug 2019 16:03:52 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:52 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 18/25] drm: kirin: Move drm driver to driver data Date: Mon, 19 Aug 2019 23:03:14 +0000 Message-Id: <20190819230321.56480-19-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the drm_driver structure to be under device specific driver data. This will allow us to more easily add support for kirin960 hardware with later patches. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 24 +++++++++++++ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 35 +------------------ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 26 insertions(+), 34 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 2e29a228f3f4..7db2cf93a245 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1049,6 +1049,29 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { }; +DEFINE_DRM_GEM_CMA_FOPS(ade_fops); + +static struct drm_driver ade_driver = { + .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, + .fops = &ade_fops, + .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_vm_ops = &drm_gem_cma_vm_ops, + .dumb_create = drm_gem_cma_dumb_create_internal, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, + .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, + .gem_prime_vmap = drm_gem_cma_prime_vmap, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, + + .name = "kirin", + .desc = "Hisilicon Kirin620 SoC DRM Driver", + .date = "20150718", + .major = 1, + .minor = 0, +}; + struct kirin_drm_data ade_driver_data = { .num_planes = ADE_CH_NUM, .prim_plane = ADE_CH1, @@ -1056,6 +1079,7 @@ struct kirin_drm_data ade_driver_data = { .channel_formats_cnt = ARRAY_SIZE(channel_formats), .config_max_width = 2048, .config_max_height = 2048, + .driver = &ade_driver, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 2ab32c2e3f95..c9faaa848cc6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -93,38 +93,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) return ret; } -DEFINE_DRM_GEM_CMA_FOPS(kirin_drm_fops); - -static int kirin_gem_cma_dumb_create(struct drm_file *file, - struct drm_device *dev, - struct drm_mode_create_dumb *args) -{ - return drm_gem_cma_dumb_create_internal(file, dev, args); -} - -static struct drm_driver kirin_drm_driver = { - .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC, - .fops = &kirin_drm_fops, - - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - .dumb_create = kirin_gem_cma_dumb_create, - - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, - .gem_prime_vmap = drm_gem_cma_prime_vmap, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - - .name = "kirin", - .desc = "Hisilicon Kirin SoCs' DRM Driver", - .date = "20150718", - .major = 1, - .minor = 0, -}; - static int compare_of(struct device *dev, void *data) { return dev->of_node == data; @@ -132,11 +100,10 @@ static int compare_of(struct device *dev, void *data) static int kirin_drm_bind(struct device *dev) { - struct drm_driver *driver = &kirin_drm_driver; struct drm_device *drm_dev; int ret; - drm_dev = drm_dev_alloc(driver, dev); + drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 43be65f82a03..fdbfc4a90f22 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -42,6 +42,7 @@ struct kirin_drm_data { u32 num_planes; u32 prim_plane; + struct drm_driver *driver; const struct drm_crtc_helper_funcs *crtc_helper_funcs; const struct drm_crtc_funcs *crtc_funcs; const struct drm_plane_helper_funcs *plane_helper_funcs; From patchwork Mon Aug 19 23:03:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171747 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596216ily; Mon, 19 Aug 2019 16:03:56 -0700 (PDT) X-Received: by 2002:a17:90b:14c:: with SMTP id em12mr23936675pjb.28.1566255836728; Mon, 19 Aug 2019 16:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255836; cv=none; d=google.com; s=arc-20160816; b=CRmyyRWgVJqeHSy4ZwmC9213AAijV0Vk+mVsEfDUJObFbu0LreglulvJSamGe/gOhP nmpr3KJ93f0MVU0UfOC99xvAsTWpjmIBcpbevLm3iLtg9MMveuiVhzeg+bNVEoSLtGho xXqYzOUxqHkmtNDyaWdZ8Kb26emp5/PwxbVEn/ju+IiRGfM3dBTM+MZUA8roIaWy/MVP 4SFM/ldwfhTWLSdRA/suKHXb0qwAkeRfNTUcOufrHR7fOq3pgE1NAIU4CsBglCO1ZBuQ tlEkJlwUvPpNREpqxAsqDhYKXSz2wwBgRMkpRvQSMfydcQteWny2HiWBQYOPU9Gf0+Ht zIjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5xXqlqGWu5A581PxcE1TU9HQN3Deqwd26JfZ6CBJo3I=; b=WktoEX4Eq5Eu57UvzsZNlND47MnHTVvJBN4HhVMzZmIHfHKKiSOvWrA+5STGu8X1LC V8jEcQUrB9zn/q1GVXlJdVHkgM7kdq0imXipJHfEcnk5i4a0pE7uFm9fsSncS1h9B8lI eFzuyz3hOc6beGT/PkYRx+heqt9NjZG3LDMh5kcGqou2N4RV5/pXK2xtTRr7JZCxRfwe pP6isIQcJv41sDC1W4SZKv00iyv6x+yJ8Ng/gvnePngRvzP9MF64+ZL8sDLjwNBR4zhl UA11F5FKKcKQYAKNF/ZW1riU616CNdKwnZ0JOP2QvLwOo8ZMvCL+3AAni7i4RiatdnTa eSQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+7JlJtd; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o4sor2488278pjs.5.2019.08.19.16.03.56 for (Google Transport Security); Mon, 19 Aug 2019 16:03:56 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i+7JlJtd; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5xXqlqGWu5A581PxcE1TU9HQN3Deqwd26JfZ6CBJo3I=; b=i+7JlJtdwvhF0sU+zkXbFNUp/U9CGl0fhE6aCXvRQ6LAEgcqtBgbtAwFQz/f4UShbr o1CilFSSiyAlklLCS4XbjMea207NHBunBUsC+CyfYie1eHyQ1s++OXJaLWv6KBpF0RtQ 8MV7AeU1PYnGdfYWDPHg3znzttuK89H8oFUoaN7yfFQoPktS+rX9t4yajotfrLNMrBZ+ fC6f1ALQ1sfh81EerbqgsD/GIvBQV5XpD2yaFU6CBT0OeBvhgWlcAGfVc5tf5DEDBvWW J1ttv4bZm9XEjn8k5xoz/VUbWv2c1udxvDVfb4s7xSgW8Wc9dRQyAX85EJzy165ScrLr Dg7w== 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; bh=5xXqlqGWu5A581PxcE1TU9HQN3Deqwd26JfZ6CBJo3I=; b=I/LlQsSbca/psknp/McvTXmz62JZbY6bNYxHnO5IA1K9Wr55aNgOhT2vEO2Ir4Y3id 6uTU/mWPkA6Cup1UaxkJQKKQ3PQsd8eC+xynt76JmfLEziY5w3nUrhk2k0beZHEOSRpU MNXGiYr5TABKGN4lNPOHIplQb2LEovuFCnEzLV/R3A3i0XU5ZR4K6wybMN2Sm9k2vtWw ON7hTDwcdvtdqyFzSo8ACfnj1N4ATh7cNifqQh1KIdJyV4U0Og3bfoEpB2IbGYJoJkjL pNej+njB5XU6T/3bPBLrVsDdajKX43YPuIShwYvAMgwRjEq8KnPkeu0YV9JI0urlUB/q vSRw== X-Gm-Message-State: APjAAAXt9IMV7XZTAAtMNAviLcuntbTXiWKtNCyTHfJselHvFJ5poeC3 VMDdPTAceLuR0UHNsCfPkn7YhIrO X-Google-Smtp-Source: APXvYqwfhm7llbkVctWlSDwtfdAvwLhY+YVSQI6Ko11Wl1U5THXL/MpzMgH47+N+G/aXeDPuN1xZxQ== X-Received: by 2002:a17:90a:9f46:: with SMTP id q6mr22468018pjv.110.1566255836335; Mon, 19 Aug 2019 16:03:56 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:55 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 20/25] drm: kirin: Rename plane_init and crtc_init Date: Mon, 19 Aug 2019 23:03:16 +0000 Message-Id: <20190819230321.56480-21-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch renames ade_crtc/plane_init kirin_plane/crtc_init, as they will later be moved to kirin drm drv and shared with the kirin960 hardware support. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 5f39249fd83e..a0cc1285512b 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -571,7 +571,7 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { .disable_vblank = ade_crtc_disable_vblank, }; -static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, +static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, struct drm_plane *plane) { struct device_node *port; @@ -892,8 +892,9 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, - enum drm_plane_type type) +static int kirin_drm_plane_init(struct drm_device *dev, + struct kirin_plane *kplane, + enum drm_plane_type type) { int ret = 0; @@ -1024,13 +1025,13 @@ static int ade_drm_init(struct platform_device *pdev) else type = DRM_PLANE_TYPE_OVERLAY; - ret = ade_plane_init(dev, kplane, type); + ret = kirin_drm_plane_init(dev, kplane, type); if (ret) return ret; } /* crtc init */ - ret = ade_crtc_init(dev, &kcrtc->base, + ret = kirin_drm_crtc_init(dev, &kcrtc->base, &ade->planes[ade_driver_data.prim_plane].base); if (ret) return ret; From patchwork Mon Aug 19 23:03:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171749 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596240ily; Mon, 19 Aug 2019 16:03:58 -0700 (PDT) X-Received: by 2002:a17:902:830c:: with SMTP id bd12mr25503275plb.237.1566255837935; Mon, 19 Aug 2019 16:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255837; cv=none; d=google.com; s=arc-20160816; b=GKsV7D0FeiEHPSb0dUXSUAeoRWCnRefNVd+I08PEFicBS7S2AUol7jWfpyUmxSCrqm Cvzh/ezwMRLNwKzJDri8+3Jf9z117FrBn6GvNw4pOzo/GioGm6QUL3nNNGDfLvpcPnFN /d+L74itFp2vog6sdOBkiH7Z2iyJUPCutzOsg6236oo3K76BbrvQzVZwdj2wx3HO/IAt sy39VLYw18pbpaGPmJuz9Js1hBGy4zcUjGPEQrACg7yTvdSx+QIK6hjdWDo3ut9F8N2q xaLRnTrtVVUIBz62ZwnYeAbhOtfzGkhgMM539BuZBj99uOyM54uNYwnhKdQbXFS22zZB I7Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KEp0elOXwEygi2UwLXppvJt7Q3Cx6Htjn7Pk6SXSqQ8=; b=pp5Ln5trbEmVX5FxYdffYyhKEsvvLKQ9Nw/OtWRmoqplpT48zVWdCyc+MDD8jdyhqs JxyplQ40ez9t4tiV58kvo7gPGIxHoNEGIp6p2yCrY07YsR9lYKpuK5ulCHWmHDy8CrIQ 8cAUMebjpXskwscAMVq2kQjettmdqKQYC9xnSL5IIgBgVlGDhNKr3Yn3A2i1AQUiavKy 5oaDJZ824UeIniqJ+2tUfSK7pPyq65tEXMdDJ9SJrWsTi6+pbzjIDZzaoKSxtwyXtN7D 2CxEg0Am7E8iIkHqJYWMRsofAKIxXVJWaSjkT2NvQWLFXgoBOYFE4KtekHcAGDDw4A3B TCNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdOoZu3g; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id k67sor2427756pje.16.2019.08.19.16.03.57 for (Google Transport Security); Mon, 19 Aug 2019 16:03:57 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pdOoZu3g; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=KEp0elOXwEygi2UwLXppvJt7Q3Cx6Htjn7Pk6SXSqQ8=; b=pdOoZu3g7oZCCwI/bXh7Isj1qi7y7cuAYZjlN+hZ8RJndngrGKe3jT/YScIyRDgMNT pYPVudymwquCht5UccK02DFM0AWhxmeVDVk9bC7pe4gffL873wQNepON+skjV6CtE8H4 Jg6wdtOlhCm0vdb7MzFzOQehTSRG39gQQ2HOIoDeqjTWTtSr7zFMlcEs6IRu4fx7BV5Q Lq03F/OWNw/VyGswq7MnHya73oZtDsyq0wG/DccFS6mpab9sVNYoOxLb5pRaUtxvv1oc zON5zefzInYHEyMcWe3tYkxeRyKDep2/fRF21Sdmw4m/xzXqqt5c+2JIPXzMqxdukfGQ FUoQ== 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; bh=KEp0elOXwEygi2UwLXppvJt7Q3Cx6Htjn7Pk6SXSqQ8=; b=tKftpc/KwFMTA3nMni85RFspbgu2OmsB8CBOenawRcP0dFm1xUAN879Nn3K03yvpD8 JYv9HgwMDbkYFCJN0/uHsOabGpapdxLjIog3tFe/XJipzfizDjW71FhfTXvoIQ0dj4I4 DA3gjWP0RCk4MGfCk35crFxOSPnQqziQKkBcGikP1DvSVv2DdMrrnevlbtbbAMuII/0d +3eVKDM5G2CtZIyO0VnMQSch8eUa6gCVO3zE+kUhaeacbc1IxCCj+phZ+9ySafeaAiMD ug+sqpXYGUhvMTA7ZWNOUWwENtn/G40tdC4Y5YgIInNjQj8mSezG6jY/7ZrZglqjnowN 8Drg== X-Gm-Message-State: APjAAAXdGN6WH023AuAHxihRePxfZdpi9MJv6fE2U/+MyKlIlY2pZlK4 e7BgnKZdApwmE8nJCOQk2hWCHEmc X-Google-Smtp-Source: APXvYqzy7dL1PlN9gj3IYtPQmc4I8figOnswPtwMOyqf8D1q6BzRiYl/2/7Jcm3uza9avL8EUpXNcA== X-Received: by 2002:a17:90a:246f:: with SMTP id h102mr22983749pje.125.1566255837541; Mon, 19 Aug 2019 16:03:57 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:56 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 21/25] drm: kirin: Fix dev->driver_data setting Date: Mon, 19 Aug 2019 23:03:17 +0000 Message-Id: <20190819230321.56480-22-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the dev->driver_data to point to a drm_device, not ade_data. Thus we set the driver data to drm device after alloc. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 - drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index a0cc1285512b..a7fe2fc57bf7 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -998,7 +998,6 @@ static int ade_drm_init(struct platform_device *pdev) DRM_ERROR("failed to alloc ade_data\n"); return -ENOMEM; } - platform_set_drvdata(pdev, ade); ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index f92b3f7de5c0..55c8dbb68be0 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -44,8 +44,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) { int ret; - dev_set_drvdata(dev->dev, dev); - /* dev->mode_config initialization */ drm_mode_config_init(dev); dev->mode_config.min_width = 0; @@ -140,6 +138,7 @@ static int kirin_drm_bind(struct device *dev) drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); + dev_set_drvdata(dev, drm_dev); ret = kirin_drm_kms_init(drm_dev); if (ret) From patchwork Mon Aug 19 23:03:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171750 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596289ily; Mon, 19 Aug 2019 16:03:59 -0700 (PDT) X-Received: by 2002:a17:902:d88e:: with SMTP id b14mr3026935plz.244.1566255839665; Mon, 19 Aug 2019 16:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255839; cv=none; d=google.com; s=arc-20160816; b=qJLZ+cSzBGi8mCPnoxa3xqDXWw2lBvTPUdtbRxalea+wn0CPrvhpq+HUSwI6CUPUjt d+0qVLIZgPoJaMZw9JwSNWE0l1Zx6o9RO+/THCyVST4lDPdv3iLAV9y2EXvFI2Zywssf 3JTGYUZA3h7Jjp06qjPaS0MddmEWyJh3YS3hE+GUY+1jIvw2II9wRgk+cRHBPY/sH/35 Jh9DpbNAgDWAWimkMLVfLSycYpuBej4UXwAPwZZf+VdEnzJCysoaN2Zz3fDo5LghAdPR mTSk4pthw0G45MuCGxdpzBHBM/f054yPvySNvGr7D7X10zzPknrLD4dGAiO8xvvRoDV2 +eLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iSQb8FgaCNaXcBii2QVIuOGP6f5h31ib3HlDrpYCUmw=; b=cBsbj2k57RRUIyB9lqgD8n3ayQSVSwlyFFEoroJWbY3C9Kufv7SATVpZDQAUl/abRo s0Pt4nMTxAzzXO4cf0pPN7FA6MhRUmR+iSsv4qnZtrOgrB27Eg7OQUAo6McIjb1HicuW Xs9HUOTzntC39l30s7Y4fAwcSId5wO/C4rAPMPt3NHiX2wfqw15Ek653RjPTtfIptfdS DoloeDVOWP0NgWAhjAof1dYxyJsByJLzbHmZi4oFImIfvn0jqCzlrgKYbhdSx7oKjjGH 7I4CKWlLMfInjb13WCw32heFsLl9kxwliniKZGa5hotUcmYVVtuUVlXLsO0LrBkkRUHa H3bQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QrkgArX0; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b1sor1777846pgr.86.2019.08.19.16.03.59 for (Google Transport Security); Mon, 19 Aug 2019 16:03:59 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QrkgArX0; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=iSQb8FgaCNaXcBii2QVIuOGP6f5h31ib3HlDrpYCUmw=; b=QrkgArX0B3Kj0xDaromy4qzCPe+ESlH2vc6lYT0aQG/b5Ry0WwjZjdbsZ+2UZG2x+K 6y5q7KG4OqXaWU1fzhH3MC1bC4X7EXx9k4+4mg/KUqSCNUTajD7+ZwpcNxAdMgemgQG6 HrZbhzgqJB0FXQnl3fgaYls9yl6fklO2aJeoMQw0Tb3DHoY7kIpqffUNL9lb8+RCYFqI KeGpBenrN2lyhF1tm7gOgiQiX5gZhfBXmgs6VhkwFK8JsSIdbxyAMuk79k2xQs0KAnsU 2zH6Be8BqnNrPIhjfkK1rzSCdno/V0Snr8CURxDs/TjYeRL4h1JFn9KIsikc3nCB8HFo CIAw== 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; bh=iSQb8FgaCNaXcBii2QVIuOGP6f5h31ib3HlDrpYCUmw=; b=d0Quqny7/EyVVHdhhGV1+YDLvlDe/xpQYAmyicmoVWu7HP87Yruw3du9I9GBH+MjDr jIMcZuOBO9eqXaWzxn5t1BPkWMB/G6ze00L6M/nO20vJ1jzV+ZPwmtT4G/GXMwoXEotN bKUWFBiu6L55U7SY9n8HnIVB82B+ntXXFdHFv+N2fOQq6zC4URsvN9HMa9b/RSQLulaj 9uH8RjT8cCc23sXSkjWLpp1NMlpH0r8h+E1ZO2LYNWOD1cAQyfAdVY7yUJeqUpwx6K/2 OmlrXTF4xKfyXCng+at2IIZPGAjYB2TrgLtblbbt+pfRQHbf1+QlMiR4vZPmihnL+AEu tfDA== X-Gm-Message-State: APjAAAU7BnrSqI0JiMmVIoxs/nZhedexRsjJTRJvhCRUksdWeBTZUV07 J+fRlZ8YARy30pJZX3bSkLg+bMeDLih5HQ== X-Google-Smtp-Source: APXvYqz0V0XOXIPeAq3o2S1YQkSrU0pipkFmKcruZgN4S03QshB4Zhd+fABk5Xoj6Ks7kaSVwW7BpA== X-Received: by 2002:a63:505a:: with SMTP id q26mr21501966pgl.18.1566255839103; Mon, 19 Aug 2019 16:03:59 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:03:58 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 22/25] drm: kirin: Make driver_data variable non-global Date: Mon, 19 Aug 2019 23:03:18 +0000 Message-Id: <20190819230321.56480-23-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the driver_data value to not be a global variable. Instead the driver_data value is accessed via the of_device_get_match_data() when needed. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 55c8dbb68be0..84215f9dc985 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -29,18 +29,9 @@ #include "kirin_drm_drv.h" -static struct kirin_drm_data *driver_data; -static int kirin_drm_kms_cleanup(struct drm_device *dev) -{ - drm_kms_helper_poll_fini(dev); - driver_data->cleanup(to_platform_device(dev->dev)); - drm_mode_config_cleanup(dev); - - return 0; -} - -static int kirin_drm_kms_init(struct drm_device *dev) +static int kirin_drm_kms_init(struct drm_device *dev, + const struct kirin_drm_data *driver_data) { int ret; @@ -96,6 +87,21 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static int kirin_drm_kms_cleanup(struct drm_device *dev) +{ + const struct kirin_drm_data *driver_data; + + drm_kms_helper_poll_fini(dev); + + driver_data = of_device_get_match_data(dev->dev); + if (driver_data->cleanup) + driver_data->cleanup(to_platform_device(dev->dev)); + + drm_mode_config_cleanup(dev); + + return 0; +} + static int kirin_drm_connectors_register(struct drm_device *dev) { struct drm_connector *connector; @@ -132,15 +138,21 @@ static int kirin_drm_connectors_register(struct drm_device *dev) static int kirin_drm_bind(struct device *dev) { + struct kirin_drm_data *driver_data; struct drm_device *drm_dev; int ret; + driver_data = (struct kirin_drm_data *)of_device_get_match_data(dev); + if (driver_data == NULL) + return -EINVAL; + drm_dev = drm_dev_alloc(driver_data->driver, dev); if (IS_ERR(drm_dev)) return PTR_ERR(drm_dev); dev_set_drvdata(dev, drm_dev); - ret = kirin_drm_kms_init(drm_dev); + /* display controller init */ + ret = kirin_drm_kms_init(drm_dev, driver_data); if (ret) goto err_drm_dev_put; @@ -190,12 +202,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) struct component_match *match = NULL; struct device_node *remote; - driver_data = (struct kirin_drm_data *)of_device_get_match_data(dev); - if (!driver_data) { - DRM_ERROR("failed to get dt id data\n"); - return -EINVAL; - } - remote = of_graph_get_remote_node(np, 0, 0); if (!remote) return -ENODEV; @@ -209,7 +215,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev) static int kirin_drm_platform_remove(struct platform_device *pdev) { component_master_del(&pdev->dev, &kirin_drm_ops); - driver_data = NULL; return 0; } From patchwork Mon Aug 19 23:03:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171751 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596317ily; Mon, 19 Aug 2019 16:04:01 -0700 (PDT) X-Received: by 2002:a17:902:82c4:: with SMTP id u4mr1316568plz.196.1566255841405; Mon, 19 Aug 2019 16:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255841; cv=none; d=google.com; s=arc-20160816; b=f5wIv41a5LPIkzNTzaAxp50Pwva+YXzLOKTXP1LcxBBpUDbty4bu3xjzOhMnZcJC4s d8Zx1jRQMf679Zb0BPlZx9ytll+NM+xa1zgwWMtQxjYnyrIUaUI2U/w0crXn0F3NOu9J W050wi5xJaItBTHSjJON8kpDJcjKuyFwJR6mf1SAClnRD1rjE4Q0p6Samt3QEvqVT3M/ qu4wN0qKF1vU5KuQUd1CNuP9HuuN42A0jIgzXwvSrBJQkYvIzwds9se6NFNlIlofhjw9 KOUMqCYJKR4qRSXXcmU2tZ2jSsVCzNJetbd3PF/sjXdSMC+448PhirWny5PjYIuLnEov 0YAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ffOhLSrwkZ0FoYckf3kTJH2dZNi42NmCSonPnEyy2Hc=; b=Jk7mHuWw2qD7zKgHf3RY5+ASFk8LEZcuj7LFBNsu2Yud5pIWDJw/5DUr0nb6CJmuld hG72+vtXE4oJ1gcFI7WD1hH25l7h1kOGvWDBx2PGsnnRieNiwK1cuUNAp6zf3tpXsEnT 19SqCsorrFcnNRHSkB8hzMrJtAUaOd2Zpd3EezvLA6KDCSjG4gufaj/hwxTuI8hcEFCZ u4TMoNRK9OOnJnqnKHThx3p9DO3198B7I6WPb/OoJzF/BxLZ4jZVDMMhg3+U6wCCU51J vwvzUq2OhyR8dFJjHp+zyuPPqhc+pIBcsWDJs7L3EP27Nbr9PUZXvHcMitFqa8k3KxmU SV9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u3ZHOgJd; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a31sor1858788pga.15.2019.08.19.16.04.01 for (Google Transport Security); Mon, 19 Aug 2019 16:04:01 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=u3ZHOgJd; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ffOhLSrwkZ0FoYckf3kTJH2dZNi42NmCSonPnEyy2Hc=; b=u3ZHOgJd502s/aInsx0EzPcO26A1FA+uOEiIkhJKCiZ5hAcXzU0zAQA5eqfrge34yi HAgWlvz/zeQt8miwKSyTesRUl1qArKIpHtaIH+G98V0fKGHBkGDCIBoP4QyLv+B7zHbq 37bE3GwOVky5lEbBJqQSMAo1roqIKmn2AWPjyso7Tas2OIQ9zPgSffUeorOIz5D4N/iM ZpXMH1NNPT9hmJNqSvjyRqLzMG8OC+SlIUZBUSe2Xb7YctyFGwY04qyxJNFIuOnIX3QH HEt/eAuQu2E5dQ9B+3n1qJIurFSg7Rp4/Uy8Qk7EuLxvU/vssVWSA90jn9ry/YwoNGeI xr/A== 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; bh=ffOhLSrwkZ0FoYckf3kTJH2dZNi42NmCSonPnEyy2Hc=; b=bBe+/GrlKqjQxSkkhG2W6goNmNb1MeLI5ghzgvl+L8h0EtQiVYGHb4TY+gg12u80+h b3q6vs5hp/ENcRi8qEomDKBsIg1OlQVIB7AmEteGyNgIPsOp9fnRaFtK4gCKai8MGdZz zms84uTBUjDY14NCLSdYY1PMCrR9l6tEFsILHa5OalaA2k7eHNOSwM2ImPtlZnJCCOQ0 f6KD4eFk1Fr6cSI14+3AxNFX7Oo7c0b9o55p9M52moIIo68S0xXZMZOObeucBh10C9r9 ecjQ0DHdaj9fknL8L2h3xeb4lYKloTj/dXfJMMwEmSYhEvzbWZVXPdr8Cjz+UJ6GJkOu ijng== X-Gm-Message-State: APjAAAU/sDYd8AxCbUFw0jRos56Z9OnrjGOIPQQA+nUmA+9J14hi4mLD TIGnn6mpcD187gPWpoXpLV24wGNu X-Google-Smtp-Source: APXvYqxoxiFV08/B/uo/2/sQJgEIGK7Iy84PjzPkwa/66GDBThzwEXIfxiZD56GFZFTRHw7CIvuc6w== X-Received: by 2002:a63:89c2:: with SMTP id v185mr21987280pgd.241.1566255840875; Mon, 19 Aug 2019 16:04:00 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.03.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:04:00 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 23/25] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Mon, 19 Aug 2019 23:03:19 +0000 Message-Id: <20190819230321.56480-24-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the alloc/clean_hw_ctx functions to be called via driver_data specific funciton pointers. This will allow the ade_drm_init to later be made generic and moved to kirin_drm_drv.c Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 ++++++++- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index a7fe2fc57bf7..5caf0921c26c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -999,7 +999,7 @@ static int ade_drm_init(struct platform_device *pdev) return -ENOMEM; } - ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); + ctx = ade_driver_data.alloc_hw_ctx(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); return -EINVAL; @@ -1038,6 +1038,10 @@ static int ade_drm_init(struct platform_device *pdev) return 0; } +static void ade_hw_ctx_cleanup(void *hw_ctx) +{ +} + static void ade_drm_cleanup(struct platform_device *pdev) { } @@ -1087,6 +1091,9 @@ struct kirin_drm_data ade_driver_data = { .plane_funcs = &ade_plane_funcs, .mode_config_funcs = &ade_mode_config_funcs, + .alloc_hw_ctx = ade_hw_ctx_alloc, + .cleanup_hw_ctx = ade_hw_ctx_cleanup, + .init = ade_drm_init, .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 95f56c9960d5..1663610d2cd8 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -49,6 +49,11 @@ struct kirin_drm_data { const struct drm_plane_helper_funcs *plane_helper_funcs; const struct drm_plane_funcs *plane_funcs; const struct drm_mode_config_funcs *mode_config_funcs; + + void *(*alloc_hw_ctx)(struct platform_device *pdev, + struct drm_crtc *crtc); + void (*cleanup_hw_ctx)(void *hw_ctx); + int (*init)(struct platform_device *pdev); void (*cleanup)(struct platform_device *pdev); }; From patchwork Mon Aug 19 23:03:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171752 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596349ily; Mon, 19 Aug 2019 16:04:02 -0700 (PDT) X-Received: by 2002:a17:902:a50a:: with SMTP id s10mr14068636plq.108.1566255842903; Mon, 19 Aug 2019 16:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255842; cv=none; d=google.com; s=arc-20160816; b=UDT44FgXNdHUD3h96Q2DKBBP/obe4EHuZf6MqnIZZalBXw8VZiP3wDKQBnLr1MmuJk wuHeNC+s0Oc+M3aZx6Ki98AtEYLo3SLXlE8Uq+8KFdUp/OLbWKMC2mMLg3WUUOhzHHpv NcdFtAKMzY82l3KHYzEqqii6VoMHjFgeaG8FievBBVIEYme64R6VAqs3VVvGQXIhufUh b9+amoRkkk72vf2QBvi17Hjan08MabdF/Eww02wmVuFD0URGZcSMMaXAU0sB52aotRc4 LnTe4q7Wgvj+fpMs0KgRX9MrKWsIquVM1D7Jb3shxKrqSCM5OloZUUSvyj5b0muxm2Rl lrLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YSUSZvC/MmkBb2A0U71VegVq9IwUqDyTaMf1Jm6kttM=; b=C5Ye81mqz1gy3i0W2BPRPk+mfLEkwsZ/aYtJVoYcncjj5rawn1HXDUjBDYnZEVeftS nGDZhsPDYVXZhSfE8CxGFdpOjJQjTlCzJxsVHPkyc1Wkxqeh1ki7YYfrfA3L9EjgxbJ9 INrd88PeLmreKh3zIX3B7CBqa5c8YLD3zPYBmXj+H6pDF9zlTT/kGCU4ZXzvL2BYWeUC 3t/8CNRMI4oZY86zACPJFnqUOU8LK18ugxjcOCv+OZHwRQvNYJNzpYyz/N2jurg5t3DK zdUYah2fygdFGV+aiwGmmzFdYTK9B0RKnwf3AYvEwNwRXTQaGu6L/po5ZEf0wrgUgs7M fItw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUn1iLVW; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id f6sor2050240pfd.46.2019.08.19.16.04.02 for (Google Transport Security); Mon, 19 Aug 2019 16:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUn1iLVW; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YSUSZvC/MmkBb2A0U71VegVq9IwUqDyTaMf1Jm6kttM=; b=lUn1iLVWN3M/Tavd+lGuDsv+sjHbrx8GA9ZiY8qNOT04SvbHkmMQaFc10dzXCV2nL0 v0IFt7+4KM5RkGel8iZf268c9c5XOBDQjeWCHpNZHij2ar4vItOFkNorSBg2T9vlFkK9 n5iSbXpVkRmPjGEe6/eHcsJJPytYpdT+3cK3V2yHVs0acHXIJRDAPih50km1ipZX1TAR WgU2p6s7q+A69kPVgtzwgh/xJKB7s3DeX9/jPOljSf1z6/0i7PyWA7ZSCYV2nChVIDkc Kun9g4EEXdAYn9iBmJYQ/T4F4mI3fEh+4Hu6664kAaPuWPGLoqVlscoQCf3odGCbALJP /tHw== 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; bh=YSUSZvC/MmkBb2A0U71VegVq9IwUqDyTaMf1Jm6kttM=; b=lQ43gOaXAEuM0XYcYp1pmZ9ljFTAJ4R+W7v0+gEUJ5P9axTTO+g8DHT+OtXdVFEVxl AdhBSYecSqaf0GZaO5oU6P+OKVvIKHJBTfc0Q95doyFgiRMSNiTVrAQSt3sT0qY0CLs8 Hneids/5FjjiW3ixW44vfBK7ZyexJS9maZMCn6JNevoYokIUz/rPI4fApJG86d2tUZDn m9hUi921b60AlDUZLTd1drofV26dEmqAePj5p7BcdxTkv6Ed4sHtY1ofvO+efluEPW+9 63/r1DNW5Jre5UQaxwz9qxrz0Bzg6SCa9qJTfm2+Z0W1LIGFkCixs0IHbmjPkrRayEFM 62xg== X-Gm-Message-State: APjAAAVlrt4T6e7BTR0NitXG0TUy3wpK4G7ODYjvcSkgrTcPtd1KKI8z vu0jfCki2itJ+toARJ2g8tD+nNyP X-Google-Smtp-Source: APXvYqwuD5lU5Za2D+Vjnplf9zhdygBc0WW1Zmxbw+NTVMd+56KwwU6JvtLjPPrSlN2QSTYdxT3KDA== X-Received: by 2002:a63:5807:: with SMTP id m7mr21941754pgb.371.1566255842444; Mon, 19 Aug 2019 16:04:02 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.04.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:04:01 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 24/25] drm: kirin: Pass driver data to crtc init and plane init Date: Mon, 19 Aug 2019 23:03:20 +0000 Message-Id: <20190819230321.56480-25-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the code via a passed in driver_data pointer, rather than hardcoding them via ade_driver_data variable. This will allow those funcitons to be later moved to the generic kirin_drm_drv.c using alternative driver_data structures that support other hardware. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- v2: Whitespace fixups, commit message tweaks suggested by Sam. --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 5caf0921c26c..559e521add43 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { }; static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, - struct drm_plane *plane) + struct drm_plane *plane, + const struct kirin_drm_data *driver_data) { struct device_node *port; int ret; @@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - ade_driver_data.crtc_funcs, NULL); + driver_data->crtc_funcs, NULL); if (ret) { DRM_ERROR("failed to init crtc.\n"); return ret; } - drm_crtc_helper_add(crtc, ade_driver_data.crtc_helper_funcs); + drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs); return 0; } @@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = { static int kirin_drm_plane_init(struct drm_device *dev, struct kirin_plane *kplane, - enum drm_plane_type type) + enum drm_plane_type type, + const struct kirin_drm_data *driver_data) { int ret = 0; ret = drm_universal_plane_init(dev, &kplane->base, 1, - ade_driver_data.plane_funcs, - ade_driver_data.channel_formats, - ade_driver_data.channel_formats_cnt, - NULL, type, NULL); + driver_data->plane_funcs, + driver_data->channel_formats, + driver_data->channel_formats_cnt, + NULL, type, NULL); if (ret) { DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); return ret; } - drm_plane_helper_add(&kplane->base, ade_driver_data.plane_helper_funcs); + drm_plane_helper_add(&kplane->base, driver_data->plane_helper_funcs); return 0; } @@ -1024,14 +1026,15 @@ static int ade_drm_init(struct platform_device *pdev) else type = DRM_PLANE_TYPE_OVERLAY; - ret = kirin_drm_plane_init(dev, kplane, type); + ret = kirin_drm_plane_init(dev, kplane, type, &ade_driver_data); if (ret) return ret; } /* crtc init */ ret = kirin_drm_crtc_init(dev, &kcrtc->base, - &ade->planes[ade_driver_data.prim_plane].base); + &ade->planes[ade_driver_data.prim_plane].base, + &ade_driver_data); if (ret) return ret; From patchwork Mon Aug 19 23:03:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171753 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp3596378ily; Mon, 19 Aug 2019 16:04:04 -0700 (PDT) X-Received: by 2002:a62:5250:: with SMTP id g77mr27086517pfb.158.1566255844462; Mon, 19 Aug 2019 16:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566255844; cv=none; d=google.com; s=arc-20160816; b=qOe4bgYD31mBQ+Dg0pKIne6BObDcr5talSI7iVIwvdaU0d6LChZ6QcRBo2PU0Jv4QJ hM5okCnxSLYoAexWkCnME70+Hx9Z8k6k7eHpaBYFzYnT+L78gkLt+nYQPyRSysgLvLn1 yD5zluLJBeFjiHy/RjmtKFg0JrYv4LvNlQuX750AQ9IMxbY9+3OqxPOGXVWmMLwEaOsY QbJ23wb9N+M4k+2Xc+SkuyxbgPujYoGuWskSo4D1Jiz5+eceHzfQmjWz9iR0dAF5g61T YesVL+EGAcRZaw7qqARB+JIoyImmEMnayXsEUR+TQnbxBPcLVYPrXENSgYqG0CHqgE3T Fx4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TjgKBqnULZnu1lj9DdO97YcmFn7/F/EreXqPG+h61Eo=; b=FHmD+jA4SBnriMFYCDLAbnLId7J4lym67/wEbgpTM26uc0TcO9/MF+uQFTR52mRVhN mfls0yBMVSARA7n9DnK4yQrhGJmmXlHZwa56yuutMeTTMl4U/kZQJnh1XPtWwmAR63Qc Zdf5HRyseXdAgW+BSAcjW9kZLXAJstJheOdwKVsgpOAoGMy4C0GrFb5m/AAl2vQNqOZA K3LBNjshbxVzeDhdb3LL/XhXDrPdFcWcQ737Ap+7Vy+vhWwHJuLaEvuQC+J0g9YDMkk9 wBFoGIRXA82LxDqFjr7lnhkd1lTypFASWm7vauzaQ3dSbSt1T+1q1waSD4boSAaAlAk9 bNkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQpy1FjP; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id w11sor2546772plq.1.2019.08.19.16.04.04 for (Google Transport Security); Mon, 19 Aug 2019 16:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQpy1FjP; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TjgKBqnULZnu1lj9DdO97YcmFn7/F/EreXqPG+h61Eo=; b=KQpy1FjPma6psGbw5T97t7M7E/hCLcT30K7owRTnbaxb3/3d68Z0mdvJKIoRxE0CAE zSqBD9igvF/IpP5qaqEJNmA6icLvWiNf9naCncmb5qODUwfzCO5jMfRf0uu8tiXI1p4x /g8JPzxdD9vwPOnb/bwVxGScV2fo2OIIodLMCLWn/qejrfWSsIq5VLuLJipwU3R7xLHv I4q9AHJiURrgNoB2N6Ffgoipn6Q8Mj2nz4JObx1AqtHhgGKU+1v0uyMFSo32f9isBb6r 77CtEusdAQW2sXgWwzH1VXgaTST1WBZb/2liS8CxJM4csWuzGKlO+yYlKfEPZHHqz7Uw R34g== 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; bh=TjgKBqnULZnu1lj9DdO97YcmFn7/F/EreXqPG+h61Eo=; b=B9FX9C8UK811Q+awQmPuXH3zmU10R3El71uHn6hfsN/Zo4bTT7WHKiQKoftBQioQzW q1kwK//JrOpWo0sW43762CMd0Gn3KKYVE126mYo3ssbBFFmsfv1j5XHIZM6fXsOxJZQs 67wVoaWFx61TOle4ndK65YOR7mzQ55acAOaCDgWCnXr/IK00Td5ZVjz/rhN/9Bhmufg9 oa55XDKwsHC32XQBFEkyM3eWNBgTSoQInV4LWBqZRlxP+KlJK+LGFBIwnQTIJqah4yMK VE4jtXmT+ijswpAKLqpVrCTLpnR1/iLmy7sLmdohgF0mIUEodZpMI5Adzl0jIOh/uviP QIrg== X-Gm-Message-State: APjAAAXAH/uWQ2oTlsojgNghi1ivn0BTzHLdfV1XHrIX9Whz7irZkuOT rCV3lSqrwP0Kz24g1J87wXxvt0D4 X-Google-Smtp-Source: APXvYqyoBtmT0gsUbvo3d0yExIFRJ1LCT+p/RlEBEsLvJssTH1eigulblaaQ0RnOur756J5oX56Slw== X-Received: by 2002:a17:902:b418:: with SMTP id x24mr24661220plr.219.1566255843997; Mon, 19 Aug 2019 16:04:03 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id j15sm17256509pfr.146.2019.08.19.16.04.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 16:04:03 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [PATCH v4 25/25] drm: kirin: Move ade drm init to kirin drm drv Date: Mon, 19 Aug 2019 23:03:21 +0000 Message-Id: <20190819230321.56480-26-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190819230321.56480-1-john.stultz@linaro.org> References: <20190819230321.56480-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch renames ade_data to kirin_drm_private, and moves crtc_init and plane_init to kirin drm drv too. Now that they are generic the functions can be shared between the kirin620 and (to be added later) kirin960 specific support code. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Acked-by: Xinliang Liu Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 123 --------------- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 141 ++++++++++++++++-- .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 - 3 files changed, 129 insertions(+), 140 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 559e521add43..1f75a190fd92 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -53,13 +53,6 @@ struct ade_hw_ctx { struct drm_crtc *crtc; }; -struct ade_data { - struct kirin_crtc crtc; - struct kirin_plane planes[ADE_CH_NUM]; - struct ade_hw_ctx *hw_ctx; -}; - -/* ade-format info: */ static const struct kirin_format ade_formats[] = { /* 16bpp RGB: */ { DRM_FORMAT_RGB565, ADE_RGB_565 }, @@ -571,36 +564,6 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { .disable_vblank = ade_crtc_disable_vblank, }; -static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, - struct drm_plane *plane, - const struct kirin_drm_data *driver_data) -{ - struct device_node *port; - int ret; - - /* set crtc port so that - * drm_of_find_possible_crtcs call works - */ - port = of_get_child_by_name(dev->dev->of_node, "port"); - if (!port) { - DRM_ERROR("no port node found in %pOF\n", dev->dev->of_node); - return -EINVAL; - } - of_node_put(port); - crtc->port = port; - - ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, - driver_data->crtc_funcs, NULL); - if (ret) { - DRM_ERROR("failed to init crtc.\n"); - return ret; - } - - drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs); - - return 0; -} - static void ade_rdma_set(void __iomem *base, struct drm_framebuffer *fb, u32 ch, u32 y, u32 in_h, u32 fmt) { @@ -893,28 +856,6 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int kirin_drm_plane_init(struct drm_device *dev, - struct kirin_plane *kplane, - enum drm_plane_type type, - const struct kirin_drm_data *driver_data) -{ - int ret = 0; - - ret = drm_universal_plane_init(dev, &kplane->base, 1, - driver_data->plane_funcs, - driver_data->channel_formats, - driver_data->channel_formats_cnt, - NULL, type, NULL); - if (ret) { - DRM_ERROR("fail to init plane, ch=%d\n", kplane->ch); - return ret; - } - - drm_plane_helper_add(&kplane->base, driver_data->plane_helper_funcs); - - return 0; -} - static void *ade_hw_ctx_alloc(struct platform_device *pdev, struct drm_crtc *crtc) { @@ -984,71 +925,10 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev, return ctx; } -static int ade_drm_init(struct platform_device *pdev) -{ - struct drm_device *dev = platform_get_drvdata(pdev); - struct ade_data *ade; - struct ade_hw_ctx *ctx; - struct kirin_crtc *kcrtc; - struct kirin_plane *kplane; - enum drm_plane_type type; - int ret; - u32 ch; - - ade = devm_kzalloc(dev->dev, sizeof(*ade), GFP_KERNEL); - if (!ade) { - DRM_ERROR("failed to alloc ade_data\n"); - return -ENOMEM; - } - - ctx = ade_driver_data.alloc_hw_ctx(pdev, &ade->crtc.base); - if (IS_ERR(ctx)) { - DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); - return -EINVAL; - } - ade->hw_ctx = ctx; - - kcrtc = &ade->crtc; - kcrtc->hw_ctx = ctx; - - /* - * plane init - * TODO: Now only support primary plane, overlay planes - * need to do. - */ - for (ch = 0; ch < ade_driver_data.num_planes; ch++) { - kplane = &ade->planes[ch]; - kplane->ch = ch; - kplane->hw_ctx = ctx; - - if (ch == ade_driver_data.prim_plane) - type = DRM_PLANE_TYPE_PRIMARY; - else - type = DRM_PLANE_TYPE_OVERLAY; - - ret = kirin_drm_plane_init(dev, kplane, type, &ade_driver_data); - if (ret) - return ret; - } - - /* crtc init */ - ret = kirin_drm_crtc_init(dev, &kcrtc->base, - &ade->planes[ade_driver_data.prim_plane].base, - &ade_driver_data); - if (ret) - return ret; - - return 0; -} - static void ade_hw_ctx_cleanup(void *hw_ctx) { } -static void ade_drm_cleanup(struct platform_device *pdev) -{ -} - static const struct drm_mode_config_funcs ade_mode_config_funcs = { .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check, @@ -1096,7 +976,4 @@ struct kirin_drm_data ade_driver_data = { .alloc_hw_ctx = ade_hw_ctx_alloc, .cleanup_hw_ctx = ade_hw_ctx_cleanup, - - .init = ade_drm_init, - .cleanup = ade_drm_cleanup }; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 84215f9dc985..2575076d638b 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -29,6 +29,130 @@ #include "kirin_drm_drv.h" +#define KIRIN_MAX_PLANE 2 + +struct kirin_drm_private { + struct kirin_crtc crtc; + struct kirin_plane planes[KIRIN_MAX_PLANE]; + void *hw_ctx; +}; + +static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, + struct drm_plane *plane, + const struct kirin_drm_data *driver_data) +{ + struct device_node *port; + int ret; + + /* set crtc port so that + * drm_of_find_possible_crtcs call works + */ + port = of_get_child_by_name(dev->dev->of_node, "port"); + if (!port) { + DRM_ERROR("no port node found in %pOF\n", dev->dev->of_node); + return -EINVAL; + } + of_node_put(port); + crtc->port = port; + + ret = drm_crtc_init_with_planes(dev, crtc, plane, NULL, + driver_data->crtc_funcs, NULL); + if (ret) { + DRM_ERROR("failed to init crtc.\n"); + return ret; + } + + drm_crtc_helper_add(crtc, driver_data->crtc_helper_funcs); + + return 0; +} + +static int kirin_drm_plane_init(struct drm_device *dev, struct drm_plane *plane, + enum drm_plane_type type, + const struct kirin_drm_data *data) +{ + int ret = 0; + + ret = drm_universal_plane_init(dev, plane, 1, data->plane_funcs, + data->channel_formats, + data->channel_formats_cnt, + NULL, type, NULL); + if (ret) { + DRM_ERROR("fail to init plane, ch=%d\n", 0); + return ret; + } + + drm_plane_helper_add(plane, data->plane_helper_funcs); + + return 0; +} + +static void kirin_drm_private_cleanup(struct drm_device *dev) +{ + struct kirin_drm_private *kirin_priv = dev->dev_private; + struct kirin_drm_data *data; + + data = (struct kirin_drm_data *)of_device_get_match_data(dev->dev); + if (data->cleanup_hw_ctx) + data->cleanup_hw_ctx(kirin_priv->hw_ctx); + + devm_kfree(dev->dev, kirin_priv); + dev->dev_private = NULL; +} + +static int kirin_drm_private_init(struct drm_device *dev, + const struct kirin_drm_data *driver_data) +{ + struct platform_device *pdev = to_platform_device(dev->dev); + struct kirin_drm_private *kirin_priv; + struct drm_plane *prim_plane; + enum drm_plane_type type; + void *ctx; + int ret; + u32 ch; + + kirin_priv = devm_kzalloc(dev->dev, sizeof(*kirin_priv), GFP_KERNEL); + if (!kirin_priv) { + DRM_ERROR("failed to alloc kirin_drm_private\n"); + return -ENOMEM; + } + + ctx = driver_data->alloc_hw_ctx(pdev, &kirin_priv->crtc.base); + if (IS_ERR(ctx)) { + DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); + return -EINVAL; + } + kirin_priv->hw_ctx = ctx; + + /* + * plane init + * TODO: Now only support primary plane, overlay planes + * need to do. + */ + for (ch = 0; ch < driver_data->num_planes; ch++) { + if (ch == driver_data->prim_plane) + type = DRM_PLANE_TYPE_PRIMARY; + else + type = DRM_PLANE_TYPE_OVERLAY; + ret = kirin_drm_plane_init(dev, &kirin_priv->planes[ch].base, + type, driver_data); + if (ret) + return ret; + kirin_priv->planes[ch].ch = ch; + kirin_priv->planes[ch].hw_ctx = ctx; + } + + /* crtc init */ + prim_plane = &kirin_priv->planes[driver_data->prim_plane].base; + ret = kirin_drm_crtc_init(dev, &kirin_priv->crtc.base, + prim_plane, driver_data); + if (ret) + return ret; + kirin_priv->crtc.hw_ctx = ctx; + dev->dev_private = kirin_priv; + + return 0; +} static int kirin_drm_kms_init(struct drm_device *dev, const struct kirin_drm_data *driver_data) @@ -44,7 +168,7 @@ static int kirin_drm_kms_init(struct drm_device *dev, dev->mode_config.funcs = driver_data->mode_config_funcs; /* display controller init */ - ret = driver_data->init(to_platform_device(dev->dev)); + ret = kirin_drm_private_init(dev, driver_data); if (ret) goto err_mode_config_cleanup; @@ -52,7 +176,7 @@ static int kirin_drm_kms_init(struct drm_device *dev, ret = component_bind_all(dev->dev, dev); if (ret) { DRM_ERROR("failed to bind all component.\n"); - goto err_dc_cleanup; + goto err_private_cleanup; } /* vblank init */ @@ -74,11 +198,10 @@ static int kirin_drm_kms_init(struct drm_device *dev, err_unbind_all: component_unbind_all(dev->dev, dev); -err_dc_cleanup: - driver_data->cleanup(to_platform_device(dev->dev)); +err_private_cleanup: + kirin_drm_private_cleanup(dev); err_mode_config_cleanup: drm_mode_config_cleanup(dev); - return ret; } @@ -89,14 +212,8 @@ static int compare_of(struct device *dev, void *data) static int kirin_drm_kms_cleanup(struct drm_device *dev) { - const struct kirin_drm_data *driver_data; - drm_kms_helper_poll_fini(dev); - - driver_data = of_device_get_match_data(dev->dev); - if (driver_data->cleanup) - driver_data->cleanup(to_platform_device(dev->dev)); - + kirin_drm_private_cleanup(dev); drm_mode_config_cleanup(dev); return 0; diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index 1663610d2cd8..4d5c05a24065 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -7,8 +7,6 @@ #ifndef __KIRIN_DRM_DRV_H__ #define __KIRIN_DRM_DRV_H__ -#define MAX_CRTC 2 - #define to_kirin_crtc(crtc) \ container_of(crtc, struct kirin_crtc, base) @@ -53,9 +51,6 @@ struct kirin_drm_data { void *(*alloc_hw_ctx)(struct platform_device *pdev, struct drm_crtc *crtc); void (*cleanup_hw_ctx)(void *hw_ctx); - - int (*init)(struct platform_device *pdev); - void (*cleanup)(struct platform_device *pdev); }; extern struct kirin_drm_data ade_driver_data;