WhyCan Forum

人过留名,雁过留声,感谢各位朋友不离不弃地支持。 QQ: 516333132, 微信: whycan_cn (哇酷网/挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2019-02-25 15:43:26

vkaoke
会员
注册时间: 2019-02-01
累计积分: 14

荔枝派Nano Pi PWM背光设置问题

设备树配置:   

   pio:pinctrl@1c20800 {
			compatible = "allwinner,suniv-pinctrl";
			reg = <0x1c20800 0x400>;
			interrupts = <0x26 0x27 0x28>;
			clocks = <0x3 0x24 0x5 0xb>;
			clock-names = "apb", "hosc", "losc";
			gpio-controller;
			interrupt-controller;
			#interrupt-cells = <0x3>;
			#gpio-cells = <0x3>;
			phandle = <0xd>;

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

		};



       pwm:pwm@1C21000 {
		    compatible = "allwinner,sun7i-a20-pwm";        
			reg = <0x1C21000 0x400>;
			clocks = <0x5>;
			#pwm-cells = <3>;
			pinctrl-names = "default";
			pinctrl-0 = <&pwm1_pins>;
			status = "okay";
	   };

内核配置:

         --- Pulse-Width Modulation (PWM) Support                                                       │ │
  │ │                        < >   Freescale FlexTimer Module (FTM) PWM support                                             │ │
  │ │                        < >   NXP PCA9685 PWM driver                                                                   │ │
  │ │                        <*>   Allwinner PWM support                                                                    │ │
  │ │      

  Symbol: PWM [=y]                                                                                                          │
  │ Type  : boolean                                                                                                           │
  │ Prompt: Pulse-Width Modulation (PWM) Support                                                                              │
  │   Location:                                                                                                               │
  │ (1) -> Device Drivers                                                                                                     │
  │   Defined at drivers/pwm/Kconfig:1                                                                                        │
  │   Selected by: S3C24XX_PWM [=n] && PLAT_SAMSUNG [=n] && SAMSUNG_ATAGS [=n] || FB_SSD1307 [=y] && HAS_IOMEM [=y] && FB [=y │
  │                                                                                                                           │
  │                                                                                                                           │
  │ Symbol: BACKLIGHT_PWM [=y]                                                                                                │
  │ Type  : tristate                                                                                                          │
  │ Prompt: Generic PWM based Backlight Driver                                                                                │
  │   Location:                                                                                                               │
  │     -> Device Drivers                                                                                                     │
  │       -> Graphics support                                                                                                 │
  │         -> Backlight & LCD device support (BACKLIGHT_LCD_SUPPORT [=y])                                                    │
  │ (2)       -> Lowlevel Backlight controls (BACKLIGHT_CLASS_DEVICE [=y])                                                    │
  │   Defined at drivers/video/backlight/Kconfig:261                                                                          │
  │   Depends on: HAS_IOMEM [=y] && BACKLIGHT_LCD_SUPPORT [=y] && BACKLIGHT_CLASS_DEVICE [=y] && PWM [=y]   
  
  
 Symbol: COMMON_CLK_PWM [=n]                                                                                               │
  │ Type  : tristate                                                                                                          │
  │ Prompt: Clock driver for PWMs used as clock outputs                                                                       │
  │   Location:                                                                                                               │
  │     -> Device Drivers                                                                                                     │
  │ (4)   -> Common Clock Framework                                                                                           │
  │   Defined at drivers/clk/Kconfig:197                                                                                      │
  │   Depends on: COMMON_CLK [=y] && PWM [=y]

                                                         

驱动中已经打开了;

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   

由于默认设备树开启了led,我将下面的代码从设备树中移除了,并且去掉了默认的led驱动

 leds {
             compatible = "gpio-leds";

             blue_led {
                     label = "licheepi:blue:usr";
                     gpios = <&pio 4 4 GPIO_ACTIVE_LOW>; /* PE4 */
             };

             green_led {
                     label = "licheepi:green:usr";
                     gpios = <&pio 4 5 GPIO_ACTIVE_LOW>; /* PE5 */
                     default-state = "on";
             };

             red_led {
                     label = "licheepi:red:usr";
                     gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PE6 */
             };
     };

上面的命令都可以执行成功,但是PE6脚输出一直是高电平,没有PWM波形的输出,这个哪个问题导致的呀

最近编辑记录 vkaoke (2019-02-25 15:44:25)

离线

#2 2019-02-25 17:07:22

jimmy
Moderator
注册时间: 2017-10-29
累计积分: 290

离线

#3 2019-02-25 17:14:40

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,550

Re: 荔枝派Nano Pi PWM背光设置问题

https://licheezero.readthedocs.io/zh/latest/%E9%A9%B1%E5%8A%A8/PWM.html

仔细核对了一下 荔枝派 V3s 的文档, 基本操作没有太大问题。

PWM_CTRL_REG  0x00  PWM Control Register
PWM_CH1_PERIOD  0x08  PWM Channel 1 Period Register

用 busybox 里面的 devmem 把这两个寄存器读出来看看:

devmem 0x01C21000
devmem 0x01C21008

离线

#4 2019-02-26 09:13:52

vkaoke
会员
注册时间: 2019-02-01
累计积分: 14

Re: 荔枝派Nano Pi PWM背光设置问题

晕哥 说:

https://licheezero.readthedocs.io/zh/latest/%E9%A9%B1%E5%8A%A8/PWM.html

仔细核对了一下 荔枝派 V3s 的文档, 基本操作没有太大问题。

PWM_CTRL_REG  0x00  PWM Control Register
PWM_CH1_PERIOD  0x08  PWM Channel 1 Period Register

用 busybox 里面的 devmem 把这两个寄存器读出来看看:

devmem 0x01C21000
devmem 0x01C21008


# devmem 0x01C21000
0x002F8000
# devmem 0x01C21008
0x5DBF12C0

pwm控制寄存器:
0000 0000 0010 1111 1000 0000 0000 0000
PWM_CH1_PRESCAL=1  PWM_CH1_EN=1   PWM_CH1_CLK_GATING=1(Gating the Special Clock for PWM1 (0: mask, 1: pass).)

设置的参数:
0101 1101 1011 1111 0001 0010 1100 0000 

PWM_CH1_ACT_CYS=4800
PWM_CH1_ENTIRE_CYS=23999

我不知道,是不是pwm控制器里面有哪些位是不是还得设置一下。

离线

#5 2019-02-26 09:14:53

vkaoke
会员
注册时间: 2019-02-01
累计积分: 14

Re: 荔枝派Nano Pi PWM背光设置问题

clk-24M {
            #clock-cells = <0x0>;
            compatible = "fixed-clock";
            clock-frequency = <0x16e3600>;
            clock-output-names = "osc24M";
            phandle = <0x5>;
        };

引用的应该是24M的时钟

离线

#6 2019-02-26 09:20:18

jimmy
Moderator
注册时间: 2017-10-29
累计积分: 290

Re: 荔枝派Nano Pi PWM背光设置问题

离线

#7 2019-02-26 12:46:39

jiangming1399
会员
注册时间: 2018-06-14
累计积分: 63

Re: 荔枝派Nano Pi PWM背光设置问题

离线

#8 2019-02-26 12:59:49

duckduckgo
会员
注册时间: 2018-12-13
累计积分: 57

Re: 荔枝派Nano Pi PWM背光设置问题

试试这个帖子里面的驱动, https://whycan.cn/t_1457.html
是好的,我已经用过了。

离线

#9 2019-02-27 15:58:53

vkaoke
会员
注册时间: 2019-02-01
累计积分: 14

Re: 荔枝派Nano Pi PWM背光设置问题

jiangming1399 说:

设备树中,去掉gpios的配置就正常啦,十分感谢大家

compatible = "qiaodian,qd43003c0-40", "simple-panel";
 		#address-cells = <1>;
 		#size-cells = <0>;
-		enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;

离线

#10 2019-02-27 15:59:53

vkaoke
会员
注册时间: 2019-02-01
累计积分: 14

Re: 荔枝派Nano Pi PWM背光设置问题

/dts-v1/;
#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
/ {
	#address-cells = <0x1>;
	#size-cells = <0x1>;
	interrupt-parent = <0x1>;
	model = "Lichee Pi Nano";
	compatible = "licheepi,licheepi-nano", "allwinner,suniv-f1c100s", "allwinner,suniv";

	clocks {
		#address-cells = <0x1>;
		#size-cells = <0x1>;
		ranges;

		clk-24M {
			#clock-cells = <0x0>;
			compatible = "fixed-clock";
			clock-frequency = <0x16e3600>;
			clock-output-names = "osc24M";
			phandle = <0x5>;
		};

		clk-32k {
			#clock-cells = <0x0>;
			compatible = "fixed-clock";
			clock-frequency = <0x8000>;
			clock-output-names = "osc32k";
			phandle = <0xb>;
		};

		clk-100M {
			#clock-cells = <0x0>;
			compatible = "fixed-clock";
			clock-frequency = <0x5f5e100>;
			clock-output-names = "fake-100M";
		};
	};

	cpus {
		#address-cells = <0x0>;
		#size-cells = <0x0>;

		cpu {
			compatible = "arm,arm926ej-s";
			device_type = "cpu";
		};
	};

	display-engine {
		compatible = "allwinner,suniv-display-engine";
		allwinner,pipelines = <0x2>;
		status = "okay";
	};

	soc {
		compatible = "simple-bus";
		#address-cells = <0x1>;
		#size-cells = <0x1>;
		ranges;

		sram-controller@1c00000 {
			compatible = "allwinner,sun4i-a10-sram-controller";
			reg = <0x1c00000 0x30>;
			#address-cells = <0x1>;
			#size-cells = <0x1>;
			ranges;

			sram@10000 {
				compatible = "mmio-sram";
				reg = <0x10000 0x1000>;
				#address-cells = <0x1>;
				#size-cells = <0x1>;
				ranges = <0x0 0x10000 0x1000>;

				sram-section@0 {
					compatible = "allwinner,sun4i-a10-sram-d";
					reg = <0x0 0x1000>;
					status = "okay";
					phandle = <0x11>;
				};
			};
		};

		spi@1c05000 {
			compatible = "allwinner,suniv-spi", "allwinner,sun8i-h3-spi";
			reg = <0x1c05000 0x1000>;
			interrupts = <0xa>;
			clocks = <0x3 0x11 0x3 0x11>;
			clock-names = "ahb", "mod";
			resets = <0x3 0x4>;
			status = "okay";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			pinctrl-names = "default";
			pinctrl-0 = <0x4>;

			flash@0 {
				#address-cells = <0x1>;
				#size-cells = <0x1>;
				compatible = "winbond,w25q128", "jedec,spi-nor";
				reg = <0x0>;
				spi-max-frequency = <0x2625a00>;
			};
		};

		spi@1c06000 {
			compatible = "allwinner,suniv-spi", "allwinner,sun8i-h3-spi";
			reg = <0x1c06000 0x1000>;
			interrupts = <0xb>;
			clocks = <0x3 0x12 0x3 0x12>;
			clock-names = "ahb", "mod";
			resets = <0x3 0x5>;
			status = "disabled";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
		};

		lcd-controller@1c0c000 {
			compatible = "allwinner,suniv-tcon";
			reg = <0x1c0c000 0x1000>;
			interrupts = <0x1d>;
			clocks = <0x3 0x15 0x3 0x39 0x5>;
			clock-names = "ahb", "tcon-ch0", "tcon-ch1";
			clock-output-names = "tcon-pixel-clock";
			resets = <0x3 0x8>;
			reset-names = "lcd";
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <0x6>;

			ports {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				port@0 {
					#address-cells = <0x1>;
					#size-cells = <0x0>;
					reg = <0x0>;

					endpoint@0 {
						reg = <0x0>;
						remote-endpoint = <0x7>;
						phandle = <0x14>;
					};
				};

				port@1 {
					#address-cells = <0x1>;
					#size-cells = <0x0>;
					reg = <0x1>;

					endpoint@0 {
						reg = <0x0>;
						remote-endpoint = <0x8>;
						phandle = <0x15>;
					};
				};
			};
		};

		mmc@1c0f000 {
			compatible = "allwinner,suniv-mmc", "allwinner,sun7i-a20-mmc";
			reg = <0x1c0f000 0x1000>;
			clocks = <0x3 0xe 0x3 0x28 0x3 0x2a 0x3 0x29>;
			clock-names = "ahb", "mmc", "output", "sample";
			resets = <0x3 0x1>;
			reset-names = "ahb";
			interrupts = <0x17>;
			pinctrl-names = "default";
			pinctrl-0 = <0x9>;
			status = "okay";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
			vmmc-supply = <0xa>;
			bus-width = <0x4>;
			broken-cd;
		};

		mmc@1c10000 {
			compatible = "allwinner,suniv-mmc", "allwinner,sun7i-a20-mmc";
			reg = <0x1c10000 0x1000>;
			clocks = <0x3 0xf 0x3 0x2b 0x3 0x2d 0x3 0x2c>;
			clock-names = "ahb", "mmc", "output", "sample";
			resets = <0x3 0x2>;
			reset-names = "ahb";
			interrupts = <0x18>;
			status = "disabled";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
		};

		clock@1c20000 {
			compatible = "allwinner,suniv-ccu";
			reg = <0x1c20000 0x400>;
			clocks = <0x5 0xb>;
			clock-names = "hosc", "losc";
			#clock-cells = <0x1>;
			#reset-cells = <0x1>;
			phandle = <0x3>;
		};

		interrupt-controller@1c20400 {
			compatible = "allwinner,suniv-ic";
			reg = <0x1c20400 0x400>;
			interrupt-controller;
			#interrupt-cells = <0x1>;
			phandle = <0x1>;
		};

		pio:pinctrl@1c20800 {
			compatible = "allwinner,suniv-pinctrl";
			reg = <0x1c20800 0x400>;
			interrupts = <0x26 0x27 0x28>;
			clocks = <0x3 0x24 0x5 0xb>;
			clock-names = "apb", "hosc", "losc";
			gpio-controller;
			interrupt-controller;
			#interrupt-cells = <0x3>;
			#gpio-cells = <0x3>;
			phandle = <0xd>;

			spi0-pins-pc {
				pins = "PC0", "PC1", "PC2", "PC3";
				function = "spi0";
				phandle = <0x4>;
			};

			i2c0 {
				pins = "PE11", "PE12";
				function = "i2c0";
				phandle = <0xc>;
			};

			lcd-rgb666-pins {
				pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PD16", "PD17", "PD18", "PD19", "PD20", "PD21";
				function = "lcd";
				phandle = <0x6>;
			};

			uart-pins-pe {
				pins = "PE0", "PE1";
				function = "uart0";
				phandle = <0xf>;
			};
			uart-pins-pina{
				pins = "PA2", "PA3";
				function = "uart1";
				phandle = <0x1a>;
			};
            uart-pins-pinb{
				pins = "PE7", "PE8";
				function = "uart2";
				phandle = <0xe>;
			};
			mmc0-pins {
				pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5";
				function = "mmc0";
				phandle = <0x9>;
			};
			pwm1_pins: pwm1 {
					pins = "PE6";
					function = "pwm1";
				};

		};

		timer@1c20c00 {
			compatible = "allwinner,suniv-timer";
			reg = <0x1c20c00 0x90>;
			interrupts = <0xd>;
			clocks = <0x5>;
		};

		watchdog@1c20ca0 {
			compatible = "allwinner,sun6i-a31-wdt";
			reg = <0x1c20ca0 0x20>;
		};
		pwm:pwm@1C21000 {
		    compatible = "allwinner,sun7i-a20-pwm";        
			reg = <0x1C21000 0xC>;
			clocks = <0x5>;
			#pwm-cells = <3>;
			pinctrl-names = "default";
			pinctrl-0 = <&pwm1_pins>;
			status = "okay";
	   };
	 
		i2c@1C27000 {
			compatible = "allwinner,sun6i-a31-i2c";
			reg = <0x1c27000 0x400>;
			interrupts = <0x7>;
			clocks = <0x3 0x21>;
			resets = <0x3 0x14>;
			pinctrl-names = "default";
			pinctrl-0 = <0xc>;
			status = "okay";
			#address-cells = <0x1>;
			#size-cells = <0x0>;
		
			lcos@0x48 {
				compatible = "lcos,lcos_hx7097";
				reg = <0x48>;
			};			
			axp209:pmic@0x34 { 
		    compatible = "x-powers,axp209";
			reg = <0x34>;
			interrupt-parent = <&pio>;
            interrupts = <4 2 IRQ_TYPE_LEVEL_LOW>; /* (PE2) */
			/* interrupts = <0 IRQ_TYPE_LEVEL_LOW>;*/
			interrupt-controller;
			#interrupt-cells = <1>;
				battery_power_supply: battery-power-supply{ 
						compatible = "x-powers,axp209-battery-power-supply"; 
					};
				ac_power_supply:ac-power-supply{ 
						compatible = "x-powers,axp202-ac-power-supply"; 
					};				
				axp_gpio:gpio{ 
						compatible = "x-powers,axp209-gpio";
						gpio-controller;
						#gpio-cells = <2>; 
					};
			}; 			
		};		
		serial@1c25000 {
			compatible = "snps,dw-apb-uart";
			reg = <0x1c25000 0x400>;
			interrupts = <0x1>;
			reg-shift = <0x2>;
			reg-io-width = <0x4>;
			clocks = <0x3 0x25>;
			resets = <0x3 0x17>;
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <0xf>;
		};

		serial@1c25400 {
			compatible = "snps,dw-apb-uart";
			reg = <0x1c25400 0x400>;
			interrupts = <0x2>;
			reg-shift = <0x2>;
			reg-io-width = <0x4>;
			clocks = <0x3 0x26>;
			resets = <0x3 0x18>;
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <0x1a>;
		};

		serial@1c25800 {
			compatible = "snps,dw-apb-uart";
			reg = <0x1c25800 0x400>;
			interrupts = <0x3>;
			reg-shift = <0x2>;
			reg-io-width = <0x4>;
			clocks = <0x3 0x27>;
			resets = <0x3 0x19>;
			status = "okay";
			pinctrl-names = "default";
			pinctrl-0 = <0xe>;
		};

		usb@1c13000 {
			compatible = "allwinner,suniv-musb";
			reg = <0x1c13000 0x400>;
			clocks = <0x3 0x13>;
			resets = <0x3 0x6>;
			interrupts = <0x1a>;
			interrupt-names = "mc";
			phys = <0x10 0x0>;
			phy-names = "usb";
			extcon = <0x10 0x0>;
			allwinner,sram = <0x11 0x1>;
			status = "okay";
			dr_mode = "otg";
		};

		phy@1c13400 {
			compatible = "allwinner,suniv-usb-phy";
			reg = <0x1c13400 0x10>;
			reg-names = "phy_ctrl";
			clocks = <0x3 0x30>;
			clock-names = "usb0_phy";
			resets = <0x3 0x0>;
			reset-names = "usb0_reset";
			#phy-cells = <0x1>;
			status = "okay";
			usb0_id_det-gpio = <0xd 0x4 0x2 0x0>;
			phandle = <0x10>;
		};

		display-frontend@1e00000 {
			compatible = "allwinner,suniv-display-frontend";
			reg = <0x1e00000 0x20000>;
			interrupts = <0x1e>;
			clocks = <0x3 0x1b 0x3 0x38 0x3 0x35>;
			clock-names = "ahb", "mod", "ram";
			resets = <0x3 0xe>;
			status = "disabled";
			phandle = <0x2>;

			ports {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				port@1 {
					#address-cells = <0x1>;
					#size-cells = <0x0>;
					reg = <0x1>;

					endpoint@0 {
						reg = <0x0>;
						remote-endpoint = <0x12>;
						phandle = <0x13>;
					};
				};
			};
		};
		
		
		display-backend@1e60000 {
			compatible = "allwinner,suniv-display-backend";
			reg = <0x1e60000 0x10000>;
			reg-names = "be";
			interrupts = <0x1f>;
			clocks = <0x3 0x1a 0x3 0x37 0x3 0x36>;
			clock-names = "ahb", "mod", "ram";
			resets = <0x3 0xd>;
			reset-names = "be";
			assigned-clocks = <0x3 0x37>;
			assigned-clock-rates = <0x11e1a300>;

			ports {
				#address-cells = <0x1>;
				#size-cells = <0x0>;

				port@0 {
					#address-cells = <0x1>;
					#size-cells = <0x0>;
					reg = <0x0>;

					endpoint@0 {
						reg = <0x0>;
						remote-endpoint = <0x13>;
						phandle = <0x12>;
					};
				};

				port@1 {
					#address-cells = <0x1>;
					#size-cells = <0x0>;
					reg = <0x1>;

					endpoint@0 {
						reg = <0x0>;
						remote-endpoint = <0x14>;
						phandle = <0x7>;
					};
				};
			};
		};
	};

	aliases {
		serial0 = "/soc/serial@1c25000";
		spi0 = "/soc/spi@1c05000";		
		i2c0 = "/soc/i2c@1C27000";
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	panel {
		compatible = "lg,lb070wv8", "simple-panel";
		#address-cells = <0x1>;
		#size-cells = <0x0>;
		port@0 {
			reg = <0x0>;
			#address-cells = <0x1>;
			#size-cells = <0x0>;

			endpoint@0 {
				reg = <0x0>;
				remote-endpoint = <0x15>;
				phandle = <0x8>;
			};
		};
	};
	vcc3v3 {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3";
		regulator-min-microvolt = <0x325aa0>;
		regulator-max-microvolt = <0x325aa0>;
		phandle = <0xa>;
	};
	backlight 
	{
		compatible = "pwm-backlight";
		pwms = <&pwm 1 500000 0>;
		brightness-levels = <0 4 8 16 32 64 128 255>;
		default-brightness-level = <6>;
	};
	
};

离线

#11 2019-02-27 16:20:54

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 8,550

Re: 荔枝派Nano Pi PWM背光设置问题

vkaoke 说:
jiangming1399 说:

设备树中,去掉gpios的配置就正常啦,十分感谢大家
compatible = "qiaodian,qd43003c0-40", "simple-panel";
        #address-cells = <1>;
        #size-cells = <0>;
-        enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;

感谢分享经验,应该是这里把IO的复用状态切换到GPIO了,而不是PWM。

离线

#12 2019-07-22 07:18:53

路漫漫
会员
注册时间: 2019-07-22
累计积分: 32

Re: 荔枝派Nano Pi PWM背光设置问题

先 mark, 晚点我也要调试 c100 linux 4.15 的背光调节.

离线

#13 2019-07-27 17:42:04

路漫漫
会员
注册时间: 2019-07-22
累计积分: 32

Re: 荔枝派Nano Pi PWM背光设置问题

vkaoke 说:
jiangming1399 说:

设备树中,去掉gpios的配置就正常啦,十分感谢大家

compatible = "qiaodian,qd43003c0-40", "simple-panel";
 		#address-cells = <1>;
 		#size-cells = <0>;
-		enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;

进了同一个坑, 开始怎么调都出不来,总是保持高电平,后来输出 PE6 复用寄存器状态才恍然大悟。

离线

#15 2019-12-02 16:50:36

aaayao
会员
注册时间: 2019-10-30
累计积分: 72

Re: 荔枝派Nano Pi PWM背光设置问题

楼主,你好:
               正好要做leds驱动,请教一个问题,没有看到有leds目录,是少了那个配置文件呢?
板子log:
# ls /sys/bus/platform/devices                                                                         
10000.sram               1c20ca0.watchdog         regulatory.0
1c00000.sram-controller  1c25000.serial           serial8250
1c05000.spi              1e60000.display-backend  snd-soc-dummy
1c0c000.lcd-controller   alarmtimer               snd_aloop.0
1c0f000.mmc              display-engine           soc
1c13000.usb              musb-hdrc.1.auto         usb_phy_generic.0.auto
1c13400.phy              my-leds2                 vcc3v3
1c20800.pinctrl          panel
1c20c00.timer            reg-dummy
# ls /sys/bus/platform/devices/my-leds2                                                               
driver_override  of_node          subsystem
modalias         power            uevent
#


设备树:
    my-leds2 {
        compatible = "gpio-leds";        /* 才能被识别为Led */
        pinctrl-names = "default";
        pinctrl-0 = <&leds_pins>;
             blue_led {
                     label = "licheepi:blue:usr";
                     gpios = <&pio 4 4 GPIO_ACTIVE_LOW>; /* PE4 */
             };

             green_led {
                     label = "licheepi:green:usr";
                     gpios = <&pio 4 5 GPIO_ACTIVE_LOW>; /* PE5 */
                     default-state = "on";
             };

             red_led {
                     label = "licheepi:red:usr";
                     gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PE6 */
             };
    };



        pio: pinctrl@1c20800 {
            compatible = "allwinner,suniv-pinctrl";
            reg = <0x01c20800 0x400>;
            interrupts = <38>, <39>, <40>;
            clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&osc32k>;
            clock-names = "apb", "hosc", "losc";
            gpio-controller;
            interrupt-controller;
            #interrupt-cells = <3>;
            #gpio-cells = <3>;


            leds_pins: leds-pins {
                pins = "PE4","PE5","PE6";
                function = "gpio_out";
            };
                  };

离线

#16 昨天 11:05:59

异乡是故乡
会员
注册时间: 2019-11-15
累计积分: 14

Re: 荔枝派Nano Pi PWM背光设置问题

vkaoke 说:

设备树中,去掉gpios的配置就正常啦,十分感谢大家

compatible = "qiaodian,qd43003c0-40", "simple-panel";
 		#address-cells = <1>;
 		#size-cells = <0>;
-		enable-gpios = <&pio 4 6 GPIO_ACTIVE_HIGH>;

原来如此, 调了大半天死活不起作用,正在准备放弃治疗了。

离线

#17 昨天 11:06:37

异乡是故乡
会员
注册时间: 2019-11-15
累计积分: 14

Re: 荔枝派Nano Pi PWM背光设置问题

离线

页脚