STRUCT HANTRO_DEV(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ struct hantro_dev(9) β€” driver data, but make it iconic

okay bestie, welcome to struct hantro_dev(9), straight out of the Kernel API Manual. this is the struct that's basically the main character of the whole verisilicon VPU driver situation β€” it holds all the driver data, and yes it's a lot, but we're gonna get through it together 🫢


✨ NAME ✨

struct hantro_dev β€” driver data. that's it, that's the vibe. it's the struct that carries everything the driver needs to function, no cap πŸ’…


🌸 SYNOPSIS 🌸

okay so here's the whole thing, exactly as it lives, do not touch:

struct hantro_dev {
    struct v4l2_device v4l2_dev;
    struct v4l2_m2m_dev *m2m_dev;
    struct media_device mdev;
    struct hantro_func *encoder;
    struct hantro_func *decoder;
    struct platform_device *pdev;
    struct device *dev;
    struct clk_bulk_data *clocks;
    struct reset_control *resets;
    void __iomem **reg_bases;
    void __iomem *enc_base;
    void __iomem *dec_base;
    void __iomem *ctrl_base;
    struct mutex vpu_mutex;
    spinlock_t irqlock;
    const struct hantro_variant *variant;
    struct delayed_work watchdog_work;
 };

like, look at all those fields. she's thriving πŸ¦‹


πŸŽ€ Members πŸŽ€

let's go member by member, because every single one of these deserves her moment:

  • v4l2_dev β€” the V4L2 device that you register the video devices for. it's giving "the foundation of the whole operation" ✨
  • m2m_dev β€” the mem2mem device that's associated with this device. memory-to-memory, slay πŸ’…
  • mdev β€” the media device associated with this device. media device for the media device, iykyk 🎬
  • encoder β€” the encoder functionality. encoding era πŸ”₯
  • decoder β€” the decoder functionality. decoding era, equally iconic 🌈
  • pdev β€” a pointer to the VPU platform device. pointer bestie 🫢
  • dev β€” a pointer to the device, there so you can do convenient logging with the dev_ macros. logging queen, honestly πŸ”₯
  • clocks β€” an array of clock handles. tick tock ⏰
  • resets β€” an array of reset handles. reset button energy πŸŽ€
  • reg_bases β€” the mapped addresses of the VPU registers. mapped = located, and we love a good address ✨
  • enc_base β€” the mapped address of the VPU encoder register, kept around for convenience. for convenience!! we love convenience πŸ’–
  • dec_base β€” the mapped address of the VPU decoder register, also for convenience. matching set, cute 🀝
  • ctrl_base β€” the mapped address of the VPU control block. the control center, the moment, the icon πŸ‘‘
  • vpu_mutex β€” a mutex to synchronize V4L2 calls. mutual exclusion but make it chic πŸ’…
  • irqlock β€” a spinlock that synchronizes access to the data structures shared with interrupt handlers. very serious, very necessary, do not skip the locking fr fr
  • variant β€” the hardware variant-specific parameters. every VPU is different and this field knows it 🌸
  • watchdog_work β€” delayed work for hardware timeout handling. watchdog bestie is watching, she's always watching πŸ‘€

πŸ¦‹ SEE ALSO πŸ¦‹

related reading, all from the kernel file ./drivers/media/platform/verisilicon/hantro.h, go read them bestie:

  • struct hantro_irq(9)
  • struct hantro_variant(9)
  • enum hantro_codec_mode(9)
  • struct hantro_ctx(9)
  • struct hantro_fmt(9)
  • hantro_debug: Module parameter to control level of debugging messages.(9)

like, that's a whole friend group right there πŸ’œ


ngl, if you're poking around in ./drivers/media/platform/verisilicon/, you're gonna meet all of these. no cap, they all hang out together 🌈

and that's the whole page! this one's from ./drivers/media/platform/veris... (yes, they really did abbreviate it like that), October 2026 edition, struct hantro_dev(9). thanks for reading bestie, you ate that πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from