RK3399 PWM3 的使用
本帖最后由 jpchen 于 2019-12-16 11:58 编辑在Firefly 中RK3399系列,我们选择AIO-3399C(AI) 机器,有一路PWM3是用做红外遥控的功能,但是如果用成普通的PWM功能改如何修改呢?其实比较简单,把dts里面配置PWM3红外的相关信息删除,然后在rk3399-firefly-demo.dtsi 里面设置pwm_id 为3,state设置
--- a/kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-demo.dtsi
+++ b/kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-demo.dtsi
@@ -57,9 +57,9 @@
};
pwm_demo: pwm_demo {
- status = "disabled";
+ status = "okay";
compatible = "firefly,rk3399-pwm";
- pwm_id = <1>;
+ pwm_id = <3>;
min_period = <0>;
max_period = <10000>;
duty_ns = <5000>;
--- a/kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-port.dtsi
+++ b/kernel/arch/arm64/boot/dts/rockchip/rk3399-firefly-port.dtsi
@@ -306,32 +306,10 @@
};
+
&pwm3 {
status = "okay";
- interrupts = <GIC_SPI 61 IRQ_TYPE_LEVEL_HIGH 0>;
- compatible = "rockchip,remotectl-pwm";
- remote_pwm_id = <3>;
- handle_cpu_id = <0>;
- remote_support_psci = <1>;
-
- ir_key1{
- rockchip,usercode = <0xff00>;
- rockchip,key_table =
- <0xeb KEY_POWER>,
- <0xec KEY_MENU>,
- <0xfe KEY_BACK>,
- <0xb7 KEY_HOME>,
- <0xa3 KEY_WWW>,
- <0xf4 KEY_VOLUMEUP>,
- <0xa7 KEY_VOLUMEDOWN>,
- <0xf8 KEY_REPLY>,
- <0xfc KEY_UP>,
- <0xfd KEY_DOWN>,
- <0xf1 KEY_LEFT>,
- <0xe5 KEY_RIGHT>;
- };
};
同时,我们可以cat节点看到对应pwm的信息
rk3399_firefly_aioc_ai_lvds_box:/ # cat sys/kernel/debug/pwm
platform/ff420030.pwm, 1 PWM device
pwm-0 (firefly-pwm ): requested enabled period: 10003 ns duty: 4991 ns polarity: inverse
platform/ff420020.pwm, 1 PWM device
pwm-0 (vdd-log ): requested enabled period: 24997 ns duty: 16485 ns polarity: inverse
platform/ff420010.pwm, 1 PWM device
pwm-0 ((null) ): period: 0 ns duty: 0 ns polarity: inverse
platform/ff420000.pwm, 1 PWM device
pwm-0 (backlight ): requested enabled period: 24997 ns duty: 13524 ns polarity: inverse结果如图所示
按照操作开机一直出现循环重启,错误提示: firefly-pwm pwm-demo: unable to request legacy PWM,错误代码: -517 kiswih 发表于 2019-12-2 15:32
按照操作开机一直出现循环重启,错误提示: firefly-pwm pwm-demo: unable to request legacy PWM,错误代 ...
更新附件,然后修改dts就可以解决此问题
pwm_demo: pwm_demo {
status = "okay";
compatible = "firefly,rk3399-pwm";
pwms = <&pwm3 0 10000 1>; //pwm1:PWM number 0 10000:PWM period in nanoseconds1:polarity
duty_ns = <5000>; //pwm duty cycle activation time, unit ns
};
学习下。。。 jpchen 发表于 2019-12-3 18:03
更新附件,然后修改dts就可以解决此问题
{:4_89:} thanks {:4_92:} {:4_103:}{:4_103:} 学习了 {:4_107:} 学习 学习
页:
[1]
2