* [v2,PATCH 0/3] mt8183 dpi supports dual edge
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen
v2:
modify unused code
v1:
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Rex-BC Chen (3):
drm/mediatek: dpi dual edge sample mode support
drm/mediatek: config mt8183 driver data to support dual edge sample
drm/mediatek: dpi: add bus format negotiation
drivers/gpu/drm/mediatek/mtk_dpi.c | 102 +++++++++++++++++++++++++++--
1 file changed, 97 insertions(+), 5 deletions(-)
--
2.18.0
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v2,PATCH 0/3] mt8183 dpi supports dual edge
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen
v2:
modify unused code
v1:
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Rex-BC Chen (3):
drm/mediatek: dpi dual edge sample mode support
drm/mediatek: config mt8183 driver data to support dual edge sample
drm/mediatek: dpi: add bus format negotiation
drivers/gpu/drm/mediatek/mtk_dpi.c | 102 +++++++++++++++++++++++++++--
1 file changed, 97 insertions(+), 5 deletions(-)
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v2,PATCH 0/3] mt8183 dpi supports dual edge
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen
v2:
modify unused code
v1:
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Rex-BC Chen (3):
drm/mediatek: dpi dual edge sample mode support
drm/mediatek: config mt8183 driver data to support dual edge sample
drm/mediatek: dpi: add bus format negotiation
drivers/gpu/drm/mediatek/mtk_dpi.c | 102 +++++++++++++++++++++++++++--
1 file changed, 97 insertions(+), 5 deletions(-)
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
* [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
2021-04-14 13:35 ` Rex-BC Chen
(?)
@ 2021-04-14 13:35 ` Rex-BC Chen
-1 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index b05f900d9322..21a3a7b78835 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -83,6 +83,7 @@ struct mtk_dpi {
struct pinctrl *pinctrl;
struct pinctrl_state *pins_gpio;
struct pinctrl_state *pins_dpi;
+ bool ddr_edge_sel;
int refcount;
};
@@ -121,6 +122,7 @@ struct mtk_dpi_conf {
unsigned int (*cal_factor)(int clock);
u32 reg_h_fre_con;
bool edge_sel_en;
+ bool dual_edge;
};
static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
@@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
}
}
+static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
+{
+ if (dpi->conf->dual_edge) {
+ mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
+ DDR_EN | DDR_4PHASE);
+ mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL);
+ }
+}
+
static void mtk_dpi_power_off(struct mtk_dpi *dpi)
{
if (WARN_ON(dpi->refcount == 0))
@@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
mtk_dpi_config_yc_map(dpi, dpi->yc_map);
mtk_dpi_config_color_format(dpi, dpi->color_format);
mtk_dpi_config_2n_h_fre(dpi);
+ mtk_dpi_dual_edge(dpi);
mtk_dpi_config_disable_edge(dpi);
mtk_dpi_sw_reset(dpi, false);
--
2.18.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index b05f900d9322..21a3a7b78835 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -83,6 +83,7 @@ struct mtk_dpi {
struct pinctrl *pinctrl;
struct pinctrl_state *pins_gpio;
struct pinctrl_state *pins_dpi;
+ bool ddr_edge_sel;
int refcount;
};
@@ -121,6 +122,7 @@ struct mtk_dpi_conf {
unsigned int (*cal_factor)(int clock);
u32 reg_h_fre_con;
bool edge_sel_en;
+ bool dual_edge;
};
static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
@@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
}
}
+static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
+{
+ if (dpi->conf->dual_edge) {
+ mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
+ DDR_EN | DDR_4PHASE);
+ mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL);
+ }
+}
+
static void mtk_dpi_power_off(struct mtk_dpi *dpi)
{
if (WARN_ON(dpi->refcount == 0))
@@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
mtk_dpi_config_yc_map(dpi, dpi->yc_map);
mtk_dpi_config_color_format(dpi, dpi->color_format);
mtk_dpi_config_2n_h_fre(dpi);
+ mtk_dpi_dual_edge(dpi);
mtk_dpi_config_disable_edge(dpi);
mtk_dpi_sw_reset(dpi, false);
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
DPI can sample on falling, rising or both edge.
When DPI sample the data both rising and falling edge.
It can reduce half data io pins.
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index b05f900d9322..21a3a7b78835 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -83,6 +83,7 @@ struct mtk_dpi {
struct pinctrl *pinctrl;
struct pinctrl_state *pins_gpio;
struct pinctrl_state *pins_dpi;
+ bool ddr_edge_sel;
int refcount;
};
@@ -121,6 +122,7 @@ struct mtk_dpi_conf {
unsigned int (*cal_factor)(int clock);
u32 reg_h_fre_con;
bool edge_sel_en;
+ bool dual_edge;
};
static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
@@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
}
}
+static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
+{
+ if (dpi->conf->dual_edge) {
+ mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
+ DDR_EN | DDR_4PHASE);
+ mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL);
+ }
+}
+
static void mtk_dpi_power_off(struct mtk_dpi *dpi)
{
if (WARN_ON(dpi->refcount == 0))
@@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
mtk_dpi_config_yc_map(dpi, dpi->yc_map);
mtk_dpi_config_color_format(dpi, dpi->color_format);
mtk_dpi_config_2n_h_fre(dpi);
+ mtk_dpi_dual_edge(dpi);
mtk_dpi_config_disable_edge(dpi);
mtk_dpi_sw_reset(dpi, false);
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2,PATCH 2/3] drm/mediatek: config mt8183 driver data to support dual edge sample
2021-04-14 13:35 ` Rex-BC Chen
(?)
@ 2021-04-14 13:35 ` Rex-BC Chen
-1 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
add dual_edge value for mt8183_conf
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 21a3a7b78835..76431fe849b8 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -691,6 +691,7 @@ static const struct mtk_dpi_conf mt2701_conf = {
static const struct mtk_dpi_conf mt8183_conf = {
.cal_factor = mt8183_calculate_factor,
.reg_h_fre_con = 0xe0,
+ .dual_edge = true,
};
static int mtk_dpi_probe(struct platform_device *pdev)
--
2.18.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2, PATCH 2/3] drm/mediatek: config mt8183 driver data to support dual edge sample
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
add dual_edge value for mt8183_conf
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 21a3a7b78835..76431fe849b8 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -691,6 +691,7 @@ static const struct mtk_dpi_conf mt2701_conf = {
static const struct mtk_dpi_conf mt8183_conf = {
.cal_factor = mt8183_calculate_factor,
.reg_h_fre_con = 0xe0,
+ .dual_edge = true,
};
static int mtk_dpi_probe(struct platform_device *pdev)
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2, PATCH 2/3] drm/mediatek: config mt8183 driver data to support dual edge sample
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
add dual_edge value for mt8183_conf
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 21a3a7b78835..76431fe849b8 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -691,6 +691,7 @@ static const struct mtk_dpi_conf mt2701_conf = {
static const struct mtk_dpi_conf mt8183_conf = {
.cal_factor = mt8183_calculate_factor,
.reg_h_fre_con = 0xe0,
+ .dual_edge = true,
};
static int mtk_dpi_probe(struct platform_device *pdev)
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
2021-04-14 13:35 ` Rex-BC Chen
(?)
@ 2021-04-14 13:35 ` Rex-BC Chen
-1 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
the possible output and input formats for the current mode and monitor,
and use the negotiated formats in a basic atomic_check callback.
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
1 file changed, 84 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 76431fe849b8..b4e9c6c8d706 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
return 0;
}
+#define MAX_OUTPUT_SEL_FORMATS 2
+
+static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ unsigned int *num_output_fmts)
+{
+ struct drm_display_mode *mode = &crtc_state->mode;
+ u32 *output_fmts;
+ struct mtk_dpi *dpi = bridge_to_dpi(bridge);
+
+ *num_output_fmts = 0;
+
+ output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
+ GFP_KERNEL);
+ if (!output_fmts)
+ return NULL;
+
+ /* Default 8bit RGB fallback */
+ if (dpi->conf->dual_edge) {
+ output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
+ output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
+ *num_output_fmts = 2;
+ } else {
+ output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+ *num_output_fmts = 1;
+ }
+
+ return output_fmts;
+}
+
+#define MAX_INPUT_SEL_FORMATS 1
+
+static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ u32 output_fmt,
+ unsigned int *num_input_fmts)
+{
+ u32 *input_fmts;
+
+ *num_input_fmts = 0;
+
+ input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
+ GFP_KERNEL);
+ if (!input_fmts)
+ return NULL;
+
+ *num_input_fmts = 1;
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+
+ return input_fmts;
+}
+
+static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct mtk_dpi *dpi = bridge->driver_private;
+ unsigned int out_bus_format;
+
+ out_bus_format = bridge_state->output_bus_cfg.format;
+
+ dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
+ bridge_state->input_bus_cfg.format,
+ bridge_state->output_bus_cfg.format);
+
+ dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
+ true : false;
+
+ dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
+ dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
+ dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
+ dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
+
+ return 0;
+}
+
static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
@@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
.mode_set = mtk_dpi_bridge_mode_set,
.disable = mtk_dpi_bridge_disable,
.enable = mtk_dpi_bridge_enable,
+ .atomic_check = mtk_dpi_bridge_atomic_check,
+ .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
+ .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
};
void mtk_dpi_start(struct device *dev)
@@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
}
drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
- dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
- dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
- dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
- dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
-
return 0;
err_cleanup:
--
2.18.0
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
the possible output and input formats for the current mode and monitor,
and use the negotiated formats in a basic atomic_check callback.
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
1 file changed, 84 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 76431fe849b8..b4e9c6c8d706 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
return 0;
}
+#define MAX_OUTPUT_SEL_FORMATS 2
+
+static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ unsigned int *num_output_fmts)
+{
+ struct drm_display_mode *mode = &crtc_state->mode;
+ u32 *output_fmts;
+ struct mtk_dpi *dpi = bridge_to_dpi(bridge);
+
+ *num_output_fmts = 0;
+
+ output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
+ GFP_KERNEL);
+ if (!output_fmts)
+ return NULL;
+
+ /* Default 8bit RGB fallback */
+ if (dpi->conf->dual_edge) {
+ output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
+ output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
+ *num_output_fmts = 2;
+ } else {
+ output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+ *num_output_fmts = 1;
+ }
+
+ return output_fmts;
+}
+
+#define MAX_INPUT_SEL_FORMATS 1
+
+static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ u32 output_fmt,
+ unsigned int *num_input_fmts)
+{
+ u32 *input_fmts;
+
+ *num_input_fmts = 0;
+
+ input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
+ GFP_KERNEL);
+ if (!input_fmts)
+ return NULL;
+
+ *num_input_fmts = 1;
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+
+ return input_fmts;
+}
+
+static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct mtk_dpi *dpi = bridge->driver_private;
+ unsigned int out_bus_format;
+
+ out_bus_format = bridge_state->output_bus_cfg.format;
+
+ dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
+ bridge_state->input_bus_cfg.format,
+ bridge_state->output_bus_cfg.format);
+
+ dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
+ true : false;
+
+ dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
+ dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
+ dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
+ dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
+
+ return 0;
+}
+
static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
@@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
.mode_set = mtk_dpi_bridge_mode_set,
.disable = mtk_dpi_bridge_disable,
.enable = mtk_dpi_bridge_enable,
+ .atomic_check = mtk_dpi_bridge_atomic_check,
+ .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
+ .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
};
void mtk_dpi_start(struct device *dev)
@@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
}
drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
- dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
- dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
- dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
- dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
-
return 0;
err_cleanup:
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 27+ messages in thread
* [v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
@ 2021-04-14 13:35 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-14 13:35 UTC (permalink / raw)
To: chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Rex-BC Chen, Jitao Shi
Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
the possible output and input formats for the current mode and monitor,
and use the negotiated formats in a basic atomic_check callback.
Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
---
drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
1 file changed, 84 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
index 76431fe849b8..b4e9c6c8d706 100644
--- a/drivers/gpu/drm/mediatek/mtk_dpi.c
+++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
@@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
return 0;
}
+#define MAX_OUTPUT_SEL_FORMATS 2
+
+static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ unsigned int *num_output_fmts)
+{
+ struct drm_display_mode *mode = &crtc_state->mode;
+ u32 *output_fmts;
+ struct mtk_dpi *dpi = bridge_to_dpi(bridge);
+
+ *num_output_fmts = 0;
+
+ output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
+ GFP_KERNEL);
+ if (!output_fmts)
+ return NULL;
+
+ /* Default 8bit RGB fallback */
+ if (dpi->conf->dual_edge) {
+ output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
+ output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
+ *num_output_fmts = 2;
+ } else {
+ output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+ *num_output_fmts = 1;
+ }
+
+ return output_fmts;
+}
+
+#define MAX_INPUT_SEL_FORMATS 1
+
+static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state,
+ u32 output_fmt,
+ unsigned int *num_input_fmts)
+{
+ u32 *input_fmts;
+
+ *num_input_fmts = 0;
+
+ input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
+ GFP_KERNEL);
+ if (!input_fmts)
+ return NULL;
+
+ *num_input_fmts = 1;
+ input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
+
+ return input_fmts;
+}
+
+static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
+ struct drm_bridge_state *bridge_state,
+ struct drm_crtc_state *crtc_state,
+ struct drm_connector_state *conn_state)
+{
+ struct mtk_dpi *dpi = bridge->driver_private;
+ unsigned int out_bus_format;
+
+ out_bus_format = bridge_state->output_bus_cfg.format;
+
+ dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
+ bridge_state->input_bus_cfg.format,
+ bridge_state->output_bus_cfg.format);
+
+ dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
+ true : false;
+
+ dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
+ dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
+ dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
+ dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
+
+ return 0;
+}
+
static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
enum drm_bridge_attach_flags flags)
{
@@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
.mode_set = mtk_dpi_bridge_mode_set,
.disable = mtk_dpi_bridge_disable,
.enable = mtk_dpi_bridge_enable,
+ .atomic_check = mtk_dpi_bridge_atomic_check,
+ .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
+ .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
};
void mtk_dpi_start(struct device *dev)
@@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
}
drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
- dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
- dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
- dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
- dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
-
return 0;
err_cleanup:
--
2.18.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 27+ messages in thread
* Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
2021-04-14 13:35 ` Rex-BC Chen
@ 2021-04-15 1:09 ` CK Hu
-1 siblings, 0 replies; 27+ messages in thread
From: CK Hu @ 2021-04-15 1:09 UTC (permalink / raw)
To: Rex-BC Chen
Cc: chunkuang.hu, matthias.bgg, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi, Rex:
On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> the possible output and input formats for the current mode and monitor,
> and use the negotiated formats in a basic atomic_check callback.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> 1 file changed, 84 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 76431fe849b8..b4e9c6c8d706 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> return 0;
> }
>
> +#define MAX_OUTPUT_SEL_FORMATS 2
> +
> +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state,
> + unsigned int *num_output_fmts)
> +{
> + struct drm_display_mode *mode = &crtc_state->mode;
> + u32 *output_fmts;
> + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> +
> + *num_output_fmts = 0;
> +
> + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> + GFP_KERNEL);
> + if (!output_fmts)
> + return NULL;
> +
> + /* Default 8bit RGB fallback */
> + if (dpi->conf->dual_edge) {
> + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
Regards,
CK
> + *num_output_fmts = 2;
> + } else {
> + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> + *num_output_fmts = 1;
> + }
> +
> + return output_fmts;
> +}
> +
> +#define MAX_INPUT_SEL_FORMATS 1
> +
> +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state,
> + u32 output_fmt,
> + unsigned int *num_input_fmts)
> +{
> + u32 *input_fmts;
> +
> + *num_input_fmts = 0;
> +
> + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> + GFP_KERNEL);
> + if (!input_fmts)
> + return NULL;
> +
> + *num_input_fmts = 1;
> + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> +
> + return input_fmts;
> +}
> +
> +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state)
> +{
> + struct mtk_dpi *dpi = bridge->driver_private;
> + unsigned int out_bus_format;
> +
> + out_bus_format = bridge_state->output_bus_cfg.format;
> +
> + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> + bridge_state->input_bus_cfg.format,
> + bridge_state->output_bus_cfg.format);
> +
> + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> + true : false;
> +
> + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> +
> + return 0;
> +}
> +
> static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> enum drm_bridge_attach_flags flags)
> {
> @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> .mode_set = mtk_dpi_bridge_mode_set,
> .disable = mtk_dpi_bridge_disable,
> .enable = mtk_dpi_bridge_enable,
> + .atomic_check = mtk_dpi_bridge_atomic_check,
> + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
> };
>
> void mtk_dpi_start(struct device *dev)
> @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> }
> drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
>
> - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> -
> return 0;
>
> err_cleanup:
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
@ 2021-04-15 1:09 ` CK Hu
0 siblings, 0 replies; 27+ messages in thread
From: CK Hu @ 2021-04-15 1:09 UTC (permalink / raw)
To: Rex-BC Chen
Cc: chunkuang.hu, matthias.bgg, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi, Rex:
On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> the possible output and input formats for the current mode and monitor,
> and use the negotiated formats in a basic atomic_check callback.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> 1 file changed, 84 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 76431fe849b8..b4e9c6c8d706 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> return 0;
> }
>
> +#define MAX_OUTPUT_SEL_FORMATS 2
> +
> +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state,
> + unsigned int *num_output_fmts)
> +{
> + struct drm_display_mode *mode = &crtc_state->mode;
> + u32 *output_fmts;
> + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> +
> + *num_output_fmts = 0;
> +
> + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> + GFP_KERNEL);
> + if (!output_fmts)
> + return NULL;
> +
> + /* Default 8bit RGB fallback */
> + if (dpi->conf->dual_edge) {
> + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
Regards,
CK
> + *num_output_fmts = 2;
> + } else {
> + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> + *num_output_fmts = 1;
> + }
> +
> + return output_fmts;
> +}
> +
> +#define MAX_INPUT_SEL_FORMATS 1
> +
> +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state,
> + u32 output_fmt,
> + unsigned int *num_input_fmts)
> +{
> + u32 *input_fmts;
> +
> + *num_input_fmts = 0;
> +
> + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> + GFP_KERNEL);
> + if (!input_fmts)
> + return NULL;
> +
> + *num_input_fmts = 1;
> + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> +
> + return input_fmts;
> +}
> +
> +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state)
> +{
> + struct mtk_dpi *dpi = bridge->driver_private;
> + unsigned int out_bus_format;
> +
> + out_bus_format = bridge_state->output_bus_cfg.format;
> +
> + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> + bridge_state->input_bus_cfg.format,
> + bridge_state->output_bus_cfg.format);
> +
> + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> + true : false;
> +
> + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> +
> + return 0;
> +}
> +
> static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> enum drm_bridge_attach_flags flags)
> {
> @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> .mode_set = mtk_dpi_bridge_mode_set,
> .disable = mtk_dpi_bridge_disable,
> .enable = mtk_dpi_bridge_enable,
> + .atomic_check = mtk_dpi_bridge_atomic_check,
> + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
> };
>
> void mtk_dpi_start(struct device *dev)
> @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> }
> drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
>
> - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> -
> return 0;
>
> err_cleanup:
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
2021-04-15 1:09 ` CK Hu
@ 2021-04-15 6:14 ` Rex-BC Chen
-1 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-15 6:14 UTC (permalink / raw)
To: chunkuang.hu
Cc: matthias.bgg, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel, Project_Global_Chrome_Upstream_Group, Jitao Shi
On Thu, 2021-04-15 at 09:09 +0800, CK Hu wrote:
Hello CK,
> Hi, Rex:
>
> On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> > Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> > the possible output and input formats for the current mode and monitor,
> > and use the negotiated formats in a basic atomic_check callback.
> >
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> > 1 file changed, 84 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index 76431fe849b8..b4e9c6c8d706 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> > return 0;
> > }
> >
> > +#define MAX_OUTPUT_SEL_FORMATS 2
> > +
> > +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> > + struct drm_bridge_state *bridge_state,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state,
> > + unsigned int *num_output_fmts)
> > +{
> > + struct drm_display_mode *mode = &crtc_state->mode;
> > + u32 *output_fmts;
> > + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > +
> > + *num_output_fmts = 0;
> > +
> > + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> > + GFP_KERNEL);
> > + if (!output_fmts)
> > + return NULL;
> > +
> > + /* Default 8bit RGB fallback */
> > + if (dpi->conf->dual_edge) {
> > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> > + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
>
> MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
>
> Regards,
> CK
>
Yes, MT8183 only support MEDIA_BUS_FMT_RGB888_1X24
BRs,
Rex-BC
> > + *num_output_fmts = 2;
> > + } else {
> > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > + *num_output_fmts = 1;
> > + }
> > +
> > + return output_fmts;
> > +}
> > +
> > +#define MAX_INPUT_SEL_FORMATS 1
> > +
> > +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> > + struct drm_bridge_state *bridge_state,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state,
> > + u32 output_fmt,
> > + unsigned int *num_input_fmts)
> > +{
> > + u32 *input_fmts;
> > +
> > + *num_input_fmts = 0;
> > +
> > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> > + GFP_KERNEL);
> > + if (!input_fmts)
> > + return NULL;
> > +
> > + *num_input_fmts = 1;
> > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > +
> > + return input_fmts;
> > +}
> > +
> > +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> > + struct drm_bridge_state *bridge_state,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state)
> > +{
> > + struct mtk_dpi *dpi = bridge->driver_private;
> > + unsigned int out_bus_format;
> > +
> > + out_bus_format = bridge_state->output_bus_cfg.format;
> > +
> > + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> > + bridge_state->input_bus_cfg.format,
> > + bridge_state->output_bus_cfg.format);
> > +
> > + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> > + true : false;
> > +
> > + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > +
> > + return 0;
> > +}
> > +
> > static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > enum drm_bridge_attach_flags flags)
> > {
> > @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> > .mode_set = mtk_dpi_bridge_mode_set,
> > .disable = mtk_dpi_bridge_disable,
> > .enable = mtk_dpi_bridge_enable,
> > + .atomic_check = mtk_dpi_bridge_atomic_check,
> > + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> > + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
> > };
> >
> > void mtk_dpi_start(struct device *dev)
> > @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> > }
> > drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
> >
> > - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > -
> > return 0;
> >
> > err_cleanup:
>
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
@ 2021-04-15 6:14 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-15 6:14 UTC (permalink / raw)
To: chunkuang.hu
Cc: matthias.bgg, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel, Project_Global_Chrome_Upstream_Group, Jitao Shi
On Thu, 2021-04-15 at 09:09 +0800, CK Hu wrote:
Hello CK,
> Hi, Rex:
>
> On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> > Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> > the possible output and input formats for the current mode and monitor,
> > and use the negotiated formats in a basic atomic_check callback.
> >
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> > 1 file changed, 84 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index 76431fe849b8..b4e9c6c8d706 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> > return 0;
> > }
> >
> > +#define MAX_OUTPUT_SEL_FORMATS 2
> > +
> > +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> > + struct drm_bridge_state *bridge_state,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state,
> > + unsigned int *num_output_fmts)
> > +{
> > + struct drm_display_mode *mode = &crtc_state->mode;
> > + u32 *output_fmts;
> > + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > +
> > + *num_output_fmts = 0;
> > +
> > + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> > + GFP_KERNEL);
> > + if (!output_fmts)
> > + return NULL;
> > +
> > + /* Default 8bit RGB fallback */
> > + if (dpi->conf->dual_edge) {
> > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> > + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
>
> MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
>
> Regards,
> CK
>
Yes, MT8183 only support MEDIA_BUS_FMT_RGB888_1X24
BRs,
Rex-BC
> > + *num_output_fmts = 2;
> > + } else {
> > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > + *num_output_fmts = 1;
> > + }
> > +
> > + return output_fmts;
> > +}
> > +
> > +#define MAX_INPUT_SEL_FORMATS 1
> > +
> > +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> > + struct drm_bridge_state *bridge_state,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state,
> > + u32 output_fmt,
> > + unsigned int *num_input_fmts)
> > +{
> > + u32 *input_fmts;
> > +
> > + *num_input_fmts = 0;
> > +
> > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> > + GFP_KERNEL);
> > + if (!input_fmts)
> > + return NULL;
> > +
> > + *num_input_fmts = 1;
> > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > +
> > + return input_fmts;
> > +}
> > +
> > +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> > + struct drm_bridge_state *bridge_state,
> > + struct drm_crtc_state *crtc_state,
> > + struct drm_connector_state *conn_state)
> > +{
> > + struct mtk_dpi *dpi = bridge->driver_private;
> > + unsigned int out_bus_format;
> > +
> > + out_bus_format = bridge_state->output_bus_cfg.format;
> > +
> > + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> > + bridge_state->input_bus_cfg.format,
> > + bridge_state->output_bus_cfg.format);
> > +
> > + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> > + true : false;
> > +
> > + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > +
> > + return 0;
> > +}
> > +
> > static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > enum drm_bridge_attach_flags flags)
> > {
> > @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> > .mode_set = mtk_dpi_bridge_mode_set,
> > .disable = mtk_dpi_bridge_disable,
> > .enable = mtk_dpi_bridge_enable,
> > + .atomic_check = mtk_dpi_bridge_atomic_check,
> > + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> > + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
> > };
> >
> > void mtk_dpi_start(struct device *dev)
> > @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> > }
> > drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
> >
> > - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > -
> > return 0;
> >
> > err_cleanup:
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
2021-04-14 13:35 ` Rex-BC Chen
(?)
@ 2021-04-19 7:36 ` Neil Armstrong
-1 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2021-04-19 7:36 UTC (permalink / raw)
To: Rex-BC Chen, chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi,
On 14/04/2021 15:35, Rex-BC Chen wrote:
> DPI can sample on falling, rising or both edge.
> When DPI sample the data both rising and falling edge.
> It can reduce half data io pins.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index b05f900d9322..21a3a7b78835 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -83,6 +83,7 @@ struct mtk_dpi {
> struct pinctrl *pinctrl;
> struct pinctrl_state *pins_gpio;
> struct pinctrl_state *pins_dpi;
> + bool ddr_edge_sel;
> int refcount;
> };
>
> @@ -121,6 +122,7 @@ struct mtk_dpi_conf {
> unsigned int (*cal_factor)(int clock);
> u32 reg_h_fre_con;
> bool edge_sel_en;
> + bool dual_edge;
> };
>
> static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
> @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
> }
> }
>
> +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> +{
> + if (dpi->conf->dual_edge) {
> + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> + DDR_EN | DDR_4PHASE);
> + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL);
> + }
> +}
> +
By using the downstream code as reference:
- clk_set_rate(dpi->pixel_clk, vm.pixelclock);
+ clk_set_rate(dpi->pixel_clk, vm.pixelclock * (dpi->conf->dual_edge ? 2 : 1));
is missing in mtk_dpi_set_display_mode()
> static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> {
> if (WARN_ON(dpi->refcount == 0))
> @@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> mtk_dpi_config_color_format(dpi, dpi->color_format);
> mtk_dpi_config_2n_h_fre(dpi);
> + mtk_dpi_dual_edge(dpi);
> mtk_dpi_config_disable_edge(dpi);
> mtk_dpi_sw_reset(dpi, false);
>
>
Neil
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
@ 2021-04-19 7:36 ` Neil Armstrong
0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2021-04-19 7:36 UTC (permalink / raw)
To: Rex-BC Chen, chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi,
On 14/04/2021 15:35, Rex-BC Chen wrote:
> DPI can sample on falling, rising or both edge.
> When DPI sample the data both rising and falling edge.
> It can reduce half data io pins.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index b05f900d9322..21a3a7b78835 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -83,6 +83,7 @@ struct mtk_dpi {
> struct pinctrl *pinctrl;
> struct pinctrl_state *pins_gpio;
> struct pinctrl_state *pins_dpi;
> + bool ddr_edge_sel;
> int refcount;
> };
>
> @@ -121,6 +122,7 @@ struct mtk_dpi_conf {
> unsigned int (*cal_factor)(int clock);
> u32 reg_h_fre_con;
> bool edge_sel_en;
> + bool dual_edge;
> };
>
> static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
> @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
> }
> }
>
> +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> +{
> + if (dpi->conf->dual_edge) {
> + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> + DDR_EN | DDR_4PHASE);
> + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL);
> + }
> +}
> +
By using the downstream code as reference:
- clk_set_rate(dpi->pixel_clk, vm.pixelclock);
+ clk_set_rate(dpi->pixel_clk, vm.pixelclock * (dpi->conf->dual_edge ? 2 : 1));
is missing in mtk_dpi_set_display_mode()
> static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> {
> if (WARN_ON(dpi->refcount == 0))
> @@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> mtk_dpi_config_color_format(dpi, dpi->color_format);
> mtk_dpi_config_2n_h_fre(dpi);
> + mtk_dpi_dual_edge(dpi);
> mtk_dpi_config_disable_edge(dpi);
> mtk_dpi_sw_reset(dpi, false);
>
>
Neil
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
@ 2021-04-19 7:36 ` Neil Armstrong
0 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2021-04-19 7:36 UTC (permalink / raw)
To: Rex-BC Chen, chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi,
On 14/04/2021 15:35, Rex-BC Chen wrote:
> DPI can sample on falling, rising or both edge.
> When DPI sample the data both rising and falling edge.
> It can reduce half data io pins.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index b05f900d9322..21a3a7b78835 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -83,6 +83,7 @@ struct mtk_dpi {
> struct pinctrl *pinctrl;
> struct pinctrl_state *pins_gpio;
> struct pinctrl_state *pins_dpi;
> + bool ddr_edge_sel;
> int refcount;
> };
>
> @@ -121,6 +122,7 @@ struct mtk_dpi_conf {
> unsigned int (*cal_factor)(int clock);
> u32 reg_h_fre_con;
> bool edge_sel_en;
> + bool dual_edge;
> };
>
> static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask)
> @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi,
> }
> }
>
> +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> +{
> + if (dpi->conf->dual_edge) {
> + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> + DDR_EN | DDR_4PHASE);
> + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL);
> + }
> +}
> +
By using the downstream code as reference:
- clk_set_rate(dpi->pixel_clk, vm.pixelclock);
+ clk_set_rate(dpi->pixel_clk, vm.pixelclock * (dpi->conf->dual_edge ? 2 : 1));
is missing in mtk_dpi_set_display_mode()
> static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> {
> if (WARN_ON(dpi->refcount == 0))
> @@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> mtk_dpi_config_color_format(dpi, dpi->color_format);
> mtk_dpi_config_2n_h_fre(dpi);
> + mtk_dpi_dual_edge(dpi);
> mtk_dpi_config_disable_edge(dpi);
> mtk_dpi_sw_reset(dpi, false);
>
>
Neil
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
2021-04-14 13:35 ` Rex-BC Chen
` (2 preceding siblings ...)
(?)
@ 2021-04-19 7:38 ` Neil Armstrong
-1 siblings, 0 replies; 27+ messages in thread
From: Neil Armstrong @ 2021-04-19 7:38 UTC (permalink / raw)
To: linux-mediatek
Hi,
On 14/04/2021 15:35, Rex-BC Chen wrote:
> Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> the possible output and input formats for the current mode and monitor,
> and use the negotiated formats in a basic atomic_check callback.
>
> Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> ---
> drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> 1 file changed, 84 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> index 76431fe849b8..b4e9c6c8d706 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> return 0;
> }
>
> +#define MAX_OUTPUT_SEL_FORMATS 2
> +
> +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state,
> + unsigned int *num_output_fmts)
> +{
> + struct drm_display_mode *mode = &crtc_state->mode;
> + u32 *output_fmts;
> + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> +
> + *num_output_fmts = 0;
> +
> + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> + GFP_KERNEL);
> + if (!output_fmts)
> + return NULL;
> +
> + /* Default 8bit RGB fallback */
> + if (dpi->conf->dual_edge) {
> + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
> + *num_output_fmts = 2;
> + } else {
> + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> + *num_output_fmts = 1;
> + }
> +
> + return output_fmts;
> +}
> +
> +#define MAX_INPUT_SEL_FORMATS 1
> +
> +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state,
> + u32 output_fmt,
> + unsigned int *num_input_fmts)
> +{
> + u32 *input_fmts;
> +
> + *num_input_fmts = 0;
> +
> + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> + GFP_KERNEL);
> + if (!input_fmts)
> + return NULL;
> +
> + *num_input_fmts = 1;
> + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> +
> + return input_fmts;
> +}
> +
> +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> + struct drm_bridge_state *bridge_state,
> + struct drm_crtc_state *crtc_state,
> + struct drm_connector_state *conn_state)
> +{
> + struct mtk_dpi *dpi = bridge->driver_private;
> + unsigned int out_bus_format;
> +
> + out_bus_format = bridge_state->output_bus_cfg.format;
> +
> + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> + bridge_state->input_bus_cfg.format,
> + bridge_state->output_bus_cfg.format);
> +
> + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> + true : false;
> +
> + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> +
> + return 0;
> +}
> +
> static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> enum drm_bridge_attach_flags flags)
> {
> @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> .mode_set = mtk_dpi_bridge_mode_set,
> .disable = mtk_dpi_bridge_disable,
> .enable = mtk_dpi_bridge_enable,
> + .atomic_check = mtk_dpi_bridge_atomic_check,
> + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
+ .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
+ .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
+ .atomic_reset = drm_atomic_helper_bridge_reset,
Are missing to handle the bridge state, otherwise you will hit a warning in the atomic bridge code.
> };
>
> void mtk_dpi_start(struct device *dev)
> @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> }
> drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
>
> - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> -
> return 0;
>
> err_cleanup:
>
Neil
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM]Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
2021-04-15 6:14 ` Rex-BC Chen
@ 2021-04-20 8:31 ` CK Hu
-1 siblings, 0 replies; 27+ messages in thread
From: CK Hu @ 2021-04-20 8:31 UTC (permalink / raw)
To: Rex-BC Chen
Cc: chunkuang.hu, matthias.bgg, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi, Rex:
On Thu, 2021-04-15 at 14:14 +0800, Rex-BC Chen wrote:
> On Thu, 2021-04-15 at 09:09 +0800, CK Hu wrote:
> Hello CK,
> > Hi, Rex:
> >
> > On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> > > Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> > > the possible output and input formats for the current mode and monitor,
> > > and use the negotiated formats in a basic atomic_check callback.
> > >
> > > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > > ---
> > > drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> > > 1 file changed, 84 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > index 76431fe849b8..b4e9c6c8d706 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> > > return 0;
> > > }
> > >
> > > +#define MAX_OUTPUT_SEL_FORMATS 2
> > > +
> > > +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> > > + struct drm_bridge_state *bridge_state,
> > > + struct drm_crtc_state *crtc_state,
> > > + struct drm_connector_state *conn_state,
> > > + unsigned int *num_output_fmts)
> > > +{
> > > + struct drm_display_mode *mode = &crtc_state->mode;
> > > + u32 *output_fmts;
> > > + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > > +
> > > + *num_output_fmts = 0;
> > > +
> > > + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> > > + GFP_KERNEL);
> > > + if (!output_fmts)
> > > + return NULL;
> > > +
> > > + /* Default 8bit RGB fallback */
> > > + if (dpi->conf->dual_edge) {
> > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> > > + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
> >
> > MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
> >
> > Regards,
> > CK
> >
> Yes, MT8183 only support MEDIA_BUS_FMT_RGB888_1X24
I'm confused with this answer. dpi->conf->dual_edge is true only in
mt8183, but you say 'MT8183 only support MEDIA_BUS_FMT_RGB888_1X24',
your answer looks conflict with these code.
Regards,
CK
>
> BRs,
> Rex-BC
> > > + *num_output_fmts = 2;
> > > + } else {
> > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > + *num_output_fmts = 1;
> > > + }
> > > +
> > > + return output_fmts;
> > > +}
> > > +
> > > +#define MAX_INPUT_SEL_FORMATS 1
> > > +
> > > +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> > > + struct drm_bridge_state *bridge_state,
> > > + struct drm_crtc_state *crtc_state,
> > > + struct drm_connector_state *conn_state,
> > > + u32 output_fmt,
> > > + unsigned int *num_input_fmts)
> > > +{
> > > + u32 *input_fmts;
> > > +
> > > + *num_input_fmts = 0;
> > > +
> > > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> > > + GFP_KERNEL);
> > > + if (!input_fmts)
> > > + return NULL;
> > > +
> > > + *num_input_fmts = 1;
> > > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > +
> > > + return input_fmts;
> > > +}
> > > +
> > > +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> > > + struct drm_bridge_state *bridge_state,
> > > + struct drm_crtc_state *crtc_state,
> > > + struct drm_connector_state *conn_state)
> > > +{
> > > + struct mtk_dpi *dpi = bridge->driver_private;
> > > + unsigned int out_bus_format;
> > > +
> > > + out_bus_format = bridge_state->output_bus_cfg.format;
> > > +
> > > + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> > > + bridge_state->input_bus_cfg.format,
> > > + bridge_state->output_bus_cfg.format);
> > > +
> > > + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> > > + true : false;
> > > +
> > > + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > > enum drm_bridge_attach_flags flags)
> > > {
> > > @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> > > .mode_set = mtk_dpi_bridge_mode_set,
> > > .disable = mtk_dpi_bridge_disable,
> > > .enable = mtk_dpi_bridge_enable,
> > > + .atomic_check = mtk_dpi_bridge_atomic_check,
> > > + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> > > + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
> > > };
> > >
> > > void mtk_dpi_start(struct device *dev)
> > > @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> > > }
> > > drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
> > >
> > > - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > -
> > > return 0;
> > >
> > > err_cleanup:
> >
> >
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!wSbSRrRV87zBpi29W3qMJC0hPE5QwMj2oVUgPcq4538Poo-n0KFyM14woxJZbA$
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM]Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
@ 2021-04-20 8:31 ` CK Hu
0 siblings, 0 replies; 27+ messages in thread
From: CK Hu @ 2021-04-20 8:31 UTC (permalink / raw)
To: Rex-BC Chen
Cc: chunkuang.hu, matthias.bgg, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
Hi, Rex:
On Thu, 2021-04-15 at 14:14 +0800, Rex-BC Chen wrote:
> On Thu, 2021-04-15 at 09:09 +0800, CK Hu wrote:
> Hello CK,
> > Hi, Rex:
> >
> > On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> > > Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts to negotiate
> > > the possible output and input formats for the current mode and monitor,
> > > and use the negotiated formats in a basic atomic_check callback.
> > >
> > > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > > ---
> > > drivers/gpu/drm/mediatek/mtk_dpi.c | 89 ++++++++++++++++++++++++++++--
> > > 1 file changed, 84 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > index 76431fe849b8..b4e9c6c8d706 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi,
> > > return 0;
> > > }
> > >
> > > +#define MAX_OUTPUT_SEL_FORMATS 2
> > > +
> > > +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,
> > > + struct drm_bridge_state *bridge_state,
> > > + struct drm_crtc_state *crtc_state,
> > > + struct drm_connector_state *conn_state,
> > > + unsigned int *num_output_fmts)
> > > +{
> > > + struct drm_display_mode *mode = &crtc_state->mode;
> > > + u32 *output_fmts;
> > > + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > > +
> > > + *num_output_fmts = 0;
> > > +
> > > + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS, sizeof(*output_fmts),
> > > + GFP_KERNEL);
> > > + if (!output_fmts)
> > > + return NULL;
> > > +
> > > + /* Default 8bit RGB fallback */
> > > + if (dpi->conf->dual_edge) {
> > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> > > + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
> >
> > MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
> >
> > Regards,
> > CK
> >
> Yes, MT8183 only support MEDIA_BUS_FMT_RGB888_1X24
I'm confused with this answer. dpi->conf->dual_edge is true only in
mt8183, but you say 'MT8183 only support MEDIA_BUS_FMT_RGB888_1X24',
your answer looks conflict with these code.
Regards,
CK
>
> BRs,
> Rex-BC
> > > + *num_output_fmts = 2;
> > > + } else {
> > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > + *num_output_fmts = 1;
> > > + }
> > > +
> > > + return output_fmts;
> > > +}
> > > +
> > > +#define MAX_INPUT_SEL_FORMATS 1
> > > +
> > > +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
> > > + struct drm_bridge_state *bridge_state,
> > > + struct drm_crtc_state *crtc_state,
> > > + struct drm_connector_state *conn_state,
> > > + u32 output_fmt,
> > > + unsigned int *num_input_fmts)
> > > +{
> > > + u32 *input_fmts;
> > > +
> > > + *num_input_fmts = 0;
> > > +
> > > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts),
> > > + GFP_KERNEL);
> > > + if (!input_fmts)
> > > + return NULL;
> > > +
> > > + *num_input_fmts = 1;
> > > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > +
> > > + return input_fmts;
> > > +}
> > > +
> > > +static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,
> > > + struct drm_bridge_state *bridge_state,
> > > + struct drm_crtc_state *crtc_state,
> > > + struct drm_connector_state *conn_state)
> > > +{
> > > + struct mtk_dpi *dpi = bridge->driver_private;
> > > + unsigned int out_bus_format;
> > > +
> > > + out_bus_format = bridge_state->output_bus_cfg.format;
> > > +
> > > + dev_dbg(dpi->dev, "input format 0x%04x, output format 0x%04x\n",
> > > + bridge_state->input_bus_cfg.format,
> > > + bridge_state->output_bus_cfg.format);
> > > +
> > > + dpi->ddr_edge_sel = (out_bus_format == MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> > > + true : false;
> > > +
> > > + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > +
> > > + return 0;
> > > +}
> > > +
> > > static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > > enum drm_bridge_attach_flags flags)
> > > {
> > > @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs mtk_dpi_bridge_funcs = {
> > > .mode_set = mtk_dpi_bridge_mode_set,
> > > .disable = mtk_dpi_bridge_disable,
> > > .enable = mtk_dpi_bridge_enable,
> > > + .atomic_check = mtk_dpi_bridge_atomic_check,
> > > + .atomic_get_output_bus_fmts = mtk_dpi_bridge_atomic_get_output_bus_fmts,
> > > + .atomic_get_input_bus_fmts = mtk_dpi_bridge_atomic_get_input_bus_fmts,
> > > };
> > >
> > > void mtk_dpi_start(struct device *dev)
> > > @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data)
> > > }
> > > drm_connector_attach_encoder(dpi->connector, &dpi->encoder);
> > >
> > > - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > -
> > > return 0;
> > >
> > > err_cleanup:
> >
> >
>
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@lists.infradead.org
> https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!wSbSRrRV87zBpi29W3qMJC0hPE5QwMj2oVUgPcq4538Poo-n0KFyM14woxJZbA$
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
2021-04-19 7:36 ` Neil Armstrong
(?)
@ 2021-04-29 2:23 ` Rex-BC Chen
-1 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-29 2:23 UTC (permalink / raw)
To: Neil Armstrong, chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
On Mon, 2021-04-19 at 09:36 +0200, Neil Armstrong wrote:
> Hi,
>
> On 14/04/2021 15:35, Rex-BC Chen wrote:
> > DPI can sample on falling, rising or both edge.
> > When DPI sample the data both rising and falling edge.
> > It can reduce half data io pins.
> >
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index b05f900d9322..21a3a7b78835 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -83,6 +83,7 @@ struct mtk_dpi {
> > struct pinctrl *pinctrl;
> > struct pinctrl_state *pins_gpio;
> > struct pinctrl_state *pins_dpi;
> > + bool ddr_edge_sel;
> > int refcount;
> > };
> >
> > @@ -121,6 +122,7 @@ struct mtk_dpi_conf {
> > unsigned int (*cal_factor)(int clock);
> > u32 reg_h_fre_con;
> > bool edge_sel_en;
> > + bool dual_edge;
> > };
> >
> > static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val,
> > u32 mask)
> > @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct
> > mtk_dpi *dpi,
> > }
> > }
> >
> > +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> > +{
> > + if (dpi->conf->dual_edge) {
> > + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> > + DDR_EN | DDR_4PHASE);
> > + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel
> > ? EDGE_SEL : 0, EDGE_SEL);
> > + }
> > +}
> > +
>
> By using the downstream code as reference:
>
> - clk_set_rate(dpi->pixel_clk, vm.pixelclock);
> + clk_set_rate(dpi->pixel_clk, vm.pixelclock * (dpi->conf-
> >dual_edge ? 2 : 1));
>
> is missing in mtk_dpi_set_display_mode()
>
Hello Neil,
Thanks for helping checking this.
I will add this modification for next patch.
BRs,
Rex-BC Chen
> > static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> > {
> > if (WARN_ON(dpi->refcount == 0))
> > @@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct
> > mtk_dpi *dpi,
> > mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> > mtk_dpi_config_color_format(dpi, dpi->color_format);
> > mtk_dpi_config_2n_h_fre(dpi);
> > + mtk_dpi_dual_edge(dpi);
> > mtk_dpi_config_disable_edge(dpi);
> > mtk_dpi_sw_reset(dpi, false);
> >
> >
>
> Neil
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
@ 2021-04-29 2:23 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-29 2:23 UTC (permalink / raw)
To: Neil Armstrong, chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
On Mon, 2021-04-19 at 09:36 +0200, Neil Armstrong wrote:
> Hi,
>
> On 14/04/2021 15:35, Rex-BC Chen wrote:
> > DPI can sample on falling, rising or both edge.
> > When DPI sample the data both rising and falling edge.
> > It can reduce half data io pins.
> >
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index b05f900d9322..21a3a7b78835 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -83,6 +83,7 @@ struct mtk_dpi {
> > struct pinctrl *pinctrl;
> > struct pinctrl_state *pins_gpio;
> > struct pinctrl_state *pins_dpi;
> > + bool ddr_edge_sel;
> > int refcount;
> > };
> >
> > @@ -121,6 +122,7 @@ struct mtk_dpi_conf {
> > unsigned int (*cal_factor)(int clock);
> > u32 reg_h_fre_con;
> > bool edge_sel_en;
> > + bool dual_edge;
> > };
> >
> > static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val,
> > u32 mask)
> > @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct
> > mtk_dpi *dpi,
> > }
> > }
> >
> > +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> > +{
> > + if (dpi->conf->dual_edge) {
> > + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> > + DDR_EN | DDR_4PHASE);
> > + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel
> > ? EDGE_SEL : 0, EDGE_SEL);
> > + }
> > +}
> > +
>
> By using the downstream code as reference:
>
> - clk_set_rate(dpi->pixel_clk, vm.pixelclock);
> + clk_set_rate(dpi->pixel_clk, vm.pixelclock * (dpi->conf-
> >dual_edge ? 2 : 1));
>
> is missing in mtk_dpi_set_display_mode()
>
Hello Neil,
Thanks for helping checking this.
I will add this modification for next patch.
BRs,
Rex-BC Chen
> > static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> > {
> > if (WARN_ON(dpi->refcount == 0))
> > @@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct
> > mtk_dpi *dpi,
> > mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> > mtk_dpi_config_color_format(dpi, dpi->color_format);
> > mtk_dpi_config_2n_h_fre(dpi);
> > + mtk_dpi_dual_edge(dpi);
> > mtk_dpi_config_disable_edge(dpi);
> > mtk_dpi_sw_reset(dpi, false);
> >
> >
>
> Neil
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support
@ 2021-04-29 2:23 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-29 2:23 UTC (permalink / raw)
To: Neil Armstrong, chunkuang.hu, matthias.bgg
Cc: devicetree, linux-arm-kernel, linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
On Mon, 2021-04-19 at 09:36 +0200, Neil Armstrong wrote:
> Hi,
>
> On 14/04/2021 15:35, Rex-BC Chen wrote:
> > DPI can sample on falling, rising or both edge.
> > When DPI sample the data both rising and falling edge.
> > It can reduce half data io pins.
> >
> > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_dpi.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > index b05f900d9322..21a3a7b78835 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > @@ -83,6 +83,7 @@ struct mtk_dpi {
> > struct pinctrl *pinctrl;
> > struct pinctrl_state *pins_gpio;
> > struct pinctrl_state *pins_dpi;
> > + bool ddr_edge_sel;
> > int refcount;
> > };
> >
> > @@ -121,6 +122,7 @@ struct mtk_dpi_conf {
> > unsigned int (*cal_factor)(int clock);
> > u32 reg_h_fre_con;
> > bool edge_sel_en;
> > + bool dual_edge;
> > };
> >
> > static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val,
> > u32 mask)
> > @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct
> > mtk_dpi *dpi,
> > }
> > }
> >
> > +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi)
> > +{
> > + if (dpi->conf->dual_edge) {
> > + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE,
> > + DDR_EN | DDR_4PHASE);
> > + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel
> > ? EDGE_SEL : 0, EDGE_SEL);
> > + }
> > +}
> > +
>
> By using the downstream code as reference:
>
> - clk_set_rate(dpi->pixel_clk, vm.pixelclock);
> + clk_set_rate(dpi->pixel_clk, vm.pixelclock * (dpi->conf-
> >dual_edge ? 2 : 1));
>
> is missing in mtk_dpi_set_display_mode()
>
Hello Neil,
Thanks for helping checking this.
I will add this modification for next patch.
BRs,
Rex-BC Chen
> > static void mtk_dpi_power_off(struct mtk_dpi *dpi)
> > {
> > if (WARN_ON(dpi->refcount == 0))
> > @@ -518,6 +529,7 @@ static int mtk_dpi_set_display_mode(struct
> > mtk_dpi *dpi,
> > mtk_dpi_config_yc_map(dpi, dpi->yc_map);
> > mtk_dpi_config_color_format(dpi, dpi->color_format);
> > mtk_dpi_config_2n_h_fre(dpi);
> > + mtk_dpi_dual_edge(dpi);
> > mtk_dpi_config_disable_edge(dpi);
> > mtk_dpi_sw_reset(dpi, false);
> >
> >
>
> Neil
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM]Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
2021-04-20 8:31 ` CK Hu
@ 2021-04-29 2:27 ` Rex-BC Chen
-1 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-29 2:27 UTC (permalink / raw)
To: CK Hu
Cc: chunkuang.hu, matthias.bgg, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
On Tue, 2021-04-20 at 16:31 +0800, CK Hu wrote:
> Hi, Rex:
>
> On Thu, 2021-04-15 at 14:14 +0800, Rex-BC Chen wrote:
> > On Thu, 2021-04-15 at 09:09 +0800, CK Hu wrote:
> > Hello CK,
> > > Hi, Rex:
> > >
> > > On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> > > > Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts
> > > > to negotiate
> > > > the possible output and input formats for the current mode and
> > > > monitor,
> > > > and use the negotiated formats in a basic atomic_check
> > > > callback.
> > > >
> > > > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > > > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > > > ---
> > > > drivers/gpu/drm/mediatek/mtk_dpi.c | 89
> > > > ++++++++++++++++++++++++++++--
> > > > 1 file changed, 84 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > index 76431fe849b8..b4e9c6c8d706 100644
> > > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct
> > > > mtk_dpi *dpi,
> > > > return 0;
> > > > }
> > > >
> > > > +#define MAX_OUTPUT_SEL_FORMATS 2
> > > > +
> > > > +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct
> > > > drm_bridge *bridge,
> > > > + struct drm_bridge_state
> > > > *bridge_state,
> > > > + struct drm_crtc_state
> > > > *crtc_state,
> > > > + struct
> > > > drm_connector_state *conn_state,
> > > > + unsigned int
> > > > *num_output_fmts)
> > > > +{
> > > > + struct drm_display_mode *mode = &crtc_state->mode;
> > > > + u32 *output_fmts;
> > > > + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > > > +
> > > > + *num_output_fmts = 0;
> > > > +
> > > > + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS,
> > > > sizeof(*output_fmts),
> > > > + GFP_KERNEL);
> > > > + if (!output_fmts)
> > > > + return NULL;
> > > > +
> > > > + /* Default 8bit RGB fallback */
> > > > + if (dpi->conf->dual_edge) {
> > > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> > > > + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
> > >
> > > MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
> > >
> > > Regards,
> > > CK
> > >
> >
> > Yes, MT8183 only support MEDIA_BUS_FMT_RGB888_1X24
>
> I'm confused with this answer. dpi->conf->dual_edge is true only in
> mt8183, but you say 'MT8183 only support MEDIA_BUS_FMT_RGB888_1X24',
> your answer looks conflict with these code.
>
> Regards,
> CK
>
Hello CK,
Sorry for my typo.
Input format for DPI in MT8183 only supports MEDIA_BUS_FMT_RGB888_1X24.
Output format for DPI in MT8183 only supports
MEDIA_BUS_FMT_RGB888_2x12.
dpi->conf->dual_edge means output format.
So MT8183 only support
MEDIA_BUS_FMT_RGB888_2x12.
BRs,
Rex-BC
> >
> > BRs,
> > Rex-BC
> > > > + *num_output_fmts = 2;
> > > > + } else {
> > > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > > + *num_output_fmts = 1;
> > > > + }
> > > > +
> > > > + return output_fmts;
> > > > +}
> > > > +
> > > > +#define MAX_INPUT_SEL_FORMATS 1
> > > > +
> > > > +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct
> > > > drm_bridge *bridge,
> > > > + struct drm_bridge_state
> > > > *bridge_state,
> > > > + struct drm_crtc_state
> > > > *crtc_state,
> > > > + struct
> > > > drm_connector_state *conn_state,
> > > > + u32 output_fmt,
> > > > + unsigned int
> > > > *num_input_fmts)
> > > > +{
> > > > + u32 *input_fmts;
> > > > +
> > > > + *num_input_fmts = 0;
> > > > +
> > > > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS,
> > > > sizeof(*input_fmts),
> > > > + GFP_KERNEL);
> > > > + if (!input_fmts)
> > > > + return NULL;
> > > > +
> > > > + *num_input_fmts = 1;
> > > > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > > +
> > > > + return input_fmts;
> > > > +}
> > > > +
> > > > +static int mtk_dpi_bridge_atomic_check(struct drm_bridge
> > > > *bridge,
> > > > + struct drm_bridge_state
> > > > *bridge_state,
> > > > + struct drm_crtc_state
> > > > *crtc_state,
> > > > + struct
> > > > drm_connector_state *conn_state)
> > > > +{
> > > > + struct mtk_dpi *dpi = bridge->driver_private;
> > > > + unsigned int out_bus_format;
> > > > +
> > > > + out_bus_format = bridge_state->output_bus_cfg.format;
> > > > +
> > > > + dev_dbg(dpi->dev, "input format 0x%04x, output format
> > > > 0x%04x\n",
> > > > + bridge_state->input_bus_cfg.format,
> > > > + bridge_state->output_bus_cfg.format);
> > > > +
> > > > + dpi->ddr_edge_sel = (out_bus_format ==
> > > > MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> > > > + true : false;
> > > > +
> > > > + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > > + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > > + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > > + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > > > enum drm_bridge_attach_flags
> > > > flags)
> > > > {
> > > > @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs
> > > > mtk_dpi_bridge_funcs = {
> > > > .mode_set = mtk_dpi_bridge_mode_set,
> > > > .disable = mtk_dpi_bridge_disable,
> > > > .enable = mtk_dpi_bridge_enable,
> > > > + .atomic_check = mtk_dpi_bridge_atomic_check,
> > > > + .atomic_get_output_bus_fmts =
> > > > mtk_dpi_bridge_atomic_get_output_bus_fmts,
> > > > + .atomic_get_input_bus_fmts =
> > > > mtk_dpi_bridge_atomic_get_input_bus_fmts,
> > > > };
> > > >
> > > > void mtk_dpi_start(struct device *dev)
> > > > @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device
> > > > *dev, struct device *master, void *data)
> > > > }
> > > > drm_connector_attach_encoder(dpi->connector, &dpi-
> > > > >encoder);
> > > >
> > > > - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > > - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > > - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > > - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > > -
> > > > return 0;
> > > >
> > > > err_cleanup:
> > >
> > >
> >
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@lists.infradead.org
> >
https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!wSbSRrRV87zBpi29W3qMJC0hPE5QwMj2oVUgPcq4538Poo-n0KFyM14woxJZbA$
> >
>
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 27+ messages in thread
* Re: [SPAM]Re: [SPAM][v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation
@ 2021-04-29 2:27 ` Rex-BC Chen
0 siblings, 0 replies; 27+ messages in thread
From: Rex-BC Chen @ 2021-04-29 2:27 UTC (permalink / raw)
To: CK Hu
Cc: chunkuang.hu, matthias.bgg, devicetree, linux-arm-kernel,
linux-mediatek, linux-kernel,
Project_Global_Chrome_Upstream_Group, Jitao Shi
On Tue, 2021-04-20 at 16:31 +0800, CK Hu wrote:
> Hi, Rex:
>
> On Thu, 2021-04-15 at 14:14 +0800, Rex-BC Chen wrote:
> > On Thu, 2021-04-15 at 09:09 +0800, CK Hu wrote:
> > Hello CK,
> > > Hi, Rex:
> > >
> > > On Wed, 2021-04-14 at 21:35 +0800, Rex-BC Chen wrote:
> > > > Add the atomic_get_output_bus_fmts, atomic_get_input_bus_fmts
> > > > to negotiate
> > > > the possible output and input formats for the current mode and
> > > > monitor,
> > > > and use the negotiated formats in a basic atomic_check
> > > > callback.
> > > >
> > > > Signed-off-by: Jitao Shi <jitao.shi@mediatek.com>
> > > > Signed-off-by: Rex-BC Chen <rex-bc.chen@mediatek.com>
> > > > ---
> > > > drivers/gpu/drm/mediatek/mtk_dpi.c | 89
> > > > ++++++++++++++++++++++++++++--
> > > > 1 file changed, 84 insertions(+), 5 deletions(-)
> > > >
> > > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > index 76431fe849b8..b4e9c6c8d706 100644
> > > > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c
> > > > @@ -536,6 +536,87 @@ static int mtk_dpi_set_display_mode(struct
> > > > mtk_dpi *dpi,
> > > > return 0;
> > > > }
> > > >
> > > > +#define MAX_OUTPUT_SEL_FORMATS 2
> > > > +
> > > > +static u32 *mtk_dpi_bridge_atomic_get_output_bus_fmts(struct
> > > > drm_bridge *bridge,
> > > > + struct drm_bridge_state
> > > > *bridge_state,
> > > > + struct drm_crtc_state
> > > > *crtc_state,
> > > > + struct
> > > > drm_connector_state *conn_state,
> > > > + unsigned int
> > > > *num_output_fmts)
> > > > +{
> > > > + struct drm_display_mode *mode = &crtc_state->mode;
> > > > + u32 *output_fmts;
> > > > + struct mtk_dpi *dpi = bridge_to_dpi(bridge);
> > > > +
> > > > + *num_output_fmts = 0;
> > > > +
> > > > + output_fmts = kcalloc(MAX_OUTPUT_SEL_FORMATS,
> > > > sizeof(*output_fmts),
> > > > + GFP_KERNEL);
> > > > + if (!output_fmts)
> > > > + return NULL;
> > > > +
> > > > + /* Default 8bit RGB fallback */
> > > > + if (dpi->conf->dual_edge) {
> > > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_2X12_LE;
> > > > + output_fmts[1] = MEDIA_BUS_FMT_RGB888_2X12_BE;
> > >
> > > MT8183 does not support MEDIA_BUS_FMT_RGB888_1X24?
> > >
> > > Regards,
> > > CK
> > >
> >
> > Yes, MT8183 only support MEDIA_BUS_FMT_RGB888_1X24
>
> I'm confused with this answer. dpi->conf->dual_edge is true only in
> mt8183, but you say 'MT8183 only support MEDIA_BUS_FMT_RGB888_1X24',
> your answer looks conflict with these code.
>
> Regards,
> CK
>
Hello CK,
Sorry for my typo.
Input format for DPI in MT8183 only supports MEDIA_BUS_FMT_RGB888_1X24.
Output format for DPI in MT8183 only supports
MEDIA_BUS_FMT_RGB888_2x12.
dpi->conf->dual_edge means output format.
So MT8183 only support
MEDIA_BUS_FMT_RGB888_2x12.
BRs,
Rex-BC
> >
> > BRs,
> > Rex-BC
> > > > + *num_output_fmts = 2;
> > > > + } else {
> > > > + output_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > > + *num_output_fmts = 1;
> > > > + }
> > > > +
> > > > + return output_fmts;
> > > > +}
> > > > +
> > > > +#define MAX_INPUT_SEL_FORMATS 1
> > > > +
> > > > +static u32 *mtk_dpi_bridge_atomic_get_input_bus_fmts(struct
> > > > drm_bridge *bridge,
> > > > + struct drm_bridge_state
> > > > *bridge_state,
> > > > + struct drm_crtc_state
> > > > *crtc_state,
> > > > + struct
> > > > drm_connector_state *conn_state,
> > > > + u32 output_fmt,
> > > > + unsigned int
> > > > *num_input_fmts)
> > > > +{
> > > > + u32 *input_fmts;
> > > > +
> > > > + *num_input_fmts = 0;
> > > > +
> > > > + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS,
> > > > sizeof(*input_fmts),
> > > > + GFP_KERNEL);
> > > > + if (!input_fmts)
> > > > + return NULL;
> > > > +
> > > > + *num_input_fmts = 1;
> > > > + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24;
> > > > +
> > > > + return input_fmts;
> > > > +}
> > > > +
> > > > +static int mtk_dpi_bridge_atomic_check(struct drm_bridge
> > > > *bridge,
> > > > + struct drm_bridge_state
> > > > *bridge_state,
> > > > + struct drm_crtc_state
> > > > *crtc_state,
> > > > + struct
> > > > drm_connector_state *conn_state)
> > > > +{
> > > > + struct mtk_dpi *dpi = bridge->driver_private;
> > > > + unsigned int out_bus_format;
> > > > +
> > > > + out_bus_format = bridge_state->output_bus_cfg.format;
> > > > +
> > > > + dev_dbg(dpi->dev, "input format 0x%04x, output format
> > > > 0x%04x\n",
> > > > + bridge_state->input_bus_cfg.format,
> > > > + bridge_state->output_bus_cfg.format);
> > > > +
> > > > + dpi->ddr_edge_sel = (out_bus_format ==
> > > > MEDIA_BUS_FMT_RGB888_2X12_LE) ?
> > > > + true : false;
> > > > +
> > > > + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > > + dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > > + dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > > + dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > > +
> > > > + return 0;
> > > > +}
> > > > +
> > > > static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,
> > > > enum drm_bridge_attach_flags
> > > > flags)
> > > > {
> > > > @@ -574,6 +655,9 @@ static const struct drm_bridge_funcs
> > > > mtk_dpi_bridge_funcs = {
> > > > .mode_set = mtk_dpi_bridge_mode_set,
> > > > .disable = mtk_dpi_bridge_disable,
> > > > .enable = mtk_dpi_bridge_enable,
> > > > + .atomic_check = mtk_dpi_bridge_atomic_check,
> > > > + .atomic_get_output_bus_fmts =
> > > > mtk_dpi_bridge_atomic_get_output_bus_fmts,
> > > > + .atomic_get_input_bus_fmts =
> > > > mtk_dpi_bridge_atomic_get_input_bus_fmts,
> > > > };
> > > >
> > > > void mtk_dpi_start(struct device *dev)
> > > > @@ -620,11 +704,6 @@ static int mtk_dpi_bind(struct device
> > > > *dev, struct device *master, void *data)
> > > > }
> > > > drm_connector_attach_encoder(dpi->connector, &dpi-
> > > > >encoder);
> > > >
> > > > - dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS;
> > > > - dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB;
> > > > - dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;
> > > > - dpi->color_format = MTK_DPI_COLOR_FORMAT_RGB;
> > > > -
> > > > return 0;
> > > >
> > > > err_cleanup:
> > >
> > >
> >
> > _______________________________________________
> > Linux-mediatek mailing list
> > Linux-mediatek@lists.infradead.org
> >
https://urldefense.com/v3/__http://lists.infradead.org/mailman/listinfo/linux-mediatek__;!!CTRNKA9wMg0ARbw!wSbSRrRV87zBpi29W3qMJC0hPE5QwMj2oVUgPcq4538Poo-n0KFyM14woxJZbA$
> >
>
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 27+ messages in thread
end of thread, other threads:[~2021-04-29 2:32 UTC | newest]
Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-14 13:35 [v2,PATCH 0/3] mt8183 dpi supports dual edge Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-14 13:35 ` [v2,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-19 7:36 ` Neil Armstrong
2021-04-19 7:36 ` Neil Armstrong
2021-04-19 7:36 ` Neil Armstrong
2021-04-29 2:23 ` Rex-BC Chen
2021-04-29 2:23 ` Rex-BC Chen
2021-04-29 2:23 ` Rex-BC Chen
2021-04-14 13:35 ` [v2,PATCH 2/3] drm/mediatek: config mt8183 driver data to support dual edge sample Rex-BC Chen
2021-04-14 13:35 ` [v2, PATCH " Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-14 13:35 ` [v2,PATCH 3/3] drm/mediatek: dpi: add bus format negotiation Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-14 13:35 ` Rex-BC Chen
2021-04-15 1:09 ` [SPAM][v2,PATCH " CK Hu
2021-04-15 1:09 ` CK Hu
2021-04-15 6:14 ` Rex-BC Chen
2021-04-15 6:14 ` Rex-BC Chen
2021-04-20 8:31 ` [SPAM]Re: " CK Hu
2021-04-20 8:31 ` CK Hu
2021-04-29 2:27 ` Rex-BC Chen
2021-04-29 2:27 ` Rex-BC Chen
2021-04-19 7:38 ` [v2,PATCH " Neil Armstrong
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.