From patchwork Thu Jun 28 18:28:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10494723 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C992E60325 for ; Thu, 28 Jun 2018 18:29:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFC832A762 for ; Thu, 28 Jun 2018 18:29:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3D952A780; Thu, 28 Jun 2018 18:29:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ED262A762 for ; Thu, 28 Jun 2018 18:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967881AbeF1S32 (ORCPT ); Thu, 28 Jun 2018 14:29:28 -0400 Received: from mail-yb0-f195.google.com ([209.85.213.195]:38805 "EHLO mail-yb0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967887AbeF1S3M (ORCPT ); Thu, 28 Jun 2018 14:29:12 -0400 Received: by mail-yb0-f195.google.com with SMTP id f12-v6so2383098ybp.5 for ; Thu, 28 Jun 2018 11:29:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CijIgxXh935vca8qqL8xYTtoMcFlcymDlmtj1aUQy9g=; b=mANwgKVT0ailbs914eN+gPpHxgJO2wYL5ETs0PAVCWJq6vkdt9RzM/XqR/fFvCF8Wy pQonY0rGWV3S/AYfrIXrK7VYjPlavmJIWZ7s1fqUMQY4PS2+2czP8bJPqqDGPiamzMxp XVZUYeRjPmfU6sbyDC/h1MwUEMVtu5JGgtTqk= 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=CijIgxXh935vca8qqL8xYTtoMcFlcymDlmtj1aUQy9g=; b=WCcp1ge7aRZWPkjr6ONGkYia90z4CXkhfS7oern4ossUKPZjJw/KH1IB0UNFNWBXK0 /D3vC6FdcFiMSecWzztDea3qe32t0gDK/LKLDnm/SayzI0PMf6TOtZO8Cc0QuQU9tN4t 4xYJPMX5JVADJk6moppOL+/Oj5la5eqE1YDRAJb13uPqmH1OhT95LGTcHA6QhHmD+RW5 aTl1zzzJOa5URQtS5jrKfLgYEWnaHhw6uZSOCZGEdfS9NN24nhYb9dbjHG4heSIwNlTX Geo9Nk1uthVDUEz1fBPHIAFjLkionRJ0SKXhjOzLJ5LWKMfe73rQzgnQiZyR8K/n1IEj JtAg== X-Gm-Message-State: APt69E05AbffInfCiwTwik8xVqvFHh1M1YmlBReJskNZ+w4kAihNVpvy 8jC25UUshRoTxtaY7nXGnijhDg== X-Google-Smtp-Source: ADUXVKIv6cmLshKF8UVa2Y9qaixJd4sBcNHo6K+19lKUxawiQxqrJZG84lZSIL8ccMD3RgY2sZw1LA== X-Received: by 2002:a25:5b87:: with SMTP id p129-v6mr6166316ybb.270.1530210551729; Thu, 28 Jun 2018 11:29:11 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id g145-v6sm2732140ywe.17.2018.06.28.11.29.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 11:29:11 -0700 (PDT) From: Sean Paul To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: robdclark@gmail.com, hoegsberg@chromium.org, jsanka@codeaurora.org, abhinavk@codeaurora.org, Sean Paul Subject: [DPU PATCH 04/15] drm/msm: Remove more dpu-related code from msm_drv Date: Thu, 28 Jun 2018 14:28:55 -0400 Message-Id: <20180628182906.84926-5-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.rc2.346.g013aa6912e-goog In-Reply-To: <20180628182906.84926-1-seanpaul@chromium.org> References: <20180628182906.84926-1-seanpaul@chromium.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This time the iomap/iounmap helper functions. Move map into dpu and refactor it to reflect their actual use. iounmap wasn't useful, so delete it and call iounmap directly. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 38 +++++++++++++++++------- drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c | 13 ++++++-- drivers/gpu/drm/msm/msm_drv.c | 23 -------------- drivers/gpu/drm/msm/msm_drv.h | 2 -- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 0b813a089cba..beba919a6ef6 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -77,6 +77,25 @@ bool dpu_is_custom_client(void) return dpucustom; } +static unsigned long dpu_iomap_size(struct platform_device *pdev, + const char *name) +{ + struct resource *res; + + if (!name) { + DRM_ERROR("Resource name unspecified\n"); + return 0; + } + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); + if (!res) { + DRM_ERROR("failed to get memory resource: %s\n", name); + return 0; + } + + return resource_size(res); +} + #ifdef CONFIG_DEBUG_FS static int _dpu_danger_signal_status(struct seq_file *s, bool danger_status) @@ -1056,15 +1075,15 @@ static void _dpu_kms_hw_destroy(struct dpu_kms *dpu_kms) dpu_kms->core_client = NULL; if (dpu_kms->vbif[VBIF_NRT]) - msm_iounmap(dpu_kms->pdev, dpu_kms->vbif[VBIF_NRT]); + devm_iounmap(&dpu_kms->pdev->dev, dpu_kms->vbif[VBIF_NRT]); dpu_kms->vbif[VBIF_NRT] = NULL; if (dpu_kms->vbif[VBIF_RT]) - msm_iounmap(dpu_kms->pdev, dpu_kms->vbif[VBIF_RT]); + devm_iounmap(&dpu_kms->pdev->dev, dpu_kms->vbif[VBIF_RT]); dpu_kms->vbif[VBIF_RT] = NULL; if (dpu_kms->mmio) - msm_iounmap(dpu_kms->pdev, dpu_kms->mmio); + devm_iounmap(&dpu_kms->pdev->dev, dpu_kms->mmio); dpu_kms->mmio = NULL; } @@ -1429,7 +1448,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms) goto error; } DRM_DEBUG("mapped dpu address space @%pK\n", dpu_kms->mmio); - dpu_kms->mmio_len = msm_iomap_size(dpu_kms->pdev, "mdp_phys"); + dpu_kms->mmio_len = dpu_iomap_size(dpu_kms->pdev, "mdp_phys"); dpu_kms->vbif[VBIF_RT] = msm_ioremap(dpu_kms->pdev, "vbif_phys", "vbif_phys"); @@ -1439,16 +1458,15 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms->vbif[VBIF_RT] = NULL; goto error; } - dpu_kms->vbif_len[VBIF_RT] = msm_iomap_size(dpu_kms->pdev, - "vbif_phys"); + dpu_kms->vbif_len[VBIF_RT] = dpu_iomap_size(dpu_kms->pdev, "vbif_phys"); dpu_kms->vbif[VBIF_NRT] = msm_ioremap(dpu_kms->pdev, "vbif_nrt_phys", "vbif_nrt_phys"); if (IS_ERR(dpu_kms->vbif[VBIF_NRT])) { dpu_kms->vbif[VBIF_NRT] = NULL; DPU_DEBUG("VBIF NRT is not defined"); } else { - dpu_kms->vbif_len[VBIF_NRT] = msm_iomap_size(dpu_kms->pdev, - "vbif_nrt_phys"); + dpu_kms->vbif_len[VBIF_NRT] = dpu_iomap_size(dpu_kms->pdev, + "vbif_nrt_phys"); } dpu_kms->reg_dma = msm_ioremap(dpu_kms->pdev, "regdma_phys", @@ -1457,8 +1475,8 @@ static int dpu_kms_hw_init(struct msm_kms *kms) dpu_kms->reg_dma = NULL; DPU_DEBUG("REG_DMA is not defined"); } else { - dpu_kms->reg_dma_len = msm_iomap_size(dpu_kms->pdev, - "regdma_phys"); + dpu_kms->reg_dma_len = dpu_iomap_size(dpu_kms->pdev, + "regdma_phys"); } dpu_kms->core_client = dpu_power_client_create(&dpu_kms->phandle, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c index 5c69c2cc5d10..5191c77cd907 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_mdss.c @@ -162,7 +162,7 @@ static void dpu_mdss_destroy(struct drm_device *dev) devm_kfree(&pdev->dev, mp->clk_config); if (dpu_mdss->mmio) - msm_iounmap(pdev, dpu_mdss->mmio); + devm_iounmap(&pdev->dev, dpu_mdss->mmio); dpu_mdss->mmio = NULL; pm_runtime_disable(dev->dev); @@ -179,6 +179,7 @@ int dpu_mdss_init(struct drm_device *dev) { struct platform_device *pdev = to_platform_device(dev->dev); struct msm_drm_private *priv = dev->dev_private; + struct resource *res; struct dpu_mdss *dpu_mdss; struct dss_module_power *mp; int ret = 0; @@ -192,7 +193,13 @@ int dpu_mdss_init(struct drm_device *dev) return PTR_ERR(dpu_mdss->mmio); DRM_DEBUG("mapped mdss address space @%pK\n", dpu_mdss->mmio); - dpu_mdss->mmio_len = msm_iomap_size(pdev, "mdss_phys"); + + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mdss_phys"); + if (!res) { + DRM_ERROR("failed to get memory resource for mdss_phys\n"); + return -ENOMEM; + } + dpu_mdss->mmio_len = resource_size(res); mp = &dpu_mdss->mp; ret = msm_dss_parse_clock(pdev, mp); @@ -246,7 +253,7 @@ int dpu_mdss_init(struct drm_device *dev) devm_kfree(&pdev->dev, mp->clk_config); clk_parse_err: if (dpu_mdss->mmio) - msm_iounmap(pdev, dpu_mdss->mmio); + devm_iounmap(&pdev->dev, dpu_mdss->mmio); dpu_mdss->mmio = NULL; return ret; } diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 6177b3f18912..561617db7338 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -131,29 +131,6 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, return ptr; } -unsigned long msm_iomap_size(struct platform_device *pdev, const char *name) -{ - struct resource *res; - - if (name) - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, name); - else - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - - if (!res) { - dev_err(&pdev->dev, "failed to get memory resource: %s\n", - name); - return 0; - } - - return resource_size(res); -} - -void msm_iounmap(struct platform_device *pdev, void __iomem *addr) -{ - devm_iounmap(&pdev->dev, addr); -} - void msm_writel(u32 data, void __iomem *addr) { if (reglog) diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 9004530cc49a..da7daacc5eb8 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -416,8 +416,6 @@ static inline void msm_perf_debugfs_cleanup(struct msm_drm_private *priv) {} struct clk *msm_clk_get(struct platform_device *pdev, const char *name); void __iomem *msm_ioremap(struct platform_device *pdev, const char *name, const char *dbgname); -unsigned long msm_iomap_size(struct platform_device *pdev, const char *name); -void msm_iounmap(struct platform_device *dev, void __iomem *addr); void msm_writel(u32 data, void __iomem *addr); u32 msm_readl(const void __iomem *addr);