From patchwork Fri Mar 3 14:51:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2768 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2A4CC44AA6 for ; Fri, 3 Mar 2023 15:52:44 +0100 (CET) Received: by mail-pl1-f200.google.com with SMTP id s15-20020a170902ea0f00b0019d0c7a83dfsf1505404plg.14 for ; Fri, 03 Mar 2023 06:52:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677855163; cv=pass; d=google.com; s=arc-20160816; b=GHQsHQReyEIekmDFOseQI9Zz+H/NUgW2Vl5sauCn6KIgle23HdrNOxto5TaboFidai 3j7QqV5hbV/93wiYjzU9GsRkvgAB3fFPZih1fqnsmw++ta9EEtHMwzLhxZOEu1cEXcGs 6/wRl5AUFQUxMpOyEeDIJbCfpTHQDFV2ZEOLWMORAkjAjZbEhuTB3mCs7/jOrb5hZ4H1 TE69z2WXEPr16V38DRTpYWx58QIa7Xic6WHlzPARNkBuLBZTF1fJPisyP80dSuOBPb/1 puDHlmVAXYHJbVUZtdW20bDJVmWHXlH5b4e+nCadzq+VRErV20OlpwOYmytECnz0x+7t s3gw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TckoKxG0crOmtY67nTkSdWAJlAipCn+32H7SGivffPI=; b=RqqcQawSEvDL5MfJk8+geKsLieaIAD11R+YnLKonFqL114A0XJ8uA3oLI9v8jQfws5 Ro2yHLfjjnagdSmSwzT9Z8l8EwZ7RhhdjmWX2DMDupEh9Q7UH3lpzLSy/CYMG9msX2bf VjtP6sHtvJeIkG2kO7kCG8+ieGWJn76Lclow2Emo4MYyZTaqOQ1kfNNN5P6RfzTPLXZn MMSb57FtJO2x1AOjnIQyMnxbsPsLypounhIbi5E059bZt0uytmTSZfPd2D5f3MtT08V7 +DTKUZjBpyoh8BbaqZwlWtdMZUJiyG27DhQvK4XW82ZZSSiZgQI+3QJnTFa1ws3dPVXv 2J9Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FhHtWBPo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1677855163; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=TckoKxG0crOmtY67nTkSdWAJlAipCn+32H7SGivffPI=; b=ALM+F1zu8RFDCp2SPXftZPn5XK+tLQszKEYIcgFlxTTZCgvHViiVFr0Pl9IhLk/RQO zm5GdgtP88YKsyEnDWTo3C1P+5O5GeJuNAc/5GMz785dBH42i2MsKp7jFJuyKgBPSGBM jSdmmHWIzXz5PoE39S7fWJQX8nTwnKgl9JErs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677855163; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender: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=TckoKxG0crOmtY67nTkSdWAJlAipCn+32H7SGivffPI=; b=dvH9A/gpHQgHyUPSgX/3JeCjOb9nPms4UMmdrc/f6tv9nka9oL4xO1LztFa4Iur6mD PDnCppxIiI8vhMLsPiXY0885PPFkyEvRykfxBX2ALXRk/Tig0fplmrkvGh7E7CcL2lAZ G++lX4DWDRnW68VnEFLvf21WQL9RzOlyVZbCCemEovvFMgu0B8JLZq8ceOxL0dC4+SST /DIWFbHL+Gv9/LP54LUZ+/2lC3Ix5C3hM7e8RmVRyBhtmQ7ojFK3qqvafTORFax2XMm1 cpm637WnO63C0hPr2OI6gTSz+G7gJXtqp58szveukgYgRD5kZ5zdNpCOPE8IJnq0JXTv q/pg== X-Gm-Message-State: AO0yUKWSgcztfiyEdjnhL4fWfOcFJul3sZDYlNSSo1KI7V+tOM11bic9 A4v/k779uOaiEj/6/rq9sVoUx12n X-Google-Smtp-Source: AK7set8RM82BTk1E9i6+XdOSVodwZMev273P7rPXYlQYQPQ7EUaJeUu7UIYdIiwI+onZAnBvKG92sA== X-Received: by 2002:a17:90b:2352:b0:230:9de7:1d14 with SMTP id ms18-20020a17090b235200b002309de71d14mr675259pjb.5.1677855162796; Fri, 03 Mar 2023 06:52:42 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:e742:b0:19c:2b1c:4d75 with SMTP id p2-20020a170902e74200b0019c2b1c4d75ls923503plf.0.-pod-prod-gmail; Fri, 03 Mar 2023 06:52:42 -0800 (PST) X-Received: by 2002:a17:903:1cb:b0:19c:eaf0:9859 with SMTP id e11-20020a17090301cb00b0019ceaf09859mr2884726plh.38.1677855161780; Fri, 03 Mar 2023 06:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677855161; cv=none; d=google.com; s=arc-20160816; b=sGoAsH1etJoPdsWpAsUrMPGf92Q606veAqCfg2691uqNsBGLZUrGXaHbNoktl6VEJC A9Mq0qD5B3AGly1svQr53Ejt+muIzmjJGr/Mzp//DzKe1bhyoiHGi6ubrZJ5wYl2jPFm iZSSQuIDPvbZdZberPJvqZAldOYIMQOBFkIgDoMYeIBGytinwkGWdrOwocs2BhKduGJX PjvT1fLJp9wD1UkgC4Lob+tg3ShagJqdAy6WWHsMUAB5IYvFQwI7HiTD8LJkcMPOaaJA 1gdhlU6cpiyw8fHaUJiekvNjU/n3tfzT9w+frD85DYpfUUIll65UrLuPEq69zsO/mgCb uwmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=8ZuKEGIK8u3BOHalvqGIm9UnoS+t9+HMUkXfXB/tUbc=; b=PC+/ND9mXEfSGDvVTLNwBsJGMvuTHmMaBjQMcxo88209uEWPvgzMn8u91EoMbTazvD u5OcJtyzEwaN15YsFpjFgq5+8d+19eTlRHKwPirOTX5EIKeRN7Q6YJa/6tCdowU4jinJ nacBzkGSUuRk2w04Yg+Iu/WX/TDxsYU2Hrjhkoj2pV2u+eT2avGLPjXX0WS7blxMZj1v q2G44VGgLvCj5d7T4aKk1Z7hCsogV7eYWcQ0Hb8Nhbb9CR8QiPWzksHyNBohcCFov1Ih dszMbikaKb4lRvRYfC9AtVQPDypxQFt2xisDtoCz71i8UGw1YGdbXQS/roG9rt/5ErOv LUKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FhHtWBPo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id iw21-20020a170903045500b0019a9c0b98dcsor1084287plb.85.2023.03.03.06.52.41 for (Google Transport Security); Fri, 03 Mar 2023 06:52:41 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a05:6a20:a8a6:b0:cc:8ac6:90ca with SMTP id ca38-20020a056a20a8a600b000cc8ac690camr2228469pzb.27.1677855161400; Fri, 03 Mar 2023 06:52:41 -0800 (PST) Received: from localhost.localdomain ([183.83.137.89]) by smtp.gmail.com with ESMTPSA id z4-20020a63e544000000b00502fd70b0bdsm1660856pgj.52.2023.03.03.06.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:52:40 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Cc: Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH v15 05/16] drm: exynos: dsi: Introduce hw_type platform data Date: Fri, 3 Mar 2023 20:21:27 +0530 Message-Id: <20230303145138.29233-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303145138.29233-1-jagan@amarulasolutions.com> References: <20230303145138.29233-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FhHtWBPo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Samsung MIPI DSIM controller is common DSI IP that can be used in various SoCs like Exynos, i.MX8M Mini/Nano/Plus. Add hw_type enum via platform_data so that accessing the different controller data between various platforms becomes easy and meaningful. Reviewed-by: Marek Vasut Reviewed-by: Frieder Schrempf Suggested-by: Marek Szyprowski Signed-off-by: Jagan Teki --- Changes for v15, v13: - none Changes for v12: - collect RB from Marek Changes for v11: - collect RB from Frieder - drop extra line Changes for v10: - split from previous series patch "drm: bridge: Generalize Exynos-DSI driver into a Samsung DSIM bridge" - update enum type names drivers/gpu/drm/exynos/exynos_drm_dsi.c | 83 ++++++++++++++++++++----- 1 file changed, 68 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 603fed107fd1..64cf69995750 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -254,6 +254,15 @@ struct exynos_dsi_transfer { #define DSIM_STATE_CMD_LPM BIT(2) #define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) +enum exynos_dsi_type { + DSIM_TYPE_EXYNOS3250, + DSIM_TYPE_EXYNOS4210, + DSIM_TYPE_EXYNOS5410, + DSIM_TYPE_EXYNOS5422, + DSIM_TYPE_EXYNOS5433, + DSIM_TYPE_COUNT, +}; + struct exynos_dsi_driver_data { const unsigned int *reg_ofs; unsigned int plltmr_reg; @@ -267,6 +276,10 @@ struct exynos_dsi_driver_data { const unsigned int *reg_values; }; +struct exynos_dsi_plat_data { + enum exynos_dsi_type hw_type; +}; + struct exynos_dsi { struct drm_encoder encoder; struct mipi_dsi_host dsi_host; @@ -297,6 +310,7 @@ struct exynos_dsi { struct list_head transfer_list; const struct exynos_dsi_driver_data *driver_data; + const struct exynos_dsi_plat_data *plat_data; }; #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) @@ -524,18 +538,13 @@ static const struct exynos_dsi_driver_data exynos5422_dsi_driver_data = { .reg_values = exynos5422_reg_values, }; -static const struct of_device_id exynos_dsi_of_match[] = { - { .compatible = "samsung,exynos3250-mipi-dsi", - .data = &exynos3_dsi_driver_data }, - { .compatible = "samsung,exynos4210-mipi-dsi", - .data = &exynos4_dsi_driver_data }, - { .compatible = "samsung,exynos5410-mipi-dsi", - .data = &exynos5_dsi_driver_data }, - { .compatible = "samsung,exynos5422-mipi-dsi", - .data = &exynos5422_dsi_driver_data }, - { .compatible = "samsung,exynos5433-mipi-dsi", - .data = &exynos5433_dsi_driver_data }, - { } +static const struct exynos_dsi_driver_data * +exynos_dsi_types[DSIM_TYPE_COUNT] = { + [DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, + [DSIM_TYPE_EXYNOS4210] = &exynos4_dsi_driver_data, + [DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, + [DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, + [DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, }; static void exynos_dsi_wait_for_reset(struct exynos_dsi *dsi) @@ -1468,8 +1477,6 @@ static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { .attach = exynos_dsi_attach, }; -MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); - static int exynos_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { @@ -1704,7 +1711,8 @@ static int exynos_dsi_probe(struct platform_device *pdev) dsi->dsi_host.dev = dev; dsi->dev = dev; - dsi->driver_data = of_device_get_match_data(dev); + dsi->plat_data = of_device_get_match_data(dev); + dsi->driver_data = exynos_dsi_types[dsi->plat_data->hw_type]; dsi->supplies[0].supply = "vddcore"; dsi->supplies[1].supply = "vddio"; @@ -1862,6 +1870,51 @@ static const struct dev_pm_ops exynos_dsi_pm_ops = { pm_runtime_force_resume) }; +static const struct exynos_dsi_plat_data exynos3250_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS3250, +}; + +static const struct exynos_dsi_plat_data exynos4210_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS4210, +}; + +static const struct exynos_dsi_plat_data exynos5410_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS5410, +}; + +static const struct exynos_dsi_plat_data exynos5422_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS5422, +}; + +static const struct exynos_dsi_plat_data exynos5433_dsi_pdata = { + .hw_type = DSIM_TYPE_EXYNOS5433, +}; + +static const struct of_device_id exynos_dsi_of_match[] = { + { + .compatible = "samsung,exynos3250-mipi-dsi", + .data = &exynos3250_dsi_pdata, + }, + { + .compatible = "samsung,exynos4210-mipi-dsi", + .data = &exynos4210_dsi_pdata, + }, + { + .compatible = "samsung,exynos5410-mipi-dsi", + .data = &exynos5410_dsi_pdata, + }, + { + .compatible = "samsung,exynos5422-mipi-dsi", + .data = &exynos5422_dsi_pdata, + }, + { + .compatible = "samsung,exynos5433-mipi-dsi", + .data = &exynos5433_dsi_pdata, + }, + { /* sentinel. */ } +}; +MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); + struct platform_driver dsi_driver = { .probe = exynos_dsi_probe, .remove = exynos_dsi_remove,