From patchwork Wed Aug 14 18:46:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 171339 Delivered-To: patches@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp1203095ily; Wed, 14 Aug 2019 11:47:22 -0700 (PDT) X-Received: by 2002:a17:90a:8d86:: with SMTP id d6mr1093983pjo.94.1565808442707; Wed, 14 Aug 2019 11:47:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565808442; cv=none; d=google.com; s=arc-20160816; b=bb0DWUvsBLd+Ev+8KMUqaP8RARcwiIlm9/wFC71tahcFdUEJjG7Hycj92xgPurZku7 vGsfXJTT+R/t8fMNnwE3XGm/16TLc1FS7O4MPWk+ja1sJ5HMkdQWslx6Ri7gCIXNfC3p RxV2zF2rNx5tyeT7kXpHmCgr6qmGmRaTmNAfLNDjq8javRFMsD/Txrhqpb7y9gV5ZD9m o4qdnUxLwhvoq9tFjPozvuhQDFBKlWwMFuAj14knjq2fkYAp1LXDuYw3xchhxOJ3z1hG RlrDnsPX682hbxACtuWBv5T1YaPqsxOksBhHlYTcM7FUsRJZCjy09DSM1Y/QJzDMmTlE xT5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wvK/3ErN4wAOUGSP9sa1Evt1Opo7B3qrstIX5kiusy8=; b=tOXmDTIRI9KRqcURVHFskdtftZahyOSkrdx0IAAILiNVSgRKvnm4AsQaDyObxo56QQ PNU5Jj3sf3o4ePJQlQmii+h/TaA6z+Z/PmULdr9hKFmaWCg8/C4Sou2VGbJIQj8IceHA 08s9gqBb3IThXHYE4wJ8s8a+BqAUQJeOVR4Xe9ztga0kVfG09qANsX5yjG5C2eA0DHvp YCMNfW9kY1sHy54bVIodruBi9BeiUPMZvmDXijdA6QgNrJajFqDDUsH06Sc+KjrPAboL Sif48COQFkMu9rrjwcXlRPJuuy4sFA2cBO3eMdWaBhyTeU4bLlUpbkoYLwn14fIRdRRp FU5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cpfh3NWH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v5sor546058pfn.71.2019.08.14.11.47.22 for (Google Transport Security); Wed, 14 Aug 2019 11:47:22 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cpfh3NWH; spf=pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wvK/3ErN4wAOUGSP9sa1Evt1Opo7B3qrstIX5kiusy8=; b=Cpfh3NWHEHi6l8EB8XmZOgSh/8o8G7lgNUqtXNmdAYy46WXcYN7FqnitHrZpXc5hJY Z0IxbY5zrAsWaPqarNxK7pVLE2HV9yf4QyHvvh2iRKmb82vjnfg6yHckyMsFMPDVkw7t QSZ4qLug//fjGz/4FhMH/8rzP+v28cl4foKvATTs+UG6BEl9IY53kDq9fn91Jwf+pgBb ZFAiLfeCPjoJoGKIUoi5XauHXXHY43JTruTkK/FaJtEJm+/iwWEW35Nr6KqK4ImVQO25 iMEvMJ1SkAxDIUaVQey+/5ch7rJmbiM7LS4qe/EsNitcUaOBDCRLq69FeyO6c1EMqlYp IdEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wvK/3ErN4wAOUGSP9sa1Evt1Opo7B3qrstIX5kiusy8=; b=YBAnGdCE70YAIB/ivzh8s1Qco/vatNa4p5suEx9i13GLTksyq6ThXl/119GOciTRhi yq5eTNQoYpm1a0lyf15LIykKGcwIn3mQXFVSEoProkpmge1zn7L5LGP6dwZDxKJT0Z3D oW/z39Fmb8XXu9pSXXIf/hvAzn0gBXpLnR4wST3wRj0PcVDZgZnUvckbn3Typ+bQOWOC Q1NAbWdoYQCPx/YMAQZNezerxCo/08xYKy0QlJzxB1srS3VJtiY+lQsK0cS6zxjPyjxO 5FoBGn0xd0IXa2RJ4wN467Aty4WBjTK+Ac3i/6BQzd5Zs+0VrrLTrkxYWka00TUIzLFC BXQQ== X-Gm-Message-State: APjAAAWN9CrFSn4t0sFVbqX26oh07DYpHx1+5GbIVbPlYW5AsAQMj01D ZjCwR68/tzpDMuv1MYDcB9Aa6wQi X-Google-Smtp-Source: APXvYqyZGdbkXmqHNPSUFMNgCMhpoqA7AKg44U8bK842JHx9Nz1jPxGzeG5oT2vaCVVncT70GRIABw== X-Received: by 2002:aa7:8dd2:: with SMTP id j18mr1419335pfr.88.1565808442309; Wed, 14 Aug 2019 11:47:22 -0700 (PDT) Return-Path: Received: from localhost.localdomain ([2601:1c2:680:1319:692:26ff:feda:3a81]) by smtp.gmail.com with ESMTPSA id y16sm610855pfc.36.2019.08.14.11.47.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 14 Aug 2019 11:47:21 -0700 (PDT) From: John Stultz To: lkml Cc: Xu YiPing , Rongrong Zou , Xinliang Liu , David Airlie , Daniel Vetter , dri-devel , Sam Ravnborg , John Stultz Subject: [RESEND][PATCH v3 10/26] drm: kirin: Move request irq handle in ade hw ctx alloc Date: Wed, 14 Aug 2019 18:46:46 +0000 Message-Id: <20190814184702.54275-11-john.stultz@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190814184702.54275-1-john.stultz@linaro.org> References: <20190814184702.54275-1-john.stultz@linaro.org> From: Xu YiPing As part of refactoring the kirin driver to better support different hardware revisions, this patch modifies the initialization routines so the devm_request_irq() function is called as part of the allocation function. This will be needed in the future when we will have different allocation functions to allocate hardware specific hw_ctx structures, which will setup the vblank irq differently. Cc: Rongrong Zou Cc: Xinliang Liu Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel Cc: Sam Ravnborg Reviewed-by: Sam Ravnborg Signed-off-by: Xu YiPing [jstultz: reworded commit message] Signed-off-by: John Stultz --- .../gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) -- 2.17.1 diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c index ddcfe0c42d7c..0e0fe1cb945f 100644 --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c @@ -54,6 +54,8 @@ struct ade_hw_ctx { struct reset_control *reset; bool power_on; int irq; + + struct drm_crtc *crtc; }; struct kirin_crtc { @@ -358,9 +360,9 @@ static void drm_underflow_wq(struct work_struct *work) static irqreturn_t ade_irq_handler(int irq, void *data) { - struct kirin_crtc *kcrtc = data; - struct ade_hw_ctx *ctx = kcrtc->hw_ctx; - struct drm_crtc *crtc = &kcrtc->base; + struct ade_hw_ctx *ctx = data; + struct drm_crtc *crtc = ctx->crtc; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); void __iomem *base = ctx->base; u32 status; @@ -951,12 +953,14 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane, return 0; } -static void *ade_hw_ctx_alloc(struct platform_device *pdev) +static void *ade_hw_ctx_alloc(struct platform_device *pdev, + struct drm_crtc *crtc) { struct resource *res; struct device *dev = &pdev->dev; struct device_node *np = pdev->dev.of_node; struct ade_hw_ctx *ctx = NULL; + int ret; ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); if (!ctx) { @@ -1006,6 +1010,14 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev) return ERR_PTR(-ENODEV); } + /* vblank irq init */ + ret = devm_request_irq(dev, ctx->irq, ade_irq_handler, + IRQF_SHARED, dev->driver->name, ctx); + if (ret) + return ERR_PTR(-EIO); + + ctx->crtc = crtc; + return ctx; } @@ -1027,7 +1039,7 @@ static int ade_drm_init(struct platform_device *pdev) } platform_set_drvdata(pdev, ade); - ctx = ade_hw_ctx_alloc(pdev); + ctx = ade_hw_ctx_alloc(pdev, &ade->crtc.base); if (IS_ERR(ctx)) { DRM_ERROR("failed to initialize kirin_priv hw ctx\n"); return -EINVAL; @@ -1059,15 +1071,8 @@ static int ade_drm_init(struct platform_device *pdev) if (ret) return ret; - /* vblank irq init */ - ret = devm_request_irq(dev->dev, ctx->irq, ade_irq_handler, - IRQF_SHARED, dev->driver->name, kcrtc); - INIT_WORK(&kcrtc->display_reset_wq, drm_underflow_wq); - if (ret) - return ret; - return 0; }