本文主要是介绍Linux_tq2440_背光灯驱动分析,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
背光灯的引脚是S3C2410_GPG4
可以这样定义
#define S3C2410_GPIO_BANKG (32*6)
#define S3C2410_GPG4 S3C2410_GPIONO(S3C2410_GPIO_BANKG, 4)
#define S3C2410_GPG4_INP (0x00 << 8)
#define S3C2410_GPG4_OUTP (0x01 << 8)
#define S3C2410_GPG4_EINT12 (0x02 << 8)
#define S3C2400_GPG4_MMCCLK (0x02 << 8)
#define S3C2400_GPG4_I2SSDI (0x03 << 8)
#define S3C2410_GPG4_LCDPWREN (0x03 << 8)
#define S3C2443_GPG4_LCDPWRDN (0x03 << 8)
static int tq2440_backlight_ioctl(
struct inode *inode,
struct file *file,
unsigned int cmd,
unsigned long arg)
{
switch(cmd)
{
case 0:
s3c2410_gpio_setpin(S3C2410_GPG4, 0);
printk(DEVICE_NAME " Turn Off!\n");
return 0;
case 1:
s3c2410_gpio_setpin(S3C2410_GPG4, 1);
printk(DEVICE_NAME " Turn On!\n");
return 0;
default:
return -EINVAL;
}
}
程序调用的时候使用
fd = open("/dev/backlight", O_RDWR);
ioctl(fd, 0);
close(fd);
这篇关于Linux_tq2440_背光灯驱动分析的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!