2 * Copyright (c) 2010 SAMSUNG
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20 #include <linux/interrupt.h>
21 #include <linux/irq.h>
22 #include <linux/i2c.h>
24 #include <linux/errno.h>
25 #include <linux/device.h>
26 #include <linux/delay.h>
27 #include <linux/miscdevice.h>
28 #include <linux/platform_device.h>
29 #include <linux/leds.h>
30 #include <linux/gpio.h>
31 #include <mach/hardware.h>
32 #include <linux/input.h>
33 #include <linux/workqueue.h>
34 #include <linux/uaccess.h>
35 #include <linux/input/gp2a.h>
36 #include <linux/slab.h>
37 #include <linux/regulator/consumer.h>
38 #include <linux/gpio.h>
40 /*********** for debug *******************************/
42 #define gprintk(fmt, x...) printk(KERN_INFO "%s(%d): "\
43 fmt, __func__ , __LINE__, ## x)
45 #define gprintk(x...) do { } while (0)
47 /**************************************************/
49 #define SENSOR_DEFAULT_DELAY (200) /* 200 ms */
50 #define SENSOR_MAX_DELAY (2000) /* 2000 ms */
51 #define ABS_STATUS (ABS_BRAKE)
52 #define ABS_WAKE (ABS_MISC)
53 #define ABS_CONTROL_REPORT (ABS_THROTTLE)
55 #define PROX_READ_NUM 10
58 static struct wake_lock prx_wake_lock;
60 static struct i2c_driver opt_i2c_driver;
61 static struct i2c_client *opt_i2c_client;
66 struct input_dev *input_dev;
67 struct work_struct work; /* for proximity sensor */
68 /*struct mutex data_mutex; */
69 struct gp2a_platform_data *pdata;
71 /*int wakeup; configure the button as a wake-up source */
76 int average[PROX_READ_NUM]; /*for proximity adc average */
79 static struct gp2a_data *prox_data;
82 struct i2c_client *client;
85 struct opt_state *opt_state;
87 /* initial value for sensor register */
89 static u8 gp2a_original_image[COL][2] = {
91 /*PRST :01(4 cycle at Detection/Non-detection),
92 ALSresolution :16bit, range *128 //0x1F -> 5F by sharp */
94 /*ALC : 0, INTTYPE : 1, PS mode resolution : 12bit, range*1 */
96 /*LED drive current 110mA, Detection/Non-detection judgment output */
102 {0x08, 0x07}, /*PS mode LTH(Loff): (??mm) */
103 {0x09, 0x00}, /*PS mode LTH(Loff) : */
104 {0x0A, 0x08}, /*PS mode HTH(Lon) : (??mm) */
105 {0x0B, 0x00}, /* PS mode HTH(Lon) : */
106 /*{0x13 , 0x08}, by sharp for internal calculation (type:0)*/
107 /*alternating mode (PS+ALS),
108 TYPE=1(0:externel 1:auto calculated mode) //umfa.cal */
112 /*static int alt_int = 0;*/
113 extern u8 lightsensor_mode; /* 0 = low, 1 = high */
114 extern unsigned int get_hw_rev(void);
116 static int proximity_onoff(u8 onoff);
118 /*TODO Need to add comments*/
119 /* Proximity Sysfs interface */
122 proximity_delay_show(struct device *dev,
123 struct device_attribute *attr, char *buf)
125 struct input_dev *input_data = to_input_dev(dev);
126 struct gp2a_data *data = input_get_drvdata(input_data);
131 return sprintf(buf, "%d\n", delay);
135 proximity_delay_store(struct device *dev,
136 struct device_attribute *attr,
137 const char *buf, size_t count)
139 struct input_dev *input_data = to_input_dev(dev);
140 struct gp2a_data *data = input_get_drvdata(input_data);
144 err = kstrtoint(buf, 10, &delay);
147 printk(KERN_ERR "%s, kstrtoint failed.", __func__);
152 if (SENSOR_MAX_DELAY < delay)
153 delay = SENSOR_MAX_DELAY;
157 /*input_report_abs(input_data, ABS_CONTROL_REPORT
158 , (data->enabled<<16) | delay); */
165 proximity_enable_show(struct device *dev,
166 struct device_attribute *attr, char *buf)
168 struct input_dev *input_data = to_input_dev(dev);
169 struct gp2a_data *data = input_get_drvdata(input_data);
172 enabled = data->enabled;
174 return sprintf(buf, "%d\n", enabled);
178 proximity_enable_store(struct device *dev,
179 struct device_attribute *attr,
180 const char *buf, size_t count)
182 struct input_dev *input_data = to_input_dev(dev);
183 struct gp2a_data *data = input_get_drvdata(input_data);
184 unsigned long value = 0;
187 /*signed char get_buf[18]={0,};//test */
189 err = strict_strtoul(buf, 10, &value);
192 printk(KERN_ERR "%s, conversion %s to number.\n", __func__, buf);
194 if (value != 0 && value != 1)
197 if (data->enabled && !value) { /* Proximity power off */
198 disable_irq(data->irq);
201 disable_irq_wake(data->irq);
202 /*data->pdata->gp2a_led_on(false); */
204 if (!data->enabled && value) { /* proximity power on */
205 /*data->pdata->gp2a_led_on(true); */
209 enable_irq_wake(data->irq);
212 input = gpio_get_value(data->pdata->p_out);
213 /* we reports it to SensorFW by opposition, 1 :proximity , 0 :away*/
214 input_report_abs(data->input_dev, ABS_DISTANCE, !input);
215 input_sync(data->input_dev);
217 enable_irq(data->irq);
219 data->enabled = (int)value;
220 proximity_enable = (int)value;
222 /* input_report_abs(input_data, ABS_CONTROL_REPORT,
223 (value<<16) | data->delay); */
230 proximity_wake_store(struct device *dev,
231 struct device_attribute *attr,
232 const char *buf, size_t count)
234 struct input_dev *input_data = to_input_dev(dev);
237 input_report_abs(input_data, ABS_WAKE, cnt++);
243 proximity_data_show(struct device *dev,
244 struct device_attribute *attr, char *buf)
246 struct input_dev *input_data = to_input_dev(dev);
247 struct gp2a_data *data = input_get_drvdata(input_data);
250 mutex_lock(&data->data_mutex);
252 mutex_unlock(&data->data_mutex);
253 return sprintf(buf, "%d\n", x);
257 static int count; /*count for proximity average */
259 static ssize_t proximity_state_show(struct device *dev,
260 struct device_attribute *attr, char *buf)
263 struct input_dev *input_data = to_input_dev(dev);
264 struct gp2a_data *data = input_get_drvdata(input_data);
266 unsigned char get_D2_data[2] = { 0, }; /*test */
269 opt_i2c_read(0x10, get_D2_data, sizeof(get_D2_data));
270 D2_data = (get_D2_data[1] << 8) | get_D2_data[0];
272 data->average[count] = D2_data;
274 if (count == PROX_READ_NUM)
277 return sprintf(buf, "%d\n", D2_data);
280 static ssize_t proximity_avg_show(struct device *dev,
281 struct device_attribute *attr, char *buf)
283 struct input_dev *input_data = to_input_dev(dev);
284 struct gp2a_data *data = input_get_drvdata(input_data);
286 int min = 0, max = 0, avg = 0;
288 int proximity_value = 0;
290 for (i = 0; i < PROX_READ_NUM; i++) {
291 proximity_value = data->average[i];
292 if (proximity_value > 0) {
294 avg += proximity_value;
297 min = proximity_value;
298 else if (proximity_value < min)
299 min = proximity_value;
301 if (proximity_value > max)
302 max = proximity_value;
307 return sprintf(buf, "%d, %d, %d\n", min, avg, max);
310 static ssize_t proximity_avg_store(struct device *dev,
311 struct device_attribute *attr,
312 const char *buf, size_t size)
314 return proximity_enable_store(dev, attr, buf, size);
317 static ssize_t proximity_thresh_show(struct device *dev,
318 struct device_attribute *attr, char *buf)
323 for (i = 0; i < COL; i++) {
324 if (gp2a_original_image[i][0] == 0x08)
325 /*PS mode LTH(Loff) */
326 threshold = gp2a_original_image[i][1];
327 else if (gp2a_original_image[i][0] == 0x09)
328 /*PS mode LTH(Loff) */
329 threshold |= gp2a_original_image[i][1]<<8;
332 return sprintf(buf, "prox_threshold = %d\n", threshold);
335 static ssize_t proximity_thresh_store(struct device *dev,
336 struct device_attribute *attr,
337 const char *buf, size_t size)
339 unsigned long thresh_value = 0x07;
343 err = strict_strtoul(buf, 10, &thresh_value);
346 printk(KERN_ERR "%s, conversion %s to number.\n",
349 for (i = 0; i < COL; i++) {
350 if (gp2a_original_image[i][0] == 0x08)
351 /*PS mode LTH(Loff) */
352 gp2a_original_image[i][1] =
353 thresh_value & 0x00FF;
354 else if (gp2a_original_image[i][0] == 0x09)
355 /*PS mode LTH(Loff) */
356 gp2a_original_image[i][1] =
357 (thresh_value & 0xFF00) >> 8;
358 else if (gp2a_original_image[i][0] == 0x0A)
359 /*PS mode HTH(Lon) */
360 gp2a_original_image[i][1] =
361 (thresh_value+1) & 0x00FF;
362 else if (gp2a_original_image[i][0] == 0x0B)
363 /* PS mode HTH(Lon) */
364 gp2a_original_image[i][1] =
365 ((thresh_value+1) & 0xFF00) >> 8;
368 for (i = 0; i < COL; i++) {
369 if (gp2a_original_image[i][0] == 0x08 ||
370 gp2a_original_image[i][0] == 0x09 ||
371 gp2a_original_image[i][0] == 0x0A ||
372 gp2a_original_image[i][0] == 0x0B)
373 err = opt_i2c_write(gp2a_original_image[i][0],
374 &gp2a_original_image[i][1]);
377 printk(KERN_ERR "%s : setting error i = %d, err=%d\n",
386 static DEVICE_ATTR(poll_delay, 664,
387 proximity_delay_show, proximity_delay_store);
389 static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, proximity_enable_show, proximity_enable_store);
390 static DEVICE_ATTR(proximity_avg, S_IRUGO | S_IWUSR, proximity_avg_show, proximity_avg_store);
391 static DEVICE_ATTR(state, S_IRUGO, proximity_state_show, NULL);
392 static DEVICE_ATTR(prox_thresh, S_IRUGO | S_IWUSR,
393 proximity_thresh_show, proximity_thresh_store);
395 /* TODO Need to check if those are used or not.*/
397 static DEVICE_ATTR(wake, S_IWUSR|S_IWGRP,
398 NULL, proximity_wake_store);
399 static DEVICE_ATTR(data, S_IRUGO, proximity_data_show, NULL);
402 static struct attribute *proximity_attributes[] = {
403 /*&dev_attr_poll_delay.attr,*/
404 &dev_attr_enable.attr,
405 &dev_attr_state.attr,
406 &dev_attr_prox_thresh.attr,
408 &dev_attr_prox_avg.attr,
415 static struct attribute_group proximity_attribute_group = {
416 .attrs = proximity_attributes
419 irqreturn_t gp2a_irq_handler(int irq, void *dev_id)
421 schedule_work(&prox_data->work);
423 printk(KERN_INFO "[PROXIMITY] IRQ_HANDLED.\n");
427 /***************************************************
429 * function : gp2a_setup_irq
430 * description : This function sets up the interrupt.
434 static int gp2a_setup_irq(struct gp2a_data *gp2a)
437 struct gp2a_platform_data *pdata = gp2a->pdata;
440 pr_err("%s, start\n", __func__);
442 rc = gpio_request(pdata->p_out, "gpio_proximity_out");
444 pr_err("%s: gpio %d request failed (%d)\n",
445 __func__, pdata->p_out, rc);
449 rc = gpio_direction_input(pdata->p_out);
451 pr_err("%s: failed to set gpio %d as input (%d)\n",
452 __func__, pdata->p_out, rc);
453 goto err_gpio_direction_input;
456 irq = gpio_to_irq(pdata->p_out);
457 rc = request_threaded_irq(irq, NULL,
459 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
460 "proximity_int", gp2a);
462 pr_err("%s: request_irq(%d) failed for gpio %d (%d)\n",
463 __func__, irq, pdata->p_out, rc);
464 goto err_request_irq;
467 /* start with interrupts disabled */
471 pr_err("%s, success\n", __func__);
476 err_gpio_direction_input:
477 gpio_free(pdata->p_out);
482 /***************************************************
484 * function : gp2a_work_func_prox
485 * description : This function is for proximity sensor work function.
486 * when INT signal is occured , it gets value the interrupt pin.
489 char proximity_sensor_detection;
491 static void gp2a_work_func_prox(struct work_struct *work)
493 struct gp2a_data *gp2a = container_of((struct work_struct *)work,
494 struct gp2a_data, work);
500 /* 0 : proximity, 1 : away */
501 result = gpio_get_value(gp2a->pdata->p_out);
502 proximity_sensor_detection = !result;
504 input_report_abs(gp2a->input_dev, ABS_DISTANCE, result);
505 gprintk("%s Proximity values = %d\n", __func__, result);
506 input_sync(gp2a->input_dev);
508 disable_irq(gp2a->irq);
511 ret = opt_i2c_write(COMMAND1, &value); /*Software reset */
513 if (result == 0) { /* detection = Falling Edge */
514 if (lightsensor_mode == 0) /* Low mode */
518 ret = opt_i2c_write(COMMAND2, &value);
519 } else { /* none Detection */
520 if (lightsensor_mode == 0) /* Low mode */
524 ret = opt_i2c_write(COMMAND2, &value);
527 enable_irq(gp2a->irq);
530 ret = opt_i2c_write(COMMAND1, &value);
532 gp2a->prox_data = result;
533 gprintk("proximity = %d, lightsensor_mode=%d\n",
534 result, lightsensor_mode);
537 static int opt_i2c_init(void)
539 if (i2c_add_driver(&opt_i2c_driver)) {
540 printk(KERN_ERR "i2c_add_driver failed\n");
546 int opt_i2c_read(u8 reg, unsigned char *rbuf, int len)
551 if ((opt_i2c_client == NULL) || (!opt_i2c_client->adapter)) {
552 printk(KERN_ERR "%s %d (opt_i2c_client == NULL)\n",
557 msg.addr = opt_i2c_client->addr;
558 msg.flags = I2C_M_WR;
562 ret = i2c_transfer(opt_i2c_client->adapter, &msg, 1);
565 msg.flags = I2c_M_RD;
568 ret = i2c_transfer(opt_i2c_client->adapter, &msg, 1);
572 gprintk("i2c transfer error ret=%d\n", ret);
577 printk(KERN_INFO "%s : 0x%x, 0x%x\n", __func__,reg++,rbuf[i]);
583 int opt_i2c_write(u8 reg, u8 *val)
586 struct i2c_msg msg[1];
587 unsigned char data[2];
590 if ((opt_i2c_client == NULL) || (!opt_i2c_client->adapter))
597 msg->addr = opt_i2c_client->addr;
598 msg->flags = I2C_M_WR;
602 err = i2c_transfer(opt_i2c_client->adapter, msg, 1);
603 /*gprintk("0x%x, 0x%x\n", reg, *val); */
608 gprintk(" i2c transfer error(%d)\n", err);
612 static int proximity_input_init(struct gp2a_data *data)
614 struct input_dev *dev;
617 printk(KERN_INFO "%s, %d start\n", __func__, __LINE__);
619 dev = input_allocate_device();
621 printk(KERN_ERR "%s, error\n", __func__);
625 input_set_capability(dev, EV_ABS, ABS_DISTANCE);
626 input_set_abs_params(dev, ABS_DISTANCE, 0, 0xFF, 0, 0);
629 input_set_capability(dev, EV_ABS, ABS_STATUS);
630 input_set_capability(dev, EV_ABS, ABS_WAKE);
631 input_set_capability(dev, EV_ABS, ABS_CONTROL_REPORT);
634 dev->name = "proximity_sensor";
635 input_set_drvdata(dev, data);
637 err = input_register_device(dev);
639 input_free_device(dev);
642 data->input_dev = dev;
644 printk(KERN_INFO "%s, success\n", __func__);
648 static int gp2a_opt_probe(struct platform_device *pdev)
650 struct gp2a_data *gp2a;
651 struct gp2a_platform_data *pdata = pdev->dev.platform_data;
655 /* int wakeup = 0; */
657 printk(KERN_INFO "%s : probe start!\n", __func__);
660 pr_err("%s: missing pdata!\n", __func__);
664 if (pdata->gp2a_get_low_threshold) {
666 for (i = 0; i < COL; i++) {
667 if (gp2a_original_image[i][0] == 0x08)
668 /*PS mode LTH(Loff) */
669 gp2a_original_image[i][1] =
670 pdata->gp2a_get_low_threshold()
672 else if (gp2a_original_image[i][0] == 0x09)
673 /*PS mode LTH(Loff) */
674 gp2a_original_image[i][1] =
675 (pdata->gp2a_get_low_threshold()
677 else if (gp2a_original_image[i][0] == 0x0A)
678 /*PS mode HTH(Lon) */
679 gp2a_original_image[i][1] =
680 (pdata->gp2a_get_low_threshold()+1)
682 else if (gp2a_original_image[i][0] == 0x0B)
683 /* PS mode HTH(Lon) */
684 gp2a_original_image[i][1] =
685 ((pdata->gp2a_get_low_threshold()+1)
690 if (!pdata->gp2a_led_on) {
691 pr_err("%s: incomplete pdata!\n", __func__);
695 pdata->gp2a_led_on(true);
697 /* allocate driver_data */
698 gp2a = kzalloc(sizeof(struct gp2a_data), GFP_KERNEL);
700 pr_err("kzalloc error\n");
707 /* gp2a->delay = SENSOR_DEFAULT_DELAY; */
710 /*mutex_init(&gp2a->data_mutex); */
712 INIT_WORK(&gp2a->work, gp2a_work_func_prox);
714 err = proximity_input_init(gp2a);
716 goto error_setup_reg;
718 err = sysfs_create_group(&gp2a->input_dev->dev.kobj,
719 &proximity_attribute_group);
721 goto err_sysfs_create_group_proximity;
724 platform_set_drvdata(pdev, gp2a);
729 if (opt_i2c_client == NULL) {
730 pr_err("opt_probe failed : i2c_client is NULL\n");
733 printk(KERN_INFO "opt_i2c_client : (0x%p), address = %x\n",
734 opt_i2c_client, opt_i2c_client->addr);
736 /* GP2A Regs INIT SETTINGS and Check I2C communication */
739 opt_i2c_write((u8) (COMMAND1), &value); /* shutdown mode op[3]=0 */
742 ret = gp2a_setup_irq(gp2a);
744 pr_err("%s: could not setup irq\n", __func__);
748 device_init_wakeup(&pdev->dev, 1/*wakeup*/);
750 printk(KERN_INFO "%s : probe success!\n", __func__);
755 sysfs_remove_group(&gp2a->input_dev->dev.kobj,
756 &proximity_attribute_group);
757 err_sysfs_create_group_proximity:
758 input_unregister_device(gp2a->input_dev);
759 input_free_device(gp2a->input_dev);
765 static int gp2a_opt_remove(struct platform_device *pdev)
767 struct gp2a_data *gp2a = platform_get_drvdata(pdev);
769 if (gp2a->input_dev != NULL) {
770 sysfs_remove_group(&gp2a->input_dev->dev.kobj,
771 &proximity_attribute_group);
772 input_unregister_device(gp2a->input_dev);
773 if (gp2a->input_dev != NULL)
774 kfree(gp2a->input_dev);
777 /*mutex_destroy(gp2a->data_mutex); */
778 device_init_wakeup(&pdev->dev, 0);
787 static int gp2a_opt_suspend(struct device *dev)
789 struct gp2a_data *gp2a = dev_get_drvdata(dev);
794 if (device_may_wakeup(dev))
795 enable_irq_wake(gp2a->irq);
801 static int gp2a_opt_resume(struct device *dev)
803 struct gp2a_data *gp2a = dev_get_drvdata(dev);
808 if (device_may_wakeup(dev))
809 disable_irq_wake(gp2a->irq);
815 static int gp2a_opt_freeze(struct device *dev)
817 struct gp2a_data *gp2a = dev_get_drvdata(dev);
820 disable_irq_wake(gp2a->irq);
821 disable_irq_nosync(gp2a->irq);
827 static int gp2a_opt_restore(struct device *dev)
829 struct gp2a_data *gp2a = dev_get_drvdata(dev);
833 enable_irq(gp2a->irq);
839 static struct dev_pm_ops gp2a_opt_dev_pm_ops = {
840 .suspend = gp2a_opt_suspend,
841 .resume = gp2a_opt_resume,
842 .freeze = gp2a_opt_freeze,
843 .restore = gp2a_opt_restore,
846 #define GP2A_OPT_DEV_PM_OPS (&gp2a_opt_dev_pm_ops)
848 #define GP2A_OPT_DEV_PM_OPS NULL
849 #endif /* CONFIG_PM */
851 static int proximity_onoff(u8 onoff)
855 /* unsigned char get_data[1]; */
858 printk(KERN_INFO "%s : proximity turn on/off = %d\n", __func__, onoff);
860 /* already on light sensor, so must simultaneously
861 turn on light sensor and proximity sensor */
863 /*opt_i2c_read(COMMAND1, get_data, sizeof(get_data)); */
864 /*if (get_data == 0xC1)
866 for (i = 0; i < COL; i++) {
868 opt_i2c_write(gp2a_original_image[i][0],
869 &gp2a_original_image[i][1]);
871 printk(KERN_ERR "%s : turnning on error i = %d, err=%d\n",
873 lightsensor_mode = 0;
875 } else { /* light sensor turn on and proximity turn off */
876 /*opt_i2c_read(COMMAND1, get_data, sizeof(get_data)); */
877 /*if (get_data == 0xD1)
880 if (lightsensor_mode)
881 value = 0x67; /*resolution :16bit, range: *8(HIGH) */
883 value = 0x63; /* resolution :16bit, range: *128(LOW) */
884 opt_i2c_write(COMMAND2, &value);
885 /* OP3 : 1(operating mode)
886 OP2 :1(coutinuous operating mode) OP1 : 01(ALS mode) */
888 opt_i2c_write(COMMAND1, &value);
894 static int opt_i2c_remove(struct i2c_client *client)
896 struct opt_state *data = i2c_get_clientdata(client);
899 opt_i2c_client = NULL;
904 static int opt_i2c_probe(struct i2c_client *client,
905 const struct i2c_device_id *id)
907 struct opt_state *opt;
909 printk(KERN_INFO "%s, %d : start!!!\n", __func__, __LINE__);
911 opt = kzalloc(sizeof(struct opt_state), GFP_KERNEL);
913 printk(KERN_ERR "failed to allocate memory\n");
914 pr_err("kzalloc error\n");
915 pr_err("%s, %d : error!!!\n", __func__, __LINE__);
920 printk(KERN_ERR "GP2A i2c client is NULL !!!\n");
921 opt->client = client;
922 i2c_set_clientdata(client, opt);
924 /* rest of the initialisation goes here. */
926 pr_err("GP2A opt i2c attach success!!!\n");
928 opt_i2c_client = client;
929 pr_err("%s, %d : end!!!\n", __func__, __LINE__);
934 static const struct i2c_device_id opt_device_id[] = {
939 MODULE_DEVICE_TABLE(i2c, opt_device_id);
941 static struct i2c_driver opt_i2c_driver = {
944 .owner = THIS_MODULE,
946 .probe = opt_i2c_probe,
947 .remove = opt_i2c_remove,
948 .id_table = opt_device_id,
951 static struct platform_driver gp2a_opt_driver = {
952 .probe = gp2a_opt_probe,
953 .remove = gp2a_opt_remove,
956 .owner = THIS_MODULE,
957 .pm = GP2A_OPT_DEV_PM_OPS,
961 #ifdef CONFIG_BATTERY_SEC
962 extern unsigned int is_lpcharging_state(void);
965 static int __init gp2a_opt_init(void)
969 #ifdef CONFIG_BATTERY_SEC
970 if (is_lpcharging_state()) {
971 pr_info("%s : LPM Charging Mode! return 0\n", __func__);
976 ret = platform_driver_register(&gp2a_opt_driver);
980 static void __exit gp2a_opt_exit(void)
982 platform_driver_unregister(&gp2a_opt_driver);
985 module_init(gp2a_opt_init);
986 module_exit(gp2a_opt_exit);
988 MODULE_AUTHOR("SAMSUNG");
989 MODULE_DESCRIPTION("Optical Sensor driver for GP2AP020A00F");
990 MODULE_LICENSE("GPL");