Re: [PATCH] MAINTAINERS: Update Alain Volmat's email address for drm/sti
On 4/19/23 08:33, Patrice CHOTARD wrote: Hi Alain On 4/16/23 22:27, Alain Volmat wrote: Update my email address for maintainer of the STi DRM driver. Signed-off-by: Alain Volmat --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0e64787aace8..3cec7ad72389 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6952,7 +6952,7 @@ F: Documentation/devicetree/bindings/display/rockchip/ F:drivers/gpu/drm/rockchip/ DRM DRIVERS FOR STI -M: Alain Volmat +M: Alain Volmat L:dri-devel@lists.freedesktop.org S:Maintained T:git git://anongit.freedesktop.org/drm/drm-misc Reviewed-by: Patrice Chotard Dear Arnd, May we ask you please to apply this patch (maybe on "soc/soc.git (arm/fixes)") as you did previously for a similar DRM/STI serie [1]? Many thanks Philippe :-) [1] https://lore.kernel.org/all/164431157889.18327.10086136061531044985.git-patchwork-not...@kernel.org/ Thanks Patrice
Re: [PATCH v3 4/4] drm/stm: add an option to change FB bpp
On 6/13/23 17:26, Raphael Gallais-Pou wrote: On 6/13/23 16:52, Michael Nazzareno Trimarchi wrote: Hi On Tue, Jun 13, 2023 at 4:41 PM Philippe CORNU wrote: On 6/9/23 08:20, Dario Binacchi wrote: Boards that use the STM32F{4,7} series have limited amounts of RAM. The added parameter allows users to size, within certain limits, the memory footprint required by the framebuffer. Signed-off-by: Dario Binacchi --- Changes in v3: - drop [4/6] dt-bindings: display: simple: add Rocktech RK043FN48H Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next): https://cgit.freedesktop.org/drm/drm-misc/commit/?id=c42a37a27c777d63961dd634a30f7c887949491a - drop [5/6] drm/panel: simple: add support for Rocktech RK043FN48H panel Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next) https://cgit.freedesktop.org/drm/drm-misc/commit/?id=13cdd12a9f934158f4ec817cf048fcb4384aa9dc drivers/gpu/drm/stm/drv.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 40df7d8c..65be2b442a6a 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -30,6 +30,11 @@ #define STM_MAX_FB_WIDTH2048 #define STM_MAX_FB_HEIGHT 2048 /* same as width to handle orientation */ +static uint stm_bpp = 16; + +MODULE_PARM_DESC(bpp, "bits-per-pixel (default: 16)"); +module_param_named(bpp, stm_bpp, uint, 0644); + static const struct drm_mode_config_funcs drv_mode_config_funcs = { .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check, @@ -93,6 +98,7 @@ static int drv_load(struct drm_device *ddev) ddev->mode_config.min_height = 0; ddev->mode_config.max_width = STM_MAX_FB_WIDTH; ddev->mode_config.max_height = STM_MAX_FB_HEIGHT; + ddev->mode_config.preferred_depth = stm_bpp; ddev->mode_config.funcs = _mode_config_funcs; ddev->mode_config.normalize_zpos = true; @@ -203,7 +209,7 @@ static int stm_drm_platform_probe(struct platform_device *pdev) if (ret) goto err_put; - drm_fbdev_dma_setup(ddev, 16); + drm_fbdev_dma_setup(ddev, stm_bpp); return 0; Acked-by: Philippe Cornu Many thanks, Philippe :-) According to the latest review on usb patchset: "Please do not add new module parameters, this is not the 1990's anymore. We have per-device settings everywhere, this makes that impossible. Just use a DT value, if it is wrong, then fix the DT value! No need to have the kernel override it, that's not what DT files are for." I actually am conflicted about this idea, but I still think that here the best option would be to put a device-tree property. In which context here the module parameters could be used ? I think a module parameter would be quite troublesome for userspace applications in that case. Raphaël I think it makes more sense to have dts parameters. Should maybe apply here too Michael Hi Raphaël & Michael, Many thanks for your comments. Dario's usage of this stm driver is STM32 MCUs (STM32F4 & F7...) where, sometimes, old userland fbdev-based applications are used, and I imagine it is maybe "easier" to use a module parameter (through the kernel command line or whatever...) in these use cases (even if using dt is always better and not that complex). Moreover, as I did not find any drm drivers with drm_fbdev_dma_setup() using a dt property "as example" (but always hard-coded value), then I decided to not block this proposal :) Thanks to your feedback, I am reconsidering my position. And sorry Dario, hope you understand it will take more time for reviewing your patch. Does anyone have an opinion to share on this point? Many thanks, Philippe :-)
Re: [PATCH v3 4/4] drm/stm: add an option to change FB bpp
On 6/9/23 08:20, Dario Binacchi wrote: Boards that use the STM32F{4,7} series have limited amounts of RAM. The added parameter allows users to size, within certain limits, the memory footprint required by the framebuffer. Signed-off-by: Dario Binacchi --- Changes in v3: - drop [4/6] dt-bindings: display: simple: add Rocktech RK043FN48H Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next): https://cgit.freedesktop.org/drm/drm-misc/commit/?id=c42a37a27c777d63961dd634a30f7c887949491a - drop [5/6] drm/panel: simple: add support for Rocktech RK043FN48H panel Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next) https://cgit.freedesktop.org/drm/drm-misc/commit/?id=13cdd12a9f934158f4ec817cf048fcb4384aa9dc drivers/gpu/drm/stm/drv.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 40df7d8c..65be2b442a6a 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -30,6 +30,11 @@ #define STM_MAX_FB_WIDTH 2048 #define STM_MAX_FB_HEIGHT 2048 /* same as width to handle orientation */ +static uint stm_bpp = 16; + +MODULE_PARM_DESC(bpp, "bits-per-pixel (default: 16)"); +module_param_named(bpp, stm_bpp, uint, 0644); + static const struct drm_mode_config_funcs drv_mode_config_funcs = { .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check, @@ -93,6 +98,7 @@ static int drv_load(struct drm_device *ddev) ddev->mode_config.min_height = 0; ddev->mode_config.max_width = STM_MAX_FB_WIDTH; ddev->mode_config.max_height = STM_MAX_FB_HEIGHT; + ddev->mode_config.preferred_depth = stm_bpp; ddev->mode_config.funcs = _mode_config_funcs; ddev->mode_config.normalize_zpos = true; @@ -203,7 +209,7 @@ static int stm_drm_platform_probe(struct platform_device *pdev) if (ret) goto err_put; - drm_fbdev_dma_setup(ddev, 16); + drm_fbdev_dma_setup(ddev, stm_bpp); return 0; Acked-by: Philippe Cornu Many thanks, Philippe :-)
Re: [PATCH 2/2] dt-bindings: backlight: document new property default-brightness-level
On 5/19/23 22:05, Alexandru Ardelean wrote: From: Yannick Fertre Add documentation for new default-brightness-level property. Reviewed-by: Philippe CORNU Hi Alexandru, same comments as for the 1/2 patch. Many thanks Philippe :-) Signed-off-by: Yannick Fertre Signed-off-by: Alexandru Ardelean --- Link to original patch: https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98 .../bindings/leds/backlight/gpio-backlight.yaml | 9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml b/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml index 584030b6b0b9..b96c08cff0f0 100644 --- a/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml +++ b/Documentation/devicetree/bindings/leds/backlight/gpio-backlight.yaml @@ -23,6 +23,15 @@ properties: description: enable the backlight at boot. type: boolean + default-brightness-level: +description: + The default brightness level (index into the array defined by the + "brightness-levels" property). +$ref: /schemas/types.yaml#/definitions/uint32 + +dependencies: + default-brightness-level: [ "brightness-levels" ] + required: - compatible - gpios
Re: [PATCH 1/2] backlight: gpio_backlight: add new property default-brightness-level
On 5/19/23 22:05, Alexandru Ardelean wrote: From: Yannick Fertre Add new property to set a brightness by default at probe. Reviewed-by: Philippe CORNU Hi Alexandru, Many thanks for your patch. You have sent a patch originally pushed on the STMicroelectronics github as mentioned in your commit message (no problem with that :-). But, the "Reviewed-by" inside this github patch is linked to our gerrit STM internal server so you can not use it directly for mainlining this patch. So please, re-send your this patch without my "Reviewed-by". Many thanks Philippe :-) Signed-off-by: Yannick Fertre Signed-off-by: Alexandru Ardelean --- Link to original patch: https://github.com/STMicroelectronics/linux/commit/c4067d7bd883c6fa14ffd49892c4ce663cdafe98 drivers/video/backlight/gpio_backlight.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c index 6f78d928f054..d3fa3a8bef4d 100644 --- a/drivers/video/backlight/gpio_backlight.c +++ b/drivers/video/backlight/gpio_backlight.c @@ -53,6 +53,7 @@ static int gpio_backlight_probe(struct platform_device *pdev) struct backlight_device *bl; struct gpio_backlight *gbl; int ret, init_brightness, def_value; + u32 value; gbl = devm_kzalloc(dev, sizeof(*gbl), GFP_KERNEL); if (gbl == NULL) @@ -93,7 +94,11 @@ static int gpio_backlight_probe(struct platform_device *pdev) else bl->props.power = FB_BLANK_UNBLANK; - bl->props.brightness = 1; + ret = device_property_read_u32(dev, "default-brightness-level", ); + if (!ret && value <= props.max_brightness) + bl->props.brightness = value; + else + bl->props.brightness = 1; init_brightness = backlight_get_brightness(bl); ret = gpiod_direction_output(gbl->gpiod, init_brightness);
Re: [PATCH RESEND] drm/stm: ltdc: fix late dereference check
On 5/15/23 14:38, Raphael Gallais-Pou wrote: In ltdc_crtc_set_crc_source(), struct drm_crtc was dereferenced in a container_of() before the pointer check. This could cause a kernel panic. Fix this smatch warning: drivers/gpu/drm/stm/ltdc.c:1124 ltdc_crtc_set_crc_source() warn: variable dereferenced before check 'crtc' (see line 1119) Reported-by: kernel test robot Reported-by: Dan Carpenter Link: https://lore.kernel.org/lkml/202212241802.zelfzcxb-...@intel.com/ Signed-off-by: Raphael Gallais-Pou --- drivers/gpu/drm/stm/ltdc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 03c6becda795..b8be4c1db423 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1145,7 +1145,7 @@ static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc) static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source) { - struct ltdc_device *ldev = crtc_to_ltdc(crtc); + struct ltdc_device *ldev; int ret; DRM_DEBUG_DRIVER("\n"); @@ -1153,6 +1153,8 @@ static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source) if (!crtc) return -ENODEV; + ldev = crtc_to_ltdc(crtc); + if (source && strcmp(source, "auto") == 0) { ldev->crc_active = true; ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN); Hi Raphael, Applied on drm-misc-next. Note & fyi, I fixed the following warning, please be sure to follow this rule next time :-) WARNING:BAD_REPORTED_BY_LINK: Reported-by: should be immediately followed by Closes: with a URL to the report Many thanks for your patch, Philippe :-)
Re: [PATCH -next] drm/stm: dsi: Use devm_platform_ioremap_resource()
On 4/21/23 10:34, Yang Li wrote: Convert platform_get_resource(),devm_ioremap_resource() to a single call to devm_platform_ioremap_resource(), as this is exactly what this function does. Signed-off-by: Yang Li --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 89897d5f5c72..1750b6a25e87 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -444,15 +444,13 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) struct device *dev = >dev; struct dw_mipi_dsi_stm *dsi; struct clk *pclk; - struct resource *res; int ret; dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); if (!dsi) return -ENOMEM; - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - dsi->base = devm_ioremap_resource(dev, res); + dsi->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(dsi->base)) { ret = PTR_ERR(dsi->base); DRM_ERROR("Unable to get dsi registers %d\n", ret); Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH RESEND] drm/stm: ltdc: fix late dereference check
On 5/15/23 14:38, Raphael Gallais-Pou wrote: In ltdc_crtc_set_crc_source(), struct drm_crtc was dereferenced in a container_of() before the pointer check. This could cause a kernel panic. Fix this smatch warning: drivers/gpu/drm/stm/ltdc.c:1124 ltdc_crtc_set_crc_source() warn: variable dereferenced before check 'crtc' (see line 1119) Reported-by: kernel test robot Reported-by: Dan Carpenter Link: https://lore.kernel.org/lkml/202212241802.zelfzcxb-...@intel.com/ Signed-off-by: Raphael Gallais-Pou --- drivers/gpu/drm/stm/ltdc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 03c6becda795..b8be4c1db423 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1145,7 +1145,7 @@ static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc) static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source) { - struct ltdc_device *ldev = crtc_to_ltdc(crtc); + struct ltdc_device *ldev; int ret; DRM_DEBUG_DRIVER("\n"); @@ -1153,6 +1153,8 @@ static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source) if (!crtc) return -ENODEV; + ldev = crtc_to_ltdc(crtc); + if (source && strcmp(source, "auto") == 0) { ldev->crc_active = true; ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN); Hi Raphael, and many thanks for your patch. Acked-by: Philippe Cornu Philippe :-)
Re: [PATCH] drm/stm: Fix resolution bitmasks
On 5/26/23 11:05, Marek Vasut wrote: On 5/15/23 18:02, Philippe CORNU wrote: Hi, The genmask of regsiter SSCR, BPCR & others were setted accordly to the chipset stm32f4. So that means: F4 -> 2048x2048 framebuffer H7/MP1 -> 4096x4096 framebuffer ? Worse F4 is 2048x2048 F7 is 4096x2048 MP1 is 4096x4096 and there is no IDR register on F4/F7 like on MP1, or is there ? How else can we tell those LTDC versions apart ? Dear Marek, Many thanks for your patch (and sorry for this late reply). Your patch is good and fixes this ltdc driver source code vs. the related reference manual. imho, it will not be an issue for F4 & F7 series if these bit-fields are "bigger" as I am pretty sure stm32 MCUs are not really using such high resolutions. Yannick already replied with his reviewed-by. I add my Acked-by: Philippe Cornu If you agree, I will merge your patch really soon. I would say there is no rush, so let's get this done right . Dear Yannick, You may add to your todo list to double check if there is a need to detect stm32 MCUs vs. these bit-field sizes... Can we use a compatible string , or I think there is some ID register ? [...] btw I only received this email now, odd, I wonder whether it was stuck in some SMTP server. Sorry for the delayed reply, it was out of my control. Hi Marek, Thank you for your feedback, I agree it is better to fix this properly. Note: After a quick check, I'm 99% sure that the smtp problem was on my end (although I don't understand why I know we've had some issues with the mailing lists over the past few weeks), so all my apologies for that :-) Hi Yannick, May I ask you please to prepare this clean up (taking into account all ltdc versions). Many thanks Philippe :-)
Re: [PATCH] drm/stm: Fix resolution bitmasks
On 10/14/22 19:15, Marek Vasut wrote: On 10/14/22 17:55, Marek Vasut wrote: On 10/14/22 15:42, Yannick FERTRE wrote: Hi Marek, Hello Yannick, The genmask of regsiter SSCR, BPCR & others were setted accordly to the chipset stm32f4. So that means: F4 -> 2048x2048 framebuffer H7/MP1 -> 4096x4096 framebuffer ? Worse F4 is 2048x2048 F7 is 4096x2048 MP1 is 4096x4096 and there is no IDR register on F4/F7 like on MP1, or is there ? How else can we tell those LTDC versions apart ? Dear Marek, Many thanks for your patch (and sorry for this late reply). Your patch is good and fixes this ltdc driver source code vs. the related reference manual. imho, it will not be an issue for F4 & F7 series if these bit-fields are "bigger" as I am pretty sure stm32 MCUs are not really using such high resolutions. Yannick already replied with his reviewed-by. I add my Acked-by: Philippe Cornu If you agree, I will merge your patch really soon. Dear Yannick, You may add to your todo list to double check if there is a need to detect stm32 MCUs vs. these bit-field sizes... Many thanks Philippe :-)
Re: [PATCH] MAINTAINERS: Update Alain Volmat's email address for drm/sti
On 4/16/23 22:27, Alain Volmat wrote: Update my email address for maintainer of the STi DRM driver. Signed-off-by: Alain Volmat --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0e64787aace8..3cec7ad72389 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6952,7 +6952,7 @@ F: Documentation/devicetree/bindings/display/rockchip/ F:drivers/gpu/drm/rockchip/ DRM DRIVERS FOR STI -M: Alain Volmat +M: Alain Volmat L:dri-devel@lists.freedesktop.org S:Maintained T:git git://anongit.freedesktop.org/drm/drm-misc Hi Alain, Reviewed-by: Philippe Cornu Many thanks Philippe :-)
Re: [PATCH] drm/stm: ltdc: add support of the dynamic z-order
On 6/3/22 15:44, Yannick Fertre wrote: Zpos property is immutable for all hardware versions except the last version (0x40100) which support the blending order feature (dynamic z-order). Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/drv.c | 1 + drivers/gpu/drm/stm/ltdc.c | 23 --- drivers/gpu/drm/stm/ltdc.h | 1 + 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 0da7cce2a1a2..c63945dc2260 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -95,6 +95,7 @@ static int drv_load(struct drm_device *ddev) ddev->mode_config.max_width = STM_MAX_FB_WIDTH; ddev->mode_config.max_height = STM_MAX_FB_HEIGHT; ddev->mode_config.funcs = _mode_config_funcs; + ddev->mode_config.normalize_zpos = true; ret = ltdc_load(ddev); if (ret) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 6a9f613839b5..00a6bc1b1d7c 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -194,6 +194,7 @@ #define LXBFCR_BF2 GENMASK(2, 0) /* Blending Factor 2 */ #define LXBFCR_BF1GENMASK(10, 8) /* Blending Factor 1 */ +#define LXBFCR_BOR GENMASK(18, 16) /* Blending ORder */ #define LXCFBLR_CFBLL GENMASK(12, 0) /* Color Frame Buffer Line Length */ #define LXCFBLR_CFBP GENMASK(28, 16) /* Color Frame Buffer Pitch in bytes */ @@ -1309,7 +1310,14 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, plane->type != DRM_PLANE_TYPE_PRIMARY) val = BF1_PAXCA | BF2_1PAXCA; - regmap_write_bits(ldev->regmap, LTDC_L1BFCR + lofs, LXBFCR_BF2 | LXBFCR_BF1, val); + if (ldev->caps.dynamic_zorder) { + val |= (newstate->normalized_zpos << 16); + regmap_write_bits(ldev->regmap, LTDC_L1BFCR + lofs, + LXBFCR_BF2 | LXBFCR_BF1 | LXBFCR_BOR, val); + } else { + regmap_write_bits(ldev->regmap, LTDC_L1BFCR + lofs, + LXBFCR_BF2 | LXBFCR_BF1, val); + } /* Configures the frame buffer line number */ line_number = y1 - y0 + 1; @@ -1578,7 +1586,10 @@ static int ltdc_crtc_init(struct drm_device *ddev, struct drm_crtc *crtc) return -EINVAL; } - drm_plane_create_zpos_immutable_property(primary, 0); + if (ldev->caps.dynamic_zorder) + drm_plane_create_zpos_property(primary, 0, 0, ldev->caps.nb_layers - 1); + else + drm_plane_create_zpos_immutable_property(primary, 0); /* Init CRTC according to its hardware features */ if (ldev->caps.crc) @@ -1607,7 +1618,10 @@ static int ltdc_crtc_init(struct drm_device *ddev, struct drm_crtc *crtc) DRM_ERROR("Can not create overlay plane %d\n", i); goto cleanup; } - drm_plane_create_zpos_immutable_property(overlay, i); + if (ldev->caps.dynamic_zorder) + drm_plane_create_zpos_property(overlay, i, 0, ldev->caps.nb_layers - 1); + else + drm_plane_create_zpos_immutable_property(overlay, i); } return 0; @@ -1737,6 +1751,7 @@ static int ltdc_get_caps(struct drm_device *ddev) ldev->caps.ycbcr_output = false; ldev->caps.plane_reg_shadow = false; ldev->caps.crc = false; + ldev->caps.dynamic_zorder = false; break; case HWVER_20101: ldev->caps.layer_ofs = LAY_OFS_0; @@ -1752,6 +1767,7 @@ static int ltdc_get_caps(struct drm_device *ddev) ldev->caps.ycbcr_output = false; ldev->caps.plane_reg_shadow = false; ldev->caps.crc = false; + ldev->caps.dynamic_zorder = false; break; case HWVER_40100: ldev->caps.layer_ofs = LAY_OFS_1; @@ -1767,6 +1783,7 @@ static int ltdc_get_caps(struct drm_device *ddev) ldev->caps.ycbcr_output = true; ldev->caps.plane_reg_shadow = true; ldev->caps.crc = true; + ldev->caps.dynamic_zorder = true; break; default: return -ENODEV; diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h index 59fc5d1bbbab..4855898bd4c0 100644 --- a/drivers/gpu/drm/stm/ltdc.h +++ b/drivers/gpu/drm/stm/ltdc.h @@ -28,6 +28,7 @@ struct ltdc_caps { bool ycbcr_output; /* ycbcr output converter supported */ bool plane_reg_shadow; /* plane shadow registers ability */ bool crc; /* cyclic redundancy check supported */ + bool dynamic_zorder;/* dynamic z-order */ }; #define LTDC_MAX_LAYER 4 Dear Yannick, Many thanks for your patch, Applied on drm-misc-next. Have a good day Philippe :-)
Re: [PATCH] drm/stm: ltdc: update hardware error management
On 6/3/22 15:46, Yannick Fertre wrote: The latest hardware version (0x40100) supports a hardware threshold register (aka FUTR) to trigger a fifo underrun interrupt. A software threshold has been implemented for other hardware versions. The threshold is set to 128 by default. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 90 ++ drivers/gpu/drm/stm/ltdc.h | 6 ++- 2 files changed, 77 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index ff2075dd9474..42a3bd515477 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -162,16 +162,20 @@ #define BCCR_BCWHITE GENMASK(23, 0) /* Background Color WHITE */ #define IER_LIE BIT(0) /* Line Interrupt Enable */ -#define IER_FUIE BIT(1) /* Fifo Underrun Interrupt Enable */ +#define IER_FUWIE BIT(1) /* Fifo Underrun Warning Interrupt Enable */ #define IER_TERRIEBIT(2) /* Transfer ERRor Interrupt Enable */ -#define IER_RRIE BIT(3) /* Register Reload Interrupt enable */ +#define IER_RRIE BIT(3) /* Register Reload Interrupt Enable */ +#define IER_FUEIE BIT(6) /* Fifo Underrun Error Interrupt Enable */ +#define IER_CRCIE BIT(7) /* CRC Error Interrupt Enable */ #define CPSR_CYPOS GENMASK(15, 0) /* Current Y position */ #define ISR_LIF BIT(0) /* Line Interrupt Flag */ -#define ISR_FUIF BIT(1) /* Fifo Underrun Interrupt Flag */ +#define ISR_FUWIF BIT(1) /* Fifo Underrun Warning Interrupt Flag */ #define ISR_TERRIFBIT(2) /* Transfer ERRor Interrupt Flag */ #define ISR_RRIF BIT(3) /* Register Reload Interrupt Flag */ +#define ISR_FUEIF BIT(6) /* Fifo Underrun Error Interrupt Flag */ +#define ISR_CRCIF BIT(7) /* CRC Error Interrupt Flag */ #define EDCR_OCYEN BIT(25) /* Output Conversion to YCbCr 422: ENable */ #define EDCR_OCYSEL BIT(26) /* Output Conversion to YCbCr 422: SELection of the CCIR */ @@ -231,6 +235,8 @@ #define NB_PF 8 /* Max nb of HW pixel format */ +#define FUT_DFT 128 /* Default value of fifo underrun threshold */ + /* * Skip the first value and the second in case CRC was enabled during * the thread irq. This is to be sure CRC value is relevant for the @@ -711,12 +717,13 @@ static irqreturn_t ltdc_irq_thread(int irq, void *arg) ltdc_irq_crc_handle(ldev, crtc); } - /* Save FIFO Underrun & Transfer Error status */ mutex_lock(>err_lock); - if (ldev->irq_status & ISR_FUIF) - ldev->error_status |= ISR_FUIF; if (ldev->irq_status & ISR_TERRIF) - ldev->error_status |= ISR_TERRIF; + ldev->transfer_err++; + if (ldev->irq_status & ISR_FUEIF) + ldev->fifo_err++; + if (ldev->irq_status & ISR_FUWIF) + ldev->fifo_warn++; mutex_unlock(>err_lock); return IRQ_HANDLED; @@ -775,7 +782,7 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, regmap_write(ldev->regmap, LTDC_BCCR, BCCR_BCBLACK); /* Enable IRQ */ - regmap_set_bits(ldev->regmap, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); + regmap_set_bits(ldev->regmap, LTDC_IER, IER_FUWIE | IER_FUEIE | IER_RRIE | IER_TERRIE); /* Commit shadow registers = update planes at next vblank */ if (!ldev->caps.plane_reg_shadow) @@ -801,13 +808,20 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc, LXCR_CLUTEN | LXCR_LEN, 0); /* disable IRQ */ - regmap_clear_bits(ldev->regmap, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); + regmap_clear_bits(ldev->regmap, LTDC_IER, IER_FUWIE | IER_FUEIE | IER_RRIE | IER_TERRIE); /* immediately commit disable of layers before switching off LTDC */ if (!ldev->caps.plane_reg_shadow) regmap_set_bits(ldev->regmap, LTDC_SRCR, SRCR_IMR); pm_runtime_put_sync(ddev->dev); + + /* clear interrupt error counters */ + mutex_lock(>err_lock); + ldev->transfer_err = 0; + ldev->fifo_err = 0; + ldev->fifo_warn = 0; + mutex_unlock(>err_lock); } #define CLK_TOLERANCE_HZ 50 @@ -1168,6 +1182,18 @@ static int ltdc_crtc_verify_crc_source(struct drm_crtc *crtc, return 0; } +static void ltdc_crtc_atomic_print_state(struct drm_printer *p, +const struct drm_crtc_state *state) +{ + struct drm_crtc *crtc = state->crtc; + struct ltdc_device *ldev = crtc_to_ltdc(crtc); + + drm_printf(p, "\ttransfer_error=%d\n", ldev->transfer_err); + drm_printf(p, "\tfifo_underrun_error=%d\n", ldev->fifo_err); + drm_printf(p, "\tfifo_underrun_warning=%d\n", ldev->fifo_warn); + drm_printf(p, "\tfifo_underrun_threshold=%d\n",
Re: [PATCH] drm/stm: ltdc: add support of horizontal & vertical mirroring
On 6/3/22 15:45, Yannick Fertre wrote: Support of vertical & horizontal mirroring features thanks to the plane rotation property. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 163 - drivers/gpu/drm/stm/ltdc.h | 1 + 2 files changed, 108 insertions(+), 56 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 00a6bc1b1d7c..ff2075dd9474 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -180,6 +180,7 @@ #define LXCR_LEN BIT(0) /* Layer ENable */ #define LXCR_COLKEN BIT(1) /* Color Keying Enable */ #define LXCR_CLUTEN BIT(4) /* Color Look-Up Table ENable */ +#define LXCR_HMEN BIT(8) /* Horizontal Mirroring ENable */ #define LXWHPCR_WHSTPOS GENMASK(11, 0) /* Window Horizontal StarT POSition */ #define LXWHPCR_WHSPPOS GENMASK(27, 16) /* Window Horizontal StoP POSition */ @@ -197,7 +198,7 @@ #define LXBFCR_BORGENMASK(18, 16) /* Blending ORder */ #define LXCFBLR_CFBLL GENMASK(12, 0) /* Color Frame Buffer Line Length */ -#define LXCFBLR_CFBP GENMASK(28, 16) /* Color Frame Buffer Pitch in bytes */ +#define LXCFBLR_CFBP GENMASK(31, 16) /* Color Frame Buffer Pitch in bytes */ #define LXCFBLNR_CFBLN GENMASK(10, 0) /* Color Frame Buffer Line Number */ @@ -1237,7 +1238,8 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, u32 y0 = newstate->crtc_y; u32 y1 = newstate->crtc_y + newstate->crtc_h - 1; u32 src_x, src_y, src_w, src_h; - u32 val, pitch_in_bytes, line_length, line_number, paddr, ahbp, avbp, bpcr; + u32 val, pitch_in_bytes, line_length, line_number, ahbp, avbp, bpcr; + u32 paddr, paddr1, paddr2; enum ltdc_pix_fmt pf; if (!newstate->crtc || !fb) { @@ -1289,13 +1291,6 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, } regmap_write_bits(ldev->regmap, LTDC_L1PFCR + lofs, LXPFCR_PF, val); - /* Configures the color frame buffer pitch in bytes & line length */ - pitch_in_bytes = fb->pitches[0]; - line_length = fb->format->cpp[0] * - (x1 - x0 + 1) + (ldev->caps.bus_width >> 3) - 1; - val = ((pitch_in_bytes << 16) | line_length); - regmap_write_bits(ldev->regmap, LTDC_L1CFBLR + lofs, LXCFBLR_CFBLL | LXCFBLR_CFBP, val); - /* Specifies the constant alpha value */ val = newstate->alpha >> 8; regmap_write_bits(ldev->regmap, LTDC_L1CACR + lofs, LXCACR_CONSTA, val); @@ -1319,76 +1314,115 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, LXBFCR_BF2 | LXBFCR_BF1, val); } - /* Configures the frame buffer line number */ - line_number = y1 - y0 + 1; - regmap_write_bits(ldev->regmap, LTDC_L1CFBLNR + lofs, LXCFBLNR_CFBLN, line_number); - /* Sets the FB address */ paddr = (u32)drm_fb_cma_get_gem_addr(fb, newstate, 0); + if (newstate->rotation & DRM_MODE_REFLECT_X) + paddr += (fb->format->cpp[0] * (x1 - x0 + 1)) - 1; + + if (newstate->rotation & DRM_MODE_REFLECT_Y) + paddr += (fb->pitches[0] * (y1 - y0)); + DRM_DEBUG_DRIVER("fb: phys 0x%08x", paddr); regmap_write(ldev->regmap, LTDC_L1CFBAR + lofs, paddr); + /* Configures the color frame buffer pitch in bytes & line length */ + line_length = fb->format->cpp[0] * + (x1 - x0 + 1) + (ldev->caps.bus_width >> 3) - 1; + + if (newstate->rotation & DRM_MODE_REFLECT_Y) + /* Compute negative value (signed on 16 bits) for the picth */ + pitch_in_bytes = 0x1 - fb->pitches[0]; + else + pitch_in_bytes = fb->pitches[0]; + + val = (pitch_in_bytes << 16) | line_length; + regmap_write_bits(ldev->regmap, LTDC_L1CFBLR + lofs, LXCFBLR_CFBLL | LXCFBLR_CFBP, val); + + /* Configures the frame buffer line number */ + line_number = y1 - y0 + 1; + regmap_write_bits(ldev->regmap, LTDC_L1CFBLNR + lofs, LXCFBLNR_CFBLN, line_number); + if (ldev->caps.ycbcr_input) { if (fb->format->is_yuv) { switch (fb->format->format) { case DRM_FORMAT_NV12: case DRM_FORMAT_NV21: - /* Configure the auxiliary frame buffer address 0 & 1 */ - paddr = (u32)drm_fb_cma_get_gem_addr(fb, newstate, 1); - regmap_write(ldev->regmap, LTDC_L1AFBA0R + lofs, paddr); - regmap_write(ldev->regmap, LTDC_L1AFBA1R + lofs, paddr + 1); + /* Configure the auxiliary frame buffer address 0 */ + paddr1 = (u32)drm_fb_cma_get_gem_addr(fb, newstate, 1); + + if (newstate->rotation & DRM_MODE_REFLECT_X) + paddr1 += ((fb->format->cpp[1] *
Re: [PATCH] drm/stm: ltdc: fix various coding-style warnings
On 6/3/22 15:43, Yannick Fertre wrote: Fix issues reported by checkpatch.pl: - Braces {} should be used on all arms - Blank lines Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index a4098aaff243..6a9f613839b5 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -908,9 +908,9 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc) drm_connector_list_iter_end(); } - if (bridge && bridge->timings) + if (bridge && bridge->timings) { bus_flags = bridge->timings->input_bus_flags; - else if (connector) { + } else if (connector) { bus_flags = connector->display_info.bus_flags; if (connector->display_info.num_bus_formats) bus_formats = connector->display_info.bus_formats[0]; @@ -1917,7 +1917,6 @@ int ltdc_load(struct drm_device *ddev) DRM_ERROR("Failed to register LTDC interrupt\n"); goto err; } - } crtc = devm_kzalloc(dev, sizeof(*crtc), GFP_KERNEL); Dear Yannick, Many thanks for your patch, Applied on drm-misc-next. Have a good day Philippe :-)
Re: [PATCH] drm/stm: ltdc: remove error message about scaling
On 6/3/22 15:42, Yannick Fertre wrote: Remove error message about scaling & replace it by a debug message to avoid too much error. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index eeefc3260c07..a4098aaff243 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1215,7 +1215,8 @@ static int ltdc_plane_atomic_check(struct drm_plane *plane, /* Reject scaling */ if (src_w != new_plane_state->crtc_w || src_h != new_plane_state->crtc_h) { - DRM_ERROR("Scaling is not supported"); + DRM_DEBUG_DRIVER("Scaling is not supported"); + return -EINVAL; } Dear Yannick, Many thanks for your patch, Applied on drm-misc-next. Have a good day Philippe :-)
Re: [PATCH] drm/stm: ltdc: disable all layers before crtc shutdown
On 6/3/22 15:41, Yannick Fertre wrote: All plans must be disabled before the CRTC shutdown helping the crtc to restart from a clean situation (without unwanted planes already enable). Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 6bd45df8f5a7..eeefc3260c07 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -787,11 +787,17 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc *crtc, { struct ltdc_device *ldev = crtc_to_ltdc(crtc); struct drm_device *ddev = crtc->dev; + int layer_index = 0; DRM_DEBUG_DRIVER("\n"); drm_crtc_vblank_off(crtc); + /* Disable all layers */ + for (layer_index = 0; layer_index < ldev->caps.nb_layers; layer_index++) + regmap_write_bits(ldev->regmap, LTDC_L1CR + layer_index * LAY_OFS, + LXCR_CLUTEN | LXCR_LEN, 0); + /* disable IRQ */ regmap_clear_bits(ldev->regmap, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); Dear Yannick, Many thanks for your patch, Applied on drm-misc-next. Have a good day Philippe :-)
Re: [PATCH] drm: sti: fix spelling mistake: rejec -> rejection
On 10/4/19 10:27, Colin King wrote: From: Colin Ian King In other places of the driver the string hdmi_rejection_pll is used instead of the truncated hdmi_rejec_pll, so use this string instead to be consistent. Signed-off-by: Colin Ian King --- drivers/gpu/drm/sti/sti_hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 814560ead4e1..e2018e4a3ec5 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -886,7 +886,7 @@ static void sti_hdmi_pre_enable(struct drm_bridge *bridge) if (clk_prepare_enable(hdmi->clk_tmds)) DRM_ERROR("Failed to prepare/enable hdmi_tmds clk\n"); if (clk_prepare_enable(hdmi->clk_phy)) - DRM_ERROR("Failed to prepare/enable hdmi_rejec_pll clk\n"); + DRM_ERROR("Failed to prepare/enable hdmi_rejection_pll clk\n"); hdmi->enabled = true; Dear Colin, Many thanks for your patch, Applied on drm-misc-next. and sorry for the delay. Have a good day Philippe :-)
Re: [PATCH] stm: ltdc: fix two incorrect NULL checks on list iterator
On 3/28/22 14:37, Raphael Gallais-Pou wrote: Hello Xiaomeng On 3/27/22 07:53, Xiaomeng Tong wrote: The two bugs are here: if (encoder) { if (bridge && bridge->timings) The list iterator value 'encoder/bridge' will *always* be set and non-NULL by drm_for_each_encoder()/list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty or no element is found. To fix the bug, use a new variable '*_iter' as the list iterator, while use the old variable 'encoder/bridge' as a dedicated pointer to point to the found element. Cc: sta...@vger.kernel.org Fixes: 99e360442f223 ("drm/stm: Fix bus_flags handling") Signed-off-by: Xiaomeng Tong --- drivers/gpu/drm/stm/ltdc.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) Thanks for your fix Acked-by: Raphael Gallais-Pou Raphaël Gallais-Pou Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH] drm: sti: don't use kernel-doc markers
On 3/31/22 18:58, Philippe CORNU wrote: On 3/28/22 16:26, Daniel Vetter wrote: On Mon, Mar 28, 2022 at 12:21:16PM +0200, Alain Volmat wrote: Hi Randy, thanks for the patch. Acked-by: Alain Volmat Will Philippe apply this one? Hi, yes I will (probably early next week). Many thanks Philippe Applied on drm-misc-next. Many thanks for your patch, Philippe :-) Just trying to make sure this wont be lost, just acking isn't enough :-) -Daniel Alain On Sat, Mar 26, 2022 at 04:51:32PM -0700, Randy Dunlap wrote: Don't mark static functions as kernel-doc. Prevents multiple kernel-doc build warnings: drivers/gpu/drm/sti/sti_hdmi.c:187: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * HDMI interrupt handler threaded drivers/gpu/drm/sti/sti_hdmi.c:219: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * HDMI interrupt handler drivers/gpu/drm/sti/sti_hdmi.c:241: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Set hdmi active area depending on the drm display mode selected drivers/gpu/drm/sti/sti_hdmi.c:262: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Overall hdmi configuration drivers/gpu/drm/sti/sti_hdmi.c:340: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Helper to concatenate infoframe in 32 bits word drivers/gpu/drm/sti/sti_hdmi.c:357: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Helper to write info frame drivers/gpu/drm/sti/sti_hdmi.c:427: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Prepare and configure the AVI infoframe drivers/gpu/drm/sti/sti_hdmi.c:470: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Prepare and configure the AUDIO infoframe drivers/gpu/drm/sti/sti_hdmi.c:555: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Software reset of the hdmi subsystem Fixes: 5402626c83a2 ("drm: sti: add HDMI driver") Signed-off-by: Randy Dunlap Cc: Aditya Srivastava Cc: Benjamin Gaignard Cc: Alain Volmat Cc: David Airlie Cc: Daniel Vetter --- drivers/gpu/drm/sti/sti_hdmi.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) --- linux-next-20220325.orig/drivers/gpu/drm/sti/sti_hdmi.c +++ linux-next-20220325/drivers/gpu/drm/sti/sti_hdmi.c @@ -183,7 +183,7 @@ void hdmi_write(struct sti_hdmi *hdmi, u writel(val, hdmi->regs + offset); } -/** +/* * HDMI interrupt handler threaded * * @irq: irq number @@ -215,7 +215,7 @@ static irqreturn_t hdmi_irq_thread(int i return IRQ_HANDLED; } -/** +/* * HDMI interrupt handler * * @irq: irq number @@ -237,7 +237,7 @@ static irqreturn_t hdmi_irq(int irq, voi return IRQ_WAKE_THREAD; } -/** +/* * Set hdmi active area depending on the drm display mode selected * * @hdmi: pointer on the hdmi internal structure @@ -258,7 +258,7 @@ static void hdmi_active_area(struct sti_ hdmi_write(hdmi, ymax, HDMI_ACTIVE_VID_YMAX); } -/** +/* * Overall hdmi configuration * * @hdmi: pointer on the hdmi internal structure @@ -336,7 +336,7 @@ static void hdmi_infoframe_reset(struct hdmi_write(hdmi, 0x0, pack_offset + i); } -/** +/* * Helper to concatenate infoframe in 32 bits word * * @ptr: pointer on the hdmi internal structure @@ -353,7 +353,7 @@ static inline unsigned int hdmi_infofram return value; } -/** +/* * Helper to write info frame * * @hdmi: pointer on the hdmi internal structure @@ -423,7 +423,7 @@ static void hdmi_infoframe_write_infopac hdmi_write(hdmi, val, HDMI_SW_DI_CFG); } -/** +/* * Prepare and configure the AVI infoframe * * AVI infoframe are transmitted at least once per two video field and @@ -466,7 +466,7 @@ static int hdmi_avi_infoframe_config(str return 0; } -/** +/* * Prepare and configure the AUDIO infoframe * * AUDIO infoframe are transmitted once per frame and @@ -551,7 +551,7 @@ static int hdmi_vendor_infoframe_config( #define HDMI_TIMEOUT_SWRESET 100 /*milliseconds */ -/** +/* * Software reset of the hdmi subsystem * * @hdmi: pointer on the hdmi internal structure @@ -785,7 +785,7 @@ static void sti_hdmi_disable(struct drm_ cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID); } -/** +/* * sti_hdmi_audio_get_non_coherent_n() - get N parameter for non-coherent * clocks. None-coherent clocks means that audio and TMDS clocks have n
Re: [PATCH] drm: sti: don't use kernel-doc markers
On 3/28/22 16:26, Daniel Vetter wrote: On Mon, Mar 28, 2022 at 12:21:16PM +0200, Alain Volmat wrote: Hi Randy, thanks for the patch. Acked-by: Alain Volmat Will Philippe apply this one? Hi, yes I will (probably early next week). Many thanks Philippe Just trying to make sure this wont be lost, just acking isn't enough :-) -Daniel Alain On Sat, Mar 26, 2022 at 04:51:32PM -0700, Randy Dunlap wrote: Don't mark static functions as kernel-doc. Prevents multiple kernel-doc build warnings: drivers/gpu/drm/sti/sti_hdmi.c:187: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * HDMI interrupt handler threaded drivers/gpu/drm/sti/sti_hdmi.c:219: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * HDMI interrupt handler drivers/gpu/drm/sti/sti_hdmi.c:241: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Set hdmi active area depending on the drm display mode selected drivers/gpu/drm/sti/sti_hdmi.c:262: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Overall hdmi configuration drivers/gpu/drm/sti/sti_hdmi.c:340: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Helper to concatenate infoframe in 32 bits word drivers/gpu/drm/sti/sti_hdmi.c:357: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Helper to write info frame drivers/gpu/drm/sti/sti_hdmi.c:427: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Prepare and configure the AVI infoframe drivers/gpu/drm/sti/sti_hdmi.c:470: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Prepare and configure the AUDIO infoframe drivers/gpu/drm/sti/sti_hdmi.c:555: warning: This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst * Software reset of the hdmi subsystem Fixes: 5402626c83a2 ("drm: sti: add HDMI driver") Signed-off-by: Randy Dunlap Cc: Aditya Srivastava Cc: Benjamin Gaignard Cc: Alain Volmat Cc: David Airlie Cc: Daniel Vetter --- drivers/gpu/drm/sti/sti_hdmi.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) --- linux-next-20220325.orig/drivers/gpu/drm/sti/sti_hdmi.c +++ linux-next-20220325/drivers/gpu/drm/sti/sti_hdmi.c @@ -183,7 +183,7 @@ void hdmi_write(struct sti_hdmi *hdmi, u writel(val, hdmi->regs + offset); } -/** +/* * HDMI interrupt handler threaded * * @irq: irq number @@ -215,7 +215,7 @@ static irqreturn_t hdmi_irq_thread(int i return IRQ_HANDLED; } -/** +/* * HDMI interrupt handler * * @irq: irq number @@ -237,7 +237,7 @@ static irqreturn_t hdmi_irq(int irq, voi return IRQ_WAKE_THREAD; } -/** +/* * Set hdmi active area depending on the drm display mode selected * * @hdmi: pointer on the hdmi internal structure @@ -258,7 +258,7 @@ static void hdmi_active_area(struct sti_ hdmi_write(hdmi, ymax, HDMI_ACTIVE_VID_YMAX); } -/** +/* * Overall hdmi configuration * * @hdmi: pointer on the hdmi internal structure @@ -336,7 +336,7 @@ static void hdmi_infoframe_reset(struct hdmi_write(hdmi, 0x0, pack_offset + i); } -/** +/* * Helper to concatenate infoframe in 32 bits word * * @ptr: pointer on the hdmi internal structure @@ -353,7 +353,7 @@ static inline unsigned int hdmi_infofram return value; } -/** +/* * Helper to write info frame * * @hdmi: pointer on the hdmi internal structure @@ -423,7 +423,7 @@ static void hdmi_infoframe_write_infopac hdmi_write(hdmi, val, HDMI_SW_DI_CFG); } -/** +/* * Prepare and configure the AVI infoframe * * AVI infoframe are transmitted at least once per two video field and @@ -466,7 +466,7 @@ static int hdmi_avi_infoframe_config(str return 0; } -/** +/* * Prepare and configure the AUDIO infoframe * * AUDIO infoframe are transmitted once per frame and @@ -551,7 +551,7 @@ static int hdmi_vendor_infoframe_config( #define HDMI_TIMEOUT_SWRESET 100 /*milliseconds */ -/** +/* * Software reset of the hdmi subsystem * * @hdmi: pointer on the hdmi internal structure @@ -785,7 +785,7 @@ static void sti_hdmi_disable(struct drm_ cec_notifier_set_phys_addr(hdmi->notifier, CEC_PHYS_ADDR_INVALID); } -/** +/* * sti_hdmi_audio_get_non_coherent_n() - get N parameter for non-coherent * clocks. None-coherent clocks means that audio and TMDS clocks have not the * same source (drifts between clocks). In this case assumption is that CTS is
Re: [PATCH v2] drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config()
On 2/22/22 16:20, Nathan Chancellor wrote: Clang warns: drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~ drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here val |= LxPCR_YCEN; ^~~ drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning u32 val; ^ = 0 1 warning generated. Use a return instead of break in the default case to fix the warning. Add an error message so that this return is not silent, which could hide issues in the future. Fixes: 484e72d3146b ("drm/stm: ltdc: add support of ycbcr pixel formats") Link: https://github.com/ClangBuiltLinux/linux/issues/1575 Acked-by: Yannick Fertre Reviewed-by: Nick Desaulniers Reviewed-by: Raphael Gallais-Pou Signed-off-by: Nathan Chancellor --- v1 -> v2: https://lore.kernel.org/r/20220207165304.1046867-1-nat...@kernel.org/ * Use DRM_ERROR() instead of drm_err() (Philippe). Hi Nathan, Applied on drm-misc-next. Many thanks for your patch, Philippe :-) * Collect tags from v1, as nothing substantial has changed. drivers/gpu/drm/stm/ltdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 5eeb32c9c9ce..c9bc4ccb6d43 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -624,7 +624,8 @@ static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fm break; default: /* RGB or not a YCbCr supported format */ - break; + DRM_ERROR("Unsupported pixel format: %u\n", drm_pix_fmt); + return; } /* Enable limited range */ base-commit: 542898c5aa5c6a3179dffb1d1606884a63f75fed
Re: [PATCH] drm/stm: ltdc: add support for CRC hashing feature
On 2/11/22 11:46, Raphaël Gallais-Pou wrote: From: Raphael Gallais-Pou This patch adds the CRC hashing feature supported by some recent hardware versions of the LTDC. This is useful for test suite such as IGT-GPU-tools [1] where a CRTC output frame can be compared to a test reference frame thanks to their respective CRC hash. [1] https://cgit.freedesktop.org/drm/igt-gpu-tools Signed-off-by: Raphael Gallais-Pou Applied on drm-misc-next. Many thanks for your patch, Philippe :-) --- drivers/gpu/drm/stm/ltdc.c | 104 +++-- drivers/gpu/drm/stm/ltdc.h | 3 ++ 2 files changed, 104 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 5eeb32c9c9ce..b29476aec3a1 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -77,6 +77,7 @@ #define LTDC_CPSR 0x0044 /* Current Position Status */ #define LTDC_CDSR 0x0048 /* Current Display Status */ #define LTDC_EDCR 0x0060 /* External Display Control */ +#define LTDC_CCRCR 0x007C /* Computed CRC value */ #define LTDC_FUT 0x0090 /* Fifo underrun Threshold */ /* Layer register offsets */ @@ -121,6 +122,7 @@ #define GCR_LTDCEN BIT(0) /* LTDC ENable */ #define GCR_DEN BIT(16) /* Dither ENable */ +#define GCR_CRCEN BIT(19) /* CRC ENable */ #define GCR_PCPOL BIT(28) /* Pixel Clock POLarity-Inverted */ #define GCR_DEPOL BIT(29) /* Data Enable POLarity-High */ #define GCR_VSPOL BIT(30) /* Vertical Synchro POLarity-High */ @@ -227,6 +229,13 @@ #define NB_PF 8 /* Max nb of HW pixel format */ +/* + * Skip the first value and the second in case CRC was enabled during + * the thread irq. This is to be sure CRC value is relevant for the + * frame. + */ +#define CRC_SKIP_FRAMES 2 + enum ltdc_pix_fmt { PF_NONE, /* RGB formats */ @@ -664,6 +673,26 @@ static inline void ltdc_set_ycbcr_coeffs(struct drm_plane *plane) ltdc_ycbcr2rgb_coeffs[enc][ran][1]); } +static inline void ltdc_irq_crc_handle(struct ltdc_device *ldev, + struct drm_crtc *crtc) +{ + u32 crc; + int ret; + + if (ldev->crc_skip_count < CRC_SKIP_FRAMES) { + ldev->crc_skip_count++; + return; + } + + /* Get the CRC of the frame */ + ret = regmap_read(ldev->regmap, LTDC_CCRCR, ); + if (ret) + return; + + /* Report to DRM the CRC (hw dependent feature) */ + drm_crtc_add_crc_entry(crtc, true, drm_crtc_accurate_vblank_count(crtc), ); +} + static irqreturn_t ltdc_irq_thread(int irq, void *arg) { struct drm_device *ddev = arg; @@ -671,9 +700,14 @@ static irqreturn_t ltdc_irq_thread(int irq, void *arg) struct drm_crtc *crtc = drm_crtc_from_index(ddev, 0); /* Line IRQ : trigger the vblank event */ - if (ldev->irq_status & ISR_LIF) + if (ldev->irq_status & ISR_LIF) { drm_crtc_handle_vblank(crtc); + /* Early return if CRC is not active */ + if (ldev->crc_active) + ltdc_irq_crc_handle(ldev, crtc); + } + /* Save FIFO Underrun & Transfer Error status */ mutex_lock(>err_lock); if (ldev->irq_status & ISR_FUIF) @@ -1079,6 +1113,48 @@ static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc) regmap_clear_bits(ldev->regmap, LTDC_IER, IER_LIE); } +static int ltdc_crtc_set_crc_source(struct drm_crtc *crtc, const char *source) +{ + struct ltdc_device *ldev = crtc_to_ltdc(crtc); + int ret; + + DRM_DEBUG_DRIVER("\n"); + + if (!crtc) + return -ENODEV; + + if (source && strcmp(source, "auto") == 0) { + ldev->crc_active = true; + ret = regmap_set_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN); + } else if (!source) { + ldev->crc_active = false; + ret = regmap_clear_bits(ldev->regmap, LTDC_GCR, GCR_CRCEN); + } else { + ret = -EINVAL; + } + + ldev->crc_skip_count = 0; + return ret; +} + +static int ltdc_crtc_verify_crc_source(struct drm_crtc *crtc, + const char *source, size_t *values_cnt) +{ + DRM_DEBUG_DRIVER("\n"); + + if (!crtc) + return -ENODEV; + + if (source && strcmp(source, "auto") != 0) { + DRM_DEBUG_DRIVER("Unknown CRC source %s for %s\n", +source, crtc->name); + return -EINVAL; + } + + *values_cnt = 1; + return 0; +} + static const struct drm_crtc_funcs ltdc_crtc_funcs = { .destroy = drm_crtc_cleanup, .set_config = drm_atomic_helper_set_config, @@ -1091,6 +1167,20 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = {
Re: [PATCH] drm/stm: Avoid using val uninitialized in ltdc_set_ycbcr_config()
On 2/7/22 8:44 PM, Nick Desaulniers wrote: On Mon, Feb 7, 2022 at 8:53 AM Nathan Chancellor wrote: Clang warns: drivers/gpu/drm/stm/ltdc.c:625:2: warning: variable 'val' is used uninitialized whenever switch default is taken [-Wsometimes-uninitialized] default: ^~~ drivers/gpu/drm/stm/ltdc.c:635:2: note: uninitialized use occurs here val |= LxPCR_YCEN; ^~~ drivers/gpu/drm/stm/ltdc.c:600:9: note: initialize the variable 'val' to silence this warning u32 val; ^ = 0 1 warning generated. Use a return instead of break in the default case to fix the warning. Add an error message so that this return is not silent, which could hide issues in the future. Fixes: 484e72d3146b ("drm/stm: ltdc: add support of ycbcr pixel formats") Link: https://github.com/ClangBuiltLinux/linux/issues/1575 Signed-off-by: Nathan Chancellor --- drivers/gpu/drm/stm/ltdc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 5eeb32c9c9ce..447ddde1786c 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -624,7 +624,8 @@ static inline void ltdc_set_ycbcr_config(struct drm_plane *plane, u32 drm_pix_fm break; default: /* RGB or not a YCbCr supported format */ - break; + drm_err(plane->dev, "Unsupported pixel format: %u\n", drm_pix_fmt); This is fine, but in the future you should add an explicit #include to avoid implicit header dependencies (like the ones that Mingo is trying to detangle) for the declaration of drm_err. `drm_vprintf` needs it, too. Reviewed-by: Nick Desaulniers Hi Nick, and thank you for having pointing this. Hi Nathan, May I ask you please to update your patch changing drm_err(plane->dev, ) with DRM_ERROR(). Big thank you, Philippe :-) + return; } /* Enable limited range */ base-commit: 542898c5aa5c6a3179dffb1d1606884a63f75fed -- 2.35.1
Re: [PATCH 17/23] drm/sti: plane: Remove redundant zpos initialisation
On 2/7/22 5:35 PM, Maxime Ripard wrote: The sti KMS driver will call drm_plane_create_zpos_property() with an init value depending on the plane type. Since the initial value wasn't carried over in the state, the driver had to set it again in sti_plane_reset() and rcar_du_vsp_plane_reset(). Hi Maxime, and many thanks for your patches. Great you added Alain as he is now the drm/sti maintainer (Maintainers file should be updated soon) Minor typo in the commit message as rcar_du_vsp_plane_reset() is not part of drm/sti Reviewed-by: Philippe Cornu Philippe :-) However, the helpers have been adjusted to set it properly at reset, so this is not needed anymore. Cc: Alain Volmat Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sti/sti_cursor.c | 2 +- drivers/gpu/drm/sti/sti_gdp.c| 2 +- drivers/gpu/drm/sti/sti_hqvdp.c | 2 +- drivers/gpu/drm/sti/sti_plane.c | 6 -- drivers/gpu/drm/sti/sti_plane.h | 1 - 5 files changed, 3 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_cursor.c b/drivers/gpu/drm/sti/sti_cursor.c index 1d6051b4f6fe..414c9973aa6d 100644 --- a/drivers/gpu/drm/sti/sti_cursor.c +++ b/drivers/gpu/drm/sti/sti_cursor.c @@ -351,7 +351,7 @@ static const struct drm_plane_funcs sti_cursor_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = sti_plane_reset, + .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .late_register = sti_cursor_late_register, diff --git a/drivers/gpu/drm/sti/sti_gdp.c b/drivers/gpu/drm/sti/sti_gdp.c index d1a35d97bc45..3db3768a3241 100644 --- a/drivers/gpu/drm/sti/sti_gdp.c +++ b/drivers/gpu/drm/sti/sti_gdp.c @@ -905,7 +905,7 @@ static const struct drm_plane_funcs sti_gdp_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = sti_plane_reset, + .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .late_register = sti_gdp_late_register, diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index 3c61ba8b43e0..2201a50353eb 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -1283,7 +1283,7 @@ static const struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = { .update_plane = drm_atomic_helper_update_plane, .disable_plane = drm_atomic_helper_disable_plane, .destroy = drm_plane_cleanup, - .reset = sti_plane_reset, + .reset = drm_atomic_helper_plane_reset, .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, .late_register = sti_hqvdp_late_register, diff --git a/drivers/gpu/drm/sti/sti_plane.c b/drivers/gpu/drm/sti/sti_plane.c index 3da4a46df2f2..173409cdb99e 100644 --- a/drivers/gpu/drm/sti/sti_plane.c +++ b/drivers/gpu/drm/sti/sti_plane.c @@ -112,12 +112,6 @@ static int sti_plane_get_default_zpos(enum drm_plane_type type) return 0; } -void sti_plane_reset(struct drm_plane *plane) -{ - drm_atomic_helper_plane_reset(plane); - plane->state->zpos = sti_plane_get_default_zpos(plane->type); -} - static void sti_plane_attach_zorder_property(struct drm_plane *drm_plane, enum drm_plane_type type) { diff --git a/drivers/gpu/drm/sti/sti_plane.h b/drivers/gpu/drm/sti/sti_plane.h index 065bfb4a..8e33e629d9b0 100644 --- a/drivers/gpu/drm/sti/sti_plane.h +++ b/drivers/gpu/drm/sti/sti_plane.h @@ -81,5 +81,4 @@ void sti_plane_update_fps(struct sti_plane *plane, void sti_plane_init_property(struct sti_plane *plane, enum drm_plane_type type); -void sti_plane_reset(struct drm_plane *plane); #endif
Re: [PATCH 1/2] MAINTAINERS: Update Benjamin Gaignard maintainer status
On 1/14/22 1:45 AM, Arnd Bergmann wrote: On Thu, Jan 13, 2022 at 6:19 PM Philippe Cornu wrote: DRM DRIVERS FOR STI -M: Benjamin Gaignard L: dri-devel@lists.freedesktop.org S: Maintained T: git git://anongit.freedesktop.org/drm/drm-misc If there is no longer a maintainer, I suppose it should also be marked as S: Orphaned Arnd Hi Arnd, I sent a serie of 2 patches containing first the original/unmodified patch from Benjamin (see [1]) + a new patch to avoid this "orphaned driver" situation. Many thanks Philippe :-) [1] https://lore.kernel.org/lkml/20210706163033.795805-1-benjamin.gaign...@collabora.com/
Re: [PATCH 1/2] MAINTAINERS: Update Benjamin Gaignard maintainer status
On 1/13/22 6:19 PM, Philippe Cornu wrote: From: Benjamin Gaignard Update Benjamin Gaignard address and remove it from no more maintained drivers. Signed-off-by: Benjamin Gaignard --- MAINTAINERS | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7a2345ce8521..6bea080d0159 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5702,7 +5702,7 @@ F:tools/testing/selftests/dma/ DMA-BUF HEAPS FRAMEWORK M:Sumit Semwal -R: Benjamin Gaignard +R: Benjamin Gaignard R:Liam Mark R:Laura Abbott R:Brian Starkey @@ -6423,7 +6423,6 @@ F: Documentation/devicetree/bindings/display/rockchip/ F:drivers/gpu/drm/rockchip/ DRM DRIVERS FOR STI -M: Benjamin Gaignard L:dri-devel@lists.freedesktop.org S:Maintained T:git git://anongit.freedesktop.org/drm/drm-misc @@ -6433,7 +6432,6 @@ F:drivers/gpu/drm/sti DRM DRIVERS FOR STM M:Yannick Fertre M:Philippe Cornu -M: Benjamin Gaignard L:dri-devel@lists.freedesktop.org S:Maintained T:git git://anongit.freedesktop.org/drm/drm-misc @@ -18154,7 +18152,6 @@ F: Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt F:sound/soc/sti/ STI CEC DRIVER -M: Benjamin Gaignard S:Maintained F:Documentation/devicetree/bindings/media/stih-cec.txt F:drivers/media/cec/platform/sti/ Adding my r-b as already done in the original post from Benjamin (see https://lore.kernel.org/lkml/20210706163033.795805-1-benjamin.gaign...@collabora.com/) Reviewed-by: Philippe Cornu Thank you Philippe :-)
[PATCH 2/2] MAINTAINERS: update drm/stm drm/sti and cec/sti maintainers
Add Alain as sti maintainer for both drm/sti & cec/sti. Add Raphaël as stm maintainer for drm/stm. Signed-off-by: Philippe Cornu --- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 6bea080d0159..708f8c86e4c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6423,6 +6423,7 @@ F: Documentation/devicetree/bindings/display/rockchip/ F: drivers/gpu/drm/rockchip/ DRM DRIVERS FOR STI +M: Alain Volmat L: dri-devel@lists.freedesktop.org S: Maintained T: git git://anongit.freedesktop.org/drm/drm-misc @@ -6431,6 +6432,7 @@ F:drivers/gpu/drm/sti DRM DRIVERS FOR STM M: Yannick Fertre +M: Raphael Gallais-Pou M: Philippe Cornu L: dri-devel@lists.freedesktop.org S: Maintained @@ -18152,6 +18154,7 @@ F: Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt F: sound/soc/sti/ STI CEC DRIVER +M: Alain Volmat S: Maintained F: Documentation/devicetree/bindings/media/stih-cec.txt F: drivers/media/cec/platform/sti/ -- 2.17.1
[PATCH 1/2] MAINTAINERS: Update Benjamin Gaignard maintainer status
From: Benjamin Gaignard Update Benjamin Gaignard address and remove it from no more maintained drivers. Signed-off-by: Benjamin Gaignard --- MAINTAINERS | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7a2345ce8521..6bea080d0159 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5702,7 +5702,7 @@ F:tools/testing/selftests/dma/ DMA-BUF HEAPS FRAMEWORK M: Sumit Semwal -R: Benjamin Gaignard +R: Benjamin Gaignard R: Liam Mark R: Laura Abbott R: Brian Starkey @@ -6423,7 +6423,6 @@ F: Documentation/devicetree/bindings/display/rockchip/ F: drivers/gpu/drm/rockchip/ DRM DRIVERS FOR STI -M: Benjamin Gaignard L: dri-devel@lists.freedesktop.org S: Maintained T: git git://anongit.freedesktop.org/drm/drm-misc @@ -6433,7 +6432,6 @@ F:drivers/gpu/drm/sti DRM DRIVERS FOR STM M: Yannick Fertre M: Philippe Cornu -M: Benjamin Gaignard L: dri-devel@lists.freedesktop.org S: Maintained T: git git://anongit.freedesktop.org/drm/drm-misc @@ -18154,7 +18152,6 @@ F: Documentation/devicetree/bindings/sound/st,sti-asoc-card.txt F: sound/soc/sti/ STI CEC DRIVER -M: Benjamin Gaignard S: Maintained F: Documentation/devicetree/bindings/media/stih-cec.txt F: drivers/media/cec/platform/sti/ -- 2.17.1
[PATCH 0/2] MAINTAINERS: update various stm & sti maintainer names
This short serie contains the maintainer status update sent recently by Benjamin Gaignard (see [1] for details) and add new maintainers for various stm & sti files. [1] https://lore.kernel.org/lkml/20210706163033.795805-1-benjamin.gaign...@collabora.com/ Benjamin Gaignard (1): MAINTAINERS: Update Benjamin Gaignard maintainer status Philippe Cornu (1): MAINTAINERS: update drm/stm drm/sti and cec/sti maintainers MAINTAINERS | 8 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.17.1
Re: [PATCH 0/5] drm/stm: new features to display controller
On 12/15/21 10:46 PM, Yannick Fertre wrote: Hello, List of new feature: * Replace the legacy register access by regmap API. * Support of YCbCr 422 output * Update layer shadow registers per plane. * Support of YCbCr output (planar, semiplanar & coplanar) These featues are available only with last hardware version of ltdc (0x401000) link to patch"drm/stm: ltdc: support of new hardware version" (https://patchwork.freedesktop.org/patch/465207). Yannick Fertre (5): drm/stm: ltdc: switch to regmap drm/stm: ltdc: add YCbCr 422 output support drm/stm: ltdc: add per plane update support drm/stm: ltdc: add support of flexible pixel formats drm/stm: ltdc: add support of ycbcr pixel formats drivers/gpu/drm/stm/ltdc.c | 639 + drivers/gpu/drm/stm/ltdc.h | 9 +- 2 files changed, 518 insertions(+), 130 deletions(-) Hi Yannick, for the entire serie, Applied on drm-misc-next. Many thanks for your patches, Philippe :-)
Re: [PATCH v3 2/6] drm/plane: Fix typo in format_mod_supported documentation
On 1/7/22 6:26 PM, José Expósito wrote: Hi Simon, On Wed, Jan 05, 2022 at 11:54:43PM +, Simon Ser wrote: Pushed patches 1 & 2 to drm-misc-next. Thanks for your contribution! Thanks a lot for the review and for applying the changes, appreciate it. Is there something that needs to improve in the other 4 patches? Or just waiting on maintainers input? Thanks, José Expósito Hi José, for the drm/stm part, Applied on drm-misc-next. Many thanks for your patches, Philippe :-)
Re: [PATCH] drm/stm: ltdc: support of new hardware version
On 12/14/21 11:19 AM, Philippe CORNU wrote: On 12/3/21 9:56 AM, Yannick Fertre wrote: Add support of new hardware version 0x40100. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 172 ++--- drivers/gpu/drm/stm/ltdc.h | 3 +- 2 files changed, 145 insertions(+), 30 deletions(-) Hi Yannick, This looks great, many thanks for your patch. Acked-by: Philippe Cornu Philippe :-) Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH] drm/stm: remove conflicting framebuffers
On 12/14/21 11:15 AM, Philippe CORNU wrote: On 12/6/21 3:23 PM, Thomas Zimmermann wrote: Hi Am 06.12.21 um 14:47 schrieb Yannick Fertre: In case of using simplefb or another conflicting framebuffer, call drm_aperture_remove_framebuffers() to remove memory allocated. Signed-off-by: Yannick Fertre The patch should have contained a note that this is version 2 of the change with a short changelog. Anyway Reviewed-by: Thomas Zimmermann Best regards Thomas --- drivers/gpu/drm/stm/drv.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 222869b232ae..9f441aadf2d5 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -183,6 +184,10 @@ static int stm_drm_platform_probe(struct platform_device *pdev) DRM_DEBUG("%s\n", __func__); + ret = drm_aperture_remove_framebuffers(false, _driver); + if (ret) + return ret; + Hi Yannick, and many thanks for your patch. Acked-by: Philippe Cornu Philippe :-) dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); ddev = drm_dev_alloc(_driver, dev); Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH 3/3] drm/stm: dsi: provide the implementation of mode_valid()
On 12/18/21 10:50 PM, Antonio Borneo wrote: The dsi has several constraints on the video modes it can support, mainly due to the frequencies that can be generated by the PLL integrated in the DSI device. Verify that the required HS clock can be generated by the PLL. The dsi clock from the dsi PLL and the ltdc pixel clock are asynchronous. The dsi needs to return in LP mode during HFP or HBP to re-synchronize at each video line. Verify that the duration of HFP and HBP allows the dsi to enter in LP mode. Signed-off-by: Antonio Borneo --- To: David Airlie To: Daniel Vetter To: Andrzej Hajda To: Neil Armstrong To: Robert Foss To: Laurent Pinchart To: Jonas Karlman To: Jernej Skrabec To: Yannick Fertre To: Philippe Cornu To: Benjamin Gaignard To: Maxime Coquelin To: Alexandre Torgue To: Philipp Zabel To: dri-devel@lists.freedesktop.org To: linux-st...@st-md-mailman.stormreply.com To: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 98 +++ 1 file changed, 98 insertions(+) Hi Antonio, many thanks for your patch. Nice improvement for better filtering supported modes... Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 2/3] drm/bridge/synopsys: dsi: extend the prototype of mode_valid()
On 12/18/21 10:50 PM, Antonio Borneo wrote: To evaluate the validity of a video mode, some additional internal value has to be passed to the platform implementation. Extend the prototype of mode_valid(). Signed-off-by: Antonio Borneo --- To: David Airlie To: Daniel Vetter To: Andrzej Hajda To: Neil Armstrong To: Robert Foss To: Laurent Pinchart To: Jonas Karlman To: Jernej Skrabec To: Yannick Fertre To: Philippe Cornu To: Benjamin Gaignard To: Maxime Coquelin To: Alexandre Torgue To: Philipp Zabel To: dri-devel@lists.freedesktop.org To: linux-st...@st-md-mailman.stormreply.com To: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org --- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 5 - include/drm/bridge/dw_mipi_dsi.h | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) Hi Antonio, many thanks for your patch. (I should have done like that from the beginning as validating a mode in dsi requires dsi related information...) Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 1/3] drm/stm: dsi: move lane capability detection in probe()
On 12/18/21 10:50 PM, Antonio Borneo wrote: There is no need to re-compute the dsi lane capability because it only depends on dsi hw version. Since dsi hw version is detected at probe(), move there also the assignment of dsi lane capability. Signed-off-by: Antonio Borneo --- To: David Airlie To: Daniel Vetter To: Andrzej Hajda To: Neil Armstrong To: Robert Foss To: Laurent Pinchart To: Jonas Karlman To: Jernej Skrabec To: Yannick Fertre To: Philippe Cornu To: Benjamin Gaignard To: Maxime Coquelin To: Alexandre Torgue To: Philipp Zabel To: dri-devel@lists.freedesktop.org To: linux-st...@st-md-mailman.stormreply.com To: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) Hi Antonio, many thanks for your patch. Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 5/5] drm/stm: ltdc: add support of ycbcr pixel formats
On 12/15/21 10:48 PM, Yannick Fertre wrote: This patch adds the following YCbCr input pixel formats on the latest LTDC hardware version: 1 plane (co-planar) : YUYV, YVYU, UYVY, VYUY 2 planes (semi-planar): NV12, NV21 3 planes (full-planar): YU12=I420=DRM YUV420, YV12=DRM YVU420 Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 251 +++-- drivers/gpu/drm/stm/ltdc.h | 1 + 2 files changed, 245 insertions(+), 7 deletions(-) Hi Yannick, many thanks for your patch. Nice hw features! Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 4/5] drm/stm: ltdc: add support of flexible pixel formats
On 12/15/21 10:48 PM, Yannick Fertre wrote: This feature allows the generation of any RGB pixel format. The list of supported formats is no longer linked to the register LXPFCR_PF, that the reason why a list of drm formats is defined for each display controller version. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 196 ++--- drivers/gpu/drm/stm/ltdc.h | 5 +- 2 files changed, 145 insertions(+), 56 deletions(-) Hi Yannick, many thanks for your patch. Nice hw feature. Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 3/5] drm/stm: ltdc: add per plane update support
On 12/15/21 10:48 PM, Yannick Fertre wrote: Recent ltdc hardware versions offer the ability to update a plane independently of others planes. This is could be useful especially if a plane is assigned to another OS. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 26 +++--- drivers/gpu/drm/stm/ltdc.h | 1 + 2 files changed, 24 insertions(+), 3 deletions(-) Hi Yannick, many thanks for your patch. Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 2/5] drm/stm: ltdc: add YCbCr 422 output support
On 12/15/21 10:47 PM, Yannick Fertre wrote: LTDC 40100 hw version supports the YCbCr 422 output, reducing the output pins from 24 to 16. This feature is useful for some external devices like HDMI bridges. Both ITU-R BT.601 & ITU-R BT.709 are supported. It is also possible to choose the chrominance order between * Cb is output first (Y0Cb, then Y1Cr, Y2Cb and so on). * Cr is output first (Y0Cr, then Y1Cb, Y2Cr and so on). Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 44 +- drivers/gpu/drm/stm/ltdc.h | 1 + 2 files changed, 44 insertions(+), 1 deletion(-) Hi Yannick, many thanks for your patch. Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH 1/5] drm/stm: ltdc: switch to regmap
On 12/15/21 10:47 PM, Yannick Fertre wrote: Replace the legacy register access by regmap API. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 138 ++--- drivers/gpu/drm/stm/ltdc.h | 1 + 2 files changed, 68 insertions(+), 71 deletions(-) Hi Yannick, many thanks for your patch. Acked-by: Philippe Cornu Reviewed-by: Philippe Cornu Philippe :-)
Re: [PATCH] drm/stm: ltdc: support of new hardware version
/ + 0x144, /* L1 auxiliary frame buffer address 1 */ + 0x148, /* L1 auxiliary frame buffer length */ + 0x14c, /* L1 auxiliary frame buffer line number */ + 0x150, /* L1 CLUT write */ + 0x16c, /* L1 Conversion YCbCr RGB 0 */ + 0x170, /* L1 Conversion YCbCr RGB 1 */ + 0x174, /* L1 Flexible Pixel Format 0 */ + 0x178 /* L1 Flexible Pixel Format 1 */ +}; + static const u64 ltdc_format_modifiers[] = { DRM_FORMAT_MOD_LINEAR, DRM_FORMAT_MOD_INVALID @@ -1158,7 +1262,8 @@ static int ltdc_get_caps(struct drm_device *ddev) switch (ldev->caps.hw_version) { case HWVER_10200: case HWVER_10300: - ldev->caps.reg_ofs = REG_OFS_NONE; + ldev->caps.layer_ofs = LAY_OFS_0; + ldev->caps.layer_regs = ltdc_layer_regs_a0; ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a0; /* * Hw older versions support non-alpha color formats derived @@ -1174,12 +1279,21 @@ static int ltdc_get_caps(struct drm_device *ddev) ldev->caps.nb_irq = 2; break; case HWVER_20101: - ldev->caps.reg_ofs = REG_OFS_4; + ldev->caps.layer_ofs = LAY_OFS_0; + ldev->caps.layer_regs = ltdc_layer_regs_a1; ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1; ldev->caps.non_alpha_only_l1 = false; ldev->caps.pad_max_freq_hz = 15000; ldev->caps.nb_irq = 4; break; + case HWVER_40100: + ldev->caps.layer_ofs = LAY_OFS_1; + ldev->caps.layer_regs = ltdc_layer_regs_a2; + ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a2; + ldev->caps.non_alpha_only_l1 = false; + ldev->caps.pad_max_freq_hz = 9000; + ldev->caps.nb_irq = 2; + break; default: return -ENODEV; } diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h index f153b908c70e..55a125f89af6 100644 --- a/drivers/gpu/drm/stm/ltdc.h +++ b/drivers/gpu/drm/stm/ltdc.h @@ -14,7 +14,8 @@ struct ltdc_caps { u32 hw_version; /* hardware version */ u32 nb_layers; /* number of supported layers */ - u32 reg_ofs;/* register offset for applicable regs */ + u32 layer_ofs; /* layer offset for applicable regs */ + const u32 *layer_regs; /* layer register offset */ u32 bus_width; /* bus width (32 or 64 bits) */ const u32 *pix_fmt_hw; /* supported pixel formats */ bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ Hi Yannick, This looks great, many thanks for your patch. Acked-by: Philippe Cornu Philippe :-)
Re: [PATCH] drm/stm: remove conflicting framebuffers
On 12/6/21 3:23 PM, Thomas Zimmermann wrote: Hi Am 06.12.21 um 14:47 schrieb Yannick Fertre: In case of using simplefb or another conflicting framebuffer, call drm_aperture_remove_framebuffers() to remove memory allocated. Signed-off-by: Yannick Fertre The patch should have contained a note that this is version 2 of the change with a short changelog. Anyway Reviewed-by: Thomas Zimmermann Best regards Thomas --- drivers/gpu/drm/stm/drv.c | 5 + 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c index 222869b232ae..9f441aadf2d5 100644 --- a/drivers/gpu/drm/stm/drv.c +++ b/drivers/gpu/drm/stm/drv.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -183,6 +184,10 @@ static int stm_drm_platform_probe(struct platform_device *pdev) DRM_DEBUG("%s\n", __func__); + ret = drm_aperture_remove_framebuffers(false, _driver); + if (ret) + return ret; + Hi Yannick, and many thanks for your patch. Acked-by: Philippe Cornu Philippe :-) dma_set_coherent_mask(dev, DMA_BIT_MASK(32)); ddev = drm_dev_alloc(_driver, dev);
Re: [PATCH v2] drm/stm: ltdc: add layer alpha support
On 9/7/21 5:15 PM, Raphael Gallais-Pou wrote: Android Hardware Composer supports alpha values applied to layers. Enabling non-opaque layers for the STM CRTC could help offload GPU resources for screen composition. Signed-off-by: Raphael Gallais-Pou Acked-by: Yannick Fertre Reviewed-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 195de30eb90c..e0fef8bacfa8 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -845,7 +845,7 @@ static void ltdc_plane_atomic_update(struct drm_plane *plane, LXCFBLR_CFBLL | LXCFBLR_CFBP, val); /* Specifies the constant alpha value */ - val = CONSTA_MAX; + val = newstate->alpha >> 8; reg_update_bits(ldev->regs, LTDC_L1CACR + lofs, LXCACR_CONSTA, val); /* Specifies the blending factors */ @@ -997,6 +997,8 @@ static struct drm_plane *ltdc_plane_create(struct drm_device *ddev, drm_plane_helper_add(plane, _plane_helper_funcs); + drm_plane_create_alpha_property(plane); + DRM_DEBUG_DRIVER("plane:%d created\n", plane->base.id); return plane; Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH v2] drm/stm: ltdc: attach immutable zpos property to planes
On 9/7/21 5:13 PM, Raphael Gallais-Pou wrote: Defines plane ordering by hard-coding an immutable Z position from the first plane, used as primary layer, to the next ones as overlay in order of instantiation. This zpos is only an information as it is not possible to modify it, blending operations are still applied from the top to the bottom layer. This patch helps to remove a warning message from the Android Hardware Composer. Signed-off-by: Raphael Gallais-Pou Acked-by: Yannick Fertre Reviewed-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 195de30eb90c..bd603ef5e935 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1024,6 +1024,8 @@ static int ltdc_crtc_init(struct drm_device *ddev, struct drm_crtc *crtc) return -EINVAL; } + drm_plane_create_zpos_immutable_property(primary, 0); + ret = drm_crtc_init_with_planes(ddev, crtc, primary, NULL, _crtc_funcs, NULL); if (ret) { @@ -1046,6 +1048,7 @@ static int ltdc_crtc_init(struct drm_device *ddev, struct drm_crtc *crtc) DRM_ERROR("Can not create overlay plane %d\n", i); goto cleanup; } + drm_plane_create_zpos_immutable_property(overlay, i); } return 0; Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH 5/7] drm/sti: Enable COMPILE_TEST on all ARM and ARM64 platforms
On 7/28/21 5:37 PM, Laurent Pinchart wrote: To extend test coverage, relax the dependency on ARCH_STI or ARCH_MULTIPLATFORM to also enable compilation on ARM or ARM4 when Hi Laurent, Looping Benjamin (new email address) and Alain (future maintainer of drm/sti). minor typo (ARM4 -> ARM64) Reviewed-by: Philippe Cornu Many thanks for your patch, Philippe :-) COMPILE_TEST is selected. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/sti/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig index d0cfdd36b38f..e7d18893bc11 100644 --- a/drivers/gpu/drm/sti/Kconfig +++ b/drivers/gpu/drm/sti/Kconfig @@ -1,7 +1,8 @@ # SPDX-License-Identifier: GPL-2.0-only config DRM_STI tristate "DRM Support for STMicroelectronics SoC stiH4xx Series" - depends on OF && DRM && (ARCH_STI || ARCH_MULTIPLATFORM) + depends on OF && DRM + depends on ARCH_STI || ARCH_MULTIPLATFORM || ((ARM || ARM64) && COMPILE_TEST) select RESET_CONTROLLER select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER
Re: [PATCH 2/7] drm/sti: Use correct printk format specifiers for size_t
On 7/28/21 5:37 PM, Laurent Pinchart wrote: The correct format specifier for size_t is %zu. Using %d (or %u) generates a warning on 64-bit platforms. Fix it. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/sti/sti_hqvdp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hqvdp.c b/drivers/gpu/drm/sti/sti_hqvdp.c index d09b08995b12..3c61ba8b43e0 100644 --- a/drivers/gpu/drm/sti/sti_hqvdp.c +++ b/drivers/gpu/drm/sti/sti_hqvdp.c @@ -927,12 +927,12 @@ static void sti_hqvdp_start_xp70(struct sti_hqvdp *hqvdp) header = (struct fw_header *)firmware->data; if (firmware->size < sizeof(*header)) { - DRM_ERROR("Invalid firmware size (%d)\n", firmware->size); + DRM_ERROR("Invalid firmware size (%zu)\n", firmware->size); goto out; } if ((sizeof(*header) + header->rd_size + header->wr_size + header->pmem_size + header->dmem_size) != firmware->size) { - DRM_ERROR("Invalid fmw structure (%d+%d+%d+%d+%d != %d)\n", + DRM_ERROR("Invalid fmw structure (%zu+%d+%d+%d+%d != %zu)\n", Hi Laurent, Looping Benjamin (new email address) and Alain (future maintainer of drm/sti). Reviewed-by: Philippe Cornu Many thanks for your patch, Philippe :-) sizeof(*header), header->rd_size, header->wr_size, header->pmem_size, header->dmem_size, firmware->size);
Re: [PATCH] drm/stm: dsi: compute the transition time from LP to HS and back
On 7/13/21 6:47 PM, Philippe CORNU wrote: Hi Antonio, On 7/13/21 4:49 PM, Antonio Borneo wrote: The driver uses a conservative set of hardcoded values for the maximum time delay of the transitions between LP and HS, either for data and clock lanes. By using the info in STM32MP157 datasheet, valid also for other ST devices, compute the actual delay from the lane's bps. Signed-off-by: Antonio Borneo --- To: Yannick Fertre To: Philippe Cornu To: Benjamin Gaignard To: David Airlie To: Daniel Vetter To: Maxime Coquelin To: Alexandre Torgue To: Raphael Gallais-Pou To: dri-devel@lists.freedesktop.org To: linux-st...@st-md-mailman.stormreply.com To: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 8399d337589d..32cb41b2202f 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -309,14 +309,23 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, return 0; } +#define DSI_PHY_DELAY(fp, vp, mbps) DIV_ROUND_UP((fp) * (mbps) + 1000 * (vp), 8000) + static int dw_mipi_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, struct dw_mipi_dsi_dphy_timing *timing) { - timing->clk_hs2lp = 0x40; - timing->clk_lp2hs = 0x40; - timing->data_hs2lp = 0x40; - timing->data_lp2hs = 0x40; + /* + * From STM32MP157 datasheet, valid for STM32F469, STM32F7x9, STM32H747 + * phy_clkhs2lp_time = (272+136*UI)/(8*UI) + * phy_clklp2hs_time = (512+40*UI)/(8*UI) + * phy_hs2lp_time = (192+64*UI)/(8*UI) + * phy_lp2hs_time = (256+32*UI)/(8*UI) + */ + timing->clk_hs2lp = DSI_PHY_DELAY(272, 136, lane_mbps); + timing->clk_lp2hs = DSI_PHY_DELAY(512, 40, lane_mbps); + timing->data_hs2lp = DSI_PHY_DELAY(192, 64, lane_mbps); + timing->data_lp2hs = DSI_PHY_DELAY(256, 32, lane_mbps); Many thanks for your patch. Reviewed-by: Philippe Cornu Acked-by: Philippe Cornu I will apply it on drm-misc-next early next week, Philippe :-) return 0; } base-commit: 35d283658a6196b2057be562096610c6793e1219 Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH] drm/stm: ltdc: Silence -EPROBE_DEFER till bridge attached
On 7/13/21 6:43 PM, Philippe CORNU wrote: Hi Jagan, On 7/4/21 3:59 PM, Jagan Teki wrote: As dw-mipi-dsi supported all possible ways to find the DSI devices. It can take multiple iterations for ltdc to find all components attached to the DSI bridge. The current ltdc driver failed to find the endpoint as it returned -EINVAL for the first iteration itself. This leads to following error: [ 3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0 So, check the return value and cleanup the encoder only if it's not -EPROBE_DEFER. This make all components in the attached DSI bridge found properly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/stm/ltdc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 08b71248044d..95e983d3ffb5 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1122,8 +1122,9 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge) ret = drm_bridge_attach(encoder, bridge, NULL, 0); if (ret) { - drm_encoder_cleanup(encoder); - return -EINVAL; + if (ret != -EPROBE_DEFER) + drm_encoder_cleanup(encoder); Many thanks for your patch. This means that we are counting on the future success of the deferred probe because we do not clean the encoder... However, Yannick gave his "Tested-by" and this patch seems useful so Acked-by: Philippe Cornu I will merge it friday or early next week, Thank you Philippe :-) + return ret; } DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id); @@ -1266,7 +1267,8 @@ int ltdc_load(struct drm_device *ddev) if (bridge) { ret = ltdc_encoder_init(ddev, bridge); if (ret) { - DRM_ERROR("init encoder endpoint %d\n", i); + if (ret != -EPROBE_DEFER) + DRM_ERROR("init encoder endpoint %d\n", i); goto err; } } Applied on drm-misc-next. Many thanks for your patch, Philippe :-)
Re: [PATCH] drm/stm: dsi: compute the transition time from LP to HS and back
Hi Antonio, On 7/13/21 4:49 PM, Antonio Borneo wrote: The driver uses a conservative set of hardcoded values for the maximum time delay of the transitions between LP and HS, either for data and clock lanes. By using the info in STM32MP157 datasheet, valid also for other ST devices, compute the actual delay from the lane's bps. Signed-off-by: Antonio Borneo --- To: Yannick Fertre To: Philippe Cornu To: Benjamin Gaignard To: David Airlie To: Daniel Vetter To: Maxime Coquelin To: Alexandre Torgue To: Raphael Gallais-Pou To: dri-devel@lists.freedesktop.org To: linux-st...@st-md-mailman.stormreply.com To: linux-arm-ker...@lists.infradead.org Cc: linux-ker...@vger.kernel.org drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index 8399d337589d..32cb41b2202f 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -309,14 +309,23 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, return 0; } +#define DSI_PHY_DELAY(fp, vp, mbps) DIV_ROUND_UP((fp) * (mbps) + 1000 * (vp), 8000) + static int dw_mipi_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, struct dw_mipi_dsi_dphy_timing *timing) { - timing->clk_hs2lp = 0x40; - timing->clk_lp2hs = 0x40; - timing->data_hs2lp = 0x40; - timing->data_lp2hs = 0x40; + /* +* From STM32MP157 datasheet, valid for STM32F469, STM32F7x9, STM32H747 +* phy_clkhs2lp_time = (272+136*UI)/(8*UI) +* phy_clklp2hs_time = (512+40*UI)/(8*UI) +* phy_hs2lp_time = (192+64*UI)/(8*UI) +* phy_lp2hs_time = (256+32*UI)/(8*UI) +*/ + timing->clk_hs2lp = DSI_PHY_DELAY(272, 136, lane_mbps); + timing->clk_lp2hs = DSI_PHY_DELAY(512, 40, lane_mbps); + timing->data_hs2lp = DSI_PHY_DELAY(192, 64, lane_mbps); + timing->data_lp2hs = DSI_PHY_DELAY(256, 32, lane_mbps); Many thanks for your patch. Reviewed-by: Philippe Cornu Acked-by: Philippe Cornu I will apply it on drm-misc-next early next week, Philippe :-) return 0; } base-commit: 35d283658a6196b2057be562096610c6793e1219
Re: [PATCH] drm/stm: ltdc: Silence -EPROBE_DEFER till bridge attached
Hi Jagan, On 7/4/21 3:59 PM, Jagan Teki wrote: As dw-mipi-dsi supported all possible ways to find the DSI devices. It can take multiple iterations for ltdc to find all components attached to the DSI bridge. The current ltdc driver failed to find the endpoint as it returned -EINVAL for the first iteration itself. This leads to following error: [ 3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0 So, check the return value and cleanup the encoder only if it's not -EPROBE_DEFER. This make all components in the attached DSI bridge found properly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/stm/ltdc.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 08b71248044d..95e983d3ffb5 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1122,8 +1122,9 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge) ret = drm_bridge_attach(encoder, bridge, NULL, 0); if (ret) { - drm_encoder_cleanup(encoder); - return -EINVAL; + if (ret != -EPROBE_DEFER) + drm_encoder_cleanup(encoder); Many thanks for your patch. This means that we are counting on the future success of the deferred probe because we do not clean the encoder... However, Yannick gave his "Tested-by" and this patch seems useful so Acked-by: Philippe Cornu I will merge it friday or early next week, Thank you Philippe :-) + return ret; } DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id); @@ -1266,7 +1267,8 @@ int ltdc_load(struct drm_device *ddev) if (bridge) { ret = ltdc_encoder_init(ddev, bridge); if (ret) { - DRM_ERROR("init encoder endpoint %d\n", i); + if (ret != -EPROBE_DEFER) + DRM_ERROR("init encoder endpoint %d\n", i); goto err; } }
Re: [PATCH] MAINTAINERS: Add Raphael Gallais-Pou as STM32 DRM maintainer
On 7/8/21 2:54 PM, Raphael GALLAIS-POU - foss wrote: Add Raphael Gallais-Pou as STM32 DRM maintainer. Signed-off-by: Raphael Gallais-Pou --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 0f1171ceaf8b..4fa3bfc00f57 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -6165,6 +6165,7 @@ DRM DRIVERS FOR STM M:Yannick Fertre M:Philippe Cornu M:Benjamin Gaignard +M: Raphael Gallais-Pou Hi Raphaël, Warm welcome on board! Reviewed-by: Philippe Cornu Note: you may have to wait and resend your patch as Benjamin sent recently an update too. Many thanks Philippe :-) L:dri-devel@lists.freedesktop.org S:Maintained T:git git://anongit.freedesktop.org/drm/drm-misc
Re: [PATCH v4] Documentation: gpu: Mention the requirements for new properties
On 6/16/21 4:38 PM, Maxime Ripard wrote: New KMS properties come with a bunch of requirements to avoid each driver from running their own, inconsistent, set of properties, eventually leading to issues like property conflicts, inconsistencies between drivers and semantics, etc. Let's document what we expect. Cc: Alexandre Belloni Cc: Alexandre Torgue Cc: Alex Deucher Cc: Alison Wang Cc: Alyssa Rosenzweig Cc: Andrew Jeffery Cc: Andrzej Hajda Cc: Anitha Chrisanthus Cc: Benjamin Gaignard Cc: Ben Skeggs Cc: Boris Brezillon Cc: Brian Starkey Cc: Chen Feng Cc: Chen-Yu Tsai Cc: Christian Gmeiner Cc: "Christian König" Cc: Chun-Kuang Hu Cc: Edmund Dea Cc: Eric Anholt Cc: Fabio Estevam Cc: Gerd Hoffmann Cc: Haneen Mohammed Cc: Hans de Goede Cc: "Heiko Stübner" Cc: Huang Rui Cc: Hyun Kwon Cc: Inki Dae Cc: Jani Nikula Cc: Jernej Skrabec Cc: Jerome Brunet Cc: Joel Stanley Cc: John Stultz Cc: Jonas Karlman Cc: Jonathan Hunter Cc: Joonas Lahtinen Cc: Joonyoung Shim Cc: Jyri Sarha Cc: Kevin Hilman Cc: Kieran Bingham Cc: Krzysztof Kozlowski Cc: Kyungmin Park Cc: Laurent Pinchart Cc: Linus Walleij Cc: Liviu Dudau Cc: Lucas Stach Cc: Ludovic Desroches Cc: Marek Vasut Cc: Martin Blumenstingl Cc: Matthias Brugger Cc: Maxime Coquelin Cc: Maxime Ripard Cc: Melissa Wen Cc: Neil Armstrong Cc: Nicolas Ferre Cc: "Noralf Trønnes" Cc: NXP Linux Team Cc: Oleksandr Andrushchenko Cc: Patrik Jakobsson Cc: Paul Cercueil Cc: Pekka Paalanen Cc: Pengutronix Kernel Team Cc: Philippe Cornu Cc: Philipp Zabel Cc: Qiang Yu Cc: Rob Clark Cc: Robert Foss Cc: Rob Herring Cc: Rodrigo Siqueira Cc: Rodrigo Vivi Cc: Roland Scheidegger Cc: Russell King Cc: Sam Ravnborg Cc: Sandy Huang Cc: Sascha Hauer Cc: Sean Paul Cc: Seung-Woo Kim Cc: Shawn Guo Cc: Simon Ser Cc: Stefan Agner Cc: Steven Price Cc: Sumit Semwal Cc: Thierry Reding Cc: Tian Tao Cc: Tomeu Vizoso Cc: Tomi Valkeinen Cc: VMware Graphics Cc: Xinliang Liu Cc: Xinwei Kong Cc: Yannick Fertre Cc: Zack Rusin Reviewed-by: Daniel Vetter Signed-off-by: Maxime Ripard --- Changes from v3: - Roll back to the v2 - Add Simon and Pekka in Cc Changes from v2: - Take into account the feedback from Laurent and Lidiu to no longer force generic properties, but prefix vendor-specific properties with the vendor name Changes from v1: - Typos and wording reported by Daniel and Alex --- Documentation/gpu/drm-kms.rst | 19 +++ 1 file changed, 19 insertions(+) diff --git a/Documentation/gpu/drm-kms.rst b/Documentation/gpu/drm-kms.rst index 87e5023e3f55..c28b464dd397 100644 --- a/Documentation/gpu/drm-kms.rst +++ b/Documentation/gpu/drm-kms.rst @@ -463,6 +463,25 @@ KMS Properties This section of the documentation is primarily aimed at user-space developers. For the driver APIs, see the other sections. +Requirements + + +KMS drivers might need to add extra properties to support new features. +Each new property introduced in a driver need to meet a few +requirements, in addition to the one mentioned above.: + +- It must be standardized, with some documentation to describe how the + property can be used. + +- It must provide a generic helper in the core code to register that + property on the object it attaches to. + +- Its content must be decoded by the core and provided in the object's + associated state structure. That includes anything drivers might want to + precompute, like :c:type:`struct drm_clip_rect ` for planes. + +- An IGT test must be submitted where reasonable. + Property Types and Blob Property Support Hi, Regarding properties, we have a “case study example” related in a certain way to this documentation update :-) The use case: on a front desk at an exhibition, there is a welcome screen you can touch for searching various information. When this welcome screen is in idle, a small logo is displayed at its center (around 20% of the fullscreen). The logo has a white background color. We want to reduce the ddr usage for lowering the power (the board is battery powered) so the idea is to use a white background color around this logo, produced by the drm CRTC so the image in ddr is only the size of the logo. Reading the thread https://lists.freedesktop.org/archives/dri-devel/2019-October/239733.html dissuade us from coding a generic solution, so we started to implement a "STM_" private background color property, it works... but we are not at all convince this is the right way and we clearly prefer mainline/generic sw for both kernel & userland. So now, what are our options... well, this v4 documentation update is I think clear enough: we have to document + provide a generic helper in the core code (similar to the original patch) + update IGT test, right? Thanks Philippe :-) Note: It is really a pleasure to read such interesting t
Re: [PATCH] drm/stm: Remove usage of drm_display_mode_to_videomode()
Hi Marek, Applied on drm-misc-next. Note: I added Yannick Tested-by from the last (identical) December version https://patchwork.freedesktop.org/patch/409968 Many thanks for your patch, Philippe :-) On 6/7/21 7:24 PM, Marek Vasut wrote: There is not much value in the extra conversion step, the calculations required for the LTDC IP are different than what is used in the drm_display_mode_to_videomode(), so just do the right ones in the LTDC driver right away. Signed-off-by: Marek Vasut Cc: Alexandre Torgue Cc: Antonio Borneo Cc: Benjamin Gaignard Cc: Maxime Coquelin Cc: Philippe Cornu Cc: Sam Ravnborg Cc: Vincent Abriou Cc: Yannick Fertre Cc: linux-arm-ker...@lists.infradead.org Cc: linux-st...@st-md-mailman.stormreply.com To: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/stm/ltdc.c | 33 + 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index e99771b947b6..08b71248044d 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -531,7 +531,6 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc) struct drm_encoder *encoder = NULL; struct drm_bridge *bridge = NULL; struct drm_display_mode *mode = >state->adjusted_mode; - struct videomode vm; u32 hsync, vsync, accum_hbp, accum_vbp, accum_act_w, accum_act_h; u32 total_width, total_height; u32 bus_flags = 0; @@ -570,31 +569,33 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc) } } - drm_display_mode_to_videomode(mode, ); - DRM_DEBUG_DRIVER("CRTC:%d mode:%s\n", crtc->base.id, mode->name); - DRM_DEBUG_DRIVER("Video mode: %dx%d", vm.hactive, vm.vactive); + DRM_DEBUG_DRIVER("Video mode: %dx%d", mode->hdisplay, mode->vdisplay); DRM_DEBUG_DRIVER(" hfp %d hbp %d hsl %d vfp %d vbp %d vsl %d\n", -vm.hfront_porch, vm.hback_porch, vm.hsync_len, -vm.vfront_porch, vm.vback_porch, vm.vsync_len); +mode->hsync_start - mode->hdisplay, +mode->htotal - mode->hsync_end, +mode->hsync_end - mode->hsync_start, +mode->vsync_start - mode->vdisplay, +mode->vtotal - mode->vsync_end, +mode->vsync_end - mode->vsync_start); /* Convert video timings to ltdc timings */ - hsync = vm.hsync_len - 1; - vsync = vm.vsync_len - 1; - accum_hbp = hsync + vm.hback_porch; - accum_vbp = vsync + vm.vback_porch; - accum_act_w = accum_hbp + vm.hactive; - accum_act_h = accum_vbp + vm.vactive; - total_width = accum_act_w + vm.hfront_porch; - total_height = accum_act_h + vm.vfront_porch; + hsync = mode->hsync_end - mode->hsync_start - 1; + vsync = mode->vsync_end - mode->vsync_start - 1; + accum_hbp = mode->htotal - mode->hsync_start - 1; + accum_vbp = mode->vtotal - mode->vsync_start - 1; + accum_act_w = accum_hbp + mode->hdisplay; + accum_act_h = accum_vbp + mode->vdisplay; + total_width = mode->htotal - 1; + total_height = mode->vtotal - 1; /* Configures the HS, VS, DE and PC polarities. Default Active Low */ val = 0; - if (vm.flags & DISPLAY_FLAGS_HSYNC_HIGH) + if (mode->flags & DRM_MODE_FLAG_PHSYNC) val |= GCR_HSPOL; - if (vm.flags & DISPLAY_FLAGS_VSYNC_HIGH) + if (mode->flags & DRM_MODE_FLAG_PVSYNC) val |= GCR_VSPOL; if (bus_flags & DRM_BUS_FLAG_DE_LOW)
Re: [PATCH] drm/stm: Remove usage of drm_display_mode_to_videomode()
Hi Marek, Many thanks for your patch and sorry for the delay regarding this "last Christmas" patch (Dec. 24, 2020), lost in my inbox :( Could you please resend it (as I did not succeed to apply it directly)? patchwork reference https://patchwork.freedesktop.org/patch/409968/?series=85222 Many thanks, Philippe :-) On 5/28/21 4:01 PM, yannick Fertre wrote: Hi Philippe, I have already reviewed this patch on January 7, 2020. (https://lore.kernel.org/dri-devel/0ab4ee45-4437-3b02-cf63-0e3b1b539...@st.com/) Could you please review it and merge it? Best regards Yannick On 5/28/21 10:05 AM, Yannick Fertre wrote: There is not much value in the extra conversion step, the calculations required for the LTDC IP are different than what is used in the drm_display_mode_to_videomode(), so just do the right ones in the LTDC driver right away. Signed-off-by: Marek Vasut Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 32 +--- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index e99771b947b6..d113b9be12c0 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -570,31 +570,33 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc) } } - drm_display_mode_to_videomode(mode, ); - DRM_DEBUG_DRIVER("CRTC:%d mode:%s\n", crtc->base.id, mode->name); - DRM_DEBUG_DRIVER("Video mode: %dx%d", vm.hactive, vm.vactive); + DRM_DEBUG_DRIVER("Video mode: %dx%d", mode->hdisplay, mode->vdisplay); DRM_DEBUG_DRIVER(" hfp %d hbp %d hsl %d vfp %d vbp %d vsl %d\n", - vm.hfront_porch, vm.hback_porch, vm.hsync_len, - vm.vfront_porch, vm.vback_porch, vm.vsync_len); + mode->hsync_start - mode->hdisplay, + mode->htotal - mode->hsync_end, + mode->hsync_end - mode->hsync_start, + mode->vsync_start - mode->vdisplay, + mode->vtotal - mode->vsync_end, + mode->vsync_end - mode->vsync_start); /* Convert video timings to ltdc timings */ - hsync = vm.hsync_len - 1; - vsync = vm.vsync_len - 1; - accum_hbp = hsync + vm.hback_porch; - accum_vbp = vsync + vm.vback_porch; - accum_act_w = accum_hbp + vm.hactive; - accum_act_h = accum_vbp + vm.vactive; - total_width = accum_act_w + vm.hfront_porch; - total_height = accum_act_h + vm.vfront_porch; + hsync = mode->hsync_end - mode->hsync_start - 1; + vsync = mode->vsync_end - mode->vsync_start - 1; + accum_hbp = mode->htotal - mode->hsync_start - 1; + accum_vbp = mode->vtotal - mode->vsync_start - 1; + accum_act_w = accum_hbp + mode->hdisplay; + accum_act_h = accum_vbp + mode->vdisplay; + total_width = mode->htotal - 1; + total_height = mode->vtotal - 1; /* Configures the HS, VS, DE and PC polarities. Default Active Low */ val = 0; - if (vm.flags & DISPLAY_FLAGS_HSYNC_HIGH) + if (mode->flags & DRM_MODE_FLAG_PHSYNC) val |= GCR_HSPOL; - if (vm.flags & DISPLAY_FLAGS_VSYNC_HIGH) + if (mode->flags & DRM_MODE_FLAG_PVSYNC) val |= GCR_VSPOL; if (bus_flags & DRM_BUS_FLAG_DE_LOW)
Re: [PATCH 06/11] drm/: drm_gem_plane_helper_prepare_fb is now the default
On 5/21/21 11:09 AM, Daniel Vetter wrote: No need to set it explicitly. Signed-off-by: Daniel Vetter Cc: Laurentiu Palcu Cc: Lucas Stach Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: Philipp Zabel Cc: Paul Cercueil Cc: Chun-Kuang Hu Cc: Matthias Brugger Cc: Neil Armstrong Cc: Kevin Hilman Cc: Jerome Brunet Cc: Martin Blumenstingl Cc: Marek Vasut Cc: Stefan Agner Cc: Sandy Huang Cc: "Heiko Stübner" Cc: Yannick Fertre Cc: Philippe Cornu For stm Acked-by: Philippe Cornu Many thanks Philippe :-) Cc: Benjamin Gaignard Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: Maxime Ripard Cc: Chen-Yu Tsai Cc: Jernej Skrabec Cc: Jyri Sarha Cc: Tomi Valkeinen Cc: linux-arm-ker...@lists.infradead.org Cc: linux-m...@vger.kernel.org Cc: linux-media...@lists.infradead.org Cc: linux-amlo...@lists.infradead.org Cc: linux-rockc...@lists.infradead.org Cc: linux-st...@st-md-mailman.stormreply.com Cc: linux-su...@lists.linux.dev --- drivers/gpu/drm/imx/dcss/dcss-plane.c | 1 - drivers/gpu/drm/imx/ipuv3-plane.c | 1 - drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 1 - drivers/gpu/drm/ingenic/ingenic-ipu.c | 1 - drivers/gpu/drm/mediatek/mtk_drm_plane.c| 1 - drivers/gpu/drm/meson/meson_overlay.c | 1 - drivers/gpu/drm/meson/meson_plane.c | 1 - drivers/gpu/drm/mxsfb/mxsfb_kms.c | 2 -- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 - drivers/gpu/drm/stm/ltdc.c | 1 - drivers/gpu/drm/sun4i/sun4i_layer.c | 1 - drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 1 - drivers/gpu/drm/sun4i/sun8i_vi_layer.c | 1 - drivers/gpu/drm/tidss/tidss_plane.c | 1 - 14 files changed, 15 deletions(-) diff --git a/drivers/gpu/drm/imx/dcss/dcss-plane.c b/drivers/gpu/drm/imx/dcss/dcss-plane.c index 044d3bdf313c..ac45d54acd4e 100644 --- a/drivers/gpu/drm/imx/dcss/dcss-plane.c +++ b/drivers/gpu/drm/imx/dcss/dcss-plane.c @@ -361,7 +361,6 @@ static void dcss_plane_atomic_disable(struct drm_plane *plane, } static const struct drm_plane_helper_funcs dcss_plane_helper_funcs = { - .prepare_fb = drm_gem_plane_helper_prepare_fb, .atomic_check = dcss_plane_atomic_check, .atomic_update = dcss_plane_atomic_update, .atomic_disable = dcss_plane_atomic_disable, diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 8710f55d2579..ef114b6aa691 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c @@ -772,7 +772,6 @@ static void ipu_plane_atomic_update(struct drm_plane *plane, } static const struct drm_plane_helper_funcs ipu_plane_helper_funcs = { - .prepare_fb = drm_gem_plane_helper_prepare_fb, .atomic_check = ipu_plane_atomic_check, .atomic_disable = ipu_plane_atomic_disable, .atomic_update = ipu_plane_atomic_update, diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c index 389cad59e090..62db7349bf6a 100644 --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c @@ -786,7 +786,6 @@ static const struct drm_plane_helper_funcs ingenic_drm_plane_helper_funcs = { .atomic_update = ingenic_drm_plane_atomic_update, .atomic_check = ingenic_drm_plane_atomic_check, .atomic_disable = ingenic_drm_plane_atomic_disable, - .prepare_fb = drm_gem_plane_helper_prepare_fb, }; static const struct drm_crtc_helper_funcs ingenic_drm_crtc_helper_funcs = { diff --git a/drivers/gpu/drm/ingenic/ingenic-ipu.c b/drivers/gpu/drm/ingenic/ingenic-ipu.c index 3b1091e7c0cd..caf038f3e231 100644 --- a/drivers/gpu/drm/ingenic/ingenic-ipu.c +++ b/drivers/gpu/drm/ingenic/ingenic-ipu.c @@ -615,7 +615,6 @@ static const struct drm_plane_helper_funcs ingenic_ipu_plane_helper_funcs = { .atomic_update = ingenic_ipu_plane_atomic_update, .atomic_check = ingenic_ipu_plane_atomic_check, .atomic_disable = ingenic_ipu_plane_atomic_disable, - .prepare_fb = drm_gem_plane_helper_prepare_fb, }; static int diff --git a/drivers/gpu/drm/mediatek/mtk_drm_plane.c b/drivers/gpu/drm/mediatek/mtk_drm_plane.c index b5582dcf564c..1667a7e7de38 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_plane.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_plane.c @@ -227,7 +227,6 @@ static void mtk_plane_atomic_update(struct drm_plane *plane, } static const struct drm_plane_helper_funcs mtk_plane_helper_funcs = { - .prepare_fb = drm_gem_plane_helper_prepare_fb, .atomic_check = mtk_plane_atomic_check, .atomic_update = mtk_plane_atomic_update, .atomic_disable = mtk_plane_atomic_disable, diff --git a/drivers/gpu/drm/meson/meson_overlay.c b/drivers/gpu/drm/meson/meson_overlay.c index ed063152aecd..dfef8afcc245 100644 --- a/drivers/gpu
RE: [PATCH 7/8] drm/stm: Don't set allow_fb_modifiers explicitly
Hi Daniel, Many thanks for your patch, Acked-by: Philippe Cornu Philippe :-) De : Daniel Vetter Envoyé : mardi 27 avril 2021 11:20 À : DRI Development Cc : Intel Graphics Development; Daniel Vetter; Daniel Vetter; Yannick FERTRE - foss; Philippe CORNU - foss; Benjamin Gaignard; Maxime Coquelin; Alexandre TORGUE - foss; linux-st...@st-md-mailman.stormreply.com; linux-arm-ker...@lists.infradead.org Objet : [PATCH 7/8] drm/stm: Don't set allow_fb_modifiers explicitly Since commit 890880ddfdbe256083170866e49c87618b706ac7 Author: Paul Kocialkowski Date: Fri Jan 4 09:56:10 2019 +0100 drm: Auto-set allow_fb_modifiers when given modifiers at plane init this is done automatically as part of plane init, if drivers set the modifier list correctly. Which is the case here. Signed-off-by: Daniel Vetter Cc: Yannick Fertre Cc: Philippe Cornu Cc: Benjamin Gaignard Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-st...@st-md-mailman.stormreply.com Cc: linux-arm-ker...@lists.infradead.org --- drivers/gpu/drm/stm/ltdc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 65c3c79ad1d5..e99771b947b6 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -1326,8 +1326,6 @@ int ltdc_load(struct drm_device *ddev) goto err; } - ddev->mode_config.allow_fb_modifiers = true; - ret = ltdc_crtc_init(ddev, crtc); if (ret) { DRM_ERROR("Failed to init crtc\n"); -- 2.31.0 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH 1/2] drm/stm: dsi: Avoid printing errors for -EPROBE_DEFER
Applied on drm-misc-next. Many thanks Raphaël & Yannick for your patch. Note: I have updated the "From:" field to yannick.fer...@foss.st.com for more consistency. Philippe :-) De : Yannick FERTRE - foss Envoyé : lundi 8 mars 2021 10:10 À : Raphael GALLAIS-POU - foss; Yannick FERTRE; Philippe CORNU; Benjamin Gaignard; Vincent ABRIOU; Sam Ravnborg; Joe Perches Cc : David Airlie; Daniel Vetter; Maxime Coquelin; Alexandre TORGUE; dri-devel@lists.freedesktop.org; linux-st...@st-md-mailman.stormreply.com; linux-arm-ker...@lists.infradead.org; linux-ker...@vger.kernel.org; Philippe CORNU - foss; Raphael GALLAIS-POU; Alexandre TORGUE - foss Objet : Re: [PATCH 1/2] drm/stm: dsi: Avoid printing errors for -EPROBE_DEFER Tested-by: Yannick Fertre On 2/22/21 10:22 AM, Raphael GALLAIS-POU - foss wrote: > From: Yannick Fertre > > Don't print error when probe deferred error is returned. > > Signed-off-by: Raphael Gallais-Pou > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 9 +++-- > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > index 2e1f2664495d..8399d337589d 100644 > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > @@ -363,8 +363,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device > *pdev) >dsi->vdd_supply = devm_regulator_get(dev, "phy-dsi"); >if (IS_ERR(dsi->vdd_supply)) { >ret = PTR_ERR(dsi->vdd_supply); > - if (ret != -EPROBE_DEFER) > - DRM_ERROR("Failed to request regulator: %d\n", ret); > + dev_err_probe(dev, ret, "Failed to request regulator\n"); >return ret; >} > > @@ -377,9 +376,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device > *pdev) >dsi->pllref_clk = devm_clk_get(dev, "ref"); >if (IS_ERR(dsi->pllref_clk)) { >ret = PTR_ERR(dsi->pllref_clk); > - if (ret != -EPROBE_DEFER) > - DRM_ERROR("Unable to get pll reference clock: %d\n", > - ret); > + dev_err_probe(dev, ret, "Unable to get pll reference clock\n"); >goto err_clk_get; >} > > @@ -419,7 +416,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device > *pdev) >dsi->dsi = dw_mipi_dsi_probe(pdev, _mipi_dsi_stm_plat_data); >if (IS_ERR(dsi->dsi)) { >ret = PTR_ERR(dsi->dsi); > - DRM_ERROR("Failed to initialize mipi dsi host: %d\n", ret); > + dev_err_probe(dev, ret, "Failed to initialize mipi dsi host\n"); >goto err_dsi_probe; >} > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [Linux-stm32] [PATCH] drm/stm: ltdc: Use simple encoder
Applied on drm-misc-next. Many thanks Jagan for your patch and many thanks Thomas & Yannick for your reviews & tests. Philippe :-) De : Linux-stm32 de la part de Yannick FERTRE - foss Envoyé : jeudi 4 mars 2021 09:49 À : Thomas Zimmermann; Jagan Teki; Yannick FERTRE; Philippe CORNU; Benjamin Gaignard; Vincent ABRIOU Cc : dri-devel@lists.freedesktop.org; linux-amar...@amarulasolutions.com; linux-ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-st...@st-md-mailman.stormreply.com Objet : Re: [Linux-stm32] [PATCH] drm/stm: ltdc: Use simple encoder Hi Thomas, I wait a few days before merging it. Thank you for your help. Best regards Yannick On 3/4/21 9:21 AM, Thomas Zimmermann wrote: > Hi, > > shall I merge this patch? > > Am 02.03.21 um 18:57 schrieb Jagan Teki: >> STM ltdc driver uses an empty implementation for its encoder. >> Replace the code with the generic simple encoder. >> >> Signed-off-by: Jagan Teki >> --- >> drivers/gpu/drm/stm/ltdc.c | 12 ++-- >> 1 file changed, 2 insertions(+), 10 deletions(-) >> >> diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c >> index 7812094f93d6..aeeb43524ca0 100644 >> --- a/drivers/gpu/drm/stm/ltdc.c >> +++ b/drivers/gpu/drm/stm/ltdc.c >> @@ -31,6 +31,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> @@ -1020,14 +1021,6 @@ static int ltdc_crtc_init(struct drm_device >> *ddev, struct drm_crtc *crtc) >> return ret; >> } >> -/* >> - * DRM_ENCODER >> - */ >> - >> -static const struct drm_encoder_funcs ltdc_encoder_funcs = { >> -.destroy = drm_encoder_cleanup, >> -}; >> - >> static void ltdc_encoder_disable(struct drm_encoder *encoder) >> { >> struct drm_device *ddev = encoder->dev; >> @@ -1088,8 +1081,7 @@ static int ltdc_encoder_init(struct drm_device >> *ddev, struct drm_bridge *bridge) >> encoder->possible_crtcs = CRTC_MASK; >> encoder->possible_clones = 0;/* No cloning support */ >> -drm_encoder_init(ddev, encoder, _encoder_funcs, >> - DRM_MODE_ENCODER_DPI, NULL); >> +drm_simple_encoder_init(ddev, encoder, DRM_MODE_ENCODER_DPI); >> drm_encoder_helper_add(encoder, _encoder_helper_funcs); >> > > > ___ > dri-devel mailing list > dri-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/dri-devel > ___ Linux-stm32 mailing list linux-st...@st-md-mailman.stormreply.com https://st-md-mailman.stormreply.com/mailman/listinfo/linux-stm32 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH V4] drm/stm: Fix bus_flags handling
Dear Marek, Applied on drm-misc-next. Many thanks for your patch, Philippe :-) ST Restricted -Original Message- From: Marek Vasut Sent: Wednesday, January 27, 2021 12:08 To: dri-devel@lists.freedesktop.org Cc: Marek Vasut ; Yannick FERTRE ; Alexandre TORGUE ; Antonio BORNEO ; Benjamin Gaignard ; Maxime Coquelin ; Philippe CORNU ; Sam Ravnborg ; Vincent ABRIOU ; linux-arm-ker...@lists.infradead.org; linux-st...@st-md-mailman.stormreply.com Subject: [PATCH V4] drm/stm: Fix bus_flags handling The drm_display_mode_to_videomode() does not populate DISPLAY_FLAGS_DE_LOW or DISPLAY_FLAGS_PIXDATA_NEGEDGE flags in struct videomode. Therefore, no matter what polarity the next bridge or display might require, these flags are never set, and thus the LTDC GCR_DEPOL and GCR_PCPOL bits are never set, and the LTDC behaves as if both DISPLAY_FLAGS_PIXDATA_POSEDGE and DISPLAY_FLAGS_DE_HIGH were always set. The fix for this problem is taken almost verbatim from MXSFB driver. In case there is a bridge attached to the LTDC, the bridge might have extra polarity requirements, so extract bus_flags from the bridge and use them for LTDC configuration. Otherwise, extract bus_flags from the connector, which is the display. Fixes: b759012c5fa7 ("drm/stm: Add STM32 LTDC driver") Signed-off-by: Marek Vasut Signed-off-by: Yannick Fertre Cc: Alexandre Torgue Cc: Antonio Borneo Cc: Benjamin Gaignard Cc: Maxime Coquelin Cc: Philippe Cornu Cc: Sam Ravnborg Cc: Vincent Abriou Cc: Yannick Fertre Cc: linux-arm-ker...@lists.infradead.org Cc: linux-st...@st-md-mailman.stormreply.com To: dri-devel@lists.freedesktop.org --- V2: Check if ldev->bridge->timings is non-NULL before accessing it V3: get bus_flags from connector (from Yannick) - Display controller could support several connectors (not connected at the same time). ie: stm32mp15c-DK2 board have 2 connectors (HDMI + DSI). Driver check which connector is connected to get the bus flag. V4: get bridge from encoder (from Yannick) --- drivers/gpu/drm/stm/ltdc.c | 33 +++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index 6e28e6b60e72..acc9f6694eb6 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -544,13 +544,42 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc) { struct ltdc_device *ldev = crtc_to_ltdc(crtc); struct drm_device *ddev = crtc->dev; + struct drm_connector_list_iter iter; + struct drm_connector *connector = NULL; + struct drm_encoder *encoder = NULL; + struct drm_bridge *bridge = NULL; struct drm_display_mode *mode = >state->adjusted_mode; struct videomode vm; u32 hsync, vsync, accum_hbp, accum_vbp, accum_act_w, accum_act_h; u32 total_width, total_height; + u32 bus_flags = 0; u32 val; int ret; + /* get encoder from crtc */ + drm_for_each_encoder(encoder, ddev) + if (encoder->crtc == crtc) + break; + + if (encoder) { + /* get bridge from encoder */ + list_for_each_entry(bridge, >bridge_chain, chain_node) + if (bridge->encoder == encoder) + break; + + /* Get the connector from encoder */ + drm_connector_list_iter_begin(ddev, ); + drm_for_each_connector_iter(connector, ) + if (connector->encoder == encoder) + break; + drm_connector_list_iter_end(); + } + + if (bridge && bridge->timings) + bus_flags = bridge->timings->input_bus_flags; + else if (connector) + bus_flags = connector->display_info.bus_flags; + if (!pm_runtime_active(ddev->dev)) { ret = pm_runtime_get_sync(ddev->dev); if (ret) { @@ -586,10 +615,10 @@ static void ltdc_crtc_mode_set_nofb(struct drm_crtc *crtc) if (vm.flags & DISPLAY_FLAGS_VSYNC_HIGH) val |= GCR_VSPOL; - if (vm.flags & DISPLAY_FLAGS_DE_LOW) + if (bus_flags & DRM_BUS_FLAG_DE_LOW) val |= GCR_DEPOL; - if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) + if (bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE) val |= GCR_PCPOL; reg_update_bits(ldev->regs, LTDC_GCR, -- 2.29.2 ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 1/2] drm: automatic legacy gamma support
Hi Tomi, On 12/11/20 12:42 PM, Tomi Valkeinen wrote: > To support legacy gamma ioctls the drivers need to set > drm_crtc_funcs.gamma_set either to a custom implementation or to > drm_atomic_helper_legacy_gamma_set. Most of the atomic drivers do the > latter. > > We can simplify this by making the core handle it automatically. > > Move the drm_atomic_helper_legacy_gamma_set() functionality into > drm_color_mgmt.c to make drm_mode_gamma_set_ioctl() use > drm_crtc_funcs.gamma_set if set or GAMMA_LUT property if not. > > Signed-off-by: Tomi Valkeinen > --- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 - > .../gpu/drm/arm/display/komeda/komeda_crtc.c | 1 - > drivers/gpu/drm/arm/malidp_crtc.c | 1 - > drivers/gpu/drm/armada/armada_crtc.c | 1 - > drivers/gpu/drm/ast/ast_mode.c| 1 - > .../gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c| 1 - > drivers/gpu/drm/drm_atomic_helper.c | 70 --- > drivers/gpu/drm/drm_color_mgmt.c | 111 -- > drivers/gpu/drm/i915/display/intel_display.c | 1 - > drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 - > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 1 - > drivers/gpu/drm/nouveau/dispnv50/head.c | 2 - > drivers/gpu/drm/omapdrm/omap_crtc.c | 1 - > drivers/gpu/drm/rcar-du/rcar_du_crtc.c| 1 - > drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 1 - > drivers/gpu/drm/stm/ltdc.c| 1 - For the stm part, Reviewed-by: Philippe Cornu Thank you Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] dt-bindings: display: Add dsi-controller.yaml in DSI controller schemas
On 10/3/20 12:59 AM, Rob Herring wrote: > Some DSI controllers are missing a reference to the recently added > dsi-controller.yaml schema. Add it and we can drop the duplicate parts. > > Cc: Maxime Ripard > Cc: Chen-Yu Tsai > Cc: Eric Anholt > Cc: Nicolas Saenz Julienne > Cc: Florian Fainelli > Cc: Ray Jui > Cc: Scott Branden > Cc: bcm-kernel-feedback-l...@broadcom.com > Cc: Maxime Coquelin > Cc: Alexandre Torgue > Cc: "Guido Gúnther" > Cc: Robert Chiras > Cc: Philippe Cornu Hi Rob, and many thanks for the patch. For the stm32 part, Reviewed-by: Philippe Cornu Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/stm: dsi: Use dev_ based logging
On 10/13/20 9:56 AM, Yannick Fertre wrote: > Standardize on the dev_ based logging. > > Signed-off-by: Yannick Fertre > --- > Changes in v2: > - restore function dsi_color_from_mipi. > - reword commit. > > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 55 ++- > 1 file changed, 29 insertions(+), 26 deletions(-) > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > index 164f79ef6269..a5a87c89aa07 100644 > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > @@ -76,6 +76,7 @@ enum dsi_color { > > struct dw_mipi_dsi_stm { > void __iomem *base; > + struct device *dev; > struct clk *pllref_clk; > struct dw_mipi_dsi *dsi; > u32 hw_version; > @@ -110,7 +111,8 @@ static inline void dsi_update_bits(struct dw_mipi_dsi_stm > *dsi, u32 reg, > dsi_write(dsi, reg, (dsi_read(dsi, reg) & ~mask) | val); > } > > -static enum dsi_color dsi_color_from_mipi(enum mipi_dsi_pixel_format fmt) > +static enum dsi_color dsi_color_from_mipi(struct dw_mipi_dsi_stm *dsi, > + enum mipi_dsi_pixel_format fmt) > { > switch (fmt) { > case MIPI_DSI_FMT_RGB888: > @@ -122,7 +124,7 @@ static enum dsi_color dsi_color_from_mipi(enum > mipi_dsi_pixel_format fmt) > case MIPI_DSI_FMT_RGB565: > return DSI_RGB565_CONF1; > default: > - DRM_DEBUG_DRIVER("MIPI color invalid, so we use rgb888\n"); > + dev_dbg(dsi->dev, "MIPI color invalid, so we use rgb888\n"); > } > return DSI_RGB888; > } > @@ -205,14 +207,14 @@ static int dw_mipi_dsi_phy_init(void *priv_data) > ret = readl_poll_timeout(dsi->base + DSI_WISR, val, val & WISR_RRS, >SLEEP_US, TIMEOUT_US); > if (ret) > - DRM_DEBUG_DRIVER("!TIMEOUT! waiting REGU, let's continue\n"); > + dev_dbg(dsi->dev, "!TIMEOUT! waiting REGU, let's continue\n"); > > /* Enable the DSI PLL & wait for its lock */ > dsi_set(dsi, DSI_WRPCR, WRPCR_PLLEN); > ret = readl_poll_timeout(dsi->base + DSI_WISR, val, val & WISR_PLLLS, >SLEEP_US, TIMEOUT_US); > if (ret) > - DRM_DEBUG_DRIVER("!TIMEOUT! waiting PLL, let's continue\n"); > + dev_dbg(dsi->dev, "!TIMEOUT! waiting PLL, let's continue\n"); > > return 0; > } > @@ -221,7 +223,7 @@ static void dw_mipi_dsi_phy_power_on(void *priv_data) > { > struct dw_mipi_dsi_stm *dsi = priv_data; > > - DRM_DEBUG_DRIVER("\n"); > + dev_dbg(dsi->dev, "\n"); > > /* Enable the DSI wrapper */ > dsi_set(dsi, DSI_WCR, WCR_DSIEN); > @@ -231,7 +233,7 @@ static void dw_mipi_dsi_phy_power_off(void *priv_data) > { > struct dw_mipi_dsi_stm *dsi = priv_data; > > - DRM_DEBUG_DRIVER("\n"); > + dev_dbg(dsi->dev, "\n"); > > /* Disable the DSI wrapper */ > dsi_clear(dsi, DSI_WCR, WCR_DSIEN); > @@ -267,11 +269,11 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct > drm_display_mode *mode, > > if (pll_out_khz > dsi->lane_max_kbps) { > pll_out_khz = dsi->lane_max_kbps; > - DRM_WARN("Warning max phy mbps is used\n"); > + dev_warn(dsi->dev, "Warning max phy mbps is used\n"); > } > if (pll_out_khz < dsi->lane_min_kbps) { > pll_out_khz = dsi->lane_min_kbps; > - DRM_WARN("Warning min phy mbps is used\n"); > + dev_warn(dsi->dev, "Warning min phy mbps is used\n"); > } > > /* Compute best pll parameters */ > @@ -281,7 +283,7 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct > drm_display_mode *mode, > ret = dsi_pll_get_params(dsi, pll_in_khz, pll_out_khz, >, , ); > if (ret) > - DRM_WARN("Warning dsi_pll_get_params(): bad params\n"); > + dev_warn(dsi->dev, "Warning dsi_pll_get_params(): bad > params\n"); > > /* Get the adjusted pll out value */ > pll_out_khz = dsi_pll_get_clkout_khz(pll_in_khz, idf, ndiv, odf); > @@ -299,12 +301,12 @@ dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct > drm_display_mode *mode, > > /* Select the color coding */ > dsi_update_bits(dsi, DSI_WCFGR, WCFGR_COLMUX, > - dsi_color_from_mipi(forma
Re: [PATCH] drm/panel: rm68200: fix mode to 50fps
On 9/25/20 4:16 PM, Yannick Fertre wrote: > Compute new timings to get a framerate of 50fps with a pixel clock > @54Mhz. > > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/panel/panel-raydium-rm68200.c | 12 ++-- > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-raydium-rm68200.c > b/drivers/gpu/drm/panel/panel-raydium-rm68200.c > index 2b9e48b0a491..412c0dbcb2b6 100644 > --- a/drivers/gpu/drm/panel/panel-raydium-rm68200.c > +++ b/drivers/gpu/drm/panel/panel-raydium-rm68200.c > @@ -82,15 +82,15 @@ struct rm68200 { > }; > > static const struct drm_display_mode default_mode = { > - .clock = 52582, > + .clock = 54000, > .hdisplay = 720, > - .hsync_start = 720 + 38, > - .hsync_end = 720 + 38 + 8, > - .htotal = 720 + 38 + 8 + 38, > + .hsync_start = 720 + 48, > + .hsync_end = 720 + 48 + 9, > + .htotal = 720 + 48 + 9 + 48, > .vdisplay = 1280, > .vsync_start = 1280 + 12, > - .vsync_end = 1280 + 12 + 4, > - .vtotal = 1280 + 12 + 4 + 12, > + .vsync_end = 1280 + 12 + 5, > + .vtotal = 1280 + 12 + 5 + 12, > .flags = 0, > .width_mm = 68, > .height_mm = 122, > Hi Yannick, Tested-by: Philippe Cornu Thank you, Philippe ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/bridge: dw-mipi-dsi: permit configuring the escape clock rate
On 9/4/20 2:55 PM, Neil Armstrong wrote: > The Amlogic D-PHY in the Amlogic AXG SoC Family does support a frequency > higher than 10MHz for the TX Escape Clock, thus make the target rate > configurable. > > Signed-off-by: Neil Armstrong > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 25 +++ > include/drm/bridge/dw_mipi_dsi.h | 1 + > 2 files changed, 21 insertions(+), 5 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index d580b2aa4ce9..31fc965c66fd 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -562,15 +562,30 @@ static void dw_mipi_dsi_disable(struct dw_mipi_dsi *dsi) > > static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi) > { > + const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; > + unsigned int esc_rate; /* in MHz */ > + u32 esc_clk_division; > + int ret; > + > /* >* The maximum permitted escape clock is 20MHz and it is derived from > - * lanebyteclk, which is running at "lane_mbps / 8". Thus we want: > - * > - * (lane_mbps >> 3) / esc_clk_division < 20 > + * lanebyteclk, which is running at "lane_mbps / 8". > + */ > + if (phy_ops->get_esc_clk_rate) { > + ret = phy_ops->get_esc_clk_rate(dsi->plat_data->priv_data, > + _rate); > + if (ret) > + DRM_DEBUG_DRIVER("Phy get_esc_clk_rate() failed\n"); > + } else > + esc_rate = 20; /* Default to 20MHz */ > + > + /* > + * We want : > + * (lane_mbps >> 3) / esc_clk_division < X >* which is: > - * (lane_mbps >> 3) / 20 > esc_clk_division > + * (lane_mbps >> 3) / X > esc_clk_division >*/ > - u32 esc_clk_division = (dsi->lane_mbps >> 3) / 20 + 1; > + esc_clk_division = (dsi->lane_mbps >> 3) / esc_rate + 1; > > dsi_write(dsi, DSI_PWR_UP, RESET); > > diff --git a/include/drm/bridge/dw_mipi_dsi.h > b/include/drm/bridge/dw_mipi_dsi.h > index b0e390b3288e..bda8aa7c2280 100644 > --- a/include/drm/bridge/dw_mipi_dsi.h > +++ b/include/drm/bridge/dw_mipi_dsi.h > @@ -36,6 +36,7 @@ struct dw_mipi_dsi_phy_ops { >unsigned int *lane_mbps); > int (*get_timing)(void *priv_data, unsigned int lane_mbps, > struct dw_mipi_dsi_dphy_timing *timing); > + int (*get_esc_clk_rate)(void *priv_data, unsigned int *esc_clk_rate); > }; > > struct dw_mipi_dsi_host_ops { > Hi Neil, Thank you for the patch Reviewed-by: Philippe Cornu Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/bridge/synopsys: dsi: allow LP commands in video mode
On 7/8/20 4:08 PM, Yannick Fertre wrote: > From: Antonio Borneo > > Current code only sends LP commands in command mode. > > Allows sending LP commands also in video mode by setting the > proper flag in DSI_VID_MODE_CFG. > > Signed-off-by: Antonio Borneo > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 8 > 1 file changed, 8 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index 1a24ea648ef8..e9a0f42ff99f 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -89,6 +89,7 @@ > #define VID_MODE_TYPE_NON_BURST_SYNC_EVENTS 0x1 > #define VID_MODE_TYPE_BURST 0x2 > #define VID_MODE_TYPE_MASK 0x3 > +#define ENABLE_LOW_POWER_CMD BIT(15) > #define VID_MODE_VPG_ENABLE BIT(16) > #define VID_MODE_VPG_HORIZONTAL BIT(24) > > @@ -376,6 +377,13 @@ static void dw_mipi_message_config(struct dw_mipi_dsi > *dsi, > > dsi_write(dsi, DSI_LPCLK_CTRL, lpm ? 0 : PHY_TXREQUESTCLKHS); > dsi_write(dsi, DSI_CMD_MODE_CFG, val); > + > + val = dsi_read(dsi, DSI_VID_MODE_CFG); > + if (lpm) > + val |= ENABLE_LOW_POWER_CMD; > + else > + val &= ~ENABLE_LOW_POWER_CMD; > + dsi_write(dsi, DSI_VID_MODE_CFG, val); > } > > static int dw_mipi_dsi_gen_pkt_hdr_write(struct dw_mipi_dsi *dsi, u32 > hdr_val) > (+ Antonio) Hi Yannick & Antonio, Reviewed-by: Philippe Cornu Tested-by: Philippe Cornu (Tested with the 3 patches named drm/bridge/synopsys: dsi: allow LP commands in video mode drm/bridge/synopsys: dsi: allow sending longer LP commands drm/bridge/synopsys: dsi: add support for non-continuous HS clock on various dsi bridges + stm32mp157 disco board) Many thanks Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/bridge/synopsys: dsi: allow sending longer LP commands
On 7/1/20 4:31 PM, Yannick Fertre wrote: > From: Antonio Borneo > > Current code does not properly computes the max length of LP > commands that can be send during H or V sync, and rely on static > values. > Limiting the max LP length to 4 byte during the V-sync is overly > conservative. > > Relax the limit and allows longer LP commands (16 bytes) to be > sent during V-sync. > > Signed-off-by: Antonio Borneo > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 17 + > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index d580b2aa4ce9..1a24ea648ef8 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -360,6 +360,15 @@ static void dw_mipi_message_config(struct dw_mipi_dsi > *dsi, > bool lpm = msg->flags & MIPI_DSI_MSG_USE_LPM; > u32 val = 0; > > + /* > + * TODO dw drv improvements > + * largest packet sizes during hfp or during vsa/vpb/vfp > + * should be computed according to byte lane, lane number and only > + * if sending lp cmds in high speed is enable (PHY_TXREQUESTCLKHS) > + */ > + dsi_write(dsi, DSI_DPI_LP_CMD_TIM, OUTVACT_LPCMD_TIME(16) > + | INVACT_LPCMD_TIME(4)); > + > if (msg->flags & MIPI_DSI_MSG_REQ_ACK) > val |= ACK_RQST_EN; > if (lpm) > @@ -611,14 +620,6 @@ static void dw_mipi_dsi_dpi_config(struct dw_mipi_dsi > *dsi, > dsi_write(dsi, DSI_DPI_VCID, DPI_VCID(dsi->channel)); > dsi_write(dsi, DSI_DPI_COLOR_CODING, color); > dsi_write(dsi, DSI_DPI_CFG_POL, val); > - /* > - * TODO dw drv improvements > - * largest packet sizes during hfp or during vsa/vpb/vfp > - * should be computed according to byte lane, lane number and only > - * if sending lp cmds in high speed is enable (PHY_TXREQUESTCLKHS) > - */ > - dsi_write(dsi, DSI_DPI_LP_CMD_TIM, OUTVACT_LPCMD_TIME(4) > - | INVACT_LPCMD_TIME(4)); > } > > static void dw_mipi_dsi_packet_handler_config(struct dw_mipi_dsi *dsi) > (+ Antonio) Hi Yannick & Antonio, Reviewed-by: Philippe Cornu Tested-by: Philippe Cornu (Tested with the 3 patches named drm/bridge/synopsys: dsi: allow LP commands in video mode drm/bridge/synopsys: dsi: allow sending longer LP commands drm/bridge/synopsys: dsi: add support for non-continuous HS clock on various dsi bridges + stm32mp157 disco board) Many thanks Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/bridge/synopsys: dsi: add support for non-continuous HS clock
On 7/1/20 9:42 PM, Yannick Fertre wrote: > From: Antonio Borneo > > Current code enables the HS clock when video mode is started or to > send out a HS command, and disables the HS clock to send out a LP > command. This is not what DSI spec specify. > > Enable HS clock either in command and in video mode. > Set automatic HS clock management for panels and devices that > support non-continuous HS clock. > > Signed-off-by: Antonio Borneo > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index d580b2aa4ce9..979acaa90d00 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -365,7 +365,6 @@ static void dw_mipi_message_config(struct dw_mipi_dsi > *dsi, > if (lpm) > val |= CMD_MODE_ALL_LP; > > - dsi_write(dsi, DSI_LPCLK_CTRL, lpm ? 0 : PHY_TXREQUESTCLKHS); > dsi_write(dsi, DSI_CMD_MODE_CFG, val); > } > > @@ -541,16 +540,22 @@ static void dw_mipi_dsi_video_mode_config(struct > dw_mipi_dsi *dsi) > static void dw_mipi_dsi_set_mode(struct dw_mipi_dsi *dsi, >unsigned long mode_flags) > { > + u32 val; > + > dsi_write(dsi, DSI_PWR_UP, RESET); > > if (mode_flags & MIPI_DSI_MODE_VIDEO) { > dsi_write(dsi, DSI_MODE_CFG, ENABLE_VIDEO_MODE); > dw_mipi_dsi_video_mode_config(dsi); > - dsi_write(dsi, DSI_LPCLK_CTRL, PHY_TXREQUESTCLKHS); > } else { > dsi_write(dsi, DSI_MODE_CFG, ENABLE_CMD_MODE); > } > > + val = PHY_TXREQUESTCLKHS; > + if (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) > + val |= AUTO_CLKLANE_CTRL; > + dsi_write(dsi, DSI_LPCLK_CTRL, val); > + > dsi_write(dsi, DSI_PWR_UP, POWERUP); > } > > (+ Antonio) Hi Yannick & Antonio, Reviewed-by: Philippe Cornu Tested-by: Philippe Cornu (Tested with the 3 patches named drm/bridge/synopsys: dsi: allow LP commands in video mode drm/bridge/synopsys: dsi: allow sending longer LP commands drm/bridge/synopsys: dsi: add support for non-continuous HS clock on various dsi bridges + stm32mp157 disco board) Many thanks Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] drm/bridge: dw-mipi-dsi.c: Add VPG runtime config through debugfs
On 7/8/20 7:08 PM, Angelo Ribeiro wrote: > Hi, > > Is this patch good to go? > @dan...@ffwll.ch, @Philippe CORNU > > Was already tested by @Yannick FERTRE > and @Adrian Pop > on https://lkml.org/lkml/2020/4/6/691 . > > Thanks, > Angelo > > From: Yannick > FERTRE > Date: Wed, Jun 24, 2020 at 16:35:04 > >> Hello Angelo, >> thanks for the patch. >> Tested-by: Yannick Fertre >> Tested OK on STM32MP1-DISCO, DSI v1.31 >> >> Best regards >> >> >> On 4/6/20 3:49 PM, Angelo Ribeiro wrote: >>> Add support for the video pattern generator (VPG) BER pattern mode and >>> configuration in runtime. >>> >>> This enables using the debugfs interface to manipulate the VPG after >>> the pipeline is set. >>> Also, enables the usage of the VPG BER pattern. >>> >>> Changes in v2: >>> - Added VID_MODE_VPG_MODE >>> - Solved incompatible return type on __get and __set >>> >>> Reported-by: kbuild test robot >>> Reported-by: Adrian Pop >>> Cc: Gustavo Pimentel >>> Cc: Joao Pinto >>> Cc: Jose Abreu >>> Signed-off-by: Angelo Ribeiro >>> --- >>>drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 98 >>> --- >>>1 file changed, 90 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c >>> b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c >>> index b18351b..9de3645 100644 >>> --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c >>> +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c >>> @@ -91,6 +91,7 @@ >>>#define VID_MODE_TYPE_BURST 0x2 >>>#define VID_MODE_TYPE_MASK 0x3 >>>#define VID_MODE_VPG_ENABLE BIT(16) >>> +#define VID_MODE_VPG_MODE BIT(20) >>>#define VID_MODE_VPG_HORIZONTAL BIT(24) >>> >>>#define DSI_VID_PKT_SIZE 0x3c >>> @@ -221,6 +222,21 @@ >>>#define PHY_STATUS_TIMEOUT_US1 >>>#define CMD_PKT_STATUS_TIMEOUT_US2 >>> >>> +#ifdef CONFIG_DEBUG_FS >>> +#define VPG_DEFS(name, dsi) \ >>> + ((void __force *)&((*dsi).vpg_defs.name)) >>> + >>> +#define REGISTER(name, mask, dsi) \ >>> + { #name, VPG_DEFS(name, dsi), mask, dsi } >>> + >>> +struct debugfs_entries { >>> + const char *name; >>> + bool*reg; >>> + u32 mask; >>> + struct dw_mipi_dsi *dsi; >>> +}; >>> +#endif /* CONFIG_DEBUG_FS */ >>> + >>>struct dw_mipi_dsi { >>> struct drm_bridge bridge; >>> struct mipi_dsi_host dsi_host; >>> @@ -238,9 +254,12 @@ struct dw_mipi_dsi { >>> >>>#ifdef CONFIG_DEBUG_FS >>> struct dentry *debugfs; >>> - >>> - bool vpg; >>> - bool vpg_horizontal; >>> + struct debugfs_entries *debugfs_vpg; >>> + struct { >>> + bool vpg; >>> + bool vpg_horizontal; >>> + bool vpg_ber_pattern; >>> + } vpg_defs; >>>#endif /* CONFIG_DEBUG_FS */ >>> >>> struct dw_mipi_dsi *master; /* dual-dsi master ptr */ >>> @@ -530,9 +549,11 @@ static void dw_mipi_dsi_video_mode_config(struct >>> dw_mipi_dsi *dsi) >>> val |= VID_MODE_TYPE_NON_BURST_SYNC_EVENTS; >>> >>>#ifdef CONFIG_DEBUG_FS >>> - if (dsi->vpg) { >>> + if (dsi->vpg_defs.vpg) { >>> val |= VID_MODE_VPG_ENABLE; >>> - val |= dsi->vpg_horizontal ? VID_MODE_VPG_HORIZONTAL : 0; >>> + val |= dsi->vpg_defs.vpg_horizontal ? >>> + VID_MODE_VPG_HORIZONTAL : 0; >>> + val |= dsi->vpg_defs.vpg_ber_pattern ? VID_MODE_VPG_MODE : 0; >>> } >>>#endif /* CONFIG_DEBUG_FS */ >>> >>> @@ -961,6 +982,68 @@ static const struct drm_bridge_funcs >>> dw_mipi_dsi_bridge_funcs = { >>> >>>#ifdef CONFIG_DEBUG_FS >>> >>> +int dw_mipi_dsi_debugfs_write(void *data, u64 val) >>> +{ >>> + struct debugfs_entries *vpg = data; >>> + struct dw_mipi_dsi *dsi; >>> + u32 mode_cfg; >>> + >>> +
Re: [PATCH] drm/stm: repair runtime power management
On 2/29/20 11:16 PM, Marek Vasut wrote: > Add missing pm_runtime_get_sync() into ltdc_crtc_atomic_enable() to > match pm_runtime_put_sync() in ltdc_crtc_atomic_disable(), otherwise > the LTDC might suspend via runtime PM, disable clock, and then fail > to resume later on. > > The test which triggers it is roughly -- run qt5 application which > uses eglfs platform and etnaviv, stop the application, sleep for 15 > minutes, run the application again. This leads to a timeout waiting > for vsync, because the LTDC has suspended, but did not resume. > > Fixes: 35ab6cfbf211 ("drm/stm: support runtime power management") > Signed-off-by: Marek Vasut > Cc: Yannick Fertré > Cc: Philippe Cornu > Cc: Benjamin Gaignard > Cc: Vincent Abriou > Cc: Maxime Coquelin > Cc: Alexandre Torgue > To: dri-devel@lists.freedesktop.org > Cc: linux-st...@st-md-mailman.stormreply.com > Cc: linux-arm-ker...@lists.infradead.org > --- > [ cut here ] > WARNING: CPU: 0 PID: 297 at drivers/gpu/drm/drm_atomic_helper.c:1494 > drm_atomic_helper_wait_for_vblanks+0x1dc/0x200 > [CRTC:35:crtc-0] vblank wait timed out > Modules linked in: > CPU: 0 PID: 297 Comm: QSGRenderThread Not tainted > 5.6.0-rc3-next-20200228-00010-g318bf0fc08ef #2 > Hardware name: STM32 (Device Tree Support) > [] (unwind_backtrace) from [] (show_stack+0x10/0x14) > [] (show_stack) from [] (dump_stack+0xb4/0xd0) > [] (dump_stack) from [] (__warn+0xd4/0xf0) > [] (__warn) from [] (warn_slowpath_fmt+0x78/0xa8) > [] (warn_slowpath_fmt) from [] > (drm_atomic_helper_wait_for_vblanks+0x1dc/0x200) > [] (drm_atomic_helper_wait_for_vblanks) from [] > (drm_atomic_helper_commit_tail+0 > x50/0x60) > [] (drm_atomic_helper_commit_tail) from [] > (commit_tail+0x12c/0x13c) > [] (commit_tail) from [] > (drm_atomic_helper_commit+0xf4/0x100) > [] (drm_atomic_helper_commit) from [] > (drm_atomic_helper_set_config+0x58/0x6c) > [] (drm_atomic_helper_set_config) from [] > (drm_mode_setcrtc+0x450/0x550) > [] (drm_mode_setcrtc) from [] (drm_ioctl_kernel+0x90/0xe8) > [] (drm_ioctl_kernel) from [] (drm_ioctl+0x2e4/0x32c) > [] (drm_ioctl) from [] (vfs_ioctl+0x20/0x38) > [] (vfs_ioctl) from [] (ksys_ioctl+0xbc/0x7b0) > [] (ksys_ioctl) from [] (ret_fast_syscall+0x0/0x54) > Exception stack(0xee8f3fa8 to 0xee8f3ff0) > 3fa0: 0005 adcbeb18 0005 c06864a2 adcbeb18 0001 > 3fc0: 0005 adcbeb18 c06864a2 0036 0029 0023 0023 0007 > 3fe0: b113b098 adcbeafc b1125413 b6155cf8 > ---[ end trace 2ad5ba954ceb767a ]--- > --- > drivers/gpu/drm/stm/ltdc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 99bf93e8b36f..301de0498078 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -425,9 +425,12 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc > *crtc, > struct drm_crtc_state *old_state) > { > struct ltdc_device *ldev = crtc_to_ltdc(crtc); > + struct drm_device *ddev = crtc->dev; > > DRM_DEBUG_DRIVER("\n"); > > + pm_runtime_get_sync(ddev->dev); > + > /* Sets the background color value */ > reg_write(ldev->regs, LTDC_BCCR, BCCR_BCBLACK); > > Hi Marek, Many thanks for your patch, Acked-by: Philippe Cornu Tested-by: Yannick Fertre Hi Benjamin, Could you please apply "drm/stm: ltdc: remove call of pm-runtime functions" **before** this one. Thank you. Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: remove call of pm-runtime functions
On 7/1/20 2:04 PM, Yannick Fertre wrote: > It is not necessary to suspend or stop the ltdc clocks > to modify the pixel clock. > > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/stm/ltdc.c | 16 > 1 file changed, 16 deletions(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 3f590d916e91..6e28f707092f 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -506,15 +506,7 @@ static bool ltdc_crtc_mode_fixup(struct drm_crtc *crtc, >struct drm_display_mode *adjusted_mode) > { > struct ltdc_device *ldev = crtc_to_ltdc(crtc); > - struct drm_device *ddev = crtc->dev; > int rate = mode->clock * 1000; > - bool runtime_active; > - int ret; > - > - runtime_active = pm_runtime_active(ddev->dev); > - > - if (runtime_active) > - pm_runtime_put_sync(ddev->dev); > > if (clk_set_rate(ldev->pixel_clk, rate) < 0) { > DRM_ERROR("Cannot set rate (%dHz) for pixel clk\n", rate); > @@ -523,14 +515,6 @@ static bool ltdc_crtc_mode_fixup(struct drm_crtc *crtc, > > adjusted_mode->clock = clk_get_rate(ldev->pixel_clk) / 1000; > > - if (runtime_active) { > - ret = pm_runtime_get_sync(ddev->dev); > - if (ret) { > - DRM_ERROR("Failed to fixup mode, cannot get sync\n"); > - return false; > - } > - } > - > DRM_DEBUG_DRIVER("requested clock %dkHz, adjusted clock %dkHz\n", >mode->clock, adjusted_mode->clock); > > Hi Yannick, Many thanks for your patch, Acked-by: Philippe Cornu Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: repair runtime power management
On 7/1/20 2:14 PM, Yannick FERTRE wrote: > > > On 3/9/20 12:57 PM, Marek Vasut wrote: >> On 3/9/20 11:35 AM, Yannick FERTRE wrote: >>> Hello Marek, >> >> Hi, >> >> (please stop top-posting) >> >>> Thank for your patch. Pm_runtime_put_sync is also done into function >>> ltdc_crtc_mode_fixup. >>> To avoid several call of Pm_runtime_put_sync, it could be better to check >>> pm_runtime activity: >>> >>> + int ret; >>> >>> DRM_DEBUG_DRIVER("\n"); >>> >>> + if (!pm_runtime_active(ddev->dev)) { >>> + ret = pm_runtime_get_sync(ddev->dev); >>> + if (ret) { >>> + DRM_ERROR("Failed to enable crtc, cannot get sync\n"); >>> + return; >>> + } >>> + } >>> + >> >> Where should this go ? And wouldn't that only hide nastier PM imbalance >> issues ? > Hi Marek, > I tested the patch & it generate an error when I try wake up / sleep > the board STM32MP1 DK2 with weston application. > It need an additional patch > drm-stm-ltdc-remove-call-of-pm-runtime-functions. > > Thanks for the patch. > > Tested-by: Yannick Fertre > Hi Marek, before merging the 2 patches, I would like to be sure that Yannick's patch does not "break" your use case (Qt I think)? May I ask you please to give it a try? Note: If you think there is no need to do extra checks, simply tell me of course Philippe :-) > >> >>>Best regards >>> >>> Yannick Fertré >>> >>> >>> -Original Message- >>> From: Marek Vasut >>> Sent: samedi 29 février 2020 23:17 >>> To: dri-devel@lists.freedesktop.org >>> Cc: Marek Vasut ; Yannick FERTRE ; >>> Philippe CORNU ; Benjamin Gaignard >>> ; Vincent ABRIOU ; >>> Maxime Coquelin ; Alexandre TORGUE >>> ; linux-st...@st-md-mailman.stormreply.com; >>> linux-arm-ker...@lists.infradead.org >>> Subject: [PATCH] drm/stm: repair runtime power management >>> >>> Add missing pm_runtime_get_sync() into ltdc_crtc_atomic_enable() to match >>> pm_runtime_put_sync() in ltdc_crtc_atomic_disable(), otherwise the LTDC >>> might suspend via runtime PM, disable clock, and then fail to resume later >>> on. >>> >>> The test which triggers it is roughly -- run qt5 application which uses >>> eglfs platform and etnaviv, stop the application, sleep for 15 minutes, run >>> the application again. This leads to a timeout waiting for vsync, because >>> the LTDC has suspended, but did not resume. >>> >>> Fixes: 35ab6cfbf211 ("drm/stm: support runtime power management") >>> Signed-off-by: Marek Vasut >>> Cc: Yannick Fertré >>> Cc: Philippe Cornu >>> Cc: Benjamin Gaignard >>> Cc: Vincent Abriou >>> Cc: Maxime Coquelin >>> Cc: Alexandre Torgue >>> To: dri-devel@lists.freedesktop.org >>> Cc: linux-st...@st-md-mailman.stormreply.com >>> Cc: linux-arm-ker...@lists.infradead.org >>> --- >>> [ cut here ] >>> WARNING: CPU: 0 PID: 297 at drivers/gpu/drm/drm_atomic_helper.c:1494 >>> drm_atomic_helper_wait_for_vblanks+0x1dc/0x200 >>> [CRTC:35:crtc-0] vblank wait timed out >>> Modules linked in: >>> CPU: 0 PID: 297 Comm: QSGRenderThread Not tainted >>> 5.6.0-rc3-next-20200228-00010-g318bf0fc08ef #2 Hardware name: STM32 (Device >>> Tree Support) [] (unwind_backtrace) from [] >>> (show_stack+0x10/0x14) [] (show_stack) from [] >>> (dump_stack+0xb4/0xd0) [] (dump_stack) from [] >>> (__warn+0xd4/0xf0) [] (__warn) from [] >>> (warn_slowpath_fmt+0x78/0xa8) [] (warn_slowpath_fmt) from >>> [] (drm_atomic_helper_wait_for_vblanks+0x1dc/0x200) >>> [] (drm_atomic_helper_wait_for_vblanks) from [] >>> (drm_atomic_helper_commit_tail+0 >>> x50/0x60) >>> [] (drm_atomic_helper_commit_tail) from [] >>> (commit_tail+0x12c/0x13c) [] (commit_tail) from [] >>> (drm_atomic_helper_commit+0xf4/0x100) >>> [] (drm_atomic_helper_commit) from [] >>> (drm_atomic_helper_set_config+0x58/0x6c) >>> [] (drm_atomic_helper_set_config) from [] >>> (drm_mode_setcrtc+0x450/0x550) [] (drm_mode_setcrtc) from >>> [] (drm_ioctl_kernel+0x90/0xe8) [] (drm_ioctl_kernel) >>> from [] (drm_ioctl+0x2e4/0x32c) [] (drm_ioctl) from >>> [] (vfs_ioctl+0x20/0x38) [] (vfs_ioctl) fro
Re: [Linux-stm32] [PATCH v8 08/10] drm: stm: dw-mipi-dsi: let the bridge handle the HW version check
Hi Adrian, and thank you very much for the patchset. Thank you also for having tested it on STM32F769 and STM32MP1. Sorry for the late response, Yannick and I will review it as soon as possible and we will keep you posted. Note: Do not hesitate to put us in copy for the next version (philippe.co...@st.com, yannick.fer...@st.com) Regards, Philippe :-) On 4/27/20 10:19 AM, Adrian Ratiu wrote: > The stm mipi-dsi platform driver added a version test in > commit fa6251a747b7 ("drm/stm: dsi: check hardware version") > so that HW revisions other than v1.3x get rejected. The rockchip > driver had no such check and just assumed register layouts are > v1.3x compatible. > > Having such tests was a good idea because only v130/v131 layouts > were supported at the time, however since adding multiple layout > support in the bridge, the version is automatically checked for > all drivers, compatible layouts get picked and unsupported HW is > automatically rejected by the bridge, so there's no use keeping > the test in the stm driver. > > The main reason prompting this change is that the stm driver > test immediately disabled the peripheral clock after reading > the version, making the bridge read version 0x0 immediately > after in its own probe(), so we move the clock disabling after > the bridge does the version test. > > Tested on STM32F769 and STM32MP1. > > Cc: linux-st...@st-md-mailman.stormreply.com > Reported-by: Adrian Pop > Tested-by: Adrian Pop > Tested-by: Arnaud Ferraris > Signed-off-by: Adrian Ratiu > --- > New in v6. > --- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 12 +++- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > index 2e1f2664495d0..7218e405d7e2b 100644 > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > @@ -402,15 +402,6 @@ static int dw_mipi_dsi_stm_probe(struct platform_device > *pdev) > goto err_dsi_probe; > } > > - dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION; > - clk_disable_unprepare(pclk); > - > - if (dsi->hw_version != HWVER_130 && dsi->hw_version != HWVER_131) { > - ret = -ENODEV; > - DRM_ERROR("bad dsi hardware version\n"); > - goto err_dsi_probe; > - } > - > dw_mipi_dsi_stm_plat_data.base = dsi->base; > dw_mipi_dsi_stm_plat_data.priv_data = dsi; > > @@ -423,6 +414,9 @@ static int dw_mipi_dsi_stm_probe(struct platform_device > *pdev) > goto err_dsi_probe; > } > > + dsi->hw_version = dsi_read(dsi, DSI_VERSION) & VERSION; > + clk_disable_unprepare(pclk); > + > return 0; > > err_dsi_probe: > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 17/21] drm/stm: Use GEM CMA object functions
On 5/22/20 3:52 PM, Thomas Zimmermann wrote: > The stm driver uses the default implementation for CMA functions; except > for the .dumb_create callback. The __DRM_GEM_CMA_DRIVER_OPS macro now sets > these defaults and .dumb_create in struct drm_driver. All remaining > operations are provided by CMA GEM object functions. > > Signed-off-by: Thomas Zimmermann > --- > drivers/gpu/drm/stm/drv.c | 11 +-- > 1 file changed, 1 insertion(+), 10 deletions(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 0f85dd86cafa7..d6238c71fabf6 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -62,16 +62,7 @@ static struct drm_driver drv_driver = { > .minor = 0, > .patchlevel = 0, > .fops = _driver_fops, > - .dumb_create = stm_gem_cma_dumb_create, > - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, > - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > - .gem_free_object_unlocked = drm_gem_cma_free_object, > - .gem_vm_ops = _gem_cma_vm_ops, > - .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, > - .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > - .gem_prime_vmap = drm_gem_cma_prime_vmap, > - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, > - .gem_prime_mmap = drm_gem_cma_prime_mmap, > + __DRM_GEM_CMA_DRIVER_OPS(stm_gem_cma_dumb_create), > }; > > static int drv_load(struct drm_device *ddev) > Hi Thomas, Thank you for the patch. Reviewed-by: Philippe Cornu Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
RE: [PATCH] drm/stm: ltdc: check number of endpoints
Dear Yannick, Thank you for your patch, Acked-by: Philippe Cornu (sorry for the email format) Philippe :-) -Original Message- From: Yannick FERTRE Sent: Friday, February 28, 2020 09:08 To: Yannick FERTRE ; Philippe CORNU ; Benjamin GAIGNARD ; David Airlie ; Daniel Vetter ; Maxime Coquelin ; Alexandre TORGUE ; dri-devel@lists.freedesktop.org; linux-st...@st-md-mailman.stormreply.com; linux-arm-ker...@lists.infradead.org; linux-ker...@vger.kernel.org Subject: [PATCH] drm/stm: ltdc: check number of endpoints Number of endpoints could exceed the fix value MAX_ENDPOINTS(2). Instead of increase simply this value, the number of endpoint could be read from device tree. Load sequence has been a little rework to take care of several panel or bridge which can be connected/disconnected or enable/disable. Signed-off-by: Yannick Fertre --- drivers/gpu/drm/stm/ltdc.c | 102 +++-- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c index df585fe..f894968 100644 --- a/drivers/gpu/drm/stm/ltdc.c +++ b/drivers/gpu/drm/stm/ltdc.c @@ -42,8 +42,6 @@ #define MAX_IRQ 4 -#define MAX_ENDPOINTS 2 - #define HWVER_10200 0x010200 #define HWVER_10300 0x010300 #define HWVER_20101 0x020101 @@ -1201,36 +1199,20 @@ int ltdc_load(struct drm_device *ddev) struct ltdc_device *ldev = ddev->dev_private; struct device *dev = ddev->dev; struct device_node *np = dev->of_node; - struct drm_bridge *bridge[MAX_ENDPOINTS] = {NULL}; - struct drm_panel *panel[MAX_ENDPOINTS] = {NULL}; + struct drm_bridge *bridge; + struct drm_panel *panel; struct drm_crtc *crtc; struct reset_control *rstc; struct resource *res; - int irq, ret, i, endpoint_not_ready = -ENODEV; + int irq, i, nb_endpoints; + int ret = -ENODEV; DRM_DEBUG_DRIVER("\n"); - /* Get endpoints if any */ - for (i = 0; i < MAX_ENDPOINTS; i++) { - ret = drm_of_find_panel_or_bridge(np, 0, i, [i], - [i]); - - /* -* If at least one endpoint is -EPROBE_DEFER, defer probing, -* else if at least one endpoint is ready, continue probing. -*/ - if (ret == -EPROBE_DEFER) - return ret; - else if (!ret) - endpoint_not_ready = 0; - } - - if (endpoint_not_ready) - return endpoint_not_ready; - - rstc = devm_reset_control_get_exclusive(dev, NULL); - - mutex_init(>err_lock); + /* Get number of endpoints */ + nb_endpoints = of_graph_get_endpoint_count(np); + if (!nb_endpoints) + return -ENODEV; ldev->pixel_clk = devm_clk_get(dev, "lcd"); if (IS_ERR(ldev->pixel_clk)) { @@ -1244,6 +1226,43 @@ int ltdc_load(struct drm_device *ddev) return -ENODEV; } + /* Get endpoints if any */ + for (i = 0; i < nb_endpoints; i++) { + ret = drm_of_find_panel_or_bridge(np, 0, i, , ); + + /* +* If at least one endpoint is -ENODEV, continue probing, +* else if at least one endpoint returned an error +* (ie -EPROBE_DEFER) then stop probing. +*/ + if (ret == -ENODEV) + continue; + else if (ret) + goto err; + + if (panel) { + bridge = drm_panel_bridge_add_typed(panel, + DRM_MODE_CONNECTOR_DPI); + if (IS_ERR(bridge)) { + DRM_ERROR("panel-bridge endpoint %d\n", i); + ret = PTR_ERR(bridge); + goto err; + } + } + + if (bridge) { + ret = ltdc_encoder_init(ddev, bridge); + if (ret) { + DRM_ERROR("init encoder endpoint %d\n", i); + goto err; + } + } + } + + rstc = devm_reset_control_get_exclusive(dev, NULL); + + mutex_init(>err_lock); + if (!IS_ERR(rstc)) { reset_control_assert(rstc); usleep_range(10, 20); @@ -1285,27 +1304,7 @@ int ltdc_load(struct drm_device *ddev) DRM_ERROR("Failed to register LTDC interrupt\n"); goto err; } - } - /* Add endpoints panels or bridges if any */ - for (i = 0; i < MAX_ENDPOINTS; i++) { - if (pa
Re: [PATCH 39/52] drm/stm: Drop explicit drm_mode_config_cleanup call
Hi Daniel, On 2/19/20 11:21 AM, Daniel Vetter wrote: > It's right above the drm_dev_put(). > > Aside: Another driver with a bit much devm_kzalloc, which should > probably use drmm_kzalloc instead ... > > Signed-off-by: Daniel Vetter > Cc: Yannick Fertre > Cc: Philippe Cornu > Cc: Benjamin Gaignard > Cc: Vincent Abriou > Cc: Maxime Coquelin > Cc: Alexandre Torgue > Cc: linux-st...@st-md-mailman.stormreply.com > Cc: linux-arm-ker...@lists.infradead.org > --- > drivers/gpu/drm/stm/drv.c | 10 -- > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index ea9fcbdc68b3..5b374531dd8c 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -88,7 +88,9 @@ static int drv_load(struct drm_device *ddev) > > ddev->dev_private = (void *)ldev; > > - drm_mode_config_init(ddev); > + ret = drm_mode_config_init(ddev); > + if (ret) > + return ret; > > /* >* set max width and height as default value. > @@ -103,7 +105,7 @@ static int drv_load(struct drm_device *ddev) > > ret = ltdc_load(ddev); > if (ret) > - goto err; > + return ret; > > drm_mode_config_reset(ddev); > drm_kms_helper_poll_init(ddev); > @@ -111,9 +113,6 @@ static int drv_load(struct drm_device *ddev) > platform_set_drvdata(pdev, ddev); > > return 0; > -err: > - drm_mode_config_cleanup(ddev); > - return ret; > } > > static void drv_unload(struct drm_device *ddev) > @@ -122,7 +121,6 @@ static void drv_unload(struct drm_device *ddev) > > drm_kms_helper_poll_fini(ddev); > ltdc_unload(ddev); > - drm_mode_config_cleanup(ddev); > } > > static __maybe_unused int drv_suspend(struct device *dev) > Thank you for your patch, For this stm part, Acked-by: Philippe Cornu note: we will handle devm_kzalloc() asap, thanks. Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 1/3] dt-bindings: one file of all simple DSI panels
Hi Benjamin, and many thanks for this serie. Regarding this patch: Reviewed-by: Philippe Cornu Philippe :-) On 2/6/20 2:33 PM, Benjamin Gaignard wrote: > From: Sam Ravnborg > > To complement panel-simple.yaml, create panel-simple-dsi.yaml. > panel-simple-dsi-yaml are for all simple DSP panels with a single > power-supply and optional backlight / enable GPIO. > > Migrate panasonic,vvx10f034n00 over to the new file. > > The objectives with one file for all the simple DSI panels are: > - Make it simpler to add bindings for simple DSI panels > - Keep the number of bindings file lower > - Keep the binding documentation for simple DSI panels more consistent > > Signed-off-by: Sam Ravnborg > Signed-off-by: Benjamin Gaignard > Cc: Thierry Reding > Cc: Rob Herring > Cc: Maxime Ripard > Cc: Yannick Fertre > Cc: Mark Rutland > Cc: Daniel Vetter > Cc: dri-devel@lists.freedesktop.org > Cc: devicet...@vger.kernel.org > --- > version 4: > - remove orisetech,otm8009a and raydium,rm68200 compatibles > - remove reset-gpios optional property > > version 3: > - add orisetech,otm8009a and raydium,rm68200 compatibles > - add reset-gpios optional property > - fix indentation on compatible enumeration > > .../display/panel/panasonic,vvx10f034n00.txt | 20 --- > .../bindings/display/panel/panel-simple-dsi.yaml | 67 > ++ > 2 files changed, 67 insertions(+), 20 deletions(-) > delete mode 100644 > Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt > create mode 100644 > Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml > > diff --git > a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt > b/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt > deleted file mode 100644 > index 37dedf6a6702.. > --- > a/Documentation/devicetree/bindings/display/panel/panasonic,vvx10f034n00.txt > +++ /dev/null > @@ -1,20 +0,0 @@ > -Panasonic 10" WUXGA TFT LCD panel > - > -Required properties: > -- compatible: should be "panasonic,vvx10f034n00" > -- reg: DSI virtual channel of the peripheral > -- power-supply: phandle of the regulator that provides the supply voltage > - > -Optional properties: > -- backlight: phandle of the backlight device attached to the panel > - > -Example: > - > - mdss_dsi@fd922800 { > - panel@0 { > - compatible = "panasonic,vvx10f034n00"; > - reg = <0>; > - power-supply = <_vsp>; > - backlight = <_wled>; > - }; > - }; > diff --git > a/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml > b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml > new file mode 100644 > index ..8b60368a2425 > --- /dev/null > +++ b/Documentation/devicetree/bindings/display/panel/panel-simple-dsi.yaml > @@ -0,0 +1,67 @@ > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/display/panel/panel-simple-dsi.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Simple DSI panels with a single power-supply > + > +maintainers: > + - Thierry Reding > + - Sam Ravnborg > + > +description: | > + This binding file is a collection of the DSI panels that > + requires only a single power-supply. > + There are optionally a backlight and an enable GPIO. > + The panel may use an OF graph binding for the association to the display, > + or it may be a direct child node of the display. > + > + If the panel is more advanced a dedicated binding file is required. > + > +allOf: > + - $ref: panel-common.yaml# > + > +properties: > + > + compatible: > +enum: > + # compatible must be listed in alphabetical order, ordered by > compatible. > + # The description in the comment is mandatory for each compatible. > + > +# Panasonic 10" WUXGA TFT LCD panel > + - panasonic,vvx10f034n00 > + > + reg: > +maxItems: 1 > +description: DSI virtual channel > + > + backlight: true > + enable-gpios: true > + port: true > + power-supply: true > + > +additionalProperties: false > + > +required: > + - compatible > + - power-supply > + - reg > + > +examples: > + - | > +mdss_dsi@fd922800 { > + #address-cells = <1>; > + #size-cells = <0>; > + panel@0 { > +compatible = "panasonic,vvx10f034n00"; > +reg = <0>; > +power-supply = <_lcd_reg>; > + > +port { > + panel: endpoint { > +remote-endpoint = <_out>; > + }; > +}; > + }; > +}; > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 3/3] dt-bindings: panel: Convert orisetech, otm8009a to json-schema
Hi Benjamin, On 2/6/20 2:33 PM, Benjamin Gaignard wrote: > Convert orisetech,otm8009a to json-schema. > > Signed-off-by: Benjamin Gaignard > --- > .../bindings/display/panel/orisetech,otm8009a.txt | 23 -- > .../bindings/display/panel/orisetech,otm8009a.yaml | 53 > ++ > 2 files changed, 53 insertions(+), 23 deletions(-) > delete mode 100644 > Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt > create mode 100644 > Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml > > diff --git > a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt > b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt > deleted file mode 100644 > index 203b03eefb68.. > --- a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.txt > +++ /dev/null > @@ -1,23 +0,0 @@ > -Orise Tech OTM8009A 3.97" 480x800 TFT LCD panel (MIPI-DSI video mode) > - > -The Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD panel connected using > -a MIPI-DSI video interface. Its backlight is managed through the DSI link. > - > -Required properties: > - - compatible: "orisetech,otm8009a" > - - reg: the virtual channel number of a DSI peripheral > - > -Optional properties: > - - reset-gpios: a GPIO spec for the reset pin (active low). > - - power-supply: phandle of the regulator that provides the supply voltage. > - > -Example: > - { > - ... > - panel@0 { > - compatible = "orisetech,otm8009a"; > - reg = <0>; > - reset-gpios = < 7 GPIO_ACTIVE_LOW>; > - power-supply = <>; > - }; > -}; > diff --git > a/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml > b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml > new file mode 100644 > index ..6e6ac995c27b > --- /dev/null > +++ b/Documentation/devicetree/bindings/display/panel/orisetech,otm8009a.yaml > @@ -0,0 +1,53 @@ > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/display/panel/orisetech,otm8009a.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Orise Tech OTM8009A 3.97" 480x800 TFT LCD panel (MIPI-DSI video mode) > + > +maintainers: > + - Philippe CORNU > + > +description: | > + The Orise Tech OTM8009A is a 3.97" 480x800 TFT LCD panel > connected using > + a MIPI-DSI video interface. Its backlight is managed through > the DSI link. > +allOf: > + - $ref: panel-common.yaml# > + > +properties: > + > + compatible: > +const: orisetech,otm8009a > + > + reg: > +maxItems: 1 > +description: DSI virtual channel > + > + enable-gpios: true > + port: true > + power-supply: true > + > + reset-gpios: > +maxItems: 1 > + > +additionalProperties: false > + > +required: > + - compatible > + - reg > + > +examples: > + - | > +dsi@0 { > + #address-cells = <1>; > + #size-cells = <0>; > + panel@0 { > +compatible = "orisetech,otm8009a"; > +reg = <0>; > +reset-gpios = < 15 0>; > +power-supply = <>; > + }; > +}; > +... > + > Reviewed-by: Philippe Cornu Thank you Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 2/3] dt-bindings: panel: Convert raydium,rm68200 to json-schema
Hi Benjamin, On 2/6/20 2:33 PM, Benjamin Gaignard wrote: > Convert raydium,rm68200 to json-schema. > > Signed-off-by: Benjamin Gaignard > --- > .../bindings/display/panel/raydium,rm68200.txt | 25 -- > .../bindings/display/panel/raydium,rm68200.yaml| 56 > ++ > 2 files changed, 56 insertions(+), 25 deletions(-) > delete mode 100644 > Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt > create mode 100644 > Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml > > diff --git > a/Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt > b/Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt > deleted file mode 100644 > index cbb79ef3bfc9.. > --- a/Documentation/devicetree/bindings/display/panel/raydium,rm68200.txt > +++ /dev/null > @@ -1,25 +0,0 @@ > -Raydium Semiconductor Corporation RM68200 5.5" 720p MIPI-DSI TFT LCD panel > - > -The Raydium Semiconductor Corporation RM68200 is a 5.5" 720x1280 TFT LCD > -panel connected using a MIPI-DSI video interface. > - > -Required properties: > - - compatible: "raydium,rm68200" > - - reg: the virtual channel number of a DSI peripheral > - > -Optional properties: > - - reset-gpios: a GPIO spec for the reset pin (active low). > - - power-supply: phandle of the regulator that provides the supply voltage. > - - backlight: phandle of the backlight device attached to the panel. > - > -Example: > - { > - ... > - panel@0 { > - compatible = "raydium,rm68200"; > - reg = <0>; > - reset-gpios = < 15 GPIO_ACTIVE_LOW>; > - power-supply = <>; > - backlight = <_backlight>; > - }; > -}; > diff --git > a/Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml > b/Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml > new file mode 100644 > index ..09149f140d5f > --- /dev/null > +++ b/Documentation/devicetree/bindings/display/panel/raydium,rm68200.yaml > @@ -0,0 +1,56 @@ > +# SPDX-License-Identifier: (GPL-2.0-only or BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/display/panel/raydium,rm68200.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Raydium Semiconductor Corporation RM68200 5.5" 720p MIPI-DSI TFT LCD > panel > + > +maintainers: > + - Philippe CORNU > + > +description: | > + The Raydium Semiconductor Corporation RM68200 is a 5.5" > 720x1280 TFT LCD > + panel connected using a MIPI-DSI video interface. > + > +allOf: > + - $ref: panel-common.yaml# > + > +properties: > + > + compatible: > +const: raydium,rm68200 > + > + reg: > +maxItems: 1 > +description: DSI virtual channel > + > + backlight: true > + enable-gpios: true > + port: true > + power-supply: true > + > + reset-gpios: > +maxItems: 1 > + > +additionalProperties: false > + > +required: > + - compatible > + - power-supply > + - reg > + > +examples: > + - | > +dsi@0 { > + #address-cells = <1>; > + #size-cells = <0>; > + panel@0 { > +compatible = "raydium,rm68200"; > +reg = <0>; > +reset-gpios = < 15 0>; > +power-supply = <>; > +backlight = <_backlight>; > + }; > +}; > +... > Reviewed-by: Philippe Cornu Thank you Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2] dt-bindings: display: Convert etnaviv to json-schema
Hi Benjamin, On 1/28/20 1:31 PM, Benjamin GAIGNARD wrote: > > On 1/28/20 1:06 PM, Maxime Ripard wrote: >> Hi Benjamin, >> >> On Tue, Jan 28, 2020 at 09:20:13AM +0100, Benjamin Gaignard wrote: >>> Convert etnaviv bindings to yaml format. >>> >>> Signed-off-by: Benjamin Gaignard >>> --- >>>.../bindings/display/etnaviv/etnaviv-drm.txt | 36 --- >>>.../devicetree/bindings/gpu/vivante,gc.yaml| 72 >>> ++ >>>2 files changed, 72 insertions(+), 36 deletions(-) >>>delete mode 100644 >>> Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt >>>create mode 100644 Documentation/devicetree/bindings/gpu/vivante,gc.yaml >>> >>> diff --git >>> a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt >>> b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt >>> deleted file mode 100644 >>> index 8def11b16a24.. >>> --- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt >>> +++ /dev/null >>> @@ -1,36 +0,0 @@ >>> -Vivante GPU core devices >>> - >>> - >>> -Required properties: >>> -- compatible: Should be "vivante,gc" >>> - A more specific compatible is not needed, as the cores contain chip >>> - identification registers at fixed locations, which provide all the >>> - necessary information to the driver. >>> -- reg: should be register base and length as documented in the >>> - datasheet >>> -- interrupts: Should contain the cores interrupt line >>> -- clocks: should contain one clock for entry in clock-names >>> - see Documentation/devicetree/bindings/clock/clock-bindings.txt >>> -- clock-names: >>> - - "bus":AXI/master interface clock >>> - - "reg":AHB/slave interface clock >>> - (only required if GPU can gate slave interface >>> independently) >>> - - "core": GPU core clock >>> - - "shader": Shader clock (only required if GPU has feature PIPE_3D) >>> - >>> -Optional properties: >>> -- power-domains: a power domain consumer specifier according to >>> - Documentation/devicetree/bindings/power/power_domain.txt >>> - >>> -example: >>> - >>> -gpu_3d: gpu@13 { >>> - compatible = "vivante,gc"; >>> - reg = <0x0013 0x4000>; >>> - interrupts = <0 9 IRQ_TYPE_LEVEL_HIGH>; >>> - clocks = < IMX6QDL_CLK_GPU3D_AXI>, >>> -< IMX6QDL_CLK_GPU3D_CORE>, >>> -< IMX6QDL_CLK_GPU3D_SHADER>; >>> - clock-names = "bus", "core", "shader"; >>> - power-domains = < 1>; >>> -}; >>> diff --git a/Documentation/devicetree/bindings/gpu/vivante,gc.yaml >>> b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml >>> new file mode 100644 >>> index ..c4f549c0d750 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/gpu/vivante,gc.yaml >>> @@ -0,0 +1,72 @@ >>> +# SPDX-License-Identifier: GPL-2.0 >>> +%YAML 1.2 >>> +--- >>> +$id: http://devicetree.org/schemas/gpu/vivante,gc.yaml# >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# >>> + >>> +title: Vivante GPU Bindings >>> + >>> +description: Vivante GPU core devices >>> + >>> +maintainers: >>> + - Lucas Stach >>> + >>> +properties: >>> + compatible: >>> +const: vivante,gc >>> + >>> + reg: >>> +maxItems: 1 >>> + >>> + interrupts: >>> +maxItems: 1 >>> + >>> + clocks: >>> +items: >>> + - description: AXI/master interface clock >>> + - description: GPU core clock >>> + - description: Shader clock (only required if GPU has feature >>> PIPE_3D) >>> + - description: AHB/slave interface clock (only required if GPU can >>> gate slave interface independently) >> Can you have an AHB slave interface clock without a shader clock? > > No because the items in the list are ordered so you need to have, in > order: "bus", "core", "shader", "reg" > > If it is needed to allow any number of clock in any order I could write > it like this: > > clocks: > > minItems: 1 > > maxItems: 4 > > clock-names: > > items: > > enum: [ bus, core, shader, reg] > > minItems: 1 > > maxItems: 4 > > Benjamin Thank you for your patch, I confirm that your last proposal with enum would be better. With that, Reviewed-by: Philippe Cornu Philippe :-) > >> >>> +minItems: 2 >>> +maxItems: 4 >>> + >>> + clock-names: >>> +items: >>> + - const: bus >>> + - const: core >>> + - const: shader >>> + - const: reg >>> +minItems: 2 >>> +maxItems: 4 >> If so, that check will fail, since it would expect a clock named >> shader on the 3rd item. >> >> It looks good otherwise, thanks! >> Maxime ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v4 14/22] drm/stm: Convert to struct drm_crtc_helper_funcs.get_scanout_position()
Dear Thomas, Thank you for your patch, For this stm part, Acked-by: Philippe Cornu Philippe :-) On 1/23/20 2:59 PM, Thomas Zimmermann wrote: > The callback struct drm_driver.get_scanout_position() is deprecated in > favor of struct drm_crtc_helper_funcs.get_scanout_position(). Convert stm > over. > > Signed-off-by: Thomas Zimmermann > Tested-by: Yannick Fertré > --- > drivers/gpu/drm/stm/drv.c | 1 - > drivers/gpu/drm/stm/ltdc.c | 65 -- > drivers/gpu/drm/stm/ltdc.h | 5 --- > 3 files changed, 34 insertions(+), 37 deletions(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 5a9f9aca8bc2..486985604109 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -72,7 +72,6 @@ static struct drm_driver drv_driver = { > .gem_prime_vmap = drm_gem_cma_prime_vmap, > .gem_prime_vunmap = drm_gem_cma_prime_vunmap, > .gem_prime_mmap = drm_gem_cma_prime_mmap, > - .get_scanout_position = ltdc_crtc_scanoutpos, > .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, > }; > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index c2815e8ae1da..8b6d1a2252e3 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -636,38 +636,13 @@ static void ltdc_crtc_atomic_flush(struct drm_crtc > *crtc, > } > } > > -static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = { > - .mode_valid = ltdc_crtc_mode_valid, > - .mode_fixup = ltdc_crtc_mode_fixup, > - .mode_set_nofb = ltdc_crtc_mode_set_nofb, > - .atomic_flush = ltdc_crtc_atomic_flush, > - .atomic_enable = ltdc_crtc_atomic_enable, > - .atomic_disable = ltdc_crtc_atomic_disable, > -}; > - > -static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc) > -{ > - struct ltdc_device *ldev = crtc_to_ltdc(crtc); > - > - DRM_DEBUG_DRIVER("\n"); > - reg_set(ldev->regs, LTDC_IER, IER_LIE); > - > - return 0; > -} > - > -static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc) > -{ > - struct ltdc_device *ldev = crtc_to_ltdc(crtc); > - > - DRM_DEBUG_DRIVER("\n"); > - reg_clear(ldev->regs, LTDC_IER, IER_LIE); > -} > - > -bool ltdc_crtc_scanoutpos(struct drm_device *ddev, unsigned int pipe, > - bool in_vblank_irq, int *vpos, int *hpos, > - ktime_t *stime, ktime_t *etime, > - const struct drm_display_mode *mode) > +static bool ltdc_crtc_get_scanout_position(struct drm_crtc *crtc, > +bool in_vblank_irq, > +int *vpos, int *hpos, > +ktime_t *stime, ktime_t *etime, > +const struct drm_display_mode *mode) > { > + struct drm_device *ddev = crtc->dev; > struct ltdc_device *ldev = ddev->dev_private; > int line, vactive_start, vactive_end, vtotal; > > @@ -710,6 +685,34 @@ bool ltdc_crtc_scanoutpos(struct drm_device *ddev, > unsigned int pipe, > return true; > } > > +static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = { > + .mode_valid = ltdc_crtc_mode_valid, > + .mode_fixup = ltdc_crtc_mode_fixup, > + .mode_set_nofb = ltdc_crtc_mode_set_nofb, > + .atomic_flush = ltdc_crtc_atomic_flush, > + .atomic_enable = ltdc_crtc_atomic_enable, > + .atomic_disable = ltdc_crtc_atomic_disable, > + .get_scanout_position = ltdc_crtc_get_scanout_position, > +}; > + > +static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc) > +{ > + struct ltdc_device *ldev = crtc_to_ltdc(crtc); > + > + DRM_DEBUG_DRIVER("\n"); > + reg_set(ldev->regs, LTDC_IER, IER_LIE); > + > + return 0; > +} > + > +static void ltdc_crtc_disable_vblank(struct drm_crtc *crtc) > +{ > + struct ltdc_device *ldev = crtc_to_ltdc(crtc); > + > + DRM_DEBUG_DRIVER("\n"); > + reg_clear(ldev->regs, LTDC_IER, IER_LIE); > +} > + > static const struct drm_crtc_funcs ltdc_crtc_funcs = { > .destroy = drm_crtc_cleanup, > .set_config = drm_atomic_helper_set_config, > diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h > index a1ad0ae3b006..c5467d74e707 100644 > --- a/drivers/gpu/drm/stm/ltdc.h > +++ b/drivers/gpu/drm/stm/ltdc.h > @@ -39,11 +39,6 @@ struct ltdc_device { > struct drm_atomic_state *suspend_state; > }; > > -bool ltdc_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, > - bool in_vblank_irq, int
Re: [PATCH v4 15/22] drm/stm: Convert to CRTC VBLANK callbacks
Dear Thomas, Thank you for your patch, For this stm part, Acked-by: Philippe Cornu Philippe :-) On 1/23/20 2:59 PM, Thomas Zimmermann wrote: > VBLANK callbacks in struct drm_driver are deprecated in favor of > their equivalents in struct drm_crtc_funcs. Convert stm over. > > Signed-off-by: Thomas Zimmermann > Tested-by: Yannick Fertré > --- > drivers/gpu/drm/stm/drv.c | 1 - > drivers/gpu/drm/stm/ltdc.c | 1 + > 2 files changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 486985604109..ea9fcbdc68b3 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -72,7 +72,6 @@ static struct drm_driver drv_driver = { > .gem_prime_vmap = drm_gem_cma_prime_vmap, > .gem_prime_vunmap = drm_gem_cma_prime_vunmap, > .gem_prime_mmap = drm_gem_cma_prime_mmap, > - .get_vblank_timestamp = drm_calc_vbltimestamp_from_scanoutpos, > }; > > static int drv_load(struct drm_device *ddev) > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 8b6d1a2252e3..ee2a8cac59cb 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -722,6 +722,7 @@ static const struct drm_crtc_funcs ltdc_crtc_funcs = { > .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, > .enable_vblank = ltdc_crtc_enable_vblank, > .disable_vblank = ltdc_crtc_disable_vblank, > + .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, > .gamma_set = drm_atomic_helper_legacy_gamma_set, > }; > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: add number of interrupts
Dear Yannick, Thank you for your patch, Acked-by: Philippe Cornu Philippe :-) On 1/21/20 11:13 AM, Yannick Fertre wrote: > The number of interrupts depends on the ltdc version. > Don't try to get interrupt which not exist, avoiding > kernel warning messages. > > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/stm/ltdc.c | 30 +++--- > drivers/gpu/drm/stm/ltdc.h | 1 + > 2 files changed, 16 insertions(+), 15 deletions(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index c2815e8..58092b0 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -1146,12 +1146,14 @@ static int ltdc_get_caps(struct drm_device *ddev) > ldev->caps.pad_max_freq_hz = 9000; > if (ldev->caps.hw_version == HWVER_10200) > ldev->caps.pad_max_freq_hz = 6500; > + ldev->caps.nb_irq = 2; > break; > case HWVER_20101: > ldev->caps.reg_ofs = REG_OFS_4; > ldev->caps.pix_fmt_hw = ltdc_pix_fmt_a1; > ldev->caps.non_alpha_only_l1 = false; > ldev->caps.pad_max_freq_hz = 15000; > + ldev->caps.nb_irq = 4; > break; > default: > return -ENODEV; > @@ -1251,13 +1253,21 @@ int ltdc_load(struct drm_device *ddev) > reg_clear(ldev->regs, LTDC_IER, > IER_LIE | IER_RRIE | IER_FUIE | IER_TERRIE); > > - for (i = 0; i < MAX_IRQ; i++) { > + ret = ltdc_get_caps(ddev); > + if (ret) { > + DRM_ERROR("hardware identifier (0x%08x) not supported!\n", > + ldev->caps.hw_version); > + goto err; > + } > + > + DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version); > + > + for (i = 0; i < ldev->caps.nb_irq; i++) { > irq = platform_get_irq(pdev, i); > - if (irq == -EPROBE_DEFER) > + if (irq < 0) { > + ret = irq; > goto err; > - > - if (irq < 0) > - continue; > + } > > ret = devm_request_threaded_irq(dev, irq, ltdc_irq, > ltdc_irq_thread, IRQF_ONESHOT, > @@ -1268,16 +1278,6 @@ int ltdc_load(struct drm_device *ddev) > } > } > > - > - ret = ltdc_get_caps(ddev); > - if (ret) { > - DRM_ERROR("hardware identifier (0x%08x) not supported!\n", > - ldev->caps.hw_version); > - goto err; > - } > - > - DRM_DEBUG_DRIVER("ltdc hw version 0x%08x\n", ldev->caps.hw_version); > - > /* Add endpoints panels or bridges if any */ > for (i = 0; i < MAX_ENDPOINTS; i++) { > if (panel[i]) { > diff --git a/drivers/gpu/drm/stm/ltdc.h b/drivers/gpu/drm/stm/ltdc.h > index a1ad0ae..310e87f 100644 > --- a/drivers/gpu/drm/stm/ltdc.h > +++ b/drivers/gpu/drm/stm/ltdc.h > @@ -19,6 +19,7 @@ struct ltdc_caps { > const u32 *pix_fmt_hw; /* supported pixel formats */ > bool non_alpha_only_l1; /* non-native no-alpha formats on layer 1 */ > int pad_max_freq_hz;/* max frequency supported by pad */ > + int nb_irq; /* number of hardware interrupts */ > }; > > #define LTDC_MAX_LAYER 4 > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: enable/disable depends on encoder
Dear Yannick, Thank you for your patch, Acked-by: Philippe Cornu Philippe :-) On 1/20/20 2:46 PM, Yannick Fertre wrote: > From: Yannick Fertré > > When connected to a dsi host, the ltdc display controller > must send frames only after the end of the dsi panel > initialization to avoid errors when the dsi host sends > commands to the dsi panel (dsi px fifo full). > To avoid this issue, the display controller must be > enabled/disabled when the encoder is enabled/disabled. > > Signed-off-by: Yannick Fertré > --- > drivers/gpu/drm/stm/ltdc.c | 14 -- > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 719dfc5..9ef125d 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -437,9 +437,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, > /* Commit shadow registers = update planes at next vblank */ > reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR); > > - /* Enable LTDC */ > - reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); > - > drm_crtc_vblank_on(crtc); > } > > @@ -453,9 +450,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc > *crtc, > > drm_crtc_vblank_off(crtc); > > - /* disable LTDC */ > - reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); > - > /* disable IRQ */ > reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); > > @@ -1058,9 +1052,13 @@ static const struct drm_encoder_funcs > ltdc_encoder_funcs = { > static void ltdc_encoder_disable(struct drm_encoder *encoder) > { > struct drm_device *ddev = encoder->dev; > + struct ltdc_device *ldev = ddev->dev_private; > > DRM_DEBUG_DRIVER("\n"); > > + /* Disable LTDC */ > + reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); > + > /* Set to sleep state the pinctrl whatever type of encoder */ > pinctrl_pm_select_sleep_state(ddev->dev); > } > @@ -1068,6 +1066,7 @@ static void ltdc_encoder_disable(struct drm_encoder > *encoder) > static void ltdc_encoder_enable(struct drm_encoder *encoder) > { > struct drm_device *ddev = encoder->dev; > + struct ltdc_device *ldev = ddev->dev_private; > > DRM_DEBUG_DRIVER("\n"); > > @@ -1078,6 +1077,9 @@ static void ltdc_encoder_enable(struct drm_encoder > *encoder) >*/ > if (encoder->encoder_type == DRM_MODE_ENCODER_DPI) > pinctrl_pm_select_default_state(ddev->dev); > + > + /* Enable LTDC */ > + reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); > } > > static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = { > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: check number of endpoints
Dear Yannick, Thank you for your patch, Acked-by: Philippe Cornu Philippe :-) On 1/21/20 11:14 AM, Yannick Fertre wrote: > Number of endpoints could exceed the fix value MAX_ENDPOINTS(2). > Instead of increase simply this value, the number of endpoint > could be read from device tree. Load sequence has been a little > rework to take care of several panel or bridge which can be > connected/disconnected or enable/disable. > > Signed-off-by: Yannick Fertré > --- > drivers/gpu/drm/stm/ltdc.c | 104 > ++--- > 1 file changed, 52 insertions(+), 52 deletions(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index c2815e8..dba8e7f 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -42,8 +42,6 @@ > > #define MAX_IRQ 4 > > -#define MAX_ENDPOINTS 2 > - > #define HWVER_10200 0x010200 > #define HWVER_10300 0x010300 > #define HWVER_20101 0x020101 > @@ -1190,36 +1188,20 @@ int ltdc_load(struct drm_device *ddev) > struct ltdc_device *ldev = ddev->dev_private; > struct device *dev = ddev->dev; > struct device_node *np = dev->of_node; > - struct drm_bridge *bridge[MAX_ENDPOINTS] = {NULL}; > - struct drm_panel *panel[MAX_ENDPOINTS] = {NULL}; > + struct drm_bridge *bridge; > + struct drm_panel *panel; > struct drm_crtc *crtc; > struct reset_control *rstc; > struct resource *res; > - int irq, ret, i, endpoint_not_ready = -ENODEV; > + int irq, i, nb_endpoints; > + int ret = -ENODEV; > > DRM_DEBUG_DRIVER("\n"); > > - /* Get endpoints if any */ > - for (i = 0; i < MAX_ENDPOINTS; i++) { > - ret = drm_of_find_panel_or_bridge(np, 0, i, [i], > - [i]); > - > - /* > - * If at least one endpoint is -EPROBE_DEFER, defer probing, > - * else if at least one endpoint is ready, continue probing. > - */ > - if (ret == -EPROBE_DEFER) > - return ret; > - else if (!ret) > - endpoint_not_ready = 0; > - } > - > - if (endpoint_not_ready) > - return endpoint_not_ready; > - > - rstc = devm_reset_control_get_exclusive(dev, NULL); > - > - mutex_init(>err_lock); > + /* Get number of endpoints */ > + nb_endpoints = of_graph_get_endpoint_count(np); > + if (!nb_endpoints) > + return -ENODEV; > > ldev->pixel_clk = devm_clk_get(dev, "lcd"); > if (IS_ERR(ldev->pixel_clk)) { > @@ -1233,6 +1215,43 @@ int ltdc_load(struct drm_device *ddev) > return -ENODEV; > } > > + /* Get endpoints if any */ > + for (i = 0; i < nb_endpoints; i++) { > + ret = drm_of_find_panel_or_bridge(np, 0, i, , ); > + > + /* > + * If at least one endpoint is -ENODEV, continue probing, > + * else if at least one endpoint returned an error > + * (ie -EPROBE_DEFER) then stop probing. > + */ > + if (ret == -ENODEV) > + continue; > + else if (ret) > + goto err; > + > + if (panel) { > + bridge = drm_panel_bridge_add_typed(panel, > + > DRM_MODE_CONNECTOR_DPI); > + if (IS_ERR(bridge)) { > + DRM_ERROR("panel-bridge endpoint %d\n", i); > + ret = PTR_ERR(bridge); > + goto err; > + } > + } > + > + if (bridge) { > + ret = ltdc_encoder_init(ddev, bridge); > + if (ret) { > + DRM_ERROR("init encoder endpoint %d\n", i); > + goto err; > + } > + } > + } > + > + rstc = devm_reset_control_get_exclusive(dev, NULL); > + > + mutex_init(>err_lock); > + > if (!IS_ERR(rstc)) { > reset_control_assert(rstc); > usleep_range(10, 20); > @@ -1268,7 +1287,6 @@ int ltdc_load(struct drm_device *ddev) > } > } > > - > ret = ltdc_get_caps(ddev); > if (ret) { > DRM_ERROR("hardware identifier (0x%08x) not supported!\n", > @@ -1278,27 +1296,6 @@ int ltdc_load(struct drm_device *ddev) > > DRM_DEBUG_DRIVER("ltdc hw
Re: [PATCH] drm/stm: ltdc: check crtc state before enabling LIE
Dear Yannick, Thank you for your patch, Acked-by: Philippe Cornu Philippe :-) On 1/21/20 11:14 AM, Yannick Fertre wrote: > Following investigations of a hardware bug, the LIE interrupt > can occur while the display controller is not activated. > LIE interrupt (vblank) don't have to be set if the CRTC is not > enabled. > > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/stm/ltdc.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index c2815e8..ea654c7 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -648,9 +648,14 @@ static const struct drm_crtc_helper_funcs > ltdc_crtc_helper_funcs = { > static int ltdc_crtc_enable_vblank(struct drm_crtc *crtc) > { > struct ltdc_device *ldev = crtc_to_ltdc(crtc); > + struct drm_crtc_state *state = crtc->state; > > DRM_DEBUG_DRIVER("\n"); > - reg_set(ldev->regs, LTDC_IER, IER_LIE); > + > + if (state->enable) > + reg_set(ldev->regs, LTDC_IER, IER_LIE); > + else > + return -EPERM; > > return 0; > } > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/bridge/synopsys: dsi: missing post disable
Dear Yannick, Thank you for your patch, Reviewed-by: Philippe Cornu Philippe :-) On 1/21/20 11:24 AM, Yannick Fertre wrote: > From: Yannick Fertré > > Sometime the post_disable function is missing (not registered). > > Signed-off-by: Yannick Fertré > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index b18351b..12823ae 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -824,7 +824,8 @@ static void dw_mipi_dsi_bridge_post_disable(struct > drm_bridge *bridge) >* This needs to be fixed in the drm_bridge framework and the API >* needs to be updated to manage our own call chains... >*/ > - dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge); > + if (dsi->panel_bridge->funcs->post_disable) > + dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge); > > if (phy_ops->power_off) > phy_ops->power_off(dsi->plat_data->priv_data); > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: dsi: stm mipi dsi doesn't print error on probe deferral
Dears Yannick & Etienne, Thank you for your patch, Reviewed-by: Philippe Cornu Philippe :-) On 1/21/20 11:24 AM, Yannick Fertre wrote: > From: Etienne Carriere > > Change DSI driver to not print an error trace when probe > is deferred for a clock resource. > > Signed-off-by: Etienne Carriere > --- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > index 4b16563..2e1f266 100644 > --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c > @@ -377,7 +377,9 @@ static int dw_mipi_dsi_stm_probe(struct platform_device > *pdev) > dsi->pllref_clk = devm_clk_get(dev, "ref"); > if (IS_ERR(dsi->pllref_clk)) { > ret = PTR_ERR(dsi->pllref_clk); > - DRM_ERROR("Unable to get pll reference clock: %d\n", ret); > + if (ret != -EPROBE_DEFER) > + DRM_ERROR("Unable to get pll reference clock: %d\n", > + ret); > goto err_clk_get; > } > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [Linux-stm32] [PATCH v4 0/4] Genericize DW MIPI DSI bridge and add i.MX 6 driver
Hi Adrian, And sorry for this late reply. Your patches look good and we ("stm guys") understand that v1.01 is very different to v1.30/31. We are doing our best to review & test your patches and we will go back to you asap. Many thanks, Philippe :-) On 12/2/19 8:33 PM, Adrian Ratiu wrote: > Having a generic Synopsis DesignWare MIPI-DSI host controller bridge > driver is a very good idea, however the current implementation has > hardcoded quite a lot of the register layouts used by the two supported > SoC vendors, STM and Rockchip, which use IP cores v1.30 and v1.31. > > This makes it hard to support other SoC vendors like the FSL/NXP i.MX 6 > which use older v1.01 cores or future versions because, based on history, > layout changes should also be expected in new DSI versions / SoCs. > > This patch series converts the bridge and platform drivers to access > registers via generic regmap APIs and allows each platform driver to > configure its register layout via struct reg_fields, then adds support > for the host controller found on i.MX 6. > > I only have i.MX hardware with MIPI-DSI panel and relevant documentation > available for testing so I'll really appreciate it if someone could test > the series on Rockchip and STM... eyeballing register fields could only > get me so far, so sorry in advance for any breakage! > > Many thanks to Boris Brezillon for > suggesting the regmap solution and to Liu Ying > for doing the initial i.MX platform driver implementation. > > This series applies on top of latest linux-next tree, next-20191202. > > v3 -> v4: >* Added commmit message to dt-binding patch (Neil) >* Converted the dt-binding to yaml dt-schema format (Neil) >* Small DT node + driver fixes (Rob) >* Renamed platform driver to reflect it's only for i.MX v6 (Fabio) >* Added small panel example to the host controller DT binding > > v2 -> v3: >* Added const declarations to dw-mipi-dsi.c structs (Emil) >* Fixed Reviewed-by tags and cc'd some more relevant ML (Emil) > > v1 -> v2: >* Moved register definitions & regmap initialization into bridge >module. Platform drivers get the regmap via plat_data after calling >the bridge probe (Emil). > > Adrian Ratiu (4): >drm: bridge: dw_mipi_dsi: access registers via a regmap >drm: bridge: dw_mipi_dsi: abstract register access using reg_fields >drm: imx: Add i.MX 6 MIPI DSI host driver >dt-bindings: display: add i.MX6 MIPI DSI host controller doc > > .../display/imx/fsl,mipi-dsi-imx6.yaml| 136 > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 699 +- > drivers/gpu/drm/imx/Kconfig | 7 + > drivers/gpu/drm/imx/Makefile | 1 + > drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c| 378 ++ > .../gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 17 +- > drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 34 +- > include/drm/bridge/dw_mipi_dsi.h | 2 +- > 8 files changed, 1067 insertions(+), 207 deletions(-) > create mode 100644 > Documentation/devicetree/bindings/display/imx/fsl,mipi-dsi-imx6.yaml > create mode 100644 drivers/gpu/drm/imx/dw_mipi_dsi-imx6.c > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: ltdc: move pinctrl to encoder mode set
Dear Yannick, Thank you for your patch, Acked-by: Philippe Cornu Philippe :-) On 11/27/19 11:23 AM, Yannick Fertre wrote: > From: Yannick Fertré > > The pin control must be set to default as soon as possible to > establish a good video link between tv & bridge hdmi > (encoder mode set is call before encoder enable). > > Signed-off-by: Yannick Fertre > --- > drivers/gpu/drm/stm/ltdc.c | 24 ++-- > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 49ef406..dba8e7f 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -435,9 +435,6 @@ static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, > /* Commit shadow registers = update planes at next vblank */ > reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR); > > - /* Enable LTDC */ > - reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); > - > drm_crtc_vblank_on(crtc); > } > > @@ -451,9 +448,6 @@ static void ltdc_crtc_atomic_disable(struct drm_crtc > *crtc, > > drm_crtc_vblank_off(crtc); > > - /* disable LTDC */ > - reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); > - > /* disable IRQ */ > reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); > > @@ -1042,9 +1036,13 @@ static const struct drm_encoder_funcs > ltdc_encoder_funcs = { > static void ltdc_encoder_disable(struct drm_encoder *encoder) > { > struct drm_device *ddev = encoder->dev; > + struct ltdc_device *ldev = ddev->dev_private; > > DRM_DEBUG_DRIVER("\n"); > > + /* Disable LTDC */ > + reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); > + > /* Set to sleep state the pinctrl whatever type of encoder */ > pinctrl_pm_select_sleep_state(ddev->dev); > } > @@ -1052,6 +1050,19 @@ static void ltdc_encoder_disable(struct drm_encoder > *encoder) > static void ltdc_encoder_enable(struct drm_encoder *encoder) > { > struct drm_device *ddev = encoder->dev; > + struct ltdc_device *ldev = ddev->dev_private; > + > + DRM_DEBUG_DRIVER("\n"); > + > + /* Enable LTDC */ > + reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); > +} > + > +static void ltdc_encoder_mode_set(struct drm_encoder *encoder, > + struct drm_display_mode *mode, > + struct drm_display_mode *adjusted_mode) > +{ > + struct drm_device *ddev = encoder->dev; > > DRM_DEBUG_DRIVER("\n"); > > @@ -1067,6 +1078,7 @@ static void ltdc_encoder_enable(struct drm_encoder > *encoder) > static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = { > .disable = ltdc_encoder_disable, > .enable = ltdc_encoder_enable, > + .mode_set = ltdc_encoder_mode_set, > }; > > static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge > *bridge) > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/5] drm/bridge/synopsys: dsi: move phy_ops callbacks around panel enablement
Hi Heiko, On 11/8/19 1:02 AM, Heiko Stuebner wrote: > If implementation-specific phy_ops need to be defined they probably > should be enabled before trying to talk to the panel and disabled only > after the panel was disabled. > > Right now they are enabled last and disabled first, so might make it > impossible to talk to some panels - example for this being the px30 > with an external Innosilicon dphy that needs the phy to be enabled > to transfer commands to the panel. > > So move the calls appropriately. > > Signed-off-by: Heiko Stuebner > --- > drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 13 ++--- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > index 675442bfc1bd..49f5600a1dea 100644 > --- a/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > +++ b/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c > @@ -797,9 +797,6 @@ static void dw_mipi_dsi_bridge_post_disable(struct > drm_bridge *bridge) > struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); > const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; > > - if (phy_ops->power_off) > - phy_ops->power_off(dsi->plat_data->priv_data); > - > /* >* Switch to command mode before panel-bridge post_disable & >* panel unprepare. > @@ -816,6 +813,9 @@ static void dw_mipi_dsi_bridge_post_disable(struct > drm_bridge *bridge) >*/ > dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge); > > + if (phy_ops->power_off) > + phy_ops->power_off(dsi->plat_data->priv_data); > + > if (dsi->slave) { > dw_mipi_dsi_disable(dsi->slave); > clk_disable_unprepare(dsi->slave->pclk); > @@ -882,6 +882,9 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi, > > /* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ > dw_mipi_dsi_set_mode(dsi, 0); > + > + if (phy_ops->power_on) > + phy_ops->power_on(dsi->plat_data->priv_data); > } > > static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, > @@ -898,15 +901,11 @@ static void dw_mipi_dsi_bridge_mode_set(struct > drm_bridge *bridge, > static void dw_mipi_dsi_bridge_enable(struct drm_bridge *bridge) > { > struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); > - const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; > > /* Switch to video mode for panel-bridge enable & panel enable */ > dw_mipi_dsi_set_mode(dsi, MIPI_DSI_MODE_VIDEO); > if (dsi->slave) > dw_mipi_dsi_set_mode(dsi->slave, MIPI_DSI_MODE_VIDEO); > - > - if (phy_ops->power_on) > - phy_ops->power_on(dsi->plat_data->priv_data); > } > > static enum drm_mode_status > Tested-by: Yannick Fertre Reviewed-by: Philippe Cornu Many thanks, Philippe :-) ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/stm: attach gem fence to atomic state
Hi Lucas & Ahmad, Many thanks for your patch, Tested successfully on stm32mp157-dk2 (weston & drm). Acked-by: Philippe Cornu Tested-by: Philippe Cornu Philippe :-) On 7/12/19 10:42 AM, Lucas Stach wrote: > From: Ahmad Fatoum > > To properly synchronize with other devices the fence from the GEM > object backing the framebuffer needs to be attached to the atomic > state, so the commit work can wait on fence signaling. > > Signed-off-by: Ahmad Fatoum > Signed-off-by: Lucas Stach > --- > drivers/gpu/drm/stm/ltdc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/gpu/drm/stm/ltdc.c b/drivers/gpu/drm/stm/ltdc.c > index 2fe6c4a8d915..3ab4fbf8eb0d 100644 > --- a/drivers/gpu/drm/stm/ltdc.c > +++ b/drivers/gpu/drm/stm/ltdc.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -922,6 +923,7 @@ static const struct drm_plane_funcs ltdc_plane_funcs = { > }; > > static const struct drm_plane_helper_funcs ltdc_plane_helper_funcs = { > + .prepare_fb = drm_gem_fb_prepare_fb, > .atomic_check = ltdc_plane_atomic_check, > .atomic_update = ltdc_plane_atomic_update, > .atomic_disable = ltdc_plane_atomic_disable, > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/bridge: sii902x: add audio graph card support
Hi Daniel, On 7/10/19 5:27 PM, Daniel Vetter wrote: > On Fri, Jul 05, 2019 at 12:41:03PM +0000, Philippe CORNU wrote: >> Hi Olivier, >> and many thanks for your patch. >> Good to have the audio graph card support, looks ok. >> Reviewed-by: Philippe Cornu > > Since you have drm-misc commit rights I'm assuming you're going to push > this too. Correct? > -Daniel Regarding this patch in particular, there is still missing an acked-by from a "bridge" maintainer. Also it could be nice to wait for the reviewed-by from Jiry as it knows well this sii driver and sent recently good patches on it (already merged). With that, Benjamin or I (or a bridge maintainer) can push this patch + the serie named "drm/bridge: sii902x: fix audio mclk management" as I think it is better to push this serie *before* this patch. Thanks, Philippe :-) >> Philippe :-) >> >> On 7/3/19 10:04 AM, Olivier Moysan wrote: >>> Implement get_dai_id callback of audio HDMI codec >>> to support ASoC audio graph card. >>> HDMI audio output has to be connected to sii902x port 3. >>> get_dai_id callback maps this port to ASoC DAI index 0. >>> >>> Signed-off-by: Olivier Moysan >>> --- >>>drivers/gpu/drm/bridge/sii902x.c | 23 +++ >>>1 file changed, 23 insertions(+) >>> >>> diff --git a/drivers/gpu/drm/bridge/sii902x.c >>> b/drivers/gpu/drm/bridge/sii902x.c >>> index dd7aa466b280..daf9ef3cd817 100644 >>> --- a/drivers/gpu/drm/bridge/sii902x.c >>> +++ b/drivers/gpu/drm/bridge/sii902x.c >>> @@ -158,6 +158,8 @@ >>> >>>#define SII902X_I2C_BUS_ACQUISITION_TIMEOUT_MS 500 >>> >>> +#define SII902X_AUDIO_PORT_INDEX 3 >>> + >>>struct sii902x { >>> struct i2c_client *i2c; >>> struct regmap *regmap; >>> @@ -690,11 +692,32 @@ static int sii902x_audio_get_eld(struct device *dev, >>> void *data, >>> return 0; >>>} >>> >>> +static int sii902x_audio_get_dai_id(struct snd_soc_component *component, >>> + struct device_node *endpoint) >>> +{ >>> + struct of_endpoint of_ep; >>> + int ret; >>> + >>> + ret = of_graph_parse_endpoint(endpoint, _ep); >>> + if (ret < 0) >>> + return ret; >>> + >>> + /* >>> +* HDMI sound should be located at reg = <3> >>> +* Return expected DAI index 0. >>> +*/ >>> + if (of_ep.port == SII902X_AUDIO_PORT_INDEX) >>> + return 0; >>> + >>> + return -EINVAL; >>> +} >>> + >>>static const struct hdmi_codec_ops sii902x_audio_codec_ops = { >>> .hw_params = sii902x_audio_hw_params, >>> .audio_shutdown = sii902x_audio_shutdown, >>> .digital_mute = sii902x_audio_digital_mute, >>> .get_eld = sii902x_audio_get_eld, >>> + .get_dai_id = sii902x_audio_get_dai_id, >>>}; >>> >>>static int sii902x_audio_codec_init(struct sii902x *sii902x, >>> > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH] drm/bridge: sii902x: add audio graph card support
Hi Olivier, and many thanks for your patch. Good to have the audio graph card support, looks ok. Reviewed-by: Philippe Cornu Philippe :-) On 7/3/19 10:04 AM, Olivier Moysan wrote: > Implement get_dai_id callback of audio HDMI codec > to support ASoC audio graph card. > HDMI audio output has to be connected to sii902x port 3. > get_dai_id callback maps this port to ASoC DAI index 0. > > Signed-off-by: Olivier Moysan > --- > drivers/gpu/drm/bridge/sii902x.c | 23 +++ > 1 file changed, 23 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/sii902x.c > b/drivers/gpu/drm/bridge/sii902x.c > index dd7aa466b280..daf9ef3cd817 100644 > --- a/drivers/gpu/drm/bridge/sii902x.c > +++ b/drivers/gpu/drm/bridge/sii902x.c > @@ -158,6 +158,8 @@ > > #define SII902X_I2C_BUS_ACQUISITION_TIMEOUT_MS 500 > > +#define SII902X_AUDIO_PORT_INDEX 3 > + > struct sii902x { > struct i2c_client *i2c; > struct regmap *regmap; > @@ -690,11 +692,32 @@ static int sii902x_audio_get_eld(struct device *dev, > void *data, > return 0; > } > > +static int sii902x_audio_get_dai_id(struct snd_soc_component *component, > + struct device_node *endpoint) > +{ > + struct of_endpoint of_ep; > + int ret; > + > + ret = of_graph_parse_endpoint(endpoint, _ep); > + if (ret < 0) > + return ret; > + > + /* > + * HDMI sound should be located at reg = <3> > + * Return expected DAI index 0. > + */ > + if (of_ep.port == SII902X_AUDIO_PORT_INDEX) > + return 0; > + > + return -EINVAL; > +} > + > static const struct hdmi_codec_ops sii902x_audio_codec_ops = { > .hw_params = sii902x_audio_hw_params, > .audio_shutdown = sii902x_audio_shutdown, > .digital_mute = sii902x_audio_digital_mute, > .get_eld = sii902x_audio_get_eld, > + .get_dai_id = sii902x_audio_get_dai_id, > }; > > static int sii902x_audio_codec_init(struct sii902x *sii902x, > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/bridge: sii902x: make audio mclk optional
Hi Olivier, and many thanks for your patch. Reviewed-by: Philippe Cornu Philippe :-) On 7/2/19 5:47 PM, Olivier Moysan wrote: > The master clock on i2s bus is not mandatory, > as sii902X internal PLL can be used instead. > Make use of mclk optional. > > Fixes: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support") > > Signed-off-by: Olivier Moysan > --- > drivers/gpu/drm/bridge/sii902x.c | 39 > +++ > 1 file changed, 23 insertions(+), 16 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/sii902x.c > b/drivers/gpu/drm/bridge/sii902x.c > index 36acc256e67e..a08bd9fdc046 100644 > --- a/drivers/gpu/drm/bridge/sii902x.c > +++ b/drivers/gpu/drm/bridge/sii902x.c > @@ -562,19 +562,21 @@ static int sii902x_audio_hw_params(struct device *dev, > void *data, > } > } > > - ret = clk_prepare_enable(sii902x->audio.mclk); > - if (ret) { > - dev_err(dev, "Enabling mclk failed: %d\n", ret); > - return ret; > - } > + if (sii902x->audio.mclk) { > + ret = clk_prepare_enable(sii902x->audio.mclk); > + if (ret) { > + dev_err(dev, "Enabling mclk failed: %d\n", ret); > + return ret; > + } > > - mclk_rate = clk_get_rate(sii902x->audio.mclk); > + mclk_rate = clk_get_rate(sii902x->audio.mclk); > > - ret = sii902x_select_mclk_div(_config_reg, params->sample_rate, > - mclk_rate); > - if (mclk_rate != ret * params->sample_rate) > - dev_dbg(dev, "Inaccurate reference clock (%ld/%d != %u)\n", > - mclk_rate, ret, params->sample_rate); > + ret = sii902x_select_mclk_div(_config_reg, > + params->sample_rate, mclk_rate); > + if (mclk_rate != ret * params->sample_rate) > + dev_dbg(dev, "Inaccurate reference clock (%ld/%d != > %u)\n", > + mclk_rate, ret, params->sample_rate); > + } > > mutex_lock(>mutex); > > @@ -640,7 +642,8 @@ static int sii902x_audio_hw_params(struct device *dev, > void *data, > mutex_unlock(>mutex); > > if (ret) { > - clk_disable_unprepare(sii902x->audio.mclk); > + if (sii902x->audio.mclk) > + clk_disable_unprepare(sii902x->audio.mclk); > dev_err(dev, "%s: hdmi audio enable failed: %d\n", __func__, > ret); > } > @@ -659,7 +662,8 @@ static void sii902x_audio_shutdown(struct device *dev, > void *data) > > mutex_unlock(>mutex); > > - clk_disable_unprepare(sii902x->audio.mclk); > + if (sii902x->audio.mclk) > + clk_disable_unprepare(sii902x->audio.mclk); > } > > int sii902x_audio_digital_mute(struct device *dev, void *data, bool enable) > @@ -752,9 +756,12 @@ static int sii902x_audio_codec_init(struct sii902x > *sii902x, > > sii902x->audio.mclk = devm_clk_get(dev, "mclk"); > if (IS_ERR(sii902x->audio.mclk)) { > - dev_err(dev, "%s: No clock (audio mclk) found: %ld\n", > - __func__, PTR_ERR(sii902x->audio.mclk)); > - return 0; > + if (PTR_ERR(sii902x->audio.mclk) != -ENOENT) { > + dev_err(dev, "%s: No clock (audio mclk) found: %ld\n", > + __func__, PTR_ERR(sii902x->audio.mclk)); > + return PTR_ERR(sii902x->audio.mclk); > + } > + sii902x->audio.mclk = NULL; > } > > sii902x->audio.pdev = platform_device_register_data( > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] dt-bindings: display: sii902x: Change audio mclk binding
Hi Olivier, and many thanks for your patch. I have double checked in the sil9022/24 datasheet and you are right: "As an option, the original MCLK signal used to strobe the I2S signals out from the sourcing chip can be used. If the internal PLL is used, then an external MCLK input is not required." So, even if #sound-dai-cells is there, this is not mandatory to have MCLK. Reviewed-by: Philippe Cornu Philippe :-) On 7/2/19 5:47 PM, Olivier Moysan wrote: > As stated in SiL9022/24 datasheet, master clock is not required for I2S. > Make mclk property optional in DT bindings. > > Fixes: 3f18021f43a3 ("dt-bindings: display: sii902x: Add HDMI audio bindings") > > Signed-off-by: Olivier Moysan > --- > Documentation/devicetree/bindings/display/bridge/sii902x.txt | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/Documentation/devicetree/bindings/display/bridge/sii902x.txt > b/Documentation/devicetree/bindings/display/bridge/sii902x.txt > index 2df44b7d3821..6e14e087c0d0 100644 > --- a/Documentation/devicetree/bindings/display/bridge/sii902x.txt > +++ b/Documentation/devicetree/bindings/display/bridge/sii902x.txt > @@ -26,9 +26,8 @@ Optional properties: > - clocks: phandle and clock specifier for each clock listed in > the clock-names property > - clock-names: "mclk" > -Describes SII902x MCLK input. MCLK is used to produce > -HDMI audio CTS values. This property is required if > -"#sound-dai-cells"-property is present. This property follows > +Describes SII902x MCLK input. MCLK can be used to produce > +HDMI audio CTS values. This property follows > Documentation/devicetree/bindings/clock/clock-bindings.txt > consumer binding. > > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/bridge: sii902x: fix missing reference to mclk clock
Hi Olivier, and many thanks for your patch. I do not see how audio could work without your patch, so: Reviewed-by: Philippe Cornu Philippe :-) On 7/2/19 5:47 PM, Olivier Moysan wrote: > Add devm_clk_get call to retrieve reference to master clock. > > Fixes: ff5781634c41 ("drm/bridge: sii902x: Implement HDMI audio support") > > Signed-off-by: Olivier Moysan > --- > drivers/gpu/drm/bridge/sii902x.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/bridge/sii902x.c > b/drivers/gpu/drm/bridge/sii902x.c > index dd7aa466b280..36acc256e67e 100644 > --- a/drivers/gpu/drm/bridge/sii902x.c > +++ b/drivers/gpu/drm/bridge/sii902x.c > @@ -750,6 +750,7 @@ static int sii902x_audio_codec_init(struct sii902x > *sii902x, > sii902x->audio.i2s_fifo_sequence[i] |= audio_fifo_id[i] | > i2s_lane_id[lanes[i]] | SII902X_TPI_I2S_FIFO_ENABLE; > > + sii902x->audio.mclk = devm_clk_get(dev, "mclk"); > if (IS_ERR(sii902x->audio.mclk)) { > dev_err(dev, "%s: No clock (audio mclk) found: %ld\n", > __func__, PTR_ERR(sii902x->audio.mclk)); > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/3] drm/stm: drv: fix suspend/resume
Hi Yannick, Thank you for your patch. Acked-by: Philippe Cornu Philippe :-) On 6/17/19 9:18 AM, Yannick Fertré wrote: > Without this fix, the system can not go in "suspend" mode > due to an error in drv_suspend function. > > Fixes: 35ab6cf ("drm/stm: support runtime power management") > > Signed-off-by: Yannick Fertré > --- > drivers/gpu/drm/stm/drv.c | 15 --- > 1 file changed, 8 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 5659572..9dee4e4 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -136,8 +136,7 @@ static __maybe_unused int drv_suspend(struct device *dev) > struct ltdc_device *ldev = ddev->dev_private; > struct drm_atomic_state *state; > > - if (WARN_ON(!ldev->suspend_state)) > - return -ENOENT; > + WARN_ON(ldev->suspend_state); > > state = drm_atomic_helper_suspend(ddev); > if (IS_ERR(state)) > @@ -155,15 +154,17 @@ static __maybe_unused int drv_resume(struct device *dev) > struct ltdc_device *ldev = ddev->dev_private; > int ret; > > + if (WARN_ON(!ldev->suspend_state)) > + return -ENOENT; > + > pm_runtime_force_resume(dev); > ret = drm_atomic_helper_resume(ddev, ldev->suspend_state); > - if (ret) { > + if (ret) > pm_runtime_force_suspend(dev); > - ldev->suspend_state = NULL; > - return ret; > - } > > - return 0; > + ldev->suspend_state = NULL; > + > + return ret; > } > > static __maybe_unused int drv_runtime_suspend(struct device *dev) >
Re: [PATCH 30/59] drm/stm: Drop drm_gem_prime_export/import
Hi Daniel, Acked-by: Philippe Cornu We will have a look to simplify this part of the code. Thank you for your patch. Philippe :-) On 6/14/19 10:35 PM, Daniel Vetter wrote: > They're the default. > > Aside: Would be really nice to switch the others over to > drm_gem_object_funcs. > > Signed-off-by: Daniel Vetter > Cc: Yannick Fertre > Cc: Philippe Cornu > Cc: Benjamin Gaignard > Cc: Vincent Abriou > Cc: Maxime Coquelin > Cc: Alexandre Torgue > Cc: linux-st...@st-md-mailman.stormreply.com > Cc: linux-arm-ker...@lists.infradead.org > --- > drivers/gpu/drm/stm/drv.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c > index 4026c33ccc39..331f5e8d779b 100644 > --- a/drivers/gpu/drm/stm/drv.c > +++ b/drivers/gpu/drm/stm/drv.c > @@ -67,8 +67,6 @@ static struct drm_driver drv_driver = { > .prime_fd_to_handle = drm_gem_prime_fd_to_handle, > .gem_free_object_unlocked = drm_gem_cma_free_object, > .gem_vm_ops = _gem_cma_vm_ops, > - .gem_prime_export = drm_gem_prime_export, > - .gem_prime_import = drm_gem_prime_import, > .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, > .gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table, > .gem_prime_vmap = drm_gem_cma_prime_vmap, > ___ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel