Re: [PATCH 10/14] drm/imx: dc-lb: Support getting secondary input selectio

Frank Li
2025-09-19T15:26:57Z

On Fri, Jul 04, 2025 at 05:03:57PM +0800, Liu Ying wrote:
> Add a helper to get LayerBlend secondary input selection. This is
> needed by disabling CRTC at boot in an upcoming commit which tries
> to get the selection.
>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>

Reviewed-by: Frank Li <Frank.Li@nxp.com>

> ---
> drivers/gpu/drm/imx/dc/dc-lb.c | 21 +++++++++++++++++++++
> drivers/gpu/drm/imx/dc/dc-pe.h | 1 +
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/gpu/drm/imx/dc/dc-lb.c b/drivers/gpu/drm/imx/dc/dc-lb.c
> index 38f966625d382487e45c2e0c202e15c1417f6e65..b0f3fb818799b58597e8ae41d868338c3fd40800 100644
> --- a/drivers/gpu/drm/imx/dc/dc-lb.c
> +++ b/drivers/gpu/drm/imx/dc/dc-lb.c
> @@ -23,6 +23,8 @@
> #define PIXENGCFG_DYNAMIC_SEC_SEL_MASK GENMASK(13, 8)
> #define PIXENGCFG_DYNAMIC_SEC_SEL(x) \
> FIELD_PREP(PIXENGCFG_DYNAMIC_SEC_SEL_MASK, (x))
> +#define PIXENGCFG_DYNAMIC_SEC_SEL_GET(x) \
> + FIELD_GET(PIXENGCFG_DYNAMIC_SEC_SEL_MASK, (x))
>
> #define STATICCONTROL 0x8
> #define SHDTOKSEL_MASK GENMASK(4, 3)
> @@ -182,6 +184,25 @@ void dc_lb_pec_dynamic_sec_sel(struct dc_lb *lb, enum dc_link_id sec)
> dev_warn(lb->dev, "invalid secondary input selection:%d\n", sec);
> }
>
> +int dc_lb_pec_dynamic_sec_sel_get(struct dc_lb *lb, enum dc_link_id *sec)
> +{
> + u32 val;
> +
> + regmap_read(lb->reg_pec, PIXENGCFG_DYNAMIC, &val);
> + val = PIXENGCFG_DYNAMIC_SEC_SEL_GET(val);
> +
> + switch (val) {
> + case LINK_ID_NONE:
> + case LINK_ID_FETCHWARP2:
> + case LINK_ID_FETCHLAYER0:
> + *sec = val;
> + dev_dbg(lb->dev, "get secondary input selection: 0x%02x\n", val);
> + return 0;
> + default:
> + return -EINVAL;
> + }
> +}
> +
> void dc_lb_pec_clken(struct dc_lb *lb, enum dc_pec_clken clken)
> {
> regmap_write_bits(lb->reg_pec, PIXENGCFG_DYNAMIC, CLKEN_MASK,
> diff --git a/drivers/gpu/drm/imx/dc/dc-pe.h b/drivers/gpu/drm/imx/dc/dc-pe.h
> index 0b81dc6b251c452e7ca72f1cd12af065bafaa198..4e38aead69bce6e9ad4cf2a7cd1fedbaeda60650 100644
> --- a/drivers/gpu/drm/imx/dc/dc-pe.h
> +++ b/drivers/gpu/drm/imx/dc/dc-pe.h
> @@ -93,6 +93,7 @@ void dc_ed_init(struct dc_ed *ed);
> enum dc_link_id dc_lb_get_link_id(struct dc_lb *lb);
> void dc_lb_pec_dynamic_prim_sel(struct dc_lb *lb, enum dc_link_id prim);
> void dc_lb_pec_dynamic_sec_sel(struct dc_lb *lb, enum dc_link_id sec);
> +int dc_lb_pec_dynamic_sec_sel_get(struct dc_lb *lb, enum dc_link_id *sec);
> void dc_lb_pec_clken(struct dc_lb *lb, enum dc_pec_clken clken);
> void dc_lb_mode(struct dc_lb *lb, enum dc_lb_mode mode);
> void dc_lb_position(struct dc_lb *lb, int x, int y);
>
> --
> 2.34.1
>