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; }