全志H3 耳机检测驱动代码

一管脚注册耳机插入的管脚gpio注册放在了sys_config.fex文件里面了。二 驱动代码文件/** Copyright (c) 2015, lvan xiong* All rights reserved.** 文件名称: zhc_key.c* 摘 要: 按键检测驱动* * 当前版本: 1.0* 作 者: lvan xiong* 完成
摘要由CSDN通过智能技术生成

一管脚注册

耳机插入的管脚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;
#
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值