[RK3288][Android6.0] 调试笔记 --- 通用GPIO驱动控制LED

Platform: ROCKCHIP
OS: Android 6.0
Kernel: 3.10.92

由于板子没有lcd无法得知sd卡升级是否完成,因此使用LED显示.
Recovery中升级完成后控制GPIO输出高电平点亮LED.

系统自带GPIO控制驱动:
内核已经自带了通用GPIO驱动,可以直接在用户空间操作.
路径: /sys/class/gpio
root@rk3288:/sys/class/gpio # ls
export
gpiochip0
gpiochip120
gpiochip152
gpiochip184
gpiochip216
gpiochip24
gpiochip248
gpiochip280
gpiochip56
gpiochip88
unexport

比如我要操作GPIO8_A6作为高电平输出有效, 那么有以下问题:
1. 对应的gpio number是多少呢?
2. 如何设置成输出
3. 如何输出高电平

问题1:
可以通过/sys/kernel/debug/gpio查询信息:
root@rk3288:/sys/kernel/debug # cat gpio                                       
//snip
GPIOs 184-215, platform/ff770000.pinctrl, gpio6:
 gpio-193 (?                   ) in  hi
 gpio-194 (?                   ) in  hi

GPIOs 216-247, platform/ff770000.pinctrl, g
  • 8
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
以下是一个可以用于SD卡启动的rk3288-evb-android-act8846-ed.dts示例,仅供参考: ``` /dts-v1/; /include/ "rk3288.dtsi" / { model = "Rockchip RK3288 EVB with act8846 and edp"; chosen { bootargs = "earlyprintk console=ttyS2,115200n8 root=/dev/mmcblk1p2 rw rootwait"; }; memory@60000000 { reg = <0x60000000 0x40000000>; }; reserved-memory { #address-cells = <1>; #size-cells = <1>; ranges; kernel@0 { reg = <0x60000000 0x02000000>; }; reserved@20000000 { reg = <0x20000000 0x20000000>; }; }; aliases { mmc0 = &sdmmc; }; sdmmc: sdmmc@fe310000 { compatible = "rockchip,rk3288-dw-mshc"; reg = <0xfe310000 0x1000>; interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru PCLK_SDMMC0>, <&cru SCLK_SDMMC0>; clock-names = "pclk", "hclk"; dmas = <&pdma 12>, <&pdma 12>; dma-names = "rx", "tx"; pinctrl-0 = <&sdmmc_pins>; pinctrl-names = "default"; status = "okay"; }; sdmmc_pins: sdmmc@0 { rockchip,pins = < RK_GPIO1 1 RK_FUNC_2 RK_GPIO1 2 RK_FUNC_2 RK_GPIO1 3 RK_FUNC_2 RK_GPIO1 4 RK_FUNC_2 RK_GPIO1 5 RK_FUNC_2 RK_GPIO1 6 RK_FUNC_2 RK_GPIO1 7 RK_FUNC_2 RK_GPIO1 8 RK_FUNC_2 >; }; act8846: act8846@5b { compatible = "active-semi,act8846"; reg = <0x5b>; gpio-controller; #gpio-cells = <2>; interrupt-parent = <&gpio1>; interrupts = <14 IRQ_TYPE_EDGE_RISING>; pinctrl-names = "default"; pinctrl-0 = <&act8846_pins>; status = "okay"; }; act8846_pins: act8846@0 { rockchip,pins = < RK_GPIO4 3 RK_FUNC_GPIO RK_GPIO4 4 RK_FUNC_GPIO RK_GPIO4 5 RK_FUNC_GPIO >; }; edp: edp@1c19000 { compatible = "rockchip,rk3288-edp"; reg = <0x01c19000 0x1000>; interrupts = <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cru SCLK_EDP>; clock-names = "edp"; status = "okay"; }; backlight: backlight { compatible = "pwm-backlight"; pwms = <&pwm2 0 5000>; brightness-levels = <0 14 28 42 56 70 84 100>; default-brightness-level = <7>; status = "okay"; }; }; ``` 这个示例中,sdmmc节点表示SD卡,act8846节点表示PMIC,edp节点表示eDP显示器接口,backlight节点表示背光控制。其中,bootargs设置了SD卡启动的相关参数。注意,这个示例是根据某个特定的rk3288 EVB开发板进行配置的,如果你的硬件不同,需要进行相应的修改。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值