D71 pipeline/component descovery and initialization
Subsystems (4)
cover D71 pipeline/component descovery and initialization
This is the 2nd patchset for komeda-driver.
These patches focus on CHIP(D71) Layer for pipeline/component descovery and initialization. All basic and essential display component: layer, compiz, improc, timing-ctrlr and irq handling have been added, other component
support: scaler, wb_layer, merger, splitter will be added in the future.
James (Qian) Wang (7):
drm/komeda: Add d71_enum_resources and d71_cleanup drm/komeda: Add d71 layer
arm/komeda: Add d71 compiz component
drm/komeda: Add D71 improc and timing_ctrlr drm/komeda: Add komeda_assemble_pipelines drm/komeda: Add irq handling
drm/komeda: Add debugfs node "register" for register dump
.../drm/arm/display/include/malidp_utils.h | 29 + drivers/gpu/drm/arm/display/komeda/Makefile | 3 +- .../arm/display/komeda/d71/d71_component.c | 682 ++++++++++++++++++ .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 367 +++++++++- .../gpu/drm/arm/display/komeda/d71/d71_dev.h | 50 ++ .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 530 ++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 18 + .../gpu/drm/arm/display/komeda/komeda_dev.c | 58 ++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 48 ++ .../gpu/drm/arm/display/komeda/komeda_kms.c | 35 +- .../gpu/drm/arm/display/komeda/komeda_kms.h | 5 + .../drm/arm/display/komeda/komeda_pipeline.c | 97 ++- .../drm/arm/display/komeda/komeda_pipeline.h | 48 +- 13 files changed, 1949 insertions(+), 21 deletions(-) create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_component.c create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_dev.h create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 1/7 drm/komeda: Add d71_enum_resources and d71_cleanup
D71 consists of a number of Register Blocks, every Block controls a specific HW function, every block has a common block_header to represent its type and pipeline information.
GCU (Global Control Unit) is the first Block which describe the global information of D71 HW, Like number of block contained and the number of pipeline supported.
So the d71_enum_resources parsed GCU and create pipeline according the GCU configuration, and then iterate and detect the blocks that indicated by the GCU and block_header.
And this change also added two struct d71_dev/d71_pipeline to extend komeda_dev/komeda_pipeline to add some d71 only members.
--- .../drm/arm/display/include/malidp_utils.h | 12 + drivers/gpu/drm/arm/display/komeda/Makefile | 3 +- .../arm/display/komeda/d71/d71_component.c | 120 ++++ .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 130 ++++- .../gpu/drm/arm/display/komeda/d71/d71_dev.h | 50 ++ .../gpu/drm/arm/display/komeda/d71/d71_regs.h | 530 ++++++++++++++++++ 6 files changed, 837 insertions(+), 8 deletions(-) create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_component.c create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_dev.h create mode 100644 drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h
drivers/gpu/drm/arm/display/include/malidp_utils.h +12 -0
@@ -13,4 +13,16 @@#define dp_for_each_set_bit (bit, mask) \ for_each_set_bit((bit), ((unsigned long *)&(mask)), sizeof(mask) * 8) +#define dp_wait_cond (__cond, __tries, __min_range, __max_range) \ +({ \ + int num_tries = __tries; \ + while (!__cond && (num_tries > 0)) { \ + usleep_range(__min_range, __max_range); \ + if (__cond) \ + break; \ + num_tries--; \ + } \ + num_tries; \ +}) +#endif /* _MALIDP_UTILS_ */
drivers/gpu/drm/arm/display/komeda/Makefile +2 -1
@@ -16,6 +16,7 @@ komeda-y := \ komeda_private_obj.o komeda-y += \ - d71/d71_dev.o + d71/d71_dev.o \ + d71/d71_component.o obj-$(CONFIG_DRM_KOMEDA) += komeda.o
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c new file +120 -0
120 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +123 -7
148 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.h new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h new file +530 -0
530 lines not on this page · raw message
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/komeda: Add d71_enum_resources and d71_cleanup
Hi James,
A few minor comments.
Quoted 12 lines · james qian wang (Arm Technology China)
D71 consists of a number of Register Blocks, every Block controls a specific HW function, every block has a common
block_headerto represent its type and pipeline information.GCU (Global Control Unit) is the first Block which describe the global information of D71 HW, Like number of block contained and the number of pipeline supported.
So the
d71_enum_resourcesparsed GCU and create pipeline according the GCU configuration, and then iterate and detect the blocks that indicated by the GCU andblock_header.
Quoted 5 lines
And this change also added two struct d71_dev/d71_pipeline to extend komeda_dev/komeda_pipeline to add some d71 only members.
Signed-off-by James (Qian) Wang <[email protected]>---
-- snip --
Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c new file +4
-0@@ -0,0 +1,120 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* (C) COPYRIGHT 2018 ARM Limited. All rights reserved. +* Author: James.Qian.Wang <[email protected]>
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c line 14
Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c new file +10
-0+* +*/ +#include "d71_dev.h" +#include "komeda_kms.h" +#include "malidp_io.h" + +static int d71_layer_init (struct d71_dev *d71, +struct block_header *blk,u32 __iomem *reg) +{ +DRM_INFO ("Detect D71_Layer.\n" );
I think all of these can be DRM_DEBUG.
-- snip --
Quoted 74 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c new file +70
-1static int d71_enum_resources (struct komeda_dev *mdev) { -/* TODO add enum resources */ +struct d71_dev *d71; +struct komeda_pipeline *pipe; +struct block_header blk; +u32 __iomem *blk_base; +u32 i, value, offset; + + d71 =devm_kzalloc (mdev->dev,sizeof (*d71),GFP_KERNEL ); +if (!d71) +return -ENOMEM ; + + mdev->chip_data = d71; + d71->mdev = mdev; + d71->gcu_addr = mdev->reg_base; + d71->periph_addr = mdev->reg_base + (D71_BLOCK_OFFSET_PERIPH >>2 ); + +if (d71_reset (d71)) { +DRM_ERROR ("Fail to reset d71 device.\n" ); + goto err_cleanup; + } + +/* probe GCU */ + value =malidp_read32 (d71->gcu_addr,GLB_CORE_INFO ); + d71->num_blocks = value &0xFF ; + d71->num_pipelines = (value >>8 ) &0x7 ; + +if (d71->num_pipelines >D71_MAX_PIPELINE ) { +DRM_ERROR ("d71 supports %d pipelines, but got: %d.\n" , +D71_MAX_PIPELINE , d71->num_pipelines); + goto err_cleanup; + } + +/* probe PERIPH */ + value =malidp_read32 (d71->periph_addr,BLK_BLOCK_INFO ); +if (BLOCK_INFO_BLK_TYPE (value) !=D71_BLK_TYPE_PERIPH ) { +DRM_ERROR ("access blk periph but got blk: %d.\n" , +BLOCK_INFO_BLK_TYPE (value)); + goto err_cleanup; + } + + value =malidp_read32 (d71->periph_addr,PERIPH_CONFIGURATION_ID ); + + d71->max_line_size = value &PERIPH_MAX_LINE_SIZE ?4096 :2048 ; + d71->max_vsize =4096 ; + d71->num_rich_layers = value &PERIPH_NUM_RICH_LAYERS ?2 :1 ; + d71->supports_dual_link = value &PERIPH_SPLIT_EN ? true : false; + d71->integrates_tbu = value &PERIPH_TBU_EN ? true : false; + +for (i =0 ; i < d71->num_pipelines; i++) { + pipe =komeda_pipeline_add (mdev,sizeof (struct d71_pipeline ), +NULL ); +if (!pipe) + goto err_cleanup; + + d71->pipes[i] =to_d71_pipeline (pipe); + } + +/* loop the register blks and probe */ + i =2 ;/* exclude GCU and PERIPH */ + offset =D71_BLOCK_SIZE ;/* skip GCU */ +while (i < d71->num_blocks) { + blk_base = mdev->reg_base + (offset >>2 ); + +d71_read_block_header (blk_base, &blk); +if (BLOCK_INFO_BLK_TYPE (blk.block_info) !=D71_BLK_TYPE_RESERVED ) { +if (d71_probe_block (d71, &blk, blk_base)) + goto err_cleanup; + i++; + } + + offset +=D71_BLOCK_SIZE ;
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c new file +9
-0+ } + +DRM_INFO ("total %d (out of %d) blocks are found.\n" , + i, d71->num_blocks); + +return 0 ; + +err_cleanup: +d71_cleanup (mdev);return -1 ;
-1 isn't a useful error code, and you return -ENOMEM if allocation fails. It would probably be better to return proper codes everywhere (e.g. you might get -EINVAL back from d71_probe_block, but you don't propagate it).
-- snip --
Quoted 5 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h new file +0
-0
...
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h line 416
Quoted 7 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h new file +7
-0+ +/* Image process registers */ +#define IPS_DEPTH 0x0D8 +#define IPS_RGB_RGB_COEFF0 0x130 +#define IPS_RGB_YUV_COEFF0 0x170 + +#define IPS_DEPTH_MARK 0xF
s/MARK/MASK/
Cheers,
-Brian
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 1/7] drm/komeda: Add d71_enum_resources and d71_cleanup
On 2019/1/7, 9:41 PM, "Brian Starkey" <[email protected]> wrote:
Hi James,
A few minor comments.
On Mon, Dec 24, 2018 at 08:58:46AM +0000, james qian wang (Arm Technology China) wrote:
> D71 consists of a number of Register Blocks, every Block controls a
> specific HW function, every block has a common block_header to represent
> its type and pipeline information.
>
> GCU (Global Control Unit) is the first Block which describe the global
> information of D71 HW, Like number of block contained and the number of
> pipeline supported.
>
> So the d71_enum_resources parsed GCU and create pipeline according
> the GCU configuration, and then iterate and detect the blocks that
> indicated by the GCU and block_header.
>
> And this change also added two struct d71_dev/d71_pipeline to extend
> komeda_dev/komeda_pipeline to add some d71 only members.
>
> Signed-off-by: James (Qian) Wang <[email protected]>
> ---
-- snip --
> diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
> new file mode 100644
> index 000000000000..a43a2410159f
> --- /dev/null
> +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_component.c
> @@ -0,0 +1,120 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * (C) COPYRIGHT 2018 ARM Limited. All rights reserved.
> + * Author: James.Qian.Wang <[email protected]>
> + *
> + */
> +#include "d71_dev.h"
> +#include "komeda_kms.h"
> +#include "malidp_io.h"
> +
> +static int d71_layer_init(struct d71_dev *d71,
> + struct block_header *blk, u32 __iomem *reg)
> +{
> + DRM_INFO("Detect D71_Layer.\n");
I think all of these can be DRM_DEBUG.
-- snip --Will fix it on the next version.
Quoted 74 lines
static int
d71_enum_resources(struct komeda_dev *mdev){drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +70
-1-/* TODO add enum resources */ +struct d71_dev *d71; +struct komeda_pipeline *pipe; +struct block_header blk; +u32 __iomem *blk_base; +u32 i, value, offset; + + d71 =devm_kzalloc (mdev->dev,sizeof (*d71),GFP_KERNEL ); +if (!d71) +return -ENOMEM ; + + mdev->chip_data = d71; + d71->mdev = mdev; + d71->gcu_addr = mdev->reg_base; + d71->periph_addr = mdev->reg_base + (D71_BLOCK_OFFSET_PERIPH >>2 ); + +if (d71_reset (d71)) { +DRM_ERROR ("Fail to reset d71 device.\n" ); + goto err_cleanup; + } + +/* probe GCU */ + value =malidp_read32 (d71->gcu_addr,GLB_CORE_INFO ); + d71->num_blocks = value &0xFF ; + d71->num_pipelines = (value >>8 ) &0x7 ; + +if (d71->num_pipelines >D71_MAX_PIPELINE ) { +DRM_ERROR ("d71 supports %d pipelines, but got: %d.\n" , +D71_MAX_PIPELINE , d71->num_pipelines); + goto err_cleanup; + } + +/* probe PERIPH */ + value =malidp_read32 (d71->periph_addr,BLK_BLOCK_INFO ); +if (BLOCK_INFO_BLK_TYPE (value) !=D71_BLK_TYPE_PERIPH ) { +DRM_ERROR ("access blk periph but got blk: %d.\n" , +BLOCK_INFO_BLK_TYPE (value)); + goto err_cleanup; + } + + value =malidp_read32 (d71->periph_addr,PERIPH_CONFIGURATION_ID ); + + d71->max_line_size = value &PERIPH_MAX_LINE_SIZE ?4096 :2048 ; + d71->max_vsize =4096 ; + d71->num_rich_layers = value &PERIPH_NUM_RICH_LAYERS ?2 :1 ; + d71->supports_dual_link = value &PERIPH_SPLIT_EN ? true : false; + d71->integrates_tbu = value &PERIPH_TBU_EN ? true : false; + +for (i =0 ; i < d71->num_pipelines; i++) { + pipe =komeda_pipeline_add (mdev,sizeof (struct d71_pipeline ), +NULL ); +if (!pipe) + goto err_cleanup; + + d71->pipes[i] =to_d71_pipeline (pipe); + } + +/* loop the register blks and probe */ + i =2 ;/* exclude GCU and PERIPH */ + offset =D71_BLOCK_SIZE ;/* skip GCU */ +while (i < d71->num_blocks) { + blk_base = mdev->reg_base + (offset >>2 ); + +d71_read_block_header (blk_base, &blk); +if (BLOCK_INFO_BLK_TYPE (blk.block_info) !=D71_BLK_TYPE_RESERVED ) { +if (d71_probe_block (d71, &blk, blk_base)) + goto err_cleanup; + i++; + } + + offset +=D71_BLOCK_SIZE ;
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c line 133
Quoted 10 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +9
-0+ } + +DRM_INFO ("total %d (out of %d) blocks are found.\n" , + i, d71->num_blocks); + +return 0 ; + +err_cleanup: +d71_cleanup (mdev);return -1 ;
-1 isn't a useful error code, and you return -ENOMEM if allocation fails. It would probably be better to return proper codes everywhere (e.g. you might get -EINVAL back from d71_probe_block, but you don't propagate it).
-- snip --
Ok, will fix it in the next version.
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h
Quoted 5 lines
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h new file +0
-0
...
> +
> +/* Image process registers */
> +#define IPS_DEPTH 0x0D8
> +#define IPS_RGB_RGB_COEFF0 0x130
> +#define IPS_RGB_YUV_COEFF0 0x170
> +
> +#define IPS_DEPTH_MARK 0xF
s/MARK/MASK/
Cheers,
-Brian_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 2/7 drm/komeda: Add d71 layer
In reply to james qian wang (Arm Technology China)1. Add detailed layer/layer_state definitions
2. Add d71_layer_init to report layer features and capabilities according to D71 layer block.
3. Add d71_layer_updat/disable
--- .../drm/arm/display/include/malidp_utils.h | 17 ++ .../arm/display/komeda/d71/d71_component.c | 162 +++++++++++++++++- .../drm/arm/display/komeda/komeda_pipeline.c | 2 +- .../drm/arm/display/komeda/komeda_pipeline.h | 10 +- 4 files changed, 186 insertions(+), 5 deletions(-)
drivers/gpu/drm/arm/display/include/malidp_utils.h +17 -0
@@ -25,4 +25,21 @@ num_tries; \ }) +/* the restriction of range is [start, end] */ +struct malidp_range { +u32 start; +u32 end; +}; + +static inline void set_range (struct malidp_range *rg,u32 start,u32 end) +{ + rg->start = start; + rg->end = end; +} + +static inline bool in_range (struct malidp_range *rg,u32 v) +{ +return (v >= rg->start) && (v <= rg->end); +} +#endif /* _MALIDP_UTILS_ */
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +161 -1
172 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c +1 -1
@@ -146,7 +146,7 @@ komeda_component_add(struct komeda_pipeline *pipe, } pos =komeda_pipeline_get_component_pos (pipe, id); -if (!pos || !(*pos)) +if (!pos || (*pos))return NULL ;if (has_bit (id,KOMEDA_PIPELINE_LAYERS )) {
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +7 -3
@@ -209,16 +209,20 @@ static inline u16 component_changed_inputs(struct komeda_component_state *st)#define to_comp (__c) (((__c) == NULL) ? NULL : &((__c)->base))#define to_cpos (__c) ((struct komeda_component **)&(__c)) -/* these structures are going to be filled in in uture patches */ struct komeda_layer {struct komeda_component base; -/* layer specific features and caps */ -int layer_type;/* RICH, SIMPLE or WB */ +/* accepted h/v input range before rotation */ +struct malidp_range hsize_in, vsize_in; +u32 layer_type;/* RICH, SIMPLE or WB */ +u32 supported_rots; };struct komeda_layer_state {struct komeda_component_state base;/* layer specific configuration state */ +u16 hsize, vsize; +u32 rot; +dma_addr_t addr[3 ]; };struct komeda_compiz {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 3/7 arm/komeda: Add d71 compiz component
In reply to james qian wang (Arm Technology China)Implement d71_compiz_init and add compiz component to komeda-CORE
--- .../arm/display/komeda/d71/d71_component.c | 95 ++++++++++++++++++- .../drm/arm/display/komeda/komeda_pipeline.h | 26 +++-- 2 files changed, 113 insertions(+), 8 deletions(-)
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +94 -1
@@ -96,6 +96,14 @@ static u32 to_rot_ctrl(u32 rot)return lr_ctrl; } +static inline u32 +to_d71_input_id (struct komeda_component_output *output) +{ +struct komeda_component *comp = output->component; + +return comp ? (comp->hw_id + output->output_port) :0 ; +} +static void d71_layer_disable (struct komeda_component *c) {malidp_write32_mask (c->reg,BLK_CONTROL ,L_EN ,0 );
@@ -184,10 +192,95 @@ static int d71_wb_layer_init(struct d71_dev *d71,return 0 ; } +static void d71_component_disable (struct komeda_component *c) +{ +u32 __iomem *reg = c->reg; +u32 i; + +malidp_write32 (reg,BLK_CONTROL ,0 ); + +for (i =0 ; i < c->max_active_inputs; i++) +malidp_write32 (reg,BLK_INPUT_ID0 + (i <<2 ),0 ); +} + +static void compiz_enable_input (u32 __iomem *id_reg, +u32 __iomem *cfg_reg, +u32 input_hw_id, +struct komeda_compiz_input_cfg *cin) +{ +u32 ctrl =CU_INPUT_CTRL_EN ; +u8 blend = cin->pixel_blend_mode; + +if (blend ==DRM_MODE_BLEND_PIXEL_NONE ) + ctrl |=CU_INPUT_CTRL_PAD ; +else if (blend ==DRM_MODE_BLEND_PREMULTI ) + ctrl |=CU_INPUT_CTRL_PMUL ; + + ctrl |=CU_INPUT_CTRL_ALPHA (cin->layer_alpha); + +malidp_write32 (id_reg,BLK_INPUT_ID0 , input_hw_id); + +malidp_write32 (cfg_reg,CU_INPUT0_SIZE , +HV_SIZE (cin->hsize, cin->vsize)); +malidp_write32 (cfg_reg,CU_INPUT0_OFFSET , +HV_OFFSET (cin->hoffset, cin->voffset)); +malidp_write32 (cfg_reg,CU_INPUT0_CONTROL , ctrl); +} + +static void d71_compiz_update (struct komeda_component *c, +struct komeda_component_state *state) +{ +struct komeda_compiz_state *st =to_compiz_st (state); +u32 __iomem *reg = c->reg; +u32 __iomem *id_reg, *cfg_reg; +u32 index, input_hw_id; + +for_each_changed_input (state, index) { + id_reg = reg + index; + cfg_reg = reg + index *CU_PER_INPUT_REGS ; + input_hw_id =to_d71_input_id (&state->inputs[index]); +if (state->active_inputs &BIT (index)) { +compiz_enable_input (id_reg, cfg_reg, + input_hw_id, &st->cins[index]); + }else { +malidp_write32 (id_reg,BLK_INPUT_ID0 ,0 ); +malidp_write32 (cfg_reg,CU_INPUT0_CONTROL ,0 ); + } + } + +malidp_write32 (reg,BLK_SIZE ,HV_SIZE (st->hsize, st->vsize)); +} + +struct komeda_component_funcs d71_compiz_funcs = { + .update = d71_compiz_update, + .disable = d71_component_disable, +}; +static int d71_compiz_init (struct d71_dev *d71,struct block_header *blk,u32 __iomem *reg) { -DRM_INFO ("Detect D71_compiz.\n" ); +struct komeda_component *c; +struct komeda_compiz *compiz; +u32 blk_id =BLOCK_INFO_BLK_ID (blk->block_info); +u32 pipe_id, comp_id; + +get_resources_id (blk->block_info, &pipe_id, &comp_id); + + c =komeda_component_add (&d71->pipes[pipe_id]->base,sizeof (*compiz), + comp_id, +BLOCK_INFO_INPUT_ID (blk->block_info), + &d71_compiz_funcs, +CU_NUM_INPUT_IDS ,get_valid_inputs (blk), +CU_NUM_OUTPUT_IDS , reg, +"CU%d" , blk_id); + +if (!c) +return -1 ; + + compiz =to_compiz (c); + +set_range (&compiz->hsize,D71_MIN_LINE_SIZE , d71->max_line_size); +set_range (&compiz->vsize,D71_MIN_VERTICAL_SIZE , d71->max_vsize);return 0 ; }
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +19 -7
@@ -206,6 +206,10 @@ static inline u16 component_changed_inputs(struct komeda_component_state *st)return component_disabling_inputs (st) | st->changed_active_inputs; } +#define for_each_changed_input (st, i) \ + for ((i) = 0; (i) < (st)->component->max_active_inputs; (i)++) \ + if (has_bit((i), component_changed_inputs(st))) +#define to_comp (__c) (((__c) == NULL) ? NULL : &((__c)->base))#define to_cpos (__c) ((struct komeda_component **)&(__c))
@@ -225,23 +229,31 @@ struct komeda_layer_state {dma_addr_t addr[3 ]; }; -struct komeda_compiz { +struct komeda_scaler {struct komeda_component base; -/* compiz specific features and caps */ +/* scaler features and caps */ }; -struct komeda_compiz_state { +struct komeda_scaler_state {struct komeda_component_state base; -/* compiz specific configuration state */ }; -struct komeda_scaler { +struct komeda_compiz {struct komeda_component base; -/* scaler features and caps */ +struct malidp_range hsize, vsize; }; -struct komeda_scaler_state { +struct komeda_compiz_input_cfg { +u16 hsize, vsize; +u16 hoffset, voffset; +u8 pixel_blend_mode, layer_alpha; +}; + +struct komeda_compiz_state {struct komeda_component_state base; +/* composition size */ +u16 hsize, vsize; +struct komeda_compiz_input_cfg cins[KOMEDA_COMPONENT_N_INPUTS ]; };struct komeda_improc {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 4/7 drm/komeda: Add D71 improc and timing_ctrlr
In reply to james qian wang (Arm Technology China)Add and initialize improc and timing_ctrlr according to D71 capablitites
--- .../arm/display/komeda/d71/d71_component.c | 108 +++++++++++++++++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 2 + .../drm/arm/display/komeda/komeda_pipeline.h | 7 ++ 3 files changed, 115 insertions(+), 2 deletions(-)
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +106 -2
@@ -285,18 +285,122 @@ static int d71_compiz_init(struct d71_dev *d71,return 0 ; } +static void d71_improc_update (struct komeda_component *c, +struct komeda_component_state *state) +{ +struct komeda_improc_state *st =to_improc_st (state); +u32 __iomem *reg = c->reg; +u32 index, input_hw_id; + +for_each_changed_input (state, index) { + input_hw_id = state->active_inputs &BIT (index) ? +to_d71_input_id (&state->inputs[index]) :0 ; +malidp_write32 (reg,BLK_INPUT_ID0 + index *4 , input_hw_id); + } + +malidp_write32 (reg,BLK_SIZE ,HV_SIZE (st->hsize, st->vsize)); +} + +struct komeda_component_funcs d71_improc_funcs = { + .update = d71_improc_update, + .disable = d71_component_disable, +}; +static int d71_improc_init (struct d71_dev *d71,struct block_header *blk,u32 __iomem *reg) { -DRM_INFO ("Detect D71_improc.\n" ); +struct komeda_component *c; +struct komeda_improc *improc; +u32 blk_id =BLOCK_INFO_BLK_ID (blk->block_info); +u32 value; + + c =komeda_component_add (&d71->pipes[blk_id]->base,sizeof (*improc), +KOMEDA_COMPONENT_IPS0 + blk_id, +BLOCK_INFO_INPUT_ID (blk->block_info), + &d71_improc_funcs,IPS_NUM_INPUT_IDS , +get_valid_inputs (blk), +IPS_NUM_OUTPUT_IDS , reg,"DOU%d_IPS" , blk_id); +if (!c) { +DRM_ERROR ("Failed to add improc component\n" ); +return -EINVAL ; + } + + improc =to_improc (c); + improc->supported_color_depths =BIT (8 ) |BIT (10 ); + improc->supported_color_formats =DRM_COLOR_FORMAT_RGB444 | +DRM_COLOR_FORMAT_YCRCB444 | +DRM_COLOR_FORMAT_YCRCB422 ; + value =malidp_read32 (reg,BLK_INFO ); +if (value &IPS_INFO_CHD420 ) + improc->supported_color_formats |=DRM_COLOR_FORMAT_YCRCB420 ; + + improc->supports_csc = true; + improc->supports_gamma = true;return 0 ; } +static void d71_timing_ctrlr_disable (struct komeda_component *c) +{ +malidp_write32_mask (c->reg,BLK_CONTROL ,BS_CTRL_EN ,0 ); +} + +static void d71_timing_ctrlr_update (struct komeda_component *c, +struct komeda_component_state *state) +{ +struct drm_crtc_state *crtc_st = state->crtc->state; +u32 __iomem *reg = c->reg; +struct videomode vm; +u32 value; + +drm_display_mode_to_videomode (&crtc_st->adjusted_mode, &vm); + +malidp_write32 (reg,BS_ACTIVESIZE ,HV_SIZE (vm.hactive, vm.vactive)); +malidp_write32 (reg,BS_HINTERVALS ,BS_H_INTVALS (vm.hfront_porch, + vm.hback_porch)); +malidp_write32 (reg,BS_VINTERVALS ,BS_V_INTVALS (vm.vfront_porch, + vm.vback_porch)); + + value =BS_SYNC_VSW (vm.vsync_len) |BS_SYNC_HSW (vm.hsync_len); + value |= vm.flags &DISPLAY_FLAGS_VSYNC_HIGH ?BS_SYNC_VSP :0 ; + value |= vm.flags &DISPLAY_FLAGS_HSYNC_HIGH ?BS_SYNC_HSP :0 ; +malidp_write32 (reg,BS_SYNC , value); + +malidp_write32 (reg,BS_PROG_LINE ,D71_DEFAULT_PREPRETCH_LINE -1 ); +malidp_write32 (reg,BS_PREFETCH_LINE ,D71_DEFAULT_PREPRETCH_LINE ); + +/* configure bs control register */ + value =BS_CTRL_EN |BS_CTRL_VM ; + +malidp_write32 (reg,BLK_CONTROL , value); +} + +struct komeda_component_funcs d71_timing_ctrlr_funcs = { + .update = d71_timing_ctrlr_update, + .disable = d71_timing_ctrlr_disable, +}; +static int d71_timing_ctrlr_init (struct d71_dev *d71,struct block_header *blk,u32 __iomem *reg) { -DRM_INFO ("Detect D71_timing_ctrlr.\n" ); +struct komeda_component *c; +struct komeda_timing_ctrlr *ctrlr; +u32 blk_id =BLOCK_INFO_BLK_ID (blk->block_info); + + c =komeda_component_add (&d71->pipes[blk_id]->base,sizeof (*ctrlr), +KOMEDA_COMPONENT_TIMING_CTRLR , +BLOCK_INFO_INPUT_ID (blk->block_info), + &d71_timing_ctrlr_funcs, +1 ,BIT (KOMEDA_COMPONENT_IPS0 + blk_id), +BS_NUM_OUTPUT_IDS , reg,"DOU%d_BS" , blk_id); +if (!c) { +DRM_ERROR ("Failed to add display_ctrl component\n" ); +return -EINVAL ; + } + + ctrlr =to_ctrlr (c); + + ctrlr->supports_dual_link = true;return 0 ; }
drivers/gpu/drm/arm/display/komeda/komeda_kms.h +2 -0
@@ -11,6 +11,8 @@#include <drm/drm_atomic_helper.h> #include <drm/drm_crtc_helper.h> #include <drm/drm_writeback.h> +#include <video/videomode.h> +#include <video/display_timing.h> /** struct komeda_plane - komeda instance of drm_plane */ struct komeda_plane {
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +7 -0
@@ -258,15 +258,22 @@ struct komeda_compiz_state {struct komeda_improc {struct komeda_component base; +u32 supported_color_formats;/* DRM_RGB/YUV444/YUV420*/ +u32 supported_color_depths;/* BIT(8) | BIT(10)*/ +u8 supports_degamma :1 ; +u8 supports_csc :1 ; +u8 supports_gamma :1 ; };struct komeda_improc_state {struct komeda_component_state base; +u16 hsize, vsize; };/* display timing controller */ struct komeda_timing_ctrlr {struct komeda_component base; +u8 supports_dual_link :1 ; };struct komeda_timing_ctrlr_state {
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 5/7 drm/komeda: Add komeda_assemble_pipelines
In reply to james qian wang (Arm Technology China)komeda_accemble_pipelines is for:
1. Verifing the component->supported_inputs according to the pipeline->avail_components.
2. Generating component->supported_outputs.
--- .../gpu/drm/arm/display/komeda/komeda_dev.c | 6 ++ .../drm/arm/display/komeda/komeda_pipeline.c | 75 +++++++++++++++++++ .../drm/arm/display/komeda/komeda_pipeline.h | 2 +- 3 files changed, 82 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +6 -0
@@ -152,6 +152,12 @@ struct komeda_dev *komeda_dev_create(struct device *dev) goto err_cleanup; } + err =komeda_assemble_pipelines (mdev); +if (err) { +DRM_ERROR ("assemble display pipelines failed.\n" ); + goto err_cleanup; + } +return mdev; err_cleanup:
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c +75 -0
78 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +1 -1
@@ -365,7 +365,7 @@ komeda_pipeline_add(struct komeda_dev *mdev, size_t size, struct komeda_pipeline_funcs *funcs);void komeda_pipeline_destroy (struct komeda_dev *mdev,struct komeda_pipeline *pipe); - +int komeda_assemble_pipelines (struct komeda_dev *mdev);struct komeda_component *komeda_pipeline_get_component (struct komeda_pipeline *pipe,int id);
Signature · 1 line
2.17.1
PATCH 6/7 drm/komeda: Add irq handling
In reply to james qian wang (Arm Technology China)1. Added irq_handler/irq_enable/irq_disable to komeda_dev_func, then the Komeda-CORE can control the HW irq via these chip function.
2. Install irq and register irq_handler to system by DRM, so once the IRQ coming, the handling sequence is:
komeda_kms_irq_handler(int irq, void *data)
/* step 1. call into the CHIP to recognize event */ mdev->funcs->irq_handler(mdev, &evts); /* step 2. notify the crtc to handle the events */ for (i = 0; i < kms->n_crtcs; i++) komeda_crtc_handle_event(&kms->crtcs[i], &evts);
--- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 237 ++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 18 ++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 43 ++++ .../gpu/drm/arm/display/komeda/komeda_kms.c | 35 ++- .../gpu/drm/arm/display/komeda/komeda_kms.h | 3 + 5 files changed, 335 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +237 -0
@@ -7,6 +7,240 @@#include "d71_dev.h" #include "malidp_io.h" +static u64 get_lpu_event (struct d71_pipeline *d71_pipeline) +{ +u32 __iomem *reg = d71_pipeline->lpu_addr; +u32 status, raw_status; +u64 evts =0ULL ; + + raw_status =malidp_read32 (reg,BLK_IRQ_RAW_STATUS ); +if (raw_status &LPU_IRQ_IBSY ) + evts |=KOMEDA_EVENT_IBSY ; +if (raw_status &LPU_IRQ_EOW ) + evts |=KOMEDA_EVENT_EOW ; + +if (raw_status & (LPU_IRQ_ERR |LPU_IRQ_IBSY )) { +u32 restore =0 , tbu_status; +/* Check error of LPU status */ + status =malidp_read32 (reg,BLK_STATUS ); +if (status &LPU_STATUS_AXIE ) { + restore |=LPU_STATUS_AXIE ; + evts |=KOMEDA_ERR_AXIE ; + } +if (status &LPU_STATUS_ACE0 ) { + restore |=LPU_STATUS_ACE0 ; + evts |=KOMEDA_ERR_ACE0 ; + } +if (status &LPU_STATUS_ACE1 ) { + restore |=LPU_STATUS_ACE1 ; + evts |=KOMEDA_ERR_ACE1 ; + } +if (status &LPU_STATUS_ACE2 ) { + restore |=LPU_STATUS_ACE2 ; + evts |=KOMEDA_ERR_ACE2 ; + } +if (status &LPU_STATUS_ACE3 ) { + restore |=LPU_STATUS_ACE3 ; + evts |=KOMEDA_ERR_ACE3 ; + } +if (restore !=0 ) +malidp_write32_mask (reg,BLK_STATUS , restore,0 ); + + restore =0 ; +/* Check errors of TBU status */ + tbu_status =malidp_read32 (reg,LPU_TBU_STATUS ); +if (tbu_status &LPU_TBU_STATUS_TCF ) { + restore |=LPU_TBU_STATUS_TCF ; + evts |=KOMEDA_ERR_TCF ; + } +if (tbu_status &LPU_TBU_STATUS_TTNG ) { + restore |=LPU_TBU_STATUS_TTNG ; + evts |=KOMEDA_ERR_TTNG ; + } +if (tbu_status &LPU_TBU_STATUS_TITR ) { + restore |=LPU_TBU_STATUS_TITR ; + evts |=KOMEDA_ERR_TITR ; + } +if (tbu_status &LPU_TBU_STATUS_TEMR ) { + restore |=LPU_TBU_STATUS_TEMR ; + evts |=KOMEDA_ERR_TEMR ; + } +if (tbu_status &LPU_TBU_STATUS_TTF ) { + restore |=LPU_TBU_STATUS_TTF ; + evts |=KOMEDA_ERR_TTF ; + } +if (restore !=0 ) +malidp_write32_mask (reg,LPU_TBU_STATUS , restore,0 ); + } + +malidp_write32 (reg,BLK_IRQ_CLEAR , raw_status); +return evts; +} + +static u64 get_cu_event (struct d71_pipeline *d71_pipeline) +{ +u32 __iomem *reg = d71_pipeline->cu_addr; +u32 status, raw_status; +u64 evts =0ULL ; + + raw_status =malidp_read32 (reg,BLK_IRQ_RAW_STATUS ); +if (raw_status &CU_IRQ_OVR ) + evts |=KOMEDA_EVENT_OVR ; + +if (raw_status & (CU_IRQ_ERR |CU_IRQ_OVR )) { + status =malidp_read32 (reg,BLK_STATUS ) &0x7FFFFFFF ; +if (status &CU_STATUS_CPE ) + evts |=KOMEDA_ERR_CPE ; +if (status &CU_STATUS_ZME ) + evts |=KOMEDA_ERR_ZME ; +if (status &CU_STATUS_CFGE ) + evts |=KOMEDA_ERR_CFGE ; +if (status) +malidp_write32_mask (reg,BLK_STATUS , status,0 ); + } + +malidp_write32 (reg,BLK_IRQ_CLEAR , raw_status); + +return evts; +} + +static u64 get_dou_event (struct d71_pipeline *d71_pipeline) +{ +u32 __iomem *reg = d71_pipeline->dou_addr; +u32 status, raw_status; +u64 evts =0ULL ; + + raw_status =malidp_read32 (reg,BLK_IRQ_RAW_STATUS ); +if (raw_status &DOU_IRQ_PL0 ) + evts |=KOMEDA_EVENT_VSYNC ; +if (raw_status &DOU_IRQ_UND ) + evts |=KOMEDA_EVENT_URUN ; + +if (raw_status & (DOU_IRQ_ERR |DOU_IRQ_UND )) { +u32 restore =0 ; + + status =malidp_read32 (reg,BLK_STATUS ); +if (status &DOU_STATUS_DRIFTTO ) { + restore |=DOU_STATUS_DRIFTTO ; + evts |=KOMEDA_ERR_DRIFTTO ; + } +if (status &DOU_STATUS_FRAMETO ) { + restore |=DOU_STATUS_FRAMETO ; + evts |=KOMEDA_ERR_FRAMETO ; + } +if (status &DOU_STATUS_TETO ) { + restore |=DOU_STATUS_TETO ; + evts |=KOMEDA_ERR_TETO ; + } +if (status &DOU_STATUS_CSCE ) { + restore |=DOU_STATUS_CSCE ; + evts |=KOMEDA_ERR_CSCE ; + } + +if (restore !=0 ) +malidp_write32_mask (reg,BLK_STATUS , restore,0 ); + } + +malidp_write32 (reg,BLK_IRQ_CLEAR , raw_status); +return evts; +} + +static u64 get_pipeline_event (struct d71_pipeline *d71_pipeline,u32 gcu_status) +{ +u32 evts =0ULL ; + +if (gcu_status & (GLB_IRQ_STATUS_LPU0 |GLB_IRQ_STATUS_LPU1 )) + evts |=get_lpu_event (d71_pipeline); + +if (gcu_status & (GLB_IRQ_STATUS_CU0 |GLB_IRQ_STATUS_CU1 )) + evts |=get_cu_event (d71_pipeline); + +if (gcu_status & (GLB_IRQ_STATUS_DOU0 |GLB_IRQ_STATUS_DOU1 )) + evts |=get_dou_event (d71_pipeline); + +return evts; +} + +static irqreturn_t +d71_irq_handler (struct komeda_dev *mdev,struct komeda_events *evts) +{ +struct d71_dev *d71 = mdev->chip_data; +u32 status, gcu_status, raw_status; + + gcu_status =malidp_read32 (d71->gcu_addr,GLB_IRQ_STATUS ); + +if (gcu_status &GLB_IRQ_STATUS_GCU ) { + raw_status =malidp_read32 (d71->gcu_addr,BLK_IRQ_RAW_STATUS ); +if (raw_status &GCU_IRQ_CVAL0 ) + evts->pipes[0 ] |=KOMEDA_EVENT_FLIP ; +if (raw_status &GCU_IRQ_CVAL1 ) + evts->pipes[1 ] |=KOMEDA_EVENT_FLIP ; +if (raw_status &GCU_IRQ_ERR ) { + status =malidp_read32 (d71->gcu_addr,BLK_STATUS ); +if (status &GCU_STATUS_MERR ) { + evts->global |=KOMEDA_ERR_MERR ; +malidp_write32_mask (d71->gcu_addr,BLK_STATUS , +GCU_STATUS_MERR ,0 ); + } + } + +malidp_write32 (d71->gcu_addr,BLK_IRQ_CLEAR , raw_status); + } + +if (gcu_status &GLB_IRQ_STATUS_PIPE0 ) + evts->pipes[0 ] |=get_pipeline_event (d71->pipes[0 ], gcu_status); + +if (gcu_status &GLB_IRQ_STATUS_PIPE1 ) + evts->pipes[1 ] |=get_pipeline_event (d71->pipes[1 ], gcu_status); + +return gcu_status ?IRQ_HANDLED :IRQ_NONE ; +} + +#define ENABLED_GCU_IRQS (GCU_IRQ_CVAL0 | GCU_IRQ_CVAL1 | \ + GCU_IRQ_MODE | GCU_IRQ_ERR) +#define ENABLED_LPU_IRQS (LPU_IRQ_IBSY | LPU_IRQ_ERR | LPU_IRQ_EOW) +#define ENABLED_CU_IRQS (CU_IRQ_OVR | CU_IRQ_ERR) +#define ENABLED_DOU_IRQS (DOU_IRQ_UND | DOU_IRQ_ERR) + +static int d71_enable_irq (struct komeda_dev *mdev) +{ +struct d71_dev *d71 = mdev->chip_data; +struct d71_pipeline *pipe; +u32 i; + +malidp_write32_mask (d71->gcu_addr,BLK_IRQ_MASK , +ENABLED_GCU_IRQS ,ENABLED_GCU_IRQS ); +for (i =0 ; i < d71->num_pipelines; i++) { + pipe = d71->pipes[i]; +malidp_write32_mask (pipe->cu_addr,BLK_IRQ_MASK , +ENABLED_CU_IRQS ,ENABLED_CU_IRQS ); +malidp_write32_mask (pipe->lpu_addr,BLK_IRQ_MASK , +ENABLED_LPU_IRQS ,ENABLED_LPU_IRQS ); +malidp_write32_mask (pipe->dou_addr,BLK_IRQ_MASK , +ENABLED_DOU_IRQS ,ENABLED_DOU_IRQS ); + } +return 0 ; +} + +static int d71_disable_irq (struct komeda_dev *mdev) +{ +struct d71_dev *d71 = mdev->chip_data; +struct d71_pipeline *pipe; +u32 i; + +malidp_write32_mask (d71->gcu_addr,BLK_IRQ_MASK ,ENABLED_GCU_IRQS ,0 ); +for (i =0 ; i < d71->num_pipelines; i++) { + pipe = d71->pipes[i]; +malidp_write32_mask (pipe->cu_addr,BLK_IRQ_MASK , +ENABLED_CU_IRQS ,0 ); +malidp_write32_mask (pipe->lpu_addr,BLK_IRQ_MASK , +ENABLED_LPU_IRQS ,0 ); +malidp_write32_mask (pipe->dou_addr,BLK_IRQ_MASK , +ENABLED_DOU_IRQS ,0 ); + } +return 0 ; +} +static int d71_reset (struct d71_dev *d71) {u32 __iomem *gcu = d71->gcu_addr;
@@ -214,6 +448,9 @@ static struct komeda_dev_funcs d71_chip_funcs = { .init_format_table = d71_init_fmt_tbl, .enum_resources = d71_enum_resources, .cleanup = d71_cleanup, + .irq_handler = d71_irq_handler, + .enable_irq = d71_enable_irq, + .disable_irq = d71_disable_irq, }; struct komeda_dev_funcs *
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +18 -0
@@ -14,6 +14,24 @@#include "komeda_dev.h" #include "komeda_kms.h" +void komeda_crtc_handle_event (struct komeda_crtc *kcrtc, +struct komeda_events *evts) +{ +struct drm_crtc *crtc = &kcrtc->base; +u32 events = evts->pipes[kcrtc->master->id]; + +if (events &KOMEDA_EVENT_VSYNC ) +drm_crtc_handle_vblank (crtc); + +/* will handle it together with the write back support */ +if (events &KOMEDA_EVENT_EOW ) +DRM_INFO ("EOW.\n" ); + +/* will handle it with crtc->flush */ +if (events &KOMEDA_EVENT_FLIP ) +DRM_INFO ("FLIP Done.\n" ); +} +struct drm_crtc_helper_funcs komeda_crtc_helper_funcs = { };
drivers/gpu/drm/arm/display/komeda/komeda_dev.h +43 -0
61 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_kms.c +34 -1
@@ -29,10 +29,31 @@ static int komeda_gem_cma_dumb_create(struct drm_file *file,return drm_gem_cma_dumb_create_internal (file, dev, args); } +static irqreturn_t komeda_kms_irq_handler (int irq,void *data) +{ +struct drm_device *drm = data; +struct komeda_dev *mdev = drm->dev_private; +struct komeda_kms_dev *kms =to_kdev (drm); +struct komeda_events evts; +irqreturn_t status; +u32 i; + +/* Call into the CHIP to recognize events */ +memset (&evts,0 ,sizeof (evts)); + status = mdev->funcs->irq_handler (mdev, &evts); + +/* Notify the crtc to handle the events */ +for (i =0 ; i < kms->n_crtcs; i++) +komeda_crtc_handle_event (&kms->crtcs[i], &evts); + +return status; +} +static struct drm_driver komeda_kms_driver = { .driver_features =DRIVER_GEM |DRIVER_MODESET |DRIVER_ATOMIC | -DRIVER_PRIME , +DRIVER_PRIME |DRIVER_HAVE_IRQ |DRIVER_IRQ_SHARED , .lastclose = drm_fb_helper_lastclose, + .irq_handler = komeda_kms_irq_handler, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = komeda_gem_cma_dumb_create,
@@ -140,12 +161,22 @@ struct komeda_kms_dev *komeda_kms_attach(struct komeda_dev *mdev)drm_mode_config_reset (drm); + err =drm_irq_install (drm, mdev->irq); +if (err) + goto cleanup_mode_config; + err =drm_dev_register (drm,0 );if (err) goto uninstall_irq; + err = mdev->funcs->enable_irq (mdev); +if (err) + goto unregister_dev; +return kms; +unregister_dev: +drm_dev_unregister (drm); uninstall_irq:drm_irq_uninstall (drm); cleanup_mode_config:
@@ -160,7 +191,9 @@ void komeda_kms_detach(struct komeda_kms_dev *kms)struct drm_device *drm = &kms->base;struct komeda_dev *mdev = drm->dev_private; + mdev->funcs->disable_irq (mdev);drm_dev_unregister (drm); +drm_irq_uninstall (drm);component_unbind_all (mdev->dev, drm);komeda_kms_cleanup_private_objs (mdev);drm_mode_config_cleanup (drm);
drivers/gpu/drm/arm/display/komeda/komeda_kms.h +3 -0
@@ -109,6 +109,9 @@ int komeda_kms_add_private_objs(struct komeda_kms_dev *kms, struct komeda_dev *mdev);void komeda_kms_cleanup_private_objs (struct komeda_dev *mdev); +void komeda_crtc_handle_event (struct komeda_crtc *kcrtc, +struct komeda_events *evts); +struct komeda_kms_dev *komeda_kms_attach (struct komeda_dev *mdev);void komeda_kms_detach (struct komeda_kms_dev *kms);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH 7/7 drm/komeda: Add debugfs node "register" for register dump
In reply to james qian wang (Arm Technology China)Add a debugfs node "register" and entry function dump_register to dev/pipeline/component to register dump, then user can read "/sys/kernel/debug/komeda/register" to get the register values via these chip function.
--- .../arm/display/komeda/d71/d71_component.c | 205 ++++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.c | 52 +++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 5 + .../drm/arm/display/komeda/komeda_pipeline.c | 20 ++ .../drm/arm/display/komeda/komeda_pipeline.h | 3 + 5 files changed, 285 insertions(+)
drivers/gpu/drm/arm/display/komeda/d71/d71_component.c +205 -0
@@ -69,6 +69,42 @@ static u32 get_valid_inputs(struct block_header *blk)return valid_inputs; } +static void get_values_from_reg (void __iomem *reg,u32 offset, +u32 count,u32 *val) +{ +u32 i, addr; + +for (i =0 ; i < count; i++) { + addr = offset + (i <<2 ); +/* 0xA4 is WO register */ +if (addr !=0xA4 ) + val[i] =malidp_read32 (reg, addr); +else + val[i] =0xDEADDEAD ; + } +} + +static void dump_block_header (struct seq_file *sf,void __iomem *reg) +{ +struct block_header hdr; +u32 i, n_input, n_output; + +d71_read_block_header (reg, &hdr); +seq_printf (sf,"BLOCK_INFO:\t\t0x%X\n" , hdr.block_info); +seq_printf (sf,"PIPELINE_INFO:\t\t0x%X\n" , hdr.pipeline_info); + + n_output =PIPELINE_INFO_N_OUTPUTS (hdr.pipeline_info); + n_input =PIPELINE_INFO_N_VALID_INPUTS (hdr.pipeline_info); + +for (i =0 ; i < n_input; i++) +seq_printf (sf,"VALID_INPUT_ID%u:\t0x%X\n" , + i, hdr.input_ids[i]); + +for (i =0 ; i < n_output; i++) +seq_printf (sf,"OUTPUT_ID%u:\t\t0x%X\n" , + i, hdr.output_ids[i]); +} +static u32 to_rot_ctrl (u32 rot) {u32 lr_ctrl =0 ;
@@ -142,9 +178,76 @@ static void d71_layer_update(struct komeda_component *c,malidp_write32_mask (reg,BLK_CONTROL , ctrl_mask, ctrl); } +static void d71_layer_dump (struct komeda_component *c,struct seq_file *sf) +{ +u32 v[15 ], i; +bool rich, rgb2rgb; +char *prefix; + +get_values_from_reg (c->reg,LAYER_INFO ,1 , &v[14 ]); +if (v[14 ] &0x1 ) { + rich = true; + prefix ="LR_" ; + }else { + rich = false; + prefix ="LS_" ; + } + + rgb2rgb = !!(v[14 ] &L_INFO_CM ); + +dump_block_header (sf, c->reg); + +seq_printf (sf,"%sLAYER_INFO:\t\t0x%X\n" , prefix, v[14 ]); + +get_values_from_reg (c->reg,0xD0 ,1 , v); +seq_printf (sf,"%sCONTROL:\t\t0x%X\n" , prefix, v[0 ]); +if (rich) { +get_values_from_reg (c->reg,0xD4 ,1 , v); +seq_printf (sf,"LR_RICH_CONTROL:\t0x%X\n" , v[0 ]); + } +get_values_from_reg (c->reg,0xD8 ,4 , v); +seq_printf (sf,"%sFORMAT:\t\t0x%X\n" , prefix, v[0 ]); +seq_printf (sf,"%sIT_COEFFTAB:\t\t0x%X\n" , prefix, v[1 ]); +seq_printf (sf,"%sIN_SIZE:\t\t0x%X\n" , prefix, v[2 ]); +seq_printf (sf,"%sPALPHA:\t\t0x%X\n" , prefix, v[3 ]); + +get_values_from_reg (c->reg,0x100 ,3 , v); +seq_printf (sf,"%sP0_PTR_LOW:\t\t0x%X\n" , prefix, v[0 ]); +seq_printf (sf,"%sP0_PTR_HIGH:\t\t0x%X\n" , prefix, v[1 ]); +seq_printf (sf,"%sP0_STRIDE:\t\t0x%X\n" , prefix, v[2 ]); + +get_values_from_reg (c->reg,0x110 ,2 , v); +seq_printf (sf,"%sP1_PTR_LOW:\t\t0x%X\n" , prefix, v[0 ]); +seq_printf (sf,"%sP1_PTR_HIGH:\t\t0x%X\n" , prefix, v[1 ]); +if (rich) { +get_values_from_reg (c->reg,0x118 ,1 , v); +seq_printf (sf,"LR_P1_STRIDE:\t\t0x%X\n" , v[0 ]); + +get_values_from_reg (c->reg,0x120 ,2 , v); +seq_printf (sf,"LR_P2_PTR_LOW:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"LR_P2_PTR_HIGH:\t\t0x%X\n" , v[1 ]); + +get_values_from_reg (c->reg,0x130 ,12 , v); +for (i =0 ; i <12 ; i++) +seq_printf (sf,"LR_YUV_RGB_COEFF%u:\t0x%X\n" , i, v[i]); + } + +if (rgb2rgb) { +get_values_from_reg (c->reg,LAYER_RGB_RGB_COEFF0 ,12 , v); +for (i =0 ; i <12 ; i++) +seq_printf (sf,"LS_RGB_RGB_COEFF%u:\t0x%X\n" , i, v[i]); + } + +get_values_from_reg (c->reg,0x160 ,3 , v); +seq_printf (sf,"%sAD_CONTROL:\t\t0x%X\n" , prefix, v[0 ]); +seq_printf (sf,"%sAD_H_CROP:\t\t0x%X\n" , prefix, v[1 ]); +seq_printf (sf,"%sAD_V_CROP:\t\t0x%X\n" , prefix, v[2 ]); +} +struct komeda_component_funcs d71_layer_funcs = { .update = d71_layer_update, .disable = d71_layer_disable, + .dump_register = d71_layer_dump, }; static int d71_layer_init(struct d71_dev *d71,
@@ -251,9 +354,46 @@ static void d71_compiz_update(struct komeda_component *c,malidp_write32 (reg,BLK_SIZE ,HV_SIZE (st->hsize, st->vsize)); } +static void d71_compiz_dump (struct komeda_component *c,struct seq_file *sf) +{ +u32 v[8 ], i; + +dump_block_header (sf, c->reg); + +get_values_from_reg (c->reg,0x80 ,5 , v); +for (i =0 ; i <5 ; i++) +seq_printf (sf,"CU_INPUT_ID%u:\t\t0x%X\n" , i, v[i]); + +get_values_from_reg (c->reg,0xA0 ,5 , v); +seq_printf (sf,"CU_IRQ_RAW_STATUS:\t0x%X\n" , v[0 ]); +seq_printf (sf,"CU_IRQ_CLEAR:\t\t0x%X\n" , v[1 ]); +seq_printf (sf,"CU_IRQ_MASK:\t\t0x%X\n" , v[2 ]); +seq_printf (sf,"CU_IRQ_STATUS:\t\t0x%X\n" , v[3 ]); +seq_printf (sf,"CU_STATUS:\t\t0x%X\n" , v[4 ]); + +get_values_from_reg (c->reg,0xD0 ,2 , v); +seq_printf (sf,"CU_CONTROL:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"CU_SIZE:\t\t0x%X\n" , v[1 ]); + +get_values_from_reg (c->reg,0xDC ,1 , v); +seq_printf (sf,"CU_BG_COLOR:\t\t0x%X\n" , v[0 ]); + +for (i =0 , v[4 ] =0xE0 ; i <5 ; i++, v[4 ] +=0x10 ) { +get_values_from_reg (c->reg, v[4 ],3 , v); +seq_printf (sf,"CU_INPUT%u_SIZE:\t\t0x%X\n" , i, v[0 ]); +seq_printf (sf,"CU_INPUT%u_OFFSET:\t0x%X\n" , i, v[1 ]); +seq_printf (sf,"CU_INPUT%u_CONTROL:\t0x%X\n" , i, v[2 ]); + } + +get_values_from_reg (c->reg,0x130 ,2 , v); +seq_printf (sf,"CU_USER_LOW:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"CU_USER_HIGH:\t\t0x%X\n" , v[1 ]); +} +struct komeda_component_funcs d71_compiz_funcs = { .update = d71_compiz_update, .disable = d71_component_disable, + .dump_register = d71_compiz_dump, }; static int d71_compiz_init(struct d71_dev *d71,
@@ -301,9 +441,37 @@ static void d71_improc_update(struct komeda_component *c,malidp_write32 (reg,BLK_SIZE ,HV_SIZE (st->hsize, st->vsize)); } +static void d71_improc_dump (struct komeda_component *c,struct seq_file *sf) +{ +u32 v[12 ], i; + +dump_block_header (sf, c->reg); + +get_values_from_reg (c->reg,0x80 ,2 , v); +seq_printf (sf,"IPS_INPUT_ID0:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"IPS_INPUT_ID1:\t\t0x%X\n" , v[1 ]); + +get_values_from_reg (c->reg,0xC0 ,1 , v); +seq_printf (sf,"IPS_INFO:\t\t0x%X\n" , v[0 ]); + +get_values_from_reg (c->reg,0xD0 ,3 , v); +seq_printf (sf,"IPS_CONTROL:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"IPS_SIZE:\t\t0x%X\n" , v[1 ]); +seq_printf (sf,"IPS_DEPTH:\t\t0x%X\n" , v[2 ]); + +get_values_from_reg (c->reg,0x130 ,12 , v); +for (i =0 ; i <12 ; i++) +seq_printf (sf,"IPS_RGB_RGB_COEFF%u:\t0x%X\n" , i, v[i]); + +get_values_from_reg (c->reg,0x170 ,12 , v); +for (i =0 ; i <12 ; i++) +seq_printf (sf,"IPS_RGB_YUV_COEFF%u:\t0x%X\n" , i, v[i]); +} +struct komeda_component_funcs d71_improc_funcs = { .update = d71_improc_update, .disable = d71_component_disable, + .dump_register = d71_improc_dump, }; static int d71_improc_init(struct d71_dev *d71,
@@ -375,9 +543,46 @@ static void d71_timing_ctrlr_update(struct komeda_component *c,malidp_write32 (reg,BLK_CONTROL , value); } +void d71_timing_ctrlr_dump (struct komeda_component *c,struct seq_file *sf) +{ +u32 v[8 ], i; + +dump_block_header (sf, c->reg); + +get_values_from_reg (c->reg,0xC0 ,1 , v); +seq_printf (sf,"BS_INFO:\t\t0x%X\n" , v[0 ]); + +get_values_from_reg (c->reg,0xD0 ,8 , v); +seq_printf (sf,"BS_CONTROL:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"BS_PROG_LINE:\t\t0x%X\n" , v[1 ]); +seq_printf (sf,"BS_PREFETCH_LINE:\t0x%X\n" , v[2 ]); +seq_printf (sf,"BS_BG_COLOR:\t\t0x%X\n" , v[3 ]); +seq_printf (sf,"BS_ACTIVESIZE:\t\t0x%X\n" , v[4 ]); +seq_printf (sf,"BS_HINTERVALS:\t\t0x%X\n" , v[5 ]); +seq_printf (sf,"BS_VINTERVALS:\t\t0x%X\n" , v[6 ]); +seq_printf (sf,"BS_SYNC:\t\t0x%X\n" , v[7 ]); + +get_values_from_reg (c->reg,0x100 ,3 , v); +seq_printf (sf,"BS_DRIFT_TO:\t\t0x%X\n" , v[0 ]); +seq_printf (sf,"BS_FRAME_TO:\t\t0x%X\n" , v[1 ]); +seq_printf (sf,"BS_TE_TO:\t\t0x%X\n" , v[2 ]); + +get_values_from_reg (c->reg,0x110 ,3 , v); +for (i =0 ; i <3 ; i++) +seq_printf (sf,"BS_T%u_INTERVAL:\t\t0x%X\n" , i, v[i]); + +get_values_from_reg (c->reg,0x120 ,5 , v); +for (i =0 ; i <2 ; i++) { +seq_printf (sf,"BS_CRC%u_LOW:\t\t0x%X\n" , i, v[i <<1 ]); +seq_printf (sf,"BS_CRC%u_HIGH:\t\t0x%X\n" , i, v[(i <<1 ) +1 ]); + } +seq_printf (sf,"BS_USER:\t\t0x%X\n" , v[4 ]); +} +struct komeda_component_funcs d71_timing_ctrlr_funcs = { .update = d71_timing_ctrlr_update, .disable = d71_timing_ctrlr_disable, + .dump_register = d71_timing_ctrlr_dump, }; static int d71_timing_ctrlr_init(struct d71_dev *d71,
drivers/gpu/drm/arm/display/komeda/komeda_dev.c +52 -0
72 lines not on this page · raw message
drivers/gpu/drm/arm/display/komeda/komeda_dev.h +5 -0
@@ -103,6 +103,9 @@ struct komeda_dev_funcs {int (*enable_irq)(struct komeda_dev *mdev);/** @disable_irq: disable irq */ int (*disable_irq)(struct komeda_dev *mdev); + +/** @dump_register: Optional, dump registers to seq_file */ +void (*dump_register)(struct komeda_dev *mdev,struct seq_file *seq); };/**
@@ -139,6 +142,8 @@ struct komeda_dev {* destroyed by &komeda_dev_funcs.cleanup() */ void *chip_data; + +struct dentry *debugfs_root; }; static inline bool
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c +20 -0
@@ -275,3 +275,23 @@ int komeda_assemble_pipelines(struct komeda_dev *mdev)return 0 ; } + +void komeda_pipeline_dump_register (struct komeda_pipeline *pipe, +struct seq_file *sf) +{ +struct komeda_component *c; +u32 id; + +seq_printf (sf,"\n======== Pipeline-%d ==========\n" , pipe->id); + +if (pipe->funcs && pipe->funcs->dump_register) + pipe->funcs->dump_register (pipe, sf); + +dp_for_each_set_bit (id, pipe->avail_comps) { + c =komeda_pipeline_get_component (pipe, id); + +seq_printf (sf,"\n------%s------\n" , c->name); +if (c->funcs->dump_register) + c->funcs->dump_register (c, sf); + } +}
drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +3 -0
@@ -369,6 +369,9 @@ int komeda_assemble_pipelines(struct komeda_dev *mdev);struct komeda_component *komeda_pipeline_get_component (struct komeda_pipeline *pipe,int id); +void komeda_pipeline_dump_register (struct komeda_pipeline *pipe, +struct seq_file *sf); +/* component APIs */ struct komeda_component * komeda_component_add(struct komeda_pipeline *pipe,
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel