本文整理汇总了C++中i2c_touchkey_read函数的典型用法代码示例。如果您正苦于以下问题:C++ i2c_touchkey_read函数的具体用法?C++ i2c_touchkey_read怎么用?C++ i2c_touchkey_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i2c_touchkey_read函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: touchkey_autocalibration
static int touchkey_autocalibration(struct touchkey_i2c *tkey_i2c)
{
u8 data[6] = { 0, };
int count = 0;
int ret = 0;
unsigned short retry = 0;
#if defined(CONFIG_TARGET_LOCALE_NA)
if (tkey_i2c->module_ver < 8)
return -1;
#endif
while (retry < 3) {
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 4);
if (ret < 0) {
printk(KERN_ERR "[TouchKey]i2c read fail.\n");
return ret;
}
printk(KERN_DEBUG
"[TouchKey] data[0]=%x data[1]=%x data[2]=%x data[3]=%x\n",
data[0], data[1], data[2], data[3]);
/* Send autocal Command */
data[0] = 0x50;
data[3] = 0x01;
count = i2c_touchkey_write(tkey_i2c->client, data, 4);
msleep(100);
/* Check autocal status */
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 6);
if ((data[5] & TK_BIT_AUTOCAL)) {
printk(KERN_DEBUG "[Touchkey] autocal Enabled\n");
break;
} else
printk(KERN_DEBUG
"[Touchkey] autocal disabled, retry %d\n",
retry);
retry = retry + 1;
}
if (retry == 3)
printk(KERN_DEBUG "[Touchkey] autocal failed\n");
return count;
}
示例2: touchkey_work_func
void touchkey_work_func(struct work_struct * p)
{
u8 data;
if(i2c_touchkey_read(KEYCODE_REG, &data, 1) < 0)
{
printk("%s %d i2c transfer error\n", __func__, __LINE__);
return;
}
#ifdef CONFIG_CPU_FREQ
set_dvfs_target_level(LEV_400MHZ);
#endif
if(data & UPDOWN_EVENT_BIT)
{
input_report_key(touchkey_driver->input_dev, touchkey_keycode[data & KEYCODE_BIT], 0);
input_sync(touchkey_driver->input_dev);
}
else
{
input_report_key(touchkey_driver->input_dev, touchkey_keycode[data & KEYCODE_BIT],1);
input_sync(touchkey_driver->input_dev);
}
// enable_irq(IRQ_TOUCH_INT);
return ;
}
示例3: touchkey_search_show
static ssize_t touchkey_search_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
u8 data[18] = { 0, };
int ret;
pr_debug("[TouchKey] %s called\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 18);
#ifdef CONFIG_TARGET_LOCALE_NA
if (tkey_i2c->module_ver < 8) {
pr_debug("[Touchkey] %s: data[6] =%d,data[7] = %d\n",
__func__, data[6], data[7]);
search_sensitivity = ((0x00FF & data[6]) << 8) | data[7];
} else {
pr_debug("[Touchkey] %s: data[11] =%d\n", __func__,
data[11]);
search_sensitivity = data[11];
}
#else
pr_debug("[Touchkey] %s: data[16] =%d,data[17] = %d\n", __func__,
data[16], data[17]);
search_sensitivity = ((0x00FF & data[16]) << 8) | data[17];
#endif /* CONFIG_TARGET_LOCALE_NA */
return sprintf(buf, "%d\n", search_sensitivity);
}
开发者ID:android-armv7a-belalang-tempur,项目名称:android_kernel_samsung_smdk4210-1,代码行数:26,代码来源:cypress-touchkey.c
示例4: touchkey_raw_data0_show
static ssize_t touchkey_raw_data0_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
u8 data[26] = { 0, };
int ret;
printk(KERN_DEBUG "called %s\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 26);
#if defined(CONFIG_TARGET_LOCALE_NA)
printk(KERN_DEBUG "called %s data[18] =%d,data[19] = %d\n", __func__,
data[18], data[19]);
raw_data0 = ((0x00FF & data[18]) << 8) | data[19];
#elif defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_C1)\
|| defined(CONFIG_MACH_M3)\
|| defined(CONFIG_MACH_T0)
printk(KERN_DEBUG "called %s data[16] =%d,data[17] = %d\n", __func__,
data[16], data[17]);
raw_data0 = ((0x00FF & data[16]) << 8) | data[17]; /* menu*/
#elif defined(CONFIG_MACH_SUPERIOR_KOR_SKT)
printk(KERN_DEBUG "called %s data[14] =%d,data[15] = %d\n", __func__,
data[14], data[15]);
raw_data0 = ((0x00FF & data[14]) << 8) | data[15]; /* menu*/
#elif defined(CONFIG_MACH_Q1_BD)
printk(KERN_DEBUG "called %s data[16] =%d,data[17] = %d\n", __func__,
data[16], data[17]);
raw_data0 = ((0x00FF & data[14]) << 8) | data[15];
#else
printk(KERN_DEBUG "called %s data[18] =%d,data[19] = %d\n", __func__,
data[10], data[11]);
raw_data0 = ((0x00FF & data[10]) << 8) | data[11];
#endif
return sprintf(buf, "%d\n", raw_data0);
}
示例5: touchkey_raw_data1_show
static ssize_t touchkey_raw_data1_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
u8 data[26] = { 0, };
int ret;
pr_debug("called %s\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 26);
#if defined(CONFIG_TARGET_LOCALE_NA)
pr_debug("called %s data[20] =%d,data[21] = %d\n", __func__,
data[20], data[21]);
raw_data1 = ((0x00FF & data[20]) << 8) | data[21];
#elif defined(CONFIG_MACH_M0) || defined(CONFIG_MACH_C1)\
|| defined(CONFIG_MACH_C1VZW) || defined(CONFIG_MACH_C2)
pr_debug("called %s data[14] =%d,data[15] = %d\n", __func__,
data[14], data[15]);
raw_data1 = ((0x00FF & data[14]) << 8) | data[15]; /*back*/
#elif defined(CONFIG_MACH_Q1_BD)
pr_debug("called %s data[14] =%d,data[15] = %d\n", __func__,
data[14], data[15]);
raw_data1 = ((0x00FF & data[16]) << 8) | data[17];
#else
pr_debug("called %s data[20] =%d,data[21] = %d\n", __func__,
data[12], data[13]);
raw_data1 = ((0x00FF & data[12]) << 8) | data[13];
#endif /* CONFIG_TARGET_LOCALE_NA */
return sprintf(buf, "%d\n", raw_data1);
}
开发者ID:android-armv7a-belalang-tempur,项目名称:android_kernel_samsung_smdk4210-1,代码行数:29,代码来源:cypress-touchkey.c
示例6: touchkey_update_func
void touchkey_update_func(struct work_struct *p)
{
int retry = 10;
#if defined(CONFIG_TARGET_LOCALE_NAATT)
char data[3];
i2c_touchkey_read(KEYCODE_REG, data, 3);
printk(KERN_DEBUG"[%s] F/W version: 0x%x, Module version:0x%x\n", __FUNCTION__, data[1], data[2]);
#endif
touchkey_update_status = 1;
printk(KERN_DEBUG "[TouchKey] %s start\n", __func__);
while (retry--) {
if (ISSP_main() == 0) {
touchkey_update_status = 0;
printk(KERN_DEBUG
"[TouchKey] touchkey_update succeeded\n");
enable_irq(IRQ_TOUCH_INT);
return;
}
#if defined(CONFIG_TARGET_LOCALE_NAATT)
touchkey_ldo_on(0);
msleep(300);
init_hw();
#endif
}
touchkey_update_status = -1;
printk(KERN_DEBUG "[TouchKey] touchkey_update failed\n");
return;
}
示例7: touchkey_back_show
static ssize_t touchkey_back_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
u8 data[18] = { 0, };
int ret;
printk(KERN_DEBUG "called %s\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 18);
#ifdef CONFIG_TARGET_LOCALE_NA
if (tkey_i2c->module_ver < 8) {
printk(KERN_DEBUG "called %s data[8] =%d,data[9] = %d\n",
__func__, data[8], data[9]);
back_sensitivity = ((0x00FF & data[8]) << 8) | data[9];
} else {
printk(KERN_DEBUG "called %s data[13] =%d\n", __func__,
data[13]);
back_sensitivity = data[13];
}
#else
printk(KERN_DEBUG "called %s data[14] =%d,data[15] = %d\n", __func__,
data[14], data[15]);
back_sensitivity = ((0x00FF & data[14]) << 8) | data[15];
#endif /* CONFIG_TARGET_LOCALE_NA */
return sprintf(buf, "%d\n", back_sensitivity);
}
示例8: touchkey_update_func
void touchkey_update_func(struct work_struct *work)
{
struct touchkey_i2c *tkey_i2c =
container_of(work, struct touchkey_i2c, update_work);
int retry = 3;
#if defined(CONFIG_TARGET_LOCALE_NAATT)
char data[3];
i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 3);
pr_debug("[Touchkey] %s: F/W version: 0x%x, Module version:0x%x\n",
__func__, data[1], data[2]);
#endif
tkey_i2c->update_status = TK_UPDATE_DOWN;
pr_debug("[Touchkey] %s: start\n", __func__);
touchkey_enable = 0;
while (retry--) {
if (ISSP_main(tkey_i2c) == 0) {
pr_debug("[TouchKey] touchkey_update succeeded\n");
msleep(50);
touchkey_enable = 1;
#if defined(TK_HAS_AUTOCAL)
touchkey_autocalibration(tkey_i2c);
#endif
tkey_i2c->update_status = TK_UPDATE_PASS;
enable_irq(tkey_i2c->irq);
return;
}
tkey_i2c->pdata->power_on(0);
}
enable_irq(tkey_i2c->irq);
tkey_i2c->update_status = TK_UPDATE_FAIL;
printk(KERN_DEBUG "[TouchKey] touchkey_update failed\n");
return;
}
开发者ID:android-armv7a-belalang-tempur,项目名称:android_kernel_samsung_smdk4210-1,代码行数:33,代码来源:cypress-touchkey.c
示例9: touchkey_auto_calibration
static int touchkey_auto_calibration(int autocal_on_off)
{
u8 data[6]={0,};
int count = 0;
int ret = 0;
unsigned short retry = 0;
while( retry < 3 )
{
ret = i2c_touchkey_read(KEYCODE_REG, data, 4);
if (ret < 0) {
printk(KERN_ERR"[TouchKey]i2c read fail.\n");
return ret;
}
printk(KERN_DEBUG "[TouchKey] touchkey_autocalibration :data[0]=%x data[1]=%x data[2]=%x data[3]=%x\n",data[0],data[1],data[2],data[3]);
/* Send autocal Command */
data[0] = 0x50;
data[3] = 0x01;
count = i2c_touchkey_write(data, 4);
msleep(100);
/* Check autocal status*/
ret = i2c_touchkey_read(KEYCODE_REG, data, 6);
if((data[5] & 0x80)) {
printk(KERN_DEBUG "[Touchkey] autocal Enabled\n");
break;
}
else
printk(KERN_DEBUG "[Touchkey] autocal disabled, retry %d\n", retry);
retry = retry + 1;
}
if( retry == 3 )
printk(KERN_DEBUG "[Touchkey] autocal failed\n");
return count;
}
示例10: touchkey_menu_show
static ssize_t touchkey_menu_show(struct device *dev, struct device_attribute *attr, char *buf)
{
u8 data[10];
int ret;
printk("called %s \n",__func__);
ret = i2c_touchkey_read(KEYCODE_REG, data, 10);
menu_sensitivity = data[7];
return sprintf(buf,"%d\n",menu_sensitivity);
}
示例11: touchkey_work_func
void touchkey_work_func(struct work_struct * p)
{
u8 data[14];
int keycode;
if (Flip_status == FLIP_CLOSE || (!gpio_get_value(_3_GPIO_TOUCH_INT) && !touchkey_dead)) {
disable_irq_nosync(touchkey_driver->client->irq);
i2c_touchkey_read(KEYCODE_REG, data, 14);
keycode = touchkey_keycode[data[0] & KEYCODE_BIT];
printk(KERN_ERR "[TKEY] %sdata[0] = %d\n",__func__,data[0] & KEYCODE_BIT);
if(activation_onoff){
if(data[0] & UPDOWN_EVENT_BIT) // key released
{
user_press_on = 0;
input_report_key(touchkey_driver->input_dev, touchkey_keycode[data[0] & KEYCODE_BIT], 0);
input_sync(touchkey_driver->input_dev);
printk(KERN_ERR "[TKEY] [R] keycode : %d\n",touchkey_keycode[data[0] & KEYCODE_BIT]);
}
else // key pressed
{
if(touch_state_val == 1)
{
printk(KERN_ERR "touchkey pressed but don't send event because touch is pressed. \n");
}
else
{
if(keycode == TOUCHKEY_KEYCODE_BACK)
{
user_press_on = 3;
back_sensitivity = data[5];
}
else if(keycode == TOUCHKEY_KEYCODE_MENU)
{
user_press_on = 1;
menu_sensitivity = data[3];
}
else if(keycode == TOUCHKEY_KEYCODE_HOME)
{
user_press_on = 2;
home_sensitivity = data[4];
}
input_report_key(touchkey_driver->input_dev, keycode,1);
input_sync(touchkey_driver->input_dev);
printk(KERN_ERR "[TKEY] [P] keycode : %d\n",keycode);
}
}
}
enable_irq(touchkey_driver->client->irq);
}else
printk(KERN_ERR "[TKEY] not enabled Flip=%d,INT=%d,tkey_dead=%d \n",\
Flip_status,!gpio_get_value(_3_GPIO_TOUCH_INT),!touchkey_dead);
return ;
}
示例12: touchkey_threshold_show
static ssize_t touchkey_threshold_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
u8 data[10];
int ret;
printk(KERN_DEBUG "called %s\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 10);
printk(KERN_DEBUG "called %s data[4] = %d\n", __func__, data[4]);
touchkey_threshold = data[4];
return sprintf(buf, "%d\n", touchkey_threshold);
}
示例13: touchkey_back_show
static ssize_t touchkey_back_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
#if defined(CONFIG_MACH_Q1_BD) \
|| (defined(CONFIG_MACH_C1) && defined(CONFIG_TARGET_LOCALE_KOR))
u8 data[14] = { 0, };
int ret;
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 14);
pr_debug("[Touchkey] %s: data[11] =%d\n", __func__, data[11]);
back_sensitivity = data[11];
#else
u8 data[10];
int ret;
pr_debug("[TouchKey] %s called\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 10);
back_sensitivity = data[9];
#endif
return sprintf(buf, "%d\n", back_sensitivity);
}
开发者ID:android-armv7a-belalang-tempur,项目名称:android_kernel_samsung_smdk4210-1,代码行数:23,代码来源:cypress-touchkey.c
示例14: set_touchkey_firm_version_read_show
static ssize_t set_touchkey_firm_version_read_show(struct device *dev, struct device_attribute *attr, char *buf)
{
char data[3] = { 0, };
int count;
init_hw();
/*if (get_touchkey_firmware(data) != 0) {*/
i2c_touchkey_read(KEYCODE_REG, data, 3);
/*}*/
count = sprintf(buf, "0x%x\n", data[1]);
printk(KERN_DEBUG "[TouchKey] touch_version_read 0x%x\n", data[1]);
return count;
}
示例15: touchkey_raw_data2_show
static ssize_t touchkey_raw_data2_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
u8 data[26] = { 0, };
int ret;
printk(KERN_DEBUG "called %s\n", __func__);
ret = i2c_touchkey_read(tkey_i2c->client, KEYCODE_REG, data, 26);
printk(KERN_DEBUG "called %s data[22] =%d,data[23] = %d\n", __func__,
data[14], data[15]);
raw_data2 = ((0x00FF & data[14]) << 8) | data[15];
return sprintf(buf, "%d\n", raw_data2);
}