From patchwork Thu Jul 22 02:42:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 483852 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp6762836jao; Wed, 21 Jul 2021 19:44:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzB1RfZ+jmUr+h4ZNVKPPZ1i0uqZ+tEIrEcc+wIYpg0kpc627V4KZztC1zz2hmm743EQiiu X-Received: by 2002:a17:90b:33cf:: with SMTP id lk15mr31478793pjb.153.1626921858329; Wed, 21 Jul 2021 19:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626921858; cv=none; d=google.com; s=arc-20160816; b=Wiy4e1k6nV06QzCcRX7RX4pQTT/tXf36LsrUTzmHHIY5kTiAiEnXg1rFdyGzVDih+I yTi9Udkoms7wqKmt4yTQe9p0kUa5arXu2JnRYUuTZFD25e5r9cuMgKChQ997HoFXQlNB KR5YNiAScLBURA+XmjaDMa2HG4JZZC5KOJkVwfr44zTLDqMKT/ITAjrIws2wwGgwrI/B rKpU/mUBimpOFa9Qjgb+Qz/Cx+kmgoSz31RAasBiD/tOqbpS/yL0xA10KuQk4iphoVb0 U4ucyhYWVlreA54dBwj1zIrleVW4D7zv6tKDsNb65mCobxZZ4D8GJG5QD0Yp/nrKPRO0 V0jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=jLfCGQhZ9sWWK6V+miB0xsO475S4ojkH6KbRA6dRnQ4=; b=ea62WbEEJ9BelV9/tAV0uY4dXfOWnWmXsOB+8tH8ggp5qyQ5oE7YIlSncpHjfiLgX6 lCCxYaN9zIJjnbC+YyQgc5LrM2z6dvm/zOpHeneFRwyxxuR/MMAMEVhZ58DQBunKfPUq nlKDDqOLtCN+V8NFXAJHOUJ/HeXdVZ39olLcYwHqb0Gr6M+iuzOQRk9Cqx0zmedaNoUV Huyir9adFessv9zIAFbApPYJ3ED656Oz+GsAwY8WWJxs2kIotLkCnsifCqtndToKtZqG t4Wah13C+yF0KAoR2CfKpDBzMdoTV34x+f+vC1IwRa2/XuYCzghn29mHahoIFuOrd/JD 8ZWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=enHglQkC; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u11si31504829pla.70.2021.07.21.19.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 19:44:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=enHglQkC; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C6E36EE99; Thu, 22 Jul 2021 02:44:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id B918B6EE98 for ; Thu, 22 Jul 2021 02:44:14 +0000 (UTC) Received: by mail-oi1-x22e.google.com with SMTP id y66so5085228oie.7 for ; Wed, 21 Jul 2021 19:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jLfCGQhZ9sWWK6V+miB0xsO475S4ojkH6KbRA6dRnQ4=; b=enHglQkCfAeXdX2XT+ADILAHKBjtUZAqEoRhEBxzapVPkQhqIWS4apVqPKtTnx1joi DUSrlS4z6vYBIliupHyaFkUYPcxR+vNP+ZTXKQGHizjl1Za4cj0ULDNdh/4QJ6mb04R2 pWEduzwKUx6sLfFmqgaATyOIG0mu6tz6Q3xLkfRSaJc5YtrouH65Gx5tcTnUxe9HaSoR 6ZV5KKvwbTZ7Gyl1p9XR70JT+nDqO+JwqJi/XLILzYdQgKS+XsKPhgcb6caDZu/5kcOD 9/fg43z7lKyi7sw/geLrThpfA9raDy0MbPgbweomzYD4vNs7x6OIMlw8Rw/qJhvsr0h+ 5VVw== 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:mime-version:content-transfer-encoding; bh=jLfCGQhZ9sWWK6V+miB0xsO475S4ojkH6KbRA6dRnQ4=; b=DCdDjMipxi0CIu9yPiqDrqxnEP6bwyYDpz4kWBFCJWiZ9lgrHTa9YNs4QtznLqitHV 7Vvgwpn8oncWb7Sgw3ZCj+SlRQDjR95d+ClRpigv/pIEpi0xWrA3qGHOLNL/LcXuzOax 5dHqZMk/5ox898KcwYoK32daBMf+CYCjzmW7KOzDJhOWpdXiPWHMPoWXrzkdqndJp1PW zV35Hx748tbD8iKqjS5BmN5xH4MQeEJr5bw4xhKGPznGUJBJzNF0PgjnX9/MIoRbSRfZ J5xEFcagcT8gvz1R+keiFQOI4+53n6y563PvlCRB/bvTrmFh9wvCWr4GqNVZLFNacyY1 UhKg== X-Gm-Message-State: AOAM532TpWyd+hLvY+BT+eyc5dfnjiDH5JVUqAhWZAKvpu4XcRgUcZYr 5YsMGF4Qx9S5Dk4RWKluAYD/qA== X-Received: by 2002:aca:1e11:: with SMTP id m17mr4309603oic.104.1626921854077; Wed, 21 Jul 2021 19:44:14 -0700 (PDT) Received: from localhost.localdomain (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id u18sm5346519oif.9.2021.07.21.19.44.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jul 2021 19:44:13 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Stephen Boyd , Abhinav Kumar Subject: [PATCH 3/5] drm/msm/dp: Refactor ioremap wrapper Date: Wed, 21 Jul 2021 19:42:25 -0700 Message-Id: <20210722024227.3313096-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210722024227.3313096-1-bjorn.andersson@linaro.org> References: <20210722024227.3313096-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Kuogee Hsieh , Tanmay Shah , freedreno@lists.freedesktop.org, Chandan Uddaraju Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to deal with multiple memory ranges in the following commit change the ioremap wrapper to not poke directly into the dss_io_data struct. Signed-off-by: Bjorn Andersson --- drivers/gpu/drm/msm/dp/dp_parser.c | 28 ++++++++++++++-------------- drivers/gpu/drm/msm/dp/dp_parser.h | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index c064ced78278..e68dacef547c 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -19,39 +19,39 @@ static const struct dp_regulator_cfg sdm845_dp_reg_cfg = { }, }; -static int msm_dss_ioremap(struct platform_device *pdev, - struct dss_io_data *io_data) +static void __iomem *dp_ioremap(struct platform_device *pdev, int idx, size_t *len) { struct resource *res = NULL; + void __iomem *base; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + res = platform_get_resource(pdev, IORESOURCE_MEM, idx); if (!res) { DRM_ERROR("%pS->%s: msm_dss_get_res failed\n", __builtin_return_address(0), __func__); - return -ENODEV; + return ERR_PTR(-ENODEV); } - io_data->len = (u32)resource_size(res); - io_data->base = devm_ioremap(&pdev->dev, res->start, io_data->len); - if (!io_data->base) { + base = devm_ioremap_resource(&pdev->dev, res); + if (!base) { DRM_ERROR("%pS->%s: ioremap failed\n", __builtin_return_address(0), __func__); - return -EIO; + return ERR_PTR(-EIO); } - return 0; + *len = resource_size(res); + return base; } static int dp_parser_ctrl_res(struct dp_parser *parser) { - int rc = 0; struct platform_device *pdev = parser->pdev; struct dp_io *io = &parser->io; + struct dss_io_data *dss = &io->dp_controller; - rc = msm_dss_ioremap(pdev, &io->dp_controller); - if (rc) { - DRM_ERROR("unable to remap dp io resources, rc=%d\n", rc); - return rc; + dss->base = dp_ioremap(pdev, 0, &dss->len); + if (IS_ERR(dss->base)) { + DRM_ERROR("unable to remap dp io region: %pe\n", dss->base); + return PTR_ERR(dss->base); } io->phy = devm_phy_get(&pdev->dev, "dp"); diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index 34b49628bbaf..dc62e70b1640 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -26,7 +26,7 @@ enum dp_pm_type { }; struct dss_io_data { - u32 len; + size_t len; void __iomem *base; };