drm: Kirin driver cleanups to prep for Kirin960 support
Subsystems (3)
cover drm: Kirin driver cleanups to prep for Kirin960 support
This patchset contains one fix (in the front, so its easier to eventually backport), and a series of changes from YiPing to refactor the kirin drm driver so that it can be used on both kirin620 based devices (like the original HiKey board) as well as kirin960 based devices (like the HiKey960 board).
The full kirin960 drm support is still being refactored, but as this base kirin rework was getting to be substantial, I wanted to send out the first chunk for some initial review, so that the review burden wasn't overwhelming.
The full HiKey960 patch stack can be found here:
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/hikey960-mainline-WIP
Feedback would be greatly appreciated!
thanks
-john
Da Lv (1):
drm: kirin: Fix for hikey620 display offset problem
John Stultz (3):
drm: kirin: Remove HISI_KIRIN_DW_DSI config option
drm: kirin: Remove unreachable return
drm: kirin: Move workqueue to ade_hw_ctx structure
Xu YiPing (21):
drm: kirin: Remove uncessary parameter indirection
drm: kirin: Remove out_format from ade_crtc
drm: kirin: Rename ade_plane to kirin_plane
drm: kirin: Rename ade_crtc to kirin_crtc
drm: kirin: Dynamically allocate the hw_ctx
drm: kirin: Move request irq handle in ade hw ctx alloc
drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to
kirin_drm_drv.h
drm: kirin: Reanme dc_ops to kirin_drm_data
drm: kirin: Move ade crtc/plane help functions to driver_data
drm: kirin: Move channel formats to driver data
drm: kirin: Move mode config function to driver_data
drm: kirin: Move plane number and primay plane in driver data
drm: kirin: Move config max_width and max_height to driver data
drm: kirin: Move drm driver to driver data
drm: kirin: Add register connect helper functions in drm init
drm: kirin: Rename plane_init and crtc_init
drm: kirin: Fix dev->driver_data setting
drm: kirin: Make driver_data variable non-global
drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data
drm: kirin: Pass driver data to crtc init and plane init
drm: kirin: Move ade drm init to kirin drm drv
drivers/gpu/drm/hisilicon/kirin/Kconfig | 10 +- drivers/gpu/drm/hisilicon/kirin/Makefile | 4 +- drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h | 6 + drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 354 ++++++++++-------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 253 ++++++++++++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 48 +++- 6 files changed, 376 insertions(+), 299 deletions(-)
Signature · 1 line
2.7.4
PATCH 1/25 drm: kirin: Fix for hikey620 display offset problem
From: Da Lv <[email protected]>
The original HiKey (620) board has had a long running issue where when using a 1080p montior, the display would occasionally blink and come come back with a horizontal offset (usually also shifting the colors, depending on the value of the offset%4).
After lots of analysis by HiSi developers, they found the issue was due to when running at 1080p, it was possible to hit the device memory bandwidth limits, which could cause the DSI signal to get out of sync.
Unfortunately the DSI logic doesn't have the ability to automatically recover from this situation, but we can get a an LDI underflow interrupt when it happens.
To then correct the issue, when we get an LDI underflow irq, we we can simply suspend and resume the display, which resets the hardware.
Thus, this patch enables the ldi underflow interrupt, and initializes a workqueue that is used to suspend/resume the display to recover. Then when the irq occurs we clear it and schedule the workqueue to reset display engine.
---
v2: Minor cleanups
--- drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h | 6 ++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)
drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +6 -0
@@ -87,6 +87,7 @@#define VSIZE_OFST 20#define LDI_INT_EN 0x741C#define FRAME_END_INT_EN_OFST 1 +#define UNDERFLOW_INT_EN_OFST 2#define LDI_CTRL 0x7420#define BPP_OFST 3#define DATA_GATE_EN BIT(2)
@@ -97,6 +98,11 @@#define LDI_HDMI_DSI_GT 0x7434/* +*BIT_LDI_UNFLOW +*/ +#define BIT_LDI_UNFLOW BIT(2) + +/* * ADE media bus service regs */ #define ADE0_QOSGENERATOR_MODE 0x010C
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +22 -0
@@ -58,6 +58,7 @@ struct ade_hw_ctx {struct ade_crtc {struct drm_crtc base;struct ade_hw_ctx *ctx; +struct work_struct drm_device_wq;bool enable;u32 out_format; };
@@ -176,6 +177,7 @@ static void ade_init(struct ade_hw_ctx *ctx)*/ ade_update_bits (base +ADE_CTRL ,FRM_END_START_OFST ,FRM_END_START_MASK ,REG_EFFECTIVE_IN_ADEEN_FRMEND ); +ade_update_bits (base +LDI_INT_EN ,UNDERFLOW_INT_EN_OFST ,MASK (1 ),1 ); } static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,
@@ -345,6 +347,17 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) MASK(1), 0); } +static void drm_underflow_wq (struct work_struct *work) +{ + struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + drm_device_wq); +struct drm_device *drm_dev = (&acrtc->base)->dev; +struct drm_atomic_state *state; + + state =drm_atomic_helper_suspend (drm_dev); +drm_atomic_helper_resume (drm_dev, state); +} +static irqreturn_t ade_irq_handler (int irq,void *data) {struct ade_crtc *acrtc = data;
@@ -362,6 +375,12 @@ static irqreturn_t ade_irq_handler(int irq, void *data) MASK(1), 1);drm_crtc_handle_vblank (crtc); } +if (status &BIT_LDI_UNFLOW ) { +ade_update_bits (base +LDI_INT_CLR ,UNDERFLOW_INT_EN_OFST , +MASK (1 ),1 ); +DRM_ERROR ("LDI underflow!" ); +schedule_work (&acrtc->drm_device_wq); + }return IRQ_HANDLED ; }
@@ -1038,6 +1057,9 @@ static int ade_drm_init(struct platform_device *pdev)/* vblank irq init */ ret =devm_request_irq (dev->dev, ctx->irq, ade_irq_handler,IRQF_SHARED , dev->driver->name, acrtc); + +INIT_WORK (&acrtc->drm_device_wq, drm_underflow_wq); +if (ret)return ret;
Signature · 1 line
2.7.4
Re: [PATCH 01/25] drm: kirin: Fix for hikey620 display offset problem
Hi John.
Quoted 56 lines · John Stultz
From: Da Lv <[email protected]>
The original HiKey (620) board has had a long running issue where when using a 1080p montior, the display would occasionally blink and come come back with a horizontal offset (usually also shifting the colors, depending on the value of the offset%4).
After lots of analysis by HiSi developers, they found the issue was due to when running at 1080p, it was possible to hit the device memory bandwidth limits, which could cause the DSI signal to get out of sync.
Unfortunately the DSI logic doesn't have the ability to automatically recover from this situation, but we can get a an LDI underflow interrupt when it happens.
To then correct the issue, when we get an LDI underflow irq, we we can simply suspend and resume the display, which resets the hardware.
Thus, this patch enables the ldi underflow interrupt, and initializes a workqueue that is used to suspend/resume the display to recover. Then when the irq occurs we clear it and schedule the workqueue to reset display engine.
Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by Da Lv <[email protected]>Signed-off-by Yidong Lin <[email protected]>[jstultz: Reworded the commit message, checkpatch cleanups]Signed-off-by John Stultz <[email protected]>---
v2: Minor cleanups--- drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h | 6 ++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 22 ++++++++++++++++++++++ 2 files changed, 28 insertions(+)drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +1
-0@@ -87,6 +87,7 @@#define VSIZE_OFST 20#define LDI_INT_EN 0x741C#define FRAME_END_INT_EN_OFST 1 +#define UNDERFLOW_INT_EN_OFST 2#define LDI_CTRL 0x7420#define BPP_OFST 3#define DATA_GATE_EN BIT(2)
drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h line 103
Quoted 6 lines
drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +3
-0@@ -97,6 +98,11 @@#define LDI_HDMI_DSI_GT 0x7434/* +*BIT_LDI_UNFLOW +*/ +#define BIT_LDI_UNFLOW BIT(2)
The definition of this bit looks not like anything surrounding it. And it is not obvious that this bit is part of LDI_MSK_INT. Consider to reformat this so it is obvious where this bit belongs when reading the .h file.
Quoted 44 lines
drivers/gpu/drm/hisilicon/kirin/kirin_ade_reg.h +2
-0+ +/* * ADE media bus service regs */ #define ADE0_QOSGENERATOR_MODE 0x010Cdrivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +13
-0@@ -58,6 +58,7 @@ struct ade_hw_ctx {struct ade_crtc {struct drm_crtc base;struct ade_hw_ctx *ctx; +struct work_struct drm_device_wq;bool enable;u32 out_format; };@@ -176,6 +177,7 @@ static void ade_init(struct ade_hw_ctx *ctx)*/ ade_update_bits (base +ADE_CTRL ,FRM_END_START_OFST ,FRM_END_START_MASK ,REG_EFFECTIVE_IN_ADEEN_FRMEND ); +ade_update_bits (base +LDI_INT_EN ,UNDERFLOW_INT_EN_OFST ,MASK (1 ),1 ); } static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,@@ -345,6 +347,17 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc) MASK(1), 0); } +static void drm_underflow_wq (struct work_struct *work) +{ + struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + drm_device_wq); +struct drm_device *drm_dev = (&acrtc->base)->dev; +struct drm_atomic_state *state; + + state =drm_atomic_helper_suspend (drm_dev); +drm_atomic_helper_resume (drm_dev, state); +} +static irqreturn_t ade_irq_handler (int irq,void *data) {struct ade_crtc *acrtc = data;
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static irqreturn_t ade_irq_handler(int irq, void *data) · line 380
Quoted 6 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3
-0@@ -362,6 +375,12 @@ static irqreturn_t ade_irq_handler(int irq, void *data) MASK(1), 1);drm_crtc_handle_vblank (crtc); } +if (status &BIT_LDI_UNFLOW ) { +ade_update_bits (base +LDI_INT_CLR ,UNDERFLOW_INT_EN_OFST , +MASK (1 ),1 );
A general comment here.
It is not obvious from reading this code that the code will clear LDI_UNFLOW bit in the LDI_INT_CLR register.
I think this driver could see readability improvements if converted to use regmaps.
Sam
PATCH 2/25 drm: kirin: Remove HISI_KIRIN_DW_DSI config option
In reply to John StultzThe CONFIG_HISI_KIRIN_DW_DSI option is only used w/ kirin driver, so cut out the middleman and condense the config logic down.
--- drivers/gpu/drm/hisilicon/kirin/Kconfig | 10 +--------- drivers/gpu/drm/hisilicon/kirin/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-)
drivers/gpu/drm/hisilicon/kirin/Kconfig +1 -9
@@ -4,16 +4,8 @@ config DRM_HISI_KIRIN select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER - select HISI_KIRIN_DW_DSI + select DRM_MIPI_DSI help Choose this option if you have a hisilicon Kirin chipsets(hi6220). If M is selected the module will be called kirin-drm. -config HISI_KIRIN_DW_DSI - tristate "HiSilicon Kirin specific extensions for Synopsys DW MIPI DSI" - depends on DRM_HISI_KIRIN - select DRM_MIPI_DSI - help - This selects support for HiSilicon Kirin SoC specific extensions for - the Synopsys DesignWare DSI driver. If you want to enable MIPI DSI on - hi6220 based SoC, you should selet this option.
drivers/gpu/drm/hisilicon/kirin/Makefile +2 -2
@@ -1,6 +1,6 @@ kirin-drm-y := kirin_drm_drv.o \ - kirin_drm_ade.o + kirin_drm_ade.o \ + dw_drm_dsi.o obj-$(CONFIG_DRM_HISI_KIRIN) += kirin-drm.o -obj-$(CONFIG_HISI_KIRIN_DW_DSI) += dw_drm_dsi.o
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/25] drm: kirin: Remove HISI_KIRIN_DW_DSI config option
Hi John.
Quoted 29 lines · John Stultz
The
CONFIG_HISI_KIRIN_DW_DSIoption is only used w/ kirin driver, so cut out the middleman and condense the config logic down.Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/Kconfig | 10 +--------- drivers/gpu/drm/hisilicon/kirin/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-)drivers/gpu/drm/hisilicon/kirin/Kconfig +1
-1@@ -4,16 +4,8 @@ config DRM_HISI_KIRIN select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER - select HISI_KIRIN_DW_DSI + select DRM_MIPI_DSI help Choose this option if you have a hisilicon Kirin chipsets(hi6220).
drivers/gpu/drm/hisilicon/kirin/Kconfig config DRM_HISI_KIRIN · line 19
Quoted 10 lines
drivers/gpu/drm/hisilicon/kirin/Kconfig +0
-8If M is selected the module will be called kirin-drm. -config HISI_KIRIN_DW_DSI - tristate "HiSilicon Kirin specific extensions for Synopsys DW MIPI DSI" - depends on DRM_HISI_KIRIN - select DRM_MIPI_DSI - help - This selects support for HiSilicon Kirin SoC specific extensions for - the Synopsys DesignWare DSI driver. If you want to enable MIPI DSI on - hi6220 based SoC, you should selet this option.
Nice simplification. We are now down to two very small Kconfig files. Consider to merge them into one Kconfig file in the top-level dir.
Sam
Quoted 20 lines
drivers/gpu/drm/hisilicon/kirin/Makefile +2
-2@@ -1,6 +1,6 @@ kirin-drm-y := kirin_drm_drv.o \ - kirin_drm_ade.o + kirin_drm_ade.o \ + dw_drm_dsi.o obj-$(CONFIG_DRM_HISI_KIRIN) += kirin-drm.o -obj-$(CONFIG_HISI_KIRIN_DW_DSI) += dw_drm_dsi.oSignature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 02/25] drm: kirin: Remove HISI_KIRIN_DW_DSI config option
Quoted 35 lines · Sam Ravnborg
Hi John.
Quoted 31 lines · John Stultz
The
CONFIG_HISI_KIRIN_DW_DSIoption is only used w/ kirin driver, so cut out the middleman and condense the config logic down.Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/Kconfig | 10 +--------- drivers/gpu/drm/hisilicon/kirin/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 11 deletions(-)drivers/gpu/drm/hisilicon/kirin/Kconfig +1
-1@@ -4,16 +4,8 @@ config DRM_HISI_KIRIN select DRM_KMS_HELPER select DRM_GEM_CMA_HELPER select DRM_KMS_CMA_HELPER - select HISI_KIRIN_DW_DSI + select DRM_MIPI_DSI help Choose this option if you have a hisilicon Kirin chipsets(hi6220). If M is selected the module will be called kirin-drm.
Quoted 12 lines
drivers/gpu/drm/hisilicon/kirin/Kconfig config DRM_HISI_KIRIN · line 19
Quoted 8 lines
drivers/gpu/drm/hisilicon/kirin/Kconfig +0
-8-config HISI_KIRIN_DW_DSI - tristate "HiSilicon Kirin specific extensions for Synopsys DW MIPI DSI" - depends on DRM_HISI_KIRIN - select DRM_MIPI_DSI - help - This selects support for HiSilicon Kirin SoC specific extensions for - the Synopsys DesignWare DSI driver. If you want to enable MIPI DSI on - hi6220 based SoC, you should selet this option.Nice simplification. We are now down to two very small
Kconfigfiles. Consider to merge them into oneKconfigfile in the top-level dir.
Part of this cleanup is so that we can add another device option in a later commit (though not in this series), so unless folks are generally wanting to consolidate Kconfigs into the top level, it may be premature to do so now only to later undo it when there are more kirin specific options. I'm fine with whichever, I just want to make sure that's clear.
thanks
-john
Re: [PATCH 02/25] drm: kirin: Remove HISI_KIRIN_DW_DSI config option
Hi John.
Quoted 11 lines
Quoted 4 lines
Nice simplification. We are now down to two very small
Kconfigfiles. Consider to merge them into oneKconfigfile in the top-level dir.Part of this cleanup is so that we can add another device option in a later commit (though not in this series), so unless folks are generally wanting to consolidate Kconfigs into the top level, it may be premature to do so now only to later undo it when there are more kirin specific options. I'm fine with whichever, I just want to make sure that's clear.
I am just passing my reflections forward in a mail as I read the patches.
Unless there is something that resemble a real bug then always do what you consider best. In this case keep the two Kconfig files.
Sam
PATCH 3/25 drm: kirin: Remove unreachable return
In reply to John StultzThe 'return 0' in kirin_drm_platform_probe() is unreachable code, so remove it.
Cc: Xinliang Liu <[email protected]>
Cc: Rongrong Zou <[email protected]>
Cc: Xinwei Kong <[email protected]>
Cc: Chen Feng <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: dri-devel <[email protected]>
Suggested by: Xu YiPing <[email protected]>
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +0 -2
@@ -212,8 +212,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)of_node_put (remote);return component_master_add_with_match (dev, &kirin_drm_ops, match); - -return 0 ; }static int kirin_drm_platform_remove (struct platform_device *pdev)
Signature · 1 line
2.7.4
PATCH 4/25 drm: kirin: Remove uncessary parameter indirection
In reply to John StultzFrom: Xu YiPing <[email protected]>
In a few functions, we pass in a struct ade_crtc, which we only use to get to the underlying struct ade_hw_ctx.
Thus this patch refactors the functions to just take the struct ade_hw_ctx directly.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +5 -7
@@ -210,11 +210,10 @@ static void ade_set_pix_clk(struct ade_hw_ctx *ctx, adj_mode->clock =clk_get_rate (ctx->ade_pix_clk) /1000 ; } -static void ade_ldi_set_mode (struct ade_crtc *acrtc, +static void ade_ldi_set_mode (struct ade_hw_ctx *ctx,struct drm_display_mode *mode,struct drm_display_mode *adj_mode) { -struct ade_hw_ctx *ctx = acrtc->ctx;void __iomem *base = ctx->base;u32 width = mode->hdisplay;u32 height = mode->vdisplay;
@@ -301,9 +300,8 @@ static void ade_power_down(struct ade_hw_ctx *ctx) ctx->power_on = false; } -static void ade_set_medianoc_qos (struct ade_crtc *acrtc) +static void ade_set_medianoc_qos (struct ade_hw_ctx *ctx) { -struct ade_hw_ctx *ctx = acrtc->ctx;struct regmap *map = ctx->noc_regmap; regmap_update_bits(map, ADE0_QOSGENERATOR_MODE,
@@ -515,7 +513,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc,return ; } -ade_set_medianoc_qos (acrtc); +ade_set_medianoc_qos (ctx);ade_display_enable (acrtc);ade_dump_regs (ctx->base);drm_crtc_vblank_on (crtc);
@@ -545,7 +543,7 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)if (!ctx->power_on) (void )ade_power_up (ctx); -ade_ldi_set_mode (acrtc, mode, adj_mode); +ade_ldi_set_mode (ctx, mode, adj_mode); } static void ade_crtc_atomic_begin(struct drm_crtc *crtc,
@@ -558,7 +556,7 @@ static void ade_crtc_atomic_begin(struct drm_crtc *crtc,if (!ctx->power_on) (void )ade_power_up (ctx); -ade_ldi_set_mode (acrtc, mode, adj_mode); +ade_ldi_set_mode (ctx, mode, adj_mode); } static void ade_crtc_atomic_flush(struct drm_crtc *crtc,
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/25 drm: kirin: Remove out_format from ade_crtc
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch removes the out_format field in the struct ade_crtc, which was only ever set to LDI_OUT_RGB_888.
Thus this patch removes the field and instead directly uses LDI_OUT_RGB_888.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +3 -6
@@ -60,7 +60,6 @@ struct ade_crtc {struct ade_hw_ctx *ctx;struct work_struct drm_device_wq;bool enable; -u32 out_format; };struct ade_plane {
@@ -383,11 +382,10 @@ static irqreturn_t ade_irq_handler(int irq, void *data)return IRQ_HANDLED ; } -static void ade_display_enable (struct ade_crtc *acrtc) +static void ade_display_enable (struct ade_hw_ctx *ctx) { -struct ade_hw_ctx *ctx = acrtc->ctx;void __iomem *base = ctx->base; -u32 out_fmt = acrtc->out_format; +u32 out_fmt =LDI_OUT_RGB_888 ;/* enable output overlay compositor */ writel (ADE_ENABLE , base +ADE_OVLYX_CTL (OUT_OVLY ));
@@ -514,7 +512,7 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc, }ade_set_medianoc_qos (ctx); -ade_display_enable (acrtc); +ade_display_enable (ctx);ade_dump_regs (ctx->base);drm_crtc_vblank_on (crtc); acrtc->enable = true;
@@ -1024,7 +1022,6 @@ static int ade_drm_init(struct platform_device *pdev) ctx = &ade->ctx; acrtc = &ade->acrtc; acrtc->ctx = ctx; - acrtc->out_format =LDI_OUT_RGB_888 ; ret =ade_dts_parse (pdev, ctx);if (ret)
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 6/25 drm: kirin: Rename ade_plane to kirin_plane
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct ade_plane to kirin_plane.
The struct kirin_plane will later used by both kirin620 and future kirin960 driver, and will be moved to a common kirin_drm_drv.h in a future patch
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 57 +++++++++++++------------ 1 file changed, 29 insertions(+), 28 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +29 -28
@@ -41,8 +41,9 @@#define to_ade_crtc (crtc) \ container_of(crtc, struct ade_crtc, base) -#define to_ade_plane (plane) \ - container_of(plane, struct ade_plane, base) +#define to_kirin_plane (plane) \ + container_of(plane, struct kirin_plane, base) +struct ade_hw_ctx {void __iomem *base;
@@ -62,15 +63,15 @@ struct ade_crtc {bool enable; }; -struct ade_plane { +struct kirin_plane {struct drm_plane base; -void *ctx; -u8 ch;/* channel */ +void *hw_ctx; +u32 ch; };struct ade_data {struct ade_crtc acrtc; -struct ade_plane aplane[ADE_CH_NUM ]; +struct kirin_plane planes[ADE_CH_NUM ];struct ade_hw_ctx ctx; };
@@ -795,16 +796,16 @@ static void ade_compositor_routing_disable(void __iomem *base, u32 ch)/* * Typicaly, a channel looks like: DMA-->clip-->scale-->ctrans-->compositor */ -static void ade_update_channel (struct ade_plane *aplane, +static void ade_update_channel (struct kirin_plane *kplane,struct drm_framebuffer *fb,int crtc_x,int crtc_y,unsigned int crtc_w,unsigned int crtc_h,u32 src_x,u32 src_y,u32 src_w,u32 src_h) { -struct ade_hw_ctx *ctx = aplane->ctx; +struct ade_hw_ctx *ctx = kplane->hw_ctx;void __iomem *base = ctx->base;u32 fmt =ade_get_format (fb->format->format); -u32 ch = aplane->ch; +u32 ch = kplane->ch;u32 in_w;u32 in_h;
@@ -828,11 +829,11 @@ static void ade_update_channel(struct ade_plane *aplane,ade_compositor_routing_set (base, ch, crtc_x, crtc_y, in_w, in_h, fmt); } -static void ade_disable_channel (struct ade_plane *aplane) +static void ade_disable_channel (struct kirin_plane *kplane) { -struct ade_hw_ctx *ctx = aplane->ctx; +struct ade_hw_ctx *ctx = kplane->hw_ctx;void __iomem *base = ctx->base; -u32 ch = aplane->ch; +u32 ch = kplane->ch;DRM_DEBUG_DRIVER ("disable channel%d\n" , ch +1 );
@@ -894,10 +895,10 @@ static int ade_plane_atomic_check(struct drm_plane *plane,static void ade_plane_atomic_update (struct drm_plane *plane,struct drm_plane_state *old_state) { -struct drm_plane_state *state = plane->state; -struct ade_plane *aplane =to_ade_plane (plane); +struct drm_plane_state *state = plane->state; +struct kirin_plane *kplane =to_kirin_plane (plane); -ade_update_channel (aplane, state->fb, state->crtc_x, state->crtc_y, +ade_update_channel (kplane, state->fb, state->crtc_x, state->crtc_y, state->crtc_w, state->crtc_h, state->src_x >>16 , state->src_y >>16 , state->src_w >>16 , state->src_h >>16 );
@@ -906,9 +907,9 @@ static void ade_plane_atomic_update(struct drm_plane *plane,static void ade_plane_atomic_disable (struct drm_plane *plane,struct drm_plane_state *old_state) { -struct ade_plane *aplane =to_ade_plane (plane); +struct kirin_plane *kplane =to_kirin_plane (plane); -ade_disable_channel (aplane); +ade_disable_channel (kplane); }static const struct drm_plane_helper_funcs ade_plane_helper_funcs = {
@@ -926,7 +927,7 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int ade_plane_init (struct drm_device *dev,struct ade_plane *aplane, +static int ade_plane_init (struct drm_device *dev,struct kirin_plane *kplane,enum drm_plane_type type) {const u32 *fmts;
@@ -934,18 +935,18 @@ static int ade_plane_init(struct drm_device *dev, struct ade_plane *aplane,int ret =0 ;/* get properties */ - fmts_cnt =ade_get_channel_formats (aplane->ch, &fmts); + fmts_cnt =ade_get_channel_formats (kplane->ch, &fmts);if (ret)return ret; - ret =drm_universal_plane_init (dev, &aplane->base,1 , &ade_plane_funcs, + ret =drm_universal_plane_init (dev, &kplane->base,1 , &ade_plane_funcs, fmts, fmts_cnt,NULL , type,NULL );if (ret) { -DRM_ERROR ("fail to init plane, ch=%d\n" , aplane->ch); +DRM_ERROR ("fail to init plane, ch=%d\n" , kplane->ch);return ret; } -drm_plane_helper_add (&aplane->base, &ade_plane_helper_funcs); +drm_plane_helper_add (&kplane->base, &ade_plane_helper_funcs);return 0 ; }
@@ -1007,7 +1008,7 @@ static int ade_drm_init(struct platform_device *pdev)struct ade_data *ade;struct ade_hw_ctx *ctx;struct ade_crtc *acrtc; -struct ade_plane *aplane; +struct kirin_plane *kplane;enum drm_plane_type type;int ret;int i;
@@ -1033,19 +1034,19 @@ static int ade_drm_init(struct platform_device *pdev)* need to do. */ for (i =0 ; i <ADE_CH_NUM ; i++) { - aplane = &ade->aplane[i]; - aplane->ch = i; - aplane->ctx = ctx; + kplane = &ade->planes[i]; + kplane->ch = i; + kplane->hw_ctx = ctx; type = i ==PRIMARY_CH ?DRM_PLANE_TYPE_PRIMARY :DRM_PLANE_TYPE_OVERLAY ; - ret =ade_plane_init (dev, aplane, type); + ret =ade_plane_init (dev, kplane, type);if (ret)return ret; }/* crtc init */ - ret =ade_crtc_init (dev, &acrtc->base, &ade->aplane[PRIMARY_CH ].base); + ret =ade_crtc_init (dev, &acrtc->base, &ade->planes[PRIMARY_CH ].base);if (ret)return ret;
Signature · 1 line
2.7.4
PATCH 7/25 drm: kirin: Rename ade_crtc to kirin_crtc
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct ade_crtc to kirin_crtc.
The struct kirin_crtc will later used by both kirin620 and future kirin960 driver, and will be moved to a common kirin_drm_drv.h in a future patch
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 74 ++++++++++++------------- 1 file changed, 37 insertions(+), 37 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +37 -37
@@ -38,8 +38,8 @@#define OUT_OVLY ADE_OVLY2/* output overlay compositor */ #define ADE_DEBUG 1 -#define to_ade_crtc (crtc) \ - container_of(crtc, struct ade_crtc, base) +#define to_kirin_crtc (crtc) \ + container_of(crtc, struct kirin_crtc, base)#define to_kirin_plane (plane) \ container_of(plane, struct kirin_plane, base)
@@ -56,9 +56,9 @@ struct ade_hw_ctx {int irq; }; -struct ade_crtc { +struct kirin_crtc {struct drm_crtc base; -struct ade_hw_ctx *ctx; +void *hw_ctx;struct work_struct drm_device_wq;bool enable; };
@@ -70,7 +70,7 @@ struct kirin_plane { };struct ade_data { -struct ade_crtc acrtc; +struct kirin_crtc crtc;struct kirin_plane planes[ADE_CH_NUM ];struct ade_hw_ctx ctx; };
@@ -184,8 +184,8 @@ static bool ade_crtc_mode_fixup(struct drm_crtc *crtc,const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { - struct ade_crtc *acrtc = to_ade_crtc(crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; + struct kirin_crtc *kcrtc = to_kirin_crtc(crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx; adjusted_mode->clock =clk_round_rate (ctx->ade_pix_clk, mode->clock *1000 ) /1000 ;
@@ -317,8 +317,8 @@ static void ade_set_medianoc_qos(struct ade_hw_ctx *ctx)static int ade_crtc_enable_vblank (struct drm_crtc *crtc) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx;void __iomem *base = ctx->base;if (!ctx->power_on)
@@ -332,8 +332,8 @@ static int ade_crtc_enable_vblank(struct drm_crtc *crtc)static void ade_crtc_disable_vblank (struct drm_crtc *crtc) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx;void __iomem *base = ctx->base;if (!ctx->power_on) {
@@ -347,7 +347,7 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc)static void drm_underflow_wq (struct work_struct *work) { - struct ade_crtc *acrtc = container_of(work, struct ade_crtc, + struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, drm_device_wq);struct drm_device *drm_dev = (&acrtc->base)->dev;struct drm_atomic_state *state;
@@ -358,9 +358,9 @@ static void drm_underflow_wq(struct work_struct *work)static irqreturn_t ade_irq_handler (int irq,void *data) { -struct ade_crtc *acrtc = data; -struct ade_hw_ctx *ctx = acrtc->ctx; -struct drm_crtc *crtc = &acrtc->base; +struct kirin_crtc *kcrtc = data; +struct ade_hw_ctx *ctx = kcrtc->hw_ctx; +struct drm_crtc *crtc = &kcrtc->base;void __iomem *base = ctx->base;u32 status;
@@ -377,7 +377,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data)ade_update_bits (base +LDI_INT_CLR ,UNDERFLOW_INT_EN_OFST ,MASK (1 ),1 );DRM_ERROR ("LDI underflow!" ); -schedule_work (&acrtc->drm_device_wq); +schedule_work (&kcrtc->drm_device_wq); }return IRQ_HANDLED ;
@@ -499,11 +499,11 @@ static void ade_dump_regs(void __iomem *base) { }static void ade_crtc_atomic_enable (struct drm_crtc *crtc,struct drm_crtc_state *old_state) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx;int ret; -if (acrtc->enable) +if (kcrtc->enable)return ;if (!ctx->power_on) {
@@ -516,27 +516,27 @@ static void ade_crtc_atomic_enable(struct drm_crtc *crtc,ade_display_enable (ctx);ade_dump_regs (ctx->base);drm_crtc_vblank_on (crtc); - acrtc->enable = true; + kcrtc->enable = true; }static void ade_crtc_atomic_disable (struct drm_crtc *crtc,struct drm_crtc_state *old_state) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx; -if (!acrtc->enable) +if (!kcrtc->enable)return ;drm_crtc_vblank_off (crtc);ade_power_down (ctx); - acrtc->enable = false; + kcrtc->enable = false; }static void ade_crtc_mode_set_nofb (struct drm_crtc *crtc) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx;struct drm_display_mode *mode = &crtc->state->mode;struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode;
@@ -548,8 +548,8 @@ static void ade_crtc_mode_set_nofb(struct drm_crtc *crtc)static void ade_crtc_atomic_begin (struct drm_crtc *crtc,struct drm_crtc_state *old_state) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx;struct drm_display_mode *mode = &crtc->state->mode;struct drm_display_mode *adj_mode = &crtc->state->adjusted_mode;
@@ -562,13 +562,13 @@ static void ade_crtc_atomic_flush(struct drm_crtc *crtc, struct drm_crtc_state *old_state) { -struct ade_crtc *acrtc =to_ade_crtc (crtc); -struct ade_hw_ctx *ctx = acrtc->ctx; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc); +struct ade_hw_ctx *ctx = kcrtc->hw_ctx;struct drm_pending_vblank_event *event = crtc->state->event;void __iomem *base = ctx->base;/* only crtc is enabled regs take effect */ -if (acrtc->enable) { +if (kcrtc->enable) {ade_dump_regs (base);/* flush ade registers */ writel (ADE_ENABLE , base +ADE_EN );
@@ -1007,7 +1007,7 @@ static int ade_drm_init(struct platform_device *pdev)struct drm_device *dev =platform_get_drvdata (pdev);struct ade_data *ade;struct ade_hw_ctx *ctx; -struct ade_crtc *acrtc; +struct kirin_crtc *kcrtc;struct kirin_plane *kplane;enum drm_plane_type type;int ret;
@@ -1021,8 +1021,8 @@ static int ade_drm_init(struct platform_device *pdev)platform_set_drvdata (pdev, ade); ctx = &ade->ctx; - acrtc = &ade->acrtc; - acrtc->ctx = ctx; + kcrtc = &ade->crtc; + kcrtc->hw_ctx = ctx; ret =ade_dts_parse (pdev, ctx);if (ret)
@@ -1046,15 +1046,15 @@ static int ade_drm_init(struct platform_device *pdev) }/* crtc init */ - ret =ade_crtc_init (dev, &acrtc->base, &ade->planes[PRIMARY_CH ].base); + ret =ade_crtc_init (dev, &kcrtc->base, &ade->planes[PRIMARY_CH ].base);if (ret)return ret;/* vblank irq init */ ret =devm_request_irq (dev->dev, ctx->irq, ade_irq_handler, -IRQF_SHARED , dev->driver->name, acrtc); +IRQF_SHARED , dev->driver->name, kcrtc); -INIT_WORK (&acrtc->drm_device_wq, drm_underflow_wq); +INIT_WORK (&kcrtc->drm_device_wq, drm_underflow_wq);if (ret)return ret;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 8/25 drm: kirin: Dynamically allocate the hw_ctx
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch modifies the initialization function to dynamically allocate the ade_hw_ctx structure previously kept as part of struct ade_data.
This is done so that later we can have the hw_ctx point to hardware revision specific ctx structures.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 39 +++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +24 -15
@@ -72,7 +72,7 @@ struct kirin_plane {struct ade_data {struct kirin_crtc crtc;struct kirin_plane planes[ADE_CH_NUM ]; -struct ade_hw_ctx ctx; +struct ade_hw_ctx *hw_ctx; };/* ade-format info: */
@@ -951,55 +951,62 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane,return 0 ; } -static int ade_dts_parse (struct platform_device *pdev,struct ade_hw_ctx *ctx) +static void *ade_hw_ctx_alloc (struct platform_device *pdev) {struct resource *res;struct device *dev = &pdev->dev;struct device_node *np = pdev->dev.of_node; +struct ade_hw_ctx *ctx =NULL ; + + ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL ); +if (!ctx) { +DRM_ERROR ("failed to alloc ade_hw_ctx\n" ); +return ERR_PTR (-ENOMEM ); + } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); ctx->base =devm_ioremap_resource (dev, res);if (IS_ERR (ctx->base)) {DRM_ERROR ("failed to remap ade io base\n" ); -return PTR_ERR (ctx->base); +return ERR_PTR (-EIO ); } ctx->reset =devm_reset_control_get (dev,NULL );if (IS_ERR (ctx->reset)) -return PTR_ERR (ctx->reset); +return ERR_PTR (-ENODEV ); ctx->noc_regmap =syscon_regmap_lookup_by_phandle (np,"hisilicon,noc-syscon" );if (IS_ERR (ctx->noc_regmap)) {DRM_ERROR ("failed to get noc regmap\n" ); -return PTR_ERR (ctx->noc_regmap); +return ERR_PTR (-ENODEV ); } ctx->irq =platform_get_irq (pdev,0 );if (ctx->irq <0 ) {DRM_ERROR ("failed to get irq\n" ); -return -ENODEV ; +return ERR_PTR (-ENODEV ); } ctx->ade_core_clk =devm_clk_get (dev,"clk_ade_core" );if (IS_ERR (ctx->ade_core_clk)) {DRM_ERROR ("failed to parse clk ADE_CORE\n" ); -return PTR_ERR (ctx->ade_core_clk); +return ERR_PTR (-ENODEV ); } ctx->media_noc_clk =devm_clk_get (dev,"clk_codec_jpeg" );if (IS_ERR (ctx->media_noc_clk)) {DRM_ERROR ("failed to parse clk CODEC_JPEG\n" ); -return PTR_ERR (ctx->media_noc_clk); +return ERR_PTR (-ENODEV ); } ctx->ade_pix_clk =devm_clk_get (dev,"clk_ade_pix" );if (IS_ERR (ctx->ade_pix_clk)) {DRM_ERROR ("failed to parse clk ADE_PIX\n" ); -return PTR_ERR (ctx->ade_pix_clk); +return ERR_PTR (-ENODEV ); } -return 0 ; +return ctx; }static int ade_drm_init (struct platform_device *pdev)
@@ -1020,14 +1027,16 @@ static int ade_drm_init(struct platform_device *pdev) }platform_set_drvdata (pdev, ade); - ctx = &ade->ctx; + ctx =ade_hw_ctx_alloc (pdev); +if (IS_ERR (ctx)) { +DRM_ERROR ("failed to initialize kirin_priv hw ctx\n" ); +return -EINVAL ; + } + ade->hw_ctx = ctx; + kcrtc = &ade->crtc; kcrtc->hw_ctx = ctx; - ret =ade_dts_parse (pdev, ctx); -if (ret) -return ret; -/* * plane init * TODO: Now only support primary plane, overlay planes
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 9/25 drm: kirin: Move request irq handle in ade hw ctx alloc
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch modifies the initialization routines so the devm_request_irq() function is called as part of the allocation function.
This will be needed in the future when we will have different allocation functions to allocate hardware specific hw_ctx structures, which will setup the vblank irq differently.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +17 -12
@@ -54,6 +54,8 @@ struct ade_hw_ctx {struct reset_control *reset;bool power_on;int irq; + +struct drm_crtc *crtc; };struct kirin_crtc {
@@ -358,9 +360,9 @@ static void drm_underflow_wq(struct work_struct *work)static irqreturn_t ade_irq_handler (int irq,void *data) { -struct kirin_crtc *kcrtc = data; -struct ade_hw_ctx *ctx = kcrtc->hw_ctx; -struct drm_crtc *crtc = &kcrtc->base; +struct ade_hw_ctx *ctx = data; +struct drm_crtc *crtc = ctx->crtc; +struct kirin_crtc *kcrtc =to_kirin_crtc (crtc);void __iomem *base = ctx->base;u32 status;
@@ -951,12 +953,14 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane,return 0 ; } -static void *ade_hw_ctx_alloc (struct platform_device *pdev) +static void *ade_hw_ctx_alloc (struct platform_device *pdev, +struct drm_crtc *crtc) {struct resource *res;struct device *dev = &pdev->dev;struct device_node *np = pdev->dev.of_node;struct ade_hw_ctx *ctx =NULL ; +int ret; ctx =devm_kzalloc (dev,sizeof (*ctx),GFP_KERNEL );if (!ctx) {
@@ -1006,6 +1010,14 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev)return ERR_PTR (-ENODEV ); } +/* vblank irq init */ + ret =devm_request_irq (dev, ctx->irq, ade_irq_handler, +IRQF_SHARED , dev->driver->name, ctx); +if (ret) +return ERR_PTR (-EIO ); + + ctx->crtc = crtc; +return ctx; }
@@ -1027,7 +1039,7 @@ static int ade_drm_init(struct platform_device *pdev) }platform_set_drvdata (pdev, ade); - ctx =ade_hw_ctx_alloc (pdev); + ctx =ade_hw_ctx_alloc (pdev, &ade->crtc.base);if (IS_ERR (ctx)) {DRM_ERROR ("failed to initialize kirin_priv hw ctx\n" );return -EINVAL ;
@@ -1059,15 +1071,8 @@ static int ade_drm_init(struct platform_device *pdev)if (ret)return ret; -/* vblank irq init */ - ret =devm_request_irq (dev->dev, ctx->irq, ade_irq_handler, -IRQF_SHARED , dev->driver->name, kcrtc); -INIT_WORK (&kcrtc->drm_device_wq, drm_underflow_wq); -if (ret) -return ret; -return 0 ; }
Signature · 1 line
2.7.4
PATCH 10/25 drm: kirin: Move workqueue to ade_hw_ctx structure
In reply to John StultzThe workqueue used to reset the display when we hit an LDI underflow error is ADE specific, so since this patch series works to make the kirin_crtc structure more generic, move the workqueue to the ade_hw_ctx structure instead.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +5 -7
@@ -52,6 +52,7 @@ struct ade_hw_ctx {struct clk *media_noc_clk;struct clk *ade_pix_clk;struct reset_control *reset; +struct work_struct drm_device_wq;bool power_on;int irq;
@@ -61,7 +62,6 @@ struct ade_hw_ctx {struct kirin_crtc {struct drm_crtc base;void *hw_ctx; -struct work_struct drm_device_wq;bool enable; };
@@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc)static void drm_underflow_wq (struct work_struct *work) { - struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, + struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx, drm_device_wq); -struct drm_device *drm_dev = (&acrtc->base)->dev; +struct drm_device *drm_dev = ctx->crtc->dev;struct drm_atomic_state *state; state =drm_atomic_helper_suspend (drm_dev);
@@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data) {struct ade_hw_ctx *ctx = data;struct drm_crtc *crtc = ctx->crtc; -struct kirin_crtc *kcrtc =to_kirin_crtc (crtc);void __iomem *base = ctx->base;u32 status;
@@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data)ade_update_bits (base +LDI_INT_CLR ,UNDERFLOW_INT_EN_OFST ,MASK (1 ),1 );DRM_ERROR ("LDI underflow!" ); -schedule_work (&kcrtc->drm_device_wq); +schedule_work (&ctx->drm_device_wq); }return IRQ_HANDLED ;
@@ -1016,6 +1015,7 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev,if (ret)return ERR_PTR (-EIO ); +INIT_WORK (&ctx->drm_device_wq, drm_underflow_wq); ctx->crtc = crtc;return ctx;
@@ -1071,8 +1071,6 @@ static int ade_drm_init(struct platform_device *pdev)if (ret)return ret; -INIT_WORK (&kcrtc->drm_device_wq, drm_underflow_wq); -return 0 ; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure
Hi John.
Quoted 22 lines · John Stultz
The workqueue used to reset the display when we hit an LDI underflow error is ADE specific, so since this patch series works to make the
kirin_crtcstructure more generic, move the workqueue to theade_hw_ctxstructure instead.Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-0
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c struct ade_hw_ctx { · line 55
Quoted 4 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-0@@ -52,6 +52,7 @@ struct ade_hw_ctx {struct clk *media_noc_clk;struct clk *ade_pix_clk;struct reset_control *reset; +struct work_struct drm_device_wq;
The comment probarly belongs to 01/25...
The name drm_device_wq is not at all descriptive.
Consider something like: display_reset_wq
Then when the workqueue is started it is much more obvious what it does.
Quoted 32 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2
-4bool power_on;int irq;@@ -61,7 +62,6 @@ struct ade_hw_ctx {struct kirin_crtc {struct drm_crtc base;void *hw_ctx; -struct work_struct drm_device_wq;bool enable; };@@ -349,9 +349,9 @@ static void ade_crtc_disable_vblank(struct drm_crtc *crtc)static void drm_underflow_wq (struct work_struct *work) { - struct kirin_crtc *acrtc = container_of(work, struct kirin_crtc, + struct ade_hw_ctx *ctx = container_of(work, struct ade_hw_ctx, drm_device_wq); -struct drm_device *drm_dev = (&acrtc->base)->dev; +struct drm_device *drm_dev = ctx->crtc->dev;struct drm_atomic_state *state; state =drm_atomic_helper_suspend (drm_dev);@@ -362,7 +362,6 @@ static irqreturn_t ade_irq_handler(int irq, void *data) {struct ade_hw_ctx *ctx = data;struct drm_crtc *crtc = ctx->crtc; -struct kirin_crtc *kcrtc =to_kirin_crtc (crtc);void __iomem *base = ctx->base;u32 status;
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static irqreturn_t ade_irq_handler(int irq, void *data) · line 382
Quoted 4 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-1@@ -379,7 +378,7 @@ static irqreturn_t ade_irq_handler(int irq, void *data)ade_update_bits (base +LDI_INT_CLR ,UNDERFLOW_INT_EN_OFST ,MASK (1 ),1 );DRM_ERROR ("LDI underflow!" ); -schedule_work (&kcrtc->drm_device_wq);
Compare:
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static irqreturn_t ade_irq_handler(int irq, void *data) · line 381
Quoted 1 line
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-0+schedule_work (&ctx->drm_device_wq);
With
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static irqreturn_t ade_irq_handler(int irq, void *data) · line 382
Quoted 1 line
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-0+schedule_work (&ctx->display_reset_wq);
The latter wins in readability.
Sam
Re: [PATCH 10/25] drm: kirin: Move workqueue to ade_hw_ctx structure
Quoted 21 lines · Sam Ravnborg
Hi John.
Quoted 17 lines · John Stultz
The workqueue used to reset the display when we hit an LDI underflow error is ADE specific, so since this patch series works to make the
kirin_crtcstructure more generic, move the workqueue to theade_hw_ctxstructure instead.Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
Quoted 13 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c struct ade_hw_ctx { · line 55
Quoted 9 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-0@@ -52,6 +52,7 @@ struct ade_hw_ctx {struct clk *media_noc_clk;struct clk *ade_pix_clk;struct reset_control *reset; +struct work_struct drm_device_wq;The comment probarly belongs to 01/25...
The namedrm_device_wqis not at all descriptive.
Consider something like:display_reset_wq
I agree, that sounds like a nice improvement! I'll tweak it in patch 1/25.
thanks for the review and feedback!
-john
PATCH 11/25 drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves some shared structures and helpers to the common kirin_drm_drv.h
These structures will later used by both kirin620 and future kirin960 driver
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++----------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2 -25
@@ -38,12 +38,6 @@#define OUT_OVLY ADE_OVLY2/* output overlay compositor */ #define ADE_DEBUG 1 -#define to_kirin_crtc (crtc) \ - container_of(crtc, struct kirin_crtc, base) - -#define to_kirin_plane (plane) \ - container_of(plane, struct kirin_plane, base) -struct ade_hw_ctx {void __iomem *base;
@@ -59,18 +53,6 @@ struct ade_hw_ctx {struct drm_crtc *crtc; }; -struct kirin_crtc { -struct drm_crtc base; -void *hw_ctx; -bool enable; -}; - -struct kirin_plane { -struct drm_plane base; -void *hw_ctx; -u32 ch; -}; -struct ade_data {struct kirin_crtc crtc;struct kirin_plane planes[ADE_CH_NUM ];
@@ -78,12 +60,7 @@ struct ade_data { };/* ade-format info: */ -struct ade_format { -u32 pixel_format; -enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = {/* 16bpp RGB: */ {DRM_FORMAT_RGB565 ,ADE_RGB_565 }, {DRM_FORMAT_BGR565 ,ADE_BGR_565 },
@@ -127,7 +104,7 @@ static u32 ade_get_format(u32 pixel_format)for (i =0 ; i <ARRAY_SIZE (ade_formats); i++)if (ade_formats[i].pixel_format == pixel_format) -return ade_formats[i].ade_format; +return ade_formats[i].hw_format;/* not found */ DRM_ERROR("Not found pixel format!!fourcc_format= %d\n",
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +24 -0
@@ -13,6 +13,30 @@#define MAX_CRTC 2 +#define to_kirin_crtc (crtc) \ + container_of(crtc, struct kirin_crtc, base) + +#define to_kirin_plane (plane) \ + container_of(plane, struct kirin_plane, base) + +/* kirin-format translate table */ +struct kirin_format { +u32 pixel_format; +u32 hw_format; +}; + +struct kirin_crtc { +struct drm_crtc base; +void *hw_ctx; +bool enable; +}; + +struct kirin_plane { +struct drm_plane base; +void *hw_ctx; +u32 ch; +}; +/* display controller init/cleanup ops */ struct kirin_dc_ops {int (*init)(struct platform_device *pdev);
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h
Hi John.
Quoted 61 lines · John Stultz
From: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves some shared structures and helpers to the common
kirin_drm_drv.hThese structures will later used by both kirin620 and future kirin960 driver
Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by Xu YiPing <[email protected]>[jstultz: reworded commit message]Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++----------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 24 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 25 deletions(-)drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-18@@ -38,12 +38,6 @@#define OUT_OVLY ADE_OVLY2/* output overlay compositor */ #define ADE_DEBUG 1 -#define to_kirin_crtc (crtc) \ - container_of(crtc, struct kirin_crtc, base) - -#define to_kirin_plane (plane) \ - container_of(plane, struct kirin_plane, base) -struct ade_hw_ctx {void __iomem *base;@@ -59,18 +53,6 @@ struct ade_hw_ctx {struct drm_crtc *crtc; }; -struct kirin_crtc { -struct drm_crtc base; -void *hw_ctx; -bool enable; -}; - -struct kirin_plane { -struct drm_plane base; -void *hw_ctx; -u32 ch; -}; -struct ade_data {struct kirin_crtc crtc;struct kirin_plane planes[ADE_CH_NUM ];
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c struct ade_data { · line 60
Quoted 1 line
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-0@@ -78,12 +60,7 @@ struct ade_data { };
This struct:
Quoted 29 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2
-7/* ade-format info: */ -struct ade_format { -u32 pixel_format; -enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = {/* 16bpp RGB: */ {DRM_FORMAT_RGB565 ,ADE_RGB_565 }, {DRM_FORMAT_BGR565 ,ADE_BGR_565 },@@ -127,7 +104,7 @@ static u32 ade_get_format(u32 pixel_format)for (i =0 ; i <ARRAY_SIZE (ade_formats); i++)if (ade_formats[i].pixel_format == pixel_format) -return ade_formats[i].ade_format; +return ade_formats[i].hw_format;/* not found */ DRM_ERROR("Not found pixel format!!fourcc_format= %d\n",drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +1
-0@@ -13,6 +13,30 @@#define MAX_CRTC 2 +#define to_kirin_crtc (crtc) \
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h line 26
Quoted 10 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +10
-0+ container_of(crtc, struct kirin_crtc, base) + +#define to_kirin_plane (plane) \ + container_of(plane, struct kirin_plane, base) + +/* kirin-format translate table */ +struct kirin_format { +u32 pixel_format; +u32 hw_format; +};
Is renamed.
The member hw_format is renamed and no longer uses an enum. (The sole user of this enum type).
These changes are not included in the changelog - should they be part of this patch?
And also the change from enum to u32 is not understood.
Sam
Re: [PATCH 11/25] drm: kirin: Move kirin_crtc, kirin_plane, kirin_format to kirin_drm_drv.h
Quoted 14 lines · Sam Ravnborg
On Tue, Apr 23, 2019 at 04:20:42PM -0700, John Stultz wrote:
This struct:
Quoted 11 lines
/* ade-format info: */
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-6-struct ade_format { -u32 pixel_format; -enum ade_fb_format ade_format; -}; - -static const struct ade_format ade_formats[] = { +static const struct kirin_format ade_formats[] = {/* 16bpp RGB: */ {DRM_FORMAT_RGB565 ,ADE_RGB_565 }, {DRM_FORMAT_BGR565 ,ADE_BGR_565 },
...
Quoted 9 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h line 26
Quoted 6 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +6
-0+ +/* kirin-format translate table */ +struct kirin_format { +u32 pixel_format; +u32 hw_format; +};Is renamed.
The memberhw_formatis renamed and no longer uses an enum. (The sole user of this enum type).
So the enum values are still used, but yes, the type here shifts.
Quoted 3 lines
These changes are not included in the changelog - should they be part of this patch?
And also the change from enum to u32 is not understood.
So the intent is to be able to share the kirin_format structure between both the kirin620 support and kirin960, where as the ade_fb_format enum values are tied to the kirin620, the kirin960 has dpe_fb_formats enum which has different values. So the u32 hw_format value is just the generic storage for enumerated format types of either device. So its just a map from generic pixel_format definition -> hardware specific value for that format.
I'll try to make that change more clear in the commit message, but if you have ideas for a simpler or cleaner way to do the same, let me know.
thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 12/25 drm: kirin: Reanme dc_ops to kirin_drm_data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct kirin_dc_ops to struct kirin_drm_data and cleans up the related variable names.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1 -1
@@ -1055,7 +1055,7 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } -const struct kirin_dc_ops ade_dc_ops = { +struct kirin_drm_data ade_driver_data = { .init = ade_drm_init, .cleanup = ade_drm_cleanup };
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +8 -8
@@ -30,12 +30,12 @@#include "kirin_drm_drv.h" -static struct kirin_dc_ops *dc_ops; +static struct kirin_drm_data *driver_data;static int kirin_drm_kms_cleanup (struct drm_device *dev) {drm_kms_helper_poll_fini (dev); - dc_ops->cleanup (to_platform_device (dev->dev)); + driver_data->cleanup (to_platform_device (dev->dev));drm_mode_config_cleanup (dev);return 0 ;
@@ -69,7 +69,7 @@ static int kirin_drm_kms_init(struct drm_device *dev)kirin_drm_mode_config_init (dev);/* display controller init */ - ret = dc_ops->init (to_platform_device (dev->dev)); + ret = driver_data->init (to_platform_device (dev->dev));if (ret) goto err_mode_config_cleanup;
@@ -100,7 +100,7 @@ static int kirin_drm_kms_init(struct drm_device *dev) err_unbind_all:component_unbind_all (dev->dev, dev); err_dc_cleanup: - dc_ops->cleanup (to_platform_device (dev->dev)); + driver_data->cleanup (to_platform_device (dev->dev)); err_mode_config_cleanup:drm_mode_config_cleanup (dev);
@@ -198,8 +198,8 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)struct component_match *match =NULL ;struct device_node *remote; - dc_ops = (struct kirin_dc_ops *)of_device_get_match_data (dev); -if (!dc_ops) { + driver_data = (struct kirin_drm_data *)of_device_get_match_data (dev); +if (!driver_data) {DRM_ERROR ("failed to get dt id data\n" );return -EINVAL ; }
@@ -217,13 +217,13 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)static int kirin_drm_platform_remove (struct platform_device *pdev) {component_master_del (&pdev->dev, &kirin_drm_ops); - dc_ops =NULL ; + driver_data =NULL ;return 0 ; }static const struct of_device_id kirin_drm_dt_ids[] = { { .compatible ="hisilicon,hi6220-ade" , - .data = &ade_dc_ops, + .data = &ade_driver_data, }, {/* end node */ }, };
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +2 -2
@@ -38,11 +38,11 @@ struct kirin_plane { };/* display controller init/cleanup ops */ -struct kirin_dc_ops { +struct kirin_drm_data {int (*init)(struct platform_device *pdev);void (*cleanup)(struct platform_device *pdev); }; -extern const struct kirin_dc_ops ade_dc_ops; +extern struct kirin_drm_data ade_driver_data;#endif /* __KIRIN_DRM_DRV_H__ */
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 12/25] drm: kirin: Reanme dc_ops to kirin_drm_data
Hi John.
Quoted 28 lines · John Stultz
From: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct
kirin_dc_opsto structkirin_drm_dataand cleans up the related variable names.Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by Xu YiPing <[email protected]>[jstultz: reworded commit message]Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-0
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static void ade_drm_cleanup(struct platform_device *pdev) · line 1061
Quoted 8 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-1@@ -1055,7 +1055,7 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } -const struct kirin_dc_ops ade_dc_ops = { +struct kirin_drm_data ade_driver_data = { .init = ade_drm_init, .cleanup = ade_drm_cleanup };
This rename does not help readability. An _ops often/always hold function pointers. Where _data hold data.
So it looks wrong to name this _data.
Sam
Re: [PATCH 12/25] drm: kirin: Reanme dc_ops to kirin_drm_data
Hi again.
Quoted 34 lines · Sam Ravnborg
Hi John.
Quoted 31 lines · John Stultz
From: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames the struct
kirin_dc_opsto structkirin_drm_dataand cleans up the related variable names.Cc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by Xu YiPing <[email protected]>[jstultz: reworded commit message]Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 +- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 16 ++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-)drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-0@@ -1055,7 +1055,7 @@ static void ade_drm_cleanup(struct platform_device *pdev) { }
Quoted 8 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static void ade_drm_cleanup(struct platform_device *pdev) · line 1061
Quoted 5 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1
-1-const struct kirin_dc_ops ade_dc_ops = { +struct kirin_drm_data ade_driver_data = { .init = ade_drm_init, .cleanup = ade_drm_cleanup };This rename does not help readability. An
_opsoften/always hold function pointers. Where_datahold data.
So it looks wrong to name this_data.
Reading later pathes the rename makes good sense, so disregard this.
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 13/25 drm: kirin: Move ade crtc/plane help functions to driver_data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the crtc and plane funcs/helper_funcs to the struct kirin_drm_data.
This will make it easier to add support for new devices via a new kirin_drm_data structure.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 15 ++++++++++----- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +10 -5
@@ -602,13 +602,13 @@ static int ade_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret =drm_crtc_init_with_planes (dev, crtc, plane,NULL , - &ade_crtc_funcs,NULL ); + ade_driver_data.crtc_funcs,NULL );if (ret) {DRM_ERROR ("failed to init crtc.\n" );return ret; } -drm_crtc_helper_add (crtc, &ade_crtc_helper_funcs); +drm_crtc_helper_add (crtc, ade_driver_data.crtc_helper_funcs);return 0 ; }
@@ -917,14 +917,15 @@ static int ade_plane_init(struct drm_device *dev, struct kirin_plane *kplane,if (ret)return ret; - ret =drm_universal_plane_init (dev, &kplane->base,1 , &ade_plane_funcs, - fmts, fmts_cnt,NULL , type,NULL ); + ret =drm_universal_plane_init (dev, &kplane->base,1 , + ade_driver_data.plane_funcs, fmts, + fmts_cnt,NULL , type,NULL );if (ret) {DRM_ERROR ("fail to init plane, ch=%d\n" , kplane->ch);return ret; } -drm_plane_helper_add (&kplane->base, &ade_plane_helper_funcs); +drm_plane_helper_add (&kplane->base, ade_driver_data.plane_helper_funcs);return 0 ; }
@@ -1056,6 +1057,10 @@ static void ade_drm_cleanup(struct platform_device *pdev) }struct kirin_drm_data ade_driver_data = { + .crtc_helper_funcs = &ade_crtc_helper_funcs, + .crtc_funcs = &ade_crtc_funcs, + .plane_helper_funcs = &ade_plane_helper_funcs, + .plane_funcs = &ade_plane_funcs, .init = ade_drm_init, .cleanup = ade_drm_cleanup };
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +5 -0
@@ -39,6 +39,11 @@ struct kirin_plane {/* display controller init/cleanup ops */ struct kirin_drm_data { +const struct drm_crtc_helper_funcs *crtc_helper_funcs; +const struct drm_crtc_funcs *crtc_funcs; +const struct drm_plane_helper_funcs *plane_helper_funcs; +const struct drm_plane_funcs *plane_funcs; +int (*init)(struct platform_device *pdev);void (*cleanup)(struct platform_device *pdev); };
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 14/25 drm: kirin: Move channel formats to driver data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the channel format arrays into the kirin_drm_data structure.
This will make it easier to add support for new devices via a new kirin_drm_data structure.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 30 ++++++------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 3 +++ 2 files changed, 10 insertions(+), 23 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +7 -23
@@ -76,7 +76,7 @@ static const struct kirin_format ade_formats[] = { { DRM_FORMAT_ABGR8888, ADE_ABGR_8888 }, }; -static const u32 channel_formats1[] = { +static const u32 channel_formats[] = {/* channel 1,2,3,4 */ DRM_FORMAT_RGB565 ,DRM_FORMAT_BGR565 ,DRM_FORMAT_RGB888 , DRM_FORMAT_BGR888, DRM_FORMAT_XRGB8888, DRM_FORMAT_XBGR8888,
@@ -84,19 +84,6 @@ static const u32 channel_formats1[] = { DRM_FORMAT_ABGR8888 }; -u32 ade_get_channel_formats (u8 ch,const u32 **formats) -{ -switch (ch) { -case ADE_CH1 : - *formats = channel_formats1; -return ARRAY_SIZE (channel_formats1); -default : -DRM_ERROR ("no this channel %d\n" , ch); - *formats =NULL ; -return 0 ; - } -} -/* convert from fourcc format to ade format */ static u32 ade_get_format (u32 pixel_format) {
@@ -908,18 +895,13 @@ static struct drm_plane_funcs ade_plane_funcs = {static int ade_plane_init (struct drm_device *dev,struct kirin_plane *kplane,enum drm_plane_type type) { -const u32 *fmts; -u32 fmts_cnt;int ret =0 ; -/* get properties */ - fmts_cnt =ade_get_channel_formats (kplane->ch, &fmts); -if (ret) -return ret; - ret =drm_universal_plane_init (dev, &kplane->base,1 , - ade_driver_data.plane_funcs, fmts, - fmts_cnt,NULL , type,NULL ); + ade_driver_data.plane_funcs, + ade_driver_data.channel_formats, + ade_driver_data.channel_formats_cnt, +NULL , type,NULL );if (ret) {DRM_ERROR ("fail to init plane, ch=%d\n" , kplane->ch);return ret;
@@ -1057,6 +1039,8 @@ static void ade_drm_cleanup(struct platform_device *pdev) }struct kirin_drm_data ade_driver_data = { + .channel_formats = channel_formats, + .channel_formats_cnt =ARRAY_SIZE (channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs,
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +3 -0
@@ -39,6 +39,9 @@ struct kirin_plane {/* display controller init/cleanup ops */ struct kirin_drm_data { +const u32 *channel_formats; +u32 channel_formats_cnt; +const struct drm_crtc_helper_funcs *crtc_helper_funcs;const struct drm_crtc_funcs *crtc_funcs;const struct drm_plane_helper_funcs *plane_helper_funcs;
Signature · 1 line
2.7.4
PATCH 15/25 drm: kirin: Move mode config function to driver_data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the mode config initialization values into the kirin_drm_data structure.
This will make it easier to add support for new devices via a new kirin_drm_data structure.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 10 ++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 8 +------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +10 -0
@@ -30,6 +30,7 @@#include <drm/drm_gem_cma_helper.h> #include <drm/drm_plane_helper.h> #include <drm/drm_probe_helper.h> +#include <drm/drm_gem_framebuffer_helper.h> #include "kirin_drm_drv.h" #include "kirin_ade_reg.h"
@@ -1038,6 +1039,13 @@ static void ade_drm_cleanup(struct platform_device *pdev) { } +static const struct drm_mode_config_funcs ade_mode_config_funcs = { + .fb_create = drm_gem_fb_create, + .atomic_check = drm_atomic_helper_check, + .atomic_commit = drm_atomic_helper_commit, + +}; +struct kirin_drm_data ade_driver_data = { .channel_formats = channel_formats, .channel_formats_cnt =ARRAY_SIZE (channel_formats),
@@ -1045,6 +1053,8 @@ struct kirin_drm_data ade_driver_data = { .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs, .plane_funcs = &ade_plane_funcs, + .mode_config_funcs = &ade_mode_config_funcs, + .init = ade_drm_init, .cleanup = ade_drm_cleanup };
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -7
@@ -41,12 +41,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)return 0 ; } -static const struct drm_mode_config_funcs kirin_drm_mode_config_funcs = { - .fb_create = drm_gem_fb_create, - .atomic_check = drm_atomic_helper_check, - .atomic_commit = drm_atomic_helper_commit, -}; -static void kirin_drm_mode_config_init (struct drm_device *dev) { dev->mode_config.min_width =0 ;
@@ -55,7 +49,7 @@ static void kirin_drm_mode_config_init(struct drm_device *dev) dev->mode_config.max_width =2048 ; dev->mode_config.max_height =2048 ; - dev->mode_config.funcs = &kirin_drm_mode_config_funcs; + dev->mode_config.funcs = driver_data->mode_config_funcs; }static int kirin_drm_kms_init (struct drm_device *dev)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +1 -1
@@ -46,7 +46,7 @@ struct kirin_drm_data {const struct drm_crtc_funcs *crtc_funcs;const struct drm_plane_helper_funcs *plane_helper_funcs;const struct drm_plane_funcs *plane_funcs; - +const struct drm_mode_config_funcs *mode_config_funcs;int (*init)(struct platform_device *pdev);void (*cleanup)(struct platform_device *pdev); };
Signature · 1 line
2.7.4
PATCH 16/25 drm: kirin: Move plane number and primay plane in driver data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the number of planes and the primary plane value to the kirin_drm_data structure
This will make it easier to add support for new devices via a new kirin_drm_data structure.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 21 +++++++++++++-------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +13 -8
@@ -35,7 +35,6 @@#include "kirin_drm_drv.h" #include "kirin_ade_reg.h" -#define PRIMARY_CH ADE_CH1/* primary plane */ #define OUT_OVLY ADE_OVLY2/* output overlay compositor */ #define ADE_DEBUG 1
@@ -991,7 +990,7 @@ static int ade_drm_init(struct platform_device *pdev)struct kirin_plane *kplane;enum drm_plane_type type;int ret; -int i; +u32 ch; ade =devm_kzalloc (dev->dev,sizeof (*ade),GFP_KERNEL );if (!ade) {
@@ -1015,12 +1014,15 @@ static int ade_drm_init(struct platform_device *pdev)* TODO: Now only support primary plane, overlay planes * need to do. */ -for (i =0 ; i <ADE_CH_NUM ; i++) { - kplane = &ade->planes[i]; - kplane->ch = i; +for (ch =0 ; ch < ade_driver_data.num_planes; ch++) { + kplane = &ade->planes[ch]; + kplane->ch = ch; kplane->hw_ctx = ctx; - type = i ==PRIMARY_CH ?DRM_PLANE_TYPE_PRIMARY : -DRM_PLANE_TYPE_OVERLAY ; + +if (ch == ade_driver_data.prim_plane) + type =DRM_PLANE_TYPE_PRIMARY ; +else + type =DRM_PLANE_TYPE_OVERLAY ; ret =ade_plane_init (dev, kplane, type);if (ret)
@@ -1028,7 +1030,8 @@ static int ade_drm_init(struct platform_device *pdev) }/* crtc init */ - ret =ade_crtc_init (dev, &kcrtc->base, &ade->planes[PRIMARY_CH ].base); + ret =ade_crtc_init (dev, &kcrtc->base, + &ade->planes[ade_driver_data.prim_plane].base);if (ret)return ret;
@@ -1047,6 +1050,8 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { };struct kirin_drm_data ade_driver_data = { + .num_planes =ADE_CH_NUM , + .prim_plane =ADE_CH1 , .channel_formats = channel_formats, .channel_formats_cnt =ARRAY_SIZE (channel_formats), .crtc_helper_funcs = &ade_crtc_helper_funcs,
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +2 -0
@@ -41,6 +41,8 @@ struct kirin_plane {struct kirin_drm_data {const u32 *channel_formats;u32 channel_formats_cnt; +u32 num_planes; +u32 prim_plane;const struct drm_crtc_helper_funcs *crtc_helper_funcs;const struct drm_crtc_funcs *crtc_funcs;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 17/25 drm: kirin: Move config max_width and max_height to driver data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the max_width and max_height values used in kirin_drm_mode_config_inita to hardware specific driver data.
This will make it easier to add support for new devices via a new kirin_drm_data structure.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 2 ++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 17 +++++------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 2 ++ 3 files changed, 9 insertions(+), 12 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2 -0
@@ -1054,6 +1054,8 @@ struct kirin_drm_data ade_driver_data = { .prim_plane = ADE_CH1, .channel_formats = channel_formats, .channel_formats_cnt = ARRAY_SIZE(channel_formats), + .config_max_width = 2048, + .config_max_height = 2048, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs,
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +5 -12
@@ -41,17 +41,6 @@ static int kirin_drm_kms_cleanup(struct drm_device *dev)return 0 ; } -static void kirin_drm_mode_config_init (struct drm_device *dev) -{ - dev->mode_config.min_width =0 ; - dev->mode_config.min_height =0 ; - - dev->mode_config.max_width =2048 ; - dev->mode_config.max_height =2048 ; - - dev->mode_config.funcs = driver_data->mode_config_funcs; -} -static int kirin_drm_kms_init (struct drm_device *dev) {int ret;
@@ -60,7 +49,11 @@ static int kirin_drm_kms_init(struct drm_device *dev)/* dev->mode_config initialization */ drm_mode_config_init (dev); -kirin_drm_mode_config_init (dev); + dev->mode_config.min_width =0 ; + dev->mode_config.min_height =0 ; + dev->mode_config.max_width = driver_data->config_max_width; + dev->mode_config.max_height = driver_data->config_max_width; + dev->mode_config.funcs = driver_data->mode_config_funcs;/* display controller init */ ret = driver_data->init (to_platform_device (dev->dev));
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +2 -0
@@ -41,6 +41,8 @@ struct kirin_plane {struct kirin_drm_data {const u32 *channel_formats;u32 channel_formats_cnt; +int config_max_width; +int config_max_height;u32 num_planes;u32 prim_plane;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 18/25 drm: kirin: Move drm driver to driver data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch moves the drm_driver structure to be under device specific driver data.
This will allow us to more easily add support for kirin960 hardware with later patches.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 27 ++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 38 +------------------------ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 29 insertions(+), 37 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +27 -0
@@ -1049,6 +1049,32 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = { }; +DEFINE_DRM_GEM_CMA_FOPS (ade_fops); + +static struct drm_driver ade_driver = { + .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME | +DRIVER_ATOMIC , + .fops = &ade_fops, + .gem_free_object_unlocked = drm_gem_cma_free_object, + .gem_vm_ops = &drm_gem_cma_vm_ops, + .dumb_create = drm_gem_cma_dumb_create_internal, + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .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, + .gem_prime_vunmap = drm_gem_cma_prime_vunmap, + .gem_prime_mmap = drm_gem_cma_prime_mmap, + + .name ="kirin" , + .desc ="Hisilicon Kirin620 SoC DRM Driver" , + .date ="20150718" , + .major =1 , + .minor =0 , +}; +struct kirin_drm_data ade_driver_data = { .num_planes =ADE_CH_NUM , .prim_plane =ADE_CH1 ,
@@ -1056,6 +1082,7 @@ struct kirin_drm_data ade_driver_data = { .channel_formats_cnt = ARRAY_SIZE(channel_formats), .config_max_width = 2048, .config_max_height = 2048, + .driver = &ade_driver, .crtc_helper_funcs = &ade_crtc_helper_funcs, .crtc_funcs = &ade_crtc_funcs, .plane_helper_funcs = &ade_plane_helper_funcs,
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -37
@@ -94,41 +94,6 @@ static int kirin_drm_kms_init(struct drm_device *dev)return ret; } -DEFINE_DRM_GEM_CMA_FOPS (kirin_drm_fops); - -static int kirin_gem_cma_dumb_create (struct drm_file *file, -struct drm_device *dev, -struct drm_mode_create_dumb *args) -{ -return drm_gem_cma_dumb_create_internal (file, dev, args); -} - -static struct drm_driver kirin_drm_driver = { - .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_PRIME | -DRIVER_ATOMIC , - .fops = &kirin_drm_fops, - - .gem_free_object_unlocked = drm_gem_cma_free_object, - .gem_vm_ops = &drm_gem_cma_vm_ops, - .dumb_create = kirin_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_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, - .gem_prime_vunmap = drm_gem_cma_prime_vunmap, - .gem_prime_mmap = drm_gem_cma_prime_mmap, - - .name ="kirin" , - .desc ="Hisilicon Kirin SoCs' DRM Driver" , - .date ="20150718" , - .major =1 , - .minor =0 , -}; -static int compare_of (struct device *dev,void *data) {return dev->of_node == data;
@@ -136,11 +101,10 @@ static int compare_of(struct device *dev, void *data)static int kirin_drm_bind (struct device *dev) { -struct drm_driver *driver = &kirin_drm_driver;struct drm_device *drm_dev;int ret; - drm_dev =drm_dev_alloc (driver, dev); + drm_dev =drm_dev_alloc (driver_data->driver, dev);if (IS_ERR (drm_dev))return PTR_ERR (drm_dev);
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +1 -0
@@ -46,6 +46,7 @@ struct kirin_drm_data {u32 num_planes;u32 prim_plane; +struct drm_driver *driver;const struct drm_crtc_helper_funcs *crtc_helper_funcs;const struct drm_crtc_funcs *crtc_funcs;const struct drm_plane_helper_funcs *plane_helper_funcs;
Signature · 1 line
2.7.4
PATCH 19/25 drm: kirin: Add register connect helper functions in drm init
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch adds a flag to the device specific driver data so that we can conditionally register the connectors at init.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 + drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 43 +++++++++++++++++++++++++ drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 1 + 3 files changed, 45 insertions(+)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +1 -0
@@ -1076,6 +1076,7 @@ static struct drm_driver ade_driver = { };struct kirin_drm_data ade_driver_data = { + .register_connects = false, .num_planes =ADE_CH_NUM , .prim_plane =ADE_CH1 , .channel_formats = channel_formats,
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +43 -0
57 lines not on this page · raw message
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +1 -0
@@ -43,6 +43,7 @@ struct kirin_drm_data {u32 channel_formats_cnt;int config_max_width;int config_max_height; +bool register_connects;u32 num_planes;u32 prim_plane;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 20/25 drm: kirin: Rename plane_init and crtc_init
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames ade_crtc/plane_init kirin_plane/crtc_init, as they will later be moved to kirin drm drv and shared with the kirin960 hardware support.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +6 -5
@@ -571,7 +571,7 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { .disable_vblank = ade_crtc_disable_vblank, }; -static int ade_crtc_init (struct drm_device *dev,struct drm_crtc *crtc, +static int kirin_drm_crtc_init (struct drm_device *dev,struct drm_crtc *crtc,struct drm_plane *plane) {struct device_node *port;
@@ -892,8 +892,9 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int ade_plane_init (struct drm_device *dev,struct kirin_plane *kplane, -enum drm_plane_type type) +static int kirin_drm_plane_init (struct drm_device *dev, +struct kirin_plane *kplane, +enum drm_plane_type type) {int ret =0 ;
@@ -1024,13 +1025,13 @@ static int ade_drm_init(struct platform_device *pdev)else type =DRM_PLANE_TYPE_OVERLAY ; - ret =ade_plane_init (dev, kplane, type); + ret =kirin_drm_plane_init (dev, kplane, type);if (ret)return ret; }/* crtc init */ - ret =ade_crtc_init (dev, &kcrtc->base, + ret =kirin_drm_crtc_init (dev, &kcrtc->base, &ade->planes[ade_driver_data.prim_plane].base);if (ret)return ret;
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 21/25 drm: kirin: Fix dev->driver_data setting
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the dev->driver_data to point to a drm_device, not ade_data.
Thus we set the driver data to drm device after alloc.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 1 - drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0 -1
@@ -998,7 +998,6 @@ static int ade_drm_init(struct platform_device *pdev)DRM_ERROR ("failed to alloc ade_data\n" );return -ENOMEM ; } -platform_set_drvdata (pdev, ade); ctx =ade_hw_ctx_alloc (pdev, &ade->crtc.base);if (IS_ERR (ctx)) {
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +1 -2
@@ -45,8 +45,6 @@ static int kirin_drm_kms_init(struct drm_device *dev) {int ret; -dev_set_drvdata (dev->dev, dev); -/* dev->mode_config initialization */ drm_mode_config_init (dev); dev->mode_config.min_width =0 ;
@@ -141,6 +139,7 @@ static int kirin_drm_bind(struct device *dev) drm_dev =drm_dev_alloc (driver_data->driver, dev);if (IS_ERR (drm_dev))return PTR_ERR (drm_dev); +dev_set_drvdata (dev, drm_dev); ret =kirin_drm_kms_init (drm_dev);if (ret)
Signature · 1 line
2.7.4
PATCH 22/25 drm: kirin: Make driver_data variable non-global
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the driver_data value to not be a global variable. Instead the driver_data value is accessed via the of_device_get_match_data() when needed.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 43 ++++++++++++++----------- 1 file changed, 24 insertions(+), 19 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +24 -19
@@ -30,18 +30,9 @@#include "kirin_drm_drv.h" -static struct kirin_drm_data *driver_data; -static int kirin_drm_kms_cleanup (struct drm_device *dev) -{ -drm_kms_helper_poll_fini (dev); - driver_data->cleanup (to_platform_device (dev->dev)); -drm_mode_config_cleanup (dev); - -return 0 ; -} - -static int kirin_drm_kms_init (struct drm_device *dev) +static int kirin_drm_kms_init (struct drm_device *dev, +const struct kirin_drm_data *driver_data) {int ret;
@@ -97,6 +88,21 @@ static int compare_of(struct device *dev, void *data)return dev->of_node == data; } +static int kirin_drm_kms_cleanup (struct drm_device *dev) +{ +const struct kirin_drm_data *driver_data; + +drm_kms_helper_poll_fini (dev); + + driver_data =of_device_get_match_data (dev->dev); +if (driver_data->cleanup) + driver_data->cleanup (to_platform_device (dev->dev)); + +drm_mode_config_cleanup (dev); + +return 0 ; +} +static int kirin_drm_connectors_register (struct drm_device *dev) {struct drm_connector *connector;
@@ -133,15 +139,21 @@ static int kirin_drm_connectors_register(struct drm_device *dev)static int kirin_drm_bind (struct device *dev) { +struct kirin_drm_data *driver_data;struct drm_device *drm_dev;int ret; + driver_data = (struct kirin_drm_data *)of_device_get_match_data (dev); +if (driver_data ==NULL ) +return -EINVAL ; + drm_dev =drm_dev_alloc (driver_data->driver, dev);if (IS_ERR (drm_dev))return PTR_ERR (drm_dev);dev_set_drvdata (dev, drm_dev); - ret =kirin_drm_kms_init (drm_dev); +/* display controller init */ + ret =kirin_drm_kms_init (drm_dev, driver_data);if (ret) goto err_drm_dev_put;
@@ -191,12 +203,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)struct component_match *match =NULL ;struct device_node *remote; - driver_data = (struct kirin_drm_data *)of_device_get_match_data (dev); -if (!driver_data) { -DRM_ERROR ("failed to get dt id data\n" ); -return -EINVAL ; - } - remote =of_graph_get_remote_node (np,0 ,0 );if (!remote)return -ENODEV ;
@@ -210,7 +216,6 @@ static int kirin_drm_platform_probe(struct platform_device *pdev)static int kirin_drm_platform_remove (struct platform_device *pdev) {component_master_del (&pdev->dev, &kirin_drm_ops); - driver_data =NULL ;return 0 ; }
Signature · 1 line
2.7.4
PATCH 23/25 drm: kirin: Add alloc_hw_ctx/clean_hw_ctx ops in driver data
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch changes the alloc/clean_hw_ctx functions to be called via driver_data specific funciton pointers.
This will allow the ade_drm_init to later be made generic and moved to kirin_drm_drv.c
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 9 ++++++++- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +8 -1
@@ -999,7 +999,7 @@ static int ade_drm_init(struct platform_device *pdev)return -ENOMEM ; } - ctx =ade_hw_ctx_alloc (pdev, &ade->crtc.base); + ctx = ade_driver_data.alloc_hw_ctx (pdev, &ade->crtc.base);if (IS_ERR (ctx)) {DRM_ERROR ("failed to initialize kirin_priv hw ctx\n" );return -EINVAL ;
@@ -1038,6 +1038,10 @@ static int ade_drm_init(struct platform_device *pdev)return 0 ; } +static void ade_hw_ctx_cleanup (void *hw_ctx) +{ +} +static void ade_drm_cleanup (struct platform_device *pdev) { }
@@ -1090,6 +1094,9 @@ struct kirin_drm_data ade_driver_data = { .plane_funcs = &ade_plane_funcs, .mode_config_funcs = &ade_mode_config_funcs, + .alloc_hw_ctx = ade_hw_ctx_alloc, + .cleanup_hw_ctx = ade_hw_ctx_cleanup, + .init = ade_drm_init, .cleanup = ade_drm_cleanup };
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +5 -0
@@ -53,6 +53,11 @@ struct kirin_drm_data {const struct drm_plane_helper_funcs *plane_helper_funcs;const struct drm_plane_funcs *plane_funcs;const struct drm_mode_config_funcs *mode_config_funcs; + +void *(*alloc_hw_ctx)(struct platform_device *pdev, +struct drm_crtc *crtc); +void (*cleanup_hw_ctx)(void *hw_ctx); +int (*init)(struct platform_device *pdev);void (*cleanup)(struct platform_device *pdev); };
Signature · 1 line
2.7.4
PATCH 24/25 drm: kirin: Pass driver data to crtc init and plane init
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch changes funcitons to pass the kirin_driver_data as a prameter.
This will allow those funcitons to be later moved to the generic kirin_drm_drv.c
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +14 -11
@@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { };static int kirin_drm_crtc_init (struct drm_device *dev,struct drm_crtc *crtc, -struct drm_plane *plane) +struct drm_plane *plane, +const struct kirin_drm_data *driver_data) {struct device_node *port;int ret;
@@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret =drm_crtc_init_with_planes (dev, crtc, plane,NULL , - ade_driver_data.crtc_funcs,NULL ); + driver_data->crtc_funcs,NULL );if (ret) {DRM_ERROR ("failed to init crtc.\n" );return ret; } -drm_crtc_helper_add (crtc, ade_driver_data.crtc_helper_funcs); +drm_crtc_helper_add (crtc, driver_data->crtc_helper_funcs);return 0 ; }
@@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = {static int kirin_drm_plane_init (struct drm_device *dev,struct kirin_plane *kplane, -enum drm_plane_type type) +enum drm_plane_type type, +const struct kirin_drm_data *driver_data) {int ret =0 ; ret =drm_universal_plane_init (dev, &kplane->base,1 , - ade_driver_data.plane_funcs, - ade_driver_data.channel_formats, - ade_driver_data.channel_formats_cnt, -NULL , type,NULL ); + driver_data->plane_funcs, + driver_data->channel_formats, + driver_data->channel_formats_cnt, +NULL , type,NULL );if (ret) {DRM_ERROR ("fail to init plane, ch=%d\n" , kplane->ch);return ret; } -drm_plane_helper_add (&kplane->base, ade_driver_data.plane_helper_funcs); +drm_plane_helper_add (&kplane->base, driver_data->plane_helper_funcs);return 0 ; }
@@ -1024,14 +1026,15 @@ static int ade_drm_init(struct platform_device *pdev)else type =DRM_PLANE_TYPE_OVERLAY ; - ret =kirin_drm_plane_init (dev, kplane, type); + ret =kirin_drm_plane_init (dev, kplane, type, &ade_driver_data);if (ret)return ret; }/* crtc init */ ret =kirin_drm_crtc_init (dev, &kcrtc->base, - &ade->planes[ade_driver_data.prim_plane].base); + &ade->planes[ade_driver_data.prim_plane].base, + &ade_driver_data);if (ret)return ret;
Signature · 1 line
2.7.4
Re: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init
Hi John.
Quoted 28 lines · John Stultz
From: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch changes funcitons to pass the
kirin_driver_dataas a prameter.This will allow those funcitons to be later moved to the generic
kirin_drm_drv.cCc Xinliang Liu <[email protected]>Cc Rongrong Zou <[email protected]>Cc Xinwei Kong <[email protected]>Cc Chen Feng <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc dri-devel <[email protected]>Signed-off-by Xu YiPing <[email protected]>[jstultz: Reworded commit message]Signed-off-by John Stultz <[email protected]>--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0
-0
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static const struct drm_crtc_funcs ade_crtc_funcs = { · line 576
Quoted 6 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2
-1@@ -572,7 +572,8 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { };static int kirin_drm_crtc_init (struct drm_device *dev,struct drm_crtc *crtc, -struct drm_plane *plane) +struct drm_plane *plane, +const struct kirin_drm_data *driver_data)
Indent looks wrong here.
Quoted 26 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2
-3{struct device_node *port;int ret;@@ -589,13 +590,13 @@ static int kirin_drm_crtc_init(struct drm_device *dev, struct drm_crtc *crtc, crtc->port = port; ret =drm_crtc_init_with_planes (dev, crtc, plane,NULL , - ade_driver_data.crtc_funcs,NULL ); + driver_data->crtc_funcs,NULL );if (ret) {DRM_ERROR ("failed to init crtc.\n" );return ret; } -drm_crtc_helper_add (crtc, ade_driver_data.crtc_helper_funcs); +drm_crtc_helper_add (crtc, driver_data->crtc_helper_funcs);return 0 ; }@@ -894,21 +895,22 @@ static struct drm_plane_funcs ade_plane_funcs = { static int kirin_drm_plane_init(struct drm_device *dev, struct kirin_plane *kplane, -enum drm_plane_type type)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static struct drm_plane_funcs ade_plane_funcs = { · line 907
Quoted 10 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +6
-0+enum drm_plane_type type, + const struct kirin_drm_data *driver_data) { int ret = 0; ret =drm_universal_plane_init (dev, &kplane->base,1 , + driver_data->plane_funcs, + driver_data->channel_formats, + driver_data->channel_formats_cnt, +NULL , type,NULL );
Indent looks wrong here.
I missed where ade_driver_data came from. This looks an extra patch to intoduce driver_data, that maybe should be merged with an earlier version?
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init
Quoted 8 lines · Sam Ravnborg
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static const struct drm_crtc_funcs ade_crtc_funcs = { · line 576
Quoted 4 lines · John Stultz
static int kirin_drm_crtc_init(struct
drm_device*dev, structdrm_crtc*crtc,drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +2
-1- struct drm_plane *plane) +struct drm_plane *plane, + const struct kirin_drm_data *driver_data)Indent looks wrong here.
..
Quoted 6 lines
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c static struct drm_plane_funcs ade_plane_funcs = { · line 907
Quoted 5 lines
ret = drm_universal_plane_init(dev, &kplane->base, 1,drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +4
-0+ driver_data->plane_funcs, + driver_data->channel_formats, + driver_data->channel_formats_cnt, + NULL, type, NULL);Indent looks wrong here.
Thanks! I've now fixed those up.
Quoted 3 lines
I missed where
ade_driver_datacame from. This looks an extra patch to intoducedriver_data, that maybe should be merged with an earlier version?
I'm not sure I'm following you here. Can you clarify a bit more?
thanks
-john
Re: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init
Hi John.
Quoted 6 lines
Quoted 4 lines
I missed where
ade_driver_datacame from. This looks an extra patch to intoducedriver_data, that maybe should be merged with an earlier version?I'm not sure I'm following you here. Can you clarify a bit more?
So I looked at this a bit more - and got the bigger picture in place again.
driver_data is assigned using the lookup done at probe() time. For now this is just assigned to ade_driver_data as this is the only option.
So an indirection via driver_date or calling ade_driver_data direct is the same.
And you have several patches where you migrate to use driver_data rather than calling ade_driver_data direct.
It confused me that the patch introducing the lookup at probe() came before all call sites were migrated to use driver_data. But I get it now so it is fine.
Maybe a few words in the commit log like:
This patch refactor to call functions via driver_data, rather than hardcoding them via ade_driver_data. This is doen so we later can assing another stucture to driver_data to support other chips.
PS. I did not complain about your spelling mistakes in the changelog. I have a similar (or worse) keyboard from a spelling point of view.
Sam
Re: [PATCH 24/25] drm: kirin: Pass driver data to crtc init and plane init
Quoted 20 lines · Sam Ravnborg
Quoted 5 lines
Quoted 3 lines
I missed where
ade_driver_datacame from. This looks an extra patch to intoducedriver_data, that maybe should be merged with an earlier version?I'm not sure I'm following you here. Can you clarify a bit more?
So I looked at this a bit more - and got the bigger picture in place again.
driver_datais assigned using the lookup done atprobe()time. For now this is just assigned toade_driver_dataas this is the only option.
So an indirection viadriver_dateor callingade_driver_datadirect is the same.
And you have several patches where you migrate to usedriver_datarather than callingade_driver_datadirect.
It confused me that the patch introducing the lookup atprobe()came before all call sites were migrated to usedriver_data. But I get it now so it is fine.
Quoted 6 lines
Maybe a few words in the commit log like:
This patch refactor to call functions via
driver_data, rather than hardcoding them viaade_driver_data. This is doen so we later can assing another stucture todriver_datato support other chips.
Sounds good! I'll integrate this into the change log.
Quoted 3 lines
PS. I did not complain about your spelling mistakes in the changelog. I have a similar (or worse) keyboard from a spelling point of view.
Oh yes, a deficiency of mine. Good reminder I should run through the logs w/ the spell checker.
Again, I appreciate the feedback!
thanks
-john
PATCH 25/25 drm: kirin: Move ade drm init to kirin drm drv
In reply to John StultzFrom: Xu YiPing <[email protected]>
As part of refactoring the kirin driver to better support different hardware revisions, this patch renames ade_data to kirin_drm_private, and moves crtc_init and plane_init to kirin drm drv too. Now that they are generic the functions can be shared between the kirin620 and (to be added later) kirin960 specific support code.
--- drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c | 123 --------------------- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 141 ++++++++++++++++++++++-- drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h | 5 - 3 files changed, 129 insertions(+), 140 deletions(-)
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c +0 -123
@@ -53,13 +53,6 @@ struct ade_hw_ctx {struct drm_crtc *crtc; }; -struct ade_data { -struct kirin_crtc crtc; -struct kirin_plane planes[ADE_CH_NUM ]; -struct ade_hw_ctx *hw_ctx; -}; - -/* ade-format info: */ static const struct kirin_format ade_formats[] = {/* 16bpp RGB: */ {DRM_FORMAT_RGB565 ,ADE_RGB_565 },
@@ -571,36 +564,6 @@ static const struct drm_crtc_funcs ade_crtc_funcs = { .disable_vblank = ade_crtc_disable_vblank, }; -static int kirin_drm_crtc_init (struct drm_device *dev,struct drm_crtc *crtc, -struct drm_plane *plane, -const struct kirin_drm_data *driver_data) -{ -struct device_node *port; -int ret; - -/* set crtc port so that -* drm_of_find_possible_crtcs call works -*/ - port =of_get_child_by_name (dev->dev->of_node,"port" ); -if (!port) { -DRM_ERROR ("no port node found in %pOF\n" , dev->dev->of_node); -return -EINVAL ; - } -of_node_put (port); - crtc->port = port; - - ret =drm_crtc_init_with_planes (dev, crtc, plane,NULL , - driver_data->crtc_funcs,NULL ); -if (ret) { -DRM_ERROR ("failed to init crtc.\n" ); -return ret; - } - -drm_crtc_helper_add (crtc, driver_data->crtc_helper_funcs); - -return 0 ; -} -static void ade_rdma_set (void __iomem *base,struct drm_framebuffer *fb,u32 ch,u32 y,u32 in_h,u32 fmt) {
@@ -893,28 +856,6 @@ static struct drm_plane_funcs ade_plane_funcs = { .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, }; -static int kirin_drm_plane_init (struct drm_device *dev, -struct kirin_plane *kplane, -enum drm_plane_type type, -const struct kirin_drm_data *driver_data) -{ -int ret =0 ; - - ret =drm_universal_plane_init (dev, &kplane->base,1 , - driver_data->plane_funcs, - driver_data->channel_formats, - driver_data->channel_formats_cnt, -NULL , type,NULL ); -if (ret) { -DRM_ERROR ("fail to init plane, ch=%d\n" , kplane->ch); -return ret; - } - -drm_plane_helper_add (&kplane->base, driver_data->plane_helper_funcs); - -return 0 ; -} -static void *ade_hw_ctx_alloc (struct platform_device *pdev,struct drm_crtc *crtc) {
@@ -984,71 +925,10 @@ static void *ade_hw_ctx_alloc(struct platform_device *pdev,return ctx; } -static int ade_drm_init (struct platform_device *pdev) -{ -struct drm_device *dev =platform_get_drvdata (pdev); -struct ade_data *ade; -struct ade_hw_ctx *ctx; -struct kirin_crtc *kcrtc; -struct kirin_plane *kplane; -enum drm_plane_type type; -int ret; -u32 ch; - - ade =devm_kzalloc (dev->dev,sizeof (*ade),GFP_KERNEL ); -if (!ade) { -DRM_ERROR ("failed to alloc ade_data\n" ); -return -ENOMEM ; - } - - ctx = ade_driver_data.alloc_hw_ctx (pdev, &ade->crtc.base); -if (IS_ERR (ctx)) { -DRM_ERROR ("failed to initialize kirin_priv hw ctx\n" ); -return -EINVAL ; - } - ade->hw_ctx = ctx; - - kcrtc = &ade->crtc; - kcrtc->hw_ctx = ctx; - -/* -* plane init -* TODO: Now only support primary plane, overlay planes -* need to do. -*/ -for (ch =0 ; ch < ade_driver_data.num_planes; ch++) { - kplane = &ade->planes[ch]; - kplane->ch = ch; - kplane->hw_ctx = ctx; - -if (ch == ade_driver_data.prim_plane) - type =DRM_PLANE_TYPE_PRIMARY ; -else - type =DRM_PLANE_TYPE_OVERLAY ; - - ret =kirin_drm_plane_init (dev, kplane, type, &ade_driver_data); -if (ret) -return ret; - } - -/* crtc init */ - ret =kirin_drm_crtc_init (dev, &kcrtc->base, - &ade->planes[ade_driver_data.prim_plane].base, - &ade_driver_data); -if (ret) -return ret; - -return 0 ; -} -static void ade_hw_ctx_cleanup (void *hw_ctx) { } -static void ade_drm_cleanup (struct platform_device *pdev) -{ -} -static const struct drm_mode_config_funcs ade_mode_config_funcs = { .fb_create = drm_gem_fb_create, .atomic_check = drm_atomic_helper_check,
@@ -1099,7 +979,4 @@ struct kirin_drm_data ade_driver_data = { .alloc_hw_ctx = ade_hw_ctx_alloc, .cleanup_hw_ctx = ade_hw_ctx_cleanup, - - .init = ade_drm_init, - .cleanup = ade_drm_cleanup };
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c +129 -12
174 lines not on this page · raw message
drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h +0 -5
@@ -11,8 +11,6 @@#ifndef __KIRIN_DRM_DRV_H__#define __KIRIN_DRM_DRV_H__ -#define MAX_CRTC 2 -#define to_kirin_crtc (crtc) \ container_of(crtc, struct kirin_crtc, base)
@@ -57,9 +55,6 @@ struct kirin_drm_data {void *(*alloc_hw_ctx)(struct platform_device *pdev,struct drm_crtc *crtc);void (*cleanup_hw_ctx)(void *hw_ctx); - -int (*init)(struct platform_device *pdev); -void (*cleanup)(struct platform_device *pdev); };extern struct kirin_drm_data ade_driver_data;
Signature · 1 line
2.7.4
Hi John.
Quoted 10 lines · John Stultz
This patchset contains one fix (in the front, so its easier to eventually backport), and a series of changes from YiPing to refactor the kirin drm driver so that it can be used on both kirin620 based devices (like the original HiKey board) as well as kirin960 based devices (like the HiKey960 board).
The full kirin960 drm support is still being refactored, but as this base kirin rework was getting to be substantial, I wanted to send out the first chunk for some initial review, so that the review burden wasn't overwhelming.
I have been through all 25 patches and it triggered a few minor comments here and there.
I know nothing about the hisilicon driver but based on the fact that I know nothing about the driver you can give them all a (smallish)
I trust your judgement to decide the feedback you want to address and what to ignore.
One request:
Could you please in a follow-up patch kill the use of drmP.h. We want to get rid of it one day and three fewer users are one small step towards this goal.
Thanks,
Sam
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 19 lines · Sam Ravnborg
Hi John.
Quoted 10 lines · John Stultz
This patchset contains one fix (in the front, so its easier to eventually backport), and a series of changes from YiPing to refactor the kirin drm driver so that it can be used on both kirin620 based devices (like the original HiKey board) as well as kirin960 based devices (like the HiKey960 board).
The full kirin960 drm support is still being refactored, but as this base kirin rework was getting to be substantial, I wanted to send out the first chunk for some initial review, so that the review burden wasn't overwhelming.
I have been through all 25 patches and it triggered a few minor comments here and there.
I know nothing about the hisilicon driver but based on the fact that I know nothing about the driver you can give them all a (smallish)
Quoted 4 lines
Reviewed-by Sam Ravnborg <[email protected]>I trust your judgement to decide the feedback you want to address and what to ignore.
Thanks again for your time and thoughts here! I really appreciate it!
Quoted 4 lines
One request:
Could you please in a follow-up patch kill the use ofdrmP.h. We want to get rid of it one day and three fewer users are one small step towards this goal.
I'll take a swing at this. Thanks!
-john
Hi John.
Quoted 6 lines · John Stultz
This patchset contains one fix (in the front, so its easier to eventually backport), and a series of changes from YiPing to refactor the kirin drm driver so that it can be used on both kirin620 based devices (like the original HiKey board) as well as kirin960 based devices (like the HiKey960 board).
Quoted 7 lines
The full kirin960 drm support is still being refactored, but as this base kirin rework was getting to be substantial, I wanted to send out the first chunk for some initial review, so that the review burden wasn't overwhelming.
The full HiKey960 patch stack can be found here:
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/hikey960-mainline-WIP
On the mailing list we are missing patch 25/25 - I only realize now.
Sam
Quoted 15 lines · Sam Ravnborg
Hi John.
Quoted 11 lines · John Stultz
This patchset contains one fix (in the front, so its easier to eventually backport), and a series of changes from YiPing to refactor the kirin drm driver so that it can be used on both kirin620 based devices (like the original HiKey board) as well as kirin960 based devices (like the HiKey960 board).
The full kirin960 drm support is still being refactored, but as this base kirin rework was getting to be substantial, I wanted to send out the first chunk for some initial review, so that the review burden wasn't overwhelming.
Quoted 4 lines
Quoted 2 lines
The full HiKey960 patch stack can be found here:
https://git.linaro.org/people/john.stultz/android-dev.git/log/?h=dev/hikey960-mainline-WIPOn the mailing list we are missing patch 25/25 - I only realize now.
Oof. Somehow I didn't add my Cc: list to the commit message. Apologies!
You can find it here:
https://lkml.org/lkml/2019/4/23/1140
thanks
-john
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel