1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
|
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/init.h>
#include <linux/module.h>
#include <linux/gpio.h>
#include <linux/i2c.h>
#include <linux/pm.h>
#include <linux/err.h>
#include <linux/of.h>
#include <linux/regulator/consumer.h>
#include <linux/i2c/ti_drv2667.h>
#include "../staging/android/timed_output.h"
#ifdef CONFIG_HAS_EARLYSUSPEND
#include <linux/earlysuspend.h>
#define DRV2667_SUS_LEVEL 1
#endif
#define DRV2667_STATUS_REG 0x00
#define DRV2667_CNTL1_REG 0x01
#define DRV2667_CNTL2_REG 0x02
#define DRV2667_WAV_SEQ3_REG 0x03
#define DRV2667_FIFO_REG 0x0B
#define DRV2667_PAGE_REG 0xFF
#define DRV2667_STANDBY_MASK 0xBF
#define DRV2667_INPUT_MUX_MASK 0x04
#define DRV2667_GAIN_MASK 0xFC
#define DRV2667_GAIN_SHIFT 0
#define DRV2667_TIMEOUT_MASK 0xF3
#define DRV2667_TIMEOUT_SHIFT 2
#define DRV2667_GO_MASK 0x01
#define DRV2667_FIFO_SIZE 100
#define DRV2667_VIB_START_VAL 0x7F
#define DRV2667_REG_PAGE_ID 0x00
#define DRV2667_FIFO_CHUNK_MS 10
#define DRV2667_BYTES_PER_MS 8
#define DRV2667_WAV_SEQ_ID_IDX 0
#define DRV2667_WAV_SEQ_REP_IDX 6
#define DRV2667_WAV_SEQ_FREQ_IDX 8
#define DRV2667_WAV_SEQ_FREQ_MIN 8
#define DRV2667_WAV_SEQ_DUR_IDX 9
#define DRV2667_MIN_IDLE_TIMEOUT_MS 5
#define DRV2667_MAX_IDLE_TIMEOUT_MS 20
#define DRV2667_VTG_MIN_UV 3000000
#define DRV2667_VTG_MAX_UV 5500000
#define DRV2667_VTG_CURR_UA 24000
#define DRV2667_I2C_VTG_MIN_UV 1800000
#define DRV2667_I2C_VTG_MAX_UV 1800000
#define DRV2667_I2C_CURR_UA 9630
/* supports 3 modes in digital - fifo, ram and wave */
enum drv2667_modes {
FIFO_MODE = 0,
RAM_SEQ_MODE,
WAV_SEQ_MODE,
ANALOG_MODE,
};
struct drv2667_data {
struct i2c_client *client;
struct timed_output_dev dev;
struct hrtimer timer;
struct work_struct work;
struct mutex lock;
struct regulator *vdd;
struct regulator *vdd_i2c;
u32 max_runtime_ms;
u32 runtime_left;
u8 buf[DRV2667_FIFO_SIZE + 1];
u8 cntl2_val;
enum drv2667_modes mode;
u32 time_chunk_ms;
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend es;
#endif
};
static int drv2667_read_reg(struct i2c_client *client, u32 reg)
{
int rc;
rc = i2c_smbus_read_byte_data(client, reg);
if (rc < 0)
dev_err(&client->dev, "i2c reg read for 0x%x failed\n", reg);
return rc;
}
static int drv2667_write_reg(struct i2c_client *client, u32 reg, u8 val)
{
int rc;
rc = i2c_smbus_write_byte_data(client, reg, val);
if (rc < 0)
dev_err(&client->dev, "i2c reg write for 0x%xfailed\n", reg);
return rc;
}
static void drv2667_dump_regs(struct drv2667_data *data, char *label)
{
dev_dbg(&data->client->dev,
"%s: reg0x00 = 0x%x, reg0x01 = 0x%x reg0x02 = 0x%x", label,
drv2667_read_reg(data->client, DRV2667_STATUS_REG),
drv2667_read_reg(data->client, DRV2667_CNTL1_REG),
drv2667_read_reg(data->client, DRV2667_CNTL2_REG));
}
static void drv2667_worker(struct work_struct *work)
{
struct drv2667_data *data;
int rc = 0;
u8 val;
data = container_of(work, struct drv2667_data, work);
if (data->mode == WAV_SEQ_MODE) {
/* clear go bit */
val = data->cntl2_val & ~DRV2667_GO_MASK;
rc = drv2667_write_reg(data->client, DRV2667_CNTL2_REG, val);
if (rc < 0) {
dev_err(&data->client->dev, "i2c send msg failed\n");
return;
}
/* restart wave if runtime is left */
if (data->runtime_left) {
val = data->cntl2_val | DRV2667_GO_MASK;
rc = drv2667_write_reg(data->client,
DRV2667_CNTL2_REG, val);
}
} else if (data->mode == FIFO_MODE) {
/* data is played at 8khz */
if (data->runtime_left < data->time_chunk_ms)
val = data->runtime_left * DRV2667_BYTES_PER_MS;
else
val = data->time_chunk_ms * DRV2667_BYTES_PER_MS;
rc = i2c_master_send(data->client, data->buf, val + 1);
}
if (rc < 0)
dev_err(&data->client->dev, "i2c send message failed\n");
}
static void drv2667_enable(struct timed_output_dev *dev, int runtime)
{
struct drv2667_data *data = container_of(dev, struct drv2667_data, dev);
unsigned long time_ms;
if (runtime > data->max_runtime_ms) {
dev_dbg(&data->client->dev, "Invalid runtime\n");
runtime = data->max_runtime_ms;
}
mutex_lock(&data->lock);
hrtimer_cancel(&data->timer);
data->runtime_left = runtime;
if (data->runtime_left < data->time_chunk_ms)
time_ms = runtime * NSEC_PER_MSEC;
else
time_ms = data->time_chunk_ms * NSEC_PER_MSEC;
hrtimer_start(&data->timer, ktime_set(0, time_ms), HRTIMER_MODE_REL);
schedule_work(&data->work);
mutex_unlock(&data->lock);
}
static int drv2667_get_time(struct timed_output_dev *dev)
{
struct drv2667_data *data = container_of(dev, struct drv2667_data, dev);
if (hrtimer_active(&data->timer))
return data->runtime_left +
ktime_to_ms(hrtimer_get_remaining(&data->timer));
return 0;
}
static enum hrtimer_restart drv2667_timer(struct hrtimer *timer)
{
struct drv2667_data *data;
int time_ms;
data = container_of(timer, struct drv2667_data, timer);
if (data->runtime_left <= data->time_chunk_ms) {
data->runtime_left = 0;
schedule_work(&data->work);
return HRTIMER_NORESTART;
}
data->runtime_left -= data->time_chunk_ms;
if (data->runtime_left < data->time_chunk_ms)
time_ms = data->runtime_left * NSEC_PER_MSEC;
else
time_ms = data->time_chunk_ms * NSEC_PER_MSEC;
hrtimer_forward_now(&data->timer, ktime_set(0, time_ms));
schedule_work(&data->work);
return HRTIMER_RESTART;
}
static int drv2667_vreg_config(struct drv2667_data *data, bool on)
{
int rc = 0;
if (!on)
goto deconfig_vreg;
data->vdd = regulator_get(&data->client->dev, "vdd");
if (IS_ERR(data->vdd)) {
rc = PTR_ERR(data->vdd);
dev_err(&data->client->dev, "unable to request vdd\n");
return rc;
}
if (regulator_count_voltages(data->vdd) > 0) {
rc = regulator_set_voltage(data->vdd,
DRV2667_VTG_MIN_UV, DRV2667_VTG_MAX_UV);
if (rc < 0) {
dev_err(&data->client->dev,
"vdd set voltage failed(%d)\n", rc);
goto put_vdd;
}
}
data->vdd_i2c = regulator_get(&data->client->dev, "vdd-i2c");
if (IS_ERR(data->vdd_i2c)) {
rc = PTR_ERR(data->vdd_i2c);
dev_err(&data->client->dev, "unable to request vdd for i2c\n");
goto reset_vdd_volt;
}
if (regulator_count_voltages(data->vdd_i2c) > 0) {
rc = regulator_set_voltage(data->vdd_i2c,
DRV2667_I2C_VTG_MIN_UV, DRV2667_I2C_VTG_MAX_UV);
if (rc < 0) {
dev_err(&data->client->dev,
"vdd_i2c set voltage failed(%d)\n", rc);
goto put_vdd_i2c;
}
}
return rc;
deconfig_vreg:
if (regulator_count_voltages(data->vdd_i2c) > 0)
regulator_set_voltage(data->vdd_i2c, 0, DRV2667_I2C_VTG_MAX_UV);
put_vdd_i2c:
regulator_put(data->vdd_i2c);
reset_vdd_volt:
if (regulator_count_voltages(data->vdd) > 0)
regulator_set_voltage(data->vdd, 0, DRV2667_VTG_MAX_UV);
put_vdd:
regulator_put(data->vdd);
return rc;
}
static int reg_set_optimum_mode_check(struct regulator *reg, int load_uA)
{
return (regulator_count_voltages(reg) > 0) ?
regulator_set_optimum_mode(reg, load_uA) : 0;
}
static int drv2667_vreg_on(struct drv2667_data *data, bool on)
{
int rc = 0;
if (!on)
goto vreg_off;
rc = reg_set_optimum_mode_check(data->vdd, DRV2667_VTG_CURR_UA);
if (rc < 0) {
dev_err(&data->client->dev,
"Regulator vdd set_opt failed rc=%d\n", rc);
return rc;
}
rc = regulator_enable(data->vdd);
if (rc < 0) {
dev_err(&data->client->dev, "enable vdd failed\n");
return rc;
}
rc = reg_set_optimum_mode_check(data->vdd_i2c, DRV2667_I2C_CURR_UA);
if (rc < 0) {
dev_err(&data->client->dev,
"Regulator vdd_i2c set_opt failed rc=%d\n", rc);
return rc;
}
rc = regulator_enable(data->vdd_i2c);
if (rc < 0) {
dev_err(&data->client->dev, "enable vdd_i2c failed\n");
goto disable_vdd;
}
return rc;
vreg_off:
regulator_disable(data->vdd_i2c);
disable_vdd:
regulator_disable(data->vdd);
return rc;
}
#ifdef CONFIG_PM
static int drv2667_suspend(struct device *dev)
{
struct drv2667_data *data = dev_get_drvdata(dev);
u8 val;
int rc;
hrtimer_cancel(&data->timer);
cancel_work_sync(&data->work);
/* set standby */
val = data->cntl2_val | ~DRV2667_STANDBY_MASK;
rc = drv2667_write_reg(data->client, DRV2667_CNTL2_REG, val);
if (rc < 0)
dev_err(dev, "unable to set standby\n");
/* turn regulators off */
drv2667_vreg_on(data, false);
return 0;
}
static int drv2667_resume(struct device *dev)
{
struct drv2667_data *data = dev_get_drvdata(dev);
int rc;
/* turn regulators on */
rc = drv2667_vreg_on(data, true);
if (rc < 0) {
dev_err(dev, "unable to turn regulators on\n");
return rc;
}
/* clear standby */
rc = drv2667_write_reg(data->client,
DRV2667_CNTL2_REG, data->cntl2_val);
if (rc < 0) {
dev_err(dev, "unable to clear standby\n");
goto vreg_off;
}
return 0;
vreg_off:
drv2667_vreg_on(data, false);
return rc;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
static void drv2667_early_suspend(struct early_suspend *es)
{
struct drv2667_data *data = container_of(es, struct drv2667_data, es);
drv2667_suspend(&data->client->dev);
}
static void drv2667_late_resume(struct early_suspend *es)
{
struct drv2667_data *data = container_of(es, struct drv2667_data, es);
drv2667_resume(&data->client->dev);
}
#endif
static const struct dev_pm_ops drv2667_pm_ops = {
#ifndef CONFIG_HAS_EARLYSUSPEND
.suspend = drv2667_suspend,
.resume = drv2667_resume,
#endif
};
#endif
#ifdef CONFIG_OF
static int drv2667_parse_dt(struct device *dev, struct drv2667_pdata *pdata)
{
struct property *prop;
int rc;
u32 temp;
rc = of_property_read_string(dev->of_node, "ti,label", &pdata->name);
/* set vibrator as default name */
if (rc < 0)
pdata->name = "vibrator";
rc = of_property_read_u32(dev->of_node, "ti,gain", &temp);
/* set gain as 0 */
if (rc < 0)
pdata->gain = 0;
else
pdata->gain = (u8) temp;
rc = of_property_read_u32(dev->of_node, "ti,mode", &temp);
/* set FIFO mode as default */
if (rc < 0)
pdata->mode = FIFO_MODE;
else
pdata->mode = (u8) temp;
/* read wave sequence */
if (pdata->mode == WAV_SEQ_MODE) {
prop = of_find_property(dev->of_node, "ti,wav-seq", &temp);
if (!prop) {
dev_err(dev, "wav seq data not found");
return -ENODEV;
} else if (temp != DRV2667_WAV_SEQ_LEN) {
dev_err(dev, "Invalid length of wav seq data\n");
return -EINVAL;
}
memcpy(pdata->wav_seq, prop->value, DRV2667_WAV_SEQ_LEN);
}
rc = of_property_read_u32(dev->of_node, "ti,idle-timeout-ms", &temp);
/* configure minimum idle timeout */
if (rc < 0)
pdata->idle_timeout_ms = DRV2667_MIN_IDLE_TIMEOUT_MS;
else
pdata->idle_timeout_ms = (u8) temp;
rc = of_property_read_u32(dev->of_node, "ti,max-runtime-ms",
&pdata->max_runtime_ms);
/* configure one sec as default time */
if (rc < 0)
pdata->max_runtime_ms = MSEC_PER_SEC;
return 0;
}
#else
static int drv2667_parse_dt(struct device *dev, struct drv2667_pdata *pdata)
{
return -ENODEV;
}
#endif
static int drv2667_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct drv2667_data *data;
struct drv2667_pdata *pdata;
int rc, i;
u8 val, fifo_seq_val, reg;
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
dev_err(&client->dev, "i2c is not supported\n");
return -EIO;
}
if (client->dev.of_node) {
pdata = devm_kzalloc(&client->dev,
sizeof(struct drv2667_pdata), GFP_KERNEL);
if (!pdata)
return -ENOMEM;
/* parse DT */
rc = drv2667_parse_dt(&client->dev, pdata);
if (rc) {
dev_err(&client->dev, "DT parsing failed\n");
return rc;
}
} else {
pdata = client->dev.platform_data;
if (!pdata) {
dev_err(&client->dev, "invalid pdata\n");
return -EINVAL;
}
}
data = devm_kzalloc(&client->dev, sizeof(struct drv2667_data),
GFP_KERNEL);
if (!data)
return -ENOMEM;
i2c_set_clientdata(client, data);
data->client = client;
data->max_runtime_ms = pdata->max_runtime_ms;
mutex_init(&data->lock);
INIT_WORK(&data->work, drv2667_worker);
hrtimer_init(&data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
data->timer.function = drv2667_timer;
data->mode = pdata->mode;
/* configure voltage regulators */
rc = drv2667_vreg_config(data, true);
if (rc) {
dev_err(&client->dev, "unable to configure regulators\n");
goto destroy_mutex;
}
/* turn on voltage regulators */
rc = drv2667_vreg_on(data, true);
if (rc) {
dev_err(&client->dev, "unable to turn on regulators\n");
goto deconfig_vreg;
}
rc = drv2667_read_reg(client, DRV2667_CNTL2_REG);
if (rc < 0)
goto vreg_off;
/* set timeout, clear standby */
val = (u8) rc;
if (pdata->idle_timeout_ms < DRV2667_MIN_IDLE_TIMEOUT_MS ||
pdata->idle_timeout_ms > DRV2667_MAX_IDLE_TIMEOUT_MS ||
(pdata->idle_timeout_ms % DRV2667_MIN_IDLE_TIMEOUT_MS)) {
dev_err(&client->dev, "Invalid idle timeout\n");
goto vreg_off;
}
val = (val & DRV2667_TIMEOUT_MASK) |
((pdata->idle_timeout_ms / DRV2667_MIN_IDLE_TIMEOUT_MS - 1) <<
DRV2667_TIMEOUT_SHIFT);
val &= DRV2667_STANDBY_MASK;
rc = drv2667_write_reg(client, DRV2667_CNTL2_REG, val);
if (rc < 0)
goto vreg_off;
/* cache control2 val */
data->cntl2_val = val;
/* program drv2667 registers */
rc = drv2667_read_reg(client, DRV2667_CNTL1_REG);
if (rc < 0)
goto vreg_off;
/* gain and input mode */
val = (u8) rc;
/* remove this check after adding support for these modes */
if (data->mode == ANALOG_MODE || data->mode == RAM_SEQ_MODE) {
dev_err(&data->client->dev, "Mode not supported\n");
goto vreg_off;
} else
val &= ~DRV2667_INPUT_MUX_MASK; /* set digital mode */
val = (val & DRV2667_GAIN_MASK) | (pdata->gain << DRV2667_GAIN_SHIFT);
rc = drv2667_write_reg(client, DRV2667_CNTL1_REG, val);
if (rc < 0)
goto vreg_off;
if (data->mode == FIFO_MODE) {
/* Load a predefined pattern for FIFO mode */
data->buf[0] = DRV2667_FIFO_REG;
fifo_seq_val = DRV2667_VIB_START_VAL;
for (i = 1; i < DRV2667_FIFO_SIZE - 1; i++, fifo_seq_val++)
data->buf[i] = fifo_seq_val;
data->time_chunk_ms = DRV2667_FIFO_CHUNK_MS;
} else if (data->mode == WAV_SEQ_MODE) {
u8 freq, rep, dur;
/* program wave sequence from pdata */
/* id to wave sequence 3, set page */
rc = drv2667_write_reg(client, DRV2667_WAV_SEQ3_REG,
pdata->wav_seq[DRV2667_WAV_SEQ_ID_IDX]);
if (rc < 0)
goto vreg_off;
/* set page to wave form sequence */
rc = drv2667_write_reg(client, DRV2667_PAGE_REG,
pdata->wav_seq[DRV2667_WAV_SEQ_ID_IDX]);
if (rc < 0)
goto vreg_off;
/* program waveform sequence */
for (reg = 0, i = 0; i < DRV2667_WAV_SEQ_LEN - 1; i++, reg++) {
rc = drv2667_write_reg(client, reg,
pdata->wav_seq[i+1]);
if (rc < 0)
goto vreg_off;
}
/* set page back to normal register space */
rc = drv2667_write_reg(client, DRV2667_PAGE_REG,
DRV2667_REG_PAGE_ID);
if (rc < 0)
goto vreg_off;
freq = pdata->wav_seq[DRV2667_WAV_SEQ_FREQ_IDX];
rep = pdata->wav_seq[DRV2667_WAV_SEQ_REP_IDX];
dur = pdata->wav_seq[DRV2667_WAV_SEQ_DUR_IDX];
data->time_chunk_ms = (rep * dur * MSEC_PER_SEC) /
(freq * DRV2667_WAV_SEQ_FREQ_MIN);
}
drv2667_dump_regs(data, "new");
/* register with timed output class */
data->dev.name = pdata->name;
data->dev.get_time = drv2667_get_time;
data->dev.enable = drv2667_enable;
rc = timed_output_dev_register(&data->dev);
if (rc) {
dev_err(&client->dev, "unable to register with timed_output\n");
goto vreg_off;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
data->es.level = EARLY_SUSPEND_LEVEL_BLANK_SCREEN + DRV2667_SUS_LEVEL;
data->es.suspend = drv2667_early_suspend;
data->es.resume = drv2667_late_resume;
register_early_suspend(&data->es);
#endif
return 0;
vreg_off:
drv2667_vreg_on(data, false);
deconfig_vreg:
drv2667_vreg_config(data, false);
destroy_mutex:
mutex_destroy(&data->lock);
return rc;
}
static int drv2667_remove(struct i2c_client *client)
{
struct drv2667_data *data = i2c_get_clientdata(client);
#ifdef CONFIG_HAS_EARLYSUSPEND
unregister_early_suspend(&data->es);
#endif
mutex_destroy(&data->lock);
timed_output_dev_unregister(&data->dev);
hrtimer_cancel(&data->timer);
cancel_work_sync(&data->work);
drv2667_vreg_on(data, false);
drv2667_vreg_config(data, false);
return 0;
}
static const struct i2c_device_id drv2667_id_table[] = {
{"drv2667", 0},
{ },
};
MODULE_DEVICE_TABLE(i2c, drv2667_id_table);
#ifdef CONFIG_OF
static const struct of_device_id drv2667_of_id_table[] = {
{.compatible = "ti,drv2667"},
{ },
};
#else
#define drv2667_of_id_table NULL
#endif
static struct i2c_driver drv2667_i2c_driver = {
.driver = {
.name = "drv2667",
.owner = THIS_MODULE,
.of_match_table = drv2667_of_id_table,
#ifdef CONFIG_PM
.pm = &drv2667_pm_ops,
#endif
},
.probe = drv2667_probe,
.remove = drv2667_remove,
.id_table = drv2667_id_table,
};
module_i2c_driver(drv2667_i2c_driver);
MODULE_LICENSE("GPL v2");
MODULE_DESCRIPTION("TI DRV2667 chip driver");
|