cmdq_pkt_write_s_mask(9)
π cmdq_pkt_write_s_mask β kernel API manual, but make it a group chat
okay so bestie, we're looking at cmdq_pkt_write_s_mask(9) β it's from the Kernel API Manual and it's literally the function that appends a masked write_s command onto a CMDQ packet. iconic behavior, no cap. β¨
πΈ NAME
cmdq_pkt_write_s_mask β append a write_s-with-mask command to the CMDQ packet. that's the whole vibe. it does one thing and it slays at it π
π¦ SYNOPSIS
int cmdq_pkt_write_s_mask (struct cmdq_pkt *pkt , u16 high_addr_reg_idx
, u16 addr_low , u16 src_reg_idx , u32 mask );
five args, one int coming back at you. keep the signature exactly like this, fr fr β don't go rearranging things, the compiler will not be cute about it π
β¨ ARGUMENTS
pktβ the CMDQ packet. your main character. everything gets appended to her πhigh_addr_reg_idxβ internal register ID which contains the high address ofpa. so like, the top half lives in a register, not inline π§addr_lowβ low address ofpa. the bottom half, right here in the call π«Άsrc_reg_idxβ the CMDQ internal register ID which caches the source value. that's where the value you're writing is chillin' πmaskβ the specified target address mask. useU32_MAXif you don't need one, bestie β that's the "no mask, we're fine" setting π
β RETURN
0 for success; else the error code is returned. so likeβ¦ zero is the slay, anything else means go read your error codes π
π₯ DESCRIPTION
Support write value to physical address without subsys. let me say that again for the people in the back β no subsys, we're going direct π
here's the routine, follow along:
- use
CMDQ_ADDR_HIGHto get the high address, and then callcmdq_pkt_assignto assign that value into an internal reg π - also use
CMDQ_ADDR_LOWto get the low address for theaddr_lowparameter when you call this function. split it up, keep it clean, that's the move β¨
ngl, if you skip the cmdq_pkt_assign step and just yeet a garbage reg index in there, that's on you β the docs are literally telling you the order of operations. read them. π«Ά
π SEE ALSO
Kernel file ./include/linux/soc/mediatek/mtk-cmdq.h β go read it, it's giving source of truth:
cmdq_dev_get_client_reg(9)cmdq_mbox_create(9)cmdq_mbox_destroy(9)cmdq_pkt_create(9)cmdq_pkt_destroy(9)cmdq_pkt_write(9)cmdq_pkt_write_pa(9)cmdq_pkt_write_subsys(9)cmdq_pkt_write_mask(9)cmdq_pkt_write_mask_pa(9)cmdq_pkt_write_mask_subsys(9)cmdq_pkt_write_s(9)cmdq_pkt_write_s_value(9)cmdq_pkt_write_s_mask_value(9)cmdq_pkt_mem_move(9)cmdq_pkt_wfe(9)cmdq_pkt_acquire_event(9)cmdq_pkt_clear_event(9)cmdq_pkt_set_event(9)cmdq_pkt_poll(9)cmdq_pkt_poll_mask(9)cmdq_pkt_logic_command(9)cmdq_pkt_assign(9)cmdq_pkt_poll_addr(9)cmdq_pkt_jump_abs(9)cmdq_pkt_jump_rel(9)cmdq_pkt_jump_rel_temp(9)cmdq_pkt_eoc(9)
like, that's the whole friend group right there. go say hi π
anyway that's the page, bestie π₯° this one's sourced from ./include/linux/soc/mediatek and dated October 2026 β so it's fresh, it's documented, it's ready for you. now go write some masked registers and be iconic π
β¨π¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms