]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/blob - drivers/staging/iio/light/iqs253.c
Revert "staging: iio: light: iqsxx: Add sysfs for SAR tool"
[sojka/nv-tegra/linux-3.10.git] / drivers / staging / iio / light / iqs253.c
1 /*
2  * A iio driver for the capacitive sensor IQS253.
3  *
4  * IIO Light driver for monitoring proximity.
5  *
6  * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms and conditions of the GNU General Public License,
10  * version 2, as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  * more details.
16  */
17
18 #include <linux/module.h>
19 #include <linux/i2c.h>
20 #include <linux/err.h>
21 #include <linux/mutex.h>
22 #include <linux/pm_runtime.h>
23 #include <linux/regulator/consumer.h>
24 #include <linux/platform_device.h>
25 #include <linux/gpio.h>
26 #include <linux/of_gpio.h>
27 #include <linux/slab.h>
28 #include <linux/delay.h>
29 #include <linux/irqchip/tegra.h>
30 #include <linux/input.h>
31 #include <linux/iio/iio.h>
32 #include <linux/iio/sysfs.h>
33 #include <linux/iio/light/ls_sysfs.h>
34 #include <linux/iio/light/ls_dt.h>
35
36 /* registers */
37 #define SYSFLAGS                0x10
38 #define PROX_STATUS             0x31
39 #define TOUCH_STATUS            0x35
40 #define TARGET                  0xC4
41 #define COMP0                   0xC5
42 #define CH0_ATI_BASE            0xC8
43 #define CH1_ATI_BASE            0xC9
44 #define CH2_ATI_BASE            0xCA
45 #define CH0_PTH                 0xCB
46 #define CH1_PTH                 0xCC
47 #define CH2_PTH                 0xCD
48 #define PROX_SETTINGS0          0xD1
49 #define PROX_SETTINGS1          0xD2
50 #define PROX_SETTINGS2          0xD3
51 #define PROX_SETTINGS3          0xD4
52 #define ACTIVE_CHAN             0xD5
53 #define LOW_POWER               0xD6
54 #define DYCAL_CHANS             0xD8
55 #define EVENT_MODE_MASK         0xD9
56 #define DEFAULT_COMMS_POINTER   0xDD
57
58 #define IQS253_PROD_ID          41
59 #define IQS263_PROD_ID          0x3C
60
61 #define PROX_CH0                0x01
62 #define PROX_CH1                0x02
63 #define PROX_CH2                0x04
64
65 #define STYLUS_ONLY             PROX_CH0
66 #define PROXIMITY_ONLY          (PROX_CH1 | PROX_CH2)
67
68 #define CH0_COMPENSATION        0x55
69
70 #define PROX_TH_CH0             0x03
71 #define PROX_TH_CH1             0x03
72 #define PROX_TH_CH2             0x03
73
74 #define DISABLE_DYCAL           0x00
75
76 #define CH0_ATI_TH              0xCC
77 #define CH1_ATI_TH              0x40
78 #define CH2_ATI_TH              0x40
79
80 #define EVENT_PROX_ONLY         0x01
81
82 #define PROX_SETTING_NORMAL     0x25
83 #define PROX_SETTING_STYLUS     0x26
84
85 #define AUTO_ATI_DISABLE        BIT(7)
86 #define ATI_IN_PROGRESS         0x04
87
88 /* initial values */
89
90 #define EVENT_MODE_DISABLE_MASK 0x04
91 #define LTA_DISABLE             BIT(5)
92 #define ACF_DISABLE             BIT(4)
93 /* LTA always halt */
94 #define LTA_HALT_11             (BIT(0) | BIT(1))
95
96 #define ATI_ENABLED_MASK        0x80
97
98 #define IQS253_RESET            BIT(5)
99
100 #define ATI                     0xAF
101
102 #define NUM_REG 17
103
104
105 /* iqs263 registers and values */
106 #define DEV_INFO     0x00
107 #define SYST_FLAGS   0x01
108 #define CO_NATES     0x02
109 #define TOUCH_STAT   0x03
110 #define COUNTS       0x04
111 #define LTA          0x05
112 #define DELTAS       0x06
113 #define MULTIPLERS   0x07
114 #define COMPENSATION 0x08
115 #define PROX_SETTINGS 0x09
116 #define THRESHOLDS   0x0A
117 #define TIM_TARGETS  0x0B
118 #define GESTURE_TIME 0x0C
119 #define ACTIVE_CH    0x0D
120
121 #define PROX_THR     0x04
122 #define TOUCH_THR1   0x14
123 #define TOUCH_THR2   0x02
124 #define TOUCH_THR3   0x03
125 #define MOV_THR      0x15
126 #define MOV_DEB      0x00
127 #define HALT_TIME    0xFF
128 #define I2C_TIMEOUT  0x04
129
130 #define SYST_SET     0x80
131 #define CH0_MULT     0x1B
132 #define CH1_MULT     0x08
133 #define CH2_MULT     0x08
134 #define CH3_MULT     0x00
135
136 #define CH_BASE      0x11
137
138 #define PROX_SET0    0x00
139 #define PROX_SET1    0x00
140 #define PROX_SET2    0x00
141 #define PROX_SET3    0x00
142 #define EVENT_MASK   0x00
143
144 #define LP_TIME      0x00
145 #define TARGET_T     0x64    /* set the target of 1000, 0x80 */
146 #define TARGET_P     0x64
147
148 #define TAP_TIM      0x00
149 #define FLICK_TIM    0x00
150 #define FLICK_THR    0x07
151
152 #define IQS263_RESET 0x80
153 #define IQS263_EV_MASK 0x04
154
155 #define ACT_CH0      0x0
156
157
158
159 struct iqs253_chip {
160         struct i2c_client       *client;
161         const struct i2c_device_id      *id;
162         u32                     rdy_gpio;
163         u32                     wake_gpio;
164         u32                     sar_gpio;
165         u32                     version;
166         u32                     value;
167         struct regulator        *vddhi;
168         u32                     using_regulator;
169
170         struct workqueue_struct *sar_wq;
171         struct delayed_work     sar_dw;
172 };
173
174 enum mode {
175         MODE_NONE = -1,
176         INIT_MODE,
177         FORCE_ATI_MODE,
178         POST_INIT_MODE,
179         NUM_MODE
180 };
181
182 struct reg_val_pair {
183         u8 reg;
184         u8 val;
185 };
186
187 struct reg_val_pair reg_val_map_iqs253[NUM_MODE][NUM_REG] = {
188         {       /* init settings */
189                 { ACTIVE_CHAN, PROXIMITY_ONLY},
190                 { CH0_PTH, PROX_TH_CH0},
191                 { CH1_PTH, PROX_TH_CH1},
192                 { CH2_PTH, PROX_TH_CH2},
193                 { TARGET, 0xE6},
194                 { CH1_ATI_BASE, CH1_ATI_TH},
195                 { CH2_ATI_BASE, CH2_ATI_TH},
196                 { PROX_SETTINGS3, 0x05},
197         },
198         {       /* force on ATI */
199                 { PROX_SETTINGS0, 0x57}, /* enable ATI and force auto ATI */
200                 { ATI, 0x0}, /* wait for ATI to finish */
201         },
202         {
203                 { PROX_SETTINGS1, 0x40},
204                 { PROX_SETTINGS2, 0x57},
205         },
206 };
207
208 struct cmd_val_pair {
209         u8 cmd;
210         int len;
211         u8 *vals;
212 };
213
214 static u8 beforeinit_prox_settings[10] = { PROX_SET0 | 0x80, PROX_SET1 | 0x0,
215                                            PROX_SET2 , PROX_SET3 | 0x01,
216                                            EVENT_MASK };
217 static u8 active_ch[] = { ACT_CH0 | 0x05 };
218 static u8 set_thresholds[] = { PROX_THR, TOUCH_THR1, TOUCH_THR2, TOUCH_THR3,
219                                MOV_THR, MOV_DEB, HALT_TIME, I2C_TIMEOUT };
220 static u8 set_multipliers[] = { CH0_MULT, CH1_MULT, CH2_MULT, CH3_MULT,
221                                  CH_BASE | 0x00};
222 static u8 set_tim_targets[] = { LP_TIME, TARGET_T, TARGET_P };
223 static u8 afterinit_prox_settings[] = { PROX_SET0 | 0x10, PROX_SET1 | 0x02,
224                                         PROX_SET2 | 0x00, PROX_SET3 | 0x01,
225                                         EVENT_MASK };
226 static u8 set_ati[] = {0 };
227
228 struct cmd_val_pair cmd_val_map_iqs263[] = {
229         /* iqs263 init sequence */
230         { PROX_SETTINGS, 5, beforeinit_prox_settings},
231         { ACTIVE_CH, 1, active_ch},
232         { THRESHOLDS, 8, set_thresholds},
233         { MULTIPLERS, 5, set_multipliers},
234         { TIM_TARGETS, 3, set_tim_targets},
235         { PROX_SETTINGS, 5, afterinit_prox_settings},
236         { ATI, 0x0, set_ati}, /* wait for ATI to finish */
237 };
238
239 static void iqs253_detect_comwindow(struct iqs253_chip *chip)
240 {
241         int gpio_count = 10000; /* wait for a maximum of 1 second */
242         while (gpio_get_value(chip->rdy_gpio) && gpio_count--)
243                 usleep_range(100, 110);
244 }
245
246 static int iqs253_i2c_firsthand_shake(struct iqs253_chip *iqs253_chip)
247 {
248         int retry_count = 10;
249         int ret = 0;
250
251         pr_debug("%s :<-- HANDSHAKE START -->\n", __func__);
252
253         do {
254                 gpio_direction_output(iqs253_chip->rdy_gpio, 0);
255                 usleep_range(12 * 1000, 12 * 1000);
256                 /* put to tristate */
257                 gpio_direction_input(iqs253_chip->rdy_gpio);
258                 iqs253_detect_comwindow(iqs253_chip);
259         } while (gpio_get_value(iqs253_chip->rdy_gpio) && retry_count--);
260
261         /* got the window */
262         ret = i2c_smbus_write_byte_data(iqs253_chip->client,
263                                         PROX_SETTINGS2 , 0x17);
264         if (ret)
265                 return ret;
266         usleep_range(1000, 1100);
267
268         pr_debug("%s :<-- HANDSHAKE DONE -->\n", __func__);
269         return 0;
270 }
271
272 static int iqs253_i2c_read_byte(struct iqs253_chip *chip, int reg)
273 {
274         int ret = 0;
275         iqs253_detect_comwindow(chip);
276         ret = i2c_smbus_read_byte_data(chip->client, reg);
277         usleep_range(1000, 1100);
278         return ret;
279 }
280
281 static int iqs253_i2c_write_byte(struct iqs253_chip *chip, int reg, int val)
282 {
283         int ret = 0;
284
285         iqs253_detect_comwindow(chip);
286         ret = i2c_smbus_write_byte_data(chip->client, reg, val);
287         usleep_range(1000, 1100);
288         return ret;
289 }
290
291 static void iqs253_wait_for_ati_finish(struct iqs253_chip *iqs253_chip)
292 {
293         int ret;
294         do {
295                 usleep_range(10 * 1000, 10 * 1000);
296                 ret = iqs253_i2c_read_byte(iqs253_chip, SYSFLAGS);
297         } while (ret & ATI_IN_PROGRESS);
298 }
299
300 /* must call holding lock */
301 static int iqs253_set(struct iqs253_chip *iqs253_chip)
302 {
303         int ret = 0, i, j;
304         struct reg_val_pair *reg_val_pair_map;
305         int modes[NUM_MODE] = {INIT_MODE, FORCE_ATI_MODE, POST_INIT_MODE};
306
307         if (iqs253_chip->version != 253)
308                 return 0;
309
310         for (j = 0; j < NUM_MODE; j++) {
311
312                 if (modes[j] == MODE_NONE)
313                         break;
314
315                 reg_val_pair_map = reg_val_map_iqs253[modes[j]];
316
317                 for (i = 0; i < NUM_REG; i++) {
318                         if (!reg_val_pair_map[i].reg &&
319                             !reg_val_pair_map[i].val)
320                                 continue;
321
322                         if (reg_val_pair_map[i].reg == ATI) {
323                                 iqs253_wait_for_ati_finish(iqs253_chip);
324                                 continue;
325                         }
326
327                         ret = iqs253_i2c_write_byte(iqs253_chip,
328                                                 reg_val_pair_map[i].reg,
329                                                 reg_val_pair_map[i].val);
330                         if (ret) {
331                                 dev_err(&iqs253_chip->client->dev,
332                                         "iqs253 write val:%x to reg:%x fail\n",
333                                         reg_val_pair_map[i].val,
334                                         reg_val_pair_map[i].reg);
335                                 return ret;
336                         }
337                 }
338         }
339         return 0;
340 }
341
342 static int iqs263_i2c_read_bytes(struct iqs253_chip *chip,
343                                   u8 cmd)
344 {
345         int ret = 0;
346
347         iqs253_detect_comwindow(chip);
348         ret = i2c_smbus_read_word_data(chip->client, cmd);
349         if (ret < 0)
350                 pr_err("iqs263 i2c read from %d failed", cmd);
351         usleep_range(1000, 1100);
352         return ret;
353 }
354
355 static void iqs263_wait_for_ati_finish(struct iqs253_chip *iqs253_chip)
356 {
357         int ret;
358
359         do {
360                 iqs253_detect_comwindow(iqs253_chip);
361                 ret = iqs263_i2c_read_bytes(iqs253_chip, SYST_FLAGS);
362         } while (ret & ATI_IN_PROGRESS);
363 }
364
365 /* must call holding lock */
366 static int iqs263_i2c_write_bytes(struct iqs253_chip *chip,
367                                   struct cmd_val_pair *cmd_val)
368 {
369         int ret = 0;
370
371         iqs253_detect_comwindow(chip);
372         ret = i2c_smbus_write_i2c_block_data(chip->client, cmd_val->cmd,
373                                              cmd_val->len, cmd_val->vals);
374         if (ret < 0)
375                 pr_err("iqs263 i2c write to %d failed", cmd_val->cmd);
376         usleep_range(1000, 1100);
377         return ret;
378 }
379
380 static int iqs263_i2c_read_word(struct iqs253_chip *chip, u8 cmd)
381 {
382         int ret = 0;
383         u8 data_buffer[2];
384
385         iqs253_detect_comwindow(chip);
386         ret = i2c_smbus_read_i2c_block_data(chip->client, cmd, 2, data_buffer);
387         if (ret < 0)
388                 pr_err("iqs263 i2c word read  : %d failed", cmd);
389         else
390                 ret = (data_buffer[0] & 0x0f) | ((data_buffer[1] << 8) & 0xF0);
391
392         return ret;
393 }
394
395 /* must call holding lock */
396 static int iqs263_set(struct iqs253_chip *iqs253_chip)
397 {
398         int ret = 0, j;
399         struct cmd_val_pair *cmd_val_pair_map;
400
401         pr_debug("%s :<-- INIT START -->\n", __func__);
402
403         if (iqs253_chip->version != 263)
404                 return 0;
405
406         for (j = 0; j < ARRAY_SIZE(cmd_val_map_iqs263); j++) {
407
408                 cmd_val_pair_map = &cmd_val_map_iqs263[j];
409
410                 if (cmd_val_pair_map->cmd == ATI) {
411                         iqs263_wait_for_ati_finish(iqs253_chip);
412                         continue;
413                 }
414
415                 if (!cmd_val_pair_map->len)
416                         continue;
417
418                 ret = iqs263_i2c_write_bytes(iqs253_chip,
419                                              cmd_val_pair_map);
420                 if (ret)
421                         return ret;
422         }
423
424         pr_debug("%s :<--INIT DONE -->\n", __func__);
425         return 0;
426 }
427
428 static void iqs253_sar_proximity_detect_work(struct work_struct *ws)
429 {
430         int ret;
431         struct iqs253_chip *chip;
432
433         chip = container_of(ws, struct iqs253_chip, sar_dw.work);
434
435         if (!chip->using_regulator) {
436                 ret = regulator_enable(chip->vddhi);
437                 if (ret)
438                         goto finish;
439                 chip->using_regulator = true;
440         }
441
442         if (chip->version == 253) {
443                 ret = iqs253_i2c_read_byte(chip, PROX_STATUS);
444                 if (ret < 0)
445                         return;
446                 /* need to cross check thie */
447                 if (ret & BIT(5)) {
448                         ret = iqs253_set(chip);
449                         if (ret)
450                                 goto finish;
451                 }
452         } else {
453                 /* if this does not work, try ret = iqs263_i2c_read_word, then ret = ret >> 8; then check ret & 0x80*/
454                 ret = iqs263_i2c_read_bytes(chip, 0x03);
455                 if (ret & 0x80) {
456                     #if 0
457                     ret = iqs263_set(chip);
458                     if (ret)
459                         goto finish;
460                     #endif
461                 }
462         }
463
464        if (chip->version == 253) {
465                 ret = iqs253_i2c_read_byte(chip, PROX_STATUS);
466                 chip->value = -1;
467                 if (ret >= 0) {
468                     ret = ret & PROXIMITY_ONLY;
469                 /*
470                  * if both channel detect proximity => distance = 0;
471                  * if one channel detects proximity => distance = 1;
472                  * if no channel detects proximity => distance = 2;
473                  */
474                     chip->value = (ret == (PROX_CH1 | PROX_CH2)) ? 0 :
475                                                         ret ? 1 : 2;
476                 }
477                 if (chip->value == -1)
478                         goto finish;
479                 /* provide input to SAR */
480                 if (chip->value/2) {
481                         pr_info("%s :<-- undetect -->\n", __func__);
482                         gpio_direction_output(chip->sar_gpio, 1);
483                 } else {
484                         pr_info("%s :--> detect <--\n", __func__);
485                         gpio_direction_output(chip->sar_gpio, 0);
486                 }
487        } else {
488                     ret= iqs263_i2c_read_word(chip,0x03);
489                     chip->value = ret;
490                      /* provide input to SAR 0x0c -> 0x4 */
491                      if ((chip->value&0x04) !=0) {
492                         /* pr_info("%s :<-- detect  status: 0x%x -->\n", __func__ , chip->value); */
493                         gpio_direction_output(chip->sar_gpio, 0);
494                      } else {
495                         /* pr_info("%s :--> Undetect Status: 0x%x  <--\n", __func__, chip->value); */
496                         gpio_direction_output(chip->sar_gpio, 1);
497                      }
498        }
499
500         ret = regulator_disable(chip->vddhi);
501         if (ret)
502                 goto finish;
503         chip->using_regulator = false;
504
505 finish:
506         queue_delayed_work(chip->sar_wq, &chip->sar_dw, msecs_to_jiffies(1000));
507 }
508
509 static int iqs253_probe(struct i2c_client *client,
510                         const struct i2c_device_id *id)
511 {
512         int ret;
513         struct iqs253_chip *iqs253_chip;
514         struct iio_dev *indio_dev;
515         int rdy_gpio = -1, wake_gpio = -1, sar_gpio = -1;
516
517         rdy_gpio = of_get_named_gpio(client->dev.of_node, "rdy-gpio", 0);
518         if (rdy_gpio == -EPROBE_DEFER)
519                 return -EPROBE_DEFER;
520
521         if (!gpio_is_valid(rdy_gpio))
522                 return -EINVAL;
523
524         wake_gpio = of_get_named_gpio(client->dev.of_node, "wake-gpio", 0);
525         if (wake_gpio == -EPROBE_DEFER)
526                 return -EPROBE_DEFER;
527
528         if (!gpio_is_valid(wake_gpio))
529                 return -EINVAL;
530
531         sar_gpio = of_get_named_gpio(client->dev.of_node, "sar-gpio", 0);
532         if (sar_gpio == -EPROBE_DEFER)
533                 return -EPROBE_DEFER;
534
535         ret = gpio_request_one(sar_gpio, GPIOF_OUT_INIT_LOW, NULL);
536         if (ret < 0)
537                 return -EINVAL;
538
539         indio_dev = iio_device_alloc(sizeof(*iqs253_chip));
540         if (!indio_dev)
541                 return -ENOMEM;
542
543         i2c_set_clientdata(client, indio_dev);
544         iqs253_chip = iio_priv(indio_dev);
545
546         iqs253_chip->client = client;
547         iqs253_chip->id = id;
548         iqs253_chip->vddhi = devm_regulator_get(&client->dev, "vddhi");
549         if (IS_ERR(iqs253_chip->vddhi)) {
550                 dev_err(&client->dev,
551                         "devname:%s func:%s regulator vddhi not found\n",
552                         id->name, __func__);
553                 goto err_regulator_get;
554         }
555
556         ret = gpio_request(rdy_gpio, "iqs253");
557         if (ret) {
558                         dev_err(&client->dev,
559                         "devname:%s func:%s regulator vddhi not found\n",
560                         id->name, __func__);
561                 goto err_gpio_request;
562         }
563         iqs253_chip->rdy_gpio = rdy_gpio;
564         iqs253_chip->wake_gpio = wake_gpio;
565         iqs253_chip->sar_gpio = sar_gpio;
566
567         ret = regulator_enable(iqs253_chip->vddhi);
568         if (ret) {
569                 dev_err(&client->dev,
570                         "devname:%s func:%s regulator enable failed\n",
571                         id->name, __func__);
572                 goto err_gpio_request;
573         }
574         /*
575          * XXX: Do not set using_regulator = true here as
576          * it affects proximity detection
577          */
578
579         ret = iqs253_i2c_read_byte(iqs253_chip, 0);
580         if (ret == IQS253_PROD_ID) {
581                 pr_info("%s :-->Chipid Detected: %d <--\n", __func__, iqs253_chip->version);
582                 iqs253_i2c_firsthand_shake(iqs253_chip);
583                 iqs253_chip->version = 253;
584         } else if (ret == IQS263_PROD_ID) {
585                pr_info("%s :-->Chipid Detected:  %d <--\n", __func__, iqs253_chip->version);
586                 iqs253_chip->version = 263;
587                 ret = iqs263_set(iqs253_chip);
588         } else {
589                 dev_err(&client->dev,
590                         "devname:%s func:%s device not present\n",
591                         id->name, __func__);
592                 goto err_gpio_request;
593         }
594
595         iqs253_chip->sar_wq = create_freezable_workqueue("iqs253_sar");
596         if (!iqs253_chip->sar_wq) {
597                 dev_err(&iqs253_chip->client->dev, "unable to create work queue\n");
598                 goto err_gpio_request;
599         }
600
601         INIT_DELAYED_WORK(&iqs253_chip->sar_dw,
602                                 iqs253_sar_proximity_detect_work);
603
604         queue_delayed_work(iqs253_chip->sar_wq, &iqs253_chip->sar_dw, 0);
605
606         dev_info(&client->dev, "devname:%s func:%s line:%d probe success\n",
607                         id->name, __func__, __LINE__);
608
609         return 0;
610
611 err_gpio_request:
612         if (iqs253_chip->sar_wq)
613                 destroy_workqueue(iqs253_chip->sar_wq);
614 err_regulator_get:
615         iio_device_free(indio_dev);
616
617         dev_err(&client->dev, "devname:%s func:%s line:%d probe failed\n",
618                         id->name, __func__, __LINE__);
619         return ret;
620 }
621
622 static int iqs253_remove(struct i2c_client *client)
623 {
624         struct iio_dev *indio_dev = i2c_get_clientdata(client);
625         struct iqs253_chip *chip = iio_priv(indio_dev);
626         gpio_free(chip->rdy_gpio);
627
628         if (chip->sar_wq)
629                 destroy_workqueue(chip->sar_wq);
630         iio_device_free(indio_dev);
631         return 0;
632 }
633
634 static void iqs253_shutdown(struct i2c_client *client)
635 {
636         struct iio_dev *indio_dev = i2c_get_clientdata(client);
637         struct iqs253_chip *chip = iio_priv(indio_dev);
638
639         if (chip->sar_wq)
640                 cancel_delayed_work_sync(&chip->sar_dw);
641 }
642
643 static const struct i2c_device_id iqs253_id[] = {
644         {"iqs253", 0},
645         {}
646 };
647
648 MODULE_DEVICE_TABLE(i2c, iqs253_id);
649
650 static const struct of_device_id iqs253_of_match[] = {
651         { .compatible = "azoteq,iqs253", },
652         { },
653 };
654 MODULE_DEVICE_TABLE(of, iqs253_of_match);
655
656 static struct i2c_driver iqs253_driver = {
657         .class = I2C_CLASS_HWMON,
658         .driver = {
659                 .name = "iqs253",
660                 .owner = THIS_MODULE,
661                 .of_match_table = of_match_ptr(iqs253_of_match),
662         },
663         .probe = iqs253_probe,
664         .remove = iqs253_remove,
665         .shutdown = iqs253_shutdown,
666         .id_table = iqs253_id,
667 };
668
669 module_i2c_driver(iqs253_driver);
670
671 MODULE_LICENSE("GPL");
672 MODULE_DESCRIPTION("IQS253 Driver");
673 MODULE_AUTHOR("Sri Krishna chowdary <schowdary@nvidia.com>");