N32926 LED 驱动调试

linux-2.6.35.4_fa92
make menuconfig
--->LED SUPPORT
--->

在这里插入图片描述

1、.config

CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y#
# LED drivers## 
CONFIG_LEDS_PCA9532 is not set
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_GPIO_PLATFORM=y
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_DAC124S085 is not set
# CONFIG_LEDS_BD2802 is not set
# CONFIG_LEDS_LT3593 is not set
CONFIG_LEDS_TRIGGERS=y
## LED Triggers#
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
CONFIG_LEDS_TRIGGER_GPIO=y
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y

2、arch/arm/mach-w55fa92/w55fa92.c

@@ -17,8 +17,13 @@
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <mach/w55fa92_reg.h>
#include <mach/w55fa92_gpio.h>
#include <mach/hardware.h>
#include <mach/serial.h>
#include <linux/irq.h>
#include <linux/io.h>
#include <linux/gpio.h>
#include <linux/leds.h>
#include "cpu.h"
#include "dev.h"
#include "clock.h"
@@ -261,6 +266,32 @@
static struct platform_device *uart_devices[] __initdata = {
   &w55fa92_uart0,
   &w55fa92_uart1
};
/* 添加gpio值 */
static struct gpio_led w55fa92_led_pins[] = {
   {
      .name   = "led-gpio-b",
      .gpio   = 72,
   },
   {
      .name   = "led-gpio-g",
      .gpio   = 73,
   },
   {
      .name   = "led-gpio-r",
      .gpio   = 74,
   },
};
static struct gpio_led_platform_data w55fa92_led_data = {
   .num_leds   = ARRAY_SIZE(w55fa92_led_pins),
   .leds      = w55fa92_led_pins,
};
static struct platform_device w55fa92_leds = {
   .name      = "leds-gpio",
   .id         = -1,
   .dev      = {
      .platform_data   = &w55fa92_led_data,
   },
};
static int w55fa92_uart_count = 0;
@@ -507,5 +538,6 @@
void __init w55fa92_board_init(void)
{
   platform_add_devices(w55fa92_uart_devs, w55fa92_uart_count);
   platform_device_register(&w55fa92_leds);
   w55fa92_dev_init();
}
// LED RGB IO是GPC8、GPC9、GPC10

GPIO计算方式

GPA[ 0] = GPIO[ 0x00] = GPIO0
GPA[ 1] = GPIO[ 0x01] = GPIO1
GPA[31] = GPIO[ 0x1F] = GPIO31
GPB[ 0] = GPIO[ 0x20]  = GPIO32
GPB[31] = GPIO[ 0x3F] = GPIO63
GPC[ 0] = GPIO[ 0x40] = GPIO64
GPD[ 0] = GPIO[ 0x60] = GPIO96
GPE[ 0] = GPIO[ 0x80] = GPIO128
GPG[ 0] = GPIO[ 0xA0] = GPIO160
GPH[ 0] = GPIO[ 0xC0] = GPIO192
GPH[31] = GPIO[ 0xDF] = GPIO223

GPC8==72、GPC9==73、GPC10==74
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值