From: lyx Date: Mon, 25 Apr 2011 02:09:58 +0000 (-0700) Subject: rollback gsensor mmaio num X-Git-Tag: firefly_0821_release~10423 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6bc981e2f208e0ac6e10ee86f18c1904633f059d;p=firefly-linux-kernel-4.4.55.git rollback gsensor mmaio num --- diff --git a/arch/arm/mach-rk29/include/mach/custom_log.h b/arch/arm/mach-rk29/include/mach/custom_log.h deleted file mode 100755 index b4c85cda9dfd..000000000000 --- a/arch/arm/mach-rk29/include/mach/custom_log.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -------------------------------------------------------------------------------------------------------- - * Copyright(C), 2010-2011, Fuzhou Rockchip Co., Ltd. All Rights Reserved. - * - * File: custom_log.h - * - * Desc: ChenZhen Æ«ºÃµÄ log Êä³öµÄ¶¨ÖÆʵÏÖ. - * - * ----------------------------------------------------------------------------------- - * < Ï°Óï ºÍ ËõÂÔÓï > : - * - * ----------------------------------------------------------------------------------- - * - * Usage: µ÷Óñ¾ log »ú¹¹µÄ .c Îļþ, ÈôҪʹÄÜÕâÀïµÄ log »úÖÆ, - * Ôò±ØÐëÔÚ inclue ±¾Îļþ֮ǰ, "#define ENABLE_DEBUG_LOG" ÏÈ. - * Note: - * - * Author: ChenZhen - * - * -------------------------------------------------------------------------------------------------------- - * Version: - * v1.0 - * -------------------------------------------------------------------------------------------------------- - * Log: - ----Fri Nov 19 15:20:28 2010 v1.0 - * - * -------------------------------------------------------------------------------------------------------- - */ - - -#ifndef __CUSTOM_LOG_H__ -#define __CUSTOM_LOG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -/* --------------------------------------------------------------------------------------------------------- - * Include Files - * --------------------------------------------------------------------------------------------------------- - */ -#include - - -/* --------------------------------------------------------------------------------------------------------- - * Macros Definition - * --------------------------------------------------------------------------------------------------------- - */ - -#ifdef ENABLE_DEBUG_LOG -#define D(fmt, args...) \ - { printk("[File]:%s; [Line]:%d; [Func]:%s(); " fmt "\n", __FILE__, __LINE__, __FUNCTION__, ## args); } -#else -#define D(...) ((void)0) -#endif - -#define W(fmt, args...) \ - { printk("WARNING :: [File]:%s; [Line]:%d; [Func]:%s() :: " fmt "\n", __FILE__, __LINE__, __FUNCTION__, ## args); } - -#define E(fmt, args...) \ - { printk("ERROR :: [File]:%s; [Line]:%d; [Func]:%s() :: " fmt "\n", __FILE__, __LINE__, __FUNCTION__, ## args); } - - - -/* --------------------------------------------------------------------------------------------------------- - * Types and Structures Definition - * --------------------------------------------------------------------------------------------------------- */ - - -/* --------------------------------------------------------------------------------------------------------- - * Global Functions' Prototype - * --------------------------------------------------------------------------------------------------------- - */ - - -/* --------------------------------------------------------------------------------------------------------- - * Inline Functions Implementation - * --------------------------------------------------------------------------------------------------------- - */ - -#ifdef __cplusplus -} -#endif - -#endif /* __CUSTOM_LOG_H__ */ - diff --git a/drivers/input/gsensor/mma8452.c b/drivers/input/gsensor/mma8452.c index 3db96749aab2..d9a015268d7b 100755 --- a/drivers/input/gsensor/mma8452.c +++ b/drivers/input/gsensor/mma8452.c @@ -33,20 +33,22 @@ #include #endif -// #define ENABLE_DEBUG_LOG -#include - #if 1 -#define mmaprintk(x...) D(x) +#define mmaprintk(x...) printk(x) #else #define mmaprintk(x...) #endif -// #define ENABLE_VERBOSE_LOG -#ifdef ENABLE_VERBOSE_LOG -#define V(x...) D(x) +#if 0 +#define mmaprintkd(x...) printk(x) +#else +#define mmaprintkd(x...) +#endif + +#if 0 +#define mmaprintkf(x...) printk(x) #else -#define V(x...) +#define mmaprintkf(x...) #endif static int mma8452_probe(struct i2c_client *client, const struct i2c_device_id *id); @@ -73,8 +75,6 @@ typedef char status_t; #define MMA8452_OPEN 1 #define MMA8452_CLOSE 0 - -// .! : É豸ʵÀýÊý¾ÝÀàÐÍ. struct mma8452_data { status_t status; char curr_tate; @@ -83,19 +83,12 @@ struct mma8452_data { struct work_struct work; struct delayed_work delaywork; /*report second event*/ - /** »º´æ sensor Êý¾Ý. */ struct mma8452_axis sense_data; - /** ¶Ô "sense_data" µÄ»¥³â±£»¤. */ struct mutex sense_data_mutex; - - /** ±êʶ "sense_data" ÖеÄÊý¾ÝÊÇ·ñÓÐЧ. */ atomic_t data_ready; - /** ÓÃÀ´µÈ´ý Êý¾Ý ready µÄµÈ´ý¶ÓÁÐÍ·. */ wait_queue_head_t data_ready_wq; - /** ±êʶ É豸±»ÒªÇó START ²É¼¯Êý¾ÝµÄ´ÎÊý, ¶ÔÓ¦ MMA_IOCTL_START ¿ÉÄܱ»µ÷Óöà´ÎµÄÇé¿ö. */ int start_count; - /** ¶Ô 'start_count' ºÍÏà¹Ø²Ù×÷µÄ»¥³â±£»¤. */ struct mutex operation_mutex; }; @@ -199,7 +192,7 @@ static int mma845x_active(struct i2c_client *client,int enable) tmp |=ACTIVE_MASK; else tmp &=~ACTIVE_MASK; - mmaprintk("mma845x_active %s (0x%x)\n",enable?"active":"standby",tmp); + mmaprintkd("mma845x_active %s (0x%x)\n",enable?"active":"standby",tmp); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG1,tmp); return ret; } @@ -209,39 +202,39 @@ static int mma8452_start_test(struct i2c_client *client) int ret = 0; int tmp; - mmaprintk("-------------------------mma8452 start test------------------------\n"); + mmaprintkf("-------------------------mma8452 start test------------------------\n"); /* standby */ mma845x_active(client,0); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); /* disable FIFO FMODE = 0*/ ret = mma845x_write_reg(client,MMA8452_REG_F_SETUP,0); - mmaprintk("mma8452 MMA8452_REG_F_SETUP:%x\n",mma845x_read_reg(client,MMA8452_REG_F_SETUP)); + mmaprintkd("mma8452 MMA8452_REG_F_SETUP:%x\n",mma845x_read_reg(client,MMA8452_REG_F_SETUP)); /* set full scale range to 2g */ ret = mma845x_write_reg(client,MMA8452_REG_XYZ_DATA_CFG,0); - mmaprintk("mma8452 MMA8452_REG_XYZ_DATA_CFG:%x\n",mma845x_read_reg(client,MMA8452_REG_XYZ_DATA_CFG)); + mmaprintkd("mma8452 MMA8452_REG_XYZ_DATA_CFG:%x\n",mma845x_read_reg(client,MMA8452_REG_XYZ_DATA_CFG)); /* set bus 8bit/14bit(FREAD = 1,FMODE = 0) ,data rate*/ tmp = (MMA8452_RATE_12P5<< MMA8452_RATE_SHIFT) | FREAD_MASK; ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG1,tmp); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG1:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG1)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG1:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG1)); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG3,5); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG3:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG3)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG3:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG3)); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG4,1); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG4:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG4)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG4:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG4)); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG5,1); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG5:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG5)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG5:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG5)); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); mma845x_active(client,1); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); enable_irq(client->irq); msleep(50); @@ -255,39 +248,39 @@ static int mma8452_start_dev(struct i2c_client *client, char rate) int tmp; struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); // mma8452_data ¶¨ÒåÔÚ mma8452.h ÖÐ. - mmaprintk("-------------------------mma8452 start ------------------------\n"); + mmaprintkf("-------------------------mma8452 start ------------------------\n"); /* standby */ mma845x_active(client,0); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); /* disable FIFO FMODE = 0*/ ret = mma845x_write_reg(client,MMA8452_REG_F_SETUP,0); - mmaprintk("mma8452 MMA8452_REG_F_SETUP:%x\n",mma845x_read_reg(client,MMA8452_REG_F_SETUP)); + mmaprintkd("mma8452 MMA8452_REG_F_SETUP:%x\n",mma845x_read_reg(client,MMA8452_REG_F_SETUP)); /* set full scale range to 2g */ ret = mma845x_write_reg(client,MMA8452_REG_XYZ_DATA_CFG,0); - mmaprintk("mma8452 MMA8452_REG_XYZ_DATA_CFG:%x\n",mma845x_read_reg(client,MMA8452_REG_XYZ_DATA_CFG)); + mmaprintkd("mma8452 MMA8452_REG_XYZ_DATA_CFG:%x\n",mma845x_read_reg(client,MMA8452_REG_XYZ_DATA_CFG)); /* set bus 8bit/14bit(FREAD = 1,FMODE = 0) ,data rate*/ tmp = (rate<< MMA8452_RATE_SHIFT) | FREAD_MASK; ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG1,tmp); mma8452->curr_tate = rate; - mmaprintk("mma8452 MMA8452_REG_CTRL_REG1:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG1)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG1:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG1)); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG3,5); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG3:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG3)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG3:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG3)); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG4,1); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG4:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG4)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG4:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG4)); ret = mma845x_write_reg(client,MMA8452_REG_CTRL_REG5,1); - mmaprintk("mma8452 MMA8452_REG_CTRL_REG5:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG5)); + mmaprintkd("mma8452 MMA8452_REG_CTRL_REG5:%x\n",mma845x_read_reg(client,MMA8452_REG_CTRL_REG5)); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); mma845x_active(client,1); - mmaprintk("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); + mmaprintkd("mma8452 MMA8452_REG_SYSMOD:%x\n",mma845x_read_reg(client,MMA8452_REG_SYSMOD)); enable_irq(client->irq); return ret; @@ -298,7 +291,7 @@ static int mma8452_start(struct i2c_client *client, char rate) { struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); - printk("%s::enter\n",__FUNCTION__); + mmaprintkf("%s::enter\n",__FUNCTION__); if (mma8452->status == MMA8452_OPEN) { return 0; } @@ -315,7 +308,7 @@ static int mma8452_close_dev(struct i2c_client *client) static int mma8452_close(struct i2c_client *client) { struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); - printk("%s::enter\n",__FUNCTION__); + mmaprintkf("%s::enter\n",__FUNCTION__); mma8452->status = MMA8452_CLOSE; return mma8452_close_dev(client); @@ -325,7 +318,7 @@ static int mma8452_reset_rate(struct i2c_client *client, char rate) { int ret = 0; - mmaprintk("\n----------------------------mma8452_reset_rate------------------------\n"); + mmaprintkf("\n----------------------------mma8452_reset_rate------------------------\n"); ret = mma8452_close_dev(client); ret = mma8452_start_dev(client, rate); @@ -356,7 +349,7 @@ static void mma8452_report_value(struct i2c_client *client, struct mma8452_axis input_report_abs(mma8452->input_dev, ABS_Y, axis->y); input_report_abs(mma8452->input_dev, ABS_Z, axis->z); input_sync(mma8452->input_dev); - V("Gsensor x==%d y==%d z==%d\n",axis->x,axis->y,axis->z); + mmaprintkd("Gsensor x==%d y==%d z==%d\n",axis->x,axis->y,axis->z); } /** ÔÚ µ×°ë²¿Ö´ÐÐ, ¾ßÌå»ñÈ¡ g sensor Êý¾Ý. */ @@ -377,7 +370,7 @@ static int mma8452_get_data(struct i2c_client *client) return ret; } while (0); - V("0x%02x 0x%02x 0x%02x \n",buffer[0],buffer[1],buffer[2]); + mmaprintkd("0x%02x 0x%02x 0x%02x \n",buffer[0],buffer[1],buffer[2]); axis.x = mma8452_convert_to_int(buffer[0]); axis.y = mma8452_convert_to_int(buffer[1]); @@ -389,7 +382,7 @@ static int mma8452_get_data(struct i2c_client *client) swap(axis.x,axis.y); } - V( "%s: ------------------mma8452_GetData axis = %d %d %d--------------\n", + mmaprintkd( "%s: ------------------mma8452_GetData axis = %d %d %d--------------\n", __func__, axis.x, axis.y, axis.z); //memcpy(sense_data, &axis, sizeof(axis)); @@ -425,34 +418,20 @@ static int mma8452_trans_buff(char *rbuf, int size) } */ -/** - * »ñÈ¡µ±Ç°ÒѾ­ cache Á赀 sensor Êý¾Ý. - * @param sense_data - * Ö¸Ïò·µ»ØÓà buffer. - * @param client - * µ±Ç° i2c client É豸ʵÀýÊý¾ÝµÄÖ¸Õë. - * @return - * Èô³É¹¦, ·µ»Ø 0; ·ñÔò, ·µ»ØÆäËü. - */ static int mma8452_get_cached_data(struct i2c_client* client, struct mma8452_axis* sense_data) { struct mma8452_data* this = (struct mma8452_data *)i2c_get_clientdata(client); - /* Óг¬Ê±µØ, µÈ´ýÊý¾Ý ready. */ wait_event_interruptible_timeout(this->data_ready_wq, atomic_read(&(this->data_ready) ), msecs_to_jiffies(1000) ); - /* Èô³¬Ê±, ÇÒÊý¾ÝûÓÐ ready. */ if ( 0 == atomic_read(&(this->data_ready) ) ) { - E("waiting 'data_ready_wq' timed out."); - /* ·µ»Ø error. */ + printk("waiting 'data_ready_wq' timed out."); return -1; } - /* Êý¾ÝÒѾ­ ready, »¥³âµØ·µ»ØÊý¾Ý. */ mutex_lock(&(this->sense_data_mutex) ); *sense_data = this->sense_data; mutex_unlock(&(this->sense_data_mutex) ); - /* ·µ»Ø. */ return 0; } @@ -489,44 +468,31 @@ static int mma8452_ioctl(struct inode *inode, struct file *file, unsigned int cm switch (cmd) { case MMA_IOCTL_START: - /* ÉÏËø. */ mutex_lock(&(this->operation_mutex) ); - D("to perform 'MMA_IOCTL_START', former 'start_count' is %d.", this->start_count); - /* ¼ÇÊý ×Ô¼Ó. */ + mmaprintkd("to perform 'MMA_IOCTL_START', former 'start_count' is %d.", this->start_count); (this->start_count)++; - /* ÈôÊdzõ´Î start, Ôò... */ if ( 1 == this->start_count ) { - /* ¸´Î» data_ready. */ atomic_set(&(this->data_ready), 0); - /* Ö´ÐоßÌåµÄ¶ÔÓ²¼þµÄÆô¶¯²Ù×÷. */ if ( (ret = mma8452_start(client, MMA8452_RATE_12P5) ) < 0 ) { mutex_unlock(&(this->operation_mutex) ); return ret; } } - /* ½âËø. */ mutex_unlock(&(this->operation_mutex) ); - D("finish 'MMA_IOCTL_START', ret = %d.", ret); - /* ·µ»Ø. */ + mmaprintkd("finish 'MMA_IOCTL_START', ret = %d.", ret); return 0; case MMA_IOCTL_CLOSE: - /* ÉÏËø. */ mutex_lock(&(this->operation_mutex) ); - D("to perform 'MMA_IOCTL_CLOSE', former 'start_count' is %d, PID : %d", this->start_count, get_current()->pid); - /* Èô¼ÇÊý×Ô¼õµ½ 0, Ôò... */ + mmaprintkd("to perform 'MMA_IOCTL_CLOSE', former 'start_count' is %d, PID : %d", this->start_count, get_current()->pid); if ( 0 == (--(this->start_count) ) ) { - /* ¸´Î» data_ready. */ atomic_set(&(this->data_ready), 0); - /* Ö´ÐоßÌåµÄ¶ÔÓ²¼þµÄ stop ²Ù×÷. */ if ( (ret = mma8452_close(client) ) < 0 ) { mutex_unlock(&(this->operation_mutex) ); return ret; } } - /* ½âËø. */ mutex_unlock(&(this->operation_mutex) ); - /* ·µ»Ø. */ return 0; case MMA_IOCTL_APP_SET_RATE: @@ -537,7 +503,7 @@ static int mma8452_ioctl(struct inode *inode, struct file *file, unsigned int cm case MMA_IOCTL_GETDATA: // ret = mma8452_trans_buff(msg, RBUFF_SIZE); if ( (ret = mma8452_get_cached_data(client, &sense_data) ) < 0 ) { - E("failed to get cached sense data, ret = %d.", ret); + printk("failed to get cached sense data, ret = %d.", ret); return ret; } break; @@ -552,7 +518,7 @@ static int mma8452_ioctl(struct inode *inode, struct file *file, unsigned int cm return -EFAULT; */ if ( copy_to_user(argp, &sense_data, sizeof(sense_data) ) ) { - D("failed to copy sense data to user space."); + printk("failed to copy sense data to user space."); return -EFAULT; } break; @@ -569,7 +535,7 @@ static void mma8452_work_func(struct work_struct *work) struct i2c_client *client = mma8452->client; if (mma8452_get_data(client) < 0) - mmaprintk(KERN_ERR "MMA8452 mma_work_func: Get data failed\n"); + mmaprintkd(KERN_ERR "MMA8452 mma_work_func: Get data failed\n"); enable_irq(client->irq); } @@ -581,8 +547,8 @@ static void mma8452_delaywork_func(struct work_struct *work) struct i2c_client *client = mma8452->client; if (mma8452_get_data(client) < 0) - E(KERN_ERR "MMA8452 mma_work_func: Get data failed\n"); - V("%s :int src:0x%02x\n",__FUNCTION__,mma845x_read_reg(mma8452->client,MMA8452_REG_INTSRC)); + printk(KERN_ERR "MMA8452 mma_work_func: Get data failed\n"); + mmaprintkd("%s :int src:0x%02x\n",__FUNCTION__,mma845x_read_reg(mma8452->client,MMA8452_REG_INTSRC)); enable_irq(client->irq); } @@ -591,9 +557,8 @@ static irqreturn_t mma8452_interrupt(int irq, void *dev_id) struct mma8452_data *mma8452 = (struct mma8452_data *)dev_id; disable_irq_nosync(irq); - /* .! : ÑÓ³ÙµØÔÚ µ×°ë²¿ ·¢ÆðºóÐø²Ù×÷(¶ÁÈ¡¾ßÌåÊý¾Ý). */ schedule_delayed_work(&mma8452->delaywork, msecs_to_jiffies(30)); - V("%s :enter\n",__FUNCTION__); + mmaprintkf("%s :enter\n",__FUNCTION__); return IRQ_HANDLED; } @@ -604,7 +569,6 @@ static struct file_operations mma8452_fops = { .ioctl = mma8452_ioctl, }; -/** ¿ØÖÆÉ豸. */ static struct miscdevice mma8452_device = { .minor = MISC_DYNAMIC_MINOR, .name = "mma8452_daemon",//"mma8452_daemon", @@ -632,7 +596,7 @@ static void mma8452_suspend(struct early_suspend *h) { struct i2c_client *client = container_of(mma8452_device.parent, struct i2c_client, dev); struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); - mmaprintk("Gsensor mma7760 enter suspend mma8452->status %d\n",mma8452->status); + mmaprintkd("Gsensor mma7760 enter suspend mma8452->status %d\n",mma8452->status); // if(mma8452->status == MMA8452_OPEN) // { //mma8452->status = MMA8452_SUSPEND; @@ -644,7 +608,7 @@ static void mma8452_resume(struct early_suspend *h) { struct i2c_client *client = container_of(mma8452_device.parent, struct i2c_client, dev); struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); - mmaprintk("Gsensor mma7760 resume!! mma8452->status %d\n",mma8452->status); + mmaprintkd("Gsensor mma7760 resume!! mma8452->status %d\n",mma8452->status); //if((mma8452->status == MMA8452_SUSPEND) && (mma8452->status != MMA8452_OPEN)) // if (mma8452->status == MMA8452_OPEN) // mma8452_start_dev(client,mma8452->curr_tate); @@ -653,7 +617,7 @@ static void mma8452_resume(struct early_suspend *h) static int mma8452_suspend(struct i2c_client *client, pm_message_t mesg) { int ret; - mmaprintk("Gsensor mma7760 enter 2 level suspend mma8452->status %d\n",mma8452->status); + mmaprintkd("Gsensor mma7760 enter 2 level suspend mma8452->status %d\n",mma8452->status); struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); // if(mma8452->status == MMA8452_OPEN) // { @@ -666,7 +630,7 @@ static int mma8452_resume(struct i2c_client *client) { int ret; struct mma8452_data *mma8452 = (struct mma8452_data *)i2c_get_clientdata(client); - mmaprintk("Gsensor mma7760 2 level resume!! mma8452->status %d\n",mma8452->status); + mmaprintkd("Gsensor mma7760 2 level resume!! mma8452->status %d\n",mma8452->status); // if((mma8452->status == MMA8452_SUSPEND) && (mma8452->status != MMA8452_OPEN)) //if (mma8452->status == MMA8452_OPEN) // ret = mma8452_start_dev(client, mma8452->curr_tate); @@ -679,16 +643,12 @@ static const struct i2c_device_id mma8452_id[] = { { } }; -/** ±íÕ÷Çý¶¯µÄÊý¾ÝÀàÐͶ¨Òå. */ static struct i2c_driver mma8452_driver = { .driver = { .name = "gs_mma8452", }, .id_table = mma8452_id, - .probe = mma8452_probe, // .!! : ¶Ô probe() µÄµ÷ÓÃ, ÈÔÊÇÓÉ ×¢²áÉ豸µÄ²Ù×÷´¥·¢µÄ, - // ¾ßÌå²Î¼û board-rk29sdk.c ÖÐµÄ board_i2c0_devices. - // ÔÚ board_i2c0_devices ÖÐÉùÃ÷ÁËÒ»¸ö¿ÉÒÔʹÓÃÃû³ÆÊÇ "gs_mma8452" Çý¶¯³ÌÐòµÄ I2C É豸. - // ͬʱҲÌåÏÖÁË I2C µØÖ· ºÍ Öն˺ŵÈÐÅÏ¢. + .probe = mma8452_probe, .remove = __devexit_p(mma8452_remove), #ifndef CONFIG_HAS_EARLYSUSPEND .suspend = &mma8452_suspend, @@ -741,7 +701,7 @@ static int mma8452_probe(struct i2c_client *client, const struct i2c_device_id int err; char devid; - mmaprintk("%s enter\n",__FUNCTION__); + mmaprintkf("%s enter\n",__FUNCTION__); mma8452 = kzalloc(sizeof(struct mma8452_data), GFP_KERNEL); if (!mma8452) { diff --git a/include/linux/mma8452.h b/include/linux/mma8452.h index 02b7b27f91d0..9de60414684a 100755 --- a/include/linux/mma8452.h +++ b/include/linux/mma8452.h @@ -54,8 +54,7 @@ #define MMA8452_REG_OFF_Y 0x30 //RW #define MMA8452_REG_OFF_Z 0x31 //RW -//#define MMAIO 0xA1 -#define MMAIO 'm' +#define MMAIO 0xA1 /* IOCTLs for MMA8452 library */ #define MMA_IOCTL_INIT _IO(MMAIO, 0x01)