mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
Wm8994 codec 修改通话通路和蓝牙通路,添加18信息机耳机检测
根据锐合的板子调试了通话通路。 另外添加了18信息机耳机检测,添加了上升沿下降沿触发选项,添加了耳机接入时管脚是高电平或低电平选项。
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include "../../../drivers/input/touchscreen/xpt2046_ts.h"
|
||||
#include "../../../drivers/staging/android/timed_gpio.h"
|
||||
#include "../../../sound/soc/codecs/wm8994.h"
|
||||
#include "../../../drivers/headset_observe/rk2818_headset.h"
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>rk2818_gpioBank<6E><6B><EFBFBD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>GPIO<49>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>ID<49>ͼĴ<CDBC><C4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7>
|
||||
@@ -1337,6 +1338,21 @@ struct platform_device rk2818_device_dm9k = {
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HEADSET_DET
|
||||
struct rk2818_headset_data rk2818_headset_info = {
|
||||
.irq = TCA6424_P23,
|
||||
.irq_type = IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING,
|
||||
.headset_in_type= HEADSET_IN_HIGH,
|
||||
};
|
||||
|
||||
struct platform_device rk28_device_headset = {
|
||||
.name = "rk2818_headsetdet",
|
||||
.id = 0,
|
||||
.dev = {
|
||||
.platform_data = &rk2818_headset_info,
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
/*****************************************************************************************
|
||||
* nand flash devices
|
||||
@@ -1425,7 +1441,9 @@ static struct platform_device *devices[] __initdata = {
|
||||
#ifdef CONFIG_DM9000
|
||||
&rk2818_device_dm9k,
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HEADSET_DET
|
||||
&rk28_device_headset,
|
||||
#endif
|
||||
#ifdef CONFIG_DWC_OTG
|
||||
&rk2818_device_dwc_otg,
|
||||
#endif
|
||||
|
||||
@@ -1486,7 +1486,9 @@ struct platform_device rk2818_device_dm9k = {
|
||||
|
||||
#ifdef CONFIG_HEADSET_DET
|
||||
struct rk2818_headset_data rk2818_headset_info = {
|
||||
.irq = FPGA_PIO0_00,
|
||||
.irq = FPGA_PIO0_00,
|
||||
.irq_type = IRQF_TRIGGER_FALLING,
|
||||
.headset_in_type= HEADSET_IN_HIGH,
|
||||
};
|
||||
|
||||
struct platform_device rk28_device_headset = {
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include "rk2818_headset.h"
|
||||
|
||||
/* Debug */
|
||||
#if 0
|
||||
#if 1
|
||||
#define DBG printk
|
||||
#else
|
||||
#define DBG
|
||||
@@ -58,22 +58,44 @@ struct rk2818_headset_dev{
|
||||
static struct rk2818_headset_dev Headset_dev;
|
||||
static struct work_struct g_headsetobserve_work;
|
||||
static struct rk2818_headset_data *prk2818_headset_info;
|
||||
static irqreturn_t headset_interrupt(int irq, void *dev_id);
|
||||
unsigned int headset_irq_type;
|
||||
|
||||
static void headsetobserve_work(void)
|
||||
{
|
||||
if(gpio_get_value(prk2818_headset_info->irq))
|
||||
Headset_dev.cur_headset_status = BIT_HEADSET;
|
||||
else
|
||||
Headset_dev.cur_headset_status = ~(BIT_HEADSET|BIT_HEADSET_NO_MIC);
|
||||
if(gpio_get_value(prk2818_headset_info->irq)){
|
||||
if(prk2818_headset_info->headset_in_type)
|
||||
Headset_dev.cur_headset_status = BIT_HEADSET;
|
||||
else
|
||||
Headset_dev.cur_headset_status = ~(BIT_HEADSET|BIT_HEADSET_NO_MIC);
|
||||
|
||||
if(Headset_dev.cur_headset_status != Headset_dev.pre_headset_status)
|
||||
{
|
||||
Headset_dev.pre_headset_status = Headset_dev.cur_headset_status;
|
||||
mutex_lock(&Headset_dev.mutex_lock);
|
||||
if(headset_irq_type != (IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING))
|
||||
headset_irq_type = IRQF_TRIGGER_FALLING;
|
||||
}
|
||||
else{
|
||||
if(prk2818_headset_info->headset_in_type)
|
||||
Headset_dev.cur_headset_status = ~(BIT_HEADSET|BIT_HEADSET_NO_MIC);
|
||||
else
|
||||
Headset_dev.cur_headset_status = BIT_HEADSET;
|
||||
|
||||
if(headset_irq_type != (IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING))
|
||||
headset_irq_type = IRQF_TRIGGER_RISING;
|
||||
}
|
||||
|
||||
if(Headset_dev.cur_headset_status != Headset_dev.pre_headset_status)
|
||||
{
|
||||
Headset_dev.pre_headset_status = Headset_dev.cur_headset_status;
|
||||
mutex_lock(&Headset_dev.mutex_lock);
|
||||
switch_set_state(&Headset_dev.sdev, Headset_dev.cur_headset_status);
|
||||
mutex_unlock(&Headset_dev.mutex_lock);
|
||||
DBG("---------------cur_headset_status = [0x%x]\n", Headset_dev.cur_headset_status);
|
||||
}
|
||||
}
|
||||
|
||||
if(headset_irq_type == (IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING))return;
|
||||
|
||||
free_irq(prk2818_headset_info->irq,NULL);
|
||||
if (request_irq(prk2818_headset_info->irq, headset_interrupt, headset_irq_type, NULL, NULL))
|
||||
DBG("headsetobserve: request irq failed\n");
|
||||
}
|
||||
|
||||
static irqreturn_t headset_interrupt(int irq, void *dev_id)
|
||||
@@ -97,7 +119,7 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
|
||||
prk2818_headset_info = pdev->dev.platform_data;
|
||||
|
||||
Headset_dev.cur_headset_status = 0;
|
||||
Headset_dev.pre_headset_status = 0;
|
||||
Headset_dev.pre_headset_status = 0;
|
||||
Headset_dev.sdev.name = "h2w";
|
||||
Headset_dev.sdev.print_name = h2w_print_name;
|
||||
mutex_init(&Headset_dev.mutex_lock);
|
||||
@@ -106,23 +128,27 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
|
||||
if (ret < 0)
|
||||
return 0;
|
||||
|
||||
INIT_WORK(&g_headsetobserve_work, headsetobserve_work);
|
||||
INIT_WORK(&g_headsetobserve_work, headsetobserve_work);
|
||||
|
||||
ret = gpio_request(prk2818_headset_info->irq, "headset_det");
|
||||
ret = gpio_request(prk2818_headset_info->irq, "headset_det");
|
||||
if (ret) {
|
||||
DBG( "headsetobserve: failed to request FPGA_PIO0_00\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
gpio_direction_input(prk2818_headset_info->irq);
|
||||
gpio_direction_input(prk2818_headset_info->irq);
|
||||
|
||||
headsetobserve_work();//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>һ<EFBFBD>μ<EFBFBD><CEBC><EFBFBD>һ<EFBFBD><D2BB>
|
||||
|
||||
prk2818_headset_info->irq = gpio_to_irq(prk2818_headset_info->irq);
|
||||
ret = request_irq(prk2818_headset_info->irq, headset_interrupt, IRQF_TRIGGER_FALLING, NULL, NULL);
|
||||
if (ret ) {
|
||||
DBG("headsetobserve: request irq failed\n");
|
||||
return ret;
|
||||
headset_irq_type = prk2818_headset_info->irq_type;
|
||||
headsetobserve_work();
|
||||
|
||||
if(headset_irq_type == (IRQF_TRIGGER_FALLING|IRQF_TRIGGER_RISING)){
|
||||
free_irq(prk2818_headset_info->irq,NULL);
|
||||
ret = request_irq(prk2818_headset_info->irq, headset_interrupt, headset_irq_type, NULL, NULL);
|
||||
if (ret ) {
|
||||
DBG("headsetobserve: request irq failed\n");
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
#ifndef RK2818_HEADSET_H
|
||||
#define RK2818_HEADSET_H
|
||||
|
||||
#define HEADSET_IN_HIGH 0x00000001
|
||||
#define HEADSET_IN_LOW 0x00000000
|
||||
|
||||
/* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9> */
|
||||
struct rk2818_headset_data {
|
||||
unsigned int irq;
|
||||
unsigned int irq;
|
||||
unsigned int irq_type;
|
||||
unsigned int headset_in_type;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user