<br><br><br>Sent from ProtonMail mobile<br><br><br><br>-------- Original Message --------<br>On Mar 10, 2021, 12:10, < dri-devel-request@lists.freedesktop.org> wrote:<blockquote class="protonmail_quote"><br><p dir="ltr">Send dri-devel mailing list submissions to<br>
dri-devel@lists.freedesktop.org</p>
<p dir="ltr">To subscribe or unsubscribe via the World Wide Web, visit<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br>
or, via email, send a message with subject or body 'help' to<br>
dri-devel-request@lists.freedesktop.org</p>
<p dir="ltr">You can reach the person managing the list at<br>
dri-devel-owner@lists.freedesktop.org</p>
<p dir="ltr">When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of dri-devel digest..."<br></p>
<p dir="ltr">Today's Topics:</p>
<p dir="ltr">1. [PATCH v5 13/14] drm/bridge: imx: Add LDB support for i.MX8qm<br>
(Liu Ying)<br>
2. [PATCH v5 14/14] MAINTAINERS: add maintainer for DRM bridge<br>
drivers for <a href="http://i.MX">i.MX</a> SoCs (Liu Ying)<br></p>
<p dir="ltr">----------------------------------------------------------------------</p>
<p dir="ltr">Message: 1<br>
Date: Wed, 10 Mar 2021 17:55:37 +0800<br>
From: Liu Ying <victor.liu@nxp.com><br>
To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,<br>
linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org,<br>
linux-media@vger.kernel.org<br>
Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org,<br>
shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de,<br>
festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org,<br>
a.hajda@samsung.com, narmstrong@baylibre.com,<br>
Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se,<br>
jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org,<br>
robert.foss@linaro.org, lee.jones@linaro.org<br>
Subject: [PATCH v5 13/14] drm/bridge: imx: Add LDB support for i.MX8qm<br>
Message-ID: <1615370138-5673-14-git-send-email-victor.liu@nxp.com><br>
Content-Type: text/plain</p>
<p dir="ltr">This patch adds a drm bridge driver for i.MX8qm LVDS display bridge(LDB)<br>
which is officially named as pixel mapper. The LDB has two channels.<br>
Each of them supports up to 30bpp parallel input color format and can<br>
map the input to VESA or JEIDA standards. The two channels can be used<br>
simultaneously, either in dual mode or split mode. In dual mode, the<br>
two channels output identical data. In split mode, channel0 outputs<br>
odd pixels and channel1 outputs even pixels. This patch supports the<br>
LDB single mode and split mode.</p>
<p dir="ltr">Signed-off-by: Liu Ying <victor.liu@nxp.com><br>
---<br>
Note that this patch depends on the patch 'phy: Add LVDS configuration options',<br>
which has already been sent with the following series to add Mixel combo PHY<br>
found in i.MX8qxp:<br>
<a href="https://www.spinics.net/lists/arm-kernel/msg879957.html">https://www.spinics.net/lists/arm-kernel/msg879957.html</a></p>
<p dir="ltr">v4->v5:<br>
* Link with the imx-ldb-helper object. (Robert)<br>
* Correspondingly, rename 'imx8qm-ldb.c' to 'imx8qm-ldb-drv.c'.</p>
<p dir="ltr">v3->v4:<br>
* No change.</p>
<p dir="ltr">v2->v3:<br>
* No change.</p>
<p dir="ltr">v1->v2:<br>
* Drop unnecessary check for maximum available LDB channels.<br>
* Mention i.MX8qm LDB official name 'pixel mapper' in the bridge driver<br>
and Kconfig help message.</p>
<p dir="ltr">drivers/gpu/drm/bridge/imx/Kconfig | 9 +<br>
drivers/gpu/drm/bridge/imx/Makefile | 3 +<br>
drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c | 586 ++++++++++++++++++++++++++++<br>
3 files changed, 598 insertions(+)<br>
create mode 100644 drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c</p>
<p dir="ltr">diff --git a/drivers/gpu/drm/bridge/imx/Kconfig b/drivers/gpu/drm/bridge/imx/Kconfig<br>
index 94f8db4d..3a8683f 100644<br>
--- a/drivers/gpu/drm/bridge/imx/Kconfig<br>
+++ b/drivers/gpu/drm/bridge/imx/Kconfig<br>
@@ -1,3 +1,12 @@<br>
+config DRM_IMX8QM_LDB<br>
+ tristate "Freescale i.MX8QM LVDS display bridge"<br>
+ depends on OF<br>
+ depends on COMMON_CLK<br>
+ select DRM_KMS_HELPER<br>
+ help<br>
+ Choose this to enable the internal LVDS Display Bridge(LDB) found in<br>
+ Freescale i.MX8qm processor. Official name of LDB is pixel mapper.<br>
+<br>
config DRM_IMX8QXP_LDB<br>
tristate "Freescale i.MX8QXP LVDS display bridge"<br>
depends on OF<br>
diff --git a/drivers/gpu/drm/bridge/imx/Makefile b/drivers/gpu/drm/bridge/imx/Makefile<br>
index 96d5d1e..aa90ec8 100644<br>
--- a/drivers/gpu/drm/bridge/imx/Makefile<br>
+++ b/drivers/gpu/drm/bridge/imx/Makefile<br>
@@ -1,3 +1,6 @@<br>
+imx8qm-ldb-objs := imx-ldb-helper.o imx8qm-ldb-drv.o<br>
+obj-$(CONFIG_DRM_IMX8QM_LDB) += imx8qm-ldb.o<br>
+<br>
imx8qxp-ldb-objs := imx-ldb-helper.o imx8qxp-ldb-drv.o<br>
obj-$(CONFIG_DRM_IMX8QXP_LDB) += imx8qxp-ldb.o</p>
<p dir="ltr">diff --git a/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c b/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c<br>
new file mode 100644<br>
index 00000000..6c92636<br>
--- /dev/null<br>
+++ b/drivers/gpu/drm/bridge/imx/imx8qm-ldb-drv.c<br>
@@ -0,0 +1,586 @@<br>
+// SPDX-License-Identifier: GPL-2.0+<br>
+<br>
+/*<br>
+ * Copyright 2020 NXP<br>
+ */<br>
+<br>
+#include <linux/clk.h><br>
+#include <linux/mfd/syscon.h><br>
+#include <linux/module.h><br>
+#include <linux/of.h><br>
+#include <linux/of_device.h><br>
+#include <linux/of_graph.h><br>
+#include <linux/phy/phy.h><br>
+#include <linux/pm_runtime.h><br>
+#include <linux/regmap.h><br>
+<br>
+#include <drm/drm_atomic_state_helper.h><br>
+#include <drm/drm_bridge.h><br>
+#include <drm/drm_connector.h><br>
+#include <drm/drm_fourcc.h><br>
+#include <drm/drm_of.h><br>
+#include <drm/drm_print.h><br>
+<br>
+#include "imx-ldb-helper.h"<br>
+<br>
+#define LDB_CH0_10BIT_EN (1 << 22)<br>
+#define LDB_CH1_10BIT_EN (1 << 23)<br>
+#define LDB_CH0_DATA_WIDTH_24BIT (1 << 24)<br>
+#define LDB_CH1_DATA_WIDTH_24BIT (1 << 26)<br>
+#define LDB_CH0_DATA_WIDTH_30BIT (2 << 24)<br>
+#define LDB_CH1_DATA_WIDTH_30BIT (2 << 26)<br>
+<br>
+#define SS_CTRL 0x20<br>
+#define CH_HSYNC_M(id) BIT(0 + ((id) * 2))<br>
+#define CH_VSYNC_M(id) BIT(1 + ((id) * 2))<br>
+#define CH_PHSYNC(id) BIT(0 + ((id) * 2))<br>
+#define CH_PVSYNC(id) BIT(1 + ((id) * 2))<br>
+<br>
+#define DRIVER_NAME "imx8qm-ldb"<br>
+<br>
+struct imx8qm_ldb_channel {<br>
+ struct ldb_channel base;<br>
+ struct phy *phy;<br>
+};<br>
+<br>
+struct imx8qm_ldb {<br>
+ struct ldb base;<br>
+ struct device *dev;<br>
+ struct imx8qm_ldb_channel channel[MAX_LDB_CHAN_NUM];<br>
+ struct clk *clk_pixel;<br>
+ struct clk *clk_bypass;<br>
+ int active_chno;<br>
+};<br>
+<br>
+static inline struct imx8qm_ldb_channel *<br>
+base_to_imx8qm_ldb_channel(struct ldb_channel *base)<br>
+{<br>
+ return container_of(base, struct imx8qm_ldb_channel, base);<br>
+}<br>
+<br>
+static inline struct imx8qm_ldb *base_to_imx8qm_ldb(struct ldb *base)<br>
+{<br>
+ return container_of(base, struct imx8qm_ldb, base);<br>
+}<br>
+<br>
+static void imx8qm_ldb_set_phy_cfg(struct imx8qm_ldb *imx8qm_ldb,<br>
+ unsigned long di_clk,<br>
+ bool is_split, bool is_slave,<br>
+ struct phy_configure_opts_lvds *phy_cfg)<br>
+{<br>
+ phy_cfg->bits_per_lane_and_dclk_cycle = 7;<br>
+ phy_cfg->lanes = 4;<br>
+ phy_cfg->differential_clk_rate = is_split ? di_clk / 2 : di_clk;<br>
+ phy_cfg->is_slave = is_slave;<br>
+}<br>
+<br>
+static int imx8qm_ldb_bridge_atomic_check(struct drm_bridge *bridge,<br>
+ struct drm_bridge_state *bridge_state,<br>
+ struct drm_crtc_state *crtc_state,<br>
+ struct drm_connector_state *conn_state)<br>
+{<br>
+ struct ldb_channel *ldb_ch = bridge->driver_private;<br>
+ struct ldb *ldb = ldb_ch->ldb;<br>
+ struct imx8qm_ldb_channel *imx8qm_ldb_ch =<br>
+ base_to_imx8qm_ldb_channel(ldb_ch);<br>
+ struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb);<br>
+ struct drm_display_mode *adj = &crtc_state->adjusted_mode;<br>
+ unsigned long di_clk = adj->clock * 1000;<br>
+ bool is_split = ldb_channel_is_split_link(ldb_ch);<br>
+ union phy_configure_opts opts = { };<br>
+ struct phy_configure_opts_lvds *phy_cfg = &opts.lvds;<br>
+ int ret;<br>
+<br>
+ ret = ldb_bridge_atomic_check_helper(bridge, bridge_state,<br>
+ crtc_state, conn_state);<br>
+ if (ret)<br>
+ return ret;<br>
+<br>
+ imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, false, phy_cfg);<br>
+ ret = phy_validate(imx8qm_ldb_ch->phy, PHY_MODE_LVDS, 0, &opts);<br>
+ if (ret < 0) {<br>
+ DRM_DEV_DEBUG_DRIVER(imx8qm_ldb->dev,<br>
+ "failed to validate PHY: %d\n", ret);<br>
+ return ret;<br>
+ }<br>
+<br>
+ if (is_split) {<br>
+ imx8qm_ldb_ch =<br>
+ &imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1];<br>
+ imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, true,<br>
+ phy_cfg);<br>
+ ret = phy_validate(imx8qm_ldb_ch->phy, PHY_MODE_LVDS, 0, &opts);<br>
+ if (ret < 0) {<br>
+ DRM_DEV_DEBUG_DRIVER(imx8qm_ldb->dev,<br>
+ "failed to validate slave PHY: %d\n", ret);<br>
+ return ret;<br>
+ }<br>
+ }<br>
+<br>
+ return ret;<br>
+}<br>
+<br>
+static void<br>
+imx8qm_ldb_bridge_mode_set(struct drm_bridge *bridge,<br>
+ const struct drm_display_mode *mode,<br>
+ const struct drm_display_mode *adjusted_mode)<br>
+{<br>
+ struct ldb_channel *ldb_ch = bridge->driver_private;<br>
+ struct ldb *ldb = ldb_ch->ldb;<br>
+ struct imx8qm_ldb_channel *imx8qm_ldb_ch =<br>
+ base_to_imx8qm_ldb_channel(ldb_ch);<br>
+ struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb);<br>
+ struct device *dev = imx8qm_ldb->dev;<br>
+ unsigned long di_clk = adjusted_mode->clock * 1000;<br>
+ bool is_split = ldb_channel_is_split_link(ldb_ch);<br>
+ union phy_configure_opts opts = { };<br>
+ struct phy_configure_opts_lvds *phy_cfg = &opts.lvds;<br>
+ u32 chno = ldb_ch->chno;<br>
+ int ret;<br>
+<br>
+ ret = pm_runtime_get_sync(dev);<br>
+ if (ret < 0)<br>
+ DRM_DEV_ERROR(dev, "failed to get runtime PM sync: %d\n", ret);<br>
+<br>
+ ret = phy_init(imx8qm_ldb_ch->phy);<br>
+ if (ret < 0)<br>
+ DRM_DEV_ERROR(dev, "failed to initialize PHY: %d\n", ret);<br>
+<br>
+ clk_set_rate(imx8qm_ldb->clk_bypass, di_clk);<br>
+ clk_set_rate(imx8qm_ldb->clk_pixel, di_clk);<br>
+<br>
+ imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, false, phy_cfg);<br>
+ ret = phy_configure(imx8qm_ldb_ch->phy, &opts);<br>
+ if (ret < 0)<br>
+ DRM_DEV_ERROR(dev, "failed to configure PHY: %d\n", ret);<br>
+<br>
+ if (is_split) {<br>
+ imx8qm_ldb_ch =<br>
+ &imx8qm_ldb->channel[imx8qm_ldb->active_chno ^ 1];<br>
+ imx8qm_ldb_set_phy_cfg(imx8qm_ldb, di_clk, is_split, true,<br>
+ phy_cfg);<br>
+ ret = phy_configure(imx8qm_ldb_ch->phy, &opts);<br>
+ if (ret < 0)<br>
+ DRM_DEV_ERROR(dev, "failed to configure slave PHY: %d\n",<br>
+ ret);<br>
+ }<br>
+<br>
+ /* input VSYNC signal from pixel link is active low */<br>
+ if (ldb_ch->chno == 0 || is_split)<br>
+ ldb->ldb_ctrl |= LDB_DI0_VS_POL_ACT_LOW;<br>
+ if (ldb_ch->chno == 1 || is_split)<br>
+ ldb->ldb_ctrl |= LDB_DI1_VS_POL_ACT_LOW;<br>
+<br>
+ switch (ldb_ch->out_bus_format) {<br>
+ case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:<br>
+ break;<br>
+ case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:<br>
+ case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:<br>
+ if (ldb_ch->chno == 0 || is_split)<br>
+ ldb->ldb_ctrl |= LDB_CH0_DATA_WIDTH_24BIT;<br>
+ if (ldb_ch->chno == 1 || is_split)<br>
+ ldb->ldb_ctrl |= LDB_CH1_DATA_WIDTH_24BIT;<br>
+ break;<br>
+ }<br>
+<br>
+ ldb_bridge_mode_set_helper(bridge, mode, adjusted_mode);<br>
+<br>
+ if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)<br>
+ regmap_update_bits(ldb->regmap, SS_CTRL, CH_VSYNC_M(chno), 0);<br>
+ else if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)<br>
+ regmap_update_bits(ldb->regmap, SS_CTRL,<br>
+ CH_VSYNC_M(chno), CH_PVSYNC(chno));<br>
+<br>
+ if (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC)<br>
+ regmap_update_bits(ldb->regmap, SS_CTRL, CH_HSYNC_M(chno), 0);<br>
+ else if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)<br>
+ regmap_update_bits(ldb->regmap, SS_CTRL,<br>
+ CH_HSYNC_M(chno), CH_PHSYNC(chno));<br>
+}<br>
+<br>
+static void<br>
+imx8qm_ldb_bridge_atomic_enable(struct drm_bridge *bridge,<br>
+ struct drm_bridge_state *old_bridge_state)<br>
+{<br>
+ struct ldb_channel *ldb_ch = bridge->driver_private;<br>
+ struct ldb *ldb = ldb_ch->ldb;<br>
+ struct imx8qm_ldb_channel *imx8qm_ldb_ch =<br>
+ base_to_imx8qm_ldb_channel(ldb_ch);<br>
+ struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb);<br>
+ struct device *dev = imx8qm_ldb->dev;<br>
+ bool is_split = ldb_channel_is_split_link(ldb_ch);<br>
+ int ret;<br>
+<br>
+ clk_prepare_enable(imx8qm_ldb->clk_pixel);<br>
+ clk_prepare_enable(imx8qm_ldb->clk_bypass);<br>
+<br>
+ /* both DI0 and DI1 connect with pixel link, so ok to use DI0 only */<br>
+ if (ldb_ch->chno == 0 || is_split) {<br>
+ ldb->ldb_ctrl &= ~LDB_CH0_MODE_EN_MASK;<br>
+ ldb->ldb_ctrl |= LDB_CH0_MODE_EN_TO_DI0;<br>
+ }<br>
+ if (ldb_ch->chno == 1 || is_split) {<br>
+ ldb->ldb_ctrl &= ~LDB_CH1_MODE_EN_MASK;<br>
+ ldb->ldb_ctrl |= LDB_CH1_MODE_EN_TO_DI0;<br>
+ }<br>
+<br>
+ if (is_split) {<br>
+ ret = phy_power_on(imx8qm_ldb->channel[0].phy);<br>
+ if (ret)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to power on channel0 PHY: %d\n",<br>
+ ret);<br>
+<br>
+ ret = phy_power_on(imx8qm_ldb->channel[1].phy);<br>
+ if (ret)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to power on channel1 PHY: %d\n",<br>
+ ret);<br>
+ } else {<br>
+ ret = phy_power_on(imx8qm_ldb_ch->phy);<br>
+ if (ret)<br>
+ DRM_DEV_ERROR(dev, "failed to power on PHY: %d\n", ret);<br>
+ }<br>
+<br>
+ ldb_bridge_enable_helper(bridge);<br>
+}<br>
+<br>
+static void<br>
+imx8qm_ldb_bridge_atomic_disable(struct drm_bridge *bridge,<br>
+ struct drm_bridge_state *old_bridge_state)<br>
+{<br>
+ struct ldb_channel *ldb_ch = bridge->driver_private;<br>
+ struct ldb *ldb = ldb_ch->ldb;<br>
+ struct imx8qm_ldb_channel *imx8qm_ldb_ch =<br>
+ base_to_imx8qm_ldb_channel(ldb_ch);<br>
+ struct imx8qm_ldb *imx8qm_ldb = base_to_imx8qm_ldb(ldb);<br>
+ struct device *dev = imx8qm_ldb->dev;<br>
+ bool is_split = ldb_channel_is_split_link(ldb_ch);<br>
+ int ret;<br>
+<br>
+ ldb_bridge_disable_helper(bridge);<br>
+<br>
+ if (is_split) {<br>
+ ret = phy_power_off(imx8qm_ldb->channel[0].phy);<br>
+ if (ret)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to power off channel0 PHY: %d\n",<br>
+ ret);<br>
+ ret = phy_power_off(imx8qm_ldb->channel[1].phy);<br>
+ if (ret)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to power off channel1 PHY: %d\n",<br>
+ ret);<br>
+ } else {<br>
+ ret = phy_power_off(imx8qm_ldb_ch->phy);<br>
+ if (ret)<br>
+ DRM_DEV_ERROR(dev, "failed to power off PHY: %d\n", ret);<br>
+ }<br>
+<br>
+ clk_disable_unprepare(imx8qm_ldb->clk_bypass);<br>
+ clk_disable_unprepare(imx8qm_ldb->clk_pixel);<br>
+<br>
+ ret = pm_runtime_put(dev);<br>
+ if (ret < 0)<br>
+ DRM_DEV_ERROR(dev, "failed to put runtime PM: %d\n", ret);<br>
+}<br>
+<br>
+static const u32 imx8qm_ldb_bus_output_fmts[] = {<br>
+ MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,<br>
+ MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,<br>
+ MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,<br>
+ MEDIA_BUS_FMT_FIXED,<br>
+};<br>
+<br>
+static bool imx8qm_ldb_bus_output_fmt_supported(u32 fmt)<br>
+{<br>
+ int i;<br>
+<br>
+ for (i = 0; i < ARRAY_SIZE(imx8qm_ldb_bus_output_fmts); i++) {<br>
+ if (imx8qm_ldb_bus_output_fmts[i] == fmt)<br>
+ return true;<br>
+ }<br>
+<br>
+ return false;<br>
+}<br>
+<br>
+static u32 *<br>
+imx8qm_ldb_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,<br>
+ struct drm_bridge_state *bridge_state,<br>
+ struct drm_crtc_state *crtc_state,<br>
+ struct drm_connector_state *conn_state,<br>
+ u32 output_fmt,<br>
+ unsigned int *num_input_fmts)<br>
+{<br>
+ struct drm_display_info *di;<br>
+ const struct drm_format_info *finfo;<br>
+ u32 *input_fmts;<br>
+<br>
+ if (!imx8qm_ldb_bus_output_fmt_supported(output_fmt))<br>
+ return NULL;<br>
+<br>
+ *num_input_fmts = 1;<br>
+<br>
+ input_fmts = kmalloc(sizeof(*input_fmts), GFP_KERNEL);<br>
+ if (!input_fmts)<br>
+ return NULL;<br>
+<br>
+ switch (output_fmt) {<br>
+ case MEDIA_BUS_FMT_FIXED:<br>
+ di = &conn_state->connector->display_info;<br>
+<br>
+ /*<br>
+ * Look at the first bus format to determine input format.<br>
+ * Default to MEDIA_BUS_FMT_RGB888_1X36_CPADLO, if no match.<br>
+ */<br>
+ if (di->num_bus_formats) {<br>
+ finfo = drm_format_info(di->bus_formats[0]);<br>
+<br>
+ input_fmts[0] = finfo->depth == 18 ?<br>
+ MEDIA_BUS_FMT_RGB666_1X36_CPADLO :<br>
+ MEDIA_BUS_FMT_RGB888_1X36_CPADLO;<br>
+ } else {<br>
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X36_CPADLO;<br>
+ }<br>
+ break;<br>
+ case MEDIA_BUS_FMT_RGB666_1X7X3_SPWG:<br>
+ input_fmts[0] = MEDIA_BUS_FMT_RGB666_1X36_CPADLO;<br>
+ break;<br>
+ case MEDIA_BUS_FMT_RGB888_1X7X4_SPWG:<br>
+ case MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA:<br>
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X36_CPADLO;<br>
+ break;<br>
+ default:<br>
+ kfree(input_fmts);<br>
+ input_fmts = NULL;<br>
+ break;<br>
+ }<br>
+<br>
+ return input_fmts;<br>
+}<br>
+<br>
+static u32 *<br>
+imx8qm_ldb_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,<br>
+ struct drm_bridge_state *bridge_state,<br>
+ struct drm_crtc_state *crtc_state,<br>
+ struct drm_connector_state *conn_state,<br>
+ unsigned int *num_output_fmts)<br>
+{<br>
+ *num_output_fmts = ARRAY_SIZE(imx8qm_ldb_bus_output_fmts);<br>
+ return kmemdup(imx8qm_ldb_bus_output_fmts,<br>
+ sizeof(imx8qm_ldb_bus_output_fmts), GFP_KERNEL);<br>
+}<br>
+<br>
+static enum drm_mode_status<br>
+imx8qm_ldb_bridge_mode_valid(struct drm_bridge *bridge,<br>
+ const struct drm_display_info *info,<br>
+ const struct drm_display_mode *mode)<br>
+{<br>
+ struct ldb_channel *ldb_ch = bridge->driver_private;<br>
+ bool is_single = ldb_channel_is_single_link(ldb_ch);<br>
+<br>
+ if (mode->clock > 300000)<br>
+ return MODE_CLOCK_HIGH;<br>
+<br>
+ if (mode->clock > 150000 && is_single)<br>
+ return MODE_CLOCK_HIGH;<br>
+<br>
+ return MODE_OK;<br>
+}<br>
+<br>
+static const struct drm_bridge_funcs imx8qm_ldb_bridge_funcs = {<br>
+ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,<br>
+ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,<br>
+ .atomic_reset = drm_atomic_helper_bridge_reset,<br>
+ .mode_valid = imx8qm_ldb_bridge_mode_valid,<br>
+ .attach = ldb_bridge_attach_helper,<br>
+ .atomic_check = imx8qm_ldb_bridge_atomic_check,<br>
+ .mode_set = imx8qm_ldb_bridge_mode_set,<br>
+ .atomic_enable = imx8qm_ldb_bridge_atomic_enable,<br>
+ .atomic_disable = imx8qm_ldb_bridge_atomic_disable,<br>
+ .atomic_get_input_bus_fmts =<br>
+ imx8qm_ldb_bridge_atomic_get_input_bus_fmts,<br>
+ .atomic_get_output_bus_fmts =<br>
+ imx8qm_ldb_bridge_atomic_get_output_bus_fmts,<br>
+};<br>
+<br>
+static int imx8qm_ldb_get_phy(struct imx8qm_ldb *imx8qm_ldb)<br>
+{<br>
+ struct imx8qm_ldb_channel *imx8qm_ldb_ch;<br>
+ struct ldb_channel *ldb_ch;<br>
+ struct device *dev = imx8qm_ldb->dev;<br>
+ int i, ret;<br>
+<br>
+ for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {<br>
+ imx8qm_ldb_ch = &imx8qm_ldb->channel[i];<br>
+ ldb_ch = &imx8qm_ldb_ch->base;<br>
+<br>
+ if (!ldb_ch->is_available)<br>
+ continue;<br>
+<br>
+ imx8qm_ldb_ch->phy = devm_of_phy_get(dev, ldb_ch->np,<br>
+ "lvds_phy");<br>
+ if (IS_ERR(imx8qm_ldb_ch->phy)) {<br>
+ ret = PTR_ERR(imx8qm_ldb_ch->phy);<br>
+ if (ret != -EPROBE_DEFER)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to get channel%d PHY: %d\n",<br>
+ i, ret);<br>
+ return ret;<br>
+ }<br>
+ }<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
+static int imx8qm_ldb_probe(struct platform_device *pdev)<br>
+{<br>
+ struct device *dev = &pdev->dev;<br>
+ struct imx8qm_ldb *imx8qm_ldb;<br>
+ struct imx8qm_ldb_channel *imx8qm_ldb_ch;<br>
+ struct ldb *ldb;<br>
+ struct ldb_channel *ldb_ch;<br>
+ struct device_node *port1, *port2;<br>
+ int pixel_order;<br>
+ int ret, i;<br>
+<br>
+ imx8qm_ldb = devm_kzalloc(dev, sizeof(*imx8qm_ldb), GFP_KERNEL);<br>
+ if (!imx8qm_ldb)<br>
+ return -ENOMEM;<br>
+<br>
+ imx8qm_ldb->clk_pixel = devm_clk_get(dev, "pixel");<br>
+ if (IS_ERR(imx8qm_ldb->clk_pixel)) {<br>
+ ret = PTR_ERR(imx8qm_ldb->clk_pixel);<br>
+ if (ret != -EPROBE_DEFER)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to get pixel clock: %d\n", ret);<br>
+ return ret;<br>
+ }<br>
+<br>
+ imx8qm_ldb->clk_bypass = devm_clk_get(dev, "bypass");<br>
+ if (IS_ERR(imx8qm_ldb->clk_bypass)) {<br>
+ ret = PTR_ERR(imx8qm_ldb->clk_bypass);<br>
+ if (ret != -EPROBE_DEFER)<br>
+ DRM_DEV_ERROR(dev,<br>
+ "failed to get bypass clock: %d\n", ret);<br>
+ return ret;<br>
+ }<br>
+<br>
+ imx8qm_ldb->dev = dev;<br>
+<br>
+ ldb = &imx8qm_ldb->base;<br>
+ ldb->dev = dev;<br>
+ ldb->ctrl_reg = 0xe0;<br>
+<br>
+ for (i = 0; i < MAX_LDB_CHAN_NUM; i++)<br>
+ ldb->channel[i] = &imx8qm_ldb->channel[i].base;<br>
+<br>
+ ret = ldb_init_helper(ldb);<br>
+ if (ret)<br>
+ return ret;<br>
+<br>
+ if (ldb->available_ch_cnt == 0) {<br>
+ DRM_DEV_DEBUG_DRIVER(dev, "no available channel\n");<br>
+ return 0;<br>
+ }<br>
+<br>
+ if (ldb->available_ch_cnt == 2) {<br>
+ port1 = of_graph_get_port_by_id(ldb->channel[0]->np, 1);<br>
+ port2 = of_graph_get_port_by_id(ldb->channel[1]->np, 1);<br>
+ pixel_order =<br>
+ drm_of_lvds_get_dual_link_pixel_order(port1, port2);<br>
+ of_node_put(port1);<br>
+ of_node_put(port2);<br>
+<br>
+ if (pixel_order != DRM_LVDS_DUAL_LINK_ODD_EVEN_PIXELS) {<br>
+ DRM_DEV_ERROR(dev, "invalid dual link pixel order: %d\n",<br>
+ pixel_order);<br>
+ return -EINVAL;<br>
+ }<br>
+<br>
+ imx8qm_ldb->active_chno = 0;<br>
+ imx8qm_ldb_ch = &imx8qm_ldb->channel[0];<br>
+ ldb_ch = &imx8qm_ldb_ch->base;<br>
+ ldb_ch->link_type = pixel_order;<br>
+ } else {<br>
+ for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {<br>
+ imx8qm_ldb_ch = &imx8qm_ldb->channel[i];<br>
+ ldb_ch = &imx8qm_ldb_ch->base;<br>
+<br>
+ if (ldb_ch->is_available) {<br>
+ imx8qm_ldb->active_chno = ldb_ch->chno;<br>
+ break;<br>
+ }<br>
+ }<br>
+ }<br>
+<br>
+ ret = imx8qm_ldb_get_phy(imx8qm_ldb);<br>
+ if (ret)<br>
+ return ret;<br>
+<br>
+ ret = ldb_find_next_bridge_helper(ldb);<br>
+ if (ret)<br>
+ return ret;<br>
+<br>
+ platform_set_drvdata(pdev, imx8qm_ldb);<br>
+ pm_runtime_enable(dev);<br>
+<br>
+ ldb_add_bridge_helper(ldb, &imx8qm_ldb_bridge_funcs);<br>
+<br>
+ return ret;<br>
+}<br>
+<br>
+static int imx8qm_ldb_remove(struct platform_device *pdev)<br>
+{<br>
+ struct imx8qm_ldb *imx8qm_ldb = platform_get_drvdata(pdev);<br>
+ struct ldb *ldb = &imx8qm_ldb->base;<br>
+<br>
+ ldb_remove_bridge_helper(ldb);<br>
+<br>
+ pm_runtime_disable(&pdev->dev);<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
+static int __maybe_unused imx8qm_ldb_runtime_suspend(struct device *dev)<br>
+{<br>
+ return 0;<br>
+}<br>
+<br>
+static int __maybe_unused imx8qm_ldb_runtime_resume(struct device *dev)<br>
+{<br>
+ struct imx8qm_ldb *imx8qm_ldb = dev_get_drvdata(dev);<br>
+ struct ldb *ldb = &imx8qm_ldb->base;<br>
+<br>
+ /* disable LDB by resetting the control register to POR default */<br>
+ regmap_write(ldb->regmap, ldb->ctrl_reg, 0);<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
+static const struct dev_pm_ops imx8qm_ldb_pm_ops = {<br>
+ SET_RUNTIME_PM_OPS(imx8qm_ldb_runtime_suspend,<br>
+ imx8qm_ldb_runtime_resume, NULL)<br>
+};<br>
+<br>
+static const struct of_device_id imx8qm_ldb_dt_ids[] = {<br>
+ { .compatible = "fsl,imx8qm-ldb" },<br>
+ { /* sentinel */ }<br>
+};<br>
+MODULE_DEVICE_TABLE(of, imx8qm_ldb_dt_ids);<br>
+<br>
+static struct platform_driver imx8qm_ldb_driver = {<br>
+ .probe = imx8qm_ldb_probe,<br>
+ .remove = imx8qm_ldb_remove,<br>
+ .driver = {<br>
+ .pm = &imx8qm_ldb_pm_ops,<br>
+ .name = DRIVER_NAME,<br>
+ .of_match_table = imx8qm_ldb_dt_ids,<br>
+ },<br>
+};<br>
+module_platform_driver(imx8qm_ldb_driver);<br>
+<br>
+MODULE_DESCRIPTION("i.MX8QM LVDS Display Bridge(LDB)/Pixel Mapper bridge driver");<br>
+MODULE_AUTHOR("Liu Ying <victor.liu@nxp.com>");<br>
+MODULE_LICENSE("GPL v2");<br>
+MODULE_ALIAS("platform:" DRIVER_NAME);<br>
--<br>
2.7.4<br><br></p>
<p dir="ltr">------------------------------</p>
<p dir="ltr">Message: 2<br>
Date: Wed, 10 Mar 2021 17:55:38 +0800<br>
From: Liu Ying <victor.liu@nxp.com><br>
To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,<br>
linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org,<br>
linux-media@vger.kernel.org<br>
Cc: airlied@linux.ie, daniel@ffwll.ch, robh+dt@kernel.org,<br>
shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de,<br>
festevam@gmail.com, linux-imx@nxp.com, mchehab@kernel.org,<br>
a.hajda@samsung.com, narmstrong@baylibre.com,<br>
Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se,<br>
jernej.skrabec@siol.net, kishon@ti.com, vkoul@kernel.org,<br>
robert.foss@linaro.org, lee.jones@linaro.org<br>
Subject: [PATCH v5 14/14] MAINTAINERS: add maintainer for DRM bridge<br>
drivers for <a href="http://i.MX">i.MX</a> SoCs<br>
Message-ID: <1615370138-5673-15-git-send-email-victor.liu@nxp.com><br>
Content-Type: text/plain</p>
<p dir="ltr">Add myself as the maintainer of DRM bridge drivers for <a href="http://i.MX">i.MX</a> SoCs.</p>
<p dir="ltr">Signed-off-by: Liu Ying <victor.liu@nxp.com><br>
---<br>
v4->v5:<br>
* No change.</p>
<p dir="ltr">v3->v4:<br>
* No change.</p>
<p dir="ltr">v2->v3:<br>
* No change.</p>
<p dir="ltr">v1->v2:<br>
* No change.</p>
<p dir="ltr">MAINTAINERS | 10 ++++++++++<br>
1 file changed, 10 insertions(+)</p>
<p dir="ltr">diff --git a/MAINTAINERS b/MAINTAINERS<br>
index 63bd69c..6e0c019 100644<br>
--- a/MAINTAINERS<br>
+++ b/MAINTAINERS<br>
@@ -5892,6 +5892,16 @@ F: Documentation/devicetree/bindings/display/imx/<br>
F: drivers/gpu/drm/imx/<br>
F: drivers/gpu/ipu-v3/</p>
<p dir="ltr">+DRM DRIVERS FOR FREESCALE IMX BRIDGE<br>
+M: Liu Ying <victor.liu@nxp.com><br>
+L: dri-devel@lists.freedesktop.org<br>
+S: Maintained<br>
+F: Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-ldb.yaml<br>
+F: Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-combiner.yaml<br>
+F: Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pixel-link.yaml<br>
+F: Documentation/devicetree/bindings/display/bridge/fsl,imx8qxp-pxl2dpi.yaml<br>
+F: drivers/gpu/drm/bridge/imx/<br>
+<br>
DRM DRIVERS FOR GMA500 (Poulsbo, Moorestown and derivative chipsets)<br>
M: Patrik Jakobsson <patrik.r.jakobsson@gmail.com><br>
L: dri-devel@lists.freedesktop.org<br>
--<br>
2.7.4<br><br></p>
<p dir="ltr">------------------------------</p>
<p dir="ltr">Subject: Digest Footer</p>
<p dir="ltr">_______________________________________________<br>
dri-devel mailing list<br>
dri-devel@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/dri-devel">https://lists.freedesktop.org/mailman/listinfo/dri-devel</a><br></p>
<p dir="ltr">------------------------------</p>
<p dir="ltr">End of dri-devel Digest, Vol 132, Issue 198<br>
*******************************************<br>
</p>
</div>