Skip to content

Commit 7de796c

Browse files
Dennis YC Hsiehmbgg
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Matthias Brugger <[email protected]>
1 parent 9958185 commit 7de796c

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

drivers/soc/mediatek/mtk-cmdq-helper.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,21 @@ int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event)
253253
}
254254
EXPORT_SYMBOL(cmdq_pkt_clear_event);
255255

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+
256271
int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys,
257272
u16 offset, u32 value)
258273
{

include/linux/mailbox/mtk-cmdq-mailbox.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define CMDQ_JUMP_PASS CMDQ_INST_SIZE
1818

1919
#define CMDQ_WFE_UPDATE BIT(31)
20+
#define CMDQ_WFE_UPDATE_VALUE BIT(16)
2021
#define CMDQ_WFE_WAIT BIT(15)
2122
#define CMDQ_WFE_WAIT_VALUE 0x1
2223

include/linux/soc/mediatek/mtk-cmdq.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,15 @@ int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event);
120120
*/
121121
int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event);
122122

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+
123132
/**
124133
* cmdq_pkt_poll() - Append polling command to the CMDQ packet, ask GCE to
125134
* execute an instruction that wait for a specified

0 commit comments

Comments
 (0)