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

soc: mediatek: cmdq: add set event function

Add set event function in cmdq helper functions to set specific event.

Signed-off-by: Dennis YC Hsieh <dennis-yc.hsieh@mediatek.com>
Link: https://lore.kernel.org/r/1592749115-24158-12-git-send-email-dennis-yc.hsieh@mediatek.com
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>

authored by

Dennis YC Hsieh and committed by
Matthias Brugger
7de796ca 99581858

+25
+15
drivers/soc/mediatek/mtk-cmdq-helper.c
··· 253 253 } 254 254 EXPORT_SYMBOL(cmdq_pkt_clear_event); 255 255 256 + int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event) 257 + { 258 + struct cmdq_instruction inst = {}; 259 + 260 + if (event >= CMDQ_MAX_EVENT) 261 + return -EINVAL; 262 + 263 + inst.op = CMDQ_CODE_WFE; 264 + inst.value = CMDQ_WFE_UPDATE | CMDQ_WFE_UPDATE_VALUE; 265 + inst.event = event; 266 + 267 + return cmdq_pkt_append_command(pkt, inst); 268 + } 269 + EXPORT_SYMBOL(cmdq_pkt_set_event); 270 + 256 271 int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys, 257 272 u16 offset, u32 value) 258 273 {
+1
include/linux/mailbox/mtk-cmdq-mailbox.h
··· 17 17 #define CMDQ_JUMP_PASS CMDQ_INST_SIZE 18 18 19 19 #define CMDQ_WFE_UPDATE BIT(31) 20 + #define CMDQ_WFE_UPDATE_VALUE BIT(16) 20 21 #define CMDQ_WFE_WAIT BIT(15) 21 22 #define CMDQ_WFE_WAIT_VALUE 0x1 22 23
+9
include/linux/soc/mediatek/mtk-cmdq.h
··· 121 121 int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event); 122 122 123 123 /** 124 + * cmdq_pkt_set_event() - append set event command to the CMDQ packet 125 + * @pkt: the CMDQ packet 126 + * @event: the desired event to be set 127 + * 128 + * Return: 0 for success; else the error code is returned 129 + */ 130 + int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event); 131 + 132 + /** 124 133 * cmdq_pkt_poll() - Append polling command to the CMDQ packet, ask GCE to 125 134 * execute an instruction that wait for a specified 126 135 * hardware register to check for the value w/o mask.