Commit ebb7619d authored by Fabio Estevam's avatar Fabio Estevam Committed by Marek Vasut

drm/bridge: fsl-ldb: Add i.MX6SX support

i.MX6SX has a single LVDS port and share a similar LDB_CTRL register layout
with i.MX8MP and i.MX93.

There is no LVDS CTRL register on the i.MX6SX, so only write to
this register on the appropriate SoCs.

Add support for the i.MX6SX LDB.

Tested on a imx6sx-sdb board with a Hannstar HSD100PXN1 LVDS panel
and also on a custom i.MX6SX-based board.
Signed-off-by: default avatarFabio Estevam <festevam@denx.de>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20230404020129.509356-2-festevam@gmail.com
parent f85f2ce5
...@@ -56,6 +56,7 @@ ...@@ -56,6 +56,7 @@
#define LVDS_CTRL_VBG_ADJ_MASK GENMASK(19, 17) #define LVDS_CTRL_VBG_ADJ_MASK GENMASK(19, 17)
enum fsl_ldb_devtype { enum fsl_ldb_devtype {
IMX6SX_LDB,
IMX8MP_LDB, IMX8MP_LDB,
IMX93_LDB, IMX93_LDB,
}; };
...@@ -64,9 +65,14 @@ struct fsl_ldb_devdata { ...@@ -64,9 +65,14 @@ struct fsl_ldb_devdata {
u32 ldb_ctrl; u32 ldb_ctrl;
u32 lvds_ctrl; u32 lvds_ctrl;
bool lvds_en_bit; bool lvds_en_bit;
bool single_ctrl_reg;
}; };
static const struct fsl_ldb_devdata fsl_ldb_devdata[] = { static const struct fsl_ldb_devdata fsl_ldb_devdata[] = {
[IMX6SX_LDB] = {
.ldb_ctrl = 0x18,
.single_ctrl_reg = true,
},
[IMX8MP_LDB] = { [IMX8MP_LDB] = {
.ldb_ctrl = 0x5c, .ldb_ctrl = 0x5c,
.lvds_ctrl = 0x128, .lvds_ctrl = 0x128,
...@@ -201,6 +207,9 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge, ...@@ -201,6 +207,9 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge,
regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->ldb_ctrl, reg); regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->ldb_ctrl, reg);
if (fsl_ldb->devdata->single_ctrl_reg)
return;
/* Program LVDS_CTRL */ /* Program LVDS_CTRL */
reg = LVDS_CTRL_CC_ADJ(2) | LVDS_CTRL_PRE_EMPH_EN | reg = LVDS_CTRL_CC_ADJ(2) | LVDS_CTRL_PRE_EMPH_EN |
LVDS_CTRL_PRE_EMPH_ADJ(3) | LVDS_CTRL_VBG_EN; LVDS_CTRL_PRE_EMPH_ADJ(3) | LVDS_CTRL_VBG_EN;
...@@ -226,6 +235,7 @@ static void fsl_ldb_atomic_disable(struct drm_bridge *bridge, ...@@ -226,6 +235,7 @@ static void fsl_ldb_atomic_disable(struct drm_bridge *bridge,
regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl,
LVDS_CTRL_LVDS_EN); LVDS_CTRL_LVDS_EN);
else else
if (!fsl_ldb->devdata->single_ctrl_reg)
regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, 0); regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, 0);
regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->ldb_ctrl, 0); regmap_write(fsl_ldb->regmap, fsl_ldb->devdata->ldb_ctrl, 0);
...@@ -372,6 +382,8 @@ static void fsl_ldb_remove(struct platform_device *pdev) ...@@ -372,6 +382,8 @@ static void fsl_ldb_remove(struct platform_device *pdev)
} }
static const struct of_device_id fsl_ldb_match[] = { static const struct of_device_id fsl_ldb_match[] = {
{ .compatible = "fsl,imx6sx-ldb",
.data = &fsl_ldb_devdata[IMX6SX_LDB], },
{ .compatible = "fsl,imx8mp-ldb", { .compatible = "fsl,imx8mp-ldb",
.data = &fsl_ldb_devdata[IMX8MP_LDB], }, .data = &fsl_ldb_devdata[IMX8MP_LDB], },
{ .compatible = "fsl,imx93-ldb", { .compatible = "fsl,imx93-ldb",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment