您尚未登录。

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

john78
会员
注册时间: 2018-07-19
已发帖子: 195
积分: 195

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
已发帖子: 195
积分: 195

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
已发帖子: 148
积分: 147.5

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,191
积分: 9191

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
已发帖子: 64
积分: 64

Re: V3S 如何 LCD 背光调整?

mark

离线

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

hanzixi_angel
会员
注册时间: 2020-09-21
已发帖子: 45
积分: 44.5

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,987
积分: 1907

Re: V3S 如何 LCD 背光调整?

0 4 8 16 32 64 128 255


这几组数字呢?

在线

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

hanzixi_angel
会员
注册时间: 2020-09-21
已发帖子: 45
积分: 44.5

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,987
积分: 1907

Re: V3S 如何 LCD 背光调整?

这个驱动 CONFIG_BACKLIGHT_PWM 勾选了吗?

在线

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

哇酷小二
管理员
注册时间: 2020-04-22
已发帖子: 1,987
积分: 1907

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
已发帖子: 45
积分: 44.5

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
已发帖子: 45
积分: 44.5

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
积分: 2

Re: V3S 如何 LCD 背光调整?

pwms = <&pwm 0 5000000 0>;


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

离线

#14 2021-04-01 14:59:10

xfdr0805
会员
注册时间: 2020-07-23
已发帖子: 116
积分: 105

Re: V3S 如何 LCD 背光调整?

遇到同样问题,同样现象

离线

#15 2021-04-01 15:21:01

xfdr0805
会员
注册时间: 2020-07-23
已发帖子: 116
积分: 105

Re: V3S 如何 LCD 背光调整?

# ls /sys/class/backlight/backlight/
actual_brightness  device             scale              uevent
bl_power           max_brightness     subsystem
brightness         power              type


# echo 1 > /sys/class/backlight/backlight/bl_power  可以关闭背光
# echo 0 > /sys/class/backlight/backlight/bl_power  可以打开背光
# echo 6 > /sys/class/backlight/backlight/brightness  最大为6,设备树定义的没生效?

# echo 7 > /sys/class/backlight/backlight/brightness
sh: write error: Invalid argument


# cat /sys/class/backlight/backlight/max_brightness
6


设备树:
backlight: backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm 0 1000000 0>;
        brightness-levels = <0 30 40 50 60 70 100>;
        default-brightness-level = <100>;
    };

最近编辑记录 xfdr0805 (2021-04-01 15:28:32)

离线

#16 2021-04-01 15:51:51

raspberryman
会员
注册时间: 2019-12-27
已发帖子: 456
积分: 441.5

Re: V3S 如何 LCD 背光调整?

建议直接用 devmem 读写寄存器测试,看是不是驱动程序有bug?

离线

#17 2021-04-01 16:32:47

xfdr0805
会员
注册时间: 2020-07-23
已发帖子: 116
积分: 105

Re: V3S 如何 LCD 背光调整?

raspberryman 说:

建议直接用 devmem 读写寄存器测试,看是不是驱动程序有bug?

仔细看了下输出内容,有下边2话
[    0.070763] pwm-backlight backlight: supply power not found, using dummy regulator
[    0.071204] pwm-backlight backlight: invalid default brightness level: 80, using 10

设备树直接改成这样

backlight: backlight {
        compatible = "pwm-backlight";
        pwms = <&pwm 0 1000000 0>;
        brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
        default-brightness-level = <80>;
        power-supply = <&reg_vcc3v3>;
        enable-gpios = <&pio 1 4 0>;
        post-pwm-on-delay-ms = <10>;
        pwm-off-delay-ms = <10>;
    };

离线

#18 2021-04-03 01:09:29

mysteryli
会员
注册时间: 2020-03-05
已发帖子: 234
积分: 200.5
个人网站

Re: V3S 如何 LCD 背光调整?

我的背光也没有
QQ截图20210329203617_20210403-0109.jpg
设备树如下

/*
 * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

/dts-v1/;
#include "sun8i-v3s.dtsi"
#include "sunxi-common-regulators.dtsi"

/ {
	model = "Lichee Pi Zero";
	compatible = "licheepi,licheepi-zero", "allwinner,sun8i-v3s";

	aliases {
		serial0 = &uart0;
	};
	backlight: backlight {
		compatible = "pwm-backlight";
		pwms = <&pwm 0 1000000 0>;
		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
		default-brightness-level = <30>;
		power-supply = <&reg_vcc3v3>;
	   	enable-gpios = <&pio 1 4 0>;
	   	post-pwm-on-delay-ms = <10>;
	   	pwm-off-delay-ms = <10>;
	};
	chosen {
		stdout-path = "serial0:115200n8";
	};

	leds {
		compatible = "gpio-leds";

		blue_led {
			label = "licheepi:blue:usr";
			gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
		};
	};
};

&ehci0 {
	status = "okay";
};

&mmc0 {
	pinctrl-0 = <&mmc0_pins_a>;
	pinctrl-names = "default";
	broken-cd;
	bus-width = <4>;
	vmmc-supply = <&reg_vcc3v3>;
	status = "okay";
};

&i2c0 {
	status = "okay";
	clock-frequency = <200000>;
	/*
	ns2009: ns2009@48 {
		compatible = "nsiway,ns2009";
		reg = <0x48>;
	};*/
	sht2x@40{
		compatible = "sensirion,sht2x";
		reg = <0x40>;
	};
	gt911: touchscreen@14 {
        compatible = "goodix,gt911";
        reg = <0x5d>;
        interrupt-parent = <&pio>;
        interrupts = <1 2 IRQ_TYPE_EDGE_FALLING>; /* (PB5) */
        pinctrl-names = "default";
        irq-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; /* (PB5) */
        reset-gpios = <&pio 1 3 GPIO_ACTIVE_HIGH>; /* RST (PB3) */
        /* touchscreen-swapped-x-y */
	};
};

&ohci0 {
	status = "okay";
};

&uart0 {
	pinctrl-0 = <&uart0_pins_a>;
	pinctrl-names = "default";
	status = "okay";
};

&usb_otg {
	dr_mode = "otg";
	status = "okay";
};

&usbphy {
	usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
	status = "okay";
};
/*
 * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
 *
 * This file is dual-licensed: you can use it either under the terms
 * of the GPL or the X11 license, at your option. Note that this dual
 * licensing only applies to this file, and not this project as a
 * whole.
 *
 *  a) This file is free software; you can redistribute it and/or
 *     modify it under the terms of the GNU General Public License as
 *     published by the Free Software Foundation; either version 2 of the
 *     License, or (at your option) any later version.
 *
 *     This file is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU General Public License for more details.
 *
 * Or, alternatively,
 *
 *  b) Permission is hereby granted, free of charge, to any person
 *     obtaining a copy of this software and associated documentation
 *     files (the "Software"), to deal in the Software without
 *     restriction, including without limitation the rights to use,
 *     copy, modify, merge, publish, distribute, sublicense, and/or
 *     sell copies of the Software, and to permit persons to whom the
 *     Software is furnished to do so, subject to the following
 *     conditions:
 *
 *     The above copyright notice and this permission notice shall be
 *     included in all copies or substantial portions of the Software.
 *
 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 *     OTHER DEALINGS IN THE SOFTWARE.
 */

#include "sun8i-v3s-licheepi-zero.dts"

#include <dt-bindings/input/input.h>

/ {
	model = "Lichee Pi Zero with Dock";
	compatible = "licheepi,licheepi-zero-dock", "licheepi,licheepi-zero",
		     "allwinner,sun8i-v3s";

	aliases {
		ethernet0 = &emac;
	};

	leds {
		status = "okay";
	};
};

&codec {
	allwinner,audio-routing =
		"Headphone", "HP",
		"Headphone", "HPCOM",
		"MIC1", "Mic",
		"Mic",  "HBIAS";
	status = "okay";
};

&emac {
	status = "okay";
};

&mmc1 {
	broken-cd;
	bus-width = <4>;
	vmmc-supply = <&reg_vcc3v3>;
	status = "okay";
};
/*
&lradc {
	vref-supply = <&reg_vcc3v0>;
	status = "okay";

	button@200 {
		label = "Volume Up";
		linux,code = <KEY_VOLUMEUP>;
		channel = <0>;
		voltage = <200000>;
	};

	button@400 {
		label = "Volume Down";
		linux,code = <KEY_VOLUMEDOWN>;
		channel = <0>;
		voltage = <400000>;
	};

	button@600 {
		label = "Select";
		linux,code = <KEY_SELECT>;
		channel = <0>;
		voltage = <600000>;
	};

	button@800 {
		label = "Start";
		linux,code = <KEY_OK>;
		channel = <0>;
		voltage = <800000>;
	};
};
*/

离线

#19 2021-04-04 23:56:35

mysteryli
会员
注册时间: 2020-03-05
已发帖子: 234
积分: 200.5
个人网站

Re: V3S 如何 LCD 背光调整?

能给一下设备树嘛,我和我的对比一下,我的写0关闭背光,1-9无变化

哇酷小二 说:
 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 背光有反应

离线

#20 2021-04-05 00:11:54

mysteryli
会员
注册时间: 2020-03-05
已发帖子: 234
积分: 200.5
个人网站

Re: V3S 如何 LCD 背光调整?

我的配置完以后从uboot到内核有明显的背光变化,但是无法改变背光

离线

页脚

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

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