Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/dpu: Add dpu_hw_cwb abstraction for CWB block

The CWB mux has its own registers and set of operations. Add dpu_hw_cwb
abstraction to allow driver to configure the CWB mux.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Jessica Zhang <quic_jesszhan@quicinc.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Patchwork: https://patchwork.freedesktop.org/patch/629254/
Link: https://lore.kernel.org/r/20241216-concurrent-wb-v4-12-fe220297a7f0@quicinc.com
[DB: added #include <linux/bitfield.h>]
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

authored by

Jessica Zhang and committed by
Dmitry Baryshkov
aae87364 675c1edf

+150 -1
+1
drivers/gpu/drm/msm/Makefile
··· 78 78 disp/dpu1/dpu_hw_catalog.o \ 79 79 disp/dpu1/dpu_hw_cdm.o \ 80 80 disp/dpu1/dpu_hw_ctl.o \ 81 + disp/dpu1/dpu_hw_cwb.o \ 81 82 disp/dpu1/dpu_hw_dsc.o \ 82 83 disp/dpu1/dpu_hw_dsc_1_2.o \ 83 84 disp/dpu1/dpu_hw_interrupts.o \
+75
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cwb.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved 4 + */ 5 + 6 + #include <drm/drm_managed.h> 7 + #include "dpu_hw_cwb.h" 8 + 9 + #include <linux/bitfield.h> 10 + 11 + #define CWB_MUX 0x000 12 + #define CWB_MODE 0x004 13 + 14 + /* CWB mux block bit definitions */ 15 + #define CWB_MUX_MASK GENMASK(3, 0) 16 + #define CWB_MODE_MASK GENMASK(2, 0) 17 + 18 + static void dpu_hw_cwb_config(struct dpu_hw_cwb *ctx, 19 + struct dpu_hw_cwb_setup_cfg *cwb_cfg) 20 + { 21 + struct dpu_hw_blk_reg_map *c = &ctx->hw; 22 + int cwb_mux_cfg = 0xF; 23 + enum dpu_pingpong pp; 24 + enum cwb_mode_input input; 25 + 26 + if (!cwb_cfg) 27 + return; 28 + 29 + input = cwb_cfg->input; 30 + pp = cwb_cfg->pp_idx; 31 + 32 + if (input >= INPUT_MODE_MAX) 33 + return; 34 + 35 + /* 36 + * The CWB_MUX register takes the pingpong index for the real-time 37 + * display 38 + */ 39 + if ((pp != PINGPONG_NONE) && (pp < PINGPONG_MAX)) 40 + cwb_mux_cfg = FIELD_PREP(CWB_MUX_MASK, pp - PINGPONG_0); 41 + 42 + input = FIELD_PREP(CWB_MODE_MASK, input); 43 + 44 + DPU_REG_WRITE(c, CWB_MUX, cwb_mux_cfg); 45 + DPU_REG_WRITE(c, CWB_MODE, input); 46 + } 47 + 48 + /** 49 + * dpu_hw_cwb_init() - Initializes the writeback hw driver object with cwb. 50 + * @dev: Corresponding device for devres management 51 + * @cfg: wb_path catalog entry for which driver object is required 52 + * @addr: mapped register io address of MDP 53 + * Return: Error code or allocated dpu_hw_wb context 54 + */ 55 + struct dpu_hw_cwb *dpu_hw_cwb_init(struct drm_device *dev, 56 + const struct dpu_cwb_cfg *cfg, 57 + void __iomem *addr) 58 + { 59 + struct dpu_hw_cwb *c; 60 + 61 + if (!addr) 62 + return ERR_PTR(-EINVAL); 63 + 64 + c = drmm_kzalloc(dev, sizeof(*c), GFP_KERNEL); 65 + if (!c) 66 + return ERR_PTR(-ENOMEM); 67 + 68 + c->hw.blk_addr = addr + cfg->base; 69 + c->hw.log_mask = DPU_DBG_MASK_CWB; 70 + 71 + c->idx = cfg->id; 72 + c->ops.config_cwb = dpu_hw_cwb_config; 73 + 74 + return c; 75 + }
+70
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_cwb.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved 4 + */ 5 + 6 + #ifndef _DPU_HW_CWB_H 7 + #define _DPU_HW_CWB_H 8 + 9 + #include "dpu_hw_util.h" 10 + 11 + struct dpu_hw_cwb; 12 + 13 + enum cwb_mode_input { 14 + INPUT_MODE_LM_OUT, 15 + INPUT_MODE_DSPP_OUT, 16 + INPUT_MODE_MAX 17 + }; 18 + 19 + /** 20 + * struct dpu_hw_cwb_setup_cfg : Describes configuration for CWB mux 21 + * @pp_idx: Index of the real-time pinpong that the CWB mux will 22 + * feed the CWB mux 23 + * @input: Input tap point 24 + */ 25 + struct dpu_hw_cwb_setup_cfg { 26 + enum dpu_pingpong pp_idx; 27 + enum cwb_mode_input input; 28 + }; 29 + 30 + /** 31 + * 32 + * struct dpu_hw_cwb_ops : Interface to the cwb hw driver functions 33 + * @config_cwb: configure CWB mux 34 + */ 35 + struct dpu_hw_cwb_ops { 36 + void (*config_cwb)(struct dpu_hw_cwb *ctx, 37 + struct dpu_hw_cwb_setup_cfg *cwb_cfg); 38 + }; 39 + 40 + /** 41 + * struct dpu_hw_cwb : CWB mux driver object 42 + * @base: Hardware block base structure 43 + * @hw: Block hardware details 44 + * @idx: CWB index 45 + * @ops: handle to operations possible for this CWB 46 + */ 47 + struct dpu_hw_cwb { 48 + struct dpu_hw_blk base; 49 + struct dpu_hw_blk_reg_map hw; 50 + 51 + enum dpu_cwb idx; 52 + 53 + struct dpu_hw_cwb_ops ops; 54 + }; 55 + 56 + /** 57 + * dpu_hw_cwb - convert base object dpu_hw_base to container 58 + * @hw: Pointer to base hardware block 59 + * return: Pointer to hardware block container 60 + */ 61 + static inline struct dpu_hw_cwb *to_dpu_hw_cwb(struct dpu_hw_blk *hw) 62 + { 63 + return container_of(hw, struct dpu_hw_cwb, base); 64 + } 65 + 66 + struct dpu_hw_cwb *dpu_hw_cwb_init(struct drm_device *dev, 67 + const struct dpu_cwb_cfg *cfg, 68 + void __iomem *addr); 69 + 70 + #endif /*_DPU_HW_CWB_H */
+4 -1
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. 2 + /* 3 + * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 + * Copyright (c) 2015-2018, The Linux Foundation. All rights reserved. 3 5 */ 4 6 5 7 #ifndef _DPU_HW_MDSS_H ··· 352 350 #define DPU_DBG_MASK_DSPP (1 << 10) 353 351 #define DPU_DBG_MASK_DSC (1 << 11) 354 352 #define DPU_DBG_MASK_CDM (1 << 12) 353 + #define DPU_DBG_MASK_CWB (1 << 13) 355 354 356 355 /** 357 356 * struct dpu_hw_tear_check - Struct contains parameters to configure