Re: [PATCH v2 08/10] soc: mediatek: cmdq: add polling function
From: Pi-Hsun Shih
Date: Wed Mar 06 2019 - 05:58:59 EST
On Wed, Mar 6, 2019 at 5:51 PM Bibby Hsieh <bibby.hsieh@xxxxxxxxxxxx> wrote:
> diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c
> index d3873ab..71c167c 100644
> --- a/drivers/soc/mediatek/mtk-cmdq-helper.c
> +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c
> @@ -231,6 +231,27 @@ int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event)
> }
> EXPORT_SYMBOL(cmdq_pkt_clear_event);
>
> +int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys,
> + u16 offset, u32 value, u32 mask)
> +{
> + int err;
> +
> + if (mask != 0xffffffff) {
> + err = cmdq_pkt_append_command(pkt, CMDQ_GET_ARG_C(~mask),
> + CMDQ_GET_ARG_B(~mask),
> + 0, 0, 0, 0, 0, CMDQ_CODE_MASK);
All other codes use CMDQ_IMMEDIATE_VALUE instead of 0 for arguments of
cmdq_pkt_append_command. Also use CMDQ_IMMEDIATE_VALUE here?
> +
> + if (err != 0)
> + return err;
> + }
> + offset = offset | 0x1;
> +
> + return cmdq_pkt_append_command(pkt, CMDQ_GET_ARG_C(value),
> + CMDQ_GET_ARG_B(value),
> + offset, subsys, 0, 0, 0, CMDQ_CODE_POLL);
> +}
> +EXPORT_SYMBOL(cmdq_pkt_poll);
> +