一管脚注册
耳机插入的管脚gpio注册放在了sys_config.fex文件里面了。
Linein_gpio1 = port:PG09<0>~~~
二 驱动代码文件
/*
* Copyright (c) 2015, lvan xiong
* All rights reserved.
*
* 文件名称: zhc_key.c
* 摘 要: 按键检测驱动
*
* 当前版本: 1.0
* 作 者: ~~~~
* 完成日期:
*
* 取代版本:
* 原作者 :
* 完成日期:
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/pm.h>
#include <linux/earlysuspend.h>
#endif
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/keyboard.h>
#include <linux/ioport.h>
#include <asm/irq.h>
#include <asm/io.h>
#include <linux/timer.h>
#include <linux/clk.h>
#include <mach/sys_config.h>
#include <linux/gpio.h>
#include <mach/irqs.h>
//#include <mach/system.h>
#include <mach/hardware.h>
#include <mach/gpio.h>
//#include <mach/clock.h>
#include <linux/regulator/consumer.h>
#include <linux/platform_device.h>
//#include "sun8i-keyboard.h"
//#include <linux/power/scenelock.h>
//#define __ISDEBUG__
#ifdef __ISDEBUG__
#define dprintk(format,...) printk(" --> Fun: %s, Line: %05d "format" <--\n", __func__, __LINE__,##__VA_ARGS__)
#else
#define dprintk(format,...)
#endif
u32 linein1 = 0;
u32 linein2 = 0;
static char* machine;
script_item_u item_val;
script_item_value_type_e item_type;
//u32 g_PowerDetectIO2 = 0; // 船型开关检测IO
//u32 TouchKeyIO2 = 0; // 功放电源控制电路
//u32 TouchKeyIO3 = 0; // 小负载控制电路
int gpio1,gpio2;
//static int virq;
//u32 g_IRQPowerDetectHandle = 0; // 中断句柄
//struct work_struct g_stIRQPowerDetect; // 中断下半部
struct delayed_work g_DelayTask;
//static struct input_dev *g_PowerDec_input_dev; // 键值上报
//struct device g_dev;
//struct device *dev = &pdev->dev;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct sunxi_g_power_data {
struct early_suspend early_suspend;
};
/*
#else
#ifdef CONFIG_PM
static struct dev_pm_domain keyboard_pm_domain;
#endif
*/
#endif
#ifdef CONFIG_HAS_EARLYSUSPEND
static struct sunxi_g_power_data *g_power_data;
#