读linux-2.6.38内核,分析led驱动内核

先关注几个目录,内核的drivers/目录下找到leds,然后找到s3c24xx.c文件,
static struct platform_driver s3c24xx_led_driver = {
.probe = s3c24xx_led_probe,
.remove = s3c24xx_led_remove,
.driver = {
.name = "s3c24xx_led",
.owner = THIS_MODULE,
},
};

然后看原理图,看led的驱动引脚。
根据需要,修改路径 arch\arm\plat-s3c24xx\common-smdk.c下的

static struct s3c24xx_led_platdata smdk_pdata_led4 = {
    .gpio       = S3C2410_GPF(4),
    .flags      = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
    .name       = "led4",
    .def_trigger    = "timer",
};

static struct s3c24xx_led_platdata smdk_pdata_led5 = {
    .gpio       = S3C2410_GPF(5),
    .flags      = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
    .name       = "led5",
    .def_trigger    = "nand-disk",
};

static struct s3c24xx_led_platdata smdk_pdata_led6 = {
    .gpio       = S3C2410_GPF(6),
    .flags      = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
    .name       = "led6",
};

static struct s3c24xx_led_platdata smdk_pdata_led7 = {
    .gpio       = S3C2410_GPF(7),
    .flags      = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
    .name       = "led7",
};

其他进行编译测试,有问题再改。

你可能感兴趣的:(linux)