cmdq_pkt_write_s(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… cmdq_pkt_write_s β€” like, the CMDQ packet write_s appender bestie

okay so real talk, this is a page from the Kernel API Manual (yes the (9) section, we love a kernel-internals moment ✨) and it's all about cmdq_pkt_write_s. Buckle up, it's giving "low-level but make it cute".


🌸 NAME 🌸

cmdq_pkt_write_s β€” append a write_s command to the CMDQ packet. that's it, that's the whole personality πŸŽ€


✨ SYNOPSIS ✨

int cmdq_pkt_write_s (struct cmdq_pkt *pkt , u16 high_addr_reg_idx , u16
addr_low , u16 src_reg_idx );

literally the whole signature, don't @ me, it returns an int πŸ’–


🫢 ARGUMENTS 🫢

  • pkt β€” the CMDQ packet. the main character, the canvas, the whole vibe 🌈
  • high_addr_reg_idx β€” the internal register ID that's holding the high address of pa. yep, it's a u16, and yep, it's an index not an address, lowkey important πŸ‘€
  • addr_low β€” the low address of pa. the bottom half of the address situation πŸ’…
  • src_reg_idx β€” the CMDQ internal register ID that caches the source value. so like, where the value's coming from πŸ¦‹

πŸ‘‘ RETURN πŸ‘‘

0 for success πŸŽ‰ β€” otherwise the error code gets returned. not zero? not slay. go check that error code bestie 😭


πŸ”₯ DESCRIPTION πŸ”₯

so the whole point: this supports writing a value to a physical address without subsys. no subsys needed, we're going direct, main character energy fr fr πŸ’€

here's the little ritual you gotta do tho, don't skip steps:

  1. use CMDQ_ADDR_HIGH to get the high address, then call cmdq_pkt_assign to assign that value into an internal reg ✨
  2. also use CMDQ_ADDR_LOW to get the low address, and that's what you pass as the addr_low parameter when you call this function πŸŽ€

that's the recipe. high goes through the reg + cmdq_pkt_assign, low goes straight in as addr_low. iconic, honestly 🧚


πŸ’œ SEE ALSO πŸ’œ

kernel file ./include/linux/soc/mediatek/mtk-cmdq.h β€” go read it, it's the source of truth πŸ“–

and the whole friend group (yes, all of them, no we're not leaving anyone out):

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_mask(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) 🌟


ngl if you got all the way here you're officially a CMDQ girlie now, no cap 🫢

alright that's the page!! it lives at ./include/linux/soc/mediatek, dated October 2026, and the page itself is cmdq_pkt_write_s(9) β€” mwah, bye bestie πŸ’‹πŸ’–

πŸ“¦ where this page comes from