From patchwork Sat Feb 11 11:51:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 55789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1455144wrn; Sat, 11 Feb 2023 03:53:33 -0800 (PST) X-Google-Smtp-Source: AK7set9KoEo7h0V6CRvGv3x0QsQzl7oPLTN7V6OahdQpBV9jlm5vyXYKhxVWLoCHx2JALyvVqghn X-Received: by 2002:a17:906:4e96:b0:88d:3c85:4ccf with SMTP id v22-20020a1709064e9600b0088d3c854ccfmr19441176eju.25.1676116413577; Sat, 11 Feb 2023 03:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676116413; cv=none; d=google.com; s=arc-20160816; b=NP6m09nwFQMvxaxna71te9K+W+uAu4v29o4JIPHHr7XvMpnWQ+Lt/6+kYTpJUm0ZYi 4jjPWIWJ6vXgq04TLOYTHIEeViqi4dKHjlnefizvZod5VznYaPStx0yrzDNHJ6mm13Hd Ub92/ZfNDCoQOFNWBRlUb6WHbdDfqNG6J99ZwaQ//jvaUBZudPsyiaBhTYznWiUiydB5 fncDp3RF+CaT1Ug5lPeCjHJut7VthpV20Pe7U4HOm9aZl5VIs757gulBDRZyEsalYJyx eMYHKY01cCu98fRsuqNqu7f7+9L32mAmlpYC6R//ow2KcWccaD3PKzkJ/QHcdJm6OS5x gUXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/W1yN038JHBkZa936DvMVOCfu8R7n0uZaSVb3zgCCfI=; b=CdiMja+emM6E/AHTzKxLkvLKdas57D0pGqGb0vkBZxSy2ZI/kI1IQYhaE5cLoBYjK0 LfW8Q2r6Gh0nWZ786gGDP8VrQSmlAOMea7pEIDO/kpU2m+psdpA5ZmFlW9uzj3Y8/DQI p44MoFYt23teEX6TAyi5Msix+v4EubB6t7ggwZrVkl29gayz/sonM4N0epZjyZgrdg7P oxQqyN9Bq4tPk8WZj549OIZbrcte8UO3pxTqcydQT6MLVfVNg/DmhZVbFaU2luRt+L2W 5hyTlIex9WrIBQ4q3ke5x6bZjY9BBAXb0QCYUPbmFW6O+V1J3gVoWJ5WJZpY0s9KKbjH Vrpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d4y2N5O4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 30-20020a170906015e00b008aabee9b262si12843134ejh.474.2023.02.11.03.53.10; Sat, 11 Feb 2023 03:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d4y2N5O4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230166AbjBKLv7 (ORCPT + 99 others); Sat, 11 Feb 2023 06:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbjBKLvz (ORCPT ); Sat, 11 Feb 2023 06:51:55 -0500 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A744CAD19 for ; Sat, 11 Feb 2023 03:51:49 -0800 (PST) Received: by mail-ed1-x52a.google.com with SMTP id u21so7341074edv.3 for ; Sat, 11 Feb 2023 03:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/W1yN038JHBkZa936DvMVOCfu8R7n0uZaSVb3zgCCfI=; b=d4y2N5O4WC0XbfkuF+PWiYsvvT9dZHVpZUH2azWkndreplnqUor0ZJRp9cx20tGMi2 IrK2iwoeDlP/OXKb8fK1NJxAL/+eHidzH8zo37Obi3nQBSCs68aG/F1REjY/Nv7064kg rICCOttEFo6lCktwcXLckWBbyXnjlakWN0S5K+zXovIQ2cUUsVO8t3Z1s4ZDwxcLjC50 lw4AROrHcShlrQjwtYC6fg1MCjtZho5R9yNzv3g264c70xs5FmE4K65dsaG0wE5YDMrA 4OY8vsLJvyr/+hiDw06weFXLwXFu7wdmIx5/TtbhxyCsimLtoGrfqzi8UjiKg+JxE6wk Tx3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/W1yN038JHBkZa936DvMVOCfu8R7n0uZaSVb3zgCCfI=; b=Bd61JOBnWhzdeIwyZ9NOPn25WeEFTJlWGRP/5muGoA353w11HaBGKwOsU+j1DcibpK H1S6vR7GMuHV8z03RgdQWNmmeyWouFdisc9yKYA5Zv7ul4dO1pLAI+cEVtgKzQdb4Tfb GYsQKWnlj8iH3kWecmgJCg3/OpkoBogRLxO/BD5pmeLwBshGDuWR0LK3YhB0TCJzZcLc NdGLKFIzL067y+SIhac/HNLcV7frjcKNz884Y17WePvQe495fQ6TC4cnazpJcdUaWStM IBvCNrdGAQm42XQuwPMSi0l0BV/8riUemfUCVUIQWp7ovzstKIVAJRTxr55T2NLE0tSI 0mvQ== X-Gm-Message-State: AO0yUKUMEskpAdhi1ThfzW5dP4dy3dr+kigzSThAwcelVEnhkTgUqpoJ sjLsAd7Bg034OLgYkCMc4lpWTg== X-Received: by 2002:a50:ccd8:0:b0:4ac:b838:a902 with SMTP id b24-20020a50ccd8000000b004acb838a902mr1160166edj.13.1676116308162; Sat, 11 Feb 2023 03:51:48 -0800 (PST) Received: from localhost.localdomain (abxh117.neoplus.adsl.tpnet.pl. [83.9.1.117]) by smtp.gmail.com with ESMTPSA id r10-20020a50d68a000000b004aabb714230sm3636070edi.35.2023.02.11.03.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Feb 2023 03:51:47 -0800 (PST) From: Konrad Dybcio To: linux-arm-msm@vger.kernel.org, andersson@kernel.org, agross@kernel.org, krzysztof.kozlowski@linaro.org Cc: marijn.suijten@somainline.org, Konrad Dybcio , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Douglas Anderson , Neil Armstrong , Loic Poulain , Vinod Koul , Vladimir Lypak , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/10] drm/msm/dsi: Turn msm_dsi_config::io_start into a 2d array Date: Sat, 11 Feb 2023 12:51:02 +0100 Message-Id: <20230211115110.1462920-3-konrad.dybcio@linaro.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230211115110.1462920-1-konrad.dybcio@linaro.org> References: <20230211115110.1462920-1-konrad.dybcio@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757535444519285150?= X-GMAIL-MSGID: =?utf-8?q?1757535444519285150?= Currently, we allow for MAX_DSI entries in io_start to facilitate for MAX_DSI number of DSI hosts at different addresses. The configuration is matched against the DSI CTRL hardware revision read back from the component. We need a way to resolve situations where multiple SoCs with different register maps may use the same version of DSI CTRL. In preparation to do so, make msm_dsi_config a 2d array where each entry represents a set of configurations adequate for a given SoC. This is totally fine to do, as the only differentiating factors between same-version-different-SoCs configurations are the number of DSI hosts (1 or 2, at least as of today) and the set of registers. The regulator setup is the same, because the DSI hardware is the same, regardless of the SoC it was implemented in. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/dsi/dsi_cfg.c | 52 ++++++++++++++++++++++-------- drivers/gpu/drm/msm/dsi/dsi_cfg.h | 5 ++- drivers/gpu/drm/msm/dsi/dsi_host.c | 2 +- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/dsi_cfg.c index 6d21f0b33411..068d45b3a8f0 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c @@ -21,7 +21,9 @@ static const struct msm_dsi_config apq8064_dsi_cfg = { .num_regulators = ARRAY_SIZE(apq8064_dsi_regulators), .bus_clk_names = dsi_v2_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_v2_bus_clk_names), - .io_start = { 0x4700000, 0x5800000 }, + .io_start = { + { 0x4700000, 0x5800000 }, + }, .num_dsi = 2, }; @@ -41,7 +43,9 @@ static const struct msm_dsi_config msm8974_apq8084_dsi_cfg = { .num_regulators = ARRAY_SIZE(msm8974_apq8084_regulators), .bus_clk_names = dsi_6g_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names), - .io_start = { 0xfd922800, 0xfd922b00 }, + .io_start = { + { 0xfd922800, 0xfd922b00 }, + }, .num_dsi = 2, }; @@ -60,7 +64,9 @@ static const struct msm_dsi_config msm8916_dsi_cfg = { .num_regulators = ARRAY_SIZE(msm8916_dsi_regulators), .bus_clk_names = dsi_8916_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_8916_bus_clk_names), - .io_start = { 0x1a98000 }, + .io_start = { + { 0x1a98000 }, + }, .num_dsi = 1, }; @@ -79,7 +85,9 @@ static const struct msm_dsi_config msm8976_dsi_cfg = { .num_regulators = ARRAY_SIZE(msm8976_dsi_regulators), .bus_clk_names = dsi_8976_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_8976_bus_clk_names), - .io_start = { 0x1a94000, 0x1a96000 }, + .io_start = { + { 0x1a94000, 0x1a96000 }, + }, .num_dsi = 2, }; @@ -98,7 +106,9 @@ static const struct msm_dsi_config msm8994_dsi_cfg = { .num_regulators = ARRAY_SIZE(msm8994_dsi_regulators), .bus_clk_names = dsi_6g_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_6g_bus_clk_names), - .io_start = { 0xfd998000, 0xfd9a0000 }, + .io_start = { + { 0xfd998000, 0xfd9a0000 }, + }, .num_dsi = 2, }; @@ -118,7 +128,9 @@ static const struct msm_dsi_config msm8996_dsi_cfg = { .num_regulators = ARRAY_SIZE(msm8996_dsi_regulators), .bus_clk_names = dsi_8996_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_8996_bus_clk_names), - .io_start = { 0x994000, 0x996000 }, + .io_start = { + { 0x994000, 0x996000 }, + }, .num_dsi = 2, }; @@ -137,7 +149,9 @@ static const struct msm_dsi_config msm8998_dsi_cfg = { .num_regulators = ARRAY_SIZE(msm8998_dsi_regulators), .bus_clk_names = dsi_msm8998_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_msm8998_bus_clk_names), - .io_start = { 0xc994000, 0xc996000 }, + .io_start = { + { 0xc994000, 0xc996000 }, + }, .num_dsi = 2, }; @@ -155,7 +169,9 @@ static const struct msm_dsi_config sdm660_dsi_cfg = { .num_regulators = ARRAY_SIZE(sdm660_dsi_regulators), .bus_clk_names = dsi_sdm660_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_sdm660_bus_clk_names), - .io_start = { 0xc994000, 0xc996000 }, + .io_start = { + { 0xc994000, 0xc996000 }, + }, .num_dsi = 2, }; @@ -177,7 +193,9 @@ static const struct msm_dsi_config sdm845_dsi_cfg = { .num_regulators = ARRAY_SIZE(sdm845_dsi_regulators), .bus_clk_names = dsi_sdm845_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names), - .io_start = { 0xae94000, 0xae96000 }, + .io_start = { + { 0xae94000, 0xae96000 }, + }, .num_dsi = 2, }; @@ -191,7 +209,9 @@ static const struct msm_dsi_config sm8550_dsi_cfg = { .num_regulators = ARRAY_SIZE(sm8550_dsi_regulators), .bus_clk_names = dsi_sdm845_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_sdm845_bus_clk_names), - .io_start = { 0xae94000, 0xae96000 }, + .io_start = { + { 0xae94000, 0xae96000 }, + }, .num_dsi = 2, }; @@ -205,7 +225,9 @@ static const struct msm_dsi_config sc7180_dsi_cfg = { .num_regulators = ARRAY_SIZE(sc7180_dsi_regulators), .bus_clk_names = dsi_sc7180_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_sc7180_bus_clk_names), - .io_start = { 0xae94000 }, + .io_start = { + { 0xae94000 }, + }, .num_dsi = 1, }; @@ -223,7 +245,9 @@ static const struct msm_dsi_config sc7280_dsi_cfg = { .num_regulators = ARRAY_SIZE(sc7280_dsi_regulators), .bus_clk_names = dsi_sc7280_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_sc7280_bus_clk_names), - .io_start = { 0xae94000, 0xae96000 }, + .io_start = { + { 0xae94000, 0xae96000 }, + }, .num_dsi = 2, }; @@ -241,7 +265,9 @@ static const struct msm_dsi_config qcm2290_dsi_cfg = { .num_regulators = ARRAY_SIZE(qcm2290_dsi_cfg_regulators), .bus_clk_names = dsi_qcm2290_bus_clk_names, .num_bus_clks = ARRAY_SIZE(dsi_qcm2290_bus_clk_names), - .io_start = { 0x5e94000 }, + .io_start = { + { 0x5e94000 }, + }, .num_dsi = 1, }; diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/dsi_cfg.h index 44be4a88aa83..df9f09876ccb 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h @@ -32,13 +32,16 @@ #define DSI_6G_REG_SHIFT 4 +/* Maximum number of configurations matched against the same hw revision */ +#define VARIANTS_MAX 2 + struct msm_dsi_config { u32 io_offset; const struct regulator_bulk_data *regulator_data; int num_regulators; const char * const *bus_clk_names; const int num_bus_clks; - const resource_size_t io_start[DSI_MAX]; + const resource_size_t io_start[VARIANTS_MAX][DSI_MAX]; const int num_dsi; }; diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c index 18fa30e1e858..22ba8726b0ea 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -1869,7 +1869,7 @@ static int dsi_host_get_id(struct msm_dsi_host *msm_host) return -EINVAL; for (i = 0; i < cfg->num_dsi; i++) { - if (cfg->io_start[i] == res->start) + if (cfg->io_start[0][i] == res->start) return i; }