From patchwork Wed Oct 5 15:13:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999366 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01EA6C433F5 for ; Wed, 5 Oct 2022 15:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbiJEPNl (ORCPT ); Wed, 5 Oct 2022 11:13:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230357AbiJEPNj (ORCPT ); Wed, 5 Oct 2022 11:13:39 -0400 Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BE1B6DFB1 for ; Wed, 5 Oct 2022 08:13:39 -0700 (PDT) Received: by mail-il1-x12a.google.com with SMTP id o13so3776300ilc.7 for ; Wed, 05 Oct 2022 08:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; 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=preYEoQg0LX6lD/WAOwpnKfSNDR1YFRVxD4DlRUGkd4=; b=lxNqiUpWYwCzyY2rJLZPtx7MQ6XjmBozOxRmtaNiKq4ZF/8LQ/sbBLoQv8PLfIWOse ncrXZwGBfewOOmJQBmZZRN5vw1u7vCa20uUIualOqoFcK0ccM4/Qj8Erce0bQIjIAoHD Orqd1Je0BjwyzxfYEZLlbJ1pdeT9/yiRDHik8= 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=preYEoQg0LX6lD/WAOwpnKfSNDR1YFRVxD4DlRUGkd4=; b=M/54jEqklcnbxCSfCAaMppmR6L/d2N5oZnO6i7HUiDRr6UtLVxr14ESt67YShDc8X+ VzeFJJfEbkbWBQ20LmzuhWBpG+FAcldVXtIJT5J8m+jW2BhtSmznFJx5Mew6ShP7utVT GotUbrYFBiMbJ7fhqIjnLR9j+jVBEaBjogk22mKSsOsyEckgUNLhPzfn8brbE8MI88cJ XK5EaKpk8njVJBUxhUMXS5/Wwdgxdl7qj7vLJIQvUrrLuibBT4DfE9pQHrjlcURWpAxJ LW6ZdgYevKrMmFyxOazxFDFHn19xuRkWnT8W0CMvTKmySRyLyzj3tRCIzMsV27Axt9pu KgfQ== X-Gm-Message-State: ACrzQf13+/9XRdBPXd0RWuXvEGiiI6tr5dFTmsVUsHQxB0s1xiDKdOto p1HbA2bBlCgdTtImuHd3TvF9bg== X-Google-Smtp-Source: AMsMyM7oQxHYFC9wRtMAvjgY+dEp/T158CKlsL2Re02oXE+MskDsyE5N3YAx/UTZP+BdSW4bw65mJQ== X-Received: by 2002:a05:6e02:1c86:b0:2f9:7dc5:4037 with SMTP id w6-20020a056e021c8600b002f97dc54037mr72663ill.2.1664982818128; Wed, 05 Oct 2022 08:13:38 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:37 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki , Laurent Pinchart Subject: [PATCH v7 10/10] drm: bridge: samsung-dsim: Add i.MX8MM support Date: Wed, 5 Oct 2022 20:43:09 +0530 Message-Id: <20221005151309.7278-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Samsung MIPI DSIM master can also be found in i.MX8MM SoC. Add compatible and associated driver_data for it. v7, v6: * none v3: * enable DSIM_QUIRK_FIXUP_SYNC_POL quirk v5: * [mszyprow] rebased and adjusted to the new driver initialization * drop quirk v4: * none v3: * enable DSIM_QUIRK_FIXUP_SYNC_POL quirk v2: * collect Laurent r-b v1: * none Reviewed-by: Laurent Pinchart Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index f5cd80641cea..1b5ba33dc635 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -360,6 +360,24 @@ static const unsigned int exynos5433_reg_values[] = { [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), }; +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = 0, + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .reg_ofs = exynos_reg_ofs, .plltmr_reg = 0x50, @@ -421,6 +439,23 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .reg_values = exynos5422_reg_values, }; +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + /** + * FIXME: + * Offset value used from downstream drivers/gpu/drm/bridge/sec-dsim.c + * remove this comment if it is true else update the logic. + */ + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, +}; + static const struct samsung_dsim_driver_data * samsung_dsim_types[SAMSUNG_DSIM_TYPE_COUNT] = { [SAMSUNG_DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, @@ -428,6 +463,7 @@ samsung_dsim_types[SAMSUNG_DSIM_TYPE_COUNT] = { [SAMSUNG_DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, [SAMSUNG_DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, [SAMSUNG_DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, + [SAMSUNG_DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, }; static inline struct samsung_dsim *host_to_dsi(struct mipi_dsi_host *h) @@ -1788,7 +1824,16 @@ const struct dev_pm_ops samsung_dsim_pm_ops = { }; EXPORT_SYMBOL_GPL(samsung_dsim_pm_ops); +static const struct samsung_dsim_plat_data samsung_dsim_imx8mm_pdata = { + .hw_type = SAMSUNG_DSIM_TYPE_IMX8MM, + .host_ops = &samsung_dsim_generic_host_ops, +}; + static const struct of_device_id samsung_dsim_of_match[] = { + { + .compatible = "fsl,imx8mm-mipi-dsim", + .data = &samsung_dsim_imx8mm_pdata, + }, { /* sentinel. */ } }; MODULE_DEVICE_TABLE(of, samsung_dsim_of_match);