|
rk3288 PWM 申请失败
发表于 2017-2-16 11:34:42
浏览:10190
|
回复:6
打印
只看该作者
[复制链接]
楼主
照着这个帖子http://developer.t-firefly.com/thread-10801-1-1.html
修改firefly-rk3288.dts
&pwm0 {
interrupts = <GIC_SPI 78 IRQ_TYPE_LEVEL_HIGH>;
status = "okay";
};
rk3288.dts 中 0-3都打开 设置okay
pwm0: pwm@ff680000 {
compatible = "rockchip,rk-pwm0";
led-power = <&gpio8 GPIO_A1 GPIO_ACTIVE_LOW>;
reg = <0xff680000 0x10>;
#pwm-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pin>;
clocks = <&clk_gates11 11>;
clock-names = "pclk_pwm";
status = "okay";
};
&pwm1 {
status = "okay";
};
pwm0: pwm@ff680000 {
compatible = "rockchip,rk-pwm0";
led-power = <&gpio8 GPIO_A1 GPIO_ACTIVE_LOW>;
reg = <0xff680000 0x10>;
#pwm-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pin>;
clocks = <&clk_gates11 11>;
clock-names = "pclk_pwm";
status = "okay";
};
pwm1: pwm@ff680010 {
compatible = "rockchip,rk-pwm";
reg = <0xff680010 0x10>;
#pwm-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pwm1_pin>;
clocks = <&clk_gates11 11>;
clock-names = "pclk_pwm";
status = "okay";
};
pwm2: pwm@ff680020 {
compatible = "rockchip,rk-pwm";
reg = <0xff680020 0x10>;
#pwm-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pwm2_pin>;
clocks = <&clk_gates11 11>;
clock-names = "pclk_pwm";
status = "okay";
};
pwm3: pwm@ff680030 {
compatible = "rockchip,rk-pwm";
reg = <0xff680030 0x10>;
#pwm-cells = <2>;
pinctrl-names = "default";
pinctrl-0 = <&pwm3_pin>;
clocks = <&clk_gates11 11>;
clock-names = "pclk_pwm";
status = "okay";
};
关闭rockchip_pwm_regulator
测试
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/pwm.h>
static int __init base_init(void)
{
printk("base_init\n");
struct pwm_device * pwm0 = NULL;
struct pwm_device * pwm1 = NULL;
struct pwm_device * pwm2 = NULL;
struct pwm_device * pwm3 = NULL;
pwm0 = pwm_request(0, "pwm0");
pwm1 = pwm_request(1, "pwm1");
pwm2 = pwm_request(2, "pwm2");
pwm3 = pwm_request(3, "pwm3");
if(IS_ERR(pwm0))
printk("pwm0 err %ld\n", PTR_ERR(pwm0));
else
printk("pwm0 success\n");
if(IS_ERR(pwm1))
printk("pwm1 err %ld\n", PTR_ERR(pwm1));
else
printk("pwm1 success\n");
if(IS_ERR(pwm2))
printk("pwm2 err %ld\n", PTR_ERR(pwm2));
else
printk("pwm2 success\n");
if(IS_ERR(pwm3))
printk("pwm3 err %ld\n", PTR_ERR(pwm3));
else
printk("pwm3 success\n");
if(IS_ERR(pwm0))
{
return -1;
}
pwm_free(pwm0);
if(IS_ERR(pwm1))
{
return -1;
}
pwm_free(pwm1);
if(IS_ERR(pwm2))
{
return -1;
}
pwm_free(pwm2);
if(IS_ERR(pwm3))
{
return -1;
}
pwm_free(pwm3);
return 0;
}
static void __exit base_exit(void)
{
printk("Exit ros base\n");
}
subsys_initcall(base_init);
module_exit(base_exit);
MODULE_AUTHOR("david");
MODULE_DESCRIPTION("ros robot base driver");
MODULE_LICENSE("GPL");
测试返回
[ 3402.495385] base_init
[ 3402.495514] pwm0 err -517
[ 3402.495566] pwm1 err -517
[ 3402.495616] pwm2 err -517
[ 3402.495662] pwm3 err -517
|
|