|
rk3688pwm3申请失败
发表于 2016-12-27 18:09:08
浏览:8918
|
回复:5
打印
只看该作者
[复制链接]
楼主
#include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/err.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/slab.h>
static struct of_device_id pwm3_test_of_match[] = {
{ .compatible = "pwm3_test" },
{ }
};
static int pwm3_test_probe(struct platform_device *pdev)
{
struct pwm_device *pwm3=NULL;
pwm3= pwm_request(3,"pwm3_test");
if(IS_ERR(pwm3))
{
printk("BBBBBBBBBBBBBBB \n");
return -1;
}
pwm_config(pwm3, 500000, 1000000);
pwm_enable(pwm3);
printk("AAAAAAAAAAAAAAAAA");
return 0;
}
static int pwm3_test_remove(struct platform_device *pdev)
{
return 0;
}
static struct platform_driver pwm3_test_driver = {
.driver = {
.name = "pwm3_test",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(pwm3_test_of_match),
},
.probe = pwm3_test_probe,
.remove = pwm3_test_remove,
};
module_platform_driver(pwm3_test_driver);
MODULE_LICENSE("GPL");
接着是设备树
pwm3_test:pwm3_test{
compatible = "pwm3_test";
};
然后是dtsi
pwm3: pwm@ff680030 {
compatible = "rockchip,rk-pwm";
reg = <0x0 0xff680030 0x0 0x10>;
#pwm-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pwm3_pin>;
clocks = <&clk_gates13 6>;
clock-names = "pclk_pwm";
status = "okay";
};
然后就申请失败,,失败的原因是pwm_request函数下的pwm_to_device函数里面的
return radix_tree_lookup(&pwm_tree, pwm);
出错了。
有没有哪位知道为什么这个出错了 |
|