5

In the definition of struct device,there is a fwnode field defined,

struct device {
    ...
    struct fwnode_handle    *fwnode; /* firmware device node */
    ...
}

And the corresponding file is in include/linux/fwnode.h:

struct fwnode_reference_args {
    struct fwnode_handle *fwnode;
    unsigned int nargs;
    unsigned int args[NR_FWNODE_REFERENCE_ARGS];
};
...

Then I search it on the website, but can not find the detail explaining of this part (fwnode) of kernel so what does it mean? And what does it do? Can you provide a documentation for reference.

Rachid K.
  • 4,490
  • 3
  • 11
  • 30
downey
  • 51
  • 2

1 Answers1

3

The fwnode refers to a firmware node usually representing an entry in either Device Tree or ACPI (generally the DSDT table). Device Tree and ACPI are two different ways to define devices and their properties and interconnections between them. They both use tree structures to encode this information.

The fwnode member on a given struct device is the node in the corresponding firmware table for that device. ACPI is common in x86/UEFI based systems and device tree is common in ARM systems.

fwnode can be used with kernel APIs which accept fwnode handles. One such API is the V4l2 (Video For Linux 2) fwnode API: https://www.kernel.org/doc/html/latest/media/kapi/v4l2-fwnode.html

Some good reference docs:

Jordan
  • 397
  • 2
  • 18