gpt4 book ai didi

linux - Beaglebone devm_pwm_get 返回 ENODEV

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:44:00 26 4
gpt4 key购买 nike

我正在试验基于 this one 的 Beaglebone black 的 pwm 驱动程序.

因为我将 Yocto 与 meta-bbb 一起使用层,我不得不重写 .dtsi:

&am33xx_pinmux {
bbb_pwm_P8_13_pins: bbb_pwm_P8_13_pins {
pinctrl-single,pins = <0x024 0x4>; /* P8_13 (ZCZ ball T10) | MODE 4 */
};
};


/ {
bbb-pwm@123 {
compatible = "tfe,bbb_pwm-1.00.a";
pwms = <&ehrpwm2 1 0 1>;
pwm-names = "PWM_P8_13";

pinctrl-names = "default";
pinctrl-0 = <&bbb_pwm_P8_13_pins>;

enabled = <0>;
duty = <0>;
status = "okay";
};
};

然而,在driver-probe函数中,调用

pwm_test->pwm = devm_pwm_get(&pdev->dev, NULL);

返回 ENODEV:

[    7.538249] pinctrl-single 44e10800.pinmux: found group selector 15 for bbb_pwm_P8_13_pins
[ 7.538278] pinctrl-single 44e10800.pinmux: request pin 9 (44e10824.0) for bbb-pwm@123
[ 7.538291] pinctrl-single 44e10800.pinmux: enabling bbb_pwm_P8_13_pins function15
[ 7.538366] Loading bbb_pwm
[ 7.541304] bbb-pwm bbb-pwm@123: obtain a copy of previously claimed pinctrl
[ 7.541321] bbb-pwm bbb-pwm@123: Unable to request PWM (err = -19)

我发现错误代码是由 sub-call 返回的devm_pwm_get 的:

static int pwm_device_request(struct pwm_device *pwm, const char *label)
{
/* .... */

if (!try_module_get(pwm->chip->ops->owner))
return -ENODEV;

/* ... */
}

但是,由于我是 Linux 驱动程序的新手,所以我不明白为什么会这样。有什么线索吗?

最佳答案

事实证明,内核中禁用了较低级别的 PWM 驱动程序 (EHRPWM)。使用 menuconfig 启用它并确保 EHRPWM and EPWMSS在设备树中启用解决了我的问题:

使用 meta-bbb层,我只是通过 bitbake 访问 menuconfig:

bitbake virtual/kernel -c menuconfig

并加载位于 /meta-bbb/recipes-kernel/linux/linux-stable-4.4/beaglebone/defconfig 的 defconfig

我还在我的 local.conf 中添加了以下行

PREFERRED_VERSION_linux-stable = "4.4"

这是我的 dtsi:

&am33xx_pinmux {
bbb_pwm_P8_13_pins: bbb_pwm_P8_13_pins {
pinctrl-single,pins = <0x024 0x4>; /* P8_13 (ZCZ ball T10) | MODE 4 */
};
};

&ehrpwm2 {
status = "okay";
};

&epwmss2 {
status = "okay";
};

/ {
bbb-pwm@123 {
compatible = "tfe,bbb_pwm-1.00.a";
pwms = <&ehrpwm2 1 0 1>;
pwm-names = "PWM_P8_13";

pinctrl-names = "default";
pinctrl-0 = <&bbb_pwm_P8_13_pins>;

enabled = <0>;
duty = <0>;
status = "okay";
};
};

关于linux - Beaglebone devm_pwm_get 返回 ENODEV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39438656/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com