gaokun_ec_read(9)
π gaokun_ec_read(9) β read from EC β¨
okay bestie, welcome to the section 9 of the Kernel API Manual, like, the kernel manual, and today's main character is gaokun_ec_read. yes it's a whole vibe. sit down, grab a boba π§, we're reading from an embedded controller together.
π NAME π
gaokun_ec_read β read from EC. that's it, that's the whole thing, she's an icon and she reads. π
β¨ SYNOPSIS β¨
int gaokun_ec_read (struct gaokun_ec *ec , const u8 *req , size_t resp_len , u8 *resp );
like, four things in, one int out. we love a simple signature. π«Ά
πΈ ARGUMENTS πΈ
ecβ thegaokun_ecstructure. your whole entire context, your girl, your main character struct πreqβ the sequence to request. yes it's a magic sequence, we'll get to that π«resp_lenβ the size to read. how much room you're giving her to answer πrespβ the buffer to store response sequence. where the answer actually lands, no cap π₯
π DESCRIPTION π
okay so the way this works: this function reads data after it writes a magic sequence to the EC. literally write the spell, then read what comes back. and like β all EC operations depend on this function. all of them. every single one. she's carrying the entire ecosystem on her back fr fr ππ₯
Huawei uses magic sequences everywhere to complete various functions. and when I say everywhere I mean everywhere. all of these sequences get passed to ECCD (a ACPI method which is quiet similar to gaokun_ec_request), and ngl there's just no good abstraction to generalize these sequences, so we literally just wrap it for now π. like that's the design. that's the whole plan. wrap it and move on.
Almost all magic sequences are kept in this file. yes, that file. the one in SEE ALSO. you'll see her π
bestie note: the "no good abstraction" thing isn't me being shady, that's genuinely what the docs say, so don't come for me π«Ά
β RETURN β
0 on success or negative error code. that's it. lowkey elegant. check your return value or perish π
π¦ SEE ALSO π¦
the kernel file herself: ./drivers/platform/arm64/huawei-gaokun-ec.c β she's iconic, she's where the magic sequences live π β¨
and the whole friend group, all of them, in order:
gaokun_ec_write(9)gaokun_ec_register_notify(9)gaokun_ec_unregister_notify(9)gaokun_ec_psy_multi_read(9)gaokun_ec_psy_get_smart_charge(9)gaokun_ec_psy_set_smart_charge(9)gaokun_ec_psy_get_smart_charge_enable(9)gaokun_ec_psy_set_smart_charge_enable(9)gaokun_ec_ucsi_read(9)gaokun_ec_ucsi_write(9)gaokun_ec_ucsi_get_reg(9)gaokun_ec_ucsi_pan_ack(9)
go read them too, they're all slaying in their own way π
and that's the page!! π this lil beauty lives in ./drivers/platform/arm64 and she's dated October 2026 β mark your calendars bestie, periodt ππ
β¨
π¦ 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