From patchwork Tue Apr 23 23:20:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162738 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354475jan; Tue, 23 Apr 2019 16:21:02 -0700 (PDT) X-Received: by 2002:a62:b418:: with SMTP id h24mr29098362pfn.145.1556061662076; Tue, 23 Apr 2019 16:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061662; cv=none; d=google.com; s=arc-20160816; b=PyN4IQiAkszfMrJOUZq2Q1KbJHJDvpP0Q1rF/pW70JQYkvaco9j8r33pY7Nmog6C74 /Jj0JfnF8qdXORdtcmo6cSMKAf6gFHXyRosgAaUOCT0GAtz9hP7BiULmr6lB9wiNJvun 99I7wWglwZRpwdxoaj+eIutwNhZtT8nhHvAzYLvHSp1R8NxJWYVaBviWsqAM7oFKji/M GUt+wg2MrDtYjeIm/ATUG91BDORPNBeYcLxrgAcG8k1cAKLBSLvfeGbczUoaWEeO4roi c4voQb//0d2vDLScbBFpeSIId8+MW0UW0wk9Wo7INTwScZ/bTrjwp52lEp3v9LX2HznM Y81Q== 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=7ws3Dd9BPtQNXdrE11DrYoo1hw98ZqIgdLIuIoohWAI=; b=nDLCBtJnMtgelsHo5fyXUr3i3mFfCUb2+xBl/V/T4aNNb01rh8Xc9uEKvWopDW6Tkm IJGSw7BsVLLwe9AEde0iEIyFnZKXubuZbqAuYOpPZXABzDAXsYWEV8i86JkRGmMc7RdX gUC+CWJRJ05abGEVR4UbLcb/kQfJN3vuL+boLXn9Zj1vXKjW4hnEauJxetRhxyrcbRde JitGMyrwph/pHOjjKKCflUNbbPG0zuGnJgF/9Lv2rKQ37Vf7aScYwT+rTzc36FeqSPQI KJsE6XIqKQ11p7+mqQ/Q8OtfsH/eaEMltXmCkszdPaKITShfEaIOiWz33f1c8rAB6wMq X9Eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vOlspHR0; 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 j67sor14942554plb.46.2019.04.23.16.21.01 for (Google Transport Security); Tue, 23 Apr 2019 16:21:02 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vOlspHR0; 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=7ws3Dd9BPtQNXdrE11DrYoo1hw98ZqIgdLIuIoohWAI=; b=vOlspHR05P7wEGxI/4z2kZzKI04SunMOWWy1zhhr3rUFzMseipE5BG8dgRvRjT39r5 TmB3GfVEW/EMe3pLxSJfOIvPul16TcafmVWyQfBsssAE2plbwkLhg1B5xp5RBfaGFygk 9HA7w/JdxmUZkix8IpEpgAxLIanq034B0rpx+PqKuGD8jc9oYLf8d4A7SbFHA7q6uTIG bS1dvU1Z0pD233XfI+8MtIn0hV4Vxk1QSRnQchQozT7TOngkOE/+pNzgXV54J6ZJ7uM8 hnumrjo13fCydbP9e+89R7W/yQVw52cut4pqQ5XbnqYJmQ5vyZHFlemrzFWJyj9OYADs 7jAg== 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=7ws3Dd9BPtQNXdrE11DrYoo1hw98ZqIgdLIuIoohWAI=; b=XQ1nvJOTeN4xidD9ofBbU+MhXTLIiQQ3F1o4z3cLem0azrx1jMjCtafCkO16OvDU+Z hk3Gsz6gR0dBKfUhCdifXqmDPxIEBuA2e69FMUZW0OoNuEvymdNxn/L4xOUdA1nKTvxN 1LPJKrur7MPcNIL5yPcnEFwIBYuZ2KLIpgYyfYBt1VKPB72ehu4R2AV+84ggw94Pm4LA fnNKcdaA2FRI3KYEvMWRrTkDm9zbFPLQ63DSco59qRWF1NtJGVOo72/+VoRrP0/+sLbo vpYHHIyS/UfXMpqxJckzx7fPagN12Fb4EtNmO2csPDf0Fy7Ef2L4byDONjZ0M1M4vysX OxMA== X-Gm-Message-State: APjAAAXw8xY/IUFbt0ismv2u26BWV4dga02luTBjo+FJ7lAbCspJ4Nl4 OA9h9erXnpitfNUE7xbLvKK9DSEB X-Google-Smtp-Source: APXvYqwsyaUiw7o1uBnCgw9SPEnaS1Y92ydgJWTukVYM8eJMcb6g6lyEOjvMv/xGEOLTaxGwqm+f3w== X-Received: by 2002:a17:902:263:: with SMTP id 90mr29348524plc.257.1556061661621; Tue, 23 Apr 2019 16:21:01 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:00 -0700 (PDT) From: John Stultz To: lkml Cc: Da Lv , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , Yidong Lin , John Stultz Subject: [PATCH 01/25] drm: kirin: Fix for hikey620 display offset problem Date: Tue, 23 Apr 2019 16:20:32 -0700 Message-Id: <1556061656-1733-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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 --- drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h | 6 ++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h index 4cf281b7..ced40c6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h @@ -87,6 +87,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) @@ -97,6 +98,11 @@ #define LDI_HDMI_DSI_GT 0x7434 /* + *BIT_LDI_UNFLOW + */ +#define BIT_LDI_UNFLOW BIT(2) + +/* * ADE media bus service regs */ #define ADE0_QOSGENERATOR_MODE 0x010C diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 73611a9..beb2a3c 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -58,6 +58,7 @@ struct ade_hw_ctx { struct ade_crtc { struct drm_crtc base; struct ade_hw_ctx *ctx; + struct work_struct drm_device_wq; bool enable; u32 out_format; }; @@ -176,6 +177,7 @@ static void ade_init(struct ade_hw_ctx *ctx) */ ade_update_bits(base + ADE_CTRL, FRM_END_START_OFST, FRM_END_START_MASK, REG_EFFECTIVE_IN_ADEEN_FRMEND); + ade_update_bits(base + LDI_INT_EN, UNDERFLOW_INT_EN_OFST, MASK(1), 1); } static bool ade_crtc_mode_fixup(struct drm_crtc *crtc, @@ -345,6 +347,17 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) MASK(1), 0); } +static void drm_underflow_wq(struct work_struct *work) +{ + struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + drm_device_wq); + struct drm_device *drm_dev = (&acrtc->base)->dev; + struct drm_atomic_state *state; + + state = drm_atomic_helper_suspend(drm_dev); + drm_atomic_helper_resume(drm_dev, state); +} + static irqreturn_t ade_irq_handler(int irq, void *data) { struct ade_crtc *acrtc = data; @@ -362,6 +375,12 @@ static irqreturn_t ade_irq_handler(int irq, void *data) MASK(1), 1); drm_crtc_handle_vblank(crtc); } + if (status & BIT_LDI_UNFLOW) { + ade_update_bits(base + LDI_INT_CLR, UNDERFLOW_INT_EN_OFST, + MASK(1), 1); + DRM_ERROR("LDI underflow!"); + schedule_work(&acrtc->drm_device_wq); + } return IRQ_HANDLED; } @@ -1038,6 +1057,9 @@ static int ade_drm_init(struct platform_device *pdev) /* vblank irq init */ ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, IRQF_SHARED, dev->driver->name, acrtc); + + INIT_WORK(&acrtc->drm_device_wq, drm_underflow_wq); + if (ret) return ret; From patchwork Tue Apr 23 23:20:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162739 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354504jan; Tue, 23 Apr 2019 16:21:03 -0700 (PDT) X-Received: by 2002:a63:6b82:: with SMTP id g124mr25033221pgc.246.1556061663807; Tue, 23 Apr 2019 16:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061663; cv=none; d=google.com; s=arc-20160816; b=ftxrvf7L8i8t7pN3JeeZNzweLpDE058C6F1Q5J2bP3jPf9bEpNCG7YiM9N5iJP1pPz BuP2X/bCk89/KvrDZkt7SdfpRcuRT6R4FcfA+QuLIReWB1TPIK0f9QXf4hoM4kCIRQ7C CNBEzu0z1qGWA96KymprE8dz/8EZhyaldGZdvviTJvF2ILHQrxKuoFUzDWfPx5Z30Wxz K8k6S53/vd/53WBUw9nJk0HD3NOSpbBnP/6qrjZ8mQFKYah+nKFhtk0LryOI2hRcPlOU ewbzmkR7mPGQ3H2E9Sc6aX4VzKkeon+ZHkSmqAduKykOCfEl4+9LTwsltHEGITc9xNZT xGqw== 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=ffq6t3h4iha2b8rRhkjsypDQIKuHdAwEEoooYwQNUbA=; b=y1TUC7qo9RnNYnTZIHckkEcvcryrsIO0cWM4GC45sTmUo+V6463+8ZjI43RVbSU6KY GXGeHx9SCrszSYznQOAucM0DJG6GoFRn1VGkkdiJCGhrczwpqeyoP1dquUdNmv9WlY8z kkcBzWORzOpmzrfozdW7gkZ3goXFA087gn/1JfLDAMF4o/YabT+OcI+95DBPXZgrokOh Cqj0zcxv0LhoobsdSrfnWiplrILl/ywCjMP1nSSkKOrBGzJva/1j5OxlnE/mcHQ4ypRB LLJuMEHKxAC9wjOegkgw8N5VBqA2LaLWnvzNxx/LLpwogpt9IJc/YYa0GIVJ43w46nJP KlTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pbjIoTJH; 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 j23sor7297588pgh.83.2019.04.23.16.21.03 for (Google Transport Security); Tue, 23 Apr 2019 16:21:03 -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=pbjIoTJH; 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=ffq6t3h4iha2b8rRhkjsypDQIKuHdAwEEoooYwQNUbA=; b=pbjIoTJHu8+xPePFhwY4xi9ya/ligccZ0pj7BpUULWYCP1l020YPTE4IeijEjdARQq tpgr7CKCzne4FecwXpBNa5o1486idq5SFsH9RMOUef8xBqn6yDeyN1Zii7clSuLcepNk +2h5o6st23kjLObnaMHmTvvU37Tbcl0EntgE8AiEy7MQjYedduMhHpmYLRrkGCYiJ9b9 sX5Ew3NodXoIrY/dAXLQB8uN6tBP5QQL0iR8wcrMUKaP7wkHj7HXdp8ubct0QQ0oqWLO ijP3pNdtoxkx1zxJxYHPGHqr6SO1x+MguxaOhkD4Li8luNGdQhZ5lKl1tgXyJ8Xstxj+ hQCA== 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=ffq6t3h4iha2b8rRhkjsypDQIKuHdAwEEoooYwQNUbA=; b=OLkXscS79Tg9Qnf9Sx1xjYQ0UNRqiSnf4W63IbqfioABtEss1g6PefMDVbaXOFDKwt EZ0J7gJZU2ItxylOVrBNTRqWU4TemS4w12d3kkogmLWMorH+1lQMNplQmBNkHzq0Ky3R 6FAK93pd0ZVFt7KNRW8ybcyhNI9K+hxu0Mte/pYjzdSPhquCJFWepVhPkhVeMz111a+Y Dl5EVsa0EnkO5WSn5GDEdbc+g5WCMWfPE2N3Ie79FTXHUBndRd93IeD0dez/MrwEncka jojjG+gUjwmpXKsIBepzT0C0SzotNDbcgfgeQ3leQMmw5TLw3ZnBbCJ7RHkvHz5KjHhI QLXw== X-Gm-Message-State: APjAAAW+9sazzhD/04t575BtoGTjpqg4uhOmyJB0u/EBYSbljRP4oCix iYAYaSVSOUHh849Oyq0ljjPgLDPXUbRTTQ== X-Google-Smtp-Source: APXvYqyy7+HL910ob3T/U/6+X+behbvUMZtG72iWdqYN0rvFz1h1auspIOq2AIb3SBVVn4K+kYH1dQ== X-Received: by 2002:a63:7e10:: with SMTP id z16mr28060734pgc.40.1556061663317; Tue, 23 Apr 2019 16:21:03 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:02 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel Subject: [PATCH 02/25] drm: kirin: Remove HISI_KIRIN_DW_DSI config option Date: Tue, 23 Apr 2019 16:20:33 -0700 Message-Id: <1556061656-1733-3-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/Kconfig b/drivers/gpu/drm/hisilicon/kirin/Kconfig index 499f644..6ef7906 100644 --- a/drivers/gpu/drm/hisilicon/kirin/Kconfig +++ b/drivers/gpu/drm/hisilicon/kirin/Kconfig @@ -4,16 +4,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 cdf6158..3585327 100644 --- a/drivers/gpu/drm/hisilicon/kirin/Makefile +++ b/drivers/gpu/drm/hisilicon/kirin/Makefile @@ -1,6 +1,6 @@ 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 Tue Apr 23 23:20:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162740 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354527jan; Tue, 23 Apr 2019 16:21:05 -0700 (PDT) X-Received: by 2002:a62:1d94:: with SMTP id d142mr29806053pfd.83.1556061665026; Tue, 23 Apr 2019 16:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061665; cv=none; d=google.com; s=arc-20160816; b=rmEoWOyBGT0oTJZhL1z/74s0qwmBYjXdioU20UUYYX8YyL8tM/uvt3iBK2ocKH6Xe+ +Dcw4yY/StU+0rKje1XGBg98/vM4bDr5hpv3o1Vw658+TS1mf5aG+Y6bcQ4RHTLexiq+ gZ90UMQQrM9P9JxZpN2gqOWGZPhEFrjhOrT9Oj4BUKxIx4yZTVUBkkRv7QKTjyO003Ec phO257CPhkHS5woj6Bh8XSkRYW3bsbIZ9r7zV6wSC0rUp0z1tgIudN5EjZiMR7Cffhhs wKxsDshtrGhFEgAE3N9JBtzFjint8d2v4GwpBJOCwz7t/YOtfUf6mEnTkgywVVqBqiyz xPMA== 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=PJpt961AUotkx92U9UhQ+Xu1suFDY3Q+xFz+vrGcjE4=; b=Y2/hKmRU4qLE2HHA5nOm8SXTqUCqClhsjt/Paf+06t/0zLtC56OfL3cpUws+tHoNX7 yfVYI7VJCqtfgr76S8JM/0c6cYxB01eg4k0p6tw9xBkIgGnNYDFkUHodm091l7G897Wx yhAN7Lx6x3W5RY6RgE+f9J5r/y5FkbJidRP/k+OrxFUEy3isDdb84i4bXGDrxvA69Bfk 3kcXKPf6pL918SV1nqVBcoqNbgG41NnLphai4OwmLMgr2VoZyypTl3lHcfdAcvcuQ2MU 3Dv35hleCibz+MfnnBqRYFbWAtI8DpHzLxzyG2Xx2OX+JtayB9/LgAcqpbDM+9zS7+uR d/tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AmWnkmaL; 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 y2sor18254779pgp.73.2019.04.23.16.21.04 for (Google Transport Security); Tue, 23 Apr 2019 16:21:04 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AmWnkmaL; 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=PJpt961AUotkx92U9UhQ+Xu1suFDY3Q+xFz+vrGcjE4=; b=AmWnkmaLsdXPfYTFhHB5uW5qtrJ6UY93Uhapl8moRr/XyDxKUfPDiduErIL0PZSlXT jZSnCoKEVWH8f7Saj0aer4vXinxRi6YUL5ddDdh9ABXRAXWaUDnRhqI4m23CWENhK4tv ZtrL69sGTtL5esCcVyl1Emz05kbVxAIoAeHY6NDAPZJeFpirI0MTqF2RRmrBYxt6YRRy hsr0wbgZxAudSHehCPOOkKXwvtZyL58jBvvylzmCb962pVnepYpM/QzX4vfxT7+wjpuo SC80FeVylBl4aAQ4+GMHOd+V98/28MyE3Qtxdg6McYZzC8nHucF0ilLQ9w9P5wUYx4pj 8UeQ== 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=PJpt961AUotkx92U9UhQ+Xu1suFDY3Q+xFz+vrGcjE4=; b=S0GFNuqVbv8zl8Znbyjvkwr0x/I41L7x+20qNXB/jztyKusG59HGmo92d8FLb2X2x1 Lq08AgI40+YRx9JLok4FCSNg7qIFG9mGcPRb/W4hrGvCOD52iyDc07FbSXR3zkPvvNrQ SbL2csGMLZqG2x2/m8McVb79BdmRgpYU43T4fHuesLQer1mLaKMbicdG5b5UNmFoq1S/ 2Pg/WnBruA5yjTP7ViINZoF56dj3aNsCOrMhVmMOz8lJYmK0bPT5Efwa+VU5HZtp/ziY RpdACw6GiyjJsIZgOW9BKtlBfRrqmaK3z0Xr0U37ldnrBeaTIRCOZnHjDE2kFT7NHQ44 F+/g== X-Gm-Message-State: APjAAAXaU9C9jwhukYrxOEWRNlT8T+HsWMmU7olcTotUpjjDwfMJRwNK hdm18jnO3UImoCTz+TbCNuBc4DeZ X-Google-Smtp-Source: APXvYqyUlIaK+U1ReA6lItnW8fmKebrGKmYIDisAG1J6wlj/1UzHFWPbBZCESsA8GvKTEPWg6fbcpg== X-Received: by 2002:a65:5202:: with SMTP id o2mr27247072pgp.402.1556061664628; Tue, 23 Apr 2019 16:21:04 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:03 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel Subject: [PATCH 03/25] drm: kirin: Remove unreachable return Date: Tue, 23 Apr 2019 16:20:34 -0700 Message-Id: <1556061656-1733-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> The 'return 0' in kirin_drm_platform_probe() is unreachable code, so remove it. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index 7cb7c04..c9297d6 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -212,8 +212,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 Tue Apr 23 23:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162741 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354554jan; Tue, 23 Apr 2019 16:21:06 -0700 (PDT) X-Received: by 2002:a17:902:6bc8:: with SMTP id m8mr19611827plt.21.1556061666886; Tue, 23 Apr 2019 16:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061666; cv=none; d=google.com; s=arc-20160816; b=Ib2Dg5PT5vtKnBxXl02GJ/MPS0L7icmn45+J4wViROd0upUVAUqoH73Pe9ZKKdD2CI sR8E22x+eX8kJ1UsZfzv9lUVY75eePYyPC32Y9YrDPa3WPKv3THIiEYcu+fK9RUlEClC qpZAyOdRI0KI8X/b4qMUGXRP3PVss4c/DkMQC8QUQ4SokXGD09PzLRO5JutHE1vtwCcA Y/0shyzodUPn0JcVwrMjJu8WNlD4iI6TI/+2x1WemsBMfCRVsD4pNTQ/bB1mCt+Tjycq 4hRmGIBN5E8+Fr441GuQcRmTeyKZa4OlB9AVw4hICUHIncxs+/W0YDOM5qS2aRSkJUVz w5EQ== 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=vuhHNfWnMx8uWZhY+QeUk1qBtGP4f5NldA6jQRHm+6s=; b=IsRNhbWp5vok5Meqv9MwjHtxAAhO7Uh2u97Yf1uYhtFZlSWImOYX2QUs9X1YAeSkRb jkqzY+4wUhvrYluCpCkn91tfGnvjgezkNAqcNLWsZYWpgux6y/EHEB7dYL/u+NxRRnqP nd9pHVu+Bcg6ZpFZxMJP8e4fcJNUKYT66N9u9HJfkcmUSweAqKOwLX+6R7jNW3GrOPZA B6tuM6fDmrr2WpuXUGGHn+CAYH5/h8M96H8GQVEErOPtzPDSnhR3iL9d/snKXXpLEuJw 4EVHvoPcfb0a6hBrAD0VvRuQpXkUWOzU9Y5qv9T0dIR1Z08oGIQpVdzW6LeXDHMs4Eu4 Xz1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NQairEvL; 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 p66sor19581917pfp.35.2019.04.23.16.21.06 for (Google Transport Security); Tue, 23 Apr 2019 16:21:06 -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=NQairEvL; 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=vuhHNfWnMx8uWZhY+QeUk1qBtGP4f5NldA6jQRHm+6s=; b=NQairEvLvSGh1SguVJ2rpCemcsun3HCniG1nJhW94XLuu7Ucb+iUdicNtGfflaMyUt MkrpWYirbCzWneqOb6R778tc9wbpCvxtcsrXfukpO27qUFuVsgTpP46Y5lrOKq9SR+zY ggMFp7R1m+u3dwTHZ2tIJW17pfMqlvGUsrZChyaGacT8cyxLEUyN9Qfc6jSMCBMGOZLl tHl5Phh9o8xC65tjxfg+VOplgFnhiaYcsGeR9QqyVVZJdXv+hRopVBIckebvJOQpVQNj FbpPMtEnmslUKSHEwPR1cmD/JV6yo9G1WlwxkY7QWyb2LCkNk64yJ7ARC+xgLv0rkL9c YD/Q== 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=vuhHNfWnMx8uWZhY+QeUk1qBtGP4f5NldA6jQRHm+6s=; b=gWXHlR6tOQx27Y5ucyTPL+BITHjHB3m2c35j3pljuJHe6WFg+cRCM0qVjXcJlZVyUu XXMRlQwMxgJ5gYpMeF/bMZWw7MjmRwUbQ6cBIHvGRsIH9nHIFo3mm8ioTVPazJrx8uRE Y5+r5IdswKD3Nlf3d8A8Vfp7UwoFnuHiZ4fJT9MPbodOWveBxz/5J/II2YZQWrbZiPsl bkVqTr23h+NWUOaAsuiLsaSYEeQK1zJk+VXxXKuuh+rbRFJbwqOxMVFQ2dRdDlhcwUyU PdlzwSA9ZSd0hRzJZ1BYza5vRb7DAKCr6+Dub7cT0Dlavu4wF1vuc+Q7bwN3JswgrWqD sMTA== X-Gm-Message-State: APjAAAU8gOAJw6PJQ2enRlkFNJ3Fo1iRqOn5fkj687fycghFS5wfcx8k ik0eZ5qBL6+YWH8rzQBf24TtpEDy X-Google-Smtp-Source: APXvYqyU5nndpzr0QoWum+fQJyhtInddKfe6IAExSW1yiBxCfRbTNkbhkh/AY20A0+K5tMxuOD6cUA== X-Received: by 2002:a62:1c87:: with SMTP id c129mr4927145pfc.113.1556061666498; Tue, 23 Apr 2019 16:21:06 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:05 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 04/25] drm: kirin: Remove uncessary parameter indirection Date: Tue, 23 Apr 2019 16:20:35 -0700 Message-Id: <1556061656-1733-5-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> From: Xu YiPing In a few functions, we pass in a struct ade_crtc, which we only use to get to the underlying struct ade_hw_ctx. Thus this patch refactors the functions to just take the struct ade_hw_ctx directly. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index beb2a3c..56a55d9 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -210,11 +210,10 @@ static void ade_set_pix_clk(struct ade_hw_ctx *ctx, adj_mode->clock = clk_get_rate(ctx->ade_pix_clk) / 1000; } -static void ade_ldi_set_mode(struct ade_crtc *acrtc, +static void ade_ldi_set_mode(struct ade_hw_ctx *ctx, struct drm_display_mode *mode, struct drm_display_mode *adj_mode) { - struct ade_hw_ctx *ctx = acrtc->ctx; void __iomem *base = ctx->base; u32 width = mode->hdisplay; u32 height = mode->vdisplay; @@ -301,9 +300,8 @@ static void ade_power_down(struct ade_hw_ctx *ctx) ctx->power_on = false; } -static void ade_set_medianoc_qos(struct ade_crtc *acrtc) +static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx) { - struct ade_hw_ctx *ctx = acrtc->ctx; struct regmap *map = ctx->noc_regmap; regmap_update_bits(map, ADE0_QOSGENERATOR_MODE, @@ -515,7 +513,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, return; } - ade_set_medianoc_qos(acrtc); + ade_set_medianoc_qos(ctx); ade_display_enable(acrtc); ade_dump_regs(ctx->base); drm_crtc_vblank_on(crtc); @@ -545,7 +543,7 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc) if (!ctx->power_on) (void)ade_power_up(ctx); - ade_ldi_set_mode(acrtc, mode, adj_mode); + ade_ldi_set_mode(ctx, mode, adj_mode); } static void ade_crtc_atomic_begin(struct drm_crtc *crtc, @@ -558,7 +556,7 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc, if (!ctx->power_on) (void)ade_power_up(ctx); - ade_ldi_set_mode(acrtc, mode, adj_mode); + ade_ldi_set_mode(ctx, mode, adj_mode); } static void ade_crtc_atomic_flush(struct drm_crtc *crtc, From patchwork Tue Apr 23 23:20:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162742 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354582jan; Tue, 23 Apr 2019 16:21:08 -0700 (PDT) X-Received: by 2002:a63:1509:: with SMTP id v9mr27116126pgl.194.1556061668282; Tue, 23 Apr 2019 16:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061668; cv=none; d=google.com; s=arc-20160816; b=AH1XlUMjRTRZRF92Yxgt6scg/0kXl4EQaYF0cf9zYya0m2pAvMlto/XsSVEIaBVPOj TyfRMRl0NsbO/DrPNMJqLab5Pn3Rd0kRa9Algs7SkHhpwjFNr+yihnWfcHuHun/1PXV0 seb5BQSXEeeiDgVg07M9jQfaDQLW5hsfMOZlMzo2yKDdC5c1p+zSRUiLL1IOfyqybnoJ wpckfRgHx/Di0QCxKOcdWpCSprThakiQxPXBL2WJwkyufpFevNYzL07XmqRhKo++owa+ VHp1kzSLynftvR7+05+0iiy3x4FYvUTXWm7QALABMRXoM52Kkncr73BEqb8C1c9hB+B2 zYuA== 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=/bl8KjJZ8VdKQUaQRpB+hHEQjF/aOlCQlEyUX72UB6E=; b=xVZFR2n50FvEWG1UsejsXEs5EsRnv0jqLUfTrlxVImW4M5pu38AdAPajR13oSfXJxG 0WObf/TO8/dUe7fo82ULPNxuXSiN1PA7xTI/IuGKqaJLAQYaNIJHJMaqK4k9mcIM8eqW c5nuHH90rnLlEJdxk+L6DYFhgFoL/aAt5QZ3zDfv1lDtHqJPha1j9APgxnKeRBBVxucE m43+neKvrrPJM6SCS4VLL6YI9kiFaBeUCBZ+L4K5Oz3QLAdPEGy2jlbelXImiSO9kdmY 0eBV2EeZqXcUD9iOzr6t6fDcviHXESu+SrWxGXL6XgrhNXT2hQKzXgzv2BAjpqhefVWr Z3mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OtmWoZBI; 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 r10sor19598378pfd.10.2019.04.23.16.21.08 for (Google Transport Security); Tue, 23 Apr 2019 16:21:08 -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=OtmWoZBI; 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=/bl8KjJZ8VdKQUaQRpB+hHEQjF/aOlCQlEyUX72UB6E=; b=OtmWoZBIcZcpMPhq5QJY7URkVpfaVsaraS6hIv67HgjGOoxqt57yVNkoo6100XtjNx kBnwpBmgfo5Ta4Cq1nVSgLojL8KlHU/Z3ytxnOQISl+0ockKjuwM9vsPDkKXhFHIjVhm obMXeYCsaNw6s033mdWlROD0fpuMO1WntVXFqmdt4dF1yifXbIAcvvs6l/e2qp7GUKpj exbe91fcZi/UYhi8rWQdXk7fBLbLhBq2ifYh0ZUpYwhliv/JigIRtClhoVm9eIVAApud 468K0QK2vuGUEpUFcS1okbeGuAWNqzFvLfdt3OCSGv0Rg+HHkbry27Q4ppANyq73P5ud 1+EA== 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=/bl8KjJZ8VdKQUaQRpB+hHEQjF/aOlCQlEyUX72UB6E=; b=Fk93G0zVchHaNEFBhNbGOzzP1JUsWolfvSIuqqDAaSCYMoBknSBerngUb0wL0Cach3 bLpM3V96dVbJ+vfe7j1Cxkri6yxuMzbB9pco6JuCelquLDNaFx4itigB1J4NXc+RjmwE ZSLFGht4BzliEJMG4Lo6xKC1cbEGZ317qL0TuEd0xzpbTNGGKxPOkIUnDRr6J0NmbeUF jx5+4XYt1xqOIlszYRoA7Auh53sLkJ03wsNFivq60rvDtTt+njyxeL/Vs1bjfqf4QEcg VQQ6H8MHz6sbMpTrdPavmt8gPcdcviZ+bYbLusjtR/pC4l7BLqrpLatKb6gV787AbswP c/lw== X-Gm-Message-State: APjAAAXV5BJF/8XJpaRmphDuXiv/dMWfDrnOrV49SzqK3pMXjy98H9/P ejxYZBUX7kIwF5cX3KsEeruF2JME X-Google-Smtp-Source: APXvYqybCUl1ESlOHxixy4zHex8X6auuxEd3pYgD+rEA0e1A5nQ0uG8/073n5wgpDK5+PbJOxhszuQ== X-Received: by 2002:a62:1d94:: with SMTP id d142mr29806248pfd.83.1556061667802; Tue, 23 Apr 2019 16:21:07 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:07 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 05/25] drm: kirin: Remove out_format from ade_crtc Date: Tue, 23 Apr 2019 16:20:36 -0700 Message-Id: <1556061656-1733-6-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 56a55d9..27a5441 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 drm_device_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 Tue Apr 23 23:20: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: 162743 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354607jan; Tue, 23 Apr 2019 16:21:09 -0700 (PDT) X-Received: by 2002:a62:cfc4:: with SMTP id b187mr29617846pfg.130.1556061669746; Tue, 23 Apr 2019 16:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061669; cv=none; d=google.com; s=arc-20160816; b=NPo65aDrMHoPrLUD4uVPOoFMqevx4hafOvdlA9XWQWtGmSiSRIfZ7Pfud5Ffvla4Bj dPLwnbFLU/KCsOTKjYfu3r3MuzKs5KxKqRNhuMhi3RdimLJ915jCpJKmz6tK0N/bCaZK sCBTwDPJdRwgBVXrCri6Vp0CRn9K/9JsTVZevI7wITsJ1hoamfujqpy9RVXaGlNGG19o HZ7EmPu8gLFiFXViOYSlXuAInNrEsOMcoabBCVMfbREB+wV+I+xN7OSIQa+CdBLlCAnZ 8ySIyjPZmGG51EwxNbGy8zOmyrw6EEde98/KcEgcKXtwyO9mXVjCSxXPts3KcVR49+J/ afMQ== 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=DvGXg8jivUTV+n5vONXfna2nW1twVfjjnPtpm0T5HXo=; b=V/yZKLGdq16bhd5+2wQsEZuVSZToNN3uLfhfaTTgrLvM3jj+dneSWRrqZGiXSB3kzI v9XFRwP3dZzA1aUg+SefoEaoygR7Is1YSJG7tbIn4rMqULHqOry0QxA3eqFbtiGfOxzz sXhKtoFz2KOl5xnEogvKsTyi6JqF6jz2qu4PB7OMz9o7rlUPncp/okafFTuK6kFTxbrx vtVtR6yXyHPGyWKQAgx2MFaQPzo7ZpQ3Hhr6RECrBGHGLYwYnUUosP9r6IrrhqH4dMDj 61v0VM97mHajcjRFqjiGF+o/j9QNUfSI3LmWDqEEJI32n3Rau7I37XNPc24kg8CH1QVx Bi6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KrpWhKYW; 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 b190sor3679802pfg.49.2019.04.23.16.21.09 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=KrpWhKYW; 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=DvGXg8jivUTV+n5vONXfna2nW1twVfjjnPtpm0T5HXo=; b=KrpWhKYW3Rt3OXTN4s/LhMn1SA/vDPr40ld8JhkyD2zMO5eJRf04FrAZ6Nx06TZKtf 8QpH25Eis+u+ebanyinpluKKZ6DweUpfjUZw185649keXFPW5eUNN/VpRqL5Ppkoitkg P/LJ1ayWw9uoe2uZFK6kCIRDjn+evIR1Tq2nVfcsrZ1Cl+/1mHvkdla9RKI4V/H9unzi D2ZGzuC/AgRRev9P33HxO05DFP7BSB/tWY0m/L21Z4Vxb9I6XYuRt+usNHBxvfxJc6hc 2aZQFuUcITPHGThudIK9btSOvA3YX3UuGyjPBY1FqRq1E3y3qq0acm479HWiX3GDbkvu 5kpQ== 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=DvGXg8jivUTV+n5vONXfna2nW1twVfjjnPtpm0T5HXo=; b=PAD3JmPZ3g/ia7fXs5AZgVjLVe4tgv10ksO38uehW1FDsDo0PFD0Ng+Ed9JnJqYrRl INpJ64stPd1eYF0yHGt2MjSNYlL46SfTaPWAq34RT8ZeTUjbzs13AD8rZLVUQbX/bubN EQpt4ALhfpM+Qm9PyTHF9UuRWHZy/ttEC0fOHcGPA6P9m8rJzFRYktpB+xQ67q21BvBq bGPC/PMZJEkeB9J2jFdlKKUt6H2nEW9HxvPoWEq4nCVd+Ojg0D16PDk1XCThKmhBwSEQ uQat57z/5lY5YLSqh4qnEdEPelEvh5tkGzWHChZJlQqkOWoCIu6R5sd0geLEA5V0DKUs /yZw== X-Gm-Message-State: APjAAAXGUixj6qOpFkfXOp6IV8w4TxHaqiJCm4pdAmdwWMn2tmjWJ/JN HmsigyU9NUJgRnhLjlFC6w16qL0J X-Google-Smtp-Source: APXvYqyAvxDUilcktH+6XRWek7LPMSsg6O1HVQtsJu2ELkYiMLsR/yRPKk2D7OsCpdbUeG/UoUsPSA== X-Received: by 2002:a62:a513:: with SMTP id v19mr29373670pfm.212.1556061669266; Tue, 23 Apr 2019 16:21:09 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:08 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 06/25] drm: kirin: Rename ade_plane to kirin_plane Date: Tue, 23 Apr 2019 16:20:37 -0700 Message-Id: <1556061656-1733-7-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 57 +++++++++++++------------ 1 file changed, 29 insertions(+), 28 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 27a5441..a229da9 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 Tue Apr 23 23:20: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: 162744 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354629jan; Tue, 23 Apr 2019 16:21:11 -0700 (PDT) X-Received: by 2002:a63:6d01:: with SMTP id i1mr12946252pgc.168.1556061671111; Tue, 23 Apr 2019 16:21:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061671; cv=none; d=google.com; s=arc-20160816; b=teznQTHe4J3mowmT+bInDWqkS4acOjlS9UhjIyLf+mWMXRd1PSq2neuWEqO/5FjquU o9KqSS3dVWymOZVa08iZyDLeQQ1ir6q+c7pFPo2Loinsil8fpwvXqulbZ5GhdFteMghR GVJzwFN7YPowcPIudosL5RvmiUut1B/SdfZfA34rE6Szu6WZDY78PRiXcTsdtWI1wN0g qlqOpHQ6mlBa1tu1MfR/tvoNjGIvX0JQph0g/XchDldTDRtm5NdizX5Pfwca59kP/LZ5 msOnprPoM3ZRyvOcGcNnICsqgq4NPJOwXrtUaxb7Vv6VupZzSxlCrXc0Zt4U3NZ4Cih4 Hz6g== 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=C2Of27sjsVd0ORjTyF+gAiuy1lvWfZZrKjZ9JKI5ILg=; b=SOxgUXT3iPriOSMnrMosYVUU7q2R0thavjaojm+z3zmVkyRr02I6YHwM4ZSAnenoV/ QyXMp9I/KFsddQVuWaQs29yAFU0NRQdUS3GR/wiZoaJZElgbYMUuF9SpOA70mp+aeaBd qL+5SiEvJEJnqXBhkTiW/pk5rrzZPImZE/b3Xp4XIgaGLs1IAA4KbJ+Nkm98iBlrEJng TS3OBrmcpXGXxltPfYJm0vlqUkyvNcJTkEi2S3YiQ5l3H4+v9kZWNZpSLjP5lDe4NKs/ dbgUgsmp0IjIv4lonWbLmTSjCMYp0a4enQt7I5cBcB3j1rilb2dAlWgFPJ6DfxPFgrfY Hc1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mNrrWoqn; 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 y4sor19737698pfn.64.2019.04.23.16.21.11 for (Google Transport Security); Tue, 23 Apr 2019 16:21:11 -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=mNrrWoqn; 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=C2Of27sjsVd0ORjTyF+gAiuy1lvWfZZrKjZ9JKI5ILg=; b=mNrrWoqnEM1ruztqKaXfuhFtumiBcgRZliUpxg8b7+y5eRAP9btg54IP9NQK1De/+m 9DIzVZAn3sD1OZHHoN1sVwQBaRMazsa3NNpk/AAxxZXRpWRrJyeLevFa/bo5EKr6UUlT iPEquBtvyrLk1unX1ZYgfDp53qC9WmNVSH2LZWyAi8Js5S2Q5mYYy/+qSnJZAGAN2M8x nOYzuhKdGER4UuRaoLW3oVn6DqLWJqF5g8bjtAVj1WQFsKcwHzQnYvnyq+jZy5fI0Q/t OuQaV/+fMgzyPUBRll+/bGqkjb0veFV3LoEIiAUJgLXltwgbrkRtZbZ4iMFn1MJWzZbj 5eFA== 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=C2Of27sjsVd0ORjTyF+gAiuy1lvWfZZrKjZ9JKI5ILg=; b=spqePC83DUtDV3xFakEkeHEin9sCiptwboYdYSKl9zT9pki3yJqE2Gbn2sweDa73Xt LM80/DCy5TGpC2AOyjku7sktvpBD2KWZgQeGTNhn6NfDT+NpL/hOjUDMtCGvW9AaV4jL UAkfQabp/MS+eC7RALBV5ijLyx0VqV/biL5qtUQbKKTBuv+Dg7ESRhUcaCN1X1T+x1gd 3DKmYIh+oZlVtE8xE5H24dDsTuZGdc7cBI/ZJDkTbF2wl/7z907XfPxuh8pXuIJUB3Tm joC14NVhtoq0ST+TGq+xlMnnd50CZqNPMIDPUeIWJxZSNcqRH5v1yEY5lCJg4y4vT0Tr L2pA== X-Gm-Message-State: APjAAAUX3G9hRBRksPQ2hg3Axw1ue5EWI6N7SaevYpr0j6VF3C2HEmEJ SLq2ZtDeo6+GWxCpQ/kWiL2psNFD X-Google-Smtp-Source: APXvYqzKw7zS0EAy8qbNtzZzV53lfdRumIR/g1abofkw90uzoBOhtz6+KSCIx/k+nNLuBlJLxdFrKA== X-Received: by 2002:a62:70c6:: with SMTP id l189mr29822449pfc.139.1556061670711; Tue, 23 Apr 2019 16:21:10 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:09 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 07/25] drm: kirin: Rename ade_crtc to kirin_crtc Date: Tue, 23 Apr 2019 16:20:38 -0700 Message-Id: <1556061656-1733-8-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 74 ++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index a229da9..c29ca75 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 drm_device_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, drm_device_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->drm_device_wq); + schedule_work(&kcrtc->drm_device_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->drm_device_wq, drm_underflow_wq); + INIT_WORK(&kcrtc->drm_device_wq, drm_underflow_wq); if (ret) return ret; From patchwork Tue Apr 23 23:20: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: 162745 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354657jan; Tue, 23 Apr 2019 16:21:12 -0700 (PDT) X-Received: by 2002:a17:902:aa5:: with SMTP id 34mr12548195plp.263.1556061672434; Tue, 23 Apr 2019 16:21:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061672; cv=none; d=google.com; s=arc-20160816; b=CJpJrh+C6riB2uP4I1bb/9RotFj5xtE6CA0lcMeO6tqbWWtr1QKkwBa/SBTrOeWEU5 3nHhLNpDKoIDBStf7uL0Pb0bDxsfY1fgiRMbOP5WCntRFWrzjCVgjjSQXD2wRkZVjIFg hQBXKn8+6CWuhVPx4yuqNydLn9q84ar2AuXTl2AAntXK36eVTUe5IdeRA1rUO5fTqKVH Hm0xEhtR9Z+RJzPVNMSxMMCbTX+WrhSfT1iS7Edrl8NgmUHW/TkBvLI6qTuJEN73U+RI bcXLrH12tPEX7nDd2fEyzNoV6InXWF1DFFTlq/SqZs+wn37TY6C5gQI3i4vyLYSHc4mY 116A== 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=ZL7k6e/+E9bi/0it7T1LpM5/z2yHQD26NCZ4fJDDMXo=; b=HU5WA/tAdjxSvrNbzciVWGilgwR+tQhsfegR2hRlp386Fs6T58TAIgZ0PWgM/lz5k5 x4gmLolFYrrrIoC4iPIRahXOPD+tUo2xOJuo53CDBGh3Rg4AG1rTzVj94heWpMpV6Z1c Yd/lxiFCz1nt8T8wI4GbQ+lhiL3ZTiwvczAwh/OYtSf+VCoKFp1xcVhKrgx8QJTEzX6+ y054nR1Ira82b28RQ2Ei3/Er2aEBI/CrE0dJae+1lTbCF7hDfO8i5ApZHJSkdhUTfY5L IYLdALVAgDyJnUrKUHWt8H5VEN6q/eK3ux98QwRmHw67qAXgeNPetNc787pueM0VCmH9 21MQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e9dZ1wVL; 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 go19sor15181013plb.66.2019.04.23.16.21.12 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=e9dZ1wVL; 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=ZL7k6e/+E9bi/0it7T1LpM5/z2yHQD26NCZ4fJDDMXo=; b=e9dZ1wVLSPvWA/a7Am/iUIeh3p/2KfR17jKwh4ILeoBT1TFA6w2cGTm+5redia83kT NZLaz34vgkgOSq93x41VFcF8ZGOo93Fa+fhuuTFqu4uGONrzbEduvBmgco2DzKF9B7CY KnIAMAhlyqkhVN8Y2gBmw82LR73xjibvdiwjBWUhWU6sjpYuHsNAx3wC+wdWh4SSZ/5c lPP9mghFDRCC4UsYuozd4QxjmFyx9fmMr0UybTHs8nJfKr1CiLsQJtu0vRGC2EypQA0T dDehixG3Yxse6Uap9N4y+PQiM2M5jq2MXVW0JkFP7d0GwwOaQvneXn+rAWMXTxh54Vpq lbuw== 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=ZL7k6e/+E9bi/0it7T1LpM5/z2yHQD26NCZ4fJDDMXo=; b=jWLHed9UqCfY/BfmWU8IvoB/bTBve1J4BZnc3i2FYxG43nxk2SYIpm3Szduf2GTdra CCrIOKCdvDNjUSRwIqOYRjJsF7PFR+IMbn9Msm8ZOvOdn/5+X/Z/ek057THQD1/2UUqb 88s1e77hhQvrh9bpdleMZWW6sHIOXMXPJXx9zO5r+GOks0nX8En8mhqTyLrhW8cjftit 3jgmTPbK6/wqS7OhSeeadMfNEu3l2dtyfWJWc0qDWo9boFnTv6QHDZ/icC4NKUBTKvfY BQknuLVBCsPQveMKLwWwE4/68oIsWBlHdLzoha7izEyDPSL/GsD2VnKUhFYqo3Z0c5h1 I2gA== X-Gm-Message-State: APjAAAX1z1D8DjnfXasE/KD6TdMsHGSfh5bo+RrJucFPxlDT34+LgT1v ewED2Wl/iHJtA8t0bUALJFfyEEWU X-Google-Smtp-Source: APXvYqwe2/5g10OCkqetibI8U3Eh/TAGQv3PJF1E8wn4SUxctSU1TSdYDszeqlbbwNLKeQ2z0TEn3w== X-Received: by 2002:a17:902:2bc9:: with SMTP id l67mr29137478plb.237.1556061672036; Tue, 23 Apr 2019 16:21:12 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:11 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 08/25] drm: kirin: Dynamically allocate the hw_ctx Date: Tue, 23 Apr 2019 16:20:39 -0700 Message-Id: <1556061656-1733-9-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 39 +++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index c29ca75..0aa716e 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 Tue Apr 23 23:20: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: 162746 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354684jan; Tue, 23 Apr 2019 16:21:13 -0700 (PDT) X-Received: by 2002:a63:1702:: with SMTP id x2mr27052826pgl.448.1556061673871; Tue, 23 Apr 2019 16:21:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061673; cv=none; d=google.com; s=arc-20160816; b=xlJvM8oWMQCqNcLsx5pYzp+n+G09nPAUjEyv/dVXeNsJFuQDNZ0rNqPjbjvpmiJDpP AQhOhp3oEYSWPACqznKpiQtlUAUrNctUUAAXh0WA+7H+MMBAqU8jVFYNU5FhYZZBy0Be z1T3i1S3/WRq0+DX6EbrlaY4t3lBUOmjixiOYQeNgQyhLfRSKf0Dcj6DDUEhekGqnEQL oabR8oxQfQ1KIWFCgZOAPdsgFXiA+kMcHaEvwnDiCfNfX5kZx6thq91iVsbXHhfLjtPx izl5VpgLShd7rM8KNZLkI+Bcdse50jMMSNN/Vm/f7XEir9aEicSI0m/9Pqa1grmvKJ7u m8xQ== 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=CaDQKtmoJIrSmTozd8EuBlUja2GH18dHC9/QnJ1EnV0=; b=fpuSjV3StgFEVrJB7bjIj0SYD3wN9bJVf5Bnw6NXapnQzUZEcXGlbbitfhBj4PB/3s PTK+25AtVXiwxBm4WVEO8nWIbXoNPT5ZVkALb1f2sfbbCJL4sJSErAyd7qpx/24O29T3 lfeKgbdprpg0MT1lxDJ8/JK2Cs9+5QSJnXM8596PxtjKJOK8Q7ILoTeVd8fL5F9QsABT yjOXmrRETLKQ8qH/X9fXh9anHC6wBQkUKBE4bcCq71j7Mby7kSTZ/3sg6+qTBLvguDBZ fck0mPPKXBOJx1j9csojRWWWDuvu2nlDRMaDW1iulRg9FsNIlhLhgiw/iULiXa8LNCRr PG6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GRUGQM90; 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 y40sor14932544pla.72.2019.04.23.16.21.13 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=GRUGQM90; 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=CaDQKtmoJIrSmTozd8EuBlUja2GH18dHC9/QnJ1EnV0=; b=GRUGQM90BHyiEZRiNX+NUKgtw0znVvvXJmoarXas0EkZYjMBVWaBh5BSb1FfmEjkEl EcQJc5zmZ957OsDrFJd2XEKFrIjd3cIuJxV6vFitrPu2pSSR9S+rVKGLA7njA44gRFVX OgmLv8F4WLWIGqlMK7tSXqNj5bm06Oz7FGOBVuIUlpjqi8RpPTG0uPEkQPtU/UXXrR0m cxKhPqUSAWnr1zhR2Uyg8L7g+dEpe5LZFTIb0IJypWwhF8qP7h2L4rvVCJnfh5H5o8DZ tjTZRmwr7Tzo7lN8NkfWEG+YZqf73MNY1uvEuZVCnEJAH47fO36cKxSvqjf3YFYVvSWZ Z+XA== 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=CaDQKtmoJIrSmTozd8EuBlUja2GH18dHC9/QnJ1EnV0=; b=P4n2XIYyugZ7SQbb25dK+39ARrdHG4iNtRDfY/yvqPRu1W5I8B8qpall1oZF6vLmOH X3MJstEi91G745htr1Bg16rwJfIfYMw67hqnry79kOQTSKb+CXisqR53pM1kg9ATpw7S izuXNg0JtclEbCGRq1aeBI4clvNsipI1phpBLGA3RwmLfxZRJK6/ooJJWV0a2X/ckU8K oeY8gQu3jA3JFlX+ExRgIkIqROwatD4+jD4S0JA9Cmdlt3KL+J9kRz+i/Z/Mf9a2nZbH Hpc7tGRQz2b9N9iSxqqMVrnjqkNIDqJZ7pjLg2A7SEuJi7zNmg8/TcW9jLN4U5u2HmhD sf7A== X-Gm-Message-State: APjAAAWkUjZapM3GW2YgUbo4l74ofuBDhaMS4bZvBEzmnVco4HqSntUo Elh/Wq0tYqdBk0y2OUQKm09lruD7 X-Google-Smtp-Source: APXvYqx6GhW3MwgQc0Z4atGss2HmuRGSfxvNHOR/nmwRjSjppjo/kNExudaCLMo7krOJ2zFYPx1oBQ== X-Received: by 2002:a17:902:e683:: with SMTP id cn3mr28997997plb.115.1556061673428; Tue, 23 Apr 2019 16:21:13 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:12 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 09/25] drm: kirin: Move request irq handle in ade hw ctx alloc Date: Tue, 23 Apr 2019 16:20:40 -0700 Message-Id: <1556061656-1733-10-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0aa716e..94dcad0 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->drm_device_wq, drm_underflow_wq); - if (ret) - return ret; - return 0; } From patchwork Tue Apr 23 23:20:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 162747 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354703jan; Tue, 23 Apr 2019 16:21:15 -0700 (PDT) X-Received: by 2002:a63:d349:: with SMTP id u9mr25916575pgi.83.1556061675295; Tue, 23 Apr 2019 16:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061675; cv=none; d=google.com; s=arc-20160816; b=I8GUQArFGu8j9Df09EKc5NfZPYNNE4B5t/rBjgWd6d858LAOxDYvHwPXwx+4bOB/s+ NPDk4pp6nzwIo1Ry4ePc9DvU4OTe8VOsOKB2cxi2Xwqb8kYZKkKpBE92iHhx+3jyqKwY ONk7bsEgiX2rNmZEq+33U8XZCkCL8FelVeOWKzJi0iiMM+qH1Myr1waE9QvoNw08jmEU 9ZgHxk7ucnNwjd9VtMf0Z+vygvIZ/DmWAjrM7l2gadbNHTUoxFih5+8hZEWAGwiTTxb5 WxtgIGM50lTLwKkVLN+sm/yO1s0XtpMidagCsoZDJMy2J5A/NvlKoEF4UydRL6xr0Xtg JscQ== 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=xTm116jbzqBEXo1zbyHHVrRjnaN2HZMnf5sPll9zTbw=; b=E3hA3s5qtTqLeWcfMkTCJ5NrKQBFyruxSrru8UGmk/1/CYWasLezpD94OHCCKItDtd fw8MFgV2AMT+EfD+kmRs+ozm1UiyYmBhxJ7bSp3fTroAT87qT/icVm2LdZB6wXA8XJqO hqvzvnphkld20UAPS8/sOKbtcuywdQBqkLu7FLTHu0ZohF+6BP6bl9MN8UfI6OJAX/Fk 9Mw/7sSva0OlHz34gG3EfeT3fQ++mS5fOUBeHDyqpbLxElXasakuLKWUHUgfu44uMXd3 LNlDA2UR0FhFidqNZD2NebGDrKclbi0lMoT2RAd5NmzTA8z1rJYJts58X/yJuPeL0P9M qKzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iQmaSI6q; 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 w10sor14757105plz.54.2019.04.23.16.21.15 for (Google Transport Security); Tue, 23 Apr 2019 16:21:15 -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=iQmaSI6q; 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=xTm116jbzqBEXo1zbyHHVrRjnaN2HZMnf5sPll9zTbw=; b=iQmaSI6qMUz6Cmn3MAJaIzmnZjHAJOpl6IiabW5xVfy4iQLZ0Dw5AwDnOCUR4bkap4 LXSb39TrOxCo8f/ADnd/pKEZQEQdHh6WFj14PoTcv8SV0FvZEODFg0uXy/xrn8kXH0en GnFVY12TrHTMDPBQrHToJu7LFzJ3xSRuHCT8s3x+IHpMxkFEcm2rPrAElzrz/WuDMsS6 filnJMkHdg6n3/S0Vn6mnkGlIz8Tva2hPAwy0jS9vyFVfglvxeuHsXYuOKS+v4fWCpwx ul7M4gutNYptU3lCDZviwc3l9UNjf+08FowMjODa6EpbvuFy0jDnfPspn94fKl1NMbEs 5P1A== 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=xTm116jbzqBEXo1zbyHHVrRjnaN2HZMnf5sPll9zTbw=; b=b8m9L3hYnmxNbg181oCUYNyakSBrrNoUbQaGrocPk2Uc+P9tX+Nv/G2PO2Fc/8noJB V+Tia02ypqPWmGZGNciawequqERrYrV4Co7NQnWVV9SovqstIfnB0eP/7pK8WTbzuCcV LzVm6hInPfuemct5rqDZXJSQOLMIFurfoehRA7KdTZT8C5hUisQNRSDdSKRyjUNojGBA crJmHGcA9PmPO5pGWXvBXJxM5dLcs01BZih3YZMlPXzx6+N9Clq0LzyOnMdZFv4y4zXq 4XH3HDOynvE0GrCWR/Oua9tpTtC6lWi/jAkyJZMRRi8OG/10oB8kby5jqYaxVppBozEJ wH7A== X-Gm-Message-State: APjAAAXx9v+LPFcutcg2X9OCJXlpweR1vJAJC49k4LpwL9Ghrls1TwlB H5HQf63k5SRMN7oPOxxcqXXKz7Ed X-Google-Smtp-Source: APXvYqywTXKIf62IMwvoI+e2f34rybm50ANUcnv+iKH/YohFQP0Xgd9A95IgogAWE4lL9vspQkXEYg== X-Received: by 2002:a17:902:e684:: with SMTP id cn4mr28490956plb.71.1556061674718; Tue, 23 Apr 2019 16:21:14 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:13 -0700 (PDT) From: John Stultz To: lkml Cc: John Stultz , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel Subject: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure Date: Tue, 23 Apr 2019 16:20:41 -0700 Message-Id: <1556061656-1733-11-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 94dcad0..f54cf99 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 drm_device_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 drm_device_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, drm_device_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->drm_device_wq); + schedule_work(&ctx->drm_device_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->drm_device_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->drm_device_wq, drm_underflow_wq); - return 0; } From patchwork Tue Apr 23 23:20: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: 162748 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354722jan; Tue, 23 Apr 2019 16:21:16 -0700 (PDT) X-Received: by 2002:a65:4108:: with SMTP id w8mr27262325pgp.236.1556061676715; Tue, 23 Apr 2019 16:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061676; cv=none; d=google.com; s=arc-20160816; b=EfF4JGDWrfcIyKLCvTiLM9EKoCMoE9Bj3I75GIDIduuY77caoZUYvvZycltQrT+7pt 9gSDNSEcOhQAtxgMpZHF0EqAuffBjv+iZw1iylrWAekQU+eWwk1mHAhJ2ilU6+bkKVgx w8QbZc56BGQEgcMczYB3BMRL3h6TkIWKkGvauqT9mzzTYYtAW5knxX3wDUFaQIoamLHi HcjR0Rs7PiRPLT6hzWHP0qpQ9dpm5QN57oKJCirfa7tEHcVQDXCDZfHjrvlXRo1NP5js t+wyF9ObqU+w6H4KVmBchreL22mlp3UAHoOy7DueW/C+PdQNIf30M8QbASvwGtdcTUzk Oekw== 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=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=Pn3Uwm35J9kblppD94JGbetnvm5YNv5kW2Jh1LTzeBrjg265T6DPAv6J7kSDEpZUUY 1sQFq2EklCi6U16QKLMCBPfhSQFTpOFcyj3pKC7LxWzc3kEP+moiyQr0PTyLt+Q66wxb Eh3kaJ3Hs6on/hfYXBcoNGt/4hpf0VnXJ8AQPt4ku+MbRrb+EdWtjn5/ooQ/EGkRHPgR Bx7wCN1jbuWxFkxd69xc8kq2Fn9bHQAbAZUWzjaJal0FwvWv3luDnxAWJe9Cb5AWw1YN ARt8nlAidmpi9H5ofaGcXpkkYE6uh70una7Xhvomw1P4kZUly1+R5BeWDCgZ0JemTI+u uTHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cjViXEEt; 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 cl14sor14830375plb.30.2019.04.23.16.21.16 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=cjViXEEt; 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=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=cjViXEEth7iNuFYI0MTKtfltpV1DEW3RM2sP6kFUQRF1yZR+gHY7wnkxF3NQprorMh QZzV6oCUnje+bIBXL2+EU2opo6GijlLcAJlFZsX/91h9PBwEgQ6rR+QJVP/O0TDvse8n pQ/VJ6Qz9VTNyjO7XHtJiG+mFyQZKYwb70p6MYw1n0iIyJuoBhyyOBdNueeuYFDrrUm/ oJvlcKblSvExCfIpIG6Ngvo1v3zwOfBaUogRlbYNEeLPs7baorv9X9m/lbXA1tqQE4vi grJpEZNhCwaSYGU/9srOxbi2No7gzI0KKYLH8uJHtHf4fjcB3woDCkn/k2jsCI6VTlhB wScw== 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=QV6q4rIQIKonURhV5YI0Y2da8qAlozUPAhHD+uzvbZs=; b=oGCFdRLkqqZoZxJnHX9Z9s+PW4T15cA9N/lLwGKcU3yNFtsmoQmWaoQChrMoCnSsw+ c0FpuSRriS6dJRbfhDqm8OyBvPCBHuaKHIs2SUCAp1SQnO3JjdTplXJv5g09rskKThxN uPoiN8x00p68W9kWd9xQXrIr2pElNTpJxpzYkywLEGGGEgZO+aT2/FfSivzDKYRw2/Sd fIUB4BRl1T6CXvX3dsRooMrMSo879NegAo1x/VtDuxwx2zZeXn8eLMfbCR+4EnuRmhJh 7gJgWEfrIBwIzX4KNMecqX5tJVYFH7e0e4SHBpJ+UESlzF9wbMIffGyJdjjiAeFqx6YY RPAA== X-Gm-Message-State: APjAAAWGaHYs2ET9nU2mghMYsi4iQbyr5tOdQ06RmLkd+AOWNNV+DUgs 3Nc/v1NsecIVQutFD8QuuRLN4df7 X-Google-Smtp-Source: APXvYqxcrohcoxF7N0y3iDmLR1PiNAeIDv8NwK0xG5vjhqwI1ajGwj0jXu3C4/WphYQxCdjQhubPBA== X-Received: by 2002:a17:902:a7:: with SMTP id a36mr28776329pla.111.1556061676303; Tue, 23 Apr 2019 16:21:16 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:15 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h Date: Tue, 23 Apr 2019 16:20:42 -0700 Message-Id: <1556061656-1733-12-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++----------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index f54cf99..69604ad 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 ad027d1..b6626f5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -13,6 +13,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 Tue Apr 23 23:20: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: 162749 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354738jan; Tue, 23 Apr 2019 16:21:18 -0700 (PDT) X-Received: by 2002:a62:70c6:: with SMTP id l189mr29822963pfc.139.1556061678006; Tue, 23 Apr 2019 16:21:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061678; cv=none; d=google.com; s=arc-20160816; b=rk7sTEzHK06VJqLi0o0zTqTzkr/E6m/sgWpPQh3nwEMoYLsrPTCfRvgPwO4HXqlywG nP5YdcZpvZ3nt2pEendA1GhYpQrWQ7eN7Vrcxa8IwQy1oxrLu5QwR2kvSaFvNjnGORYc unY7OrT3UkUqhhn3OiVk2pdCuJTpUWb8glLItpB7RfDAdWIvFpykU8/XuC4p5NtYqI4B hYjujBVHFsEiSK2bTF7SfBZBen+7KEcFV0qscur6gdgqnh1EBttp5FxVlZnVrNxE5Azw fmgN5lt/9SNARomv5kcPjUFSGW9e+EXq8jXQY7gPf+rt89zQdUQymr2skA535JcNbCZx AR8g== 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=6PCKCPiU9SZdVwZNOi58l1CUoj0+t8ipJfFd6cL3prM=; b=S9pDcC9LSP9PK+NtTriPFWqHo6zbuTYC/yYipaxWgTnUNRhBe9Bef5R6lIsB0RMa4i cEzZCUxQ2DuSltrXc6+TRmntERD9B9k56T33gkyPNUDfQ2ka/Z/7OzV0Fobr0+pzx/GU f7VbXU4YBtxhnEq/DsNOKb+jZXq4K1wSJAo99wkIQW5ap0GWFLtocb/XdstuJHkKaueF I7XDIEBVKU50rDPGRiunoFQ/X5tKiSWLtC4nq80OL7ERHHU9sIMF68WbNocu4XD/dARx 8GhPrBiY9A87pbJPIsTCbcYJX/sb/meLoWfEhlm3tiuqdW4Whhf/ck6NXDVNqAuIhU9y bEzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GwhOGLab; 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 j23sor7297861pgh.83.2019.04.23.16.21.17 for (Google Transport Security); Tue, 23 Apr 2019 16:21:17 -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=GwhOGLab; 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=6PCKCPiU9SZdVwZNOi58l1CUoj0+t8ipJfFd6cL3prM=; b=GwhOGLabNj1ogmYVg2kJPECIFEX5dIE1sqaqYYlbpRHHj/MegxUZs2twDSbdDOpPrN qx89kGM6TT0YMzGJ6MR3VV0EwL1lxcGqj0LpzQaDwSmVNkF2DWg9mFYZ+A84x476fegM 1zz7DdykbEVJVcC8SODv5cUQNdDmEU0d376ZzTUc0vDqc2uBDDGvi56f67ZyQJ9QcFH8 u9KqgTLaRwfI/eF8vHHmmpBFydcY63EIrjH6C9+aH8pnCsj1jZjwIR5GyZAuNSGXGIoi moOSEzaEQ2i9BsEctw2ye1fGEZbjWQ/zUZ8tdCpXgnFk9ULihgT7SVZDCW/V0QE6REwv hR2w== 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=6PCKCPiU9SZdVwZNOi58l1CUoj0+t8ipJfFd6cL3prM=; b=lTFeOSor/aBe2IIs+PF2UYQ6mtfrAy4g3jVlDvIO+vRxchcihBcRQvC1EhI4U66KSQ +hUGfgtD8qyIJejuWKouDimIRM5LFcvpRJBv/4pbbvOoXKzxGlm8ep8rPWt9N/9jMiZ8 K00lZyw49j8EkZmSAp66f6fPoT3zB1MNGzuCzbKd+JuLAQvM5ZOumG1MDs8xNX4X9qPA Eb+LjrdWeuITrYJTQeIU8N+vGm6RB/YAwCLfZ7PHUwTxTNoW4Z2p0k+gvuI4efT3xZpN kIfGmaCrvn/EBfvFfKXdstO/NNQsq9Mv3YRgN5xDeE9VPVHHf0pVcTsvk6ZZH1kOt0W/ eORg== X-Gm-Message-State: APjAAAWjt4iaG0/gBeE5XzWj/7iC+EPmCeS7OFJyWDbtLtYVGfkIDwWN FemqbG0a45gHaPC8XBYjksgk9/81 X-Google-Smtp-Source: APXvYqxgF42hSTlly68/9rDVQn5ZzCxjggQGa9A7iGZV0Pli2Urp/fkPZiDR+6p7r3hmRhWkcrG6hQ== X-Received: by 2002:a63:28f:: with SMTP id 137mr27875194pgc.377.1556061677599; Tue, 23 Apr 2019 16:21:17 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:16 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 12/25] drm: kirin: Reanme dc_ops to kirin_drm_data Date: Tue, 23 Apr 2019 16:20:43 -0700 Message-Id: <1556061656-1733-13-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 69604ad..221bfbb 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 c9297d6..b52c40d09 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -30,12 +30,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; @@ -69,7 +69,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; @@ -100,7 +100,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); @@ -198,8 +198,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; } @@ -217,13 +217,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 b6626f5..276b159 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -38,11 +38,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 Tue Apr 23 23:20: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: 162750 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354756jan; Tue, 23 Apr 2019 16:21:19 -0700 (PDT) X-Received: by 2002:a62:e80f:: with SMTP id c15mr29500448pfi.93.1556061679345; Tue, 23 Apr 2019 16:21:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061679; cv=none; d=google.com; s=arc-20160816; b=Oh5/QiPchrVq9ihMBsJNRTbuq5ouwlRiUZD/0e5k2vXFhheFfLX5x2qqW2K+nbI3XG yqQXyT5riwVEStRWFsIcnVkpLQ60yTUiZSZZDYQgd3MU/rbRYLIHbDRgFLByl/zCBgjO 2pQCsrDAhW9PprTX7zGq7N/b6kbp59dz+x40gLtZ49SEy8C+dWmqYNCE3OPBx7K6BCX8 SHHlreXQOiVjGHz8tVVf+0tXSuRr1U0moTSrC++td1nzR0zziqmzpTsommVWNYWVA6zM x60gX9EaafrdsZS332E/oX3y08X9uDxQmTKkqctA2f9b3PL2fWJp0IpWBOzdAgH1Tdqq voDQ== 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=nanMR9WGZAGOt8W9FCJsIT2NdvldMFJeYO2gST1GNm0=; b=PZxOtbk68gYgP1OgZGfVmcniUmP23NdwC6/qOkxz6XenZ2chJeiAfzm1EFhmC2vdoT 91WExVZEEENiofMtaqdFWaxQyGCI8brJQ9/Pr8AnOVdH+hPL9ltkMjijBUJStMjVKsSB oeyr53DLMxGbS8h0xmCANU/6aOWOs3RAQQJASNVcBEe2Fmv2w+WrCoiH+kVn34nt08Yb iI2H7BkKszSTLWN5BP4XnrWFnkRsMhT79pSo/Es+iiuZZE4kDLI8X5JzVv9+SpXTPL3D zeDdIUyZVKqPJbOm1hnERklrDCPlYRp71lDTfz8TWK9O2GHFnlJgz6noOqVgZbG0yLyj CMTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aaCMAzKK; 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 f4sor15077038plb.21.2019.04.23.16.21.19 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=aaCMAzKK; 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=nanMR9WGZAGOt8W9FCJsIT2NdvldMFJeYO2gST1GNm0=; b=aaCMAzKK87Q6UwN6wPqpfWKm4r5h4W2daAKhhs0a/xCwkqMd1/t7RzCSkZgdGoC5JE VS9i7z2Ar4OSACfCAcsHuYKZHPdyhV8p0ipQakZUFPC1Gc7BboDmYHjLbsIIOBOFEC/7 I0o6VV0Vi/JJ7HwoCvocaunOnRsFyrXffVeqj6abGZ4fFc0/lvJXULVa1WL3Mj9bLxb8 G8SMg6onZZKW+7CQlUMuYU18/cH4NFd3Dad6t9Ia9wPOls+G0PpLzAWGwrMUcWO6jSE0 wHyAM9jM7qDS8Ll7wmv7jzwMwSFV12Lg+vw1/LyDzXw2KirEp/cWHudNU9TcvoSnbE8J n76Q== 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=nanMR9WGZAGOt8W9FCJsIT2NdvldMFJeYO2gST1GNm0=; b=VLJ4servbxW1sRkqrBTcHMpBEHf9eK5smUuhCUQqsLzeo66CU2qh4nHrxzQ+Up97YN xnR/BbPwRqIB7xNskKtq+rDPb7kxu/4e7aNc+EoZIXVZqR+yL68R+ZMOH7HRB3o42zki SdhO/touNsTiepDQE4R0yYiSO6pUXKTs4rJWXdoIZ5/7ENtsymf7jHLT2eknEAA70kQ8 IeTcsY1t+6CdjJ9W4i0tdcergzNcc6WgwGDVW3F3/vsjASs+sUaY+7R6GFd4tnvSKv/i d/wkhqyS65YP1uYC39OLubXWMmWaBKonFsaqWPu1Gyw+4GSgyfK9yaAJwnLEn33p9pG9 M2fQ== X-Gm-Message-State: APjAAAXr7v4bd0sEzByIbGtrAUbns//2X3LOMbn27gT7Sp8bVRQJd33o kzxZctIuPHly9zD08EqWOtmpPoYZZFFACg== X-Google-Smtp-Source: APXvYqyALxw5aburaoX8Cho1JkZDKW/0Bhym/vqMYkT0zsTkkFhaiQrNR0Zl20E/oAv3pySG0Kta6g== X-Received: by 2002:a17:902:8a8b:: with SMTP id p11mr28494162plo.227.1556061678919; Tue, 23 Apr 2019 16:21:18 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:18 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 13/25] drm: kirin: Move ade crtc/plane help functions to driver_data Date: Tue, 23 Apr 2019 16:20:44 -0700 Message-Id: <1556061656-1733-14-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 221bfbb..6aa529f 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 276b159..05161ff 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -39,6 +39,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 Tue Apr 23 23:20: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: 162751 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354791jan; Tue, 23 Apr 2019 16:21:21 -0700 (PDT) X-Received: by 2002:a63:131d:: with SMTP id i29mr8815327pgl.399.1556061680989; Tue, 23 Apr 2019 16:21:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061680; cv=none; d=google.com; s=arc-20160816; b=r8YJkfWEPkGGlRO6B03GtCAKeEWzmyd1vNFnllZyzY8HT7yFo4zBU29QX/SdlVzrKU XfZGWQJ/ygL7G81R1YYod/8lg+hfz5B2yzIGSN9qLnXhBSSUmCpdWfOrHJ/AQI86KxJj CP+Jsrh9uUK25zhuHFgLlO8IP59WXqxh4tIRyotKndpe6jI7lpFnVg9CagETe3ECGXxE exobqqu1I8PwJLiiAQ3XGglkeny5fBDxdC1Oer2wAm7xiBtFCdN0Q+o5JJ7zcK26vi9t 2aNcKIh1mwxWNsWa3OwILuODtIIxHHSc8GXNQr3NgpeIvpKHh/ncp0z4hDAFnFLyHjLV I4gw== 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=3w6o3fIq2iIb7WJJVP20Z4EfqmYB1pkBjh2u5OeFpHE=; b=vNZB2jWt7Xsg5SP0jEkQZv5a5/m1i1uGILfVsHpYdpHUWlyesBOgq3ZlLPiaeDm7Ym hPz0+e7Tw+C8a83CFjHVqwdMJ7RNlqzgrFwZrM0VONRWa/fSUddbNCMSuk+mFBZw+Ytm 2hLcYC4YvzEP0EgGT4QQXBdbo1MAypDD5KzYFVNzlHHZ0WRv13k8Mfa8kjT0n1CKrZsy 5zZEXpcrkUBWih8jGrlXGyf0YJFX4n7mnlPxXOzxoQt3KkraP5n/XRupmc9csUJtrWb+ JhbH8MRRF2Uzt/mU0T6urRXwoY9fdzx1a0+T7yXlAtYVnNl3dNigUG0UpDwupvs0Ddo3 eiDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nsh6amFf; 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 c193sor14839434pga.4.2019.04.23.16.21.20 for (Google Transport Security); Tue, 23 Apr 2019 16:21:20 -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=nsh6amFf; 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=3w6o3fIq2iIb7WJJVP20Z4EfqmYB1pkBjh2u5OeFpHE=; b=nsh6amFfhd4Ifw8Uob3BkzyqOpMWuM5rJhtKKK0K9SUaDGzpNqrP6Lnc++KtbbEF3h LIMAIvD+l3blZ+t0HETDRB0yQXT7NQnHsqLQw8dDMjbWsjm906Q/cB/TSShSRYBftQZO mZ3LbYAg4Cm+ma8lYjL98QaSTKq2IIJAS3weMwVpv69FnsZJ4o75c3NXktFKh1/FE0bF YR5Lkrlg0WpXi7dRsarHuft1+QdTWcJj6RXKCUfYuizv1dR4mhJWqoOu7wxTz1A3JdQq UabNV8mgRAODM/JiiZggCXDfQNl1oEUaK8LCz1dtOoMoQV8IiKCHyTXldR0RMTF95++N TscQ== 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=3w6o3fIq2iIb7WJJVP20Z4EfqmYB1pkBjh2u5OeFpHE=; b=AXyELfipXt/SGi9Vf9dhHxa86F0xJjquzm7XzvhF8iHSYKm/41yLbU44q927JqeyUB 3ZyEAuXoRhVZ8kqegqz3CKqIM9sVlSjvNpR+IifL4Du01uF7E1/GRAGmOhJjlTc7tH/f oXCv2xKk/ji/r0Nn8+8ZEcVQVSJPQN32lkEkKKBMIhqaDZ+w9IeVWW45x6/NaCxO60JJ uYZx8KgR2L/0H6zJ3G/oyMjotmb5RxNjv0Q5Jco7MAVukN07k4TjS/HZGIDhqYxPdRax ZywA0ajMOldaUZ0GcgHFMe3MEbpBK+V15M99u0DKYsVVg9fCq+dpYM/tmKwj/LHFo05A 9uJw== X-Gm-Message-State: APjAAAXhB6+ybaosCUy7pwauseK6P/dnzW0uf1eMy7Em0P0dG0tDmNeZ VKNHa20Po+GHOhkjWs9EO7LFycsE X-Google-Smtp-Source: APXvYqwUCGfe++hbxuKspqGxqH+ClR1wU0pXlx9MmWXqxBNFEBl3f+cwivJTEk5ptc68rsDcine/YA== X-Received: by 2002:a65:6414:: with SMTP id a20mr3518840pgv.217.1556061680604; Tue, 23 Apr 2019 16:21:20 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:19 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 14/25] drm: kirin: Move channel formats to driver data Date: Tue, 23 Apr 2019 16:20:45 -0700 Message-Id: <1556061656-1733-15-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 30 ++++++------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 3 +++ 2 files changed, 10 insertions(+), 23 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 6aa529f..0ebe715 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 05161ff..f688612 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -39,6 +39,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 Tue Apr 23 23:20: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: 162752 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354821jan; Tue, 23 Apr 2019 16:21:22 -0700 (PDT) X-Received: by 2002:a17:902:6b:: with SMTP id 98mr12967182pla.271.1556061682390; Tue, 23 Apr 2019 16:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061682; cv=none; d=google.com; s=arc-20160816; b=G10Nv+wPRrVCXVCEy80QDvbtgYKy4WPGuO3mA5YjeZ84MsQsEreYxIMUnGbQrHvAoK XcjONbTuClvBqTyWO/X6UtevkPCosasG8uKSlDr11BUqF7h1kqxC54lpzALBBG6T4lS+ etjO9sjlIrvMwjrRHd5O0VgwQ1/l8AMc88KKcbYH6/cxso4YreH+3OoHJYBFG7MyMIWL bgeyLEOztyMQt9Q6zYMegDQ1jWf8fXPFt/QHBd2us6SSWrS6pBLhfJ1Yt4WsMc4b340N 534A0ttJSHnVo5asR99jAJrA7pOXOX6jjlIkFSD1U07ha+KIG35FZr9fY1E4TBxi7YX3 JpXQ== 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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=YnPf/wMziRD9EoJd+gZOE1cMGbufiPcN4No/6IqWsC8JP1D8AUdbtxqGhWcMzIb9zZ tqCACkzvBjXPCMaQ+bIkpWYe5M9IAwT8qy5YXXp0LSK7cHugU+4SFPMa0TwxqFm/6DRv WQ+ieJTHB7dHHF1o3VpxryuMF9sG08cbtrseaNQV37+boNx+2d1a1wOkTRQdMaFEO1cb Ck9AzhAJjqdd4H/S0hP88/4/s8jX7lppBQYz4gRTLk6W/cj/4b81mVUB+bsAelK+6JkG XVkaLTYaaijDJ4cCiqgNgujAtwAkKiigiDzp6S26eBD7bzHnhxwQVc6yRyi+3Mdehusj l8uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="oVWn/lsE"; 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 m23sor19895310pfi.67.2019.04.23.16.21.22 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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="oVWn/lsE"; 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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=oVWn/lsEfBEEg1ittPmeAehdCZlbXDUOseKSawgAKA3xZqf0ekcOV18j8vkRNyihvx MgjjxKIYgGwKqhogozHZKjyLPMqPpULYvEtGoKp6v0xcebU2Hln5+4jYVO4Q9oYer/p9 0bM5jzkvdJoYToIQ4pk/EjhL2RojThFQRfrXjTfb7PpYlSqiOfwoE0kDPKNKZjKdIKsg /cO6w///QLDG6GSt9t0DQmTxaBm7mg8Oid8l0Shpg6rRAe3di95hCJJDFRJz3anrPEmm mTFr1nMp7kZKLtR6/FnICTn834D3axUuxaBVpfe8ijqHc79RzJBLoCuRVmtGQxbGrII2 vCNw== 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=J7WS362NKRHc8TtGj/Vn0nXkl/YG6bO8Uc5paDKycAo=; b=hR/NAVpXiXaktiN3qkb7LAJR8LyA/inQjcEl6xygI9m95DepiDRuUmnTFzJ3tss9p7 kunC4YEWkr8l8BgvAyQp+URKh+YAlMp7PCGxyd/WeWMcUUXOGWyNx/DokjkSRC+Kjzd4 P4twbCbVJJiYHjC5RS3D58AOHunAfs/M8rj1A1jTfxVAXC8CzZL3AMIpjDgt1QcxSaoI vihHcmrU48PxEOSUUPUFixz0yep90nfXirJG9JAQaa9kG2gGFP/lEVg1Z6ztU3mCkCXy pCn+Jc97ZPK0qMLmgW6PqVxFE7gHB0Jd8+dShX8jnfO56nukBoMGu/a9YpPsPbyq11rj XSoQ== X-Gm-Message-State: APjAAAWlsK48kGxKqcvHrY6aTjfrPjzFUitomloM4T0PUWTeTeUGagcR fb3pTg0qeLcDjFaaH2d75EVl6Xwu X-Google-Smtp-Source: APXvYqy5jPd8/syV+26q23zSB0JKQ5Qd5Jtzd9xqtc4PXOznIW7qKcD5ehVs7FCVSQ79/L2Nt5arVA== X-Received: by 2002:aa7:8e55:: with SMTP id d21mr29525492pfr.62.1556061682009; Tue, 23 Apr 2019 16:21:22 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:21 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 15/25] drm: kirin: Move mode config function to driver_data Date: Tue, 23 Apr 2019 16:20:46 -0700 Message-Id: <1556061656-1733-16-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: Reworded commit message] 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0ebe715..0e68257 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 b52c40d09..4b210ea 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -41,12 +41,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; @@ -55,7 +49,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 f688612..700a203 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -46,7 +46,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 Tue Apr 23 23:20: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: 162753 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354852jan; Tue, 23 Apr 2019 16:21:24 -0700 (PDT) X-Received: by 2002:a17:902:2d04:: with SMTP id o4mr29282563plb.88.1556061683953; Tue, 23 Apr 2019 16:21:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061683; cv=none; d=google.com; s=arc-20160816; b=ysTVWueSPZZKR+Ln63ebFbjMd/9jkG+V/soo9BkE6MT/9olE7VF3sFXEOkVRD0+qUp neegpVyha9i7Gj4E6sC4TZWUjhI0Gir4DXSypvABjv1+E1Je8hUoxX9WkAaJPlRm50Tb kBqnCjQVCE/wJ7wN0imd4pIkRrH00upi3e9PUFUjWh7oTzfydsaWmgduNqp2wJzbkXsQ zS1SYd9c67wQfVqV2lRWIM+4de82jrwgNMSn4W6xEKZPKIdDI/HzaCkHbDvD8nJ/NTlk cnAjjDQyy4OiarKo8qmTYs02bUM30SKCcuyQIozr4lezYTrZ16FfiyzZq2imJQvVHmut 71Uw== 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=yGwLHd/QsORrF/a1ijwtnZ+FE24YlLye7sgtz4UzsFE=; b=ntVtZ8ZOQjpypDqIihZUwcouRAeH0Np1w7qOyjzt0H16kFNoHRcjNpn6qQlo8PIxrY /jBIeljnPhAahELTcVpt1ZH+W2Ngh8vu72NudMUiKWboGdZ//Iuhnib/claS5CXKKSDM sEduLA2d1jgAyMwOhQMq3E+yXR5QfLXBtxRtGIidcBE6lPR/5Gf0C+/ArE/+XtUmI1/1 /PWLIA4g4bkag7ZFeegELuMAr1VAL1bI+iVuyLqkfBlE9zlL4WvSyolaJOgXpL3n2/dJ 6gVozhHxcQg8MbcgC/1rfGJEeBQjXauJymtimoKqvGn+WyYsAT1BBaainnnDrQOl9EbP PpmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AYPTBmaP; 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 z64sor19761460pfz.2.2019.04.23.16.21.23 for (Google Transport Security); Tue, 23 Apr 2019 16:21:23 -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=AYPTBmaP; 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=yGwLHd/QsORrF/a1ijwtnZ+FE24YlLye7sgtz4UzsFE=; b=AYPTBmaPULPqQbE+sL+NfzdmJ/NSE/o6yP6F6cIWoYXmY0CqMRVYk/UqRfdeT4uWTu FQdwL60ib0zDfBNSOWNEuX694R0uH2Q9CsYZ6cr0WqglN6ZwWFkOV+H45t9HzzwIHfF6 TI6pgwM0e7lwezJzRWb8S/5jUO4lyyb+wNYhtZUOn36PlKzewKJIGzcfo2q+JVMNnxTJ wEiGjR5F0Vt9rkPbPUA6c5ldPVlCHSSYwiJlzTFoYBjKqKC8p1p3c4J1up/bV8J/s+Z8 AHvc9WgLr89MkVCoyF7TFjEgPCQ2l354ROa52gpn4GqMXWHhhrm6JSus+CzcxEkbheR+ 5IRA== 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=yGwLHd/QsORrF/a1ijwtnZ+FE24YlLye7sgtz4UzsFE=; b=jmIQr+wetjyubW6wkRKchBAB1s6D6TPTidogCuMBRLVRi7pZfeGtQZ/kVP0yCwYetS MMzjNNQ7ScS7cKF0X0LIr/bXZjt8M/eH6N8YEiVPaXsuUQn7jBArJK9I7V40JBSi+cPz 9mYhLj62CEFW+v+rwjkukapwb9jhnddEMD+X2l4wYq4ul6ZncfFTVsyuien2ZPozUSCO aYaTS3O5iluu7eNyic693W4o3nhPx7Si/zksFG4ket4YrIiSNNxxdkUUEnvx7WlQhBzQ 7xTrTKytIhIFNUFSrvl43NalT3k3Oxf7850LF9DahW/1GlYzQwyzQKHdQyMzUy2izfKm 3Rlg== X-Gm-Message-State: APjAAAV0v776JVfLfbssCmAZoE7xBdB7PLqTkzSNd/hrqBh6HYc7dBYu ap1q9Ma8T9ZBVGhRdzRgLsmTkGIH X-Google-Smtp-Source: APXvYqx4xkcgjslUOx5dI/zefCl0o3ZiR4S9OssYEKtes1yNrH8CUQdAzRyAgv7ZkgB3p9XTSiFj6w== X-Received: by 2002:a62:5ec2:: with SMTP id s185mr30576470pfb.16.1556061683551; Tue, 23 Apr 2019 16:21:23 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:22 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 16/25] drm: kirin: Move plane number and primay plane in driver data Date: Tue, 23 Apr 2019 16:20:47 -0700 Message-Id: <1556061656-1733-17-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: Reworded comit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 21 +++++++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 0e68257..b6b1da6 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 700a203..59fc888 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -41,6 +41,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 Tue Apr 23 23:20: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: 162754 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354880jan; Tue, 23 Apr 2019 16:21:25 -0700 (PDT) X-Received: by 2002:a62:47d0:: with SMTP id p77mr29164137pfi.95.1556061685224; Tue, 23 Apr 2019 16:21:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061685; cv=none; d=google.com; s=arc-20160816; b=njZbDKjQudgZcwTltHh3GHcPORjX9M5srqcT9u1DtGIBNsc5LqpU0Y6CkGv3DDNYNC 7BiExnXFvVQh0nl9Dm+IDbc8UoZnijPlB40JO/5RPT4RNBwQAC7KihixxZE8A+rjaIgi CuW1B8Z+3jK+3GOBFE2utqyzSM2YF7+LSVAXENHq346fzvRmIBPRDz/4TA8unwt49r1U 8k0n/1Dze0LITFsKIpg5eN8kL3NBt90mQ4AN194CyIoJkisTLP9EXk/AEKogocF4vzU+ JHtekRP2xbqQ7hwh47/9d41qXUlCQ7tPmtazOgAsLX4/dOCpt/ugt83A9+ZxOUDNIuwC bkBQ== 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=uz24bMZkViIyZeft57rxEgaLGT+lil7nI2PxrW42mfI=; b=0POvgijJ8DWf2k6RtNwyFQf8zCbOTesqupBmzrp6OYSTAS+bHfKS6DJaQFrIrUY8bV wdn0Ay9/qVt2E+yYf0o3NYCAMH9+19/n/NwNO+jIEGZksDs5qn+hxQ2a8JnbRIbHiz4I PZw6kOfVWPoAxv+CbdY5900wkvv7Bhy5rac1Fyg3FPuZBbqOQnUPWfaK9k+1VdCOTczq AityiRkakhzLHEwaGpDCIQp3OXC172eK0BPJoq7yuSvOKeUTgt93IdwNw3weT5mrBYcM RalJUobW+kYcbAzTQxvqIu0bvSpRphBi9o9PWNXu30+KmU13+e1BVo2UtKzQkDlxbQAI P7HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="fTy8g/79"; 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 k4sor19497406pfa.53.2019.04.23.16.21.25 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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="fTy8g/79"; 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=uz24bMZkViIyZeft57rxEgaLGT+lil7nI2PxrW42mfI=; b=fTy8g/79O0qRKYvKP2RA0bslJG7zvilBCVnEtjN2gYOP06t2CbJd8WhLxUF6wP+avC OA4zDKjq6w/qLqnBAyMmLXGoolHASn1fHzgNoFF4jjFWNN+ixU5A8hHC2X8jljvHZbvK c9vZWThmvpr5SHcmFje/wJEGzWf2M2AnoqigE4QKOwbIMcYPLIBSE7ZsA05BjnhHGGqE Y2rZMgViwnDm+lYCCrABRCAlhPjbcmc13D2EIV16Tct6u54mQi3yCdguIAmtGTO9832/ ut767RhEY0yZcBpSaI9KiekMCnaank+ZjmFwGEk/c56yqj0FHkyudqNvF+G3gMGjhde6 rdrw== 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=uz24bMZkViIyZeft57rxEgaLGT+lil7nI2PxrW42mfI=; b=DK0fYNgoHCL0hEj/9oSVvWO7s8qiFsxfF8UH0CNWn8GkF6j8BIKTWeW8FwP2jrgeb4 4hSY3iVWEn+N5w0dieHBivG28okjyXY+E3bBq2SEilEOCRWU0A0TnMV6n6dW7utl2aO2 gidX6cQzaVxHUhCDbokkIkAm/jQJSax6hcCdRBcTalPr4zglW26qWGEDTlthYbkJn6oc 7RX1iLUcVdVz+UVPJhCfYTO/duw7tzSBN/JWQE2PTXg+1oXSXA5DgApxdwacwYn1rJ1p 52e+LmQZo9DvP62rYJcPb3LM28FbqTa4OSFpRce4B0dqigVSTyvYqEB3DFClFWvN/k37 eluw== X-Gm-Message-State: APjAAAVhtcPShD+JWn779qTQn9clP8SyCctZgXMQmBRpOCxFvZr+X1lE 1HkVwu+zerzsYPM9WLKSYgun9VC+ X-Google-Smtp-Source: APXvYqzaQtp/hoCTDB1oJS8t8WWJg3hNjFooU0vTdyY+fPoz4HEer+IeO5PcJE0YZVOjw5Sj4j0vrA== X-Received: by 2002:a62:6807:: with SMTP id d7mr29014610pfc.75.1556061684829; Tue, 23 Apr 2019 16:21:24 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:24 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 17/25] drm: kirin: Move config max_width and max_height to driver data Date: Tue, 23 Apr 2019 16:20:48 -0700 Message-Id: <1556061656-1733-18-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index b6b1da6..8f15269 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 4b210ea..70fee30 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -41,17 +41,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; @@ -60,7 +49,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 59fc888..af27acc 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -41,6 +41,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 Tue Apr 23 23:20: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: 162755 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354902jan; Tue, 23 Apr 2019 16:21:26 -0700 (PDT) X-Received: by 2002:a63:ff18:: with SMTP id k24mr27977106pgi.140.1556061686590; Tue, 23 Apr 2019 16:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061686; cv=none; d=google.com; s=arc-20160816; b=xv+hDl9cen6bJbtYC1v5SwQ/yUxeRlg/gNKGiI7WjzF2k9hiSC+3hU6hu5vH0s+4d/ ZKKHyNGTeJQBTE8bOJw7OcHt6VLT0X+yL8eDyzzCvBeqf1SA9Pimxp8xkP7Eo/QDjEgL GSGqqOiYnIae/PiyxJQmPwdfusod6ATWyl1IWy5y3SsSy5iCXN2NdT7L7qhz14HP9axw 1RjtcXd57BVRTeBPY1DpyrAZfIpcfVB31nvJRWNWPnQlgto4qAvyPmnHbdSOrBk/YHGS 7wT/kzmc9U1TzGxKkZiKLhx8QjrU9iniY3fLCK65stmb55bnkEoroHpfMxL2G8jqsKfm odDw== 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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=JQ91BucAmIpaMQ8hfGglY80fvMloUxjwg09q/tRjqmnJZHYHNfMDKWqywMMDkv3vfq cuXysL82tpw0cGAnww6WULJqedDAest8EZeV2nYa/g3mzFzHSqZNnrLin+k52ZjpookC 8S8KH9wxW89rcBkaaE2iKLFxiUVEaCr2rEA1bc8kLqD6oKMxYCJ4OURj5ocafc3C3BtO 8Zh/E/QDsuO9mgGSMUHAQPw4GtddRP1XJFPslbbDMnFAKaqdTppRu7+G59V6veuZNhvX +Kiu7xhCCVwngPBoXasLH/Zf9DrcDirLhGLfTA+Chd/97khqjfj2dd0YdWA9pKxfbrc+ KNdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Undrc2yu; 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 bf8sor2181443plb.68.2019.04.23.16.21.26 for (Google Transport Security); Tue, 23 Apr 2019 16:21:26 -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=Undrc2yu; 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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=Undrc2yujPz9BHO8ZYDZwQgjbX9U8mUottC4PSHk1grQkFtNsdC5fKyBvwk9oJ0TUZ zxbC2QgmW1uH7J+Vwd2kw/IJOR6byz0LF9rXkp+t+UfZEnTCQQlEsReoEMKqLvaFkEaQ 4kCf6cD6IX2jndhtqkzxgojhtssD7DbgB5jHh7AVjOJzkhajgWndHjJjH1UnBjcI/YQA izmoWxzClQUddI5qaZhsMf+5uO1JONfWqB1hpyfmedSED9IvWmXTT/xK+sCDo13SmMXO st3CMl1jd/2z+4Mk6Oiy5qbAWOIl2CdRfCY1jtFIKPRV2+V0ZrfFqzMTNEqJ1c4fEbax V/cQ== 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=MSWdAG5VWJ9ruY+QIEAe/DWWyhDDBrXkAQEyNQpRh7I=; b=OhFlDBEPAxSKOv39kGwreVCh0oVDETFYQcC9NtG4enA998QHExr8XuMgM18+FCGfY3 z+QhnFb3aST6ng+VwoWhxmdj9PnOENCSSzJRjx7lR91TsbUjO9vdoJYL6Q+fWD3mp10O 9bhTdWjgw+T433VbiEwRyVNlRKEWsajbU02wvRe7DWFNK0PelwV3Cm9H/sCqSRzUtAfZ 9ej7phl7NyLh7OtqE5rGnZhLe2UTl+fOZOtfwDfuQKM06tG1F4SPVzbZUO2m5E86tpCK +g0+V+n5XPCd909MSGdgiqU+1z+nJ0WuDF2C4VQ4qS0phoTh6K3b385zJ8LgYSt/ZZ4Y hf1g== X-Gm-Message-State: APjAAAU07GgfWhqey7ITtWv/Vpmo5v4DBUbtNBj/WV/ARPlr+aebeoO5 9fzFGziot0P+0ctZh3w8/lOT7JME X-Google-Smtp-Source: APXvYqxnEx6l5bQ9FjuGPp9T12WPdNKX/NJmS2VthRc+O+JxUxxHEOVWqS+Abvpfp1Kz/mqPRj3chA== X-Received: by 2002:a17:902:3183:: with SMTP id x3mr28891345plb.170.1556061686166; Tue, 23 Apr 2019 16:21:26 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:25 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 18/25] drm: kirin: Move drm driver to driver data Date: Tue, 23 Apr 2019 16:20:49 -0700 Message-Id: <1556061656-1733-19-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38 +------------------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 29 insertions(+), 37 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 8f15269..bdd1b00 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 70fee30..c987b4e 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -94,41 +94,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; @@ -136,11 +101,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 af27acc..61fb0da 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -46,6 +46,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 Tue Apr 23 23:20: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: 162756 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354924jan; Tue, 23 Apr 2019 16:21:28 -0700 (PDT) X-Received: by 2002:a63:ff0f:: with SMTP id k15mr26715279pgi.407.1556061688081; Tue, 23 Apr 2019 16:21:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061688; cv=none; d=google.com; s=arc-20160816; b=sM9NQq72WIwx6eepmXtjUHeFknrhabY98uzTN4jO7t3qjZsmy8u65oSPC97Eobo1nb tQN7nx0s170oH2p8dVcYWyvWJOr8koWdSe5YE81vv1Irzkb9XqksUpVjVENxmKSBva70 hTY/H6vVRtMd47q3c4IEDXBhlKTqA22AnmZdkdoLs8ybE8NaFZ30su6v4kFsicG/KmtU i//YlOIinCUNiZWL6Me7kB+3DzmG+Fov+4ublDOXZyR+1dtBBQcMgcgw2659nFAvWwg1 l6VsXF7dHy8m9EVaHd+S8Hzwzx81CjQrR9h7bkrTOqdXKaS2nkDfR76joHXTm6sfkIaw 9Llw== 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=LzxumMzcEtq/SNQTqskpd8l6h66SMPqIvO/SUnJJpKM=; b=RQlV0Zp/eW6PJqjTHOvqRB+DhQJ7ImSFH0yUqUPr5gM53Ra+iCF2Jg9LrMOyv7+Z3m mFB3jRn0bu7YzLWCXalJtbuY/kIVawL3r4fz3w7JIl1A2QJIezVpjVs1hLEyqHVmxinw nRaZ5nNyk8rTN03cclQA6neB7JhE8EEmFSd0rr32IPPDoyi5oLBsJxZk3epTG+oXqge4 Zhhz3qbL/bPDK357iJAj6shiNQ/GPjcB7LlWy7OAwaFwy/WuPTf1+7RwqpREbrxRicfm K7aovcuDVDMfDPlINSGmKXfqWUBa7bNwmWyd62lg791hw80+EKq6zrfImgrkYKXdJnyU vvzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K7nqhQ4o; 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 z18sor15164942plo.58.2019.04.23.16.21.28 for (Google Transport Security); Tue, 23 Apr 2019 16:21:28 -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=K7nqhQ4o; 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=LzxumMzcEtq/SNQTqskpd8l6h66SMPqIvO/SUnJJpKM=; b=K7nqhQ4oUzp+oLLua5HKg230xAqYILqx/7xXmGUjCnyj9D5AAhdGD+GNp3T8DMLrzl ph04wV1JpRAB90Sbx4IYwihZte0cxfMdYvm9Fisf8m/gOj92AuoBWwzExFK+5os+EUfk p3NXmrbKmHB5VMw6K6aAALPCKQjV4jvoyRGw0l/Tu1sujuXX3UeHto5WaeKkrQ/dbR6I aUuqqVWvIlTUKuONfHdYSFKflXOtOUYxkoJXY2vNpMiZVPSoLKHZajYF5AciTpQuNXmK Zps1LUzTEICkOweLOfLhBidUtU0IsK0kjPaH3ath5NrX6sGAmsAJG/ptOpFWrZi50I08 0mqw== 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=LzxumMzcEtq/SNQTqskpd8l6h66SMPqIvO/SUnJJpKM=; b=pMhhVHXVxSKk1kscaldgJAL/mEbIaEqPRBD+pZyTxz9/yxX57PNog52WhMK9u6+sF8 /zzvfiF2WA55WhGlCuN3nkYezg4LSJgKjQ3IN7AXF3pAjtA0WxvOOqWRLcjJ9jKeiV4W 4h8PtUvYF+yc+yrZASQY7x/TUFxKGiYiZQTSl49jvvRmna+SvzlfF+2bOWslU6IPJ7lK yAEhyyUTC2iswi5S+SYAVwXdvnfYcf5AXilyqxSrZATposA31i7wO7Y/eAeAXtsJc7Bd tAteo714/9/NklMEzTgaYTjz+QeSoJvsikMzVGiIWs54VxhOiD81g3e2F84VZOYVorVv +hJQ== X-Gm-Message-State: APjAAAWLRRhJo1ot+NsgFfS4anfrNIdfZJwzpDeBYRmMfMC3UJK1mBwZ 7qEH/0iFDLUTV77T7QxWF0uPLHIT X-Google-Smtp-Source: APXvYqzCahw17URM7uPDNgnjEJPFq7bbhmKrHgotw8tL24qZ6Ookm3NHOl1b3VFuO++uU1km6VLpmg== X-Received: by 2002:a17:902:7085:: with SMTP id z5mr18996294plk.78.1556061687689; Tue, 23 Apr 2019 16:21:27 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:26 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 19/25] drm: kirin: Add register connect helper functions in drm init Date: Tue, 23 Apr 2019 16:20:50 -0700 Message-Id: <1556061656-1733-20-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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 | 43 +++++++++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 45 insertions(+) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index bdd1b00..fcc01c2 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 c987b4e..5ee90d7 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -99,6 +99,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; @@ -118,8 +152,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 61fb0da..8818ccf 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -43,6 +43,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 Tue Apr 23 23:20: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: 162757 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354936jan; Tue, 23 Apr 2019 16:21:29 -0700 (PDT) X-Received: by 2002:a62:6504:: with SMTP id z4mr29438361pfb.202.1556061689384; Tue, 23 Apr 2019 16:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061689; cv=none; d=google.com; s=arc-20160816; b=mzYhWB/o8E4Lg07BqZhrxyG5QXuayGrJJHO/TtfHmNGD/o5nhAFelATCH4S8jHL2l/ R7KH9aj2sxVjnbxpFuV7NO3cPNeium+uwDCdks18k4hBm6oLTIMbK6Eyx3LZMe3EJQkX jYCT9iJ4JQSg94sB33ATqhWZ8I2SigUSwkTrcR2Xa4kByATylmzqWQq57RIPc04OoGf6 fh37LfX2XpNrairL+ZecYFOF2UqjnPsIdzrZ+gqeVF8sik00G2Th2XQbgCjmDUPrpP75 T1qtscCWEAFLNLwhJBUZ+3yxF9qKTEwqPD9TeMjY0X7xANRCaC7yhkilVGqtd62ed6Om d86Q== 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=l/4HxndEudHwbox8bYtalM+RzpPcrsQmywphYVO0zYc=; b=paKDOua4tLVPb9PRFVePWVvUjJvh4hjnvcth2s3jX/CCaURnwUf5xXnS+SPBXCfQkE 1HyDo1bI6lnvolMlpK+NpWs7/9tgSPyII5ZhAejQ5n3yP3/kTOMLQMgIb14ZU27X9jCh bdYJfMbUNvbgs5LNS7Qhbj0L06uqVvfQDoTiaE5OjqmZVyBwJP7WftGwNbbTjinPpnzi h/wMsQURtW54/71ntMBgiZZXX9+Qv3GRhgcnPr7uHaRdHNdkqVhp/p5zPGPqQZosFVTG kLwTpMcBCFPLV9EwmRx8fPUn5tc8OGOpseGPTEtPYIwXmHp3AM+1ka+dRj9n6+ddahjy aDdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wrbjvLIo; 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 bf8sor2181501plb.68.2019.04.23.16.21.29 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=wrbjvLIo; 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=l/4HxndEudHwbox8bYtalM+RzpPcrsQmywphYVO0zYc=; b=wrbjvLIo7S8yefWAy6S+t5N9WVIMTHNi7nErLNj2JKhJMJl251rGYiIplpc1EiXgNM Cm8XYxORSs0TYxOCaR2AWcCv0fIBZy/FXBxGbysMh1iDK/LxOOHFbzsVWfxEq0GbMIk7 GIG3qZDuYuMgTYYPlRATA2pucx+HITzMYtk5WQWPyTDUaQcSqeL37Om9XOS1jjNrFZT2 ikZoyF1PFPXRmNB7xyMmZg7N95Yi0A5MS9w1+RqUKHQYLnNSvpJHsCfRrRJQ2VDLqF6r i7umYS2xIC9MeFswCLO7ecu4e4plaJruFjQwwVxSDXBhpFrgwqO5eVLpfQw78byznb7X f4dA== 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=l/4HxndEudHwbox8bYtalM+RzpPcrsQmywphYVO0zYc=; b=nNgBw98dU/dBN5+QCvHNw9enodSxZkGjXMtpfBYkcnBuMPX47isBDdDjReFKfBkjRR 9u8d9cwjZPeKyI83Ako8vPRBQ6vDRCF1hzbafJP6Nv5uwMCzcLUW+o5tVlqPWNDjM9OD K4kLQj41AQPsP3ch8CdYGiFllI8V0nKIyXmTjcsA/6q2oDJ/1/Wz3/+jqATkdkTuxhY7 jrYy1+Xad2tQnzCJxqkX+4gHATIEvDXRe2unq/85inepFaY56GJLqTBH0tlYSGnB8ePE IZtDNDIGMP98tsG36YcGiaPwWsFFMMlM1QvrtY1kx2NkUoCYlMMqrwNxyOggLBa4Ylpb hC9g== X-Gm-Message-State: APjAAAVU645zdq06THmwNgFbA7+QYwlkMOiihFLRJYeWp6mpjyvwmgk/ kqtSD1akfBwKKMBsqdLyc9a4kxY3 X-Google-Smtp-Source: APXvYqznrvpDjtreESEdxVrYCapvLp99vt28Wwa/eBLgzR4YMg+4MxUeBU80XpmD1fo4NGrxwhOEHA== X-Received: by 2002:a17:902:d701:: with SMTP id w1mr27423947ply.124.1556061688981; Tue, 23 Apr 2019 16:21:28 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:28 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 20/25] drm: kirin: Rename plane_init and crtc_init Date: Tue, 23 Apr 2019 16:20:51 -0700 Message-Id: <1556061656-1733-21-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index fcc01c2..21965ee 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 Tue Apr 23 23:20: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: 162758 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354955jan; Tue, 23 Apr 2019 16:21:30 -0700 (PDT) X-Received: by 2002:a17:902:44c:: with SMTP id 70mr18245455ple.31.1556061690697; Tue, 23 Apr 2019 16:21:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061690; cv=none; d=google.com; s=arc-20160816; b=rBWLwcJoyuGn+DggOXfsl06fcqP/lF2mB6R1QrM3vsGqKKGgGuQ8Hi0eHBkzmzXklb HNTloAIwUiC/8NzZ/LwuYd8g7s4z4BssfYmnCrx00/fzG9yaYeJfbClpMCQJAeZZ8QvZ 9AUgljdTHnVA9mRCXl0jUDx1+SBAXkl1o2NYhhpfJ1zzkVrBeL+gdjZe+11AWW/FgCHS jkNSCcr9kxVJehbHXd4mkNu6r/VqDcafwa0mBwPZEQVnuxz7/QkthPk/3q8TLBLEamnK I4aZG6/vt1eMWlluYYcuVSlrZjQYRKPWsYM+R0Hvh2wCDcV+l/XzGykSBkqmBdTyF3O0 jNAg== 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=VZpIv+9XMJ9csXRza8KzL21yNgQLvZSyCbypyWHMOUw=; b=nOpYLG9IayZ8Nxf9XBKmt2O1UcNzz5x+CVlgfIzGKV11COuTHnHBUc3fejmWh385jQ /Fb1qjdx7xtoy8b5afssR5iPgxwMrOGtMEdb7MtoIFrVAwF+gtOGvxwUdTC6hemkzhS2 bsPCFsR4BUjTA4O5Z6MYOHtmOfqH8Wq7RC9S3XHgtXogfCISd2Dj1R3XNfHGNUccOhnr b60BgCr/sYwOVmEHqxj/vetsm0N1oLSfQnm1SkpUlK4t9RHsZxg8SnUA0/l+EOp8DKNM u/DL+Ff3/VaxdVv7lcqJa6RF+acyMgU+Ga7IvYpdvSiiSEl3Eimv/2pmIbm7fdTw4pJd SqFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="zRR/Qo5b"; 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 s144sor3989219pfc.42.2019.04.23.16.21.30 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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="zRR/Qo5b"; 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=VZpIv+9XMJ9csXRza8KzL21yNgQLvZSyCbypyWHMOUw=; b=zRR/Qo5bYroXdXojCw8cu739K44KjE9a9FCvieFsAEgn4wA0iSXY4E8KlxyzBr8AIJ fCkc8zhwYkRj0wRJW8zO36ltNNXsH9tcC21c6owPLKQFGSkZKulPoh1WRMhBRS/eWtFn sOI6NTCzAIp6hHrRq3P/3wGZzWanOAdARjN/4k+fg1urddAfw2v+hVRXIBLFTpucRKrg x1WRMiNoLMX84V+RXhiMXCtAMAKYzjh3ZxijaOz8noszCMRJOy8Q9dF5XDGmI6LLfgsr skSZfAHFC6wCQaOKfFo1S4g6IgobfFVbt+SVllr/v31fxbi9yDQMkvOd48y+mZuilEP5 hy+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VZpIv+9XMJ9csXRza8KzL21yNgQLvZSyCbypyWHMOUw=; b=Bqwkalmg9FTAgmHGvM2cmEL5PTMoIJmazE43N61wMSmnfeCE79g/tENhAQa0cbw9/8 4vO/MLem/Rked0yul1fQXvHO3U7Esb1J3pC9u6Rsmdva15xq2YsjpKRxYYR7oDqt/aBl QAO0EsBTulH7pczII7i0q89Snola4myjmWHIh+QiEAxEeXAcwI7hfOrpb9XQGBQxf/lf XyZuJ2UbDVYutdQE2DpRTNkQwNtCiQ1543iSgU3CrflbdFE7D2LtETp7lMRTl3X8NQky oSo8H5wuubN4jZj0IiHEDv7fmESOnscWNy5BN5mFLVWyfxpbgQ3TH33DAsYnGBbwgpmL fhXA== X-Gm-Message-State: APjAAAX/8FyIcPcdZFwHNgbI9UNNAyrlbEHACwvBtqabcg72ePQZJZoe +3mfbu55JGG4Z57s7OCp2tMTR2JNzjXJAQ== X-Google-Smtp-Source: APXvYqz9MfY/qTz0PFUH+681l2VpDr/fJck5yp7tggLJ7C4wLYYD1x3aIj8pRAQAd8EMBRUTP09Qdg== X-Received: by 2002:aa7:8458:: with SMTP id r24mr10796538pfn.231.1556061690322; Tue, 23 Apr 2019 16:21:30 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:29 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 21/25] drm: kirin: Fix dev->driver_data setting Date: Tue, 23 Apr 2019 16:20:52 -0700 Message-Id: <1556061656-1733-22-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the dev->driver_data to point to a drm_device, not ade_data. Thus we set the driver data to drm device after alloc. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 21965ee..3d5bd3a 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 5ee90d7..a2938d4 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -45,8 +45,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; @@ -141,6 +139,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 Tue Apr 23 23:20: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: 162759 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4354982jan; Tue, 23 Apr 2019 16:21:32 -0700 (PDT) X-Received: by 2002:aa7:8284:: with SMTP id s4mr29494625pfm.235.1556061692096; Tue, 23 Apr 2019 16:21:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061692; cv=none; d=google.com; s=arc-20160816; b=rcqo/iZbOGYZTKFZrwrK3Xq/iNyGl2kr+V/lZRaYLTXOfuJLfpzYmIw5u4syQ14nSV xOvbXGhNhNeVdfpuAXJqYO1BBlPErejA/oAABgzKa/mEpVdyviaM0yjsALu6N4Q8C+kk Nacyip++1UbtzYb8ykTnneR4bpFGBU8G9Z1XqKgpv0gHq6czDqktvpIJRU9a0hfaeK6T baij3NpNwqwt6P7DdkEbJ4T4ebVgP7GKwUkDEyDQ6soTqmH/5mcBeJcEmyfeTs4w8FAX Z7A5LHurrewcmvXT44Lf8vKxSsfdryaSW8kzMllC4lMSPq4jwwphWkObdBhFqJDDvhIQ uzRA== 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=EYoqwtlhspVO6DfzyLClaQUxGfmShRm+XxIRhwBQn0I=; b=s5VGiFdn3s8xiPaCu7UvnDXMGwh2aeb42vMR3pljt0mHuf2/VjT8ER1RoM8sWEpEGQ ZblyC713zyQ/Vtwsa51TLoaQiAnYbHVRW90cn90MESMDynRy0EiNqlZlE58g25kDHpZM mxTg3A0I/FLlXN/K4pkZsv2WUEjwT4g3BRxKYYz9g07Tyjd1O6yWOMoQx+1bt3O8uBSw cq4lTIikCH6NS4JVmhuIGZXAo/HZuASacKdnZatQ+idP5msfnrsPvDLW+AB/n+R2cJlS LlanlakT/jlAKpXghxceDnrScIthHLchhmaoKliipenMCPrtCiC2WsgQ2qzDOGOO3iJO ip4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=untjjzDT; 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 e2sor2510288pln.52.2019.04.23.16.21.32 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=untjjzDT; 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=EYoqwtlhspVO6DfzyLClaQUxGfmShRm+XxIRhwBQn0I=; b=untjjzDTKcvx3+iaKnypN+M8KVcNEUpB4mwwFbgfwC7yJnVLUBuXEpWrZKIITqTcBN gVCMKZuU7x49a1EvydCQLYZ0v5weudYBbmFitR1K7Gh24cS8vTgajFK56tt7Hu+U48bE +w4OzV1FKl0FgVZHth0AEKFh/mDjlgqxlMNAyxjO9pXkUD2io8Y5+MQCESi7DzfOD8o+ DhYLCwlN38AEvwfx6tQsucj4HusnSH7zA6DI4x2BvZmeeAHqpDk+2wjNAaNfLS/6u640 AvHBbHkJcdxSBilkrUHaTcRf8S459B45aqIU5crH6Q4NTEN1NEQ86QgF0YXzfCgYlUsh 6Cvg== 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=EYoqwtlhspVO6DfzyLClaQUxGfmShRm+XxIRhwBQn0I=; b=bMaykWjH61lV1TbWAIkh9KY+FzJ2uo6IGArHMdkGMpXENPtAW3d2KGkAWTLVHteba8 R02Fn5MnsINcMfg0wXMTZndTKAx4U5KBN5ZPGA0uuH4taP9uOAfFvJ+8fNz6SCw8ChvK qG6q4sV8Y8i7U4x001wOrTVfQD6KGii4beS8d9huhvrZpfUFda4ljoEKFetE1bFI4Eog BMb55TvJtYeG3uTQeeucldt9UMW08JCxI7j5WkhIV9XpYvRjOZXwPk2HNG3LzudhHAZg xc282yzeQOqdcKsUq8vddM+Plp+jspaR/M91FHOkbhqBIdQk4COjDFhRm8IsDOBvgZf4 CXVA== X-Gm-Message-State: APjAAAUpn7d2RRfjcFmw71LN+03mSjO+d5mHf6guSLCSvQJyq5WV8JhD OJ9dfBXpd7Jnz996GHy6nW57TyM8ZQc8iQ== X-Google-Smtp-Source: APXvYqwSsIHNNCSlSYPmHMjgWsENBgc+jn8ULcVY1CgFWt3IEmlE6/E3F36W0TwLmUHJ8AIgZE/Zyg== X-Received: by 2002:a17:902:9898:: with SMTP id s24mr7893823plp.268.1556061691666; Tue, 23 Apr 2019 16:21:31 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:30 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 22/25] drm: kirin: Make driver_data variable non-global Date: Tue, 23 Apr 2019 16:20:53 -0700 Message-Id: <1556061656-1733-23-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the driver_data value to not be a global variable. Instead the driver_data value is accessed via the of_device_get_match_data() when needed. Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 43 ++++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c index a2938d4..634fd58 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -30,18 +30,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; @@ -97,6 +88,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; @@ -133,15 +139,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; @@ -191,12 +203,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; @@ -210,7 +216,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 Tue Apr 23 23:20: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: 162760 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4355003jan; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) X-Received: by 2002:a17:902:7209:: with SMTP id ba9mr9078418plb.252.1556061693813; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061693; cv=none; d=google.com; s=arc-20160816; b=yxxcSOBrRi6+PfnURlpeq460t5XlqnG/yPeZhsNiUQUskfdhWeY2aaQmzW0GOBmypz anfzMVvf70KVu6+kck0HUA9aU5AOxgBiNTVmKkU+qsNQPVC9CBOZS8MbygQsV7VeAGrd uprhCTMoCp9D3Wgl3kS1IIs1ojFX2m1FIA1IHsyATj506jw63PnxbKLzvncGRti2dckU Fl9UCwvD9RIcpWFl+4gidWAiIRrGkZjez0WHfwKGNodRAsEEWsdwMjQfpdnwPJpCPv3T 3c8zG/2zmHByS/baz8UuvgXD+l8KaYE6qeIOzoIyfzVTqqtbfYu3arPHZkM59m9v8Tcp 73LQ== 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=CzAFt2wEmU0rb5/8Er+KAwwuTXQA0uuJRBdc+Z8f6l8h10BHhXtJIWA1VgOoEMkz4K LPmheJsWc/CUlapn5q+E8F0NcZYiNvUC1Et1Vg5RkLyouvxATksxygo0blOlVeEqIPEb AumFNReMM49e5NO83dg8Eo22iPlVc0GXMHRRCYIL/230lznX/biClT/XDp6Xm69ItKI5 dbYIL+p6YFcq1Bi89G579l9h+MhvCirdjnNHzig83HOJJV4mVx+CWdIdzdrRaUNPScvJ EULn7chOdbbabMy49tymk5cTYfqx7+mdADmuxQ9eBoS9l9T4xpnMXWzs/pjjmJ6GY5sZ b91A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="YvFX/fer"; 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 x18sor19746796pfa.69.2019.04.23.16.21.33 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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="YvFX/fer"; 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=YvFX/fern8eZoKAnjIxAf5RUz4Uvp8J4p+xGsXoGVflJquwMrkpMrG5g8ZV/A05vEL yW4+YKBR+RsZlQhjDsCS8pJ/EmpS7jY5Nxgx/1AQ3Ya5XcDNOjPb4k8GciQ+eajGnR/5 RXoEnF4psLyE5PY753D8fvFFFGFUlRDP49VQujstxvFXl9/CyxSjTs159j/utvmq+X/s qPrI7Cib+zCask/1pHW5q5vdYjmF78xWdpJEJ86ShLuA6lz1CQltJKk0Roi5f1NAwx/B aYeJM1u+qRXXYRuBlkLqNqHVbjpQ7Qfb+aOQ9sDEROm0ngV+RtvVOxttKiHa++iOEKVP 4CKw== 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=fyuYklvBayJptM/nAc9IL2K6XjtBGntJN95HuquLEL4=; b=b/mkTOfYj1mFZH3IaXy7QwvKkR2ehygaqK/OvnbL9VMU1uNhFdz/xfHavIS6iMOJgb f9w0zT/VRLwOujimkFDv/kBV+fbIfiqZpZXq+VxcWB7pQlhXYGa7rcMS4VN/dlLh0Y71 a4SWeudqmqq/j4ZEJ7jsvWv3U/rND2qaJp4FFUrTX0rVwljxPtCtOPcbPRCclEuHo45f JIewy9cCOb6ce8fjGb7wO9GlDOrVlGlJKWWsU5ueI71mmUdgq6+eeCJRBaRCuCc3yiPW ROuDMIzIsxexo18g6tqsANtEYpOq16y3iVFtdzdGAflAnjWIb73k1ufQT/a9dM8l990D DtLA== X-Gm-Message-State: APjAAAVamK2lOY3b3ElTz/VXK7mCK23arN6TzdJu/xF/vnFc0dA8sR1M BJ61DQ+0zmV4sb+reE4A17ei80gsNPF6ow== X-Google-Smtp-Source: APXvYqz8GDtuEf42eI35uaJpItKZLJSWWg9sDHjfvRMh4FewHjzW+BcTBuYF9lMJA4CyvbPWWnvOhw== X-Received: by 2002:aa7:8518:: with SMTP id v24mr22541292pfn.219.1556061693163; Tue, 23 Apr 2019 16:21:33 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:32 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 23/25] drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data Date: Tue, 23 Apr 2019 16:20:54 -0700 Message-Id: <1556061656-1733-24-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel 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.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 3d5bd3a..71671f8 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 8818ccf..17c45b5 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -53,6 +53,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 Tue Apr 23 23:20: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: 162761 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4355038jan; Tue, 23 Apr 2019 16:21:35 -0700 (PDT) X-Received: by 2002:a65:6110:: with SMTP id z16mr18721158pgu.131.1556061695275; Tue, 23 Apr 2019 16:21:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061695; cv=none; d=google.com; s=arc-20160816; b=dHcODI39owpBEfv2BmaPhMwXwhB/OO08RGKTaiEHLjGa+aoMaToiT84ezyoFAmf/xe pMPeR7pNn5jCv46cFIxjTEh2VAID2EYasdTcs0CPV5/j4MOf8Vy6Ba6TZ5cWuZcgLa78 hw1J3jxTIKOqhtKnPBlK42RfRR1H6idrHPrU+QqSdItYQQGNSxKL1/s/fU8tKyoBGLEo BwYgyJWEMyR95O5ckh7uG9zN0eULAJgOG5iWyj0o2cATQ5VWUwM0tUAGeTQALwkJM56A o5qs5k681P5oCEFuO29wAiR4YmkCW5LOO+5misKd8BLzSw6lg6XtlB+BE1y1eJrVgq2X K0HA== 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=BvIii0rpBLgX+wwqwL/0OsyeoCyTJ/LguEAz+P3IFTk=; b=KPK2dBIUEQZIWGLOZx4wbhOsGVfQMvqu6rkPq/R+WhxVRj/wWC57W3qjB73N5qGB8P kYdpUH9w0BjsXuq3yTgfK5Sm6BwAJ7aZVdtUSQ7Rr3s5PCoan1YI3+yYJ2fRcCtWUT6A bJgzLlmK2OPox9/N8P/9DnY/wEFQ4gSxI7IwZGuGLE6g0zDR5W4YBumIWb+hAnkYjv2V BgYsSuOYxWFdf1hGygAIvqxD7I79M83xXMGI//HL7a/QELsVZEVxD6XfCHztfPgMCw0i XrBb+DJ5BEZWiLe0EPLAFXsqt/n+ZC+S8TolSiUodNewZVkkYck4fpDg9jZMFYrqO3tO 0J+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CYwdS5Pe; 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 u23sor19541870pfh.51.2019.04.23.16.21.35 for (Google Transport Security); Tue, 23 Apr 2019 16:21: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=CYwdS5Pe; 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=BvIii0rpBLgX+wwqwL/0OsyeoCyTJ/LguEAz+P3IFTk=; b=CYwdS5PeelmfD2irWAn0bYe3ptymOpnIEYyoFy+PvmAdcp+pAwgymZkAQxtFyKifQH VJZFG0qu8dTg34cxK+/TKJab5K3exR9lc9UijG3AgKAJ4T9c2dVrCkM2aZOQVqtAzlQ3 4ATCqPMlOvg44oJytrIRmcN6l/9Q3my5KBAjYeGrPBmWytTR/jVY9UGPdQORQdiY2WIV AmLrzYyd9gM6VrbwfcBqMrVzcKNpntVbYA8SLgpR6JUg0KvesAWeUq1ROXtSp7oM747U eW12liqDNdINlMAtvaRQBGMIF1KtlgbLjE+wMC54nHO8sH4wk90qdR94gBeET3LDHQ2F fkrw== 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=BvIii0rpBLgX+wwqwL/0OsyeoCyTJ/LguEAz+P3IFTk=; b=ISHEDQOKnGYkTJwmXIrn4fBqQ/B0PNnwS0B+QV/JpUruHH3wWs5Xlw/wVAsrDhTo44 wyP2z7XcJEeIKfuvfyXO/fEk7by2W9YAT4btQM1vfefh6pznBw6uK2uetCeJtyg4JiNV EuosFyPT2++l0kr2USIBNDI6YFYxsZoHr15RRLi1fMKK+i8M8qmLd0uYtOz2LeWQEvc6 CalsCWD+0SxRyfQ6XhGQuMT63RiSPKVscJ6mgMxOPiIitT66O24MLqqM8T+NfF35rygy S7mZyWp839t91vhUPO/3Fg21Iu2dSBIc8Wnh8oZuccPgYs36edkT+ei1kKRZQhXVKztG dnDA== X-Gm-Message-State: APjAAAUw8ijlX0n/XYyajh5xtcHuzWWclYBKWsfayThKHzN3d/nMeZDV As+yMSGOYN6rcrWR7eM5UJTMZruU X-Google-Smtp-Source: APXvYqzw+pUXyclfRXDV1TZekbBMMDVlL0SOVff5oY0DiBlSQhsq3d+eMnwM3635pkNkObZAkNmSbw== X-Received: by 2002:a62:aa01:: with SMTP id e1mr29934003pff.43.1556061694850; Tue, 23 Apr 2019 16:21:34 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:33 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Xinliang Liu , Rongrong Zou , Xinwei Kong , Chen Feng , David Airlie , Daniel Vetter , dri-devel , John Stultz Subject: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init Date: Tue, 23 Apr 2019 16:20:55 -0700 Message-Id: <1556061656-1733-25-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch changes funcitons to pass the kirin_driver_data as a prameter. This will allow those funcitons to be later moved to the generic kirin_drm_drv.c Cc: Xinliang Liu Cc: Rongrong Zou Cc: Xinwei Kong Cc: Chen Feng Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 71671f8..876e25b 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 Tue Apr 23 23:20: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: 162762 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp4355077jan; Tue, 23 Apr 2019 16:21:37 -0700 (PDT) X-Received: by 2002:a63:7f0b:: with SMTP id a11mr25584856pgd.234.1556061697712; Tue, 23 Apr 2019 16:21:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556061697; cv=none; d=google.com; s=arc-20160816; b=ihsW9dlR2Zkxgt5PJ6VMB+txul/tV0ojfDXj2W0E5zBlGt8V664gPIINU2C9VFPXAJ USGFHhSIYtU1U21815qKRjn2xbjYqX2pnAfv+oOqmNVLD3FRfIuUSBlkqu1xQ068pmEa XBABDlv45XFE273jlotwrZxe48ZzV6MvH3r2ydj4Rwq2+0gA+ZLMGGIidhkgOwpr/+xP xt2LnHZvW951wUcVqxKWMj8JLgzrv65sA4PMrp2zzSKHLWnjTcxkuZrELG1lKXb3F6EZ lHibo+9DKp2OKTxlhJqhqH4ldl28zUT+J4aFS58a3b5H7dJwewTSZlXl66vwuXrr671u VS+w== 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=V+FSAASWtwX3Rz3dXeEFGzLwTjL29V4frKpEvC8FKiw=; b=WyypcsMULlihZi4Vg/X4Asmlwj0jhntxcbB2WVixpF4GDNETzoq6skXGn5shrA+bSk +6Wvb4OhQtmOTLIvoZDpsNfdOCLrizUlaFTSPzGcUb6xYEtjrseK/FhTbmdiw/cg10Hj ylozdHWKb1TUmfKPomGvKJ0X5oakbjq2Mm9vcFIQ9g+kKKAgBg+fdwpwEx1+MfXHGC3j 3nOQhjkwbYJ6MgboyLFZ+8KCTCDg4zpgV+C//2QHp6rERnfVrTlWd5rzu/t00ZA91hlg qmsSFQi/uq23pPgIxs6HcrB/1lym7PcXf7PxkgCwDGRcR62WThEgG/LOdffqXwdA9XIw 0GZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fQXUEplp; 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 h190sor18142795pgc.78.2019.04.23.16.21.37 for (Google Transport Security); Tue, 23 Apr 2019 16:21:37 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fQXUEplp; 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=V+FSAASWtwX3Rz3dXeEFGzLwTjL29V4frKpEvC8FKiw=; b=fQXUEplpDtTJzsAkhnXP3pnuZVuqjm5bcifmVmlQCB7/ISLYKAZbnddKM/xMxyhzd0 y5oovjimDPMMLEEkot8lNm4zHsevlSunDuit0fZiKc3jaWWPe0oPrR9U+ipDa0ery+nb JNwQPh//JZPWgWgdyEaWR91psqXTqRNBZ6VE5YU+edJzoiMJ5CEjAqA5E2Dy1ryJtIb9 hrWuf+2exNdyr28twnuKM2x5LlD91ghf7sSyia47hGQSYLJhcc9pKM/mEov6ofXyGGOH buwqjK6nM6Xn4HEViS3hJCfojx4pJCnivZM2UP1vQUppPy9abmnNGiXCxiU6rgibg8FS eLFg== 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=V+FSAASWtwX3Rz3dXeEFGzLwTjL29V4frKpEvC8FKiw=; b=AsYcuuPZr1ahvGzMvdtndI0aM70OaWhkpEezLZvK/DDAbCrEe+q9RAQToWFCA+Osd8 Ky174VtN8JrnUWYgBA5v1OIr8el/DiQXaqNF4HLNfzKxX1VI87lxoHO53EKo5mZXPZI4 gjcyLugCtsUv7PqzcDDk3VEqNpCxSGaP66mZBfXEbuY1p9bUIye2o1d3kBBMT4dYZY1S 1kpl6VyxfF2UK/cHrG5euxXni9kSl+qVsyxP72Ul13GFpHtbCtqHvJhbisOlvoIajf5n lw9Rd68t2GAHIpOqSKsyu4aLTj+9xSe1OyqOP96rTZvu03h4aLcL0Xrfar/2VZvTVG/P 9RVA== X-Gm-Message-State: APjAAAVJiH0uNmkANqlqoE0ue7C5SwQxnfZy7TedfCvBpjcq0pnoK2Jh CiKFY8/t3m1SFGs9ZJnnJrOsQOcf X-Google-Smtp-Source: APXvYqwUGuAz3HSZAgtZB6XjqYzwCluNEgKzp/sKBioBR1YUptU3JOCZNAUbiEsl/slpLJBWhzmqOA== X-Received: by 2002:a65:55c6:: with SMTP id k6mr10330749pgs.134.1556061697268; Tue, 23 Apr 2019 16:21:37 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:4e72:b9ff:fe99:466a]) by smtp.gmail.com with ESMTPSA id c28sm6984235pgm.42.2019.04.23.16.21.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 23 Apr 2019 16:21:35 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , John Stultz Subject: [PATCH 25/25] drm: kirin: Move ade drm init to kirin drm drv Date: Tue, 23 Apr 2019 16:20:56 -0700 Message-Id: <1556061656-1733-26-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1556061656-1733-1-git-send-email-john.stultz@linaro.org> References: <1556061656-1733-1-git-send-email-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. Signed-off-by: Xu YiPing [jstultz: Reworded commit message] Signed-off-by: John Stultz --- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 123 --------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 141 ++++++++++++++++++++++-- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 - 3 files changed, 129 insertions(+), 140 deletions(-) -- 2.7.4 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index 876e25b..9a6df95 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 634fd58..9d4c057 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c @@ -30,6 +30,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) @@ -45,7 +169,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; @@ -53,7 +177,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 */ @@ -75,11 +199,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; } @@ -90,14 +213,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 17c45b5..9beaaf3 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h @@ -11,8 +11,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) @@ -57,9 +55,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;