WhyCan Forum(哇酷开发者社区)

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn

您尚未登录。

#1 2020-03-05 21:08:39

john78
会员
注册时间: 2018-07-19
累计积分: 190

V3S 如何 LCD 背光调整?

u-boot的DTS中有背光的控制,LINUX中的DTS没有

echo 1 > /sys/class/backlight/pwm-backlight/bl_power  ---这个使用要哪个dts配合?

离线

#2 2020-03-05 21:43:28

john78
会员
注册时间: 2018-07-19
累计积分: 190

Re: V3S 如何 LCD 背光调整?

# echo 0 > /sys/class/backlight/pwm-backlight/brightness
-sh: can't create /sys/class/backlight/pwm-backlight/brightness: nonexistent directory
--------------------------------------------------------------------------------
dts:
backlight: backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm 0 1000000 0>;
        brightness-levels = <0 30 40 50 60 70 100>;
        default-brightness-level = <6>;
    };

离线

#3 2020-04-15 15:32:12

zhang235hai
会员
注册时间: 2020-04-06
累计积分: 128

Re: V3S 如何 LCD 背光调整?

john78 说:

# echo 0 > /sys/class/backlight/pwm-backlight/brightness
-sh: can't create /sys/class/backlight/pwm-backlight/brightness: nonexistent directory
--------------------------------------------------------------------------------
dts:
backlight: backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm 0 1000000 0>;
        brightness-levels = <0 30 40 50 60 70 100>;
        default-brightness-level = <6>;
    };


我用荔枝派zero驱动4.3寸屏背光没有问题
但是用7寸屏背光非常的暗,图像显示是正常的
我修改了linux源码中的sun8i-v3s-licheepi-zero-with-lcd.dtsi/ {
        backlight: backlight {
                compatible = "pwm-backlight";
                pwms = <&pwm 0 1000000 0>;
                brightness-levels = <0 30 40 50 60 70 100>;
                default-brightness-level = <70>;
        };

重新编译之后背光还是很暗
请问还有其他的办法吗?

离线

#4 2020-04-15 15:38:35

晕哥
管理员
注册时间: 2017-09-06
累计积分: 9,190

Re: V3S 如何 LCD 背光调整?

https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt

backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm 0 5000000>;

        brightness-levels = <0 4 8 16 32 64 128 255>;
        default-brightness-level = <6>;

        power-supply = <&vdd_bl_reg>;
        enable-gpios = <&gpio 58 0>;
        post-pwm-on-delay-ms = <10>;
        pwm-off-delay-ms = <10>;
    };

凭感觉 /sys/class/backlight/pwm-backlight/bl_power 应该对应是 enable-gpios

离线

#5 2020-08-15 17:35:56

小熊猫
会员
注册时间: 2020-05-21
累计积分: 62

Re: V3S 如何 LCD 背光调整?

mark

离线

#6 2020-11-10 17:59:26

hanzixi_angel
会员
注册时间: 2020-09-21
累计积分: 29

Re: V3S 如何 LCD 背光调整?

晕哥 说:

https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/leds/backlight/pwm-backlight.txt

backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm 0 5000000>;

        brightness-levels = <0 4 8 16 32 64 128 255>;
        default-brightness-level = <6>;

        power-supply = <&vdd_bl_reg>;
        enable-gpios = <&gpio 58 0>;
        post-pwm-on-delay-ms = <10>;
        pwm-off-delay-ms = <10>;
    };

凭感觉 /sys/class/backlight/pwm-backlight/bl_power 应该对应是 enable-gpios




晕哥  power-supply = <&vdd_bl_reg>;
        enable-gpios = <&gpio 58 0>;
        post-pwm-on-delay-ms = <10>;
        pwm-off-delay-ms = <10>;

这些参数配置是从哪来的   在v3s上没有这些参数   内核是5.2.y   该如何配置呢   按照默认配置背光控制不起任何作用 
但是单独控制pwm是可以调光的
echo 1 > /sys/class/pwm/pwmchip0/export
echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/period
echo 200000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle   
echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable


使用echo 1 > brightness不起任何作用  是设备树中缺少某些配置吗

离线

#7 2020-11-10 18:17:02

哇酷小二
管理员
注册时间: 2020-04-22
累计积分: 1,850

Re: V3S 如何 LCD 背光调整?

0 4 8 16 32 64 128 255


这几组数字呢?

离线

#8 2020-11-10 18:26:33

hanzixi_angel
会员
注册时间: 2020-09-21
累计积分: 29

Re: V3S 如何 LCD 背光调整?

哇酷小二 说:

0 4 8 16 32 64 128 255


这几组数字呢?

 

这几组也不行  没有任何效果   不i知道是不是又其他地方需要使能啊   单独使用pwm是可以的

我的配置如下:
backlight: backlight {
          compatible = "pwm-backlight";
          //pwms = <&pwm 0 1000000 0>;
          pwms = <&pwm 0 5000000 0>;
          //brightness-levels = <0 30 40 50 60 70 100>;
          brightness-levels = <0 4 8 16 32 64 128 255>;
          default-brightness-level = <6>;
          status = "okay";
 
};


&pwm {
      pinctrl-names = "default";
      pinctrl-0 = <&pwm1_pins>;
      status = "okay";
};


pwm1_pins: pwm1 {
                 pins = "PB5";
                 function = "pwm1";
};

离线

#9 2020-11-10 19:43:09

哇酷小二
管理员
注册时间: 2020-04-22
累计积分: 1,850

Re: V3S 如何 LCD 背光调整?

这个驱动 CONFIG_BACKLIGHT_PWM 勾选了吗?

离线

#10 2020-11-10 21:51:07

哇酷小二
管理员
注册时间: 2020-04-22
累计积分: 1,850

Re: V3S 如何 LCD 背光调整?

 echo 0 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 1 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 7 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 6 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 5 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 4 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 3 > /sys/devices/platform/backlight/backlight/backlight/brightness
echo 0 > /sys/class/backlight/backlight/brightness
echo 1 > /sys/class/backlight/backlight/brightness
echo 2 > /sys/class/backlight/backlight/brightness
echo 3 > /sys/class/backlight/backlight/brightness
echo 4 > /sys/class/backlight/backlight/brightness
echo 5 > /sys/class/backlight/backlight/brightness
echo 6 > /sys/class/backlight/backlight/brightness
echo 7 > /sys/class/backlight/backlight/brightness
echo 8 > /sys/class/backlight/backlight/brightness
echo 9 > /sys/class/backlight/backlight/brightness

刚刚试了一下, V3s linux4.13-y 背光有反应

离线

#11 2020-11-11 09:07:50

hanzixi_angel
会员
注册时间: 2020-09-21
累计积分: 29

Re: V3S 如何 LCD 背光调整?

哇酷小二 说:
 echo 0 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 1 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 7 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 6 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 5 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 4 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 3 > /sys/devices/platform/backlight/backlight/backlight/brightness
echo 0 > /sys/class/backlight/backlight/brightness
echo 1 > /sys/class/backlight/backlight/brightness
echo 2 > /sys/class/backlight/backlight/brightness
echo 3 > /sys/class/backlight/backlight/brightness
echo 4 > /sys/class/backlight/backlight/brightness
echo 5 > /sys/class/backlight/backlight/brightness
echo 6 > /sys/class/backlight/backlight/brightness
echo 7 > /sys/class/backlight/backlight/brightness
echo 8 > /sys/class/backlight/backlight/brightness
echo 9 > /sys/class/backlight/backlight/brightness

刚刚试了一下, V3s linux4.13-y 背光有反应




打开了 跟pwm的设置都打开了   单独控制pwm没有问题   
CONFIG_BACKLIGHT_CLASS_DEVICE=y
ONFIG_BACKLIGHT_GENERIC=y
CONFIG_BACKLIGHT_PWM=y 

回头测下zero开发板  开发板用的是pb4   我用的是pb5   pwm可以单独控制  那背光应该也是可以的

离线

#12 2020-11-20 11:33:48

hanzixi_angel
会员
注册时间: 2020-09-21
累计积分: 29

Re: V3S 如何 LCD 背光调整?

哇酷小二 说:
 echo 0 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 1 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 7 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 6 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 5 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 4 > /sys/devices/platform/backlight/backlight/backlight/brightness
 echo 3 > /sys/devices/platform/backlight/backlight/backlight/brightness
echo 0 > /sys/class/backlight/backlight/brightness
echo 1 > /sys/class/backlight/backlight/brightness
echo 2 > /sys/class/backlight/backlight/brightness
echo 3 > /sys/class/backlight/backlight/brightness
echo 4 > /sys/class/backlight/backlight/brightness
echo 5 > /sys/class/backlight/backlight/brightness
echo 6 > /sys/class/backlight/backlight/brightness
echo 7 > /sys/class/backlight/backlight/brightness
echo 8 > /sys/class/backlight/backlight/brightness
echo 9 > /sys/class/backlight/backlight/brightness

刚刚试了一下, V3s linux4.13-y 背光有反应



我昨晚测试了一下荔枝派zero   他们使用的是pb4作为背光   测试确实是可以调节背光的    但是我使用的pb5就死活不行   不知道是不是还需要哪里配置    另外必须在uboot中指定背光为pb4   如果不指定的话也是不行的   您帮忙测试下pb5作为背光的调节吗   是不是哪里还需要配置   我目前没有找到配置点  谢谢

离线

#13 2020-11-20 11:51:07

redstar
会员
注册时间: 2020-08-30
累计积分: 2

Re: V3S 如何 LCD 背光调整?

pwms = <&pwm 0 5000000 0>;


是不是这里面可以调到PB5?

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB