Wie ich weiß, können Plattformgerätetreiber automatisch geladen werden, wenn das Feld "compatible" im Gerätebaum mit dem Feld "compatible" im Kernelmodul übereinstimmt. Hier ist pwm-overlay.dts
Datei von Raspberry Pi Distro:Autoloading-Mechanismus für Plattformgerätetreiber
/ {
[email protected] {
target = <&gpio>;
__overlay__ {
pwm_pins: pwm_pins {
brcm,pins = <18>;
brcm,function = <2>; /* Alt5 */
};
};
};
[email protected] {
target = <&pwm>;
__overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&pwm_pins>;
status = "okay";
};
};
[email protected] {
target = <&clk_pwm>;
frag2: __overlay__ {
clock-frequency = <100000000>;
};
};
__overrides__ {
pin = <&pwm_pins>,"brcm,pins:0";
func = <&pwm_pins>,"brcm,function:0";
clock = <&frag2>,"clock-frequency:0";
};
};
Zunächst einmal, ich sehe kein "kompatibel" Feld, aber in pwm-bcm2835.c
Datei gibt es solche Strings:
static const struct of_device_id bcm2835_pwm_of_match[] = {
{ .compatible = "brcm,bcm2835-pwm", },
{ /* sentinel */ }
};
Auch, wenn ich Overlay laden, Treiber erfolgreich automatisch geladen. Wie es funktioniert? Wie weiß er, welcher Treiber geladen werden soll?
Können Sie die dts (Gerätebaum) -Datei teilen? Ich erwarte die Antwort ist da – levengli