天天看點

501在全志r16平台tinav3.0系統下調通pwm1的10KHZ波形

501在全志r16平台tinav3.0系統下調通pwm1的10KHZ波形

2018/10/19 19:52

版本:V1.0

開發闆:SC3817R

SDK:tina v3.0

1、01原始編譯全志r16平台tinav3.0系統:

[email protected]:~$ cd /home/wwt

[email protected]:/home/wwt$

[email protected]:~$ cd /home/wwt

[email protected]:/home/wwt$

[email protected]:/home/wwt$

[email protected]:/home/wwt$ md5sum tina_v3.0_20180606_1711git.tar.gz 

ebf7ea460473f13a7f64248ed61cf998  tina_v3.0_20180606_1711git.tar.gz

[email protected]:/home/wwt$

[email protected]:/home/wwt$ tar zxvf tina_v3.0_20180606_1711git.tar.gz

[email protected]:/home/wwt$

[email protected]:/home/wwt$ cd tina_v3.0/

[email protected]:/home/wwt/tina_v3.0$

[email protected]:/home/wwt/tina_v3.0$

[email protected]:/home/wwt/tina_v3.0$ source build/envsetup.sh 

(請嚴重注意:lunch之後的選項是環境依賴的,請選擇astar_parrot-tina前的實際數值!)

[email protected]:/home/wwt/tina_v3.0$ lunch

You're building on Linux

Lunch menu... pick a combo:

     5. astar_parrot-tina

Which would you like?5

[email protected]:/home/wwt/tina_v3.0$ make -j12

[email protected]:/home/wwt/tina_v3.0$ pack -d

2、在核心中打開PWM:

(已經預設選中了)

[email protected]:/home/wwt/tina_v3.0$ make kernel_menuconfig

Device Drivers  --->

[*] Pulse-Width Modulation (PWM) Support  --->

--- Pulse-Width Modulation (PWM) Support

<*>   sunxi pwm support

相關驅動檔案在這裡:

W:\tina_v3.0\lichee\linux-3.4\drivers\pwm\core.c

W:\tina_v3.0\lichee\linux-3.4\drivers\pwm\pwm-sunxi.c

刷機之後可見,沒有輸出PWM波形的驅動!

[email protected]:/#

[email protected]:/# find . -name pwm*

./sys/kernel/debug/pwm

[email protected]:/#

[email protected]:/sys/kernel/debug#

[email protected]:/sys/kernel/debug# ll

drwxr-xr-x   24 root     root             0 Jan  1 08:00 .

drwxr-xr-x    9 root     root             0 Jan  1 08:29 ..

drwxr-xr-x    3 root     root             0 Jan  1 08:00 asoc

drwxr-xr-x    2 root     root             0 Jan  1 08:29 axpdbg

drwxr-xr-x   16 root     root             0 Jan  1 08:00 bdi

drwxr-xr-x    2 root     root             0 Jan  1 08:00 bluetooth

drwxr-xr-x    2 root     root             0 Jan  1 08:29 ccudbg

drwxr-xr-x    6 root     root             0 Jan  1 08:29 clk

drwxr-xr-x    2 root     root             0 Jan  1 08:29 cpufreq

drwxr-xr-x    2 root     root             0 Jan  1 08:29 ddrfreq

drwxr-xr-x    2 root     root             0 Jan  1 08:00 extfrag

-r--r--r--    1 root     root             0 Jan  1 08:00 gpio

drwxr-xr-x    2 root     root             0 Jan  1 08:00 hid

drwxr-xr-x    2 root     root             0 Jan  1 08:00 hotplug

drwxr-xr-x    2 root     root             0 Jan  1 08:00 ieee80211

drwxr-xr-x    2 root     root             0 Jan  1 08:00 ion

drwxr-xr-x    8 root     root             0 Jan  1 08:29 mali

drwxr-xr-x    2 root     root             0 Jan  1 08:00 memblock

drwxr-xr-x    2 root     root             0 Jan  1 08:00 mmc0

drwxr-xr-x    4 root     root             0 Jan  1 08:00 pinctrl

-r--r--r--    1 root     root             0 Jan  1 08:00 pwm

drwxr-xr-x    2 root     root             0 Jan  1 08:00 regmap

drwxr-xr-x   23 root     root             0 Jan  1 08:00 regulator

-rw-r--r--    1 root     root             0 Jan  1 08:00 shrinker

drwxr-xr-x    2 root     root             0 Jan  1 08:00 sunxi_pinctrl

drwxr-xr-x    2 root     root             0 Jan  1 08:00 sunxi_soc_info

-r--r--r--    1 root     root             0 Jan  1 08:00 suspend_stats

-rwxr-xr-x    1 root     root             0 Jan  1 08:00 suspend_time

-r--r--r--    1 root     root             0 Jan  1 08:00 sync

drwxr-xr-x    2 root     root             0 Jan  1 08:00 usb

-r--r--r--    1 root     root             0 Jan  1 08:00 wakeup_sources

[email protected]:/sys/kernel/debug#

[email protected]:/sys/kernel/debug#

(可見)

[email protected]:/sys/kernel/debug#

[email protected]:/sys/kernel/debug# cat pwm

platform/sunxi_pwm, 2 PWM devices

 pwm-0   ((null)              ):

 pwm-1   (lcd                 ): requested enabled

[email protected]:/sys/kernel/debug#

(tina v3.0.2中内置:)

W:\tina_v3.0\lichee\linux-3.4\drivers\misc\leds\Kconfig

W:\tina_v3.0\lichee\linux-3.4\drivers\misc\leds\Makefile

W:\tina_v3.0\lichee\linux-3.4\drivers\misc\leds\pwm_leds.c

W:\tina_v3.0\lichee\linux-3.4\drivers\misc\Makefile

obj-y                           += leds/

W:\tina_v3.0\lichee\linux-3.4\drivers\misc\Kconfig

source "drivers/misc/c2port/Kconfig"

source "drivers/misc/eeprom/Kconfig"

source "drivers/misc/cb710/Kconfig"

source "drivers/misc/iwmc3200top/Kconfig"

source "drivers/misc/ti-st/Kconfig"

source "drivers/misc/lis3lv02d/Kconfig"

source "drivers/misc/carma/Kconfig"

source "drivers/misc/altera-stapl/Kconfig"

source "drivers/misc/sw_3g_module/Kconfig"

source "drivers/misc/rf_pm/Kconfig"

source "drivers/misc/sunxi-clk-prepare/Kconfig"

source "drivers/misc/leds/Kconfig"

endmenu

[email protected]:/home/wwt/tina_v3.0$ make kernel_menuconfig

Device Drivers  --->

Misc devices  --->

(在最後面,預設選中的)

<M> LEDs by PWM Control driver (NEW)

[email protected]:/home/wwt/tina_v3.0$ make -j12

STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (SPI) (SENSORS_LIS3_SPI) [N/m/y/?] n

STMicroeletronics LIS3LV02Dx three-axis digital accelerometer (I2C) (SENSORS_LIS3_I2C) [N/m/y/?] n

*

* Altera FPGA firmware download module

*

Altera FPGA firmware download module (ALTERA_STAPL) [N/m/y/?] n

Allwinner rf module pm driver (AW_RF_PM) [Y/n/?] y

LEDs by PWM Control driver (MISC_PWM_LEDS) [M/n/y/?] (NEW) y

刷機之後可見:

(通過ADB可見PWM1打開了)

[email protected]:/# cd /sys/class/sunxi_dump

cd /sys/class/sunxi_dump

[email protected]:/sys/class/sunxi_dump#

[email protected]:/sys/class/sunxi_dump# ll

ll

drwxr-xr-x    2 root     root             0 Jan  1 08:29 .

drwxr-xr-x   48 root     root             0 Jan  1 08:29 ..

-rw-r--r--    1 root     root          4096 Jan  1 08:29 compare

-rw-r--r--    1 root     root          4096 Jan  1 08:29 dump

-rw-r--r--    1 root     root          4096 Jan  1 08:29 write

[email protected]:/sys/class/sunxi_dump#

[email protected]:/sys/class/sunxi_dump#

[email protected]:/sys/class/sunxi_dump# echo 0x01C208FC > dump;cat dump

echo 0x01C208FC > dump;cat dump

0x77222227

[email protected]:/#

[email protected]:/# find . -name pwm*

./sys/devices/virtual/misc/misc_dev/pwm_leds

./sys/kernel/debug/pwm

[email protected]:/#

[email protected]:/# cd /sys/kernel/debug

[email protected]:/sys/kernel/debug# cat pwm

platform/sunxi_pwm, 2 PWM devices

 pwm-0   (led_red             ): requested

 pwm-1   (led_blue            ): requested enabled

[email protected]:/sys/kernel/debug#

[email protected]:/#

[email protected]:/# cd /sys/devices/virtual/misc/misc_dev/pwm_leds

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# ll

drwxr-xr-x    2 root     root             0 Jan  1 08:30 .

drwxr-xr-x    4 root     root             0 Jan  1 08:29 ..

-rw-rw-r--    1 root     root          4096 Jan  1 08:30 blue_func

-rw-rw-r--    1 root     root          4096 Jan  1 08:30 red_func

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# cat blue_func 

[  367.939811] **** wyb drivers/misc/leds/pwm_leds.c-245-get_blue_func

9

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

1預設值為9頻率416.7HZ

501在全志r16平台tinav3.0系統下調通pwm1的10KHZ波形

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# echo 0 > blue_func 

[  387.486088] **** wyb drivers/misc/leds/pwm_leds.c-255-set_blue_func

[  387.498988] pwm_id = 1,>>>function = 0+++

[  387.505686] **** wyb drivers/misc/leds/pwm_leds.c-65-set_pwm

[  387.523484] **** wyb drivers/misc/leds/pwm_leds.c-74-set_pwm

[  387.529991] **** wyb drivers/misc/leds/pwm_leds.c-300-set_blue_func

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# cat blue_func 

[  505.578676] **** wyb drivers/misc/leds/pwm_leds.c-245-get_blue_func

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

配置值為0頻率10KHZ最暗

501在全志r16平台tinav3.0系統下調通pwm1的10KHZ波形

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# echo 1 > blue_func 

[  512.697534] **** wyb drivers/misc/leds/pwm_leds.c-255-set_blue_func

[  512.709935] pwm_id = 1,>>>function = 1+++

[  512.716597] **** wyb drivers/misc/leds/pwm_leds.c-65-set_pwm

[  512.726517] **** wyb drivers/misc/leds/pwm_leds.c-74-set_pwm

[  512.735989] **** wyb drivers/misc/leds/pwm_leds.c-300-set_blue_func

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# cat blue_func 

[  578.443656] **** wyb drivers/misc/leds/pwm_leds.c-245-get_blue_func

1

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

配置值為1頻率10KHZ中等亮度

501在全志r16平台tinav3.0系統下調通pwm1的10KHZ波形

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# echo 2 > blue_func [  607.022921] **** wyb drivers/misc/leds/pwm_leds.c-255-set_blue_func

[  607.037085] pwm_id = 1,>>>function = 2+++

[  607.043501] **** wyb drivers/misc/leds/pwm_leds.c-65-set_pwm

[  607.053190] **** wyb drivers/misc/leds/pwm_leds.c-74-set_pwm

[  607.064587] **** wyb drivers/misc/leds/pwm_leds.c-300-set_blue_func

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# echo 2 > blue_func 

[  662.857794] **** wyb drivers/misc/leds/pwm_leds.c-255-set_blue_func

[  662.870006] pwm_id = 1,>>>function = 2+++

[  662.877317] **** wyb drivers/misc/leds/pwm_leds.c-65-set_pwm

[  662.890735] **** wyb drivers/misc/leds/pwm_leds.c-74-set_pwm

[  662.898948] **** wyb drivers/misc/leds/pwm_leds.c-300-set_blue_func

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# cat blue_func 

[  674.138688] **** wyb drivers/misc/leds/pwm_leds.c-245-get_blue_func

2

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

配置為值為2頻率10KHZ最高亮度:

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds#

501在全志r16平台tinav3.0系統下調通pwm1的10KHZ波形

(有興趣的可以看看:)

[email protected]:/sys/devices/virtual/misc/misc_dev/pwm_leds# cd ..

[email protected]:/sys/devices/virtual/misc/misc_dev#

[email protected]:/sys/devices/virtual/misc/misc_dev#

[email protected]:/sys/devices/virtual/misc/misc_dev# ll

drwxr-xr-x    4 root     root             0 Jan  1 08:29 .

drwxr-xr-x   22 root     root             0 Jan  1 08:29 ..

-r--r--r--    1 root     root          4096 Jan  1 08:29 dev

drwxr-xr-x    2 root     root             0 Jan  1 08:30 power

drwxr-xr-x    2 root     root             0 Jan  1 08:30 pwm_leds

lrwxrwxrwx    1 root     root             0 Jan  1 08:30 subsystem -> ../../../../class/misc

-rw-r--r--    1 root     root          4096 Jan  1 08:29 uevent

[email protected]:/sys/devices/virtual/misc/misc_dev#