Merge branch 'develop' of 10.10.10.29:/home/rockchip/kernel into develop

This commit is contained in:
xbw 2011-09-22 13:19:11 +08:00
commit 42630d2ac8
13 changed files with 1027 additions and 151 deletions

View File

@ -230,8 +230,9 @@ CONFIG_MACH_RK29_PHONEPADSDK=y
# CONFIG_DDR_TYPE_DDR3_2133N is not set
CONFIG_DDR_TYPE_DDR3_DEFAULT=y
CONFIG_RK29_MEM_SIZE_M=512
CONFIG_DDR_SDRAM_FREQ=400
CONFIG_DDR_FREQ=y
CONFIG_DDR_SDRAM_FREQ=456
# CONFIG_DDR_RECONFIG is not set
CONFIG_WIFI_CONTROL_FUNC=y
#
# RK29 VPU (Video Processing Unit) support

View File

@ -1440,7 +1440,11 @@ struct platform_device rk29_device_gps = {
*****************************************************************************************/
struct wm8994_pdata wm8994_platdata = {
.BB_input_diff = 0,
.phone_pad = 0,
.BB_class = NO_PCM_BB,
.no_earpiece = 0,
.sp_hp_same_channel = 0,
.PA_control_pin = RK29_PIN6_PD3,
.Power_EN_Pin = RK29_PIN5_PA1,

View File

@ -1513,9 +1513,13 @@ struct platform_device rk29_device_gps = {
* author: qjb@rock-chips.com
*****************************************************************************************/
struct wm8994_pdata wm8994_platdata = {
.BB_input_diff = 0,
.phone_pad = 0,
.BB_input_diff = 0,
.BB_class = NO_PCM_BB,
.no_earpiece = 0,
.sp_hp_same_channel = 0,
.PA_control_pin = 0,
.Power_EN_Pin = RK29_PIN5_PA1,

View File

@ -608,7 +608,10 @@ int laibao_init_platform_hw(void)
struct laibao_platform_data laibao_info = {
.model= 1003,
.init_platform_hw= laibao_init_platform_hw,
.lcd_disp_on_pin = RK29_PIN6_PD0,
.disp_on_value = GPIO_HIGH,
.lcd_cs_pin = RK29_PIN6_PD1,
.lcd_cs_value = GPIO_HIGH,
};
#endif
@ -719,112 +722,12 @@ struct bq27510_platform_data bq27510_info = {
* wm8994 codec
* author: qjb@rock-chips.com
*****************************************************************************************/
//#if defined(CONFIG_MFD_WM8994)
#if defined (CONFIG_REGULATOR_WM8994)
static struct regulator_consumer_supply wm8994_ldo1_consumers[] = {
{
.supply = "DBVDD",
},
{
.supply = "AVDD1",
},
{
.supply = "CPVDD",
},
{
.supply = "SPKVDD1",
}
};
static struct regulator_consumer_supply wm8994_ldo2_consumers[] = {
{
.supply = "DCVDD",
},
{
.supply = "AVDD2",
},
{
.supply = "SPKVDD2",
}
};
struct regulator_init_data regulator_init_data_ldo1 = {
.constraints = {
.name = "wm8994-ldo1",
.min_uA = 00000,
.max_uA = 18000,
.always_on = true,
.apply_uV = true,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
},
.num_consumer_supplies = ARRAY_SIZE(wm8994_ldo1_consumers),
.consumer_supplies = wm8994_ldo1_consumers,
};
struct regulator_init_data regulator_init_data_ldo2 = {
.constraints = {
.name = "wm8994-ldo2",
.min_uA = 00000,
.max_uA = 18000,
.always_on = true,
.apply_uV = true,
.valid_ops_mask = REGULATOR_CHANGE_STATUS | REGULATOR_CHANGE_CURRENT,
},
.num_consumer_supplies = ARRAY_SIZE(wm8994_ldo2_consumers),
.consumer_supplies = wm8994_ldo2_consumers,
};
#endif
struct wm8994_drc_cfg wm8994_drc_cfg_pdata = {
.name = "wm8994_DRC",
.regs = {0,0,0,0,0},
};
struct wm8994_retune_mobile_cfg wm8994_retune_mobile_cfg_pdata = {
.name = "wm8994_EQ",
.rate = 0,
.regs = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,},
};
struct wm8994_pdata wm8994_platdata = {
#if defined (CONFIG_GPIO_WM8994)
.gpio_base = WM8994_GPIO_EXPANDER_BASE,
//Fill value to initialize the GPIO
.gpio_defaults ={},
#endif
//enable=0 disable ldo
#if defined (CONFIG_REGULATOR_WM8994)
.ldo = {
{
.enable = 0,
//RK29_PIN5_PA1
.supply = NULL,
.init_data = &regulator_init_data_ldo1,
},
{
.enable = 0,
.supply = NULL,
.init_data = &regulator_init_data_ldo2,
}
},
#endif
//DRC 0--use default
.num_drc_cfgs = 0,
.drc_cfgs = &wm8994_drc_cfg_pdata,
//EQ 0--use default
.num_retune_mobile_cfgs = 0,
.retune_mobile_cfgs = &wm8994_retune_mobile_cfg_pdata,
.lineout1_diff = 1,
.lineout2_diff = 1,
.lineout1fb = 1,
.lineout2fb = 1,
.micbias1_lvl = 1,
.micbias2_lvl = 1,
.jd_scthr = 0,
.jd_thr = 0,
.no_earpiece = 1,
.sp_hp_same_channel = 1,
.BB_input_diff = 1,
.phone_pad = 1,
.BB_class = PCM_BB,
.PA_control_pin = RK29_PIN6_PB6,
.Power_EN_Pin = RK29_PIN5_PA1,
@ -1364,7 +1267,7 @@ static int rk29_backlight_pwm_suspend(void)
return -1;
}
gpio_direction_output(PWM_GPIO, GPIO_LOW);
#ifdef LCD_DISP_ON_PIN
#if 0//def LCD_DISP_ON_PIN
gpio_direction_output(BL_EN_PIN, 0);
gpio_set_value(BL_EN_PIN, !BL_EN_VALUE);
#endif
@ -1376,7 +1279,7 @@ static int rk29_backlight_pwm_resume(void)
gpio_free(PWM_GPIO);
rk29_mux_api_set(PWM_MUX_NAME, PWM_MUX_MODE);
#ifdef LCD_DISP_ON_PIN
#if 0//def LCD_DISP_ON_PIN
msleep(30);
gpio_direction_output(BL_EN_PIN, 1);
gpio_set_value(BL_EN_PIN, BL_EN_VALUE);

View File

@ -307,6 +307,10 @@ struct laibao_platform_data {
int (*laibao_platform_sleep)(void);
int (*laibao_platform_wakeup)(void);
void (*exit_platform_hw)(void);
int lcd_disp_on_pin;
int disp_on_value;
int lcd_cs_pin;
int lcd_cs_value;
};
struct akm8975_platform_data {

View File

@ -30,6 +30,17 @@
#include <linux/async.h>
#include <mach/gpio.h>
#include <mach/board.h>
#include <linux/earlysuspend.h>
struct FTS_TS_DATA_T {
struct i2c_client *client;
struct input_dev *input_dev;
struct FTS_TS_EVENT_T event;
struct work_struct pen_event_work;
struct workqueue_struct *ts_workqueue;
struct early_suspend early_suspend;
};
/* -------------- global variable definition -----------*/
static struct i2c_client *this_client;
static REPORT_FINGER_INFO_T _st_finger_infos[CFG_MAX_POINT_NUM];
@ -54,6 +65,13 @@ char *tsp_keyname[CFG_NUMOFKEYS] ={
static bool tsp_keystatus[CFG_NUMOFKEYS];
#ifdef CONFIG_HAS_EARLYSUSPEND
static void ft5x0x_ts_early_suspend(struct early_suspend *h);
static void ft5x0x_ts_late_resume(struct early_suspend *h);
#endif
/***********************************************************************
[function]:
callback: read data from ctpm by i2c interface;
@ -234,7 +252,7 @@ static int fts_i2c_rxdata(u8 *rxdata, int length)
ret = i2c_transfer(this_client->adapter, &msg, 1);
if (ret < 0)
pr_err("msg %s i2c write error: %d\n", __func__, ret);
pr_err("msg %s line:%d i2c write error: %d\n", __func__, __LINE__,ret);
msg.addr = this_client->addr;
msg.flags = I2C_M_RD;
@ -242,7 +260,7 @@ static int fts_i2c_rxdata(u8 *rxdata, int length)
msg.buf = rxdata;
ret = i2c_transfer(this_client->adapter, &msg, 1);
if (ret < 0)
pr_err("msg %s i2c write error: %d\n", __func__, ret);
pr_err("msg %s line:%d i2c write error: %d\n", __func__,__LINE__, ret);
return ret;
}
@ -423,11 +441,9 @@ int fts_read_data(void)
_st_finger_infos[id].ui2_id = size;
_si_touch_num ++;
}
else
/*bad event, ignore*/
else /*bad event, ignore*/
continue;
if ( (touch_event==1) )
{
// printk("[TSP]id=%d up\n", id);
@ -436,7 +452,6 @@ int fts_read_data(void)
for( i= 0; i<CFG_MAX_POINT_NUM; ++i )
{
input_report_abs(data->input_dev, ABS_MT_TRACKING_ID, _st_finger_infos[i].ui2_id);
input_report_abs(data->input_dev, ABS_MT_TOUCH_MAJOR, _st_finger_infos[i].u2_pressure);
input_report_abs(data->input_dev, ABS_MT_POSITION_X, SCREEN_MAX_X - _st_finger_infos[i].i2_x);
@ -796,6 +811,66 @@ unsigned char fts_ctpm_get_upg_ver(void)
}
void ft5x0x_ts_set_standby(struct i2c_client *client, int enable)
{
struct laibao_platform_data *mach_info = client->dev.platform_data;
unsigned display_on = mach_info->lcd_disp_on_pin;
unsigned lcd_cs = mach_info->lcd_cs_pin;
int display_on_pol = mach_info->disp_on_value;
int lcd_cs_pol = mach_info->lcd_cs_value;
printk("%s : %s, enable = %d", __FILE__, __FUNCTION__,enable);
if(display_on != INVALID_GPIO)
{
gpio_direction_output(display_on, 0);
gpio_set_value(display_on, enable ? display_on_pol : !display_on_pol);
}
if(lcd_cs != INVALID_GPIO)
{
gpio_direction_output(lcd_cs, 0);
gpio_set_value(lcd_cs, enable ? lcd_cs_pol : !lcd_cs_pol);
}
}
#ifdef CONFIG_HAS_EARLYSUSPEND
static void ft5x0x_ts_early_suspend(struct early_suspend *h)
{
struct FTS_TS_DATA_T *data = i2c_get_clientdata(this_client);
printk("enter ft5x0x_ts_early_suspend\n");
disable_irq_nosync(this_client->irq);
cancel_work_sync(&data->pen_event_work);
ft5x0x_ts_set_standby(this_client,0);
return;
}
static void ft5x0x_ts_late_resume(struct early_suspend *h)
{
struct FTS_TS_DATA_T *data = i2c_get_clientdata(this_client);
ft5x0x_ts_set_standby(this_client,1);
if(!work_pending(&data->pen_event_work)){
PREPARE_WORK(&data->pen_event_work, fts_work_func);
queue_work(data->ts_workqueue, &data->pen_event_work);
}
else
enable_irq(this_client->irq);
printk("ft5x0x_ts_late_resume finish\n");
return ;
}
#else
#define egalax_i2c_suspend NULL
#define egalax_i2c_resume NULL
#endif
static int fts_ts_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
@ -826,6 +901,7 @@ static int fts_ts_probe(struct i2c_client *client, const struct i2c_device_id *i
}
this_client = client;
ft5x0x_ts->client = client;
i2c_set_clientdata(client, ft5x0x_ts);
INIT_WORK(&ft5x0x_ts->pen_event_work, fts_work_func);
@ -944,6 +1020,15 @@ static int fts_ts_probe(struct i2c_client *client, const struct i2c_device_id *i
goto exit_input_register_device_failed;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
ft5x0x_ts->early_suspend.level = EARLY_SUSPEND_LEVEL_DISABLE_FB + 1;
ft5x0x_ts->early_suspend.suspend = ft5x0x_ts_early_suspend;
ft5x0x_ts->early_suspend.resume = ft5x0x_ts_late_resume;
register_early_suspend(&ft5x0x_ts->early_suspend);
#endif
enable_irq(_sui_irq_num);
printk("[TSP] file(%s), function (%s), -- end\n", __FILE__, __FUNCTION__);
return 0;

10
drivers/input/touchscreen/ft5x0x_i2c_ts.h Normal file → Executable file
View File

@ -13,8 +13,8 @@
#define CFG_NUMOFKEYS 0x4 //number of touch keys
#ifdef CONFIG_FTS_CUSTOME_ENV
#define SCREEN_MAX_X 1024
#define SCREEN_MAX_Y 600
#define SCREEN_MAX_X 1044//1024
#define SCREEN_MAX_Y 620//600
#else
#define SCREEN_MAX_X 800
#define SCREEN_MAX_Y 480
@ -80,12 +80,6 @@ typedef enum
u8 touch_point;
};
struct FTS_TS_DATA_T {
struct input_dev *input_dev;
struct FTS_TS_EVENT_T event;
struct work_struct pen_event_work;
struct workqueue_struct *ts_workqueue;
};

View File

@ -299,7 +299,9 @@ config FM580X
config MU509
bool "MU509 modem control driver"
default n
config MW100
bool "MW100 modem control driver"
default n
config RK29_NEWTON
bool "RK29_NEWTON misc driver"
default n

274
drivers/misc/MW100.c Normal file
View File

@ -0,0 +1,274 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/i2c.h>
#include <linux/irq.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/platform_device.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/miscdevice.h>
#include <linux/circ_buf.h>
#include <linux/interrupt.h>
#include <linux/miscdevice.h>
#include <mach/iomux.h>
#include <mach/gpio.h>
#include <linux/delay.h>
#include <linux/poll.h>
#include <linux/wait.h>
#include <linux/wakelock.h>
#include <linux/workqueue.h>
#include <linux/mu509.h>
#include <mach/iomux.h>
#include<linux/ioctl.h>
MODULE_LICENSE("GPL");
//#define DEBUG
#ifdef DEBUG
#define MODEMDBG(x...) printk(x)
#else
#define MODEMDBG(fmt,argss...)
#endif
#define MW100IO 0XA1
#define MW_IOCTL_RESET _IO(MW100IO,0X01)
#define SLEEP 1
#define READY 0
#define MU509_RESET 0x01
static struct wake_lock modem_wakelock;
#define IRQ_BB_WAKEUP_AP_TRIGGER IRQF_TRIGGER_RISING
//#define IRQ_BB_WAKEUP_AP_TRIGGER IRQF_TRIGGER_RISING
struct rk29_mu509_data *gpdata = NULL;
static int bp_wakeup_ap_irq = 0;
static void ap_wakeup_bp(struct platform_device *pdev, int wake)
{
struct rk29_mu509_data *pdata = pdev->dev.platform_data;
MODEMDBG("ap_wakeup_bp\n");
gpio_set_value(pdata->ap_wakeup_bp, wake);
}
extern void rk28_send_wakeup_key(void);
static void do_wakeup(struct work_struct *work)
{
MODEMDBG("%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__);
rk28_send_wakeup_key();
enable_irq(bp_wakeup_ap_irq);
}
static DECLARE_DELAYED_WORK(wakeup_work, do_wakeup);
static irqreturn_t detect_irq_handler(int irq, void *dev_id)
{
disable_irq_nosync( irq);
printk("%s[%d]: %s\n", __FILE__, __LINE__, __FUNCTION__);
schedule_delayed_work(&wakeup_work, HZ / 10);
return IRQ_HANDLED;
}
int modem_poweron_off(int on_off)
{
struct rk29_mu509_data *pdata = gpdata;
if(on_off)
{
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
/*
gpio_set_value(pdata->bp_power, GPIO_LOW);
msleep(1000);
gpio_set_value(pdata->bp_power, GPIO_HIGH);
msleep(700);
gpio_set_value(pdata->ap_wakeup_bp, GPIO_LOW);
*/
}
else
{
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
/*
gpio_set_value(pdata->bp_power, GPIO_LOW);
mdelay(2500);
gpio_set_value(pdata->bp_power, GPIO_HIGH);
*/
}
return 0;
}
static int mu509_open(struct inode *inode, struct file *file)
{
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
//modem_poweron_off(1);
return 0;
}
static int mu509_release(struct inode *inode, struct file *file)
{
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
//modem_poweron_off(0);
return 0;
}
static int mu509_ioctl(struct inode *inode,struct file *file, unsigned int cmd, unsigned long arg)
{
struct rk29_mu509_data *pdata = gpdata;
switch(cmd)
{
case MW_IOCTL_RESET:
printk("%s::%d--bruins--ioctl mw100 reset\n",__func__,__LINE__);
gpio_direction_output(pdata->bp_reset,GPIO_LOW);
mdelay(120);
gpio_set_value(pdata->bp_reset, GPIO_HIGH);
break;
default:
break;
}
return 0;
}
static struct file_operations mu509_fops = {
.owner = THIS_MODULE,
.open = mu509_open,
.release = mu509_release,
.ioctl = mu509_ioctl
};
static struct miscdevice mu509_misc = {
.minor = MISC_DYNAMIC_MINOR,
.name = "mw100",
.fops = &mu509_fops
};
static int mu509_probe(struct platform_device *pdev)
{
struct rk29_mu509_data *pdata = gpdata = pdev->dev.platform_data;
struct modem_dev *mu509_data = NULL;
int result, irq = 0;
gpio_request(pdata->bp_power,"bp_power");
gpio_request(pdata->bp_reset,"bp_reset");
gpio_request(pdata->bp_wakeup_ap,"bp_wakeup_ap");
gpio_request(pdata->ap_wakeup_bp,"ap_wakeup_bp");
rk29_mux_api_set(GPIO6C76_CPUTRACEDATA76_NAME, GPIO4H_GPIO6C76);
gpio_direction_output(pdata->bp_reset,GPIO_LOW);
mdelay(120);
gpio_set_value(pdata->bp_reset, GPIO_HIGH);
gpio_set_value(pdata->ap_wakeup_bp, GPIO_HIGH);
gpio_direction_output(pdata->ap_wakeup_bp,GPIO_HIGH);
gpio_set_value(pdata->bp_power, GPIO_HIGH);
gpio_direction_output(pdata->bp_power,GPIO_HIGH);
mdelay(120);
gpio_set_value(pdata->bp_power, GPIO_LOW);
gpio_direction_output(pdata->bp_power,GPIO_LOW);
//±£Áô
/* gpio_set_value(pdata->bp_reset, GPIO_LOW);
gpio_direction_output(pdata->bp_reset,GPIO_LOW);
mdelay(120);
gpio_set_value(pdata->bp_reset, GPIO_HIGH);
gpio_direction_output(pdata->bp_reset,GPIO_HIGH);
*/
mu509_data = kzalloc(sizeof(struct modem_dev), GFP_KERNEL);
if(mu509_data == NULL){
printk("failed to request mu509_data\n");
goto err2;
}
platform_set_drvdata(pdev, mu509_data);
gpio_direction_input(pdata->bp_wakeup_ap);
irq = gpio_to_irq(pdata->bp_wakeup_ap);
if(irq < 0){
gpio_free(pdata->bp_wakeup_ap);
printk("failed to request bp_wakeup_ap\n");
}
bp_wakeup_ap_irq = irq;
result = request_irq(irq, detect_irq_handler, IRQ_BB_WAKEUP_AP_TRIGGER, "bp_wakeup_ap", NULL);
if (result < 0) {
printk("%s: request_irq(%d) failed\n", __func__, irq);
gpio_free(pdata->bp_wakeup_ap);
goto err0;
}
enable_irq_wake(bp_wakeup_ap_irq);
result = misc_register(&mu509_misc);
if(result){
MODEMDBG("misc_register err\n");
}
return result;
err0:
gpio_free(pdata->bp_wakeup_ap);
err1:
gpio_free(pdata->ap_wakeup_bp);
err2:
kfree(mu509_data);
return 0;
}
int mu509_suspend(struct platform_device *pdev)
{
struct rk29_mu509_data *pdata = pdev->dev.platform_data;
MODEMDBG("%s::%d--\n",__func__,__LINE__);
gpio_set_value(pdata->ap_wakeup_bp, GPIO_LOW);
return 0;
}
int mu509_resume(struct platform_device *pdev)
{
struct rk29_mu509_data *pdata = pdev->dev.platform_data;
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
gpio_set_value(pdata->ap_wakeup_bp, GPIO_HIGH);
return 0;
}
void mu509_shutdown(struct platform_device *pdev, pm_message_t state)
{
struct rk29_mu509_data *pdata = pdev->dev.platform_data;
struct modem_dev *mu509_data = platform_get_drvdata(pdev);
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
gpio_set_value(pdata->bp_power, GPIO_HIGH);
mdelay(2010);
gpio_free(pdata->bp_power);
gpio_free(pdata->bp_reset);
gpio_free(pdata->ap_wakeup_bp);
gpio_free(pdata->bp_wakeup_ap);
kfree(mu509_data);
}
static struct platform_driver mu509_driver = {
.probe = mu509_probe,
.shutdown = mu509_shutdown,
.suspend = mu509_suspend,
.resume = mu509_resume,
.driver = {
.name = "MW100",
.owner = THIS_MODULE,
},
};
static int __init mu509_init(void)
{
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
return platform_driver_register(&mu509_driver);
}
static void __exit mu509_exit(void)
{
MODEMDBG("%s::%d--bruins--\n",__func__,__LINE__);
platform_driver_unregister(&mu509_driver);
}
module_init(mu509_init);
module_exit(mu509_exit);

View File

@ -31,6 +31,7 @@ obj-$(CONFIG_APANIC) += apanic.o
obj-$(CONFIG_MTK23D) += mtk23d.o
obj-$(CONFIG_FM580X) += fm580x.o
obj-$(CONFIG_MU509) += mu509.o
obj-$(CONFIG_MW100) += MW100.o
obj-$(CONFIG_STE) += ste.o
obj-$(CONFIG_RK29_SUPPORT_MODEM) += rk29_modem/
obj-$(CONFIG_GPS_GNS7560) += gps/

View File

@ -373,6 +373,7 @@ static int option_resume(struct usb_serial *serial);
/* Thinkwill products */
#define THINKWILL_VENDOR_ID 0x19f5
#define THINKWILL_PRODUCT_ID 0x9909
#define THINKWILL_MI900_PRODUCT_ID 0x9013
/* Cinterion (formerly Siemens) products */
#define SIEMENS_VENDOR_ID 0x0681
@ -412,6 +413,9 @@ static int option_resume(struct usb_serial *serial);
static struct usb_device_id option_ids[] = {
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
{ USB_DEVICE(THINKWILL_VENDOR_ID,THINKWILL_PRODUCT_ID)},
{ USB_DEVICE(THINKWILL_VENDOR_ID,THINKWILL_MI900_PRODUCT_ID)},
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_LIGHT) },
{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA_QUAD) },

View File

@ -59,6 +59,9 @@ struct wm8994_retune_mobile_cfg {
u16 regs[WM8994_EQ_REGS];
};
#define PCM_BB 1
#define NO_PCM_BB 0
struct wm8994_pdata {
int gpio_base;
@ -94,16 +97,20 @@ struct wm8994_pdata {
unsigned int jd_thr:2;
//for phonepad
unsigned int phone_pad:1; // =0 is not phone_pad, =1 is phone_pad
unsigned int no_earpiece:1; // =1 don't have a earpiece, =0 has a earpiece
unsigned int sp_hp_same_channel:1;
//BB input can be differential or single ended
unsigned int BB_input_diff:1; // =0 single ended =1 differential
unsigned int BB_class:1;//PCM_BB= 1 NO_PCM_BB=0
//If an external amplifier speakers wm8994 enable>0 disable=0
unsigned int PA_control_pin;
//wm8994 LDO1_ENA and LDO2_ENA
unsigned int Power_EN_Pin;
char PowerEN_iomux_name[50];
int PowerEN_iomux_mode;
//volume
int speaker_incall_vol; //max = 6, min = -21

View File

@ -51,13 +51,11 @@ char debug_write_read = 0;
/* If digital BB is used,open this define.
Define what kind of digital BB is used. */
//#define PCM_BB
#ifdef PCM_BB
#define TD688_MODE
//#define MU301_MODE
//#define CHONGY_MODE
//#define THINKWILL_M800_MODE
#endif //PCM_BB
#if 1
#define DBG(x...) printk(KERN_INFO x)
@ -124,6 +122,11 @@ unsigned short BT_vol_table[16] ={0x01DB,0x01DC,0x01DD,0x01DE,0x01DF,0x01E0,
0x01E1,0x01E2,0x01E3,0x01E4,0x01E5,0x01E6,
0x01E7,0x01E8,0x01E9,0x01EA};
void (*handsetMIC_to_baseband_to_headset)(void);
void (*mainMIC_to_baseband_to_headset)(void);
void (*mainMIC_to_baseband_to_earpiece)(void);
void (*mainMIC_to_baseband_to_speakers)(void);
void (*BT_baseband)(void);
/* codec private data */
struct wm8994_priv {
@ -989,8 +992,8 @@ void AP_to_speakers(void)
wm8994_write(0x01, 0x3033);
}
#ifndef PCM_BB
void handsetMIC_to_baseband_to_headset(void)
void handsetMIC_to_BB_to_headset(void)
{//
struct wm8994_priv *wm8994 = wm8994_codec->private_data;
struct wm8994_pdata *pdata = wm8994->pdata;
@ -1044,7 +1047,7 @@ void handsetMIC_to_baseband_to_headset(void)
wm8994_set_level_volume();
}
void mainMIC_to_baseband_to_headset(void)
void mainMIC_to_BB_to_headset(void)
{//
struct wm8994_priv *wm8994 = wm8994_codec->private_data;
struct wm8994_pdata *pdata = wm8994->pdata;
@ -1099,7 +1102,7 @@ void mainMIC_to_baseband_to_headset(void)
wm8994_set_level_volume();
}
void mainMIC_to_baseband_to_earpiece(void)
void mainMIC_to_BB_to_earpiece(void)
{//
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1138,7 +1141,7 @@ void mainMIC_to_baseband_to_earpiece(void)
wm8994_set_level_volume();
}
void mainMIC_to_baseband_to_speakers(void)
void mainMIC_to_BB_to_speakers(void)
{//
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1187,7 +1190,7 @@ void mainMIC_to_baseband_to_speakers(void)
wm8994_set_level_volume();
}
void BT_baseband(void)
void BT_BB(void)
{//
struct wm8994_priv *wm8994 = wm8994_codec->private_data;
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1322,9 +1325,9 @@ void BT_baseband(void)
wm8994_write(0x04, 0x3303);
wm8994_write(0x05, 0x3303);
}
#else //PCM_BB
/******************PCM BB BEGIN*****************/
void handsetMIC_to_baseband_to_headset(void) //pcmbaseband
void handsetMIC_to_PCMBB_to_headset(void) //pcmbaseband
{
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1332,7 +1335,125 @@ void handsetMIC_to_baseband_to_headset(void) //pcmbaseband
wm8994_current_mode=wm8994_handsetMIC_to_baseband_to_headset;
wm8994_reset();
msleep(50);
#if 1
wm8994_write(0x01, 0x0003|wm8994_mic_VCC); //0x0013);
mdelay(50);
//GPIO configuration
wm8994_write(0x0700, 0xA101);
wm8994_write(0x39, 0x006C);
//VMID and BIAS
wm8994_write(0x01, 0x0023|wm8994_mic_VCC); //0x0013);
wm8994_write(0x200, 0x0000);
mdelay(50);
wm8994_write(0x200, 0x0001);
wm8994_write(0x220, 0x0000);
wm8994_write(0x221, 0x0700); //MCLK=12MHz //FLL1 CONTRLO(2)
wm8994_write(0x222, 0xB51E); //0x3126); //FLL1 CONTRLO(3)
wm8994_write(0x223, 0x0100); //FLL1 CONTRLO(4)
wm8994_write(0x220, 0x0004); //FLL1 CONTRLO(1)
//mdelay(50);
mdelay(10);
wm8994_write(0x220, 0x0005); //FLL1 CONTRLO(1)
mdelay(5);
wm8994_write(0x200, 0x0010);
wm8994_write(0x208, 0x0008);
wm8994_write(0x208, 0x000A);
wm8994_write(0x210, 0x0083);
wm8994_write(0x302, 0x3000);
wm8994_write(0x302, 0x7000);
wm8994_write(0x303, 0x0040);
wm8994_write(0x304, 0x0040);
wm8994_write(0x305, 0x0040);
wm8994_write(0x300, 0x4010);
wm8994_write(0x200, 0x0011);
//wm8994_write(0x01, 0x3003|wm8994_mic_VCC);
wm8994_write(0x01, 0x0803|wm8994_mic_VCC);
wm8994_write(0x02, 0x0110);
wm8994_write(0x03, 0x00F0); ///0x0330);
wm8994_write(0x04, 0x3003);
wm8994_write(0x05, 0x3003);
wm8994_write(0x1A, 0x0119);//0x015F);
wm8994_write(0x1F, 0x0000);
//wm8994_write(0x22, 0x0000);
//wm8994_write(0x23, 0x0100); ///0x0000);
//wm8994_write(0x25, 0x0152);
wm8994_write(0x28, 0x0003);
wm8994_write(0x2A, 0x0030);
wm8994_write(0x2D, 0x0001);
wm8994_write(0x2E, 0x0001);
wm8994_write(0x33, 0x0018);
//wm8994_write(0x36, 0x000C); //MIXOUTL_TO_SPKMIXL MIXOUTR_TO_SPKMIXR
wm8994_write(0x200, 0x0011); //AIF1 CLOCKING(1)
wm8994_write(0x204, 0x0011); //AIF2 CLOCKING(1)
wm8994_write(0x208, 0x000E);//0x000E); //CLOCKING(1)
wm8994_write(0x520, 0x0000); //AIF2 DAC FILTERS(1)
wm8994_write(0x601, 0x0004); //AIF2DACL_DAC1L
wm8994_write(0x602, 0x0004); //AIF2DACR_DAC1R
wm8994_write(0x610, 0x01C0); //DAC1 Left Volume bit0~7
wm8994_write(0x611, 0x01C0); //DAC1 Right Volume bit0~7
wm8994_write(0x612, 0x01C0); //DAC2 Left Volume bit0~7
wm8994_write(0x613, 0x01C0); //DAC2 Right Volume bit0~7
wm8994_write(0x702, 0xC100); //GPIO3
wm8994_write(0x703, 0xC100); //GPIO4
wm8994_write(0x704, 0xC100); //GPIO5
wm8994_write(0x706, 0x4100); //GPIO7
wm8994_write(0x204, 0x0011); //AIF2 MCLK=FLL1
wm8994_write(0x211, 0x0009); //LRCK=8KHz, Rate=MCLK/1536
#ifdef TD688_MODE
wm8994_write(0x310, 0xc108); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef CHONGY_MODE
wm8994_write(0x310, 0xc018); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef MU301_MODE
wm8994_write(0x310, 0xc118); ///0x4118); ///interface dsp mode 16bit
wm8994_write(0x241, 0x2f04);
wm8994_write(0x242, 0x0000);
wm8994_write(0x243, 0x0300);
wm8994_write(0x240, 0x0004);
mdelay(40);
wm8994_write(0x240, 0x0005);
wm8994_write(0x204, 0x0019);
wm8994_write(0x211, 0x0003);
wm8994_write(0x244, 0x0c83);
wm8994_write(0x620, 0x0000);
#endif
#ifdef THINKWILL_M800_MODE
//wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
#endif
wm8994_write(0x310, 0x4118);
wm8994_write(0x311, 0x0000);
wm8994_write(0x313, 0x0060); //AIF2BCLK
wm8994_write(0x314, 0x0020); //AIF2ADCLRCK
wm8994_write(0x315, 0x0020); //AIF2DACLRCLK
wm8994_write(0x603, 0x0180); //Rev.D ADCL SideTone
wm8994_write(0x604, 0x0020); ///0x0010); //ADC2_TO_DAC2L
wm8994_write(0x605, 0x0020); //0x0010); //ADC2_TO_DAC2R
wm8994_write(0x621, 0x0000); ///0x0001);
//wm8994_write(0x317, 0x0003);
//wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
//For handset
wm8994_write(0x01, 0x0B33);//0x3833); //
wm8994_write(0x1C, 0x01F9);
wm8994_write(0x1D, 0x01F9);
wm8994_write(0x4C, 0x9F25);
wm8994_write(0x60, 0x00EE);
wm8994_write(0x422, 0x0000); ////AIF2 un-mute as master
wm8994_set_level_volume();
//wm8994_set_volume(wm8994_current_mode,call_vol,call_maxvol);
#endif
#if 0
wm8994_write(0x01, 0x0003|wm8994_mic_VCC);
msleep(50);
wm8994_write(0x221, 0x0700);
@ -1403,11 +1524,216 @@ void handsetMIC_to_baseband_to_headset(void) //pcmbaseband
wm8994_write(0x621, 0x0000); //0x0001); ///0x0000);
wm8994_write(0x317, 0x0003);
wm8994_write(0x312, 0x0000); /// as slave ///0x4000); //AIF2 SET AS MASTER
#endif
}
void mainMIC_to_baseband_to_earpiece(void) //pcmbaseband
void mainMIC_to_PCMBB_to_headset(void)
{
DBG("%s::%d\n",__FUNCTION__,__LINE__);
if(wm8994_current_mode==wm8994_mainMIC_to_baseband_to_earpiece)return;
wm8994_current_mode=wm8994_mainMIC_to_baseband_to_earpiece;
wm8994_reset();
msleep(50);
#if 1
wm8994_write(0x01, 0x0003|wm8994_mic_VCC); //0x0013);
mdelay(50);
//GPIO configuration
wm8994_write(0x0700, 0xA101);
wm8994_write(0x39, 0x006C);
//VMID and BIAS
wm8994_write(0x01, 0x0023|wm8994_mic_VCC); //0x0013);
wm8994_write(0x200, 0x0000);
mdelay(50);
wm8994_write(0x200, 0x0001);
wm8994_write(0x220, 0x0000);
wm8994_write(0x221, 0x0700); //MCLK=12MHz //FLL1 CONTRLO(2)
wm8994_write(0x222, 0xB51E); //0x3126); //FLL1 CONTRLO(3)
wm8994_write(0x223, 0x0100); //FLL1 CONTRLO(4)
wm8994_write(0x220, 0x0004); //FLL1 CONTRLO(1)
//mdelay(50);
mdelay(10);
wm8994_write(0x220, 0x0005); //FLL1 CONTRLO(1)
mdelay(5);
wm8994_write(0x200, 0x0010);
wm8994_write(0x208, 0x0008);
wm8994_write(0x208, 0x000A);
wm8994_write(0x210, 0x0083);
wm8994_write(0x302, 0x3000);
wm8994_write(0x302, 0x7000);
wm8994_write(0x303, 0x0040);
wm8994_write(0x304, 0x0040);
wm8994_write(0x305, 0x0040);
wm8994_write(0x300, 0x4010);
wm8994_write(0x200, 0x0011);
//wm8994_write(0x01, 0x3003|wm8994_mic_VCC);
wm8994_write(0x01, 0x0803|wm8994_mic_VCC);
wm8994_write(0x02, 0x0110);
wm8994_write(0x03, 0x00F0); ///0x0330);
wm8994_write(0x04, 0x3003);
wm8994_write(0x05, 0x3003);
wm8994_write(0x1A, 0x015F);
wm8994_write(0x1F, 0x0000);
//wm8994_write(0x22, 0x0000);
//wm8994_write(0x23, 0x0100); ///0x0000);
//wm8994_write(0x25, 0x0152);
wm8994_write(0x28, 0x0003);
wm8994_write(0x2A, 0x0030);
wm8994_write(0x2D, 0x0001);
wm8994_write(0x2E, 0x0001);
wm8994_write(0x33, 0x0018);
//wm8994_write(0x36, 0x000C); //MIXOUTL_TO_SPKMIXL MIXOUTR_TO_SPKMIXR
wm8994_write(0x200, 0x0011); //AIF1 CLOCKING(1)
wm8994_write(0x204, 0x0011); //AIF2 CLOCKING(1)
wm8994_write(0x208, 0x000E); //CLOCKING(1)
wm8994_write(0x520, 0x0000); //AIF2 DAC FILTERS(1)
wm8994_write(0x601, 0x0004); //AIF2DACL_DAC1L
wm8994_write(0x602, 0x0004); //AIF2DACR_DAC1R
wm8994_write(0x610, 0x01C0); //DAC1 Left Volume bit0~7
wm8994_write(0x611, 0x01C0); //DAC1 Right Volume bit0~7
wm8994_write(0x612, 0x01C0); //DAC2 Left Volume bit0~7
wm8994_write(0x613, 0x01C0); //DAC2 Right Volume bit0~7
wm8994_write(0x702, 0xC100); //GPIO3
wm8994_write(0x703, 0xC100); //GPIO4
wm8994_write(0x704, 0xC100); //GPIO5
wm8994_write(0x706, 0x4100); //GPIO7
wm8994_write(0x204, 0x0011); //AIF2 MCLK=FLL1
wm8994_write(0x211, 0x0009); //LRCK=8KHz, Rate=MCLK/1536
#ifdef TD688_MODE
wm8994_write(0x310, 0xc108); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef CHONGY_MODE
wm8994_write(0x310, 0xc018); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef MU301_MODE
wm8994_write(0x310, 0xc118); ///0x4118); ///interface dsp mode 16bit
wm8994_write(0x241, 0x2f04);
wm8994_write(0x242, 0x0000);
wm8994_write(0x243, 0x0300);
wm8994_write(0x240, 0x0004);
mdelay(40);
wm8994_write(0x240, 0x0005);
wm8994_write(0x204, 0x0019);
wm8994_write(0x211, 0x0003);
wm8994_write(0x244, 0x0c83);
wm8994_write(0x620, 0x0000);
#endif
#ifdef THINKWILL_M800_MODE
//wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
#endif
wm8994_write(0x310, 0x4118);
wm8994_write(0x311, 0x0000);
wm8994_write(0x313, 0x0060); //AIF2BCLK
wm8994_write(0x314, 0x0020); //AIF2ADCLRCK
wm8994_write(0x315, 0x0020); //AIF2DACLRCLK
wm8994_write(0x603, 0x0180); //Rev.D ADCL SideTone
wm8994_write(0x604, 0x0020); ///0x0010); //ADC2_TO_DAC2L
wm8994_write(0x605, 0x0020); //0x0010); //ADC2_TO_DAC2R
wm8994_write(0x621, 0x0000); ///0x0001);
//wm8994_write(0x317, 0x0003);
//wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
//For handset
wm8994_write(0x01, 0x0B33);//0x3833); //
wm8994_write(0x1C, 0x01F9);
wm8994_write(0x1D, 0x01F9);
wm8994_write(0x4C, 0x9F25);
wm8994_write(0x60, 0x00EE);
wm8994_write(0x422, 0x0000); ////AIF2 un-mute as master
//wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
wm8994_set_level_volume();
//wm8994_set_volume(wm8994_current_mode,call_vol,call_maxvol);
#endif
#if 0
wm8994_write(0x01, 0x0003|wm8994_mic_VCC);
msleep(50);
wm8994_write(0x221, 0x0700); //MCLK=12MHz
wm8994_write(0x222, 0x3127);
wm8994_write(0x223, 0x0100);
wm8994_write(0x220, 0x0004);
msleep(50);
wm8994_write(0x220, 0x0005);
wm8994_write(0x01, 0x0803|wm8994_mic_VCC); ///0x0813);
wm8994_write(0x02, 0x0240); ///0x0110);
wm8994_write(0x03, 0x00F0);
wm8994_write(0x04, 0x3003);
wm8994_write(0x05, 0x3003);
wm8994_write(0x18, 0x011F);
wm8994_write(0x1F, 0x0000);
wm8994_write(0x28, 0x0030); ///0x0003);
wm8994_write(0x29, 0x0020);
wm8994_write(0x2D, 0x0001);
wm8994_write(0x2E, 0x0001);
wm8994_write(0x33, 0x0018);
wm8994_write(0x200, 0x0001);
wm8994_write(0x204, 0x0001);
wm8994_write(0x208, 0x0007);
wm8994_write(0x520, 0x0000);
wm8994_write(0x601, 0x0004);
wm8994_write(0x602, 0x0004);
wm8994_write(0x610, 0x01C0); //DAC1 Left Volume bit0~7
wm8994_write(0x611, 0x01C0); //DAC1 Right Volume bit0~7
wm8994_write(0x612, 0x01C0); //DAC2 Left Volume bit0~7
wm8994_write(0x613, 0x01C0); //DAC2 Right Volume bit0~7
wm8994_write(0x702, 0xC100);
wm8994_write(0x703, 0xC100);
wm8994_write(0x704, 0xC100);
wm8994_write(0x706, 0x4100);
wm8994_write(0x204, 0x0011); //AIF2 MCLK=FLL1
wm8994_write(0x211, 0x0009); //LRCK=8KHz, Rate=MCLK/1536
#ifdef TD688_MODE
wm8994_write(0x310, 0x4108); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef CHONGY_MODE
wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef MU301_MODE
wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
wm8994_write(0x241, 0x2f04);
wm8994_write(0x242, 0x0000);
wm8994_write(0x243, 0x0300);
wm8994_write(0x240, 0x0004);
msleep(40);
wm8994_write(0x240, 0x0005);
wm8994_write(0x204, 0x0019);
wm8994_write(0x211, 0x0003);
wm8994_write(0x244, 0x0c83);
wm8994_write(0x620, 0x0000);
#endif
#ifdef THINKWILL_M800_MODE
wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
#endif
wm8994_write(0x313, 0x00F0);
wm8994_write(0x314, 0x0020);
wm8994_write(0x315, 0x0020);
wm8994_write(0x603, 0x018C); //Rev.D ADCL SideTone
wm8994_write(0x604, 0x0010);
wm8994_write(0x605, 0x0010);
wm8994_write(0x621, 0x0000); ///0x0001);
wm8994_write(0x317, 0x0003);
wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
#endif
}
void mainMIC_to_PCMBB_to_earpiece(void) //pcmbaseband
{
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1491,7 +1817,7 @@ void mainMIC_to_baseband_to_earpiece(void) //pcmbaseband
}
void mainMIC_to_baseband_to_speakers(void) //pcmbaseband
void mainMIC_to_PCMBB_to_speakers(void) //pcmbaseband
{
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1500,6 +1826,127 @@ void mainMIC_to_baseband_to_speakers(void) //pcmbaseband
wm8994_reset();
msleep(50);
#if 1
wm8994_write(0x01, 0x0003|wm8994_mic_VCC); //0x0013);
mdelay(50);
//GPIO configuration
wm8994_write(0x0700, 0xA101);
wm8994_write(0x39, 0x006C);
//VMID and BIAS
wm8994_write(0x01, 0x0023|wm8994_mic_VCC); //0x0013);
wm8994_write(0x200, 0x0000);
mdelay(50);
wm8994_write(0x200, 0x0001);
wm8994_write(0x220, 0x0000);
wm8994_write(0x221, 0x0700); //MCLK=12MHz //FLL1 CONTRLO(2)
wm8994_write(0x222, 0xB51E); //0x3126); //FLL1 CONTRLO(3)
wm8994_write(0x223, 0x0100); //FLL1 CONTRLO(4)
wm8994_write(0x220, 0x0004); //FLL1 CONTRLO(1)
//mdelay(50);
mdelay(10);
wm8994_write(0x220, 0x0005); //FLL1 CONTRLO(1)
mdelay(5);
wm8994_write(0x200, 0x0010);
wm8994_write(0x208, 0x0008);
wm8994_write(0x208, 0x000A);
wm8994_write(0x210, 0x0083);
wm8994_write(0x302, 0x3000);
wm8994_write(0x302, 0x7000);
wm8994_write(0x303, 0x0040);
wm8994_write(0x304, 0x0040);
wm8994_write(0x305, 0x0040);
wm8994_write(0x300, 0x4010);
wm8994_write(0x200, 0x0011);
//wm8994_write(0x01, 0x3003|wm8994_mic_VCC);
wm8994_write(0x01, 0x0803|wm8994_mic_VCC);
wm8994_write(0x02, 0x0110);
wm8994_write(0x03, 0x00F0); ///0x0330);
wm8994_write(0x04, 0x3003);
wm8994_write(0x05, 0x3003);
wm8994_write(0x1A, 0x0119);//0x015F);
wm8994_write(0x1F, 0x0000);
//wm8994_write(0x22, 0x0000);
//wm8994_write(0x23, 0x0100); ///0x0000);
//wm8994_write(0x25, 0x0152);
wm8994_write(0x28, 0x0003);
wm8994_write(0x2A, 0x0030);
wm8994_write(0x2D, 0x0001);
wm8994_write(0x2E, 0x0001);
wm8994_write(0x33, 0x0018);
//wm8994_write(0x36, 0x000C); //MIXOUTL_TO_SPKMIXL MIXOUTR_TO_SPKMIXR
wm8994_write(0x200, 0x0011); //AIF1 CLOCKING(1)
wm8994_write(0x204, 0x0011); //AIF2 CLOCKING(1)
wm8994_write(0x208, 0x000E);//0x000E); //CLOCKING(1)
wm8994_write(0x520, 0x0000); //AIF2 DAC FILTERS(1)
wm8994_write(0x601, 0x0004); //AIF2DACL_DAC1L
wm8994_write(0x602, 0x0004); //AIF2DACR_DAC1R
wm8994_write(0x610, 0x01C0); //DAC1 Left Volume bit0~7
wm8994_write(0x611, 0x01C0); //DAC1 Right Volume bit0~7
wm8994_write(0x612, 0x01C0); //DAC2 Left Volume bit0~7
wm8994_write(0x613, 0x01C0); //DAC2 Right Volume bit0~7
wm8994_write(0x702, 0xC100); //GPIO3
wm8994_write(0x703, 0xC100); //GPIO4
wm8994_write(0x704, 0xC100); //GPIO5
wm8994_write(0x706, 0x4100); //GPIO7
wm8994_write(0x204, 0x0011); //AIF2 MCLK=FLL1
wm8994_write(0x211, 0x0009); //LRCK=8KHz, Rate=MCLK/1536
#ifdef TD688_MODE
wm8994_write(0x310, 0xc108); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef CHONGY_MODE
wm8994_write(0x310, 0xc018); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef MU301_MODE
wm8994_write(0x310, 0xc118); ///0x4118); ///interface dsp mode 16bit
wm8994_write(0x241, 0x2f04);
wm8994_write(0x242, 0x0000);
wm8994_write(0x243, 0x0300);
wm8994_write(0x240, 0x0004);
mdelay(40);
wm8994_write(0x240, 0x0005);
wm8994_write(0x204, 0x0019);
wm8994_write(0x211, 0x0003);
wm8994_write(0x244, 0x0c83);
wm8994_write(0x620, 0x0000);
#endif
#ifdef THINKWILL_M800_MODE
//wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
#endif
wm8994_write(0x310, 0x4118);
wm8994_write(0x311, 0x0000);
wm8994_write(0x313, 0x0060); //AIF2BCLK
wm8994_write(0x314, 0x0020); //AIF2ADCLRCK
wm8994_write(0x315, 0x0020); //AIF2DACLRCLK
wm8994_write(0x603, 0x0180); //Rev.D ADCL SideTone
wm8994_write(0x604, 0x0020); ///0x0010); //ADC2_TO_DAC2L
wm8994_write(0x605, 0x0020); //0x0010); //ADC2_TO_DAC2R
wm8994_write(0x621, 0x0000); ///0x0001);
//wm8994_write(0x317, 0x0003);
//wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
//For Speaker
wm8994_write(0x01, 0x3833); //
wm8994_write(0x03, 0x03F0);
wm8994_write(0x22, 0x0000);
wm8994_write(0x23, 0x0000);
wm8994_write(0x25, 0x017F); //+12DB 0x15B:4DB
//wm8994_write(0x25, 0x015B);
wm8994_write(0x36, 0x000C);
wm8994_write(0x422, 0x0000); ////AIF2 un-mute as master
wm8994_set_level_volume();
//wm8994_set_volume(wm8994_current_mode,call_vol,call_maxvol);
#endif
#if 0
wm8994_write(0x01, 0x0003|wm8994_mic_VCC); //0x0013);
msleep(50);
wm8994_write(0x221, 0x0700); //MCLK=12MHz //FLL1 CONTRLO(2)
@ -1573,11 +2020,11 @@ void mainMIC_to_baseband_to_speakers(void) //pcmbaseband
wm8994_write(0x621, 0x0000); ///0x0001);
wm8994_write(0x317, 0x0003);
wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
#endif
}
void BT_baseband(void) //pcmbaseband
void BT_PCMBB(void) //pcmbaseband
{
DBG("%s::%d\n",__FUNCTION__,__LINE__);
@ -1586,6 +2033,131 @@ void BT_baseband(void) //pcmbaseband
wm8994_reset();
msleep(50);
#if 1
wm8994_write(0x01, 0x0003|wm8994_mic_VCC); //0x0013);
mdelay(50);
//GPIO configuration
wm8994_write(0x0700, 0xA101);
wm8994_write(0x39, 0x006C);
//VMID and BIAS
wm8994_write(0x01, 0x0023|wm8994_mic_VCC); //0x0013);
wm8994_write(0x200, 0x0000);
mdelay(50);
wm8994_write(0x200, 0x0001);
wm8994_write(0x220, 0x0000);
wm8994_write(0x221, 0x0700); //MCLK=12MHz //FLL1 CONTRLO(2)
wm8994_write(0x222, 0x3126); //FLL1 CONTRLO(3)
wm8994_write(0x223, 0x0100); //FLL1 CONTRLO(4)
wm8994_write(0x220, 0x0004); //FLL1 CONTRLO(1)
//mdelay(50);
mdelay(10);
wm8994_write(0x220, 0x0005); //FLL1 CONTRLO(1)
mdelay(5);
wm8994_write(0x200, 0x0010);
wm8994_write(0x208, 0x0008);
wm8994_write(0x208, 0x000A);
wm8994_write(0x210, 0x0083);
wm8994_write(0x302, 0x3000);
wm8994_write(0x302, 0x7000);
wm8994_write(0x303, 0x0040);
wm8994_write(0x304, 0x0040);
wm8994_write(0x305, 0x0040);
wm8994_write(0x300, 0x4010);
wm8994_write(0x200, 0x0011);
//wm8994_write(0x01, 0x3003|wm8994_mic_VCC);
wm8994_write(0x01, 0x0803|wm8994_mic_VCC);
wm8994_write(0x02, 0x0110);
wm8994_write(0x03, 0x00F0); ///0x0330);
wm8994_write(0x04, 0x3003);
wm8994_write(0x05, 0x3003);
wm8994_write(0x1A, 0x015F);//0x014B);
wm8994_write(0x1F, 0x0000);
//wm8994_write(0x22, 0x0000);
//wm8994_write(0x23, 0x0100); ///0x0000);
//wm8994_write(0x25, 0x0152);
wm8994_write(0x28, 0x0003);
wm8994_write(0x2A, 0x0030);
wm8994_write(0x2D, 0x0001);
wm8994_write(0x2E, 0x0001);
wm8994_write(0x33, 0x0018);
//wm8994_write(0x36, 0x000C); //MIXOUTL_TO_SPKMIXL MIXOUTR_TO_SPKMIXR
wm8994_write(0x200, 0x0011); //AIF1 CLOCKING(1)
wm8994_write(0x204, 0x0011); //AIF2 CLOCKING(1)
wm8994_write(0x208, 0x0007);//0x0007); //CLOCKING(1)
wm8994_write(0x520, 0x0000); //AIF2 DAC FILTERS(1)
wm8994_write(0x601, 0x0004); //AIF2DACL_DAC1L
wm8994_write(0x602, 0x0004); //AIF2DACR_DAC1R
wm8994_write(0x610, 0x01C0); //DAC1 Left Volume bit0~7
wm8994_write(0x611, 0x01C0); //DAC1 Right Volume bit0~7
wm8994_write(0x612, 0x01C0); //DAC2 Left Volume bit0~7
wm8994_write(0x613, 0x01C0); //DAC2 Right Volume bit0~7
wm8994_write(0x702, 0xC100); //GPIO3
wm8994_write(0x703, 0xC100); //GPIO4
wm8994_write(0x704, 0xC100); //GPIO5
wm8994_write(0x706, 0x4100); //GPIO7
wm8994_write(0x707, 0xA100);
wm8994_write(0x708, 0xA100);
wm8994_write(0x709, 0xA100);
wm8994_write(0x70A, 0xA100);
wm8994_write(0x06, 0x0014);
wm8994_write(0x204, 0x0011); //AIF2 MCLK=FLL1
wm8994_write(0x211, 0x0009); //LRCK=8KHz, Rate=MCLK/1536
#ifdef TD688_MODE
wm8994_write(0x310, 0xc108); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef CHONGY_MODE
wm8994_write(0x310, 0xc018); ///0x4118); ///interface dsp mode 16bit
#endif
#ifdef MU301_MODE
wm8994_write(0x310, 0xc118); ///0x4118); ///interface dsp mode 16bit
wm8994_write(0x241, 0x2f04);
wm8994_write(0x242, 0x0000);
wm8994_write(0x243, 0x0300);
wm8994_write(0x240, 0x0004);
mdelay(40);
wm8994_write(0x240, 0x0005);
wm8994_write(0x204, 0x0019);
wm8994_write(0x211, 0x0003);
wm8994_write(0x244, 0x0c83);
wm8994_write(0x620, 0x0000);
#endif
#ifdef THINKWILL_M800_MODE
//wm8994_write(0x310, 0x4118); ///0x4118); ///interface dsp mode 16bit
#endif
wm8994_write(0x310, 0x4118);
wm8994_write(0x311, 0x0000);
wm8994_write(0x313, 0x0060); //AIF2BCLK
wm8994_write(0x314, 0x0020); //AIF2ADCLRCK
wm8994_write(0x315, 0x0020); //AIF2DACLRCLK
wm8994_write(0x603, 0x0180); //Rev.D ADCL SideTone
wm8994_write(0x604, 0x0020); ///0x0010); //ADC2_TO_DAC2L
wm8994_write(0x605, 0x0020); //0x0010); //ADC2_TO_DAC2R
wm8994_write(0x621, 0x0000); ///0x0001);
//wm8994_write(0x317, 0x0003);
//wm8994_write(0x312, 0x0000); //AIF2 SET AS MASTER
/* //For Speaker
wm8994_write(0x01, 0x3833); //
wm8994_write(0x03, 0x03F0);
wm8994_write(0x22, 0x0000);
wm8994_write(0x23, 0x0000);
//wm8994_write(0x25, 0x017F); //+12DB 0x15B:4DB
wm8994_write(0x36, 0x000C);
*/
wm8994_write(0x422, 0x0000); ////AIF2 un-mute as master
#endif
#if 0
wm8994_write(0x01 ,0x0003);
msleep (50);
@ -1657,9 +2229,8 @@ void BT_baseband(void) //pcmbaseband
wm8994_write(0x4C ,0x9F25);
wm8994_write(0x60 ,0x00EE);
///////////end HP test
#endif
}
#endif //PCM_BB
#define SOC_DOUBLE_SWITCH_WM8994CODEC(xname, route) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
@ -1711,13 +2282,13 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
case SPEAKER_NORMAL: //AP-> 8994Codec -> Speaker
case SPEAKER_RINGTONE:
case EARPIECE_RINGTONE:
if(pdata->phone_pad == 1)
if(pdata->sp_hp_same_channel == 1)
AP_to_headset();
else
AP_to_speakers();
break;
case SPEAKER_INCALL: //BB-> 8994Codec -> Speaker
if(pdata->phone_pad == 1)
if(pdata->sp_hp_same_channel == 1)
mainMIC_to_baseband_to_headset();
else
mainMIC_to_baseband_to_speakers();
@ -1734,8 +2305,12 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
mainMIC_to_baseband_to_headset();
break;
case EARPIECE_INCALL: //BB-> 8994Codec -> EARPIECE
if(pdata->phone_pad == 1)
mainMIC_to_baseband_to_headset();
if(pdata->no_earpiece == 1){
if(pdata->sp_hp_same_channel == 1)
mainMIC_to_baseband_to_headset();
else
mainMIC_to_baseband_to_speakers();
}
else
mainMIC_to_baseband_to_earpiece();
break;
@ -1747,7 +2322,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
AP_to_headset();
break;
default:
if(pdata->phone_pad == 1)
if(pdata->sp_hp_same_channel == 1)
AP_to_headset();
else
AP_to_speakers();
@ -1805,7 +2380,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
PA_ctrl(GPIO_HIGH);
break;
case EARPIECE_INCALL:
if(pdata->phone_pad == 1)
if(pdata->no_earpiece == 1)
{
msleep(50);
PA_ctrl(GPIO_HIGH);
@ -2409,6 +2984,7 @@ static int wm8994_probe(struct platform_device *pdev)
wm8994 = codec->private_data;
pdata = wm8994->pdata;
//disable power_EN
rk29_mux_api_set(pdata->PowerEN_iomux_name, pdata->PowerEN_iomux_mode);
gpio_request(pdata->Power_EN_Pin, NULL);
gpio_direction_output(pdata->Power_EN_Pin,GPIO_LOW);
gpio_free(pdata->Power_EN_Pin);
@ -2429,6 +3005,23 @@ static int wm8994_probe(struct platform_device *pdev)
goto card_err;
}
if(pdata->BB_class == PCM_BB)
{
handsetMIC_to_baseband_to_headset = &handsetMIC_to_PCMBB_to_headset;
mainMIC_to_baseband_to_headset = &mainMIC_to_PCMBB_to_headset;
mainMIC_to_baseband_to_earpiece = &mainMIC_to_PCMBB_to_earpiece;
mainMIC_to_baseband_to_speakers = &mainMIC_to_PCMBB_to_speakers;
BT_baseband = &BT_PCMBB;
}
else
{
handsetMIC_to_baseband_to_headset = &handsetMIC_to_BB_to_headset;
mainMIC_to_baseband_to_headset = &mainMIC_to_BB_to_headset;
mainMIC_to_baseband_to_earpiece = &mainMIC_to_BB_to_earpiece;
mainMIC_to_baseband_to_speakers = &mainMIC_to_BB_to_speakers;
BT_baseband = &BT_BB;
}
PA_ctrl(GPIO_LOW);
//enable power_EN
msleep(50);