drm: mxsfb: Add i.MX7 support
Subsystems (4)
v4 cover drm: mxsfb: Add i.MX7 support
Hello,
This patch series adds i.MX7 support to the mxsfb driver. The eLCDIF instance found in the i.MX7 is backward-compatible with the already supported LCDC v4, but has extended features amongst which the most notable one is a second plane.
The first 10 patches (01/22 to 10/22) contain miscellaneous cleanups and refactoring to prepare for what is to come. Patch 11/22 starts the real work with removal of the DRM simple display pipeline helper, as it doesn't support multiple planes. The next patch (12/22) is an additional cleanup.
Patches 13/22 to 15/22 fix vblank handling that I found to be broken when testing on my device. Patch 16/22 then performs an additional small cleanup, and patch 17/22 starts official support for i.MX7 by mentioning it in Kconfig.
Patch 18/22 adds a new device model for the i.MX6SX and i.MX7 eLCDIF. After three additional cleanups in patches 19/22 to 21/22, patch 22/22 finally adds support for the second plane.
The second plane suffers from an issue whose root cause hasn't been found, which results in the first 64 bytes of the first line to contain data of unknown origin. Help from NXP to diagnose this issue would be useful and appreciated.
Compared to v3, the series has been rebased on the latest drm-misc, without any other modifications.
The code is based on drm-misc-next and has been tested on an i.MX7D platform with a DPI panel.
Laurent Pinchart (22):
drm: mxsfb: Remove fbdev leftovers
drm: mxsfb: Use drm_panel_bridge
drm: mxsfb: Use BIT() macro to define register bitfields
drm: mxsfb: Remove unused macros from mxsfb_regs.h
drm: mxsfb: Clarify format and bus width configuration
drm: mxsfb: Pass mxsfb_drm_private pointer to mxsfb_reset_block()
drm: mxsfb: Use LCDC_CTRL register name explicitly
drm: mxsfb: Remove register definitions from mxsfb_crtc.c
drm: mxsfb: Remove unneeded includes
drm: mxsfb: Rename mxsfb_crtc.c to mxsfb_kms.c
drm: mxsfb: Stop using DRM simple display pipeline helper
drm: mxsfb: Move vblank event arm to CRTC .atomic_flush()
drm: mxsfb: Don't touch AXI clock in IRQ context
drm: mxsfb: Enable vblank handling
drm: mxsfb: Remove mxsfb_devdata unused fields
drm: mxsfb: Add i.MX7 and i.MX8M to the list of supported SoCs in
Kconfig
drm: mxsfb: Update internal IP version number for i.MX6SX
drm: mxsfb: Drop non-OF support
drm: mxsfb: Turn mxsfb_set_pixel_fmt() into a void function
drm: mxsfb: Merge mxsfb_set_pixel_fmt() and mxsfb_set_bus_fmt()
drm: mxsfb: Remove unnecessary spaces after tab
drm: mxsfb: Support the alpha plane
drivers/gpu/drm/mxsfb/Kconfig | 8 +- drivers/gpu/drm/mxsfb/Makefile | 2 +- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 343 ----------------- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 254 ++++--------- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 42 ++- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 571 +++++++++++++++++++++++++++++ drivers/gpu/drm/mxsfb/mxsfb_out.c | 99 ----- drivers/gpu/drm/mxsfb/mxsfb_regs.h | 103 +++--- 8 files changed, 739 insertions(+), 683 deletions(-) delete mode 100644 drivers/gpu/drm/mxsfb/mxsfb_crtc.c create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_kms.c delete mode 100644 drivers/gpu/drm/mxsfb/mxsfb_out.c
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 1/22 drm: mxsfb: Remove fbdev leftovers
Commit 8e93f1028d74 ("drm/mxsfb: Use drm_fbdev_generic_setup()") replaced fbdev handling with drm_fbdev_generic_setup() but left inclusion of the drm/drm_fb_cma_helper.h header. Remove it.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +0 -1
@@ -24,7 +24,6 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc.h> #include <drm/drm_drv.h> -#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 2/22 drm: mxsfb: Use drm_panel_bridge
In reply to Laurent PinchartReplace the manual connector implementation based on drm_panel with the drm_panel_bridge helper. This simplifies the mxsfb driver by removing connector-related code, and standardizing all pipeline control operations on bridges.
A hack is needed to get hold of the connector, as that's our only source of bus flags and formats for now. As soon as the bridge API provides us with that information this can be fixed.
---
Changes since v2:
- Use drm_panel_bridge_add_typed()
Changes since v1:
- Select DRM_PANEL_BRIDGE in Kconfig
--- drivers/gpu/drm/mxsfb/Kconfig | 1 + drivers/gpu/drm/mxsfb/Makefile | 2 +- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 105 ++++++++++++++---------------- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 5 +- drivers/gpu/drm/mxsfb/mxsfb_out.c | 99 ---------------------------- 5 files changed, 55 insertions(+), 157 deletions(-) delete mode 100644 drivers/gpu/drm/mxsfb/mxsfb_out.c
drivers/gpu/drm/mxsfb/Kconfig +1 -0
@@ -13,6 +13,7 @@ config DRM_MXSFB select DRM_KMS_FB_HELPER select DRM_KMS_CMA_HELPER select DRM_PANEL + select DRM_PANEL_BRIDGE help Choose this option if you have an i.MX23/i.MX28/i.MX6SX MXSFB LCD controller.
drivers/gpu/drm/mxsfb/Makefile +1 -1
@@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -mxsfb-y := mxsfb_drv.o mxsfb_crtc.o mxsfb_out.o +mxsfb-y := mxsfb_drv.o mxsfb_crtc.o obj-$(CONFIG_DRM_MXSFB) += mxsfb.o
drivers/gpu/drm/mxsfb/mxsfb_drv.c +50 -55
172 lines not on this page · raw message
drivers/gpu/drm/mxsfb/mxsfb_drv.h +3 -2
@@ -8,6 +8,8 @@ #ifndef __MXSFB_DRV_H__ #define __MXSFB_DRV_H__ +struct drm_device; + struct mxsfb_devdata { unsigned int transfer_count; unsigned int cur_buf;
@@ -26,10 +28,9 @@ struct mxsfb_drm_private {struct clk *clk_axi;struct clk *clk_disp_axi; +struct drm_device *drm;struct drm_simple_display_pipe pipe; -struct drm_connector panel_connector;struct drm_connector *connector; -struct drm_panel *panel;struct drm_bridge *bridge; };
drivers/gpu/drm/mxsfb/mxsfb_out.c deleted +0 -99
99 lines not on this page · raw message
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 3/22 drm: mxsfb: Use BIT() macro to define register bitfields
In reply to Laurent PinchartUsing BIT() is preferred over manual shifts as it's more readable, handles the 1 << 31 case properly, and avoids other mistakes as shown by the DEBUG0_HSYNC and DEBUG0_VSYNC bits (that are currently unused). Use it.
--- drivers/gpu/drm/mxsfb/mxsfb_regs.h | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_regs.h +28 -28
@@ -28,51 +28,51 @@#define LCDC_V4_DEBUG0 0x1d0#define LCDC_V3_DEBUG0 0x1f0 -#define CTRL_SFTRST (1 << 31) -#define CTRL_CLKGATE (1 << 30) -#define CTRL_BYPASS_COUNT (1 << 19) -#define CTRL_VSYNC_MODE (1 << 18) -#define CTRL_DOTCLK_MODE (1 << 17) -#define CTRL_DATA_SELECT (1 << 16) +#define CTRL_SFTRST BIT(31) +#define CTRL_CLKGATE BIT(30) +#define CTRL_BYPASS_COUNT BIT(19) +#define CTRL_VSYNC_MODE BIT(18) +#define CTRL_DOTCLK_MODE BIT(17) +#define CTRL_DATA_SELECT BIT(16)#define CTRL_SET_BUS_WIDTH (x) (((x) & 0x3) << 10)#define CTRL_GET_BUS_WIDTH (x) (((x) >> 10) & 0x3)#define CTRL_BUS_WIDTH_MASK (0x3 << 10)#define CTRL_SET_WORD_LENGTH (x) (((x) & 0x3) << 8)#define CTRL_GET_WORD_LENGTH (x) (((x) >> 8) & 0x3) -#define CTRL_MASTER (1 << 5) -#define CTRL_DF16 (1 << 3) -#define CTRL_DF18 (1 << 2) -#define CTRL_DF24 (1 << 1) -#define CTRL_RUN (1 << 0) +#define CTRL_MASTER BIT(5) +#define CTRL_DF16 BIT(3) +#define CTRL_DF18 BIT(2) +#define CTRL_DF24 BIT(1) +#define CTRL_RUN BIT(0) -#define CTRL1_FIFO_CLEAR (1 << 21) +#define CTRL1_FIFO_CLEAR BIT(21)#define CTRL1_SET_BYTE_PACKAGING (x) (((x) & 0xf) << 16)#define CTRL1_GET_BYTE_PACKAGING (x) (((x) >> 16) & 0xf) -#define CTRL1_CUR_FRAME_DONE_IRQ_EN (1 << 13) -#define CTRL1_CUR_FRAME_DONE_IRQ (1 << 9) +#define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13) +#define CTRL1_CUR_FRAME_DONE_IRQ BIT(9)#define TRANSFER_COUNT_SET_VCOUNT (x) (((x) & 0xffff) << 16)#define TRANSFER_COUNT_GET_VCOUNT (x) (((x) >> 16) & 0xffff)#define TRANSFER_COUNT_SET_HCOUNT (x) ((x) & 0xffff)#define TRANSFER_COUNT_GET_HCOUNT (x) ((x) & 0xffff) -#define VDCTRL0_ENABLE_PRESENT (1 << 28) -#define VDCTRL0_VSYNC_ACT_HIGH (1 << 27) -#define VDCTRL0_HSYNC_ACT_HIGH (1 << 26) -#define VDCTRL0_DOTCLK_ACT_FALLING (1 << 25) -#define VDCTRL0_ENABLE_ACT_HIGH (1 << 24) -#define VDCTRL0_VSYNC_PERIOD_UNIT (1 << 21) -#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT (1 << 20) -#define VDCTRL0_HALF_LINE (1 << 19) -#define VDCTRL0_HALF_LINE_MODE (1 << 18) +#define VDCTRL0_ENABLE_PRESENT BIT(28) +#define VDCTRL0_VSYNC_ACT_HIGH BIT(27) +#define VDCTRL0_HSYNC_ACT_HIGH BIT(26) +#define VDCTRL0_DOTCLK_ACT_FALLING BIT(25) +#define VDCTRL0_ENABLE_ACT_HIGH BIT(24) +#define VDCTRL0_VSYNC_PERIOD_UNIT BIT(21) +#define VDCTRL0_VSYNC_PULSE_WIDTH_UNIT BIT(20) +#define VDCTRL0_HALF_LINE BIT(19) +#define VDCTRL0_HALF_LINE_MODE BIT(18)#define VDCTRL0_SET_VSYNC_PULSE_WIDTH (x) ((x) & 0x3ffff)#define VDCTRL0_GET_VSYNC_PULSE_WIDTH (x) ((x) & 0x3ffff)#define VDCTRL2_SET_HSYNC_PERIOD (x) ((x) & 0x3ffff)#define VDCTRL2_GET_HSYNC_PERIOD (x) ((x) & 0x3ffff) -#define VDCTRL3_MUX_SYNC_SIGNALS (1 << 29) -#define VDCTRL3_VSYNC_ONLY (1 << 28) +#define VDCTRL3_MUX_SYNC_SIGNALS BIT(29) +#define VDCTRL3_VSYNC_ONLY BIT(28)#define SET_HOR_WAIT_CNT (x) (((x) & 0xfff) << 16)#define GET_HOR_WAIT_CNT (x) (((x) >> 16) & 0xfff)#define SET_VERT_WAIT_CNT (x) ((x) & 0xffff)
@@ -80,11 +80,11 @@#define VDCTRL4_SET_DOTCLK_DLY (x) (((x) & 0x7) << 29)/* v4 only */ #define VDCTRL4_GET_DOTCLK_DLY (x) (((x) >> 29) & 0x7)/* v4 only */ -#define VDCTRL4_SYNC_SIGNALS_ON (1 << 18) +#define VDCTRL4_SYNC_SIGNALS_ON BIT(18)#define SET_DOTCLK_H_VALID_DATA_CNT (x) ((x) & 0x3ffff) -#define DEBUG0_HSYNC (1 < 26) -#define DEBUG0_VSYNC (1 < 25) +#define DEBUG0_HSYNC BIT(26) +#define DEBUG0_VSYNC BIT(25)#define MXSFB_MIN_XRES 120#define MXSFB_MIN_YRES 120
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 4/22 drm: mxsfb: Remove unused macros from mxsfb_regs.h
In reply to Laurent Pinchartmxsfb_regs.h defines macros related to register bits. Some of them are not used and don't clearly map to any particular register, so their purpose isn't known. Remove them.
--- drivers/gpu/drm/mxsfb/mxsfb_regs.h | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_regs.h +0 -8
@@ -91,17 +91,9 @@#define MXSFB_MAX_XRES 0xffff#define MXSFB_MAX_YRES 0xffff -#define RED 0 -#define GREEN 1 -#define BLUE 2 -#define TRANSP 3 -#define STMLCDIF_8BIT 1/* pixel data bus to the display is of 8 bit width */ #define STMLCDIF_16BIT 0/* pixel data bus to the display is of 16 bit width */ #define STMLCDIF_18BIT 2/* pixel data bus to the display is of 18 bit width */ #define STMLCDIF_24BIT 3/* pixel data bus to the display is of 24 bit width */ -#define MXSFB_SYNC_DATA_ENABLE_HIGH_ACT (1 << 6) -#define MXSFB_SYNC_DOTCLK_FALLING_ACT (1 << 7)/* negative edge sampling */ -#endif /* __MXSFB_REGS_H__ */
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 5/22 drm: mxsfb: Clarify format and bus width configuration
In reply to Laurent PinchartReplace the convoluted way to set the format and bus width through difficult to read macros with more explicit ones. Also remove the outdated comment related to the limitations on bus width setting as it doesn't apply anymore (the bus width can be specified through the display_info bus format).
--- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 17 +++++------------ drivers/gpu/drm/mxsfb/mxsfb_regs.h | 17 ++++++++--------- 2 files changed, 13 insertions(+), 21 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +5 -12
@@ -52,13 +52,6 @@ static int mxsfb_set_pixel_fmt(struct mxsfb_drm_private *mxsfb) ctrl =CTRL_BYPASS_COUNT |CTRL_MASTER ; -/* -* WARNING: The bus width, CTRL_SET_BUS_WIDTH(), is configured to -* match the selected mode here. This differs from the original -* MXSFB driver, which had the option to configure the bus width -* to arbitrary value. This limitation should not pose an issue. -*/ -/* CTRL1 contains IRQ config and status bits, preserve those. */ ctrl1 =readl (mxsfb->base +LCDC_CTRL1 ); ctrl1 &=CTRL1_CUR_FRAME_DONE_IRQ_EN |CTRL1_CUR_FRAME_DONE_IRQ ;
@@ -66,12 +59,12 @@ static int mxsfb_set_pixel_fmt(struct mxsfb_drm_private *mxsfb)switch (format) {case DRM_FORMAT_RGB565 :dev_dbg (drm->dev,"Setting up RGB565 mode\n" ); - ctrl |=CTRL_SET_WORD_LENGTH (0 ); + ctrl |=CTRL_WORD_LENGTH_16 ; ctrl1 |=CTRL1_SET_BYTE_PACKAGING (0xf );break ;case DRM_FORMAT_XRGB8888 :dev_dbg (drm->dev,"Setting up XRGB8888 mode\n" ); - ctrl |=CTRL_SET_WORD_LENGTH (3 ); + ctrl |=CTRL_WORD_LENGTH_24 ;/* Do not use packed pixels = one pixel per word instead. */ ctrl1 |=CTRL1_SET_BYTE_PACKAGING (0x7 );break ;
@@ -104,13 +97,13 @@ static void mxsfb_set_bus_fmt(struct mxsfb_drm_private *mxsfb) reg &= ~CTRL_BUS_WIDTH_MASK ;switch (bus_format) {case MEDIA_BUS_FMT_RGB565_1X16 : - reg |=CTRL_SET_BUS_WIDTH (STMLCDIF_16BIT ); + reg |=CTRL_BUS_WIDTH_16 ;break ;case MEDIA_BUS_FMT_RGB666_1X18 : - reg |=CTRL_SET_BUS_WIDTH (STMLCDIF_18BIT ); + reg |=CTRL_BUS_WIDTH_18 ;break ;case MEDIA_BUS_FMT_RGB888_1X24 : - reg |=CTRL_SET_BUS_WIDTH (STMLCDIF_24BIT ); + reg |=CTRL_BUS_WIDTH_24 ;break ;default :dev_err (drm->dev,"Unknown media bus format %d\n" , bus_format);
drivers/gpu/drm/mxsfb/mxsfb_regs.h +8 -9
@@ -34,11 +34,15 @@#define CTRL_VSYNC_MODE BIT(18)#define CTRL_DOTCLK_MODE BIT(17)#define CTRL_DATA_SELECT BIT(16) -#define CTRL_SET_BUS_WIDTH (x) (((x) & 0x3) << 10) -#define CTRL_GET_BUS_WIDTH (x) (((x) >> 10) & 0x3) +#define CTRL_BUS_WIDTH_16 (0 << 10) +#define CTRL_BUS_WIDTH_8 (1 << 10) +#define CTRL_BUS_WIDTH_18 (2 << 10) +#define CTRL_BUS_WIDTH_24 (3 << 10)#define CTRL_BUS_WIDTH_MASK (0x3 << 10) -#define CTRL_SET_WORD_LENGTH (x) (((x) & 0x3) << 8) -#define CTRL_GET_WORD_LENGTH (x) (((x) >> 8) & 0x3) +#define CTRL_WORD_LENGTH_16 (0 << 8) +#define CTRL_WORD_LENGTH_8 (1 << 8) +#define CTRL_WORD_LENGTH_18 (2 << 8) +#define CTRL_WORD_LENGTH_24 (3 << 8)#define CTRL_MASTER BIT(5)#define CTRL_DF16 BIT(3)#define CTRL_DF18 BIT(2)
@@ -91,9 +95,4 @@#define MXSFB_MAX_XRES 0xffff#define MXSFB_MAX_YRES 0xffff -#define STMLCDIF_8BIT 1/* pixel data bus to the display is of 8 bit width */ -#define STMLCDIF_16BIT 0/* pixel data bus to the display is of 16 bit width */ -#define STMLCDIF_18BIT 2/* pixel data bus to the display is of 18 bit width */ -#define STMLCDIF_24BIT 3/* pixel data bus to the display is of 24 bit width */ -#endif /* __MXSFB_REGS_H__ */
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 6/22 drm: mxsfb: Pass mxsfb_drm_private pointer to mxsfb_reset_block()
In reply to Laurent PinchartThe mxsfb_reset_block() function isn't special, pass it the mxsfb_drm_private pointer instead of a pointer to the base address.
--- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +6 -6
@@ -166,21 +166,21 @@ static int clear_poll_bit(void __iomem *addr, u32 mask)return readl_poll_timeout (addr, reg, !(reg & mask),0 ,RESET_TIMEOUT ); } -static int mxsfb_reset_block (void __iomem *reset_addr) +static int mxsfb_reset_block (struct mxsfb_drm_private *mxsfb) {int ret; - ret =clear_poll_bit (reset_addr,MODULE_SFTRST ); + ret =clear_poll_bit (mxsfb->base,MODULE_SFTRST );if (ret)return ret; -writel (MODULE_CLKGATE , reset_addr +MXS_CLR_ADDR ); +writel (MODULE_CLKGATE , mxsfb->base +MXS_CLR_ADDR ); - ret =clear_poll_bit (reset_addr,MODULE_SFTRST ); + ret =clear_poll_bit (mxsfb->base,MODULE_SFTRST );if (ret)return ret; -return clear_poll_bit (reset_addr,MODULE_CLKGATE ); +return clear_poll_bit (mxsfb->base,MODULE_CLKGATE ); }static dma_addr_t mxsfb_get_fb_paddr (struct mxsfb_drm_private *mxsfb)
@@ -213,7 +213,7 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)*/ /* Mandatory eLCDIF reset as per the Reference Manual */ - err =mxsfb_reset_block (mxsfb->base); + err =mxsfb_reset_block (mxsfb);if (err)return ;
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 7/22 drm: mxsfb: Use LCDC_CTRL register name explicitly
In reply to Laurent PinchartThe LCDC_CTRL register is located at address 0x0000. Some of the accesses to the register simply use the mxsfb->base address. Reference the LCDC_CTRL register explicitly instead to clarify the code.
--- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +4 -4
@@ -170,17 +170,17 @@ static int mxsfb_reset_block(struct mxsfb_drm_private *mxsfb) {int ret; - ret =clear_poll_bit (mxsfb->base,MODULE_SFTRST ); + ret =clear_poll_bit (mxsfb->base +LCDC_CTRL ,MODULE_SFTRST );if (ret)return ret; -writel (MODULE_CLKGATE , mxsfb->base +MXS_CLR_ADDR ); +writel (MODULE_CLKGATE , mxsfb->base +LCDC_CTRL +MXS_CLR_ADDR ); - ret =clear_poll_bit (mxsfb->base,MODULE_SFTRST ); + ret =clear_poll_bit (mxsfb->base +LCDC_CTRL ,MODULE_SFTRST );if (ret)return ret; -return clear_poll_bit (mxsfb->base,MODULE_CLKGATE ); +return clear_poll_bit (mxsfb->base +LCDC_CTRL ,MODULE_CLKGATE ); }static dma_addr_t mxsfb_get_fb_paddr (struct mxsfb_drm_private *mxsfb)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 8/22 drm: mxsfb: Remove register definitions from mxsfb_crtc.c
In reply to Laurent Pinchartmxsfb_crtc.c defines several macros related to register addresses and bit, which duplicates macros from mxsfb_regs.h. Use the macros from mxsfb_regs.h instead and remove them.
--- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +5 -9
@@ -29,10 +29,6 @@#include "mxsfb_drv.h" #include "mxsfb_regs.h" -#define MXS_SET_ADDR 0x4 -#define MXS_CLR_ADDR 0x8 -#define MODULE_CLKGATE BIT(30) -#define MODULE_SFTRST BIT(31)/* 1 second delay should be plenty of time for block reset */ #define RESET_TIMEOUT 1000000
@@ -162,7 +158,7 @@ static int clear_poll_bit(void __iomem *addr, u32 mask) {u32 reg; -writel (mask, addr +MXS_CLR_ADDR ); +writel (mask, addr +REG_CLR );return readl_poll_timeout (addr, reg, !(reg & mask),0 ,RESET_TIMEOUT ); }
@@ -170,17 +166,17 @@ static int mxsfb_reset_block(struct mxsfb_drm_private *mxsfb) {int ret; - ret =clear_poll_bit (mxsfb->base +LCDC_CTRL ,MODULE_SFTRST ); + ret =clear_poll_bit (mxsfb->base +LCDC_CTRL ,CTRL_SFTRST );if (ret)return ret; -writel (MODULE_CLKGATE , mxsfb->base +LCDC_CTRL +MXS_CLR_ADDR ); +writel (CTRL_CLKGATE , mxsfb->base +LCDC_CTRL +REG_CLR ); - ret =clear_poll_bit (mxsfb->base +LCDC_CTRL ,MODULE_SFTRST ); + ret =clear_poll_bit (mxsfb->base +LCDC_CTRL ,CTRL_SFTRST );if (ret)return ret; -return clear_poll_bit (mxsfb->base +LCDC_CTRL ,MODULE_CLKGATE ); +return clear_poll_bit (mxsfb->base +LCDC_CTRL ,CTRL_CLKGATE ); }static dma_addr_t mxsfb_get_fb_paddr (struct mxsfb_drm_private *mxsfb)
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 9/22 drm: mxsfb: Remove unneeded includes
In reply to Laurent PinchartA fair number of includes are not needed. Drop them, and add a couple of required includes that were included indirectly.
--- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 12 +++--------- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 5 ----- 2 files changed, 3 insertions(+), 14 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_crtc.c +3 -9
@@ -10,19 +10,13 @@#include <linux/clk.h> #include <linux/iopoll.h> -#include <linux/of_graph.h> -#include <linux/platform_data/simplefb.h> +#include <linux/spinlock.h> -#include <video/videomode.h> - -#include <drm/drm_atomic_helper.h> +#include <drm/drm_bridge.h> #include <drm/drm_crtc.h> #include <drm/drm_fb_cma_helper.h> -#include <drm/drm_fb_helper.h> +#include <drm/drm_fourcc.h> #include <drm/drm_gem_cma_helper.h> -#include <drm/drm_of.h> -#include <drm/drm_plane_helper.h> -#include <drm/drm_probe_helper.h> #include <drm/drm_simple_kms_helper.h> #include <drm/drm_vblank.h>
drivers/gpu/drm/mxsfb/mxsfb_drv.c +0 -5
@@ -9,15 +9,10 @@*/ #include <linux/clk.h> -#include <linux/component.h> #include <linux/dma-mapping.h> -#include <linux/list.h> #include <linux/module.h> #include <linux/of_device.h> -#include <linux/of_graph.h> -#include <linux/of_reserved_mem.h> #include <linux/pm_runtime.h> -#include <linux/dma-resv.h> #include <linux/spinlock.h> #include <drm/drm_atomic.h>
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 10/22 drm: mxsfb: Rename mxsfb_crtc.c to mxsfb_kms.c
In reply to Laurent PinchartThe mxsfb_crtc.c file doesn't handle just the CRTC, but also the other KMS objects. Rename it accordingly.
---
drivers/gpu/drm/mxsfb/Makefile | 2 +-
drivers/gpu/drm/mxsfb/{mxsfb_crtc.c => mxsfb_kms.c} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename drivers/gpu/drm/mxsfb/{mxsfb_crtc.c => mxsfb_kms.c} (100%)drivers/gpu/drm/mxsfb/Makefile +1 -1
@@ -1,3 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only -mxsfb-y := mxsfb_drv.o mxsfb_crtc.o +mxsfb-y := mxsfb_drv.o mxsfb_kms.o obj-$(CONFIG_DRM_MXSFB) += mxsfb.o
drivers/gpu/drm/mxsfb/mxsfb_kms.c renamed from drivers/gpu/drm/mxsfb/mxsfb_crtc.c +0 -0
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 11/22 drm: mxsfb: Stop using DRM simple display pipeline helper
In reply to Laurent PinchartThe DRM simple display pipeline helper only supports a single plane. In order to prepare for support of the alpha plane on i.MX6SX and i.MX7, move away from the helper. No new feature is added.
---
Changes since v2:
- Fix primary plane enable check in mxsfb_crtc_atomic_check()
Changes since v1:
- Move after mxsfb_crtc.c rename to mxsfb_kms.c
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 114 ++---------------- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 23 ++-- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 190 +++++++++++++++++++++++++++--- 3 files changed, 203 insertions(+), 124 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +13 -101
@@ -10,22 +10,23 @@#include <linux/clk.h> #include <linux/dma-mapping.h> +#include <linux/io.h> #include <linux/module.h> #include <linux/of_device.h> +#include <linux/platform_device.h> #include <linux/pm_runtime.h> -#include <linux/spinlock.h> -#include <drm/drm_atomic.h> #include <drm/drm_atomic_helper.h> -#include <drm/drm_crtc.h> +#include <drm/drm_bridge.h> +#include <drm/drm_connector.h> #include <drm/drm_drv.h> #include <drm/drm_fb_helper.h> #include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_irq.h> +#include <drm/drm_mode_config.h> #include <drm/drm_of.h> #include <drm/drm_probe_helper.h> -#include <drm/drm_simple_kms_helper.h> #include <drm/drm_vblank.h> #include "mxsfb_drv.h"
@@ -57,22 +58,6 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { }, }; -static const uint32_t mxsfb_formats[] = { -DRM_FORMAT_XRGB8888 , -DRM_FORMAT_RGB565 -}; - -static const uint64_t mxsfb_modifiers[] = { -DRM_FORMAT_MOD_LINEAR , -DRM_FORMAT_MOD_INVALID -}; - -static struct mxsfb_drm_private * -drm_pipe_to_mxsfb_drm_private (struct drm_simple_display_pipe *pipe) -{ - return container_of(pipe, struct mxsfb_drm_private, pipe); -} -void mxsfb_enable_axi_clk (struct mxsfb_drm_private *mxsfb) {if (mxsfb->clk_axi)
@@ -95,77 +80,6 @@ static const struct drm_mode_config_helper_funcs mxsfb_mode_config_helpers = { .atomic_commit_tail = drm_atomic_helper_commit_tail_rpm, }; -static void mxsfb_pipe_enable (struct drm_simple_display_pipe *pipe, -struct drm_crtc_state *crtc_state, -struct drm_plane_state *plane_state) -{ -struct mxsfb_drm_private *mxsfb =drm_pipe_to_mxsfb_drm_private (pipe); -struct drm_device *drm = pipe->plane.dev; - -pm_runtime_get_sync (drm->dev); -mxsfb_crtc_enable (mxsfb); -} - -static void mxsfb_pipe_disable (struct drm_simple_display_pipe *pipe) -{ -struct mxsfb_drm_private *mxsfb =drm_pipe_to_mxsfb_drm_private (pipe); -struct drm_device *drm = pipe->plane.dev; -struct drm_crtc *crtc = &pipe->crtc; -struct drm_pending_vblank_event *event; - -mxsfb_crtc_disable (mxsfb); -pm_runtime_put_sync (drm->dev); - -spin_lock_irq (&drm->event_lock); - event = crtc->state->event; -if (event) { - crtc->state->event =NULL ; -drm_crtc_send_vblank_event (crtc, event); - } -spin_unlock_irq (&drm->event_lock); -} - -static void mxsfb_pipe_update (struct drm_simple_display_pipe *pipe, -struct drm_plane_state *plane_state) -{ -struct mxsfb_drm_private *mxsfb =drm_pipe_to_mxsfb_drm_private (pipe); - -mxsfb_plane_atomic_update (mxsfb, plane_state); -} - -static int mxsfb_pipe_enable_vblank (struct drm_simple_display_pipe *pipe) -{ -struct mxsfb_drm_private *mxsfb =drm_pipe_to_mxsfb_drm_private (pipe); - -/* Clear and enable VBLANK IRQ */ -mxsfb_enable_axi_clk (mxsfb); -writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR ); -writel (CTRL1_CUR_FRAME_DONE_IRQ_EN , mxsfb->base +LCDC_CTRL1 +REG_SET ); -mxsfb_disable_axi_clk (mxsfb); - -return 0 ; -} - -static void mxsfb_pipe_disable_vblank (struct drm_simple_display_pipe *pipe) -{ -struct mxsfb_drm_private *mxsfb =drm_pipe_to_mxsfb_drm_private (pipe); - -/* Disable and clear VBLANK IRQ */ -mxsfb_enable_axi_clk (mxsfb); -writel (CTRL1_CUR_FRAME_DONE_IRQ_EN , mxsfb->base +LCDC_CTRL1 +REG_CLR ); -writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR ); -mxsfb_disable_axi_clk (mxsfb); -} - -static struct drm_simple_display_pipe_funcs mxsfb_funcs = { - .enable = mxsfb_pipe_enable, - .disable = mxsfb_pipe_disable, - .update = mxsfb_pipe_update, - .prepare_fb = drm_gem_fb_simple_display_pipe_prepare_fb, - .enable_vblank = mxsfb_pipe_enable_vblank, - .disable_vblank = mxsfb_pipe_disable_vblank, -}; -static int mxsfb_attach_bridge (struct mxsfb_drm_private *mxsfb) {struct drm_device *drm = mxsfb->drm;
@@ -189,7 +103,7 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)if (!bridge)return -ENODEV ; - ret =drm_simple_display_pipe_attach_bridge (&mxsfb->pipe, bridge); + ret =drm_bridge_attach (&mxsfb->encoder, bridge,NULL ,0 );if (ret) {DRM_DEV_ERROR (drm->dev,"failed to attach bridge: %d\n" , ret);
@@ -256,11 +170,9 @@ static int mxsfb_load(struct drm_device *drm)/* Modeset init */ drm_mode_config_init (drm); - ret =drm_simple_display_pipe_init (drm, &mxsfb->pipe, &mxsfb_funcs, - mxsfb_formats,ARRAY_SIZE (mxsfb_formats), - mxsfb_modifiers,NULL ); + ret =mxsfb_kms_init (mxsfb);if (ret <0 ) { -dev_err (drm->dev,"Cannot setup simple display pipe\n" ); +dev_err (drm->dev,"Failed to initialize KMS pipeline\n" ); goto err_vblank; }
@@ -316,11 +228,11 @@ static void mxsfb_unload(struct drm_device *drm)pm_runtime_disable (drm->dev); } -static void mxsfb_irq_preinstall (struct drm_device *drm) +static void mxsfb_irq_disable (struct drm_device *drm) {struct mxsfb_drm_private *mxsfb = drm->dev_private; -mxsfb_pipe_disable_vblank (&mxsfb->pipe); + mxsfb->crtc.funcs->disable_vblank (&mxsfb->crtc); }static irqreturn_t mxsfb_irq_handler (int irq,void *data)
@@ -334,7 +246,7 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data) reg =readl (mxsfb->base +LCDC_CTRL1 );if (reg &CTRL1_CUR_FRAME_DONE_IRQ ) -drm_crtc_handle_vblank (&mxsfb->pipe.crtc); +drm_crtc_handle_vblank (&mxsfb->crtc);writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR );
@@ -348,8 +260,8 @@ DEFINE_DRM_GEM_CMA_FOPS(fops);static struct drm_driver mxsfb_driver = { .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_ATOMIC , .irq_handler = mxsfb_irq_handler, - .irq_preinstall = mxsfb_irq_preinstall, - .irq_uninstall = mxsfb_irq_preinstall, + .irq_preinstall = mxsfb_irq_disable, + .irq_uninstall = mxsfb_irq_disable,DRM_GEM_CMA_DRIVER_OPS , .fops = &fops, .name ="mxsfb-drm" ,
drivers/gpu/drm/mxsfb/mxsfb_drv.h +15 -8
@@ -8,7 +8,12 @@ #ifndef __MXSFB_DRV_H__ #define __MXSFB_DRV_H__ -struct drm_device; +#include <drm/drm_crtc.h> +#include <drm/drm_device.h> +#include <drm/drm_encoder.h> +#include <drm/drm_plane.h> + +struct clk; struct mxsfb_devdata { unsigned int transfer_count;
@@ -29,20 +34,22 @@ struct mxsfb_drm_private {struct clk *clk_disp_axi;struct drm_device *drm; -struct drm_simple_display_pipe pipe; +struct drm_plane plane; +struct drm_crtc crtc; +struct drm_encoder encoder;struct drm_connector *connector; struct drm_bridge *bridge; }; -int mxsfb_setup_crtc (struct drm_device *dev); -int mxsfb_create_output (struct drm_device *dev); +static inline struct mxsfb_drm_private * +to_mxsfb_drm_private (struct drm_device *drm) +{ +return drm->dev_private; +}void mxsfb_enable_axi_clk (struct mxsfb_drm_private *mxsfb);void mxsfb_disable_axi_clk (struct mxsfb_drm_private *mxsfb); -void mxsfb_crtc_enable (struct mxsfb_drm_private *mxsfb); -void mxsfb_crtc_disable (struct mxsfb_drm_private *mxsfb); -void mxsfb_plane_atomic_update (struct mxsfb_drm_private *mxsfb, -struct drm_plane_state *state); +int mxsfb_kms_init (struct mxsfb_drm_private *mxsfb);#endif /* __MXSFB_DRV_H__ */
drivers/gpu/drm/mxsfb/mxsfb_kms.c +175 -15
258 lines not on this page · raw message
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 12/22 drm: mxsfb: Move vblank event arm to CRTC .atomic_flush()
In reply to Laurent PinchartThe vblank event is armed in the plane .atomic_update(). This works fine as we have a single plane, and was the only option when the driver was using the drm_simple_kms_helper helper, but will break as soon as multiple planes are supported. Move it to CRTC .atomic_flush().
---
Changes since v1:
- Reword commit message
--- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 35 ++++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +20 -15
@@ -295,6 +295,25 @@ static int mxsfb_crtc_atomic_check(struct drm_crtc *crtc,return drm_atomic_add_affected_planes (state->state, crtc); } +static void mxsfb_crtc_atomic_flush (struct drm_crtc *crtc, +struct drm_crtc_state *old_state) +{ +struct drm_pending_vblank_event *event; + + event = crtc->state->event; + crtc->state->event =NULL ; + +if (!event) +return ; + +spin_lock_irq (&crtc->dev->event_lock); +if (drm_crtc_vblank_get (crtc) ==0 ) +drm_crtc_arm_vblank_event (crtc, event); +else +drm_crtc_send_vblank_event (crtc, event); +spin_unlock_irq (&crtc->dev->event_lock); +} +static void mxsfb_crtc_atomic_enable (struct drm_crtc *crtc,struct drm_crtc_state *old_state) {
@@ -364,6 +383,7 @@ static void mxsfb_crtc_disable_vblank(struct drm_crtc *crtc)static const struct drm_crtc_helper_funcs mxsfb_crtc_helper_funcs = { .atomic_check = mxsfb_crtc_atomic_check, + .atomic_flush = mxsfb_crtc_atomic_flush, .atomic_enable = mxsfb_crtc_atomic_enable, .atomic_disable = mxsfb_crtc_atomic_disable, };
@@ -410,23 +430,8 @@ static void mxsfb_plane_atomic_update(struct drm_plane *plane, struct drm_plane_state *old_pstate) {struct mxsfb_drm_private *mxsfb =to_mxsfb_drm_private (plane->dev); -struct drm_crtc *crtc = &mxsfb->crtc; -struct drm_pending_vblank_event *event;dma_addr_t paddr; -spin_lock_irq (&crtc->dev->event_lock); - event = crtc->state->event; -if (event) { - crtc->state->event =NULL ; - -if (drm_crtc_vblank_get (crtc) ==0 ) { -drm_crtc_arm_vblank_event (crtc, event); - }else { -drm_crtc_send_vblank_event (crtc, event); - } - } -spin_unlock_irq (&crtc->dev->event_lock); - paddr =mxsfb_get_fb_paddr (mxsfb);if (paddr) {mxsfb_enable_axi_clk (mxsfb);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 13/22 drm: mxsfb: Don't touch AXI clock in IRQ context
In reply to Laurent PinchartThe driver attempts agressive power management by enabling and disabling the AXI clock around register accesses. This results in attempts to enable and disable the clock in the IRQ handler, which is a no-go as preparing or unpreparing the clock may sleep.
On the other hand, the driver enables the AXI clock when enabling the CRTC and keeps it enabled until the CRTC is disabled. This is correct, and renders the power management attempt pointless, as interrupts are not supposed to occur when the CRTC is off.
The same reasoning can be applied to the CRTC .enable_vblank() and .disable_vblank() that are not supposed to be called when the CRTC off and thus don't require manual handling of the AXI clock. Furthermore, vblank handling is never enabled, which results in the vblank enable and disable handlers never being called.
To fix this, remove the manual clock handling in the IRQ, the CRTC .enable_vblank() and .disable_vblank() handlers and the plane .atomic_update() handler. We however need to handle the clock manually in mxsfb_irq_disable() as is calls .disable_vblank() manually and is used both at probe and remove time.
The clock disabling is also moved to the last step of the mxsfb_crtc_atomic_disable() function, to prepare for enabling vblank handling.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 6 ++---- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 15 ++++----------- 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +2 -4
@@ -232,7 +232,9 @@ static void mxsfb_irq_disable(struct drm_device *drm) {struct mxsfb_drm_private *mxsfb = drm->dev_private; +mxsfb_enable_axi_clk (mxsfb); mxsfb->crtc.funcs->disable_vblank (&mxsfb->crtc); +mxsfb_disable_axi_clk (mxsfb); }static irqreturn_t mxsfb_irq_handler (int irq,void *data)
@@ -241,8 +243,6 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)struct mxsfb_drm_private *mxsfb = drm->dev_private;u32 reg; -mxsfb_enable_axi_clk (mxsfb); - reg =readl (mxsfb->base +LCDC_CTRL1 );if (reg &CTRL1_CUR_FRAME_DONE_IRQ )
@@ -250,8 +250,6 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR ); -mxsfb_disable_axi_clk (mxsfb); -return IRQ_HANDLED ; }
drivers/gpu/drm/mxsfb/mxsfb_kms.c +4 -11
@@ -344,9 +344,6 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc,struct drm_pending_vblank_event *event;mxsfb_disable_controller (mxsfb); -mxsfb_disable_axi_clk (mxsfb); - -pm_runtime_put_sync (drm->dev);spin_lock_irq (&drm->event_lock); event = crtc->state->event;
@@ -355,6 +352,9 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc,drm_crtc_send_vblank_event (crtc, event); }spin_unlock_irq (&drm->event_lock); + +mxsfb_disable_axi_clk (mxsfb); +pm_runtime_put_sync (drm->dev); }static int mxsfb_crtc_enable_vblank (struct drm_crtc *crtc)
@@ -362,10 +362,8 @@ static int mxsfb_crtc_enable_vblank(struct drm_crtc *crtc)struct mxsfb_drm_private *mxsfb =to_mxsfb_drm_private (crtc->dev);/* Clear and enable VBLANK IRQ */ -mxsfb_enable_axi_clk (mxsfb);writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR );writel (CTRL1_CUR_FRAME_DONE_IRQ_EN , mxsfb->base +LCDC_CTRL1 +REG_SET ); -mxsfb_disable_axi_clk (mxsfb);return 0 ; }
@@ -375,10 +373,8 @@ static void mxsfb_crtc_disable_vblank(struct drm_crtc *crtc)struct mxsfb_drm_private *mxsfb =to_mxsfb_drm_private (crtc->dev);/* Disable and clear VBLANK IRQ */ -mxsfb_enable_axi_clk (mxsfb);writel (CTRL1_CUR_FRAME_DONE_IRQ_EN , mxsfb->base +LCDC_CTRL1 +REG_CLR );writel (CTRL1_CUR_FRAME_DONE_IRQ , mxsfb->base +LCDC_CTRL1 +REG_CLR ); -mxsfb_disable_axi_clk (mxsfb); }static const struct drm_crtc_helper_funcs mxsfb_crtc_helper_funcs = {
@@ -433,11 +429,8 @@ static void mxsfb_plane_atomic_update(struct drm_plane *plane,dma_addr_t paddr; paddr =mxsfb_get_fb_paddr (mxsfb); -if (paddr) { -mxsfb_enable_axi_clk (mxsfb); +if (paddr)writel (paddr, mxsfb->base + mxsfb->devdata->next_buf); -mxsfb_disable_axi_clk (mxsfb); - } }static const struct drm_plane_helper_funcs mxsfb_plane_helper_funcs = {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 14/22 drm: mxsfb: Enable vblank handling
In reply to Laurent PinchartEnable vblank handling when the CRTC is turned on and disable it when it is turned off. This requires moving vblank init after the KMS pipeline initialisation, otherwise drm_vblank_init() gets called with 0 CRTCs.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 15 +++++++++------ drivers/gpu/drm/mxsfb/mxsfb_kms.c | 6 +++++- 2 files changed, 14 insertions(+), 7 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +9 -6
@@ -161,12 +161,6 @@ static int mxsfb_load(struct drm_device *drm)pm_runtime_enable (drm->dev); - ret =drm_vblank_init (drm, drm->mode_config.num_crtc); -if (ret <0 ) { -dev_err (drm->dev,"Failed to initialise vblank\n" ); - goto err_vblank; - } -/* Modeset init */ drm_mode_config_init (drm);
@@ -176,6 +170,15 @@ static int mxsfb_load(struct drm_device *drm) goto err_vblank; } + ret =drm_vblank_init (drm, drm->mode_config.num_crtc); +if (ret <0 ) { +dev_err (drm->dev,"Failed to initialise vblank\n" ); + goto err_vblank; + } + +/* Start with vertical blanking interrupt reporting disabled. */ +drm_crtc_vblank_off (&mxsfb->crtc); + ret =mxsfb_attach_bridge (mxsfb);if (ret) {dev_err (drm->dev,"Cannot connect bridge: %d\n" , ret);
drivers/gpu/drm/mxsfb/mxsfb_kms.c +5 -1
@@ -322,8 +322,10 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc,dma_addr_t paddr;pm_runtime_get_sync (drm->dev); -mxsfb_enable_axi_clk (mxsfb); + +drm_crtc_vblank_on (crtc); +mxsfb_crtc_mode_set_nofb (mxsfb);/* Write cur_buf as well to avoid an initial corrupt frame */
@@ -353,6 +355,8 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc, }spin_unlock_irq (&drm->event_lock); +drm_crtc_vblank_off (crtc); +mxsfb_disable_axi_clk (mxsfb);pm_runtime_put_sync (drm->dev); }
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 15/22 drm: mxsfb: Remove mxsfb_devdata unused fields
In reply to Laurent PinchartThe debug0 and ipversion fields of the mxsfb_devdata structure are unused. Remove them.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 4 ---- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 2 -- 2 files changed, 6 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +0 -4
@@ -42,19 +42,15 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { .transfer_count = LCDC_V3_TRANSFER_COUNT, .cur_buf = LCDC_V3_CUR_BUF, .next_buf = LCDC_V3_NEXT_BUF, - .debug0 = LCDC_V3_DEBUG0, .hs_wdth_mask = 0xff, .hs_wdth_shift = 24, - .ipversion = 3, }, [MXSFB_V4] = { .transfer_count = LCDC_V4_TRANSFER_COUNT, .cur_buf = LCDC_V4_CUR_BUF, .next_buf = LCDC_V4_NEXT_BUF, - .debug0 = LCDC_V4_DEBUG0, .hs_wdth_mask = 0x3fff, .hs_wdth_shift = 18, - .ipversion = 4, }, };
drivers/gpu/drm/mxsfb/mxsfb_drv.h +0 -2
@@ -19,10 +19,8 @@ struct mxsfb_devdata {unsigned int transfer_count;unsigned int cur_buf;unsigned int next_buf; -unsigned int debug0;unsigned int hs_wdth_mask;unsigned int hs_wdth_shift; -unsigned int ipversion; };struct mxsfb_drm_private {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 16/22 drm: mxsfb: Add i.MX7 and i.MX8M to the list of supported SoCs in Kconfig
In reply to Laurent PinchartExtend the Kconfig option description by listing the i.MX7 and i.MX8M SoCs, as they are supported by the same driver. Replace the list of SoCs in the short description with just "(e)LCDIF LCD controller" to avoid expanding it further in the future as support for more SoCs is added.
---
Changes since v1:
- Make description more explicit by mentioning LCDIF and eLCDIF
- Add i.MX8M
--- drivers/gpu/drm/mxsfb/Kconfig | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/mxsfb/Kconfig +4 -3
@@ -5,7 +5,7 @@ config DRM_MXS Choose this option to select drivers for MXS FB devices config DRM_MXSFB - tristate "i.MX23/i.MX28/i.MX6SX MXSFB LCD controller" + tristate "i.MX (e)LCDIF LCD controller" depends on DRM && OF depends on COMMON_CLK select DRM_MXS
@@ -15,7 +15,8 @@ config DRM_MXSFB select DRM_PANEL select DRM_PANEL_BRIDGE help - Choose this option if you have an i.MX23/i.MX28/i.MX6SX MXSFB - LCD controller. + Choose this option if you have an LCDIF or eLCDIF LCD controller. + Those devices are found in various i.MX SoC (including i.MX23, + i.MX28, i.MX6SX, i.MX7 and i.MX8M). If M is selected the module will be called mxsfb.
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 17/22 drm: mxsfb: Update internal IP version number for i.MX6SX
In reply to Laurent PinchartThe LCDIF present in the i.MX6SX has extra features compared to the i.MX28. It has however lost its IP version register, so no official version number is known. Bump the version to MXSFB_V6 following the i.MX version, in preparation for support for the additional features.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +13 -1
@@ -35,6 +35,11 @@enum mxsfb_devtype {MXSFB_V3 ,MXSFB_V4 , +/* +* Starting at i.MX6 the hardware version register is gone, use the +* i.MX family number as the version. +*/ +MXSFB_V6 , };static const struct mxsfb_devdata mxsfb_devdata[] = {
@@ -52,6 +57,13 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { .hs_wdth_mask = 0x3fff, .hs_wdth_shift = 18, }, + [MXSFB_V6] = { + .transfer_count = LCDC_V4_TRANSFER_COUNT, + .cur_buf = LCDC_V4_CUR_BUF, + .next_buf = LCDC_V4_NEXT_BUF, + .hs_wdth_mask = 0x3fff, + .hs_wdth_shift = 18, + }, };void mxsfb_enable_axi_clk (struct mxsfb_drm_private *mxsfb)
@@ -271,7 +283,7 @@ static struct drm_driver mxsfb_driver = {static const struct platform_device_id mxsfb_devtype[] = { { .name ="imx23-fb" , .driver_data =MXSFB_V3 , }, { .name ="imx28-fb" , .driver_data =MXSFB_V4 , }, - { .name ="imx6sx-fb" , .driver_data =MXSFB_V4 , }, + { .name ="imx6sx-fb" , .driver_data =MXSFB_V6 , }, {/* sentinel */ } };MODULE_DEVICE_TABLE (platform, mxsfb_devtype);
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 18/22 drm: mxsfb: Drop non-OF support
In reply to Laurent PinchartThe mxsfb driver is only used by OF platforms. Drop non-OF support.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +7 -18
@@ -131,7 +131,8 @@ static int mxsfb_attach_bridge(struct mxsfb_drm_private *mxsfb)return 0 ; } -static int mxsfb_load (struct drm_device *drm) +static int mxsfb_load (struct drm_device *drm, +const struct mxsfb_devdata *devdata) {struct platform_device *pdev =to_platform_device (drm->dev);struct mxsfb_drm_private *mxsfb;
@@ -144,7 +145,7 @@ static int mxsfb_load(struct drm_device *drm) mxsfb->drm = drm; drm->dev_private = mxsfb; - mxsfb->devdata = &mxsfb_devdata[pdev->id_entry->driver_data]; + mxsfb->devdata = devdata; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); mxsfb->base =devm_ioremap_resource (drm->dev, res);
@@ -280,18 +281,10 @@ static struct drm_driver mxsfb_driver = { .minor = 0, }; -static const struct platform_device_id mxsfb_devtype[] = { - { .name ="imx23-fb" , .driver_data =MXSFB_V3 , }, - { .name ="imx28-fb" , .driver_data =MXSFB_V4 , }, - { .name ="imx6sx-fb" , .driver_data =MXSFB_V6 , }, - {/* sentinel */ } -}; -MODULE_DEVICE_TABLE (platform, mxsfb_devtype); -static const struct of_device_id mxsfb_dt_ids[] = { - { .compatible ="fsl,imx23-lcdif" , .data = &mxsfb_devtype[0 ], }, - { .compatible ="fsl,imx28-lcdif" , .data = &mxsfb_devtype[1 ], }, - { .compatible ="fsl,imx6sx-lcdif" , .data = &mxsfb_devtype[2 ], }, + { .compatible ="fsl,imx23-lcdif" , .data = &mxsfb_devdata[MXSFB_V3 ], }, + { .compatible ="fsl,imx28-lcdif" , .data = &mxsfb_devdata[MXSFB_V4 ], }, + { .compatible ="fsl,imx6sx-lcdif" , .data = &mxsfb_devdata[MXSFB_V6 ], }, {/* sentinel */ } };MODULE_DEVICE_TABLE (of, mxsfb_dt_ids);
@@ -306,14 +299,11 @@ static int mxsfb_probe(struct platform_device *pdev)if (!pdev->dev.of_node)return -ENODEV ; -if (of_id) - pdev->id_entry = of_id->data; - drm =drm_dev_alloc (&mxsfb_driver, &pdev->dev);if (IS_ERR (drm))return PTR_ERR (drm); - ret =mxsfb_load (drm); + ret =mxsfb_load (drm, of_id->data);if (ret) goto err_free;
@@ -367,7 +357,6 @@ static const struct dev_pm_ops mxsfb_pm_ops = {static struct platform_driver mxsfb_platform_driver = { .probe = mxsfb_probe, .remove = mxsfb_remove, - .id_table = mxsfb_devtype, .driver = { .name ="mxsfb" , .of_match_table = mxsfb_dt_ids,
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 19/22 drm: mxsfb: Turn mxsfb_set_pixel_fmt() into a void function
In reply to Laurent PinchartThe mxsfb_set_pixel_fmt() function returns an error when the selected pixel format is unsupported. This can never happen, as such errors are caught by the DRM core. Remove the error check.
--- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +2 -9
@@ -43,7 +43,7 @@ static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val) }/* Setup the MXSFB registers for decoding the pixels out of the framebuffer */ -static int mxsfb_set_pixel_fmt (struct mxsfb_drm_private *mxsfb) +static void mxsfb_set_pixel_fmt (struct mxsfb_drm_private *mxsfb) {struct drm_device *drm = mxsfb->drm;const u32 format = mxsfb->crtc.primary->state->fb->format->format;
@@ -67,15 +67,10 @@ static int mxsfb_set_pixel_fmt(struct mxsfb_drm_private *mxsfb)/* Do not use packed pixels = one pixel per word instead. */ ctrl1 |=CTRL1_SET_BYTE_PACKAGING (0x7 );break ; -default : -dev_err (drm->dev,"Unhandled pixel format %08x\n" , format); -return -EINVAL ; }writel (ctrl1, mxsfb->base +LCDC_CTRL1 );writel (ctrl, mxsfb->base +LCDC_CTRL ); - -return 0 ; }static void mxsfb_set_bus_fmt (struct mxsfb_drm_private *mxsfb)
@@ -218,9 +213,7 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)/* Clear the FIFOs */ writel (CTRL1_FIFO_CLEAR , mxsfb->base +LCDC_CTRL1 +REG_SET ); - err =mxsfb_set_pixel_fmt (mxsfb); -if (err) -return ; +mxsfb_set_pixel_fmt (mxsfb);clk_set_rate (mxsfb->clk, m->crtc_clock *1000 );
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 20/22 drm: mxsfb: Merge mxsfb_set_pixel_fmt() and mxsfb_set_bus_fmt()
In reply to Laurent PinchartThe mxsfb_set_pixel_fmt() and mxsfb_set_bus_fmt() functions both deal with format configuration, are always called in a row from mxsfb_crtc_mode_set_nofb(), and set fields from the LCDC_CTRL register. This requires a read-modify-update cycle in mxsfb_set_bus_fmt(). Make this more efficient by merging them together.
--- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 47 +++++++++++++------------------ 1 file changed, 19 insertions(+), 28 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +19 -28
@@ -42,13 +42,23 @@ static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val) mxsfb->devdata->hs_wdth_shift; } -/* Setup the MXSFB registers for decoding the pixels out of the framebuffer */ -static void mxsfb_set_pixel_fmt (struct mxsfb_drm_private *mxsfb) +/* +* Setup the MXSFB registers for decoding the pixels out of the framebuffer and +* outputting them on the bus. +*/ +static void mxsfb_set_formats (struct mxsfb_drm_private *mxsfb) {struct drm_device *drm = mxsfb->drm;const u32 format = mxsfb->crtc.primary->state->fb->format->format; +u32 bus_format =MEDIA_BUS_FMT_RGB888_1X24 ;u32 ctrl, ctrl1; +if (mxsfb->connector->display_info.num_bus_formats) + bus_format = mxsfb->connector->display_info.bus_formats[0 ]; + +DRM_DEV_DEBUG_DRIVER (drm->dev,"Using bus_format: 0x%08X\n" , + bus_format); + ctrl =CTRL_BYPASS_COUNT |CTRL_MASTER ;/* CTRL1 contains IRQ config and status bits, preserve those. */
@@ -69,40 +79,23 @@ static void mxsfb_set_pixel_fmt(struct mxsfb_drm_private *mxsfb)break ; } -writel (ctrl1, mxsfb->base +LCDC_CTRL1 ); -writel (ctrl, mxsfb->base +LCDC_CTRL ); -} - -static void mxsfb_set_bus_fmt (struct mxsfb_drm_private *mxsfb) -{ -struct drm_device *drm = mxsfb->drm; -u32 bus_format =MEDIA_BUS_FMT_RGB888_1X24 ; -u32 reg; - - reg =readl (mxsfb->base +LCDC_CTRL ); - -if (mxsfb->connector->display_info.num_bus_formats) - bus_format = mxsfb->connector->display_info.bus_formats[0 ]; - -DRM_DEV_DEBUG_DRIVER (drm->dev,"Using bus_format: 0x%08X\n" , - bus_format); - - reg &= ~CTRL_BUS_WIDTH_MASK ;switch (bus_format) {case MEDIA_BUS_FMT_RGB565_1X16 : - reg |=CTRL_BUS_WIDTH_16 ; + ctrl |=CTRL_BUS_WIDTH_16 ;break ;case MEDIA_BUS_FMT_RGB666_1X18 : - reg |=CTRL_BUS_WIDTH_18 ; + ctrl |=CTRL_BUS_WIDTH_18 ;break ;case MEDIA_BUS_FMT_RGB888_1X24 : - reg |=CTRL_BUS_WIDTH_24 ; + ctrl |=CTRL_BUS_WIDTH_24 ;break ;default :dev_err (drm->dev,"Unknown media bus format %d\n" , bus_format);break ; } -writel (reg, mxsfb->base +LCDC_CTRL ); + +writel (ctrl1, mxsfb->base +LCDC_CTRL1 ); +writel (ctrl, mxsfb->base +LCDC_CTRL ); }static void mxsfb_enable_controller (struct mxsfb_drm_private *mxsfb)
@@ -213,7 +206,7 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)/* Clear the FIFOs */ writel (CTRL1_FIFO_CLEAR , mxsfb->base +LCDC_CTRL1 +REG_SET ); -mxsfb_set_pixel_fmt (mxsfb); +mxsfb_set_formats (mxsfb);clk_set_rate (mxsfb->clk, m->crtc_clock *1000 );
@@ -255,8 +248,6 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)writel (vdctrl0, mxsfb->base +LCDC_VDCTRL0 ); -mxsfb_set_bus_fmt (mxsfb); -/* Frame length in lines. */ writel (m->crtc_vtotal, mxsfb->base +LCDC_VDCTRL1 );
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 21/22 drm: mxsfb: Remove unnecessary spaces after tab
In reply to Laurent PinchartThis is a cosmetic change only, no code change is included.
--- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.h +5 -5
@@ -16,11 +16,11 @@struct clk ;struct mxsfb_devdata { -unsigned int transfer_count; -unsigned int cur_buf; -unsigned int next_buf; -unsigned int hs_wdth_mask; -unsigned int hs_wdth_shift; +unsigned int transfer_count; +unsigned int cur_buf; +unsigned int next_buf; +unsigned int hs_wdth_mask; +unsigned int hs_wdth_shift; };struct mxsfb_drm_private {
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v4 22/22 drm: mxsfb: Support the alpha plane
In reply to Laurent PinchartThe LCDIF in the i.MX6SX and i.MX7 have a second plane called the alpha plane. Support it.
---
Changes since v1:
- Split whitespace cleanup to a separate patch
--- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 3 + drivers/gpu/drm/mxsfb/mxsfb_drv.h | 6 +- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 129 +++++++++++++++++++++++++---- drivers/gpu/drm/mxsfb/mxsfb_regs.h | 22 +++++ 4 files changed, 144 insertions(+), 16 deletions(-)
drivers/gpu/drm/mxsfb/mxsfb_drv.c +3 -0
@@ -49,6 +49,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { .next_buf = LCDC_V3_NEXT_BUF, .hs_wdth_mask = 0xff, .hs_wdth_shift = 24, + .has_overlay = false, }, [MXSFB_V4] = { .transfer_count = LCDC_V4_TRANSFER_COUNT,
@@ -56,6 +57,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { .next_buf = LCDC_V4_NEXT_BUF, .hs_wdth_mask = 0x3fff, .hs_wdth_shift = 18, + .has_overlay = false, }, [MXSFB_V6] = { .transfer_count = LCDC_V4_TRANSFER_COUNT,
@@ -63,6 +65,7 @@ static const struct mxsfb_devdata mxsfb_devdata[] = { .next_buf = LCDC_V4_NEXT_BUF, .hs_wdth_mask = 0x3fff, .hs_wdth_shift = 18, + .has_overlay = true, }, };
drivers/gpu/drm/mxsfb/mxsfb_drv.h +5 -1
@@ -21,6 +21,7 @@ struct mxsfb_devdata {unsigned int next_buf;unsigned int hs_wdth_mask;unsigned int hs_wdth_shift; +bool has_overlay; };struct mxsfb_drm_private {
@@ -32,7 +33,10 @@ struct mxsfb_drm_private {struct clk *clk_disp_axi;struct drm_device *drm; -struct drm_plane plane; +struct { +struct drm_plane primary; +struct drm_plane overlay; + } planes;struct drm_crtc crtc;struct drm_encoder encoder;struct drm_connector *connector;
drivers/gpu/drm/mxsfb/mxsfb_kms.c +114 -15
188 lines not on this page · raw message
drivers/gpu/drm/mxsfb/mxsfb_regs.h +22 -0
@@ -27,6 +27,11 @@#define LCDC_VDCTRL4 0xb0#define LCDC_V4_DEBUG0 0x1d0#define LCDC_V3_DEBUG0 0x1f0 +#define LCDC_AS_CTRL 0x210 +#define LCDC_AS_BUF 0x220 +#define LCDC_AS_NEXT_BUF 0x230 +#define LCDC_AS_CLRKEYLOW 0x240 +#define LCDC_AS_CLRKEYHIGH 0x250#define CTRL_SFTRST BIT(31)#define CTRL_CLKGATE BIT(30)
@@ -90,6 +95,23 @@#define DEBUG0_HSYNC BIT(26)#define DEBUG0_VSYNC BIT(25) +#define AS_CTRL_PS_DISABLE BIT(23) +#define AS_CTRL_ALPHA_INVERT BIT(20) +#define AS_CTRL_ALPHA (a) (((a) & 0xff) << 8) +#define AS_CTRL_FORMAT_RGB565 (0xe << 4) +#define AS_CTRL_FORMAT_RGB444 (0xd << 4) +#define AS_CTRL_FORMAT_RGB555 (0xc << 4) +#define AS_CTRL_FORMAT_ARGB4444 (0x9 << 4) +#define AS_CTRL_FORMAT_ARGB1555 (0x8 << 4) +#define AS_CTRL_FORMAT_RGB888 (0x4 << 4) +#define AS_CTRL_FORMAT_ARGB8888 (0x0 << 4) +#define AS_CTRL_ENABLE_COLORKEY BIT(3) +#define AS_CTRL_ALPHA_CTRL_ROP (3 << 1) +#define AS_CTRL_ALPHA_CTRL_MULTIPLY (2 << 1) +#define AS_CTRL_ALPHA_CTRL_OVERRIDE (1 << 1) +#define AS_CTRL_ALPHA_CTRL_EMBEDDED (0 << 1) +#define AS_CTRL_AS_ENABLE BIT(0) +#define MXSFB_MIN_XRES 120#define MXSFB_MIN_YRES 120#define MXSFB_MAX_XRES 0xffff
Signature · 8 lines
Regards, Laurent Pinchart _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 27 lines · Laurent Pinchart
Hello,
This patch series adds i.MX7 support to the mxsfb driver. The eLCDIF instance found in the i.MX7 is backward-compatible with the already supported LCDC v4, but has extended features amongst which the most notable one is a second plane.
The first 10 patches (01/22 to 10/22) contain miscellaneous cleanups and refactoring to prepare for what is to come. Patch 11/22 starts the real work with removal of the DRM simple display pipeline helper, as it doesn't support multiple planes. The next patch (12/22) is an additional cleanup.
Patches 13/22 to 15/22 fix vblank handling that I found to be broken when testing on my device. Patch 16/22 then performs an additional small cleanup, and patch 17/22 starts official support for i.MX7 by mentioning it in
Kconfig.Patch 18/22 adds a new device model for the i.MX6SX and i.MX7 eLCDIF. After three additional cleanups in patches 19/22 to 21/22, patch 22/22 finally adds support for the second plane.
The second plane suffers from an issue whose root cause hasn't been found, which results in the first 64 bytes of the first line to contain data of unknown origin. Help from NXP to diagnose this issue would be useful and appreciated.
Quoted 5 lines
Compared to v3, the series has been rebased on the latest drm-misc, without any other modifications.
The code is based on drm-misc-next and has been tested on an i.MX7D platform with a DPI panel.
Applied the series to drm-misc-next! Thanks Laurent!
--
Stefan
Quoted 26 lines
Laurent Pinchart (22):
drm: mxsfb: Remove fbdev leftovers
drm: mxsfb: Usedrm_panel_bridge
drm: mxsfb: UseBIT()macro to define register bitfields
drm: mxsfb: Remove unused macros frommxsfb_regs.h
drm: mxsfb: Clarify format and bus width configuration
drm: mxsfb: Passmxsfb_drm_privatepointer tomxsfb_reset_block()
drm: mxsfb: UseLCDC_CTRLregister name explicitly
drm: mxsfb: Remove register definitions frommxsfb_crtc.c
drm: mxsfb: Remove unneeded includes
drm: mxsfb: Renamemxsfb_crtc.ctomxsfb_kms.c
drm: mxsfb: Stop using DRM simple display pipeline helper
drm: mxsfb: Move vblank event arm to CRTC .atomic_flush()
drm: mxsfb: Don't touch AXI clock in IRQ context
drm: mxsfb: Enable vblank handling
drm: mxsfb: Removemxsfb_devdataunused fields
drm: mxsfb: Add i.MX7 and i.MX8M to the list of supported SoCs in
Kconfig
drm: mxsfb: Update internal IP version number for i.MX6SX
drm: mxsfb: Drop non-OF support
drm: mxsfb: Turnmxsfb_set_pixel_fmt()into a void function
drm: mxsfb: Mergemxsfb_set_pixel_fmt()andmxsfb_set_bus_fmt()
drm: mxsfb: Remove unnecessary spaces after tab
drm: mxsfb: Support the alpha plane
Quoted 12 lines
drivers/gpu/drm/mxsfb/Kconfig | 8 +- drivers/gpu/drm/mxsfb/Makefile | 2 +- drivers/gpu/drm/mxsfb/mxsfb_crtc.c | 343 ----------------- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 254 ++++--------- drivers/gpu/drm/mxsfb/mxsfb_drv.h | 42 ++- drivers/gpu/drm/mxsfb/mxsfb_kms.c | 571 +++++++++++++++++++++++++++++ drivers/gpu/drm/mxsfb/mxsfb_out.c | 99 ----- drivers/gpu/drm/mxsfb/mxsfb_regs.h | 103 +++--- 8 files changed, 739 insertions(+), 683 deletions(-) delete mode 100644 drivers/gpu/drm/mxsfb/mxsfb_crtc.c create mode 100644 drivers/gpu/drm/mxsfb/mxsfb_kms.c delete mode 100644 drivers/gpu/drm/mxsfb/mxsfb_out.c
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel