From patchwork Wed Aug 14 18:46:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171330 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1202871ily; Wed, 14 Aug 2019 11:47:09 -0700 (PDT) X-Received: by 2002:a65:620a:: with SMTP id d10mr524049pgv.8.1565808429402; Wed, 14 Aug 2019 11:47:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808429; cv=none; d=google.com; s=arc-20160816; b=RhU64QSW2kwEWeUQkj6f9Rua5B2RIfs6xQv3jbWF34wO3P/DXD+GnWIziH7Qo03fgZ tnUsFKHD7bmOvixeEa1DI3EVsN/g9OzPReGf93R9G6A/244/UR7q+G1E2w52g22gR5HI WPQF/ossQ8pFTF9wCIiplu8VzJjLeQphRhwgLP2m5bOqEolo+wrz3bIeKl7VeCTP+jhh iiQDSp0yba3jWS6vHAkRPz9rc0C5l3d963G0RKmwsH1yWFK9d8VPVIN8Jfuc1SQlnanA qEQXIONLfmGxg/V4p0L5siIgd7AEQGSquOcbcpyRxFqAJp8INBW2wuHJuBWZto0Sii/i bIpg== 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=GHk9KBu+sjfwQVMBr88lecQJQ9kDr2JBg8OISzQ0Mo8=; b=HS1Y3eHVE4C2Uz2lfjQNHY8nHN+l3+CaQcdSofkR17tcIXF5+rcvHS/htrJra3+jg4 pFS0NCyZjZS5IrNu8IF0e/J9S79d8WcGfaeOsTpQMe/x67ZbTd3XCwGi4BRgBoUJULr/ WFAWXa1C/HN+WAIUVTc/dRY3mYDYIXIVJUNzuseD6wVEkvhbtX6BPw5r1kPArXeBVi2+ /J13AZ4n3wpDFh/XfHHmFsANGiZjqb/dgruq92i4kA6cycuQk3CVEX21IWDbEFj+eh+j 9rsbhau5HPyeM+5ALTNh4P3UdRFULpxi/nALQ223l7Puw2DOkKQPrlyDFJt9trKUuCD6 lpKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=r3js0ydL; 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 f7sor415807pgc.20.2019.08.14.11.47.09 for (Google Transport Security); Wed, 14 Aug 2019 11:47:09 -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=r3js0ydL; 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=GHk9KBu+sjfwQVMBr88lecQJQ9kDr2JBg8OISzQ0Mo8=; b=r3js0ydLYVWv6kjs69b3EVE1ebVkkwcc0gHPBRxrBdj5PUspzHKliJWKYfdPUe9exc BBWPiDyCuEF1CjJoE8NLFSNJ2j+swzsxOWhruAH7tyUc8LCVjpK7EYZMfPY+M4ozAqdI ygeplTC6loMcRsXZtCZMmg20miPSkeLfpNbWzSZp81PRoaKm/+ZDuvIetQxatEFVlSUP aBumVfT8CeGVChSbv4ezqeES7jPEPvmet3pEXtYcUmR8lm2H98F5p0jsSM9HV7fAYAE3 La9uyxTBdwFwUH9a0pKDG/npZUN6X51gssLmFdc0ywQ9ptvc+owN6JbK8PGf4ESVKgVt RYOQ== 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=GHk9KBu+sjfwQVMBr88lecQJQ9kDr2JBg8OISzQ0Mo8=; b=hxbQxSbZFdaKr+p9mHYXo3Gbewym7tT8eeaTB5bmLkeY3aTJ4Z3HdwZAWP5lygynXa 4vqEoii1lxcZWYz7cwT3WZ+DY7nKekv2tp9rF6Jv08cSOsw1hwHtgi5sUHh1SKI4GR0h ACV54FMo7KxIhUgcgzfMHW2IQaTOTUO9JtSRzRf3yxW5HY0Uj4pXamR1Rc9WapTAfZLz 3wWX8zzbbga9+Q6AwV8E9pFvv3Ghzo/41GoyqDQb127lLdiiVg/VyJH83e9sW5F3yHgE 65q8L1iTI0BwHQ2LwbOdkC2eYncShC/Ku45dN7fvEeS9/+fYnuJFI+/MnuzlNH7YgnDj asIQ== X-Gm-Message-State: APjAAAWl1YoUJyOUj7m0Y70abr80GQYzqXrXI/fNlkIhD2RbpxbOmKvB K3esJtAkIEuCQqI9btyEJBIBqzBn X-Google-Smtp-Source: APXvYqyFZdKw4i6UT0LjD3UmiAGGwKCO+QBIqvUBmuZT9H+t+etcgS2PPN0TS7bzXvAdSNzcyscwKw== X-Received: by 2002:a63:61cd:: with SMTP id v196mr484242pgb.263.1565808428888; Wed, 14 Aug 2019 11:47:08 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.06 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:08 -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: [RESEND][PATCH v3 01/26] drm: kirin: Fix for hikey620 display offset problem Date: Wed, 14 Aug 2019 18:46:37 +0000 Message-Id: <20190814184702.54275-2-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 ad7042ae2241..d69b5d458950 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -54,6 +54,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; }; @@ -172,6 +173,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, @@ -341,6 +343,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; @@ -358,6 +371,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; } @@ -1034,6 +1053,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 Wed Aug 14 18:46:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171331 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1202886ily; Wed, 14 Aug 2019 11:47:11 -0700 (PDT) X-Received: by 2002:aa7:8611:: with SMTP id p17mr1406645pfn.41.1565808430965; Wed, 14 Aug 2019 11:47:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808430; cv=none; d=google.com; s=arc-20160816; b=mTtQ7CGlEd83h23+FMpWv2GpjPTuIWqW6sHQm5/CAnGMW/hbJCCWSjjtCpPXqfgGw+ O8xzunRHQ4OyQ93SjI8PaXjtA3oEsMgRZPxp5bLcZw1CAkNm+Yu7S4cem10OVO8aCPDN ex4Xh31+L2V6smgNfvkjXnNU6/uUEX0b+VkGKS+TDNQtZv2zvG/rVV3HzIP2LDejIVQd h4hvTFC34HS6r11O36Zzc4r/q6DYeT8GWmpbQPOgiidTSHHvT2F7HI4nBlVB6Ligsvq0 S/Pt88J5a0Hl8k/NqJTq8K0dcdJkFsmn4EwJgMqKWVf7NKzmgvsG2j+hyF5ilHa5t3vE Z40Q== 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=M6EfpO2AmlsI2DOe0XzrU1zVY/mWE6ZPcbT1wLb1NQk=; b=AALV14F+g7C1geNb/ZN5b2yDtGlWuoI5c8XijGIS75/k8CGFmTqXnV2aJrHq5ASt3g gix7ilQtStNGR44jIo07zCjAuxn4mOsqjcSYNIxoJnKetOMLuDycI00sYSPRQt5A0+sR G+duIrnciM1SQASI2n2nB+wVTVkHb2RKcypw78wVKlOXCiMTZz5X74Y5RaPa159kZV1J VkFhn8WKwbY+BvXjzzXitUCvfkTWWa+ufYhi4uMjZinuosNVM0E8qlOHWR0/vGfmyEUp G2NZzUnE3mYXLZqKSrHHYm3hf0C0qrIFTMjlJnZ+8E9XtOPxVk1mphKm6G3W6F8bZyxT /XZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dA1rYYZ5; 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 p187sor406345pga.43.2019.08.14.11.47.10 for (Google Transport Security); Wed, 14 Aug 2019 11:47:10 -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=dA1rYYZ5; 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=M6EfpO2AmlsI2DOe0XzrU1zVY/mWE6ZPcbT1wLb1NQk=; b=dA1rYYZ5AQz/pVgpowhEbvOMUR3T44a0HzOlt51pn+il3uCKhZ1XuZxJVRvMqYXO6A b5dcW0E4YtrL/peRKgkJQnkP7xE5X9KXNTRi1afVVJahW7vLlwMC8C1QOzps3oURjlxa dmvkVbJUVrQLAQr+OB1hx+B55EqNA+vqcy0tBLWMPwhiFX4yZymgd4YUaPYx6ZCJtGtz TkxhnKpSPggfA2E1jZLgohFbmEA4X9gfjXuhCvdcUp7rTSLlcc8muLLDNZuTcn0eO6rq vy2XzSSUA4+Y6CAiP98bXvrS1uc7oKYDMusQAlRtjhx2oCwTvGU4uijb0AGOZMJfMp8g PS5A== 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=M6EfpO2AmlsI2DOe0XzrU1zVY/mWE6ZPcbT1wLb1NQk=; b=oEL59gTd3z6PYKJhFrMcGbCwmGAhG209d9/xRpvE8GkKTB3ao1Yks/2w60kaz5W4ju v9NvwK/h34dyT3uCjYY7DhSggY+k73TNdhC64qWO/NtoAKWijEyt9GQOA7JJ+iAYdnX5 X2mdMrZM37Dc7tmDnQBsl+bMxgsIEQCdp4g374al4wS1Vt8t8ICEuf+39F9nXbsUoy8C 8x5QOPTJPNjQp6ohWk+JdyuFuW2WYEJxjUkLK5MacHja7Kn6ZqKoLjJIs0gGVH5rbjml 3BH192eMa/K9r3XHQeXTov3g8u4j77LyyfMVBQmikmeuV1Rd0yyQGDPvy9WfX2xev8Eq LM/g== X-Gm-Message-State: APjAAAWCTZpP9wosJoe7UEf1swj1qNsIHxIXLyCa9GvtaoBGmLhHe+xV HCkBFjC/u39wg3uWtwi0ImmN0ZPO X-Google-Smtp-Source: APXvYqxqKGmy32Ujo0BCz2vrCYNtPj3gHXOFQuGtiab1Il7shpRxfNx4/7sGrlW0wTiMl4ACe65hCw== X-Received: by 2002:a63:6a81:: with SMTP id f123mr510530pgc.348.1565808430529; Wed, 14 Aug 2019 11:47:10 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.09 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:09 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [RESEND][PATCH v3 02/26] drm: kirin: Get rid of drmP.h includes Date: Wed, 14 Aug 2019 18:46:38 +0000 Message-Id: <20190814184702.54275-3-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-1-john.stultz@linaro.org> Remove use of drmP.h in kirin driver Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Suggested-by: Sam Ravnborg Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 6 +++++- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 4 +++- 2 files changed, 8 insertions(+), 2 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 d69b5d458950..9a9e3b688ba3 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -17,8 +17,12 @@ #include #include #include +#include -#include +#include +#include +#include +#include #include #include #include diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 4a7fe10a37cb..fbab73c5851d 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -14,8 +14,10 @@ #include #include #include +#include -#include +#include +#include #include #include #include From patchwork Wed Aug 14 18:46:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171332 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1202913ily; Wed, 14 Aug 2019 11:47:12 -0700 (PDT) X-Received: by 2002:a17:90a:ba93:: with SMTP id t19mr1008069pjr.139.1565808432599; Wed, 14 Aug 2019 11:47:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808432; cv=none; d=google.com; s=arc-20160816; b=nWUMQv+PtvQrlYI08ZGaoSpbO9ReXZUQj7XZ6LoC7SiwwkGN0/SV2DjAo8jSt1Z1NM Mpc/UjY0JHYFf9aqWAWm4QIc9cNRZCxf33KmovG6/Dfqubq1e+EA3qyyPq2aRDyDJAJG DMOv1BO8hMtBuf9nR8hu5uFqSY7F1ci20I+msxKZ/1rLA7kFChob4TsAVXwyRFdyV4ee cd6244M9j1mV1FxslFzZM4BMx3E/rh2VXFNTtHTjs9uGpMumPA09iAtZBcqEFSz+K/Zo Oj7KuNhYjgHuz/0C+h4uV5W4S9FrHogs9OlYazH3vmNnY86KURiRk97iFPUZhR5OJCA1 qudg== 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=ZyAGMPNMpuVXR2jkt8gh8WUfYnDQXgrGIfOGthyfg8o=; b=de9PFwblQShLppVvczfxA4mvF0/OWNv0Lsdgu52yLmLkzXI3NWL0elhE9DKrdwscXG q6XVuUj/6GCA8BU+N2wDmhJSZhJ+/s8fTo/lhhlRN2njSJOtjRgsGKdWe6asUwtsjMG+ cUoASywQTQ4JmyiQ72mqLzYlfJ4Z3a6f2pKD3+4etquo2nRwDkJ3qFapFRMUh7s7oEP5 N5IlVI+4O7Pg7ehKAVOKVwmA7u7Z6f+qtKBTlC4KZYEPio5OWLgY9ml7Eh10M3gVcaFX 4CxtTQxKqaBPiLF7m4Ba3LkJ8/FR0xO0euJrIf2bznWE/s1Lztwt28ebml3cbesgJOoY VJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=new8xX0j; 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 d1sor463612pju.23.2019.08.14.11.47.12 for (Google Transport Security); Wed, 14 Aug 2019 11:47:12 -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=new8xX0j; 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=ZyAGMPNMpuVXR2jkt8gh8WUfYnDQXgrGIfOGthyfg8o=; b=new8xX0jxsoxrQMLLTjQzxCi9sEMmOw0y08XqrmCsvQjSiFIOUH2oFECZQOjzm47Ew cXFDtMTKt5ft82uI3BfQLWS/OucPSunD0m00lu6dNFtnM4Yfuj6jLpUqfTpGMp3RlxqZ g9GZTqDt3eOQchKPiQOtPjF78VjyeoPaP7K5itoS/AY+LMzle2ccLPW5i621gwojmzeQ Udq8vzMc/+yOPa5NVaijaIrBenAGLaCwPGUnOG2Equi+zkUn4KWtg9NK6iSdxz+xP+kt Rs5sSj4j5c6LTIoBzwooGqYLjO6iXDjfUVaEVudnMBD8BHVXYJcYoiO7/SScGSbtiXo9 02zg== 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=ZyAGMPNMpuVXR2jkt8gh8WUfYnDQXgrGIfOGthyfg8o=; b=dIO1P9GX0GksxUzSf1HMxLcvKUq08eL3BRL5ECkE3FhEWPC5jLUEGytrD/h341iNOj 5sqDEX0qVH/52mF5QSiQVAGFfigz57jHOZms3bTcYi8mCBKYv/uPfu13x7Boe//7QbLA C7Pp5idCFaChYA/sKx2qWlaPeFSiz4Q2oh9KpfBwKOctSgfUZ0TuBdYFgNwMMw0TeABs tCQfLBVxuhgmy3inni6KxvybSc5Hl4wv1ztJKjI1cOZ0YIy9tO1+nMzH5BZokDK3qa2h pNrTBWmLchOvl4IT8iwaO9eBWqE/WkLQWrBbLIiMq+xgsMVPc1mIvyJG9yGVf0bXMFj9 G/lg== X-Gm-Message-State: APjAAAWshfxLYyZ05DhD4FtCVkhs+wnEPedhRzSrbmo2iqxLg2mA4qDR ScNjWvdBxVYw6WGaZ+bVLlp6qMu4 X-Google-Smtp-Source: APXvYqx2ATmZWXgkLdV3QzZflhCxpHcPXcxbWBN7V0nc/tthxryzI4TQboQLFuMmgL6bwajwF4MfTQ== X-Received: by 2002:a17:90a:aa98:: with SMTP id l24mr1091282pjq.64.1565808432086; Wed, 14 Aug 2019 11:47:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.10 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:11 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [RESEND][PATCH v3 03/26] drm: kirin: Remove HISI_KIRIN_DW_DSI config option Date: Wed, 14 Aug 2019 18:46:39 +0000 Message-Id: <20190814184702.54275-4-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 Wed Aug 14 18:46:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171333 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1202924ily; Wed, 14 Aug 2019 11:47:13 -0700 (PDT) X-Received: by 2002:aa7:91d3:: with SMTP id z19mr1370927pfa.135.1565808433783; Wed, 14 Aug 2019 11:47:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808433; cv=none; d=google.com; s=arc-20160816; b=mB7wQkpRBaeI5McB581DSIsHNv2ZBjJ4qSfCpTRFiffBYA04kJ0N0bo3p8ySIUETWK 0nLec2uhD2GHiuKlOXB4eZMmhtjrSoC29Nu5WczqrZd50Y3juq9bHR66qPRGxewOfOr8 o7qpMMRvE6Vv6VE43mZ/unF4r9m3bJoDvmTElQTBrR0DujahJfPJzKU1YUO9fnOzgLtj XblXautiWdlAhOsNPFcPv9aWwheOkG7BdHwgCt3J2pDrx9aKuCn4XsLcOWfPKMa7f5gD i7UX7l4joxu0XFptM3ktwKvlx2bwM0QEIeAs0l/WX2dUUxBx8opPJf69a1Av/+Lh1318 ZEpQ== 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=gZlqEMIie9JrTF+U3D4DkV2iblyXZl+ikNJHS29ktag=; b=ISFHts/1pdCSTCOMzM9BCGp5GkVUYhmMlMsktw5dcRS4fxX+3ouOCodZKp2Z9PH0uD t9QoK3rzIW1qBX588+KIGO0hz3kTQEV043/I5GHR5IG1qmyARBARymtPU+Xtsp3NPB2K jrQNIzRmi/T/QO2az5oBzgchijo8t0ZBQnsMrKRY54BLNqDkNBvETVNEz4VyAywikAx2 f98LbXXf6tHaz2c8p17Rkj+xVWYiEh8sK1NQ4YBo5omEJeknP6dXHJl0WKaGDPxbysST LIvaDma/4VL/4K+BXzCuP22papBf83DjU0Lezh90pIAinJ+OYdBLigKFCtxO75o64CaT twQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XjbkzQzR; 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 b84sor561343pfb.57.2019.08.14.11.47.13 for (Google Transport Security); Wed, 14 Aug 2019 11:47:13 -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=XjbkzQzR; 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=gZlqEMIie9JrTF+U3D4DkV2iblyXZl+ikNJHS29ktag=; b=XjbkzQzRC401HwYkgJTt5/alWGhUTRr63o71FoCDwgSKS/A9ToFGHy6O/sTVyshQBT XSD4Ca0pa9uCbyUka3KenXl3dh1eYFMQWyYVO5cA/ovDzDwVvf+MytD1iy11qXkqyxCX NaUKoffPiIbORR7QDPzRSpN9Xy2zHkCBkJp+i6VhBH6kNhFS5S08Qlz7Ox2koBMBbyNF 4ymd2whYjQtP9nQQsQSNgifPOO7LbC/N5sVhYMaSju0XmZ2eQK8HGJXNFVLQKUF2jRZQ AilqvhFg60+Nhiq2bOXaeyNEHLXwChnrGXdzWurJ3tBtQfJMpRXJgX2HT7Ml2BlPrxpv D18g== 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=gZlqEMIie9JrTF+U3D4DkV2iblyXZl+ikNJHS29ktag=; b=k0Fh+bdD/KWQC+3r4yoczTD86exNbEuYvKkjL5NI+jCEXCjSp9x4JoolgEfawGjxbq SHQW6wEQvVNGN5Y/gENi7lrFU0jUkLC0vIcO+OW3hD1LYfFfLZHCAnXNxWImQqzpuJXF GRu3cRqB26rUcPFs5/3mUTTSA4V23ITQXhs529k3+p3gH/CQV3zd8vJ4yuG0sR+0FlJg 2tpxF6uS+iKOizXuztS0B7/ZbamWmTTAYCrFLesfl+98DmVpzyH9Ms6j49fjRiMdBaij TesttARD5n3/iFXWK6x9mT7DNJy7BfHtfNFTJbybokQ23ZdSnYOvLBh56xOQhqFV3VF6 oTZw== X-Gm-Message-State: APjAAAU9QSRhNfse+s19R37SUMNzYWCm3jWg1gJVtltsDPkIN1kpp1OM olja3/SvwB6x8ajKrOrp2mhKKhFh X-Google-Smtp-Source: APXvYqx1pDSc+7gIkHH4h0G8/MwRFGnnNPGCkP3tXgf2O8GF8iR/6WPGPQnWYOIEl790rNNIoAnjfA== X-Received: by 2002:aa7:96b3:: with SMTP id g19mr1385111pfk.26.1565808433394; Wed, 14 Aug 2019 11:47:13 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:12 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [RESEND][PATCH v3 04/26] drm: kirin: Remove unreachable return Date: Wed, 14 Aug 2019 18:46:40 +0000 Message-Id: <20190814184702.54275-5-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 fbab73c5851d..bfe0505ac4a0 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -210,8 +210,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 Wed Aug 14 18:46:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171334 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1202985ily; Wed, 14 Aug 2019 11:47:16 -0700 (PDT) X-Received: by 2002:a63:62c6:: with SMTP id w189mr500125pgb.312.1565808436680; Wed, 14 Aug 2019 11:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808436; cv=none; d=google.com; s=arc-20160816; b=Od0EyxbxGtcSx5ID3phDZpvN8xvysiwH2yqVSCGjwuAGttTIWh6RS0zMXOBYiZq/As 60qUgzEthOFPha0X7PuMQMwLvgdYkcNgtaPeZtflOAmPF+s1d5Z6PymkZdl+TEEwkVcc EgOe8sb8l+pRbPJsUlKK1rBEw0dxzmOra3KaF1FC7PTBwF06FXbjPq2sm7iqPmX4P0wu TO48RvmmUvfQyWy3yy29w6WXWpWMuNdBFtMLAtMagrLkKxaslRrhGqsqSU6BLE+dChFE BcAsXWMCo2/wXMkgVbg2vDENgFpNSpL3+t/vZHF3evwF53LOJ0CQi1KiILrdvFrIvQwE rQew== 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=mTsaQr/BGfn/0oGZCU1NOuvNsQeVfs5BZ0y5MQK4HZo=; b=dge93KsxUW11J4R0EX2w/P7eiDuZ3iSORAnuUqx4N3EGHq5tDcif4Esmkd1+KJKz2O OwtFHieAVXcLo0HPwZBLKIK/7w3J/BWiIKcI11KVJP2EL4pKRE96erLIOeLo86SfgfNp knK5UeWuojRqRS2eqjo5Ny/RoVHuKw7SoxlwfIkiH0H0/w40Tt1BY9CPQ1Rr1FF8d07D +LB4YLSRQzj9uOxd3a0LTeyDZZkWkgLwTVQbMvCtt7qss3h8C8IjqJEbRCvYzMwlJkz3 rIQZ13Fa0JrWrqkKosOT4YnBKamf0bIPU4DZ5aYG1m+P2ooPSUmiaTqYUf2SBPWGmCcU RojA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=o3DL2zju; 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 i20sor596980pfa.12.2019.08.14.11.47.16 for (Google Transport Security); Wed, 14 Aug 2019 11:47:16 -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=o3DL2zju; 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=mTsaQr/BGfn/0oGZCU1NOuvNsQeVfs5BZ0y5MQK4HZo=; b=o3DL2zjuNDIUowRC65Y7G85lgkhRHxMh346JtwhfodzRxGUaYUKU+thJCSJsBe4WJi o7jmKjTDOR/IWLt4CEvdDBzJbCiK0WShw5JO4BzYTiMAqvi7HWFu5LYCg6b2i0126Fxm r5ZWEFL1w8WnqZj3ws34aNLYNJa1AdQPUI37trOnmxNtOVF83WFeJ6eLezTeE0zZ+AlO fE5d4qz1P03Cz5hCnJ56goR/ZbBos3YU7jph+HMsObrsY3og0t20I7qPD0xApbiUluqI GoH4QvAomVPnLnwvhXcLrPsEC2olYCDvoAdTpAYx2C8v1zSx97YBTjrhanjp7IytNT/6 5V6A== 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=mTsaQr/BGfn/0oGZCU1NOuvNsQeVfs5BZ0y5MQK4HZo=; b=sq3fKA0bmopbn+UXIizSZsXQvH6sgsqyrXtccgoD2oiL71X8K2UJDNu9CdmXNX2Ty/ rOxq4+0TIhepdIwsRnwkXxFWCt15mg9U9FCVrftSHnTY52Z8DABgBQb0fg48esF5U2Mm kkLVe7A8TmJh0BmeL4wgMY73Zk32QcKPxsYFhqzdiYg1luIfUILmtgnBD1j1BciP416z oLErodA9QvlHioWTwDO/hEO0j8RQzaZvsOlj5bRjT38MNBWd7k6Sepv5mPDh9SlTx8UI H028b5uxBWYVAvlpWcP9K5jURdFfdqPS1J3toHxrB1L3fH2bd9RTlH1gKk0GJYYK2q0l Q/dg== X-Gm-Message-State: APjAAAUagBLduVG/S9t8UuaJugDQC+dqWs7O88ceSKikkVfhSP0fIg4C WLKeJvxSm8VlyoICgbS+16aynKiA X-Google-Smtp-Source: APXvYqz9sWuMrYnJ71oWGt4PPF5S0nMvyCRFGdTZmp2X1HPVn5mbdmlna+I0NEyr5eJPDQFLrW3tHw== X-Received: by 2002:aa7:90c9:: with SMTP id k9mr1332133pfk.171.1565808436316; Wed, 14 Aug 2019 11:47:16 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.14 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:15 -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: [RESEND][PATCH v3 06/26] drm: kirin: Remove out_format from ade_crtc Date: Wed, 14 Aug 2019 18:46:42 +0000 Message-Id: <20190814184702.54275-7-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 756aefd5bcff..73dff21bed6a 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 Wed Aug 14 18:46:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171335 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203013ily; Wed, 14 Aug 2019 11:47:18 -0700 (PDT) X-Received: by 2002:a65:654d:: with SMTP id a13mr512190pgw.196.1565808438190; Wed, 14 Aug 2019 11:47:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808438; cv=none; d=google.com; s=arc-20160816; b=sYoSeDp3qPWHu4/5k8kqr1AhJMxqsC9smKlW3rmTGwVvX1izP2jpl3QHOKPI/d1p85 mrltIGdJwqvWnbnyYGuoDLNnx/edjoDfTADXwD8cXUlDiMNpOQwk8cg43AzjpoVXBB+6 5IVNIsDoLyQIslexEXWVEnLCzi7xsQ99wJPJccVlAzNtlx/dIqxiou382mHe9wkp/jB4 IVuvpdJMm5NgzuLHfMuPGRTlIcpG9Kp8h+3v2+/upAJ0bAWBBKmrnoTYfIqY8Er10GNA /ynnlkWUCnhIrUeXIoN5Mn112CXSLWeKrN9302fBE7luPD1VjdEHK/zQVyezqRRrUBpm r5wg== 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=YedoGxgwewtM0MaOYhEMlQwwrUr+pL9zd95traMVohI=; b=S2UbPXk6XIjNoTcHAmQUE/5C4V/a2KsYobCMNdBEpK/Sw+wIcRBJkeM7MiEw4mruf1 A95OTZJnigICl3RFhreQepZaC5r3a7PXodCS1ONUh+w6XGv74jV6bnsocGqzK9XuV2Vv iW6TatxWtkuDm7BbMHU1iS9gfXyBjQpk4RYVOazlak+OYNEgj1Ssp5uQ73eg0Q+YlryV RdyLrEK6bohM13BokRVDiGH8lQ4s+BA+J/nUmY9OMQCYX0geb9kzd0IPZmFuNv+X8OMW OlV4fHt5Fc2Tt8OH7LM6wmyVDm0MGs8ufuSug1tahtS1+/R78IEUf34Prv3mPZhJiCp4 bHLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xE552AKz; 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 j21sor616723pfr.2.2019.08.14.11.47.18 for (Google Transport Security); Wed, 14 Aug 2019 11:47:18 -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=xE552AKz; 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=YedoGxgwewtM0MaOYhEMlQwwrUr+pL9zd95traMVohI=; b=xE552AKzmeFQqQGiyhzB7OArKFHfpCKYogsjZANNkX8SJ6t05n6fO+5rrc++cLBf54 SNAdNPI3cZ6nHZq0q0eD0B17oAMAI/MnvMNJPnw4OIUirFXo8qC/op51FkyD3JeayMJB ZiLcxV7kh21bUa5VBuKpdKSwTWVUkmEo0k2TDU54r/dwXH94zr6kP3PoS0eHNWdIjxta UI3C8Q5Ystyqc+H580oXHqN3QZIMI396s3dXv0zjGiQJB8m8s4un/j9dA45C5yQ4xqfE htgoDF9k5p03QW2rn1jbmGO1WQhPOFpqxNfyKvfBGeId74U4C15CLxPLedmdcaXms9dN Pilg== 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=YedoGxgwewtM0MaOYhEMlQwwrUr+pL9zd95traMVohI=; b=ebvPYq8pMzT49UYk4f07RBzwsXJH8CM/CAsh8WMBpFAzsgMouIpZdvdBM6FfLGnl9W cVs0c4GtP1+04NXxr+K4hKDDBLK9tU4YsF/i7oAvnM//VH0TLNhmUwCkLknlOPcKG2OK oTUJsofgC4wdHXNqrtTFWuXLbC6iQ3mW5M7rMXkCzdYx3mKcYw8qMhjQZe3guSDnhyRa +/KKh3YfqrAddF9KiuOhzXzaUJ8bne15wBjqDba+WJ7t5hvsLak/F3MqLiUUH7a7AuY6 CQponzmxqnrY/YTvsqdGK4nKlBvd296OA6644/sM/nRmO2Ybjo3v4o1gNgHjqlDGqz+y owoA== X-Gm-Message-State: APjAAAWLKZvzdZwERQoecLsnKcshse+nCaMhk4UvPyeAsX6YRjzIXPU1 r4w5IQhzOjnQdV2Wq+11TPAsQ1is X-Google-Smtp-Source: APXvYqzwNPPrTdleEuLKHgqBNUXfY5/qSsznFarfg0QC08thyBHNTJSm/nMXPNVi5BJeU+5fQyKOWA== X-Received: by 2002:aa7:8746:: with SMTP id g6mr1313342pfo.191.1565808437798; Wed, 14 Aug 2019 11:47:17 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:17 -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: [RESEND][PATCH v3 07/26] drm: kirin: Rename ade_plane to kirin_plane Date: Wed, 14 Aug 2019 18:46:43 +0000 Message-Id: <20190814184702.54275-8-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 73dff21bed6a..c09040876e68 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 Wed Aug 14 18:46:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171336 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203053ily; Wed, 14 Aug 2019 11:47:19 -0700 (PDT) X-Received: by 2002:a17:90a:d151:: with SMTP id t17mr1108586pjw.60.1565808439726; Wed, 14 Aug 2019 11:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808439; cv=none; d=google.com; s=arc-20160816; b=hRvcwwGTO+zhK31qLR6+tQ6ZQeIvqYCw/adyohXz2CoABBNaz5lE4upMTlkGXgF7OV iEPDb1H07nypQywZz/uC62NzIG1eFmhebrFdlPSM0nlZ9TvCq9msZsjiq7KmKa6rIKTp ZjWDTLl7bpN/hAJo9VfW1+2/mrtpiaLcRf5TZQjMRcBQremXFtMyB1AYdH6wsCmERQgy rBQu7TciWzORsLuR6Enxd2T7R7jS2XyDuPf3jTLupSEUAhAfqMRIsAz7E/ou4AkHeV6Z KY9yj8JqJg+X3cNK2qZlj9oLeNjjeN3c/KKPpsaUcbam2+7hINKKuOLeCwx8m3RSYHS7 9WCg== 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=Fr+/Pi2S9B6wdoWpzoVvTrtF22yjLCzedfYpDICy2D4=; b=QvGJ8x1wT+nUAs86aKyKD8n0LDWvqlbwEb6ZUDe8KyVsMehQPhB3b/4c8g+KBW77N5 rhJ9ROSgjFcGJYzLogEB+wkbFZgVBeDzlWTmmx27UKMe5/wPqGGtub3CZSDIvg7CE9xG pfKMLvqTWo0IPOywZomc7POmOTlKfi47SPLL+P7t+QbSH1lFiuCWd1+MXyZhySHiqPBN 7t3CQUXEQuG9KjuQB9RUfDcQogahoy/LkFIiKmqR0PzA0P30XsOt0pOTkIlK1M1xEjJZ x4ExBVHTsz6wGUNN8iL5CqvuPfjF+oDx+bpSJvv+gQW5sO/ITttUZZaqcrGT7vnTcnGZ XhIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Hzt/VeOQ"; 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 t1sor473105pjv.17.2019.08.14.11.47.19 for (Google Transport Security); Wed, 14 Aug 2019 11:47:19 -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="Hzt/VeOQ"; 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=Fr+/Pi2S9B6wdoWpzoVvTrtF22yjLCzedfYpDICy2D4=; b=Hzt/VeOQAtc+O3ahVY5yzSd/gQ2fP+233P1dAlG8ZFYWfpXRv2yfBBpmlp4s74nw+p bIdHX1J6cXzJMQwUL4Qmle5pzI+YfInoL1NGdUXnfT2nECm8GMUSJyR+8CwOxZJD/Om2 LY8Zr3ttUQCTgeUJJQWIo3hkiAm0ymc4LKv7eMviU4lAhBZSqppMPoCftbyGG79EggsL /GN87Qxsr31JNXngR026FyQM6YYj8e+yQ20e2Q0oAKa+UTJhu0YAoaaAGfkTeBKC67lP nTboFyQegkbmQFjAx0R2XXZqb+liiIrJE1UWQ7HxcaOo1nfgl60mZmNNEsv33aJZWbWZ NmBQ== 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=Fr+/Pi2S9B6wdoWpzoVvTrtF22yjLCzedfYpDICy2D4=; b=PJuR+raw33R1oLQNSdISBP/oEgBR0z3Y2sbXh5Paeh1EaMuXeQ3fSVAndli+IT1mP4 vG3EX+073j6KACGhfRo2TjBPtt1sOjs8HMcmLLdulXOX87iHuTMyi7V/2Qjih6kTVJMr CqjPSteZvNFUNUIXN/0A7ESyczwQ8ZMgvPlkB7NtD7k2uArWkHvcCfpbGgANOczYtBW6 EsR+Ghp9cmQSexn2HsvPtvThWHgYxU2VUcqa+bEyOkjo25xYP7eTG2TGExCcgQRiGO9h F291GzPKNhSUXF6fuCrc+9kGWJbF8ibAkIyk2ADY4iEHhOlsmp5vFNrP0Dt50PWDMexc +f1A== X-Gm-Message-State: APjAAAXZdQ7kRxGYMxLETdKjHqOrSz6vIky+0IGuHGIvONqD6YS6Vyrj e3nvAZ0OoEnklD4VqTsxA0JfE6sg X-Google-Smtp-Source: APXvYqz25qEBowXuYDmJdMucOPok8ZyYp867yZ9aS4rBNEzKeqLTvI4N3IJIi7WYdVx+Z132OlVR4Q== X-Received: by 2002:a17:90a:db06:: with SMTP id g6mr1123686pjv.60.1565808439301; Wed, 14 Aug 2019 11:47:19 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:18 -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: [RESEND][PATCH v3 08/26] drm: kirin: Rename ade_crtc to kirin_crtc Date: Wed, 14 Aug 2019 18:46:44 +0000 Message-Id: <20190814184702.54275-9-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 c09040876e68..ee3dc3d0f738 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 Wed Aug 14 18:46:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171337 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203077ily; Wed, 14 Aug 2019 11:47:21 -0700 (PDT) X-Received: by 2002:a62:7d93:: with SMTP id y141mr1411395pfc.164.1565808441244; Wed, 14 Aug 2019 11:47:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808441; cv=none; d=google.com; s=arc-20160816; b=K8ZsbwQIONezkpp2jsgphmLGbhrPMQrYnH/2mPg8f2zHnH0dgNZle3kzRIXcCqIIfU 1c/5y7g230fuDj1c4+IcCpX5XsWepxkWKjfTpGylwAnoimTZFPDot8ZlyYhQtJS19MT+ hIYUxMdQ/kcYjl2GqLC4C7StZbCzVuFLGY4h4mLtNbe2JewUQOa6AIbG2+NS+oOS3PX7 5QVUhQE1Sk7EA5DwVTCyuE9T5A84ESB2+DlEUwH/AjRGoH4nFBu9Z7YGfgqIQ+lmT1bR B+CmayfE7GsNYsXjKiw6k30M3CBLgc+4br/JewDAFY0uuvAYSFsIxqJiTWtYh91bxmqQ l3rA== 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=S7G+b/AKW3ZGIOc1Uy5hIvA+emi22Ls1Jq5SWNDVSjE=; b=hi+HmKeUvz6gst77lPxyZ6Y2u3Z0HPr8jI2l076AMW0cn6dUqfFZw7QAUwEsxpgNVh oVGkIMdv/1SP9vc3difTsj9caJIp9g3MvT5Yqb0dpt801BKoV+HSiSWRLasZ4APxwxc6 Z9ni2I8FKLY9rvGCoNw0QstW8wwZJI05CeeE5pM+UouaN2JOLfMwl9G8G6DUUi5dB/Gw ORA2kfPTX+7HqJEJWwukq8Ex4/OGdu+/NmieGjJuEKB7uZOv43ZY3ioXBcbA26Af+7Pp 481f47nlZ6NhHh8GH6IDxXj0CnQWhkUpoueBC6+WT3q/hby1PnX5yEHqtSKMnWcSZ+nF 3rWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nc6VyDeL; 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 v13sor409849pgn.35.2019.08.14.11.47.21 for (Google Transport Security); Wed, 14 Aug 2019 11:47:21 -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=Nc6VyDeL; 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=S7G+b/AKW3ZGIOc1Uy5hIvA+emi22Ls1Jq5SWNDVSjE=; b=Nc6VyDeLkp4MAbOVFgNDIEDfMdp0ijLVLpHeDJmme19KqUpqX+fHbwurSw04qnZLL6 JCH6P0UQRYb7SFDeqHuj41hMixuWPJJFZq02BBnWJHH8Mli44qR+3YT9X8om9y3/SV30 BMgRd0BMrno37eHclBWeNqb0d5vSye8FVTVoMxjuERMYuFKAlBvlkcpgmZ3N1wrXLVfR KmuQCmk7+BYlKXZkuwDxhTVdB1fqRdO1uSGNTOhgpJK8TebqflZTQdMHQ7UL/11w6CIv xLO2aOYiJXhRDZc5g5fR9CSuHMv3rSOmlK23rcUWy/cIHjKTlcRVmcojG7tgnCq8cnWb dLog== 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=S7G+b/AKW3ZGIOc1Uy5hIvA+emi22Ls1Jq5SWNDVSjE=; b=ioua2/auv04IcJUyJhVZGT6q0RHWarh40gw2NfqpIBtwmRra+yWoybcqLn6I+SNyXT PQ6kvDobPrNu0Un5iq1sjwwtV7pgIsdaox/e2QIpmTHpdGlyhj6OV1VC8lnfFSguJo9D AOsJJkOT7r8TuyJ6DJ4+9dvqhkreKldpC/+tJqyQz7sOs3PQSEdf/VRE4GfyphWS/vB8 j5kmVuVKjZz1cVMQ0WrVMpBo8jH+7SZ4gwwaYnT13E+gykivdY2Pm1KyRWo3zFO1uMuD wumXtqBXPUU/QeHXtiL9ybpFa+iboOMtknGQt9L6udsmbDx1l19/FqTDQ8o8ZTLctSSE mpoA== X-Gm-Message-State: APjAAAX9PWT5ilZBOUBp62t+oxGe4xaZgsNtnrZ5K5l6zIVEXw7Vp0Yi JP1YUvNnDaeBcHOOb5UrM+jaHtLa X-Google-Smtp-Source: APXvYqycFrgHQDs7Dh4+d+eohgA56r1m5xdvJK1utw9z5PlXMq5ucRmdbzs2NNCTGHKWQ0/rxxINJw== X-Received: by 2002:a63:4823:: with SMTP id v35mr517107pga.138.1565808440616; Wed, 14 Aug 2019 11:47:20 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:19 -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: [RESEND][PATCH v3 09/26] drm: kirin: Dynamically allocate the hw_ctx Date: Wed, 14 Aug 2019 18:46:45 +0000 Message-Id: <20190814184702.54275-10-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 ee3dc3d0f738..ddcfe0c42d7c 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 Wed Aug 14 18:46:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171339 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203095ily; Wed, 14 Aug 2019 11:47:22 -0700 (PDT) X-Received: by 2002:a17:90a:8d86:: with SMTP id d6mr1093983pjo.94.1565808442707; Wed, 14 Aug 2019 11:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808442; cv=none; d=google.com; s=arc-20160816; b=bb0DWUvsBLd+Ev+8KMUqaP8RARcwiIlm9/wFC71tahcFdUEJjG7Hycj92xgPurZku7 vGsfXJTT+R/t8fMNnwE3XGm/16TLc1FS7O4MPWk+ja1sJ5HMkdQWslx6Ri7gCIXNfC3p RxV2zF2rNx5tyeT7kXpHmCgr6qmGmRaTmNAfLNDjq8javRFMsD/Txrhqpb7y9gV5ZD9m o4qdnUxLwhvoq9tFjPozvuhQDFBKlWwMFuAj14knjq2fkYAp1LXDuYw3xchhxOJ3z1hG RlrDnsPX682hbxACtuWBv5T1YaPqsxOksBhHlYTcM7FUsRJZCjy09DSM1Y/QJzDMmTlE xT5w== 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=wvK/3ErN4wAOUGSP9sa1Evt1Opo7B3qrstIX5kiusy8=; b=tOXmDTIRI9KRqcURVHFskdtftZahyOSkrdx0IAAILiNVSgRKvnm4AsQaDyObxo56QQ PNU5Jj3sf3o4ePJQlQmii+h/TaA6z+Z/PmULdr9hKFmaWCg8/C4Sou2VGbJIQj8IceHA 08s9gqBb3IThXHYE4wJ8s8a+BqAUQJeOVR4Xe9ztga0kVfG09qANsX5yjG5C2eA0DHvp YCMNfW9kY1sHy54bVIodruBi9BeiUPMZvmDXijdA6QgNrJajFqDDUsH06Sc+KjrPAboL Sif48COQFkMu9rrjwcXlRPJuuy4sFA2cBO3eMdWaBhyTeU4bLlUpbkoYLwn14fIRdRRp FU5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cpfh3NWH; 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 v5sor546058pfn.71.2019.08.14.11.47.22 for (Google Transport Security); Wed, 14 Aug 2019 11:47:22 -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=Cpfh3NWH; 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=wvK/3ErN4wAOUGSP9sa1Evt1Opo7B3qrstIX5kiusy8=; b=Cpfh3NWHEHi6l8EB8XmZOgSh/8o8G7lgNUqtXNmdAYy46WXcYN7FqnitHrZpXc5hJY Z0IxbY5zrAsWaPqarNxK7pVLE2HV9yf4QyHvvh2iRKmb82vjnfg6yHckyMsFMPDVkw7t QSZ4qLug//fjGz/4FhMH/8rzP+v28cl4foKvATTs+UG6BEl9IY53kDq9fn91Jwf+pgBb ZFAiLfeCPjoJoGKIUoi5XauHXXHY43JTruTkK/FaJtEJm+/iwWEW35Nr6KqK4ImVQO25 iMEvMJ1SkAxDIUaVQey+/5ch7rJmbiM7LS4qe/EsNitcUaOBDCRLq69FeyO6c1EMqlYp IdEw== 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=wvK/3ErN4wAOUGSP9sa1Evt1Opo7B3qrstIX5kiusy8=; b=YBAnGdCE70YAIB/ivzh8s1Qco/vatNa4p5suEx9i13GLTksyq6ThXl/119GOciTRhi yq5eTNQoYpm1a0lyf15LIykKGcwIn3mQXFVSEoProkpmge1zn7L5LGP6dwZDxKJT0Z3D oW/z39Fmb8XXu9pSXXIf/hvAzn0gBXpLnR4wST3wRj0PcVDZgZnUvckbn3Typ+bQOWOC Q1NAbWdoYQCPx/YMAQZNezerxCo/08xYKy0QlJzxB1srS3VJtiY+lQsK0cS6zxjPyjxO 5FoBGn0xd0IXa2RJ4wN467Aty4WBjTK+Ac3i/6BQzd5Zs+0VrrLTrkxYWka00TUIzLFC BXQQ== X-Gm-Message-State: APjAAAWN9CrFSn4t0sFVbqX26oh07DYpHx1+5GbIVbPlYW5AsAQMj01D ZjCwR68/tzpDMuv1MYDcB9Aa6wQi X-Google-Smtp-Source: APXvYqyZGdbkXmqHNPSUFMNgCMhpoqA7AKg44U8bK842JHx9Nz1jPxGzeG5oT2vaCVVncT70GRIABw== X-Received: by 2002:aa7:8dd2:: with SMTP id j18mr1419335pfr.88.1565808442309; Wed, 14 Aug 2019 11:47:22 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:21 -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: [RESEND][PATCH v3 10/26] drm: kirin: Move request irq handle in ade hw ctx alloc Date: Wed, 14 Aug 2019 18:46:46 +0000 Message-Id: <20190814184702.54275-11-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 ddcfe0c42d7c..0e0fe1cb945f 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 Wed Aug 14 18:46:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171340 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203134ily; Wed, 14 Aug 2019 11:47:24 -0700 (PDT) X-Received: by 2002:a63:e901:: with SMTP id i1mr449056pgh.451.1565808444507; Wed, 14 Aug 2019 11:47:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808444; cv=none; d=google.com; s=arc-20160816; b=nqN7wx4e5opY3JMIpiiD+VyU7oQ6lRBSj27k/Beyu+eMSxvJs6wbtjpF5THuJt+LyM P0gcrl79D8LH9tmKbxwb1I2f9JcyZECjpamtUnxMPdoNXR/mUWJf/lWrwflLGpXoJPck YeHU0Ohs0jH6UUwpmj0yvKr43cwcz5BaAecycDwzgnvzsSbqNy0pTXwyUFXPLuh8Hr7A clpnnaja1I+lnlfku05HWdb4uO/+s00/iHtQb+wSzeW/aciBa4uMea7UHkamjR9lWHRg A2jpzf6zpten5dmi9rPvuRBqb2QCrVmLDUxguriHmT+HZeszPkUbeTKZz8AKBVLSYz/w ea8A== 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=oF/wbsoL0VS/wbGpdQ82+BUReXpcSGsjNr6ZOoxveCE=; b=DzezC4JDZOneNJ8nUQ8Afh1uhwX8riSYbc++RncV3sY2r/mGU12OScrmGCcZH40WF3 CG15pHL/FVQt4M6txRKfM0zayjFVUj7BzRCdMxJgmMOnG2ejw49cHOhGRXEA2G3pCVpA 0jblyOM20l17joGqKahxvgvP94VE2JaZ6pZ9dYGFRMVXk9TRitw1264HJNnAEwYLMoNO /XwM/kjxtiIoFpO0jcEbAYN1sOSGsogW/7xxnysaqroK6/kjT7hoJzNJ0J9Rj+mndjBJ 3pprNEoKVjobF//bAJxBYgnLLbmNNa4P7/2EF5KpNIOMEdSj942KNbpyT+X6QS9ZiPBs QD1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fbE+WUXe; 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 l13sor412479pgq.30.2019.08.14.11.47.24 for (Google Transport Security); Wed, 14 Aug 2019 11:47:24 -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=fbE+WUXe; 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=oF/wbsoL0VS/wbGpdQ82+BUReXpcSGsjNr6ZOoxveCE=; b=fbE+WUXen307U/StI9D2O7GIdMzehRpD6EtZen5vznPou1FPyMwl/2Xxzt4nMi0Wa8 rcWMpKaVL9QJEqXN1S1DhwMt81wV9iG1G/6oKUsCcVJ5yLGNWbBn2ED85dp96DmG8N5Y 3+MAEKD7CVRKwn5TU2L+IcKTbCd99tingrjVosZlgwpzyfITUpDY0VnmL4vTXg2ojAWI Fq6dpbIOcMiD7DsNZ/R2k3ON8TyRwH0VP+IYRWl9UmU1cf1YzSoAv6oGBf29neQ31Lvq 7gUwiKmxVzWTxufpHByAIwKdCWpsjinRfA/5l5yIUNiE8pnt6qG+KCo/eXCYHWwOTyQg yk2w== 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=oF/wbsoL0VS/wbGpdQ82+BUReXpcSGsjNr6ZOoxveCE=; b=WWI6TdtXLsy18q0hvSiyvdrR7r9ShDkklP0rn7ikCEjiFocc2LW3FYx2D19F6YL0t9 ZbYkUvDWvCDeVG0iAPN/B1vBttHc/RGk3koMxa262W69WcG0l8sjIlWvmSpi9p7r+YtD GeR2c8Uv7EaP3BhlZLP3VPW//vlbdrQZNqOMBjOLV/gNV3lQC2fpMeLaZisE/ziTSH8s 8pQ+CTxV+YfJQyczs7HavR/lWUvhFWRIBWDQaWw9liUBythpZEw/CmbkGyhOSNW1Ng6V XWqiGiXIQIvfgQlRlLDxrJKAmK6zMMl7pWl4hqitLd113f3u69STMXUM7mtxHUmy8DX/ /+gA== X-Gm-Message-State: APjAAAXd0GwMDr4YeVRXxZgzgw5MVHTNHYTLC/XU0+h3UYYGJMOekRVp BOY/qLzdzznqTCSSiR3GyJXrfwWv X-Google-Smtp-Source: APXvYqxwrcP6tgZ+Cn/BGiRQhmX25xrIEbmdHjEGFfzqljCsAWuX2UCiX97DGxggqL+Pgk1BdiMUpA== X-Received: by 2002:a63:b346:: with SMTP id x6mr519112pgt.218.1565808443994; Wed, 14 Aug 2019 11:47:23 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.22 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:23 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg Subject: [RESEND][PATCH v3 11/26] drm: kirin: Move workqueue to ade_hw_ctx structure Date: Wed, 14 Aug 2019 18:46:47 +0000 Message-Id: <20190814184702.54275-12-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 0e0fe1cb945f..ec4857e45b6e 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 Wed Aug 14 18:46:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171342 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203169ily; Wed, 14 Aug 2019 11:47:26 -0700 (PDT) X-Received: by 2002:a63:5550:: with SMTP id f16mr517314pgm.426.1565808446057; Wed, 14 Aug 2019 11:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808446; cv=none; d=google.com; s=arc-20160816; b=Br7AvA7Xouws5VzqLjm86yDyc8guPNo0v0BvYrobMc91CF8fnGNQH2GMic/2/QKpwh z3z7mwPgiPi2HP9hxdqLbB5KUlPRm9kKrvzwlh8LQso/SYSNbBO7XWtCAR9JNwEOq4nv RayfBv5evTyRorCrSomsa7aEaoBEpJADb0wzDWZ7iNT7xxKcKEjZnxSkBipHBt+oqZnk sWHM8RaHL6SS9GAjFH4uQTA8XqfKVdevE+qtmMJcLMdDB9s2OZmIilgXSRT1HSAMjTo/ yArBSSS8r1VZ0ExBr1HM4wudQ2H6uKg1yfTNUPUAFnvqk0KcCay8uz14l7F2i7Ycoqq/ Xpjg== 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=wKlIaA25olU11BOMfTs22yk2wQhbHWnGWzmK5Nr5c8g=; b=HA8fhqCmfdK5UPYUtavdSxVfSCB1ACZO1QjZkZabHipelAiaA8dCPkfEpIe6jFSSwt IKuPTrbXJth9av2OAke/o+w8ZodBs/++cKxUmA++tG0c/VYcwPzZXe0/WjsNVp4r+C25 bIC4pV+37Lk+yfkUjcaYgZ9QOXFklEsbWvj/QoIu1FN+8xuDvOrogXVtALD12EKTPBHe bO0zwif56/9PKg0ZbDy9hoCRLFKqYzF46u8gNyjJSuTzZmLo5sO2Q9TuYrIZzEv2UOtN S2wLQDGNkLnaZ/50RwXIwWtqAf0WLmnakLZR2ThKa0agiBVoq7NxWSm2+1sW3EyzBEGT lLfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eZzQFn1v; 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 v11sor482548pju.18.2019.08.14.11.47.25 for (Google Transport Security); Wed, 14 Aug 2019 11:47:25 -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=eZzQFn1v; 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=wKlIaA25olU11BOMfTs22yk2wQhbHWnGWzmK5Nr5c8g=; b=eZzQFn1vrMPxI+c/iYaHjDFjdZqtfub5KdhWWCpMgIT90qc4LcH6QPySnBMnKqR1RJ hWFUlAp61oTrgfMmqMwVWrLDY3uwozkSqtAfucJDuU6oeJex9OI7lG0TKSrZC8t/+sC7 01P64SsD7fNSJ1fg1G5K9qXI0autzHTOrULBojThGkp/bgYTBYBa8OrdYy09/tid3Pnz BMO0eQKBVdfcT99VfcCVYGNbxzc0RsJc5lTLl6njbbQlHkgbOFN5RJPixCjbNmsdV0oT EJ46CZsKSnu+joJf8KYeWOviuK1PlsrCh7YHL94bkMPJNauTwDcq4UAB4xWnJYDqELDC GxVQ== 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=wKlIaA25olU11BOMfTs22yk2wQhbHWnGWzmK5Nr5c8g=; b=GoaqOS1UF6XZKlvGSjFXb3GA0udVukVts/IzYTSAGgoq6PZAwsJqbc+r7rkRxQXV4F 2A+SpMnrn8squcOBXYeRE+ckNYTT/x8N0Uz2/RCiPnLPAa6T98T4F6Pgeby+4OC9RfrT /sM0Z/sL7heuaixSuewzUWWDwBzSVWwHU4dRvGwNuwFeSkHjnn5w3W3uSPdLWSHoImaK ppRWeJP6IvZWT1IGgonQP5Bxfpo4tPlzpeXnSaJY1e+0MUDDlOdm5Vg0Vl2Hqxtw6bV+ xCC9pP7P/s06ubG3+5ZuQ6t2o+ZTAl/VUyvdQTB/qQ5B1J1lZ0GBQe6EJAbWqEm2BHLM 5Qog== X-Gm-Message-State: APjAAAXG3AcV+RXj7A51P0fufzxaTzxCj0i1QVG8gAJbeVLubAK/lsbj n/kw6y0Jm3sd4bCedR9VS+YygPh+ X-Google-Smtp-Source: APXvYqzHEij/L3W78cYXzvyGC77DpNrqOmQ3aeVR5dxILgGVVx40Tz9jy8wBE2fteMZvJQgodyXz5A== X-Received: by 2002:a17:90a:1916:: with SMTP id 22mr695571pjg.62.1565808445560; Wed, 14 Aug 2019 11:47:25 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.24 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:24 -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: [RESEND][PATCH v3 12/26] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Wed, 14 Aug 2019 18:46:48 +0000 Message-Id: <20190814184702.54275-13-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 ec4857e45b6e..3ad1e290bf58 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 Wed Aug 14 18:46:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171341 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203199ily; Wed, 14 Aug 2019 11:47:27 -0700 (PDT) X-Received: by 2002:a65:430b:: with SMTP id j11mr458819pgq.383.1565808447366; Wed, 14 Aug 2019 11:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808447; cv=none; d=google.com; s=arc-20160816; b=Te7TA7/Ro2TE/BW3Sm16OlJU+IVnzbGCDmXLa690eLWGlbcc0U/nlNLFAE9BERu5M5 HWe4zhQndJcCEcwr9yMUCdXMmvNDG1KPXsdAJA03QHkQVAFAPhLQO/Fu1fIHk0i1l+lx EiWaQgr+urOGh2E/XJWeNrqr8RqRH+NINMAfbw5xwH3h6fE4WvnkzIWg7hE1cmvOma0i KP+ehVh6uxO3eNOTnjooDl0w+s5p+1lAPKhOnPYc04Kv05QNVPv0vRBPWQybS9/WOYnt Yk5Hr3FwRCZMA9phDkTcqbtb7HDHT6cvbmhZFXGT3n9opRYD8sINDXWYP4NEq17awPaL 7NgQ== 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=sfKXX+o4Qp2/I5oLyNwYp5frrb8P6SiEjD+Gvi5BkT0=; b=wbbDGYG2wEXs1nEVCrnpKtgxDWGOpzRquh6aZhIPll517YOmrwVXoyRnm3AIz01Y6W 6Q1sTeUHSHzEYfDFEW5+Hx662zrriCqtM9Tw2pID0pD37TZTOV6xhNy6h1yMKB05wvKd FK8PE7/ao5C00li+WkD0MLL5h9rW3Sr5pm6OzbQhp6tZvS7vogHZkNDCb2g0RlA9sJ9y UHVdQn6co829+cujF3MIiqbvUAhu+PFdfvH4Mg7j0LPQc0XSnoZz96eyo30psqa/pDGz L7rHuwBtoZzQkTP0R8wR2fnuYMN+jSz3RgKRW57eqCrgDjnHopBMGfFa+vzOk6Nz8qd2 /f2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T9iZEwFJ; 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 i3sor508752pjt.5.2019.08.14.11.47.27 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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=T9iZEwFJ; 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=sfKXX+o4Qp2/I5oLyNwYp5frrb8P6SiEjD+Gvi5BkT0=; b=T9iZEwFJF+TJKY0hHgQxpaN4a7p8bUuNIhxCNxLQu39fiS3b6qpIngIlGx0/PsKPxL 5BhpUZFNY4Y1uicrCiOl/ecaqtix8bpnBrPTriSTl+FU6MvKZhD40K1X9tpi1TJvUPHm ZcAJO5JN/u2+RtuXPVeqCXTc3hi688nlSKe/ziB84VAnL9rED7HxiWWfh4RFYEADZwot SFUn3RzcO/DdUz0dukUuu57PdnIWrfbgtu4pdiouqY8sD6tKNiQFqbIJ2WGGR0Ld88tt +rvamYv9LUD5NWc/6TOtfO5PHTojq78/3MAmbMdtuZTQZHWhgnPjE3bkqg75GhB2aJe5 AbPQ== 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=sfKXX+o4Qp2/I5oLyNwYp5frrb8P6SiEjD+Gvi5BkT0=; b=HgMBImbMUtVngoH8bjPBGZZviyNJzI+qOeIl/1AWbWjLR4EVb5+XC2IdDFJ59XE0LM rXSgtWvusekziFkWL1TopZV4p7mcGow90nDjUXZfP+WjmN59BTCpZQKsTcbndHCrB2/u ZcZFmVQPxfLOiw3RAxHmt/YNVvdc7bhQLEXQNkfcdFpJFUeZb6dZWlfA/AH/QCHzCBKp jQE17q2vcYKzPZl5bCVMVl0wOfH5bLSx1TrnoO3/GHyGrKGkj3PkS8Uw90wemMCl7vcX MCkXV7KLg7x24shTbpMt5mzWWCsuqgYWOFUsMDXCJkev8QTRcN8dha7O5nWaLmu1FgP8 m1oQ== X-Gm-Message-State: APjAAAUXdCCLMyhJ4fZ9BRlizcvFTa8RyMzqAika5zoA95Zp85/VdYfQ 3drF33D1dLQsKfJsSOjU61VLZd39 X-Google-Smtp-Source: APXvYqyti+/OTVYfzLGL5f/MtTZ6Q0iILK/4POxjmbTxxzDN0spGBwaiT/XdSekW3R43JNlWtf0cCw== X-Received: by 2002:a17:90a:5288:: with SMTP id w8mr1079972pjh.61.1565808446871; Wed, 14 Aug 2019 11:47:26 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:26 -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: [RESEND][PATCH v3 13/26] drm: kirin: Reanme dc_ops to kirin_drm_data Date: Wed, 14 Aug 2019 18:46:49 +0000 Message-Id: <20190814184702.54275-14-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 3ad1e290bf58..acae2815eded 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 bfe0505ac4a0..60c164623f56 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -28,12 +28,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; @@ -67,7 +67,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; @@ -98,7 +98,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); @@ -196,8 +196,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; } @@ -215,13 +215,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 Wed Aug 14 18:46:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171343 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203232ily; Wed, 14 Aug 2019 11:47:29 -0700 (PDT) X-Received: by 2002:a17:902:8a94:: with SMTP id p20mr773477plo.312.1565808449093; Wed, 14 Aug 2019 11:47:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808449; cv=none; d=google.com; s=arc-20160816; b=mOTmV8LUE3h6CuNnUo8j8MwXA8H51jgoi6z+90pwEzwXmpKRdBbBfsTS2Ef9uiOThK 4f6DzGQQtUXGrt093QIXSSKPbSR1wOlBLIEkvxj/JfvdErSszl2nsQOWXFCqzhEuZ5lm ImwngM4GOLfi8VzAEsmVNTBmTY10W3H0Ns3BkO1ONDm1DZABzXufl5hUeHZfK1HTUZ9v Fk9qH630tnE8v+cgt+tPE+URXgej2Ly5UjR/XckGbO3QpJe9dK0A88Nt9iX5QRunUC8l nm2eN+zNAy7N7uyX4DtpC/uLPwF2rJ9vBE3viMjl2ICwIRFhHf3+SYbKhOE55K99EvVy f2oQ== 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=7WLovU9z58t+myBhWk3iYSpTP732yAw8/1ubIgKA+3A=; b=T9e/NEDz4bsPfBWMxMG/7O+qlIj/XhSozXUc6dDywf09eUaqw5ebVgyWgU6bokhbKt Gm41ITIfevXUzYS3dsbRuugFP4mUMR4TgFOrBm3LygykMB7on/OYL3eEgRBwf3ycR/BP vPJ6r0/RndysS6Arsj3HFLN5NAB15SH4qq6faOSe20l2yq4WMfnBV/8ntFP4O/dyT7G9 QOb4YPm7re6OnG6/vdUP8BP//KyVhm9Gx/zLP7lz0tzzPCTzchWFU2g3kdKv7METa93S Hezz9NqBs987PuAiKT2UzhH15I+k6ws2of29pGxIylurtNkyTfjlqItTi+hO4OjgUQ1F oD2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="CER/jqqC"; 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 s16sor569729pfd.52.2019.08.14.11.47.29 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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="CER/jqqC"; 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=7WLovU9z58t+myBhWk3iYSpTP732yAw8/1ubIgKA+3A=; b=CER/jqqC2aPOLsLXBjxg7ht7MqkRyVbpCPa5548diH9GUIMpcKKp3Ab7dxu4JkRM4N QN6A4e5aHsk4ei+iWQrmACrD2/wR5JgFXd1lFFUdCl0FLIlhtTXA18FFWeQUkNP/3TgL fpGYfFfuSjbmScUfRlgx4700XHcpk4EJBYOKqwOONCgUDr1lkaG5HVGiZ5O4HlhPuGNX Lwdb2SVyX7FKnFopIbEkNXpRG91248q9PQB0b6bxOaRGkeSstBqBn2qMpFyZ2agAb0Rx x3M7tgDasQpoudyFE+yC64+qCgK738D2vMD4Z8ACW47e7JK2OMVk2/29ibZutteWt1BI 058w== 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=7WLovU9z58t+myBhWk3iYSpTP732yAw8/1ubIgKA+3A=; b=KQyZrSpxPE72jkN4qxDj9JAFhrv9KsYLI4j2pouhfZrrUhvg7pjHG0X/xlkBA8Q6va mBKK5nFVm7ozjutbQkjxj6rMHYE2/Z9hZbbPq91d2Km9V9xxFsZ13ECaf1ZCtAYoLchM SxajDucMRCxwPiYjkWegJj7dISiqRvTTW9Nkgf0V64WoA9/glL6XkxED2PS2N6aJmKPp 2aOi/EZDJyBkwWcALREu5fPwNyDew9tBxZAEDjRxENPq4gKjY3Bl5UomBJtqmfStXIJH DfbgDciq6IL2RUlIG1IV5dZdKJHwPnCAS1spZlEjBEcWOmSARvt/d1ZhiRoX2rGW/CAp MqXA== X-Gm-Message-State: APjAAAUE9A2BMDaTH0xNX9atimtqqhTgnYy+cTFn0/rup7jhDyCNEOfJ N40ood/+5MoecSiBZwKS1jYNm5Ff X-Google-Smtp-Source: APXvYqxj70kmciK+8+RpfO0Hyq2p8mFesfp+SwYXoNBXwfaJmOEIpApjYdaN0vMsGJxNRMUhNBzgDw== X-Received: by 2002:a62:8f91:: with SMTP id n139mr1474420pfd.48.1565808448714; Wed, 14 Aug 2019 11:47:28 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.26 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:27 -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: [RESEND][PATCH v3 14/26] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Wed, 14 Aug 2019 18:46:50 +0000 Message-Id: <20190814184702.54275-15-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 acae2815eded..029733864aa8 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 Wed Aug 14 18:46:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171344 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203262ily; Wed, 14 Aug 2019 11:47:30 -0700 (PDT) X-Received: by 2002:a17:902:441:: with SMTP id 59mr821652ple.62.1565808450720; Wed, 14 Aug 2019 11:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808450; cv=none; d=google.com; s=arc-20160816; b=Qi0yuQLMbZviR6lilNrtP+Kis8pj53mNoWrRr8/JEVKpT8A1dBchyLw7mcqGWps+FR CZVntJ/B7pGTZ0AV0RKwmak87yn8rMOwUmxfjSTf4SsUtgjT9TCdJBB0fIoS96e8tNik Fm67eyyFS6YRsUq0gJby/LeXTERPK1152rENRJkhXQeb93RwtTWzrkGDv/RV7j0wZdgr W03A1qdwckEjG2W8jLdP2HSeGdM0XhqrjEXSVZ8kkumThGmNPiSmqk2mse+IBKqsuRHl yUw0zU7aQzC6utZUjBQoFZhEtPymY20PeeDVBHvfJL3m/c55JWQ8SSD1LgV+bAcaRcfC QGHg== 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=DPljuKj8Rrvaey+ZGnnQxT53Wa6yVLMni/ZPYwy7Ocs=; b=QoXVSX2EeitvJhSqsq86+923IP2FwF4HtwHq7LShxsYScNOw2cxDeFPq8s7OVM4fyM 9SqQz3wbNBJ7KrhQt3gN1C+J4MZ9PGPTWWslojbl1NTon00MmqhChRlyGZDCLmqJy0py 7yuPQf1cG13JHrDBr0BcPOFCuYaIbIIOGCrDrbIRyL2KAPG+1KFkgt3TUY0PHvWdvm82 ICV8JrdYFYZ0X/m+4ycwgL8/SND8zVcJ4e2iVyGfKo6ua0nobCxW66SYx2iTmRmUUEvU I+iWoSswDJXCdIsNK/010nKsZ+KQONDXUF/Xe/bulKJ0pO9XPHXPhoKnNzNxB74gK+VP kOuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QRYla2J3; 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 m23sor385457pgv.70.2019.08.14.11.47.30 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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=QRYla2J3; 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=DPljuKj8Rrvaey+ZGnnQxT53Wa6yVLMni/ZPYwy7Ocs=; b=QRYla2J3YD94bct0XU/VHlhyLBX+vVhC+xrK/C+P82fiQdUTI0Nv6p2/JbYEJZOVP2 irXIWpYYUC4X2OFt0YIfI+Z+sogCMa5Yr344yI0VBA1ygrw398u2/Rkrvf9xUHpR7rUA 6zxlqnDtaevKn+NixPVJ3s3kLJqX5a4oA6MTSlZtGz43sUXt2Jpo5nDtOvINCQo8aFKH vnAIA8BYEpG9uji7lsh0fD2ywHOV6zNAvQIW2/Pmjd23ia5ctRBP/kcqlyyrjnPZQNyj pk2Y3KAIb6p1ap7SsTUjUnPTyWvpHnGKE75sq1g19cpd5bi3JAesWayUDirQ2c0VdZd9 9U7A== 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=DPljuKj8Rrvaey+ZGnnQxT53Wa6yVLMni/ZPYwy7Ocs=; b=I35VwzrcwA5VQYXzpLfx2Uc5sNcIgGW1AZYyIk1BW8fvQyLP2J8TwrqO2IAm6lEyrf XteGeqTIhOQcqAk+lRkNqmSNISxfdYAcQVYPQMrASAeDi9+VzYiR+Mf/e6OtHroofpoR VHPqOSpjh1MHgKQvv3ifEHlzpmnYmyB9XvGbQiCZbcbcc9ajzcvsx9XQGXhiWhquDQre Xf1Zpn43xRw4UEX4JO7orhhjp4ijruW4DlSrxohoDKGPSa1N+hk3Qawz2NucAv181W5i EOzp7Pc2KaPplaEC34kyJK5xo+dWF7FIDzikk1tpE2wg7fuk8zE5amuCHgGBGuIgsj6K XY+A== X-Gm-Message-State: APjAAAXlZhAWVKCyIIWSPm+KM9WA/3SXZr3dYJjArrysY3spxoGCiWW7 UBFzH/hjJkcaluGfOWOrye04YfUv X-Google-Smtp-Source: APXvYqxzYdQ++BF6VEmmM3gRhlHFCARtDdNB9cW6qpH5aGj4/2Nec/UVjqlAUe+ZhaEJDq6QZq0a8g== X-Received: by 2002:a63:60d1:: with SMTP id u200mr458559pgb.439.1565808450277; Wed, 14 Aug 2019 11:47:30 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:29 -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: [RESEND][PATCH v3 15/26] drm: kirin: Move channel formats to driver data Date: Wed, 14 Aug 2019 18:46:51 +0000 Message-Id: <20190814184702.54275-16-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 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 029733864aa8..99dfd15af771 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 Wed Aug 14 18:46:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171345 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203285ily; Wed, 14 Aug 2019 11:47:32 -0700 (PDT) X-Received: by 2002:aa7:9799:: with SMTP id o25mr1433156pfp.74.1565808452043; Wed, 14 Aug 2019 11:47:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808452; cv=none; d=google.com; s=arc-20160816; b=Ajb8ZaFDgBBVo0JuXnBoF6SJGpVzTl32l7qHL9kqmxdSEiFSULraNVE+TA8hwjVN1F CXR/DvbPfQrweHAwrjb2n6yxJZfWGNDooCk47fuPLE4GPTYNEyc6TMAcmFP9oI4CAvyz VL9pstRYwgRyk68zt+eQiBV2b0512H4sY52OamJTPR92eThD1RQfbhbxy+wDGd8WjqSO 2Nkj+pPGKFKwmVjGMiPx+JJsLxC3UA7k5BrS59GK8zqELdWAJKs/vBtklMbC9UjuuKl8 jyjo5FPH0p8CaX21AK7uEhnVF+w0RC0FPoQwpcyFz7S9UQEzCKNy5mol0LzxUSce+AL4 oywA== 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=7xmifYrtKTPY0d7eMeK1iDayOhz0vPlAHH86GCYxNMs=; b=VRP00wg6QXGdejFVzlOz9VGii+CXTK4zVDoSdMspL4TjQ4LoaYd/GawbvKVOJuD6+b QHInoDmrHEbRPeJlA+70QPORETe377jnTalCAKWc3JujoCwcRsGR9CuDZFyJsw8iqh0H d8johsclk0s6CgGmmnyxjvcYn5eXKQmXnBySPlK2XUu+oDyjNCbdTepeds77IVLpmMee TB2U08SfT+iBVfWkMTp6NqYhuA1KoRGQMr4VxjR6vfk3ukD2F00dX2BR7bKHT2p+V5dj nx97hYXHp69B2xCV0TFOWN6CqNLLzr5Am5PW9ZVa95O6RlMNSfn6ZfFcM/B8mJVVhGdX KPtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MDJ24+fb; 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 q203sor561475pfc.66.2019.08.14.11.47.31 for (Google Transport Security); Wed, 14 Aug 2019 11:47:32 -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=MDJ24+fb; 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=7xmifYrtKTPY0d7eMeK1iDayOhz0vPlAHH86GCYxNMs=; b=MDJ24+fbIYI2njKcl0UW8QdPWZN8z1ATr0nx6vvAzkELs6AP29eMQJTHu8d0g96Q4b UuPmYWS7jw2bXtpk7W6DFFP8vlkWnvmGPPh88msA1DwYuIx8y+I1kq1Njcfp8yMRH8c9 N70+9g6ljOKsaJp9uEPGm/jwV5vbNlU5x6TOs8nb1Ien0pW9XgJDNFRl6FwxEx1hspc9 ntZABvazZYTCa4WQVeQ/ybz/jr1nv5NlWW9bKAa/RL4g0UaiOb+brObMbjFFd3SO/K6S XWlksBKNIl0pRalg9v/j3jCsHpMMWD5yTdWY2GyvgUAJOH+6CQMBVp+zP4BCWVCPHUGs R9xA== 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=7xmifYrtKTPY0d7eMeK1iDayOhz0vPlAHH86GCYxNMs=; b=J2+dVG5ijfk6TBEMR0mWFqrwbYqyrF1eaC4YggsshS6+p1DRrUw0vq+z0cAP716h1i h0m2/F/sa6iqP+FDFQ6F5gNq7fVktbn+1SZMZIK9Vp+e3B/1z88VMYj/z9q6G8sEG6uE mdmb0AjjKA3YpmgaM+qsmQIdrf4FqDc3ri46KoKN/NIqWenygbk5GAy0rluAv5TGW9cS iMrgZYiOSFa49wZW2aaxV5rkn5xtRQxGRoJhmGQQ7BlllKbXQmey7+k3uWae5otysHWa Fh/C+3uLjpynkiPUQ1v20ZrEkFgBaU8g8srilC4BzOgUgLWMQ+uydCrzh7/19vNB4PmS aiMg== X-Gm-Message-State: APjAAAWTWD5jeUHnh+UQM4DQ860YnNj6VuBbmA4BeJRh2T0NNuljh7Ww XDQjJe09Vc45p5s01KF5llBUKBdN X-Google-Smtp-Source: APXvYqxW0U5tK9Ms1Ev3Ni5SJx77as/7G+tySsw0so+NqkPxOdCRIc7atSRk9kaGa7tKOVtfUzh7YQ== X-Received: by 2002:aa7:9790:: with SMTP id o16mr1419890pfp.51.1565808451659; Wed, 14 Aug 2019 11:47:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.30 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 16/26] drm: kirin: Move mode config function to driver_data Date: Wed, 14 Aug 2019 18:46:52 +0000 Message-Id: <20190814184702.54275-17-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 99dfd15af771..bca080e14009 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 60c164623f56..bf1e601fb367 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -39,12 +39,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; @@ -53,7 +47,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 Wed Aug 14 18:46:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171346 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203306ily; Wed, 14 Aug 2019 11:47:33 -0700 (PDT) X-Received: by 2002:aa7:9210:: with SMTP id 16mr1445260pfo.11.1565808453591; Wed, 14 Aug 2019 11:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808453; cv=none; d=google.com; s=arc-20160816; b=oS71irheo2BjPpSbSGgBBIaI0fgbi+5hI8RV9KvlSjNRbAm71pjmzvyxNluAKiJd3d ULrxm02IyBgBW/18prT2z0mCfAw2GnhkLnwwfJcu2LChQ+1nSEvHuLnArw8oqAPpMUM4 7hXihGssbII0bHiyviAExuNvCryWyDZ4UAzr7Lk7bGQqlZkGyp/5anEJ3TSUHJEv+E9Q Hcr4v50VkyV4KWg9GXkOfxxFwvP8NcYnbQk+pIYYkjaEjFfXILMlqvsmpmaVXPVq/GM9 Xvy61HXKk0+px7y7oAX71uAzBghsXaFJlP6UIQCPOCZF3WmTwgmJPUyJ/Cj6bZN6Ea+A BxrQ== 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=86FCzQs5EG3Tlp7MWCnk0oCzxkL88DSF1TUkPvnf8Ag=; b=OsQa+5DLr71ypbPcrxlJld6jX9pXgOJvV7jxAUd1qLP5HazbvPpnohAqHx5ijM7krG lcLGLlBllnGDzHx1mR5cRyW8JZltZI8mVR4aOuBNF0UxBMfQjA2Hb8QbXOk/5CtDNZ6j ZtDhN6GnE+JkYexHZMldxVFUeHEfeSxLxY3xw9/Jxfi2CEGK5j+7cfJnN69VaB3RGP5b jOZlNV0buCX7lb4YtG74p8eCVWTdUujwY7IEPkKpbUBjaImgaq2ZGb/YI/z3IejlxQlI SqWo1OqNMqWv54jh8KZ1BqPR0aPxjA2US1y++fNfo9Ns9tCeP4pjuK1qHOEGcvzJy8Xm VvlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NYKzaRm1; 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 c76sor592959pfc.11.2019.08.14.11.47.33 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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=NYKzaRm1; 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=86FCzQs5EG3Tlp7MWCnk0oCzxkL88DSF1TUkPvnf8Ag=; b=NYKzaRm17tP5zbPEJdxJV8mwLPa4e5F6FFGpOt3yTQLiQAG/kxDCQxbTypob4j35rW z8ZNOEVzhSocgML3gJgfbSA5/Rx1caZmF+NoSoovjCWQhuD0rFiY82dpCoBH762FA6X7 MVyBpuXbahe5OCzxysaazjvgrx5Vnjco81ikU3d4hC5oEQ5KpRp3BcClPdaLlQYUe4Lx K4zv7eLn2yJEofJ2HLwi5DmAtnUJx1GGqSU8FBWvitObcf/3E/rk2Hn4dT66DhceO+/i hXjeAl3uGpnFt7KStap+luZW65gxRlqGYOjLG+Eq8bCw2LPtmLeJvt3Wh4pA+br0yPZV jWlQ== 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=86FCzQs5EG3Tlp7MWCnk0oCzxkL88DSF1TUkPvnf8Ag=; b=jLFJBhjD/P8nT98bUV4TaCygccBXaWQm1XBQJsMgYojb6myhlIVjUu5N/I0ulUn6Cx 9vqi1p/HF7AChPLlmqIDVYw9fIlI7fw2sV9Us5LOoM7IY1I1eSULne+mAY04L2sIq81d N8Z4zf18kE3ns81YlPBwoqT/Z04xhVcw30XT3WBKcRjLFcgXsgCZkWsgRYUejl4gb2jv TnhRQ+nghCJud/GD249T6fcmXXKvxBnfN3E2n50x0u0OKSABxHaDwC+zFncjZcXgEey2 J9H+SJqudQSmcjWLTZIpODbYMuxaKzzV5cR2PQcIPI45dvkiHpgGq3VsfG0kWVlBL8SL 0nXA== X-Gm-Message-State: APjAAAU5TGlQ2G9CEVUysmC6yOo1HPnFDZzGBClE+o6hESFoGn86CBtm 7hX/VzY4Sp8wwvur/HQD8LEGuhyG X-Google-Smtp-Source: APXvYqwe46/m/Z3WR/Ofq33p037b8zteD+0TSjAkh8AWNOXb2hCjKVmejw7gKNT110OmXr2pzAGK5g== X-Received: by 2002:aa7:8ad0:: with SMTP id b16mr1387941pfd.45.1565808453207; Wed, 14 Aug 2019 11:47:33 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 17/26] drm: kirin: Move plane number and primay plane in driver data Date: Wed, 14 Aug 2019 18:46:53 +0000 Message-Id: <20190814184702.54275-18-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 bca080e14009..fc0f4c04d1c9 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 Wed Aug 14 18:46:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171347 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203348ily; Wed, 14 Aug 2019 11:47:35 -0700 (PDT) X-Received: by 2002:a65:4304:: with SMTP id j4mr480749pgq.419.1565808455242; Wed, 14 Aug 2019 11:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808455; cv=none; d=google.com; s=arc-20160816; b=gpK9Bb6jFR97XXb5daOLxlT1xiwLbHZFBxKUIc+igY0OuuNltO98QqK4a02Ox7qY+e grZLK6D3Q+wbZUtl+N7OjeiwE8p7KTkpiYzw5/PUT7FfanNq71TYwpQbtHjonfZi31bd cLqS/pYDIE4LC1mLtcBUj6al5SBcJ6n1k3yza1ZNUwXl8OA8VJ5Dq4XRJsQmsBGi5gZl qQJMY4V4+vuMJCBk/iarW7Zxtixe5IIRHM0nsGEPsV0edeiFM6qalL0Na2LY5mczk/ZU hjghoAlAXNOJDqb9cfDrArmbfWuHnrztK7Y83p7/he/OPmyPnKRd/3FNHHJVqabQPVc1 MdWg== 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=f7xcuRX/1vBOSp3204JRR3FGT/MGHZqTKrSmOwFZnf4=; b=rGLjZBG+yIjpEUIen2CHqCkjC3Rqe+0b6qs+RZT1aX+ZupE4ih9e1HQhvJAny3ZEzo rxEjkZsT+CMR8oOwLuJD+7AQK2DmJR99kw4qwuXdyc3UxnTdWpwtn40g74rihUJ6ijqD p847Y1pplh8sqrOMhLHn8P5ys9b5HpbdBelfEj0uAd57HtY6R21FPX1E3vJ6MNOBsEOD YJR+DNSMz++ytd2Qx+UYcYl6cg/wtcPSfwzf7nsamTWW79kXrfpB8NhfbcHRvkFm4Hdy 4iApzZvMrzRpTZ1Lhczb+jlN5YRBb4qjq6Xp2lttz2cDh6tmAbkIZqN9MHWGNOP1igzr VIzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g8HG/tRx"; 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 11sor382804pgf.75.2019.08.14.11.47.35 for (Google Transport Security); Wed, 14 Aug 2019 11:47:35 -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="g8HG/tRx"; 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=f7xcuRX/1vBOSp3204JRR3FGT/MGHZqTKrSmOwFZnf4=; b=g8HG/tRxey5TUfBHN6Wyf9GMHW1PjL30NIA/P1GlCecHTr5xSmbZzb5clD16Ntw9A5 eMeWcPBdGnfp+XOYG/bjsc1UAXqNG8yEiDHnIP6BLc8hq8a8lCg/TgKr+Ga5R6fH8NuR M7Qzm8QZZxECjgZiWLkk9dpNYbti7ep5G2GAJmDCDKtTf7Og7CtA2H1Wfun+4CCSDTxP Wsf0bfYcJ91GIOWkRdGcHRLeYTwjHUnnU9aXalI2kgE58/iIWf+PnUqqZPM4qlrHV2NG XIG7tsVSJWmF3xGJcWKS1RFMsJt1KsQU3Y549DRMhjD/DVrf1Al1vn2vw1C+fk7l5Nf8 S8ow== 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=f7xcuRX/1vBOSp3204JRR3FGT/MGHZqTKrSmOwFZnf4=; b=TyJ25Ht+MTcqhQz8AZyxr9Dtn3OkNfhlBrJWzpRTg25+exv+DAEnuC/qZebXBA5VTM Op59jN9fKbjJHrOMYVyLoou26IxrgWhrW7OmlAr/p/u6+k9oaQBxu2iJxotme3EtrJu3 7gXQkkF25Rx9zVxxNEYv0XjV5UhfTLQjm0UWm8XU/2Ox6jnMVK4flNIeiX4BsURvQiYg figxC5Mn+BVoV390DMgdnTEIKnijnSOySA7wU5KXPSg0gXgc9jI21yzPhMV8RW/CNpRV KjXKEXVg5TBkFr8/g7QwTx2dCb23KiDpkB+CURODfA6JQ5qTcwiiJuEePK65xAAwfCRZ 223A== X-Gm-Message-State: APjAAAXj376to32a0RNLq/3IlXbBJnCD82gFLzk6419UJXBa1Do+tZf6 PS2EnF3ok3cb5JKVSaYXth5LuL1U X-Google-Smtp-Source: APXvYqwOJ5gF01XhACt/fu5chx2S5A7OH6nw2xpAfmT3vkaJgq5qP2DrY09y93lww3VSrJsXoZ6Oig== X-Received: by 2002:a63:5c7:: with SMTP id 190mr474913pgf.67.1565808454735; Wed, 14 Aug 2019 11:47:34 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.33 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 18/26] drm: kirin: Move config max_width and max_height to driver data Date: Wed, 14 Aug 2019 18:46:54 +0000 Message-Id: <20190814184702.54275-19-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 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 fc0f4c04d1c9..68efd508d86b 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 bf1e601fb367..7956d698d368 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -39,17 +39,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; @@ -58,7 +47,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 Wed Aug 14 18:46:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171348 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203383ily; Wed, 14 Aug 2019 11:47:36 -0700 (PDT) X-Received: by 2002:a63:8dc9:: with SMTP id z192mr471776pgd.151.1565808456788; Wed, 14 Aug 2019 11:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808456; cv=none; d=google.com; s=arc-20160816; b=ZsywU6Wo1XDpDY2fw8F+lLGRUD89uFOP7dWlBVca6P+7gpPq5X1PpOwMqorAMIC23D 2mgheCP9KTKtAq38sx9r6LA1ifErfxmo+YNrgkYy6iK1AxJ3Nu1pLwErvBeV4r3Ivp5l Mi9e9US/ezTP7Ty3+p1ZvYG+wZqj0o1cRg0ejo3k7qvvgJkJt4fk9xjvUhgtGZRF9GZ/ dQ2WR25c8cLShAr3FOEUw23XDMKVcOLGrmfV7JNDyZftl5tro8m058z47+mb/oYtmDJ7 hBh65zQRANmMOigGZ+/aAuFxE1KcFmixSkuU+Ggwx+wCgZSnw2ASEsykUuHnwoIJ4yz3 ImkA== 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=Gw3U46bCPqQ3ETjFXBi+tKlBVOcmrTwPQEr2UHcNkBY=; b=ojbSxB+vCqHx8U+8Ko0n/7uC2bG+Z9SuF0LdQbti2F7dbZFCDRJ3IZpKFc3l9B+7bF n0+vspX6Pcr8rz3NmQn0VW0lSWtWrz3fHJEoakrAT5nOxCOY4J+rvUL60stP5GfXFLA4 EoaYjwygxsTZTmuGvBRYI+aMzJxALIgokWRbsBFhhcxQV5HOMDFXOwEjtuWl6HCJbI5u PUpdal8cQ65rC8OCaQPlsSWiukbYaD+cMsBaB1mMyo3hC6qCoftMeCoIB57/w9DfGkVq A4ionM5nIyYnQn9d4Mfd0E0NUSwHQq1/4WXidrNHAj98JBDVHUOsIXGnsJi3AzvBdtgp B1ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pmouxbbv; 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 m32sor774947pld.32.2019.08.14.11.47.36 for (Google Transport Security); Wed, 14 Aug 2019 11:47:36 -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=pmouxbbv; 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=Gw3U46bCPqQ3ETjFXBi+tKlBVOcmrTwPQEr2UHcNkBY=; b=pmouxbbveIAlwOzdvdJ0p2QuUl0N5XG++0VuOjCBBmWnVYFCP4/wQRHPGVv1pRGvYw 4wg1Xf4d9fVYnzoyLtAeULaYrcSYtaYG0I1Z3y0FhIX2KJk1ocSo8T8h5Z71WP6z/hH5 s4wFGm6zOHbqtkCTaoqfwS5uH1UECFUwKa8GMRieSlsL2z1NJirkTdgU/XR8LN8hjXkm rmCn+GHiNihGmUzm7VuuAORrLmjxRpgweMfjbCxY+7UHg0oXbkJPUByS0z9mHj8eEDZz zm3mQOQIY8TXhMNSWzud0C5PhOYdPkLBKq00eOqjrkRiO52X3Z/F8dlVIiLiAJlgApE/ TCag== 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=Gw3U46bCPqQ3ETjFXBi+tKlBVOcmrTwPQEr2UHcNkBY=; b=AB9CYUUf9IjXf8uEwtaXSA8p/tn/yLJA4UfF2+o2zLFgRoIsMhxgTrrr48vB8GQG4F Ge1agG3IYsdjJe3m/7HS1NiBuGZRpKKA/XxZSsTpVlbgU74Y5SwL7dyrrscB8IrthGjK PlKOwwCmoibDvF7kTJhbS32UsxxghOye+0Br3oCGe+gR3tnO11ULsJYQ6j/GiZqcYQqM BJ2WMs7Q1q0QeXKkUlQLRBvHBnIsT5JCKtlfSG2aBiYXJLydCnsa+6NE/iXeMaGYqJkg Fu5Arsw9ydfPuE16sJk+Wnb5+j7uzpDYpsVlq/AQv2z3cuKtD3JFsv5cqSS+Dm9VMdYv 9xyA== X-Gm-Message-State: APjAAAUP8HkECMmRZEyH0C4jZeNKUgR+SOclrSvTiUgorGicc/HHXhsT AmF1ISQGC4E688fvmQ8J7fnizcJe X-Google-Smtp-Source: APXvYqxf8PRCM/QdhrsCcFY9B3bUT+kDckdce2dIlrs5TtWi1x5QHwHYOwWNMfZiWnKyqYVld6Vd2Q== X-Received: by 2002:a17:902:7686:: with SMTP id m6mr744989pll.239.1565808456343; Wed, 14 Aug 2019 11:47:36 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 19/26] drm: kirin: Move drm driver to driver data Date: Wed, 14 Aug 2019 18:46:55 +0000 Message-Id: <20190814184702.54275-20-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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.c | 38 +------------------ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 29 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 68efd508d86b..0bc2e538913b 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1049,6 +1049,32 @@ 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_PRIME | + 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_export = drm_gem_prime_export, + .gem_prime_import = drm_gem_prime_import, + .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 +1082,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 7956d698d368..296661ba300f 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -92,41 +92,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_PRIME | - 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_export = drm_gem_prime_export, - .gem_prime_import = drm_gem_prime_import, - .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; @@ -134,11 +99,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 Wed Aug 14 18:46:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171349 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203408ily; Wed, 14 Aug 2019 11:47:38 -0700 (PDT) X-Received: by 2002:a17:90a:a013:: with SMTP id q19mr1090915pjp.64.1565808458342; Wed, 14 Aug 2019 11:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808458; cv=none; d=google.com; s=arc-20160816; b=GD1+fGwdlEsuYp9Q42+XXB5CSsfi17C6x8uQwvgQn+BJhhTqWbz73Zkyn0s4Folb8N Q5Bay6860Cc1oxKHygZ3nxBRyGbfDDNR/CzwaETgLjEjkSxDutgWyGsENG985QWRayi5 PGreX6Y6zTYiBeffVtyLF/iQIdEHnycI4ivY/bI6gpWziYpne9Ijy+2+SZvr1HmKGiDd ybRIFpRvK7rTVRsQxA69tuA1uCA1EOg5sf3kgVgyz4n8va14aTiK+/18MIatuuiCKxOk AmnTTAdH/d2XWQITDyO4iYmzFxk5fU25C0A8bfILoQK5tvDDU4hgSs3/++eUKduoHz/B H/0g== 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=IPzeQ2CUMdGC3xubSflSEVQzVTUBARkxSdnQGwtck+A=; b=fgoiNEipcsg1Fxb960IJLZnqXLbKfJzLiGBkn6An5LsS4WLKjDawtE/vcb5JPsG5Zh 5mOdiJfvIz35ppGsz9xb1Kk1Y4hb3gwI5ltaUkGaYm5mJfIo8g/89tEODjjEtZrl3/ZY 8FeWbhkFtl/YcLWi61L73XtsIcTl23t61/lSwmtUDwkIuYMO3ZXxioC94UeyktN7Jbuz Bwl8UWaigrQgbYf64L7REDiuTgli3RfcuLcloFwAr9d1TBgiAlXPKzs5lniYGULEzITm 3UoFDGEu2x+qX3Q62O6K3iYDRyzTOGj4SOokqRUDr9RO4AqS29pcaBexKNsGHvHE60Cu /s3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhJS6h06; 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 f1sor741430plt.64.2019.08.14.11.47.38 for (Google Transport Security); Wed, 14 Aug 2019 11:47:38 -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=JhJS6h06; 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=IPzeQ2CUMdGC3xubSflSEVQzVTUBARkxSdnQGwtck+A=; b=JhJS6h06u1B9jqFTOn+CwQRoRUhrXNN3KxxzVeQC7MMbPEdCS3hf1OVLyf50PTvtjX Eavd8K17SGQWSqK/F6ko5GtkXtkbqdtRPqFJD2SRDSr6nHwiE7/t066G51Pep8u22D/8 KEL/25qrR/NG9tHTc8YmDvdM1JHd5w5asBezd/WNJwXB5uL0JldYKePpWjHmBU++U2UU Yp1Ki2xdTwnLaWHKWLuBvTKq3/D6Iy+vq1kBeg2GuuKIZ9TRC1VbLffKG6PFz66LVrDZ aoe6oWl54tOmU380QHfX/wb/WRGhESj0FRQJUGyOLWXM6GDHPNvMhgU/npBdk9uQbJHT ZLug== 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=IPzeQ2CUMdGC3xubSflSEVQzVTUBARkxSdnQGwtck+A=; b=mGfJ402C8ys2lMdcH6HiGzWeGvWGH03wtocHJ8mvb5QpEb/i8FLlGOmn0RzXq1QenD pCquBvmK/BVZWWUe5hpj3ZbOJBZhEJ56z6O6MD+bWttjPRFY5BdITYrm+Iuep0BMKqbp tWuQWF/PhzFQcC5DDhKGgbcBoEsNp4OV1UUXYdVkjCBprvjWw9XcY3fCiSvkvcU1HcpR rEYWC4r/7qGk60ltl/YolKwvPjIqAg2aLchuGJ97cz02Bb3pfqj9OvhC7ZTAEM0DV1qi mWDpToSgKYhmjeJZTK/PFCYlJi1uwcG/I2ibjWBT8QqDe/l5X+VSvWn2Qv9mpy8wbDy9 i41w== X-Gm-Message-State: APjAAAXz/GuqhF8U7IkWSrn8zyzk2Qh6NUnsK/G1hNiYsLF0x08FYRQO 7GBVZnHGJXZ2J+rfQVcunPfAdRTyd7+ORg== X-Google-Smtp-Source: APXvYqyUK1+R0//fvavu46QlOZxKHVtICulhldBFx7PuI83uF7+77CJwZapDfZcjU0OKXdcrz1x87g== X-Received: by 2002:a17:902:1107:: with SMTP id d7mr778830pla.184.1565808457932; Wed, 14 Aug 2019 11:47:37 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 20/26] drm: kirin: Add register connect helper functions in drm init Date: Wed, 14 Aug 2019 18:46:56 +0000 Message-Id: <20190814184702.54275-21-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch adds a flag to the device specific driver data so that we can conditionally register the connectors at init. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg 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 | 1 + .../gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 43 +++++++++++++++++++ .../gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 45 insertions(+) -- 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 0bc2e538913b..66434c0cce6e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -1076,6 +1076,7 @@ static struct drm_driver ade_driver = { }; struct kirin_drm_data ade_driver_data = { + .register_connects = false, .num_planes = ADE_CH_NUM, .prim_plane = ADE_CH1, .channel_formats = channel_formats, diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 296661ba300f..1c9658e9565e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -97,6 +97,40 @@ static int compare_of(struct device *dev, void *data) return dev->of_node == data; } +static int kirin_drm_connectors_register(struct drm_device *dev) +{ + struct drm_connector *connector; + struct drm_connector *failed_connector; + struct drm_connector_list_iter conn_iter; + int ret; + + mutex_lock(&dev->mode_config.mutex); + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + ret = drm_connector_register(connector); + if (ret) { + failed_connector = connector; + goto err; + } + } + drm_connector_list_iter_end(&conn_iter); + mutex_unlock(&dev->mode_config.mutex); + + return 0; + +err: + drm_connector_list_iter_begin(dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + if (failed_connector == connector) + break; + drm_connector_unregister(connector); + } + drm_connector_list_iter_end(&conn_iter); + mutex_unlock(&dev->mode_config.mutex); + + return ret; +} + static int kirin_drm_bind(struct device *dev) { struct drm_device *drm_dev; @@ -116,8 +150,17 @@ static int kirin_drm_bind(struct device *dev) drm_fbdev_generic_setup(drm_dev, 32); + /* connectors should be registered after drm device register */ + if (driver_data->register_connects == true) { + ret = kirin_drm_connectors_register(drm_dev); + if (ret) + goto err_drm_dev_unregister; + } + return 0; +err_drm_dev_unregister: + drm_dev_unregister(drm_dev); err_kms_cleanup: kirin_drm_kms_cleanup(drm_dev); err_drm_dev_put: diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h index fdbfc4a90f22..95f56c9960d5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -39,6 +39,7 @@ struct kirin_drm_data { u32 channel_formats_cnt; int config_max_width; int config_max_height; + bool register_connects; u32 num_planes; u32 prim_plane; From patchwork Wed Aug 14 18:46: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: 171350 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203433ily; Wed, 14 Aug 2019 11:47:40 -0700 (PDT) X-Received: by 2002:a17:902:e002:: with SMTP id ca2mr781982plb.326.1565808459954; Wed, 14 Aug 2019 11:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808459; cv=none; d=google.com; s=arc-20160816; b=CgBG5SQv9g4CeJ+BWpG0h3RHbHD5e35Iu9SYFKnFveVk8q7SEWbsT1Ai7xSgivVbzl tpfDaRqkDF6qApGzWHUygTND/EfcIcZF1uMUvP/DBq1xCoLmaAFtQT7/NyiCzub7M3D5 zMUSfTIpue5nti+9TnC/f69kZDIn+th0HyT9PX+uSNmHFH0gBjUZieGxGeg1u29XKCQZ n6j0wSyBpiAGzQEOO1QJLs3rhea0sM/1nmQDtwuan+v4ZTj0zZF4eadm0Zhh4GrWkzrT 49W5bL/gJKRsxKFEWb/LafRxYPMM+i8yqcACwjBnIS73cFJ+r4MgIsCPfRXrqwQaEw8q P1Rw== 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=Jr0LHNXFLRr/YgSdWt3cOqmTd6edKKK0IXkakE1rRaM=; b=ADJicLpkpOYy4Ka/tHmqbFnsTM1SCXxquZAzQeJVsgEukRnNEHK1dERm0/tMAqIATb iwjaULaRyOtwBc3xjiJ1yEaFPiNO759LTeZahkt6E0UUC15Z885WMtZPt32OcCQMCuVj Vuc2u4etb4dGkHbCAt5rpnLE4278gPtrKKs2UKY4RdLpikgbnp41jFTbZj0gLe8XEw7Z IfO4/EpCjbB8gO5M3JPp3g++iTd724YZkClwB9ye7Ply55AxiR8uvsCaOApYTHtPLk29 tSdyGSlcpfi37HKWVgC6AkdgKiSpLJ91tw+nIOKxs1n/HzPGVTUftJm3ohXsnsfPs4hX y8Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rv+Gl8eC; 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 x15sor745849pln.50.2019.08.14.11.47.39 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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=Rv+Gl8eC; 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=Jr0LHNXFLRr/YgSdWt3cOqmTd6edKKK0IXkakE1rRaM=; b=Rv+Gl8eCcK5oQSZmfccdJupNqiSkL5PLZeiuBMuUviSXpb018SThybZruQCixf9sc+ 5T+plvMnfu8014K2hxyhCEeEiSTQfuOG5dkABwYp4wGXGWaYhQy7FxfUsejxGvAyiJJU bNgQ9/UXRNO/cUtGhoO1Fg/xSrXtLjA6FU8Q2TVLyunHqshmY0QE5/6+/eRFgs/1A0yY 4dlbRdiymYQSL72JNwf1JCBPeXaSEGipD7/SPNiZrMZ0vIa4yBLJ1r1Y3Q0DZNYVWGZJ WiDByytAZVSJpM8gWUIT1HLUk05RwvQ/7jVEu0mbAHdj41nVdfiRd2tYCHRvJ0nrqQhw NsDg== 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=Jr0LHNXFLRr/YgSdWt3cOqmTd6edKKK0IXkakE1rRaM=; b=XduVjPpR48K0KKradHcqNrj7LkJvgEJqo8yvwvs0uC5y0itFsnS0lqYSGq5NuR1PZY wfMLGFk4ssOTyE8cLqWStW02IXSXJrXNvt/TCHreTmWdSOyRuwdg+6z5ug+VSnusX0Zy Bh1I5WkRg7fx2BmfrsiqqBFWFbRW3ZbW4IzH2ZKRReJY2Hcw0zk0y8YzzSEFtG7HmP3D UufMp6HCpVCMRMffX0uWdxIfUE/JmhCqQRbLAeLC+j/+4JVbaIxKjPJqg0gHDnozoNl7 8wNYNWDNBnfmDKA3iKRKEW3HHYqBwBCd15oy/6duWrdEOWYyF9k6MdlOfNKin1Kk9j0O i62Q== X-Gm-Message-State: APjAAAUmiu6zXjwWpiTBlDSdRdic1lSDcRgV4vfUlvVYmQqTsFOeqDmh DpAO+c/SuxVD5J0pjjf64XH6syH/ X-Google-Smtp-Source: APXvYqzo/mdKFHRoq5DJ0COo3YXh5eNMJS7NWWZWkEwSch3MmurQnHJAW/u19PUU2WoblQ7z19983Q== X-Received: by 2002:a17:902:9a8d:: with SMTP id w13mr736590plp.157.1565808459554; Wed, 14 Aug 2019 11:47:39 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:38 -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: [RESEND][PATCH v3 21/26] drm: kirin: Rename plane_init and crtc_init Date: Wed, 14 Aug 2019 18:46:57 +0000 Message-Id: <20190814184702.54275-22-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 66434c0cce6e..0bdcac981d8b 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 Wed Aug 14 18:46: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: 171355 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203773ily; Wed, 14 Aug 2019 11:48:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5VzlkbkcjFv958yZ1aQwtARR9F8W+tsv2NY6bDubYBXmokOpPkMHfrupuc4GUTxsggPzQ X-Received: by 2002:a63:f941:: with SMTP id q1mr506116pgk.350.1565808483037; Wed, 14 Aug 2019 11:48:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808483; cv=none; d=google.com; s=arc-20160816; b=BzjN/w8DJpeCyJ4bxBy+RTHsDMoU0mFlAFSv5jeYsc/o4Ho9iEUFvbgeAyiKQYW4ik yVssmozD5gRdSZ2mb7IS7IH8v/v+ZEiDvyBbSuoQpb8m9YRQZNY93BChZZMMlXyGWF9F q7YjZPphnCTCv50nSecNC3PKXPlDf1wwe2/B5DZ0g9EuenzXAEKV/AugxEcWJheuwmhX 5niNQo5dZnSjFyYc1QsYmTMH4szs30k50NWz0BKmvBt4+1eBLBaGC5lyWMFEjIWgo0Gu pCGMe4KTwt1rNyd9nShPjIE/1zP38s+/FEmpujEqG14HlIE4y9b+lKOYbIeWaQJRbMsp nu1Q== 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=LsxdKXlIE7uZ+/6eqxu7c+cok0i20/tbrH/8RDl0m7Y=; b=gHuCeekHw2phSH780TcoTcaCzav1P5R1OBEX/LEfewTRG6LRTEM3VKA9HI1x2el6k4 N8W/gVPzpLdz3jBs76/a8nbuDh5FOaE9zHk2LQJ42E+wwl/Mfx/ACWaM2Kv+Oss+XYwU 6+e+HmFsjyVzOK36+aKm0oXmEB0JoUSQfmDflgjGBMyafHWQQXTj0XmMc4qM3rn1MOcb ngGztRa+ND+3C8lcyKAc10EqwQ9Hn3iXP0OCTHqa5nnK03dieme9BPmPD4wS9I5qXLy9 TfcTttFU/BzaLl5wDJyeh9iQFtHdkArOVbpLLJ4DuwLgcqmfjRLv7HfTfMExZkRItKNN O1gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=phHUUaiC; 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 p8si260052pff.37.2019.08.14.11.48.02; Wed, 14 Aug 2019 11:48:03 -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=phHUUaiC; 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 S1728533AbfHNSrp (ORCPT + 28 others); Wed, 14 Aug 2019 14:47:45 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:39319 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729529AbfHNSrm (ORCPT ); Wed, 14 Aug 2019 14:47:42 -0400 Received: by mail-pl1-f193.google.com with SMTP id z3so4259326pln.6 for ; Wed, 14 Aug 2019 11:47:41 -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=LsxdKXlIE7uZ+/6eqxu7c+cok0i20/tbrH/8RDl0m7Y=; b=phHUUaiCNqUXb2OQDy2PL5HiT4EhT3jgLrPghrja3apIV/sP47ECUK+syGDP5dxS4A u+j4PGs/2h04W3SConQAkYMRWPkN+ePriNra7FScCzMkt73oDq1S0URnJY56t67cEP8L 6Kde0bxm6ML74X5v2uYA4015JBOAg83kGePtdvjL3cba7JLAtSvNzHe++HBCOCCTGQ7M SdC5xiGI5kyWlBMRbN+p0GHUTH0QG9Kgu13fRBviu4FHdV9f6YQcgZcIwfyqaPamriYd cEKPVXU80fB+TBz/Yiz15pMIdJJF1l+oRZmcJ68sbU8zBUbcVVaqT7RShmx2KXd9TI3D cE3w== 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=LsxdKXlIE7uZ+/6eqxu7c+cok0i20/tbrH/8RDl0m7Y=; b=jzXlCrxNQ8ftwOw8uC439sK4cvANaf1ADpTHCuBrdnRbgC1uXpimfUKUFydgwagVeF 7cApsxAkb516uZHbXjdVVdiNfQMV93ym+yAG3PjAx8dHsADjsh9gSwwXQN3jSHJW9owv pEIW8NtKFwdKWHnSnUMAOnHhdCFRg0t2VCXunkoOfx5ClLD+0XmB+2kpOJyE/ZgPR0ev khiUOyNrgcKThp6w1jfySauJW0WRJ6dPrP5rPE2PwY++4HYaLDES+YjlmskjbSoiy52/ qSZKF8fhfXLNUTNVxpPuBjTgasY4sZVQnu9tj9pVGZMXBULYJoiPY0ugoJw5b5efGpOx R9QQ== X-Gm-Message-State: APjAAAX2N2vtL6ez7C9D19qTACNvPeLseMtjRHpFqStZHn4SOBefWrHo IVxgig/o1h2+UopEp9eNnrnm8BKuetY= X-Received: by 2002:a17:902:2f24:: with SMTP id s33mr734052plb.314.1565808461082; Wed, 14 Aug 2019 11:47:41 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.39 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:40 -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: [RESEND][PATCH v3 22/26] drm: kirin: Fix dev->driver_data setting Date: Wed, 14 Aug 2019 18:46:58 +0000 Message-Id: <20190814184702.54275-23-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 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 0bdcac981d8b..09dc2c07533d 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 1c9658e9565e..f1853b84ab58 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -43,8 +43,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; @@ -139,6 +137,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 Wed Aug 14 18:46: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: 171354 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203680ily; Wed, 14 Aug 2019 11:47:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwo22yMLlXOvUqDYqh0FlEUNkIY+f8W0yQ0GSjFwhKd7P+vdrSS7v24TT0rpPl1BBvrHZPF X-Received: by 2002:a17:902:169:: with SMTP id 96mr699391plb.297.1565808475011; Wed, 14 Aug 2019 11:47:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808475; cv=none; d=google.com; s=arc-20160816; b=UlshqwBBNfFP5rLb6reQUyDobRg0qoVTN10f3CF24VbPiQVnru0tcuk7wi6pYpWu7B NdwhB90D00OugXpCwMbFT6cw8EPnVPGPJ657bIX3WgeY54ChqkxCGzZEGOKkQFTxflSi Ne8Qh4wmQ5l2+ntt8Fnfj6DYqGbVI2V995S6FggzU7vWHvpElFJM0u9s8yqFI+ELwTdO pLBPy1ZRbf1+k2i680qHOZkaQEKdajtpnwD0VTi2KzoREMLlvkYhQ6WIAy6bs1PEhaBv gonVzh2CKvk97Fg9BPvP/R9z/kNpAyxBtILSAPhwEjRvUoV9S0D4/A/XNp67Uo2L6GM1 ON7Q== 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=OApmoIvKEwANRXPyc/6OWQeR4K/MRqLWVFQnZsIe75s=; b=P/2Px6w3Aq6AZzjhhisf/iLqNTEjhDxWBee/3USkuUiRye04I1u/KBNWK7uqt/X/ow 1qNLUO2ykV0aK0aGvBAYZgq/AD8/gUCQsHMGbtNsp3L04D0s/dkqYtZh4h9/qB8c4ifu tEThPEGnW72FOtUTH8uaI1yH8hcw8+kWsuJIg3jZHW/Yx+lKHP2VaiU/THANW+CTDfG0 BHi8DCykrI9ZiVfz+ns2y3R3jfeV+tjCjmB83ZSYdLkjSoPR2L9UZt0oqeH9vrxFwzfU atgwopVtq2LNO7tSaKtHqWre8IQGcGGhnlYLeGYuJJvRBTwRJpEVAWi4jxPHPu49xiQ8 Uh/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lOsITZch; 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 x126si316758pgx.356.2019.08.14.11.47.54; Wed, 14 Aug 2019 11:47: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=lOsITZch; 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 S1729599AbfHNSrq (ORCPT + 28 others); Wed, 14 Aug 2019 14:47:46 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:39031 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729486AbfHNSrn (ORCPT ); Wed, 14 Aug 2019 14:47:43 -0400 Received: by mail-pf1-f196.google.com with SMTP id f17so50104778pfn.6 for ; Wed, 14 Aug 2019 11:47:43 -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=OApmoIvKEwANRXPyc/6OWQeR4K/MRqLWVFQnZsIe75s=; b=lOsITZchiLFnULc5mm91WsaNs9MBzbyapHeMMb56+cdMOduZItbjK07Tu3gtHNJgwj 1mrPMeWj+3uA9BZum5sPSqe3wz4YHEcHXg0cAFV4S0JuHOb7Y36+EGsRZsl2q4Ebhugn RKMYnwMA23IRUelOo1yGFV7o/+Eso8NGPvNoQhNdO8FoZwxjC1cZC0NUYPGIeNmSXjgq flXmnQE9BmgM7AW1v2WbDZszd9ZxIoURO9WUoJf/XrHCfnx4BfoN+tSHUELB+rdPJxii zCLmsU+8GMqy6mPvkBUciI/vnNU7Kq34UXXWakMulrT4byK/uz3KcotFWFSfc4V3mrRp uFmw== 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=OApmoIvKEwANRXPyc/6OWQeR4K/MRqLWVFQnZsIe75s=; b=naUWT33QyEO0us0XEUyzw5FQUop/OF3hUirluONzsVE8qmKy3+nKMqN70LaxUfWxOD UAdEwmEgEheV/FtxpDUQnR4nFr2YNHY2L7CMbAYp2c73Fy0va1Knj7KkWOqM+X6epubX 62JCYaSNeNvAboPl0gSMNzPlRGBDh+owy3iwHShxQtkMnwuATuB2/Ahhf6sGST5NMQpV tPGorI9ZqP31Ttvj8vEJVfqfoAcwjGqZAAkmSY8LgqvrQajgJsj67Om7YtCN9yDqbvkC cr0SliBtM5c0qPBZ8nAaFSZPTQc0aUNphFlTYB0cW9DvIQhdIzhhaio1spHYOLXKunz9 t8eA== X-Gm-Message-State: APjAAAWQgg6E87ZSdj2nZ52vgShGZq+Ya/kmZg74S3kygYVRWVIhjOTz tRVE3ss86hihDiWdCXbCjtSdDSc0W3I= X-Received: by 2002:a17:90a:cd03:: with SMTP id d3mr1051669pju.117.1565808462290; Wed, 14 Aug 2019 11:47:42 -0700 (PDT) Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 23/26] drm: kirin: Make driver_data variable non-global Date: Wed, 14 Aug 2019 18:46:59 +0000 Message-Id: <20190814184702.54275-24-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 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 f1853b84ab58..cc79bd4ecec2 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -28,18 +28,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; @@ -95,6 +86,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; @@ -131,15 +137,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; @@ -189,12 +201,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; @@ -208,7 +214,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 Wed Aug 14 18:47: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: 171351 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203503ily; Wed, 14 Aug 2019 11:47:44 -0700 (PDT) X-Received: by 2002:aa7:8102:: with SMTP id b2mr1405079pfi.105.1565808464043; Wed, 14 Aug 2019 11:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808464; cv=none; d=google.com; s=arc-20160816; b=ucaOo6lz1B5mzSgZKI4QHAoEBAwRRvAPqCdS3GTEpUuNE1kYruvUgv5diHh8XNNMaZ LKGIklyo2DJekGZXU5kzaMroSANSMEtxcxB4d53L9G8TVljkUOS+6XT1mghudQPejAoP Rx0ofm2O2cYooO7uL0uTKPXUp3FwgHy3icoMkmIzOuSs0ExTBj0P8a/HY8mXf3dNqoim jCFQ3fEQYNBY+9rZmbszq/3Ib/rZ/G1ZpEiOJDKem6e3gUnZLFrblOJnHI1Ek/wj2gyX E7YkON2X76Va2uijL8+XexD13I7SSXhMkd+1d2NflL2piYIOavXaC1BY5im+aUCKy7tb ip8Q== 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=wO5ks8srjtZHHtpXOR5yQLjWhZNf1ho4YCPtcrf1Uww=; b=K7Xywc6+d2CcQQyQjKzigKeax+hQVu4ZUcytu50W2T5KCSygGcrGWnNKZcG5hewSew i8Apqg52E3r07RdvFnWl0DoTBHWaUJzB2MrbgNmLupd6CWaCATjCFfSA+r7GroXJaj2C oXS0W5w4JE7HKLzqJOpPfPWS6qucIFEzgIbawJFZ2zItvqT4hDAma4DwkfICKyhvunO5 m4uCzZeh0WoBaIdmJ0Mfo+HCkliTKawzrP2JKwUdcynTtSlcD9XE/mz1NTwkFcvtLWlx 4ZtJl1b5/b+K9Fh9ih43Zs2t65XcJFl5sJGDyavMW/BVVAejBFxRDpuF/S3oyWuCSItk 4Iwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhjafeeS; 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 e16sor483443pjp.20.2019.08.14.11.47.43 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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=JhjafeeS; 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=wO5ks8srjtZHHtpXOR5yQLjWhZNf1ho4YCPtcrf1Uww=; b=JhjafeeSnqrY96MJ/4i5IWZwtutSY/+sjrJKNymWybFyvALBIrAwaLrXnNm+qRQJFR SDwJLC5JbCWTXnmsCh3xFFheswBW72hayuwa4XzQtbYFMdz98f6PUkLTEzuFhrxa7dcT +iK9J7/7XZ11mPfH+4rhV1qlHJOE9Cbn15Spe7OBIDglTWmOC5JJDFXGFEcNnn85sFph nfFKbeM6gQtUvUA8ojdH0NUEOCMibVOA4ayu7r6zMI0uF1kb47k3aDvlNGBm4X8Ogop4 hkGyHkjIk+KzXra8pKLmPtOod3J6cD2P2fAQ5iuRAiSTVcRNwKTGrTg6uMRvhyxo9f9c BKrw== 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=wO5ks8srjtZHHtpXOR5yQLjWhZNf1ho4YCPtcrf1Uww=; b=Vkp/3rLaZiwfPigQd/ilQxn7k++ZDrw2ncMtr8Q5wD2vYH2Irruy/fqp3nhct2vPnx m4FxDI7CbA2k0i61kt1cVQPkxOYDljXt0nSfB6UPJ8qZ2GbggQ6hUUBKQpEfY9VKol/x 5r4eAOvzwzCXNZ8UZCga7RUg/W0MlTZxFcmZyvhRKplBnrhvpvHuSfzIdOcoFdYgGq+T Df7x6D/fp1xOx5744zd6RpFfe2jBcp8fhCshHT9UlTSZqmxH3FMtUGXvCA3bTIZdkQGV 1ZnaZtYSWW2+TPNp+JTlFTZeOGeo2rGTKGEiuYH6NLpLFNOFeyYnjtBM7uYvpEZo1hXZ tGHg== X-Gm-Message-State: APjAAAUtcfzH9YPaouPlkWCBem6JEzvnWGUemhzQ8MB74LytzRkuuGUW WhxoqPFAh7NxqNUglgv3OVN2YTEN X-Google-Smtp-Source: APXvYqxW9O5O6lN6D75dJ6FsTbeutZUOicVbvKl6O0GFXkGTiyx7uCBE3n4NRfwQBEVHRq3DIGsO2w== X-Received: by 2002:a17:90a:ec07:: with SMTP id l7mr1055601pjy.39.1565808463626; Wed, 14 Aug 2019 11:47:43 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:42 -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: [RESEND][PATCH v3 24/26] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Wed, 14 Aug 2019 18:47:00 +0000 Message-Id: <20190814184702.54275-25-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 09dc2c07533d..f729a1de6e14 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) { } @@ -1090,6 +1094,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 Wed Aug 14 18:47: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: 171352 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203530ily; Wed, 14 Aug 2019 11:47:45 -0700 (PDT) X-Received: by 2002:a63:484d:: with SMTP id x13mr515263pgk.122.1565808465655; Wed, 14 Aug 2019 11:47:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808465; cv=none; d=google.com; s=arc-20160816; b=ted2Xq34inRxSyn3z0pyopNm5/cXMVx6Ty+c60gc4ZtwF5ufaxW9ePDVUUiYdbcPxd 6XbDKHk+BJSLJhz+c8IdZ8zMV9JrNIa0Az1c2yHKTm4oBTJ7vF+kZ/mUIZ+gv6hIdhjR sVG10h0Jv00MFOqyKgTrLoWrmx6E1pNP5NXTBcfO5VxSi1kP+ga98EY+qMKOD6CByqv/ oFGVugpgQI3bDZXtDK9yztfwtBSEUPB1ahbIp1AHaNqbjI1d2qcRvwrnxJtP7QxEsxiZ LlQyvfaMmJNGwE2ogvpYq0sEqVl4kcCwvFydNmXQ38DOSLXVa3FzzyHyQoJ6ySyKOHtm M8Mg== 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=g6uAv27tRz5L9wSjxLNVl9yJGuoTJBSlGcSrGIG0dc8=; b=NTg9XVGJQMc1MDIfT2ZVYEuB9fcRoqyBUUscqUgPU+dxOTm8RyGTBVTxMemYte1e13 0K6B1v7TkcoehrT/kjnJBdI/zK69cO3sYIwegEAMnQ8Xjzie1uOJe07AL7T+L99SQGQL Ic5rwEa/ahPOF45pnTqW1I80EwzGbdOTpHsKr0eWVD3bmq1VB6osv6rPmuQOgh7Derzl 6J7L5Hn9NHXlC1fm3apwvujOjgvzroXiggplVW9tStellfeP+LTnVibQhga+UZVdYcll FwOjoSdMwSfx+Wj62hI6+E6PI5wdAjqGPWYXBvtJCVDzcaCvYFqd6XHn9l83UEXCMiKM KO6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Q/K3nksX"; 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 d11sor502839pjr.11.2019.08.14.11.47.45 for (Google Transport Security); Wed, 14 Aug 2019 11:47: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="Q/K3nksX"; 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=g6uAv27tRz5L9wSjxLNVl9yJGuoTJBSlGcSrGIG0dc8=; b=Q/K3nksXnTewrgH66PEsGInqHk3G5CSsI2MmO0bGyulaasGK4GnUHI4STA2aXzrRz4 D0B7N1vpWKlYXzTEzek6IXpuHE4Ye51+L0AWYXGcXZLqitG/qBEgEUu/AZmCNwPFaKHU taiQH2TBjCAka8jXpuyNUDKgJEJds4vdeIIjZPNFxDROhXDFhUkpW66TJ/87mhbw5D/b kBY/0l4Yq0C9A6Dq9qmXYcI1gbtFB1VTjUJVOypUM0UeMW8Sr79f3I5D7nG7VSp9iZVW /rUuvIxHQCdB2EYgVcWynoQwr8d36hSXtEAgjF5iV2u0nnJrQXwLU3+4/T7Nn3qGoqT5 wz6A== 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=g6uAv27tRz5L9wSjxLNVl9yJGuoTJBSlGcSrGIG0dc8=; b=UUTWudR8XBjybqkPtkGwo5NlasdPLrN7Dw+bs4Cu7TdRI7LUndwLFIs0o+OB5zHJqv uYf05/DEro5nO9eJ0Ikl/Y8tBV9LeKsQUhgvLMF8mB/rUiqiMSrmr/lLzqI1Abswv+He L3PRg41sHnz+O4HAb4x9QcTxuIr1xW4DOko1VCnjhHJQDfRZsQ5v3ovzZlPBlOEPl8Dy Y/12RVg+dM3+PL4Cps8DKO7Zs8XGWz5oKRWFZM5LD2LLBRDqMpiSllq3UXueakd+RVJS 3cOdZ0X7VuZ1WIBiqZJ1/ie4i4NMmPVNjj1MQLCYsG0R9Gwl8dfICsHHiCMeizLKg7OB 4OUg== X-Gm-Message-State: APjAAAXUtY/whCrHHdu+7TfLcmmNLP1xA2a/t4aKQcGS++MS9ZBFnUNY 3l3c2ViWqZbTmJMC+wkw8YKWGtZX X-Google-Smtp-Source: APXvYqww/O9lEEjFWec4hq2+MxoQOn1KDh79uOYPC/WRYrDlO23Pgp6bxoz/dkBfwH1RluR4paFsEg== X-Received: by 2002:a17:90a:9f4b:: with SMTP id q11mr1030317pjv.105.1565808465169; Wed, 14 Aug 2019 11:47:45 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47: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: [RESEND][PATCH v3 25/26] drm: kirin: Pass driver data to crtc init and plane init Date: Wed, 14 Aug 2019 18:47:01 +0000 Message-Id: <20190814184702.54275-26-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 f729a1de6e14..ab0c5d03903d 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 Wed Aug 14 18:47: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: 171353 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203558ily; Wed, 14 Aug 2019 11:47:47 -0700 (PDT) X-Received: by 2002:a17:902:654f:: with SMTP id d15mr689211pln.253.1565808467248; Wed, 14 Aug 2019 11:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808467; cv=none; d=google.com; s=arc-20160816; b=YIuaIJ3xQMTxobHzQ40mOXLzX9TFHmwOoWsY+NwxH/a8F4/689zMqvaDxgJh8MHMro J7vCgj4BLWmogJMIAbHA9FcC4ik0ZVhvIngz1ef3SrCn85mCDxh547MzrKHJCVebvTyu iHgK6mEFYTk0ubp8qAwY4CUWixZR46+Hl+mich2iAr36LRej0tTyn1yeIifTp2mcidSD EVjOR3o55qicFYVFASjZ7pMcWLKIILRP2F1eQ6iZGieApTw6A1lHJZIzfKnV7tgMdOFz VlMQabhp9M8PwD+Epjd7Sn/aG0TuvDO4XvFnCbDcNQbp0xUTuGvvSbjKT1n7uVgDPW4E loOQ== 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=BM6japHtNosu612QM3iXbsmNmPuxWQL1sToNVcdmCkY=; b=E+3nNjFqsBU76+O1NOQCBe0ZlO3JcKrBOzAnim+tkKpwTaGcjepjfE8VARA2eNVlqh DV8aBJnC2L2VZ1U8M8FzyD04xs4LGylJJRXjjNDqL8D2NqRNoYJQ0+Mtx+JUIqWJ0VKC Bp511oFzfOu4nkyBskZzD5DhVg9dki6ZwafkQEJnVuuxiCVRPEpHs231UsBxTEe8JY3B Z+oJqj/yopxSRCutg3S6PQrR9YdRBYlg+PN5ARNjTfSVgijMN2PUnAPAivQ7dk/cj2/k cxLXsdO/98ncYEdu3selO5WjSUsovUfxEakgDH3vWiqgIESk5ZjpP7BUNBT1/0X1kG/J mpkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VCeSzqLm; 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 t6sor778877plo.20.2019.08.14.11.47.47 for (Google Transport Security); Wed, 14 Aug 2019 11:47:47 -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=VCeSzqLm; 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=BM6japHtNosu612QM3iXbsmNmPuxWQL1sToNVcdmCkY=; b=VCeSzqLmUL1WjtpIM6CEJtF0/NzzB5tDrFv2RJC9BrlxKlMumoygw7h/DJHcFX2ftM 6Fl/GKjsThMBeEAqqmJmsL9UQz/Vvp2jXugm+GmnDowOzBMZVusvjssmDz98H2F7CMRc 2bmhcfZE0rSe07/s20hP+6MRXc/iOPwedjh1cJyG4I2vTeitmGUhFTRzn/nlBlu78g+0 zujrorPWvGAnd8SJ+lZ57fDx53gjGVlRd9jdT9/VUUt3/4U5MqkyNH5MatUGzeugB+50 0BLdy0pu6jM7H13gmYDuUjSVridhWengvSInhrfPaUn6ktLAUhNBx2Xv7Keqszl1hYHt awGw== 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=BM6japHtNosu612QM3iXbsmNmPuxWQL1sToNVcdmCkY=; b=WTFWbOm4lo0PLMj4XMmPD3ITUETkl2eno9LBuHl9mVUgUfSlSJIyDTjHl6wBJYFcaf mKv62HqJwdnBwBxNxen0ZQyXEInmAevuzu2WBDtdTRGUCoTgWU7sqrUx28vcAR8HH+Pc gWE2TNYLCP0wJIuUQOSfv4MRCN9cCBo+ruLP6Kx2gK+yBxJpBegr0d9dlNaoyMKSgSc4 9g31mhNF393uHzepwoaByWUqpb4asTCy7fpsnTu36JxijMZtTHysmVD1yU/Zmf6MzSui ebS3NKbKuTIEVoPVihPKFI2KJcP03zCj8JsL4Rqq1Njvr6VV7FYUuD48qK6KhCMeRjkN +Gcg== X-Gm-Message-State: APjAAAUaiJu8Dgy0lPirwuydEVQOTbtE64keL/dHah0NwTQ1gcnPBT/I Ul7i9NksqeLN1/vQCCS8bToqNel7 X-Google-Smtp-Source: APXvYqwbaB7LUn/FgZ0iMUdFPU/7V2ugfwRyQ9avlRChogLRQEo88iupMMV/3WbAl7SvE0OBH/K1OQ== X-Received: by 2002:a17:902:1e6:: with SMTP id b93mr727597plb.295.1565808466769; Wed, 14 Aug 2019 11:47:46 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.45 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:46 -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: [RESEND][PATCH v3 26/26] drm: kirin: Move ade drm init to kirin drm drv Date: Wed, 14 Aug 2019 18:47:02 +0000 Message-Id: <20190814184702.54275-27-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-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 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 ab0c5d03903d..428206eccfa0 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, @@ -1099,7 +979,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 cc79bd4ecec2..69aa5e1821d6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -28,6 +28,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) @@ -43,7 +167,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; @@ -51,7 +175,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 */ @@ -73,11 +197,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; } @@ -88,14 +211,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;