无法申请pwm1,这是驱动和log,麻烦看一下,提问很多天了
/*pt.c*/#include<linux/pwm.h>
#include<linux/init.h>
#include<linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
MODULE_LICENSE("GPL");
struct pwm_device * pwm1 = NULL;
static int __init pwm_init(void)
{
pwm1 = pwm_request(1, "backlight-pwm");
pwm_config(pwm1, 100000, 500000);
printk("success\n");
pwm_enable(pwm1);
return 0;
}
static void __exit pwm_exit(void)
{
printk("Exit pwm\n");
}
subsys_initcall(pwm_init);
module_exit(pwm_exit);
firefly@firefly:~/temp/makepra/pwm$ dmesg|tail
bfa0: 814f4e00 c000da00 be97a6f4 be97a874 00000003 b6f85398 00000000 00000000
bfc0: be97a6f4 be97a874 814f4e00 0000017b b6f91e08 00000000 b6f81b60 00000000
bfe0: be97a6a0 be97a690 b6f7c177 b6eec982 80030030 00000003 00000000 00000000
[<c028a454>] (pwm_config+0x40/0x60) from [<bf03a024>] (pwm_init+0x24/0x50 )
[<bf03a024>] (pwm_init+0x24/0x50 ) from [<c00086a4>] (do_one_initcall+0x34/0xc8)
[<c00086a4>] (do_one_initcall+0x34/0xc8) from [<c0080d34>] (do_init_module+0x44/0x168)
[<c0080d34>] (do_init_module+0x44/0x168) from [<c00819bc>] (SyS_finit_module+0x6c/0x94)
[<c00819bc>] (SyS_finit_module+0x6c/0x94) from [<c000da00>] (ret_fast_syscall+0x0/0x30)
Code: e1540003 c3822001 e3520000 1a000005 (e5910010)
---[ end trace 0be8b8afa4266cfb ]---
:'( 还有就是注册pwm-rockchip.c这个驱动文件的具体步骤是什么 zzj 发表于 2016-8-26 14:12
还有就是注册pwm-rockchip.c这个驱动文件的具体步骤是什么
无法申请应该具体看pwm_request报什么问题,一般申请不了都是占用,检查一下dts,那里也用到了pwm1
leung先森 发表于 2016-8-26 14:35
无法申请应该具体看pwm_request报什么问题,一般申请不了都是占用,检查一下dts,那里也用到了pwm1
请问怎么检查dts?检查出来后又要怎么释放?用pwm_free()吗 检查dts中是否被占用,disabled掉 pwm_request申请失败表明pwm1已经被占用,你可以直接操作它。若想自己另写驱动,那只能在sts中disabled,然后自己添加 HelloBirthday 发表于 2016-8-26 16:11
检查dts中是否被占用,disabled掉 pwm_request申请失败表明pwm1已经被占用,你可以直接操作它。若想 ...
我把firefly rk3288.dts里和rk3288.dtsi里的pwm都设置成okay,然后跟你说的一样直接操作pwm1,函数调用顺序是struct pwm_device * pwm1;pwm_enable(pwm1);pwm_config(pwm1,100000,500000);
然后用示波器测pwm1口,结果没有电压变化,还是搞不明白:'( dmesg给全呀。log太少了 xaityyy 发表于 2016-8-28 15:38
dmesg给全呀。log太少了
没办法:dizzy:,用的dmesg|tail命令只给这些
用dmesg的话就给的超出屏幕 dmesg | tee dmesg.log。然后发dmesg.log出来。
如果是串口,打开log,就会有log到本地。 pwm_regulator {
compatible = "rockchip_pwm_regulator";
pwms = <&pwm1 0 2000>;
rockchip,pwm_id= <1>;
rockchip,pwm_voltage_map= <925000 950000 975000 1000000 1025000 1050000 1075000 1100000 1125000 1150000 1175000 1200000 1225000 1250000 1275000 1300000 1325000 1350000 1375000 1400000>;
rockchip,pwm_voltage= <1100000>;
rockchip,pwm_min_voltage= <925000>;
rockchip,pwm_max_voltage= <1400000>;
rockchip,pwm_suspend_voltage= <950000>;
rockchip,pwm_coefficient= <475>;
regulators {
#address-cells = <1>;
#size-cells = <0>;
pwm_reg0: regulator@0 {
regulator-compatible = "pwm_dcdc1";
regulator-name= "vdd_logic";
regulator-min-microvolt = <925000>;
regulator-max-microvolt = <1400000>;
regulator-always-on;
regulator-boot-on;
};
};
};
dts中有这么一段,好像已经占用了pwm1,所以申请会失败,
但是这个是用来做电源控制吗,对应的硬件设备是什么?
页:
[1]
2