[PATCH 1/6] drm: bridge: samsung-dsim: Support multi-lane calculations
If there is more than one lane, the HFP, HBP, and HSA is calculated in bytes/pixel, then they are divided amongst the different lanes with some additional overhead. This is necessary to achieve higher resolutions while keeping the pixel clocks lower as the number of lanes increase. Signed-off-by: Adam Ford --- drivers/gpu/drm/bridge/samsung-dsim.c | 40 +++ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index e0a402a85787..1ccbad4ea577 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -215,6 +215,7 @@ #define DSI_RX_FIFO_SIZE 256 #define DSI_XFER_TIMEOUT_MS100 #define DSI_RX_FIFO_EMPTY 0x3082 +#define DSI_HSYNC_PKT_OVERHEAD 6 #define OLD_SCLK_MIPI_CLK_NAME "pll_clk" @@ -879,13 +880,40 @@ static void samsung_dsim_set_display_mode(struct samsung_dsim *dsi) | DSIM_MAIN_VBP(m->vtotal - m->vsync_end); samsung_dsim_write(dsi, DSIM_MVPORCH_REG, reg); - reg = DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) - | DSIM_MAIN_HBP(m->htotal - m->hsync_end); - samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); + /* +* If there is more than one lane, the HFP, HBP, and HSA +* is calculated in bytes/pixel, then they are divided +* amongst the different lanes with some additional +* overhead correction +*/ + if (dsi->lanes > 1) { + u32 hfp, hbp, hsa; + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format) / 8; + + hfp = ((m->hsync_start - m->hdisplay) * bpp) / dsi->lanes; + hfp -= (hfp > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSYNC_PKT_OVERHEAD : 0; + + hbp = ((m->htotal - m->hsync_end) * bpp) / dsi->lanes; + hbp -= (hbp > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSYNC_PKT_OVERHEAD : 0; - reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) - | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); - samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); + hsa = ((m->hsync_end - m->hsync_start) * bpp) / dsi->lanes; + hsa -= (hsa > DSI_HSYNC_PKT_OVERHEAD) ? DSI_HSYNC_PKT_OVERHEAD : 0; + + reg = DSIM_MAIN_HFP(hfp) | DSIM_MAIN_HBP(hbp); + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); + + reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) + | DSIM_MAIN_HSA(hsa); + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); + } else { + reg = DSIM_MAIN_HFP(m->hsync_start - m->hdisplay) + | DSIM_MAIN_HBP(m->htotal - m->hsync_end); + samsung_dsim_write(dsi, DSIM_MHPORCH_REG, reg); + + reg = DSIM_MAIN_VSA(m->vsync_end - m->vsync_start) + | DSIM_MAIN_HSA(m->hsync_end - m->hsync_start); + samsung_dsim_write(dsi, DSIM_MSYNC_REG, reg); + } } reg = DSIM_MAIN_HRESOL(m->hdisplay, num_bits_resol) | DSIM_MAIN_VRESOL(m->vdisplay, num_bits_resol); -- 2.39.2
[PATCH 2/6] drm: bridge: samsung-dsim: Fix PMS Calculator on imx8m[mnp]
According to Table 13-45 of the i.MX8M Mini Reference Manual, the min and max values for M and the frequency range for the VCO_out calculator were incorrect. This also appears to be the case for the imx8mn and imx8mp. To fix this, make new variables to hold the min and max values of m and the minimum value of VCO_out, and update the PMS calculator to use these new variables instead of using hard-coded values to keep the backwards compatibility with other parts using this driver. Fixes: 4d562c70c4dc ("drm: bridge: samsung-dsim: Add i.MX8M Mini/Nano support") Signed-off-by: Adam Ford --- drivers/gpu/drm/bridge/samsung-dsim.c | 22 -- include/drm/bridge/samsung-dsim.h | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 1ccbad4ea577..9fec32b44e05 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -406,6 +406,9 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .num_bits_resol = 11, .pll_p_offset = 13, .reg_values = reg_values, + .m_min = 41, + .m_max = 125, + .vco_min = 500, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -419,6 +422,9 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .num_bits_resol = 11, .pll_p_offset = 13, .reg_values = reg_values, + .m_min = 41, + .m_max = 125, + .vco_min = 500, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -430,6 +436,9 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .num_bits_resol = 11, .pll_p_offset = 13, .reg_values = reg_values, + .m_min = 41, + .m_max = 125, + .vco_min = 500, }; static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { @@ -442,6 +451,9 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .num_bits_resol = 12, .pll_p_offset = 13, .reg_values = exynos5433_reg_values, + .m_min = 41, + .m_max = 125, + .vco_min = 500, }; static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { @@ -454,6 +466,9 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .num_bits_resol = 12, .pll_p_offset = 13, .reg_values = exynos5422_reg_values, + .m_min = 41, + .m_max = 125, + .vco_min = 500, }; static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { @@ -470,6 +485,9 @@ static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { */ .pll_p_offset = 14, .reg_values = imx8mm_dsim_reg_values, + .m_min = 64, + .m_max = 1023, + .vco_min = 1050, }; static const struct samsung_dsim_driver_data * @@ -548,12 +566,12 @@ static unsigned long samsung_dsim_pll_find_pms(struct samsung_dsim *dsi, tmp = (u64)fout * (_p << _s); do_div(tmp, fin); _m = tmp; - if (_m < 41 || _m > 125) + if (_m < driver_data->m_min || _m > driver_data->m_max) continue; tmp = (u64)_m * fin; do_div(tmp, _p); - if (tmp < 500 * MHZ || + if (tmp < driver_data->vco_min * MHZ || tmp > driver_data->max_freq * MHZ) continue; diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index ba5484de2b30..a088d84579bc 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -59,6 +59,9 @@ struct samsung_dsim_driver_data { unsigned int num_bits_resol; unsigned int pll_p_offset; const unsigned int *reg_values; + u16 m_min; + u16 m_max; + u64 vco_min; }; struct samsung_dsim_host_ops { -- 2.39.2
[PATCH 4/6] drm: bridge: samsung-dsim: Dynamically configure DPHY timing
NXP uses a lookup table to determine the various values for the PHY Timing based on the clock rate in their downstream kernel. Since the input clock can be variable, the phy settings need to be variable too. Add an additional variable to the driver data to enable this feature to prevent breaking boards that don't support it. Signed-off-by: Adam Ford --- drivers/gpu/drm/bridge/samsung-dsim.c | 85 +++-- drivers/gpu/drm/bridge/samsung-dsim.h | 254 ++ include/drm/bridge/samsung-dsim.h | 1 + 3 files changed, 326 insertions(+), 14 deletions(-) create mode 100644 drivers/gpu/drm/bridge/samsung-dsim.h diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 73f0c3fbbdf5..c48db27adafe 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -18,13 +18,14 @@ #include #include #include - +#include #include - #include #include #include +#include "samsung-dsim.h" + /* returns true iff both arguments logically differs */ #define NEQV(a, b) (!(a) ^ !(b)) @@ -488,6 +489,7 @@ static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { .m_min = 64, .m_max = 1023, .vco_min = 1050, + .dynamic_dphy = 1, }; static const struct samsung_dsim_driver_data * @@ -694,18 +696,52 @@ static int samsung_dsim_enable_clock(struct samsung_dsim *dsi) return 0; } +static inline int dphy_timing_default_cmp(const void *key, const void *elt) +{ + const struct sec_mipi_dsim_dphy_timing *_key = key; + const struct sec_mipi_dsim_dphy_timing *_elt = elt; + + /* +* find an element whose 'bit_clk' is equal to +* the key's 'bit_clk' value or, the difference +* between them is less than 5. +*/ + + if (abs((int)(_elt->bit_clk - _key->bit_clk)) <= 5) + return 0; + + if (_key->bit_clk < _elt->bit_clk) + /* search bottom half */ + return 1; + else + /* search top half */ + return -1; +} + static void samsung_dsim_set_phy_ctrl(struct samsung_dsim *dsi) { const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; const unsigned int *reg_values = driver_data->reg_values; - u32 reg; - - if (driver_data->has_freqband) - return; + u32 reg = 0; + struct drm_display_mode *m = &dsi->mode; + struct sec_mipi_dsim_dphy_timing key = { 0 }; + const struct sec_mipi_dsim_dphy_timing *match = NULL; + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); + + /* Only dynamic dphy uses the lookup table to determine rates based on clock */ + if (driver_data->dynamic_dphy) { + key.bit_clk = DIV_ROUND_UP(m->clock * bpp, dsi->lanes * 1000); + + match = bsearch(&key, dphy_timing_ln14lpp_v1p2, + ARRAY_SIZE(dphy_timing_ln14lpp_v1p2), + sizeof(struct sec_mipi_dsim_dphy_timing), + dphy_timing_default_cmp); + } /* B D-PHY: D-PHY Master & Slave Analog Block control */ reg = reg_values[PHYCTRL_ULPS_EXIT] | reg_values[PHYCTRL_VREG_LP] | reg_values[PHYCTRL_SLEW_UP]; + samsung_dsim_write(dsi, DSIM_PHYCTRL_REG, reg); /* @@ -713,7 +749,11 @@ static void samsung_dsim_set_phy_ctrl(struct samsung_dsim *dsi) * T HS-EXIT: Time that the transmitter drives LP-11 following a HS * burst */ - reg = reg_values[PHYTIMING_LPX] | reg_values[PHYTIMING_HS_EXIT]; + if (driver_data->dynamic_dphy) + reg = DSIM_PHYTIMING_LPX(match->lpx) | DSIM_PHYTIMING_HS_EXIT(match->hs_exit); + else + reg = reg_values[PHYTIMING_LPX] | reg_values[PHYTIMING_HS_EXIT]; + samsung_dsim_write(dsi, DSIM_PHYTIMING_REG, reg); /* @@ -729,10 +769,17 @@ static void samsung_dsim_set_phy_ctrl(struct samsung_dsim *dsi) * T CLK-TRAIL: Time that the transmitter drives the HS-0 state after * the last payload clock bit of a HS transmission burst */ - reg = reg_values[PHYTIMING_CLK_PREPARE] | - reg_values[PHYTIMING_CLK_ZERO] | - reg_values[PHYTIMING_CLK_POST] | - reg_values[PHYTIMING_CLK_TRAIL]; + if (driver_data->dynamic_dphy) { + reg = DSIM_PHYTIMING1_CLK_PREPARE(match->clk_prepare) | + DSIM_PHYTIMING1_CLK_ZERO(match->clk_zero) | + DSIM_PHYTIMING1_CLK_POST(match->clk_post) | + DSIM_PHYTIMING1_CLK_TRAIL(match->clk_trail); + } else { + reg = reg_values[PHYTIMING_CLK_PREPARE] | + reg_values[PHYTIMING_CLK_ZERO] | + reg_values[PHYTIMING_CLK_POST] | + reg_values[PHYTIMING_CLK_TRAIL]; + } samsun
[PATCH 6/6] arm64: dts: imx8mn: Fix video clock parents
There are a few clocks whose parents are set in mipi_dsi and mxsfb nodes, but these clocks are used by the disp_blk_ctrl power domain which may cause an issue when re-parenting, resuling in a disp_pixel clock having the wrong parent and wrong rate. Fix this by moving the assigned-clock-parents as associate clock assignments to the power-domain node to setup these clocks before they are enabled. Fixes: d825fb6455d5 ("arm64: dts: imx8mn: Add display pipeline components") Signed-off-by: Adam Ford --- arch/arm64/boot/dts/freescale/imx8mn.dtsi | 28 --- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mn.dtsi b/arch/arm64/boot/dts/freescale/imx8mn.dtsi index bd84db550053..8be8f090e8b8 100644 --- a/arch/arm64/boot/dts/freescale/imx8mn.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mn.dtsi @@ -1069,13 +1069,6 @@ lcdif: lcdif@32e0 { <&clk IMX8MN_CLK_DISP_APB_ROOT>, <&clk IMX8MN_CLK_DISP_AXI_ROOT>; clock-names = "pix", "axi", "disp_axi"; - assigned-clocks = <&clk IMX8MN_CLK_DISP_PIXEL_ROOT>, - <&clk IMX8MN_CLK_DISP_AXI>, - <&clk IMX8MN_CLK_DISP_APB>; - assigned-clock-parents = <&clk IMX8MN_CLK_DISP_PIXEL>, -<&clk IMX8MN_SYS_PLL2_1000M>, -<&clk IMX8MN_SYS_PLL1_800M>; - assigned-clock-rates = <59400>, <5>, <2>; interrupts = ; power-domains = <&disp_blk_ctrl IMX8MN_DISPBLK_PD_LCDIF>; status = "disabled"; @@ -1093,12 +1086,6 @@ mipi_dsi: dsi@32e1 { clocks = <&clk IMX8MN_CLK_DSI_CORE>, <&clk IMX8MN_CLK_DSI_PHY_REF>; clock-names = "bus_clk", "sclk_mipi"; - assigned-clocks = <&clk IMX8MN_CLK_DSI_CORE>, - <&clk IMX8MN_CLK_DSI_PHY_REF>; - assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_266M>, -<&clk IMX8MN_CLK_24M>; - assigned-clock-rates = <26600>, <2400>; - samsung,pll-clock-frequency = <2400>; interrupts = ; power-domains = <&disp_blk_ctrl IMX8MN_DISPBLK_PD_MIPI_DSI>; status = "disabled"; @@ -1142,6 +1129,21 @@ disp_blk_ctrl: blk-ctrl@32e28000 { "lcdif-axi", "lcdif-apb", "lcdif-pix", "dsi-pclk", "dsi-ref", "csi-aclk", "csi-pclk"; + assigned-clocks = <&clk IMX8MN_CLK_DSI_CORE>, + <&clk IMX8MN_CLK_DSI_PHY_REF>, + <&clk IMX8MN_CLK_DISP_PIXEL>, + <&clk IMX8MN_CLK_DISP_AXI>, + <&clk IMX8MN_CLK_DISP_APB>; + assigned-clock-parents = <&clk IMX8MN_SYS_PLL1_266M>, +<&clk IMX8MN_CLK_24M>, +<&clk IMX8MN_VIDEO_PLL1_OUT>, +<&clk IMX8MN_SYS_PLL2_1000M>, +<&clk IMX8MN_SYS_PLL1_800M>; + assigned-clock-rates = <26600>, + <2400>, + <59400>, + <5>, + <2>; #power-domain-cells = <1>; }; -- 2.39.2
[PATCH 3/6] drm: bridge: samsung-dsim: Fetch pll-clock-frequency automatically
Fetch the clock rate of "sclk_mipi" (or "pll_clk") instead of having an entry in the device tree for samsung,pll-clock-frequency. Signed-off-by: Adam Ford --- drivers/gpu/drm/bridge/samsung-dsim.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 9fec32b44e05..73f0c3fbbdf5 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1744,11 +1744,6 @@ static int samsung_dsim_parse_dt(struct samsung_dsim *dsi) struct device_node *node = dev->of_node; int ret; - ret = samsung_dsim_of_read_u32(node, "samsung,pll-clock-frequency", - &dsi->pll_clk_rate); - if (ret < 0) - return ret; - ret = samsung_dsim_of_read_u32(node, "samsung,burst-clock-frequency", &dsi->burst_clk_rate); if (ret < 0) @@ -1823,13 +1818,18 @@ int samsung_dsim_probe(struct platform_device *pdev) if (IS_ERR(dsi->clks[i])) { if (strcmp(clk_names[i], "sclk_mipi") == 0) { dsi->clks[i] = devm_clk_get(dev, OLD_SCLK_MIPI_CLK_NAME); - if (!IS_ERR(dsi->clks[i])) + if (!IS_ERR(dsi->clks[i])) { + dsi->pll_clk_rate = clk_get_rate(dsi->clks[i]); continue; + } } dev_info(dev, "failed to get the clock: %s\n", clk_names[i]); return PTR_ERR(dsi->clks[i]); } + + if (strcmp(clk_names[i], "sclk_mipi") == 0) + dsi->pll_clk_rate = clk_get_rate(dsi->clks[i]); } dsi->reg_base = devm_platform_ioremap_resource(pdev, 0); -- 2.39.2
[PATCH 5/6] drm: bridge: samsung-dsim: Support non-burst mode
The high-speed clock is hard-coded to the burst-clock frequency specified in the device tree. However, when using devices like certain bridge chips without burst mode and varying resolutions and refresh rates, it may be necessary to set the high-speed clock dynamically based on the desired pixel clock for the connected device. Signed-off-by: Adam Ford --- drivers/gpu/drm/bridge/samsung-dsim.c | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index c48db27adafe..5aa3a44f15ec 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -659,11 +659,21 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi, static int samsung_dsim_enable_clock(struct samsung_dsim *dsi) { - unsigned long hs_clk, byte_clk, esc_clk; + unsigned long hs_clk, byte_clk, esc_clk, pix_clk; unsigned long esc_div; u32 reg; + struct drm_display_mode *m = &dsi->mode; + int bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); + + /* m->clock is in KHz */ + pix_clk = m->clock * 1000; + + /* Use burst_clk_rate for burst mode, otherwise use the pix_clk */ + if ((dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) && dsi->burst_clk_rate) + hs_clk = samsung_dsim_set_pll(dsi, dsi->burst_clk_rate); + else + hs_clk = samsung_dsim_set_pll(dsi, DIV_ROUND_UP(pix_clk * bpp, dsi->lanes)); - hs_clk = samsung_dsim_set_pll(dsi, dsi->burst_clk_rate); if (!hs_clk) { dev_err(dsi->dev, "failed to configure DSI PLL\n"); return -EFAULT; -- 2.39.2
[PATCH 0/3] drm/bridge: dw_hdmi: allow to disable CEC from DT
Boards can have perfectly working DW HDMI CEC implementation but they may prefer to use bit banged implementation instead. This is the situation on Beelink X2. Add DW HDMI DT property for disabling CEC. This prevents confusion on userspace side by not exposing unused CEC interface. Best regards, Jernej Jernej Skrabec (3): dt-bindings: display: synopsys,dw-hdmi: Add property for disabling CEC drm/bridge: dw_hdmi: Handle snps,disable-cec property ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 + arch/arm/boot/dts/sun8i-h3-beelink-x2.dts| 1 + drivers/gpu/drm/bridge/synopsys/dw-hdmi.c| 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) -- 2.40.0
[PATCH 2/3] drm/bridge: dw_hdmi: Handle snps,disable-cec property
New DT property allows to skip CEC initialization. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c index 603bb3c51027..e7e8199d2fb1 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c @@ -3615,7 +3615,9 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, hdmi->audio = platform_device_register_full(&pdevinfo); } - if (!plat_data->disable_cec && (config0 & HDMI_CONFIG0_CEC)) { + if (!plat_data->disable_cec && + !of_property_read_bool(np, "snps,disable-cec") && + (config0 & HDMI_CONFIG0_CEC)) { cec.hdmi = hdmi; cec.ops = &dw_hdmi_cec_ops; cec.irq = irq; -- 2.40.0
[PATCH 3/3] ARM: dts: sun8i: h3: beelink-x2: Disable DW-HDMI CEC
Beelink X2 uses software implementation of CEC even though DW-HDMI has working hardware implementation. Disable unused DW-HDMI CEC. Signed-off-by: Jernej Skrabec --- arch/arm/boot/dts/sun8i-h3-beelink-x2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts index a6d38ecee141..38f40d69e5c5 100644 --- a/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts +++ b/arch/arm/boot/dts/sun8i-h3-beelink-x2.dts @@ -150,6 +150,7 @@ &emac { }; &hdmi { + snps,disable-cec; status = "okay"; }; -- 2.40.0
[PATCH 1/3] dt-bindings: display: synopsys, dw-hdmi: Add property for disabling CEC
Even though some DW-HDMI controllers have perfectly usable HDMI-CEC implementation, some boards might prefer not to use it or even use software implementation instead. Add property for disabling CEC so driver doesn't expose unused CEC interface, if CEC pin isn't connected anywhere. Signed-off-by: Jernej Skrabec --- .../devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml | 5 + 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml index 4b7e54a8f037..624d32c024f6 100644 --- a/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml +++ b/Documentation/devicetree/bindings/display/bridge/synopsys,dw-hdmi.yaml @@ -48,6 +48,11 @@ properties: interrupts: maxItems: 1 + snps,disable-cec: +$ref: /schemas/types.yaml#/definitions/flag +description: + Disable HDMI-CEC. + additionalProperties: true ... -- 2.40.0
[PATCH] drm/panel: novatek-nt35950: Improve error handling
In a very peculiar case when probing and registering with the secondary DSI host succeeds, but the OF backlight or DSI attachment fails, the primary DSI device is automatically cleaned up, but the secondary one is not, leading to -EEXIST when the driver core tries to handle -EPROBE_DEFER. Unregister the DSI1 device manually on failure to prevent that. Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels") Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/panel/panel-novatek-nt35950.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c index abf752b36a52..7498fc6258bb 100644 --- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c +++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c @@ -585,8 +585,11 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) DRM_MODE_CONNECTOR_DSI); ret = drm_panel_of_backlight(&nt->panel); - if (ret) + if (ret) { + mipi_dsi_device_unregister(nt->dsi[1]); + return dev_err_probe(dev, ret, "Failed to get backlight\n"); + } drm_panel_add(&nt->panel); @@ -602,6 +605,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) ret = mipi_dsi_attach(nt->dsi[i]); if (ret < 0) { + /* If we fail to attach to either host, we're done */ + mipi_dsi_device_unregister(nt->dsi[1]); + return dev_err_probe(dev, ret, "Cannot attach to DSI%d host.\n", i); } --- base-commit: 035ba5f9cf511b9299fd9c9d0688ef930d33c886 change-id: 20230415-konrad-longbois-next-847d57abb4d2 Best regards, -- Konrad Dybcio
Re: [PATCH] video: fbdev: mmp: Fix deferred clk handling in mmphw_probe()
On Thu, Apr 13, 2023 at 09:33:17PM +0200, Christophe JAILLET wrote: > When dev_err_probe() is called, 'ret' holds the value of the previous > successful devm_request_irq() call. > 'ret' should be assigned with a meaningful value before being used in > dev_err_probe(). > > While at it, use and return "PTR_ERR(ctrl->clk)" instead of a hard-coded > "-ENOENT" so that -EPROBE_DEFER is handled and propagated correctly. > > Fixes: 81b63420564d ("video: fbdev: mmp: Make use of the helper function > dev_err_probe()") > Signed-off-by: Christophe JAILLET > --- Presumably you already wrote a Coccinelle script for this but I've added it to Smatch as well. regards, dan carpenter diff --git a/check_zero_to_err_ptr.c b/check_zero_to_err_ptr.c index 88ca0285948a..fa2a1f1603b2 100644 --- a/check_zero_to_err_ptr.c +++ b/check_zero_to_err_ptr.c @@ -157,11 +157,12 @@ static void match_err_ptr(const char *fn, struct expression *expr, void *data) { struct expression *arg_expr; struct sm_state *sm, *tmp; + int arg = PTR_INT(data); if (is_impossible_path()) return; - arg_expr = get_argument_from_call_expr(expr->args, 0); + arg_expr = get_argument_from_call_expr(expr->args, arg); sm = get_sm_state_expr(SMATCH_EXTRA, arg_expr); if (!sm) return; @@ -194,13 +195,36 @@ static void match_err_ptr(const char *fn, struct expression *expr, void *data) } END_FOR_EACH_PTR(tmp); } +static void match_err_ptr_or_zero(const char *fn, struct expression *expr, void *data) +{ + struct expression *arg; + struct range_list *rl; + char *name; + + if (is_impossible_path()) + return; + + arg = get_argument_from_call_expr(expr->args, 0); + get_absolute_rl(arg, &rl); + + if (rl_intersection(rl, valid_ptr_rl)) + return; + + name = expr_to_str(arg); + sm_warning("'%s' is never a valid pointer", name); + free_string(name); +} + void check_zero_to_err_ptr(int id) { if (option_project != PROJ_KERNEL) return; my_id = id; - add_function_hook("ERR_PTR", &match_err_ptr, NULL); - add_function_hook("ERR_CAST", &match_err_ptr, NULL); - add_function_hook("PTR_ERR", &match_err_ptr, NULL); + add_function_hook("ERR_PTR", &match_err_ptr, INT_PTR(0)); + add_function_hook("ERR_CAST", &match_err_ptr, INT_PTR(0)); + add_function_hook("PTR_ERR", &match_err_ptr, INT_PTR(0)); + add_function_hook("dev_err_probe", &match_err_ptr, INT_PTR(1)); + + add_function_hook("ERR_PTR_OR_ZERO", &match_err_ptr_or_zero, NULL); }
Re: [PATCH 1/2] bus: mhi: host: Add quirk framework and initial quirk
Hi Jeffrey, kernel test robot noticed the following build errors: [auto build test ERROR on drm-misc/drm-misc-next] [also build test ERROR on drm-tip/drm-tip linus/master v6.3-rc6] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Jeffrey-Hugo/bus-mhi-host-Add-quirk-framework-and-initial-quirk/20230415-035846 base: git://anongit.freedesktop.org/drm/drm-misc drm-misc-next patch link: https://lore.kernel.org/r/1681502239-3781-2-git-send-email-quic_jhugo%40quicinc.com patch subject: [PATCH 1/2] bus: mhi: host: Add quirk framework and initial quirk config: i386-randconfig-r036-20230410 (https://download.01.org/0day-ci/archive/20230415/202304152256.qzcwi9iu-...@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/678cad31c3c8f1b6d772150b98d25e40240e4e14 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Jeffrey-Hugo/bus-mhi-host-Add-quirk-framework-and-initial-quirk/20230415-035846 git checkout 678cad31c3c8f1b6d772150b98d25e40240e4e14 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot | Link: https://lore.kernel.org/oe-kbuild-all/202304152256.qzcwi9iu-...@intel.com/ All errors (new ones prefixed by >>): >> drivers/bus/mhi/host/init.c:977:2: error: expected expression else { ^ >> drivers/bus/mhi/host/init.c:1043:1: error: function definition is not >> allowed here { ^ drivers/bus/mhi/host/init.c:1072:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1082:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1088:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1170:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1189:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1208:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1236:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1312:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1382:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1398:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1404:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1412:1: error: function definition is not allowed here { ^ >> drivers/bus/mhi/host/init.c:1436:11: error: use of undeclared identifier >> 'mhi_match' .match = mhi_match, ^ >> drivers/bus/mhi/host/init.c:1437:12: error: use of undeclared identifier >> 'mhi_uevent'; did you mean 'mhi_event'? .uevent = mhi_uevent, ^~ mhi_event drivers/bus/mhi/host/init.c:895:20: note: 'mhi_event' declared here struct mhi_event *mhi_event; ^ drivers/bus/mhi/host/init.c:1442:1: error: function definition is not allowed here { ^ drivers/bus/mhi/host/init.c:1448:1: error: function definition is not allowed here { ^ >> drivers/bus/mhi/host/init.c:1453:19: error: use of undeclared identifier >> 'mhi_init' postcore_initcall(mhi_init); ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. vim +977 drivers/bus/mhi/host/init.c 891 892 int mhi_register_controller(struct mhi_controller *mhi_cntrl, 893 const struct mhi_controller_config *config) 894 { 895 struct mhi_event *mhi_event; 896 struct mhi_chan *mhi_chan; 897 struct mhi_cmd *mhi_cmd; 898 struct mhi_device *mhi_dev; 899 u32 soc_info; 900 int ret, i; 901 902 if (!mhi_cntrl
[PATCH] drm/amd/display: set variable dccg314_init storage-class-specifier to static
smatch reports drivers/gpu/drm/amd/amdgpu/../display/dc/dcn314/dcn314_dccg.c:277:6: warning: symbol 'dccg314_init' was not declared. Should it be static? This variable is only used in one file so should be static. Signed-off-by: Tom Rix --- drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c index 6f879265ad9c..de7bfba2c179 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c +++ b/drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dccg.c @@ -274,7 +274,7 @@ static void dccg314_set_dpstreamclk( } } -void dccg314_init(struct dccg *dccg) +static void dccg314_init(struct dccg *dccg) { int otg_inst; -- 2.27.0
Patch "fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace" has been added to the 6.2-stable tree
This is a note to let you know that I've just added the patch titled fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace to the 6.2-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fbmem-reject-fb_activate_kd_text-from-userspace.patch and it can be found in the queue-6.2 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 6fd33ac7916689b8f051a185defe4dd515b0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 4 Apr 2023 21:39:34 +0200 Subject: fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Daniel Vetter commit 6fd33ac7916689b8f051a185defe4dd515b0 upstream. This is an oversight from dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") - I failed to realize that nasty userspace could set this. It's not pretty to mix up kernel-internal and userspace uapi flags like this, but since the entire fb_var_screeninfo structure is uapi we'd need to either add a new parameter to the ->fb_set_par callback and fb_set_par() function, which has a _lot_ of users. Or some other fairly ugly side-channel int fb_info. Neither is a pretty prospect. Instead just correct the issue at hand by filtering out this kernel-internal flag in the ioctl handling code. Reviewed-by: Javier Martinez Canillas Acked-by: Maarten Lankhorst Signed-off-by: Daniel Vetter Fixes: dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") Cc: Alex Deucher Cc: shl...@fastmail.com Cc: Michel Dänzer Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: # v5.7+ Cc: Bartlomiej Zolnierkiewicz Cc: Geert Uytterhoeven Cc: Nathan Chancellor Cc: Qiujun Huang Cc: Peter Rosin Cc: linux-fb...@vger.kernel.org Cc: Helge Deller Cc: Sam Ravnborg Cc: Geert Uytterhoeven Cc: Samuel Thibault Cc: Tetsuo Handa Cc: Shigeru Yoshida Link: https://patchwork.freedesktop.org/patch/msgid/20230404193934.472457-1-daniel.vet...@ffwll.ch Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbmem.c |2 ++ 1 file changed, 2 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1117,6 +1117,8 @@ static long do_fb_ioctl(struct fb_info * case FBIOPUT_VSCREENINFO: if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; + /* only for kernel-internal use */ + var.activate &= ~FB_ACTIVATE_KD_TEXT; console_lock(); lock_fb_info(info); ret = fbcon_modechange_possible(info, &var); Patches currently in stable-queue which might be from daniel.vet...@ffwll.ch are queue-6.2/fbmem-reject-fb_activate_kd_text-from-userspace.patch
Patch "fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace" has been added to the 6.1-stable tree
This is a note to let you know that I've just added the patch titled fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fbmem-reject-fb_activate_kd_text-from-userspace.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 6fd33ac7916689b8f051a185defe4dd515b0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 4 Apr 2023 21:39:34 +0200 Subject: fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Daniel Vetter commit 6fd33ac7916689b8f051a185defe4dd515b0 upstream. This is an oversight from dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") - I failed to realize that nasty userspace could set this. It's not pretty to mix up kernel-internal and userspace uapi flags like this, but since the entire fb_var_screeninfo structure is uapi we'd need to either add a new parameter to the ->fb_set_par callback and fb_set_par() function, which has a _lot_ of users. Or some other fairly ugly side-channel int fb_info. Neither is a pretty prospect. Instead just correct the issue at hand by filtering out this kernel-internal flag in the ioctl handling code. Reviewed-by: Javier Martinez Canillas Acked-by: Maarten Lankhorst Signed-off-by: Daniel Vetter Fixes: dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") Cc: Alex Deucher Cc: shl...@fastmail.com Cc: Michel Dänzer Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: # v5.7+ Cc: Bartlomiej Zolnierkiewicz Cc: Geert Uytterhoeven Cc: Nathan Chancellor Cc: Qiujun Huang Cc: Peter Rosin Cc: linux-fb...@vger.kernel.org Cc: Helge Deller Cc: Sam Ravnborg Cc: Geert Uytterhoeven Cc: Samuel Thibault Cc: Tetsuo Handa Cc: Shigeru Yoshida Link: https://patchwork.freedesktop.org/patch/msgid/20230404193934.472457-1-daniel.vet...@ffwll.ch Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbmem.c |2 ++ 1 file changed, 2 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1116,6 +1116,8 @@ static long do_fb_ioctl(struct fb_info * case FBIOPUT_VSCREENINFO: if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; + /* only for kernel-internal use */ + var.activate &= ~FB_ACTIVATE_KD_TEXT; console_lock(); lock_fb_info(info); ret = fbcon_modechange_possible(info, &var); Patches currently in stable-queue which might be from daniel.vet...@ffwll.ch are queue-6.1/fbmem-reject-fb_activate_kd_text-from-userspace.patch
Patch "fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace" has been added to the 5.10-stable tree
This is a note to let you know that I've just added the patch titled fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fbmem-reject-fb_activate_kd_text-from-userspace.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 6fd33ac7916689b8f051a185defe4dd515b0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 4 Apr 2023 21:39:34 +0200 Subject: fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Daniel Vetter commit 6fd33ac7916689b8f051a185defe4dd515b0 upstream. This is an oversight from dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") - I failed to realize that nasty userspace could set this. It's not pretty to mix up kernel-internal and userspace uapi flags like this, but since the entire fb_var_screeninfo structure is uapi we'd need to either add a new parameter to the ->fb_set_par callback and fb_set_par() function, which has a _lot_ of users. Or some other fairly ugly side-channel int fb_info. Neither is a pretty prospect. Instead just correct the issue at hand by filtering out this kernel-internal flag in the ioctl handling code. Reviewed-by: Javier Martinez Canillas Acked-by: Maarten Lankhorst Signed-off-by: Daniel Vetter Fixes: dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") Cc: Alex Deucher Cc: shl...@fastmail.com Cc: Michel Dänzer Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: # v5.7+ Cc: Bartlomiej Zolnierkiewicz Cc: Geert Uytterhoeven Cc: Nathan Chancellor Cc: Qiujun Huang Cc: Peter Rosin Cc: linux-fb...@vger.kernel.org Cc: Helge Deller Cc: Sam Ravnborg Cc: Geert Uytterhoeven Cc: Samuel Thibault Cc: Tetsuo Handa Cc: Shigeru Yoshida Link: https://patchwork.freedesktop.org/patch/msgid/20230404193934.472457-1-daniel.vet...@ffwll.ch Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbmem.c |2 ++ 1 file changed, 2 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1117,6 +1117,8 @@ static long do_fb_ioctl(struct fb_info * case FBIOPUT_VSCREENINFO: if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; + /* only for kernel-internal use */ + var.activate &= ~FB_ACTIVATE_KD_TEXT; console_lock(); lock_fb_info(info); ret = fbcon_modechange_possible(info, &var); Patches currently in stable-queue which might be from daniel.vet...@ffwll.ch are queue-5.10/fbmem-reject-fb_activate_kd_text-from-userspace.patch
Patch "fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace" has been added to the 5.15-stable tree
This is a note to let you know that I've just added the patch titled fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fbmem-reject-fb_activate_kd_text-from-userspace.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From 6fd33ac7916689b8f051a185defe4dd515b0 Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 4 Apr 2023 21:39:34 +0200 Subject: fbmem: Reject FB_ACTIVATE_KD_TEXT from userspace MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Daniel Vetter commit 6fd33ac7916689b8f051a185defe4dd515b0 upstream. This is an oversight from dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") - I failed to realize that nasty userspace could set this. It's not pretty to mix up kernel-internal and userspace uapi flags like this, but since the entire fb_var_screeninfo structure is uapi we'd need to either add a new parameter to the ->fb_set_par callback and fb_set_par() function, which has a _lot_ of users. Or some other fairly ugly side-channel int fb_info. Neither is a pretty prospect. Instead just correct the issue at hand by filtering out this kernel-internal flag in the ioctl handling code. Reviewed-by: Javier Martinez Canillas Acked-by: Maarten Lankhorst Signed-off-by: Daniel Vetter Fixes: dc5bdb68b5b3 ("drm/fb-helper: Fix vt restore") Cc: Alex Deucher Cc: shl...@fastmail.com Cc: Michel Dänzer Cc: Noralf Trønnes Cc: Thomas Zimmermann Cc: Daniel Vetter Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: David Airlie Cc: Daniel Vetter Cc: dri-devel@lists.freedesktop.org Cc: # v5.7+ Cc: Bartlomiej Zolnierkiewicz Cc: Geert Uytterhoeven Cc: Nathan Chancellor Cc: Qiujun Huang Cc: Peter Rosin Cc: linux-fb...@vger.kernel.org Cc: Helge Deller Cc: Sam Ravnborg Cc: Geert Uytterhoeven Cc: Samuel Thibault Cc: Tetsuo Handa Cc: Shigeru Yoshida Link: https://patchwork.freedesktop.org/patch/msgid/20230404193934.472457-1-daniel.vet...@ffwll.ch Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/core/fbmem.c |2 ++ 1 file changed, 2 insertions(+) --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1119,6 +1119,8 @@ static long do_fb_ioctl(struct fb_info * case FBIOPUT_VSCREENINFO: if (copy_from_user(&var, argp, sizeof(var))) return -EFAULT; + /* only for kernel-internal use */ + var.activate &= ~FB_ACTIVATE_KD_TEXT; console_lock(); lock_fb_info(info); ret = fbcon_modechange_possible(info, &var); Patches currently in stable-queue which might be from daniel.vet...@ffwll.ch are queue-5.15/fbmem-reject-fb_activate_kd_text-from-userspace.patch
[PATCH 2/2] drm/msm/dpu: add HDMI output support
MSM8998 and the older Qualcomm platforms support HDMI outputs. Now as DPU encoder is ready, add support for using INTF_HDMI. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 45 + 1 file changed, 45 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index e85e3721d2c7..65cce59163a4 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -617,6 +617,45 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, return 0; } +static int _dpu_kms_initialize_hdmi(struct drm_device *dev, + struct msm_drm_private *priv, + struct dpu_kms *dpu_kms) +{ + struct drm_encoder *encoder = NULL; + struct msm_display_info info; + int rc; + int i; + + if (!priv->hdmi) + return 0; + + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); + if (IS_ERR(encoder)) { + DPU_ERROR("encoder init failed for HDMI display\n"); + return PTR_ERR(encoder); + } + + memset(&info, 0, sizeof(info)); + rc = msm_hdmi_modeset_init(priv->hdmi, dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); + drm_encoder_cleanup(encoder); + return rc; + } + + info.num_of_h_tiles = 1; + info.h_tile_instance[0] = i; + info.intf_type = INTF_HDMI; + rc = dpu_encoder_setup(dev, encoder, &info); + if (rc) { + DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", + encoder->base.id, rc); + return rc; + } + + return 0; +} + static int _dpu_kms_initialize_writeback(struct drm_device *dev, struct msm_drm_private *priv, struct dpu_kms *dpu_kms, const u32 *wb_formats, int n_formats) @@ -683,6 +722,12 @@ static int _dpu_kms_setup_displays(struct drm_device *dev, return rc; } + rc = _dpu_kms_initialize_hdmi(dev, priv, dpu_kms); + if (rc) { + DPU_ERROR("initialize HDMI failed, rc = %d\n", rc); + return rc; + } + /* Since WB isn't a driver check the catalog before initializing */ if (dpu_kms->catalog->wb_count) { for (i = 0; i < dpu_kms->catalog->wb_count; i++) { -- 2.30.2
[PATCH 0/2] drm/msm/dpu: enable INTF_HDMI support
Since msm8998 and older platforms (wip) support INTF_HDMI, extend DPU driver to support HDMI output. First patch was submitted about a year ago, but received some pushback ([1], [2]). However it becomes absolutely required to properly support INTF_HDMI as both HDMI and DP should use DRM_MODE_ENCODER_TMDS for encoder_type. Thus dpu_encoder can not make a difference between HDMI and DP outputs (however they require different handling). [1] https://patchwork.freedesktop.org/patch/473871/ [2] https://patchwork.freedesktop.org/patch/474271/ Dmitry Baryshkov (2): drm/msm/dpu: simplify intf allocation code drm/msm/dpu: add HDMI output support drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 39 ++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 4 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 51 +++-- 3 files changed, 63 insertions(+), 31 deletions(-) -- 2.30.2
[PATCH 1/2] drm/msm/dpu: simplify intf allocation code
Rather than passing DRM_MODE_ENCODER_* and letting dpu_encoder to guess, which intf type we mean, pass INTF_DSI/INTF_DP directly. This is required to support HDMI output in DPU, as both DP and HDMI encoders are DRM_MODE_ENCODER_TMDS. Thus dpu_encoder code can not make a difference between HDMI and DP outputs. Reviewed-by: Bjorn Andersson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 39 +++-- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.h | 4 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 6 ++-- 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 1dc5dbe58572..b34416cbd0f5 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -495,7 +495,7 @@ void dpu_encoder_helper_split_config( hw_mdptop = phys_enc->hw_mdptop; disp_info = &dpu_enc->disp_info; - if (disp_info->intf_type != DRM_MODE_ENCODER_DSI) + if (disp_info->intf_type != INTF_DSI) return; /** @@ -1127,7 +1127,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) } - if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_TMDS && + if (dpu_enc->disp_info.intf_type == INTF_DP && dpu_enc->cur_master->hw_mdptop && dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select) dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select( @@ -1135,7 +1135,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) _dpu_encoder_update_vsync_source(dpu_enc, &dpu_enc->disp_info); - if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI && + if (dpu_enc->disp_info.intf_type == INTF_DSI && !WARN_ON(dpu_enc->num_phys_encs == 0)) { unsigned bpc = dpu_enc->connector->display_info.bpc; for (i = 0; i < MAX_CHANNELS_PER_ENC; i++) { @@ -1977,7 +1977,7 @@ void dpu_encoder_kickoff(struct drm_encoder *drm_enc) phys->ops.handle_post_kickoff(phys); } - if (dpu_enc->disp_info.intf_type == DRM_MODE_ENCODER_DSI && + if (dpu_enc->disp_info.intf_type == INTF_DSI && !dpu_encoder_vsync_time(drm_enc, &wakeup_time)) { trace_dpu_enc_early_kickoff(DRMID(drm_enc), ktime_to_ms(wakeup_time)); @@ -2182,7 +2182,7 @@ static int dpu_encoder_virt_add_phys_encs( } - if (disp_info->intf_type == DRM_MODE_ENCODER_VIRTUAL) { + if (disp_info->intf_type == INTF_WB) { enc = dpu_encoder_phys_wb_init(params); if (IS_ERR(enc)) { @@ -2231,7 +2231,6 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, { int ret = 0; int i = 0; - enum dpu_intf_type intf_type = INTF_NONE; struct dpu_enc_phys_init_params phys_params; if (!dpu_enc) { @@ -2246,23 +2245,11 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, phys_params.parent = &dpu_enc->base; phys_params.enc_spinlock = &dpu_enc->enc_spinlock; - switch (disp_info->intf_type) { - case DRM_MODE_ENCODER_DSI: - intf_type = INTF_DSI; - break; - case DRM_MODE_ENCODER_TMDS: - intf_type = INTF_DP; - break; - case DRM_MODE_ENCODER_VIRTUAL: - intf_type = INTF_WB; - break; - } - WARN_ON(disp_info->num_of_h_tiles < 1); DPU_DEBUG("dsi_info->num_of_h_tiles %d\n", disp_info->num_of_h_tiles); - if (disp_info->intf_type != DRM_MODE_ENCODER_VIRTUAL) + if (disp_info->intf_type != INTF_WB) dpu_enc->idle_pc_supported = dpu_kms->catalog->caps->has_idle_pc; @@ -2290,11 +2277,11 @@ static int dpu_encoder_setup_display(struct dpu_encoder_virt *dpu_enc, i, controller_id, phys_params.split_role); phys_params.intf_idx = dpu_encoder_get_intf(dpu_kms->catalog, - intf_type, - controller_id); + disp_info->intf_type, + controller_id); phys_params.wb_idx = dpu_encoder_get_wb(dpu_kms->catalog, - intf_type, controller_id); + disp_info->intf_type, controller_id); /* * The phys_params might represent either an INTF or a WB unit, but not * both of them at the same time. @@ -2
Re: [PATCH v2] drm/i915: Fix memory leaks in i915 selftests
On Sat, Apr 15, 2023 at 12:41:09AM +0200, Andi Shyti wrote: > From: Cong Liu > > This patch fixes memory leaks on error escapes in function fake_get_pages > > Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist > creation") > Signed-off-by: Cong Liu > Reviewed-by: Andrzej Hajda > Reviewed-by: Andi Shyti > Signed-off-by: Andi Shyti pushed to drm-intel-gt-next. Thanks Cong for your fix, Andi
Re: [PATCH] drm/imx/lcdc: Fix compilation with CONFIG_OF=n
Uwe Kleine-König writes: Hello Uwe, > Hello, > > On Sat, Mar 18, 2023 at 11:10:27PM +0100, Uwe Kleine-König wrote: >> The driver needs the include . WIth CONFIG_OF enabled > Reviewed-by: Javier Martinez Canillas > Just noticed: s/WIth/With/. Assuming no further review comments make a > v2 necessary: Should I resend for that, or can you fixup when you apply > this patch? > No need to resend, I'll fix it when pushing to drm-misc-next. -- Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH] drm/imx/lcdc: Fix compilation with CONFIG_OF=n
Javier Martinez Canillas writes: > Uwe Kleine-König writes: > > Hello Uwe, > >> Hello, >> >> On Sat, Mar 18, 2023 at 11:10:27PM +0100, Uwe Kleine-König wrote: >>> The driver needs the include . WIth CONFIG_OF enabled >> > > Reviewed-by: Javier Martinez Canillas > > >> Just noticed: s/WIth/With/. Assuming no further review comments make a >> v2 necessary: Should I resend for that, or can you fixup when you apply >> this patch? >> > > No need to resend, I'll fix it when pushing to drm-misc-next. > This issue was already fixed by Dave in commit b24343eaceed ("Merge tag 'drm-misc-next-2023-03-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-next"). -- Best regards, Javier Martinez Canillas Core Platforms Red Hat
Re: [PATCH] drm/imx/lcdc: fix a NULL vs IS_ERR() bug in probe
Uwe Kleine-König writes: > On Wed, Mar 22, 2023 at 12:06:55PM +0300, Dan Carpenter wrote: >> The devm_drm_dev_alloc() function returns error pointers. It never >> returns NULL. Fix the check. >> >> Fixes: c87e859cdeb5 ("drm/imx/lcdc: Implement DRM driver for imx25") >> Signed-off-by: Dan Carpenter > > Reviewed-by: Uwe Kleine-König > Pushed to drm-misc (drm-misc-next). Thanks! -- Best regards, Javier Martinez Canillas Core Platforms Red Hat