blob: 31c79a090560fc09f05619a74767bff88cb97681 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 * isa1200.c - Haptic Motor
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 * Kyungmin Park <kyungmin.park@samsung.com>
Mohan Pallaka73787fa2011-09-09 15:14:20 +05306 * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/init.h>
15#include <linux/i2c.h>
16#include <linux/gpio.h>
17#include <linux/delay.h>
18#include <linux/err.h>
19#include <linux/pwm.h>
20#include <linux/workqueue.h>
21#include <linux/slab.h>
Mohan Pallaka73787fa2011-09-09 15:14:20 +053022#include <linux/regulator/consumer.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070023#include <linux/i2c/isa1200.h>
24#include "../staging/android/timed_output.h"
25
26#define ISA1200_HCTRL0 0x30
27#define ISA1200_HCTRL1 0x31
28#define ISA1200_HCTRL5 0x35
29
30#define ISA1200_HCTRL0_RESET 0x01
31#define ISA1200_HCTRL1_RESET 0x4B
32
33#define ISA1200_HCTRL5_VIB_STRT 0xD5
34#define ISA1200_HCTRL5_VIB_STOP 0x6B
35
36struct isa1200_chip {
37 struct i2c_client *client;
38 struct isa1200_platform_data *pdata;
39 struct pwm_device *pwm;
40 struct hrtimer timer;
41 struct timed_output_dev dev;
42 struct work_struct work;
43 spinlock_t lock;
44 unsigned int enable;
45 unsigned int period_ns;
Mohan Pallaka73787fa2011-09-09 15:14:20 +053046 bool is_len_gpio_valid;
47 struct regulator **regs;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070048};
49
50static int isa1200_read_reg(struct i2c_client *client, int reg)
51{
52 int ret;
53
54 ret = i2c_smbus_read_byte_data(client, reg);
55 if (ret < 0)
56 dev_err(&client->dev, "%s: err %d\n", __func__, ret);
57
58 return ret;
59}
60
61static int isa1200_write_reg(struct i2c_client *client, int reg, u8 value)
62{
63 int ret;
64
65 ret = i2c_smbus_write_byte_data(client, reg, value);
66 if (ret < 0)
67 dev_err(&client->dev, "%s: err %d\n", __func__, ret);
68
69 return ret;
70}
71
72static void isa1200_vib_set(struct isa1200_chip *haptic, int enable)
73{
74 int rc = 0;
75
76 if (enable) {
77 if (haptic->pdata->mode_ctrl == PWM_INPUT_MODE) {
78 int period_us = haptic->period_ns / 1000;
79 rc = pwm_config(haptic->pwm,
80 (period_us * haptic->pdata->duty) / 100,
81 period_us);
82 if (rc < 0)
83 pr_err("%s: pwm_config fail\n", __func__);
84 rc = pwm_enable(haptic->pwm);
85 if (rc < 0)
86 pr_err("%s: pwm_enable fail\n", __func__);
87 } else if (haptic->pdata->mode_ctrl == PWM_GEN_MODE) {
88 rc = isa1200_write_reg(haptic->client,
89 ISA1200_HCTRL5,
90 ISA1200_HCTRL5_VIB_STRT);
91 if (rc < 0)
92 pr_err("%s: start vibartion fail\n", __func__);
93 }
94 } else {
95 if (haptic->pdata->mode_ctrl == PWM_INPUT_MODE)
96 pwm_disable(haptic->pwm);
97 else if (haptic->pdata->mode_ctrl == PWM_GEN_MODE) {
98 rc = isa1200_write_reg(haptic->client,
99 ISA1200_HCTRL5,
100 ISA1200_HCTRL5_VIB_STOP);
101 if (rc < 0)
102 pr_err("%s: stop vibartion fail\n", __func__);
103 }
104 }
105}
106
107static void isa1200_chip_work(struct work_struct *work)
108{
109 struct isa1200_chip *haptic;
110
111 haptic = container_of(work, struct isa1200_chip, work);
112 isa1200_vib_set(haptic, haptic->enable);
113}
114
115static void isa1200_chip_enable(struct timed_output_dev *dev, int value)
116{
117 struct isa1200_chip *haptic = container_of(dev, struct isa1200_chip,
118 dev);
119 unsigned long flags;
120
121 spin_lock_irqsave(&haptic->lock, flags);
122 hrtimer_cancel(&haptic->timer);
123 if (value == 0)
124 haptic->enable = 0;
125 else {
126 value = (value > haptic->pdata->max_timeout ?
127 haptic->pdata->max_timeout : value);
128 haptic->enable = 1;
129 hrtimer_start(&haptic->timer,
130 ktime_set(value / 1000, (value % 1000) * 1000000),
131 HRTIMER_MODE_REL);
132 }
133 spin_unlock_irqrestore(&haptic->lock, flags);
134 schedule_work(&haptic->work);
135}
136
137static int isa1200_chip_get_time(struct timed_output_dev *dev)
138{
139 struct isa1200_chip *haptic = container_of(dev, struct isa1200_chip,
140 dev);
141
142 if (hrtimer_active(&haptic->timer)) {
143 ktime_t r = hrtimer_get_remaining(&haptic->timer);
144 struct timeval t = ktime_to_timeval(r);
145 return t.tv_sec * 1000 + t.tv_usec / 1000;
146 } else
147 return 0;
148}
149
150static enum hrtimer_restart isa1200_vib_timer_func(struct hrtimer *timer)
151{
152 struct isa1200_chip *haptic = container_of(timer, struct isa1200_chip,
153 timer);
154 haptic->enable = 0;
155 schedule_work(&haptic->work);
156
157 return HRTIMER_NORESTART;
158}
159
160static void dump_isa1200_reg(char *str, struct i2c_client *client)
161{
162 pr_debug("%s reg0x%x=0x%x, reg0x%x=0x%x, reg0x%x=0x%x\n", str,
163 ISA1200_HCTRL0, isa1200_read_reg(client, ISA1200_HCTRL0),
164 ISA1200_HCTRL1, isa1200_read_reg(client, ISA1200_HCTRL1),
165 ISA1200_HCTRL5, isa1200_read_reg(client, ISA1200_HCTRL5));
166}
167
168static int isa1200_setup(struct i2c_client *client)
169{
170 struct isa1200_chip *haptic = i2c_get_clientdata(client);
171 int value, temp, rc;
172
173 gpio_set_value_cansleep(haptic->pdata->hap_en_gpio, 0);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530174 if (haptic->is_len_gpio_valid == true)
175 gpio_set_value_cansleep(haptic->pdata->hap_len_gpio, 0);
176
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700177 udelay(250);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530178
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700179 gpio_set_value_cansleep(haptic->pdata->hap_en_gpio, 1);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530180 if (haptic->is_len_gpio_valid == true)
181 gpio_set_value_cansleep(haptic->pdata->hap_len_gpio, 1);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700182
183 value = (haptic->pdata->smart_en << 3) |
184 (haptic->pdata->is_erm << 5) |
185 (haptic->pdata->ext_clk_en << 7);
186
187 rc = isa1200_write_reg(client, ISA1200_HCTRL1, value);
188 if (rc < 0) {
189 pr_err("%s: i2c write failure\n", __func__);
Mohan Pallakaacdca0f2011-11-21 13:08:00 +0530190 goto reset_gpios;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191 }
192
193 if (haptic->pdata->mode_ctrl == PWM_GEN_MODE) {
194 temp = haptic->pdata->pwm_fd.pwm_div;
195 if (temp < 128 || temp > 1024 || temp % 128) {
196 pr_err("%s: Invalid divider\n", __func__);
197 goto reset_hctrl1;
198 }
199 value = ((temp >> 7) - 1);
200 } else if (haptic->pdata->mode_ctrl == PWM_INPUT_MODE) {
201 temp = haptic->pdata->pwm_fd.pwm_freq;
202 if (temp < 22400 || temp > 172600 || temp % 22400) {
203 pr_err("%s: Invalid frequency\n", __func__);
204 goto reset_hctrl1;
205 }
206 value = ((temp / 22400) - 1);
207 haptic->period_ns = NSEC_PER_SEC / temp;
208 }
209
210 value |= (haptic->pdata->mode_ctrl << 3) |
211 (haptic->pdata->overdrive_high << 5) |
212 (haptic->pdata->overdrive_en << 5) |
213 (haptic->pdata->chip_en << 7);
214
215 rc = isa1200_write_reg(client, ISA1200_HCTRL0, value);
216 if (rc < 0) {
217 pr_err("%s: i2c write failure\n", __func__);
218 goto reset_hctrl1;
219 }
220
221 dump_isa1200_reg("new:", client);
222 return 0;
223
224reset_hctrl1:
225 i2c_smbus_write_byte_data(client, ISA1200_HCTRL1,
226 ISA1200_HCTRL1_RESET);
Mohan Pallakaacdca0f2011-11-21 13:08:00 +0530227reset_gpios:
228 gpio_set_value_cansleep(haptic->pdata->hap_en_gpio, 0);
229 if (haptic->is_len_gpio_valid == true)
230 gpio_set_value_cansleep(haptic->pdata->hap_len_gpio, 0);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700231 return rc;
232}
233
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530234static int isa1200_reg_power(struct isa1200_chip *haptic, bool on)
235{
236 const struct isa1200_regulator *reg_info =
237 haptic->pdata->regulator_info;
238 u8 i, num_reg = haptic->pdata->num_regulators;
239 int rc;
240
241 for (i = 0; i < num_reg; i++) {
242 rc = regulator_set_optimum_mode(haptic->regs[i],
243 on ? reg_info[i].load_uA : 0);
244 if (rc < 0) {
245 pr_err("%s: regulator_set_optimum_mode failed(%d)\n",
246 __func__, rc);
247 goto regs_fail;
248 }
249
250 rc = on ? regulator_enable(haptic->regs[i]) :
251 regulator_disable(haptic->regs[i]);
252 if (rc < 0) {
253 pr_err("%s: regulator %sable fail %d\n", __func__,
254 on ? "en" : "dis", rc);
255 regulator_set_optimum_mode(haptic->regs[i],
256 !on ? reg_info[i].load_uA : 0);
257 goto regs_fail;
258 }
259 }
260
261 return 0;
262
263regs_fail:
264 while (i--) {
265 regulator_set_optimum_mode(haptic->regs[i],
266 !on ? reg_info[i].load_uA : 0);
267 !on ? regulator_enable(haptic->regs[i]) :
268 regulator_disable(haptic->regs[i]);
269 }
270 return rc;
271}
272
273static int isa1200_reg_setup(struct isa1200_chip *haptic, bool on)
274{
275 const struct isa1200_regulator *reg_info =
276 haptic->pdata->regulator_info;
277 u8 i, num_reg = haptic->pdata->num_regulators;
278 int rc = 0;
279
280 /* put regulators */
281 if (on == false) {
282 i = num_reg;
283 goto put_regs;
284 }
285
286 haptic->regs = kzalloc(num_reg * sizeof(struct regulator *),
287 GFP_KERNEL);
288 if (!haptic->regs) {
289 pr_err("unable to allocate memory\n");
290 return -ENOMEM;
291 }
292
293 for (i = 0; i < num_reg; i++) {
294 haptic->regs[i] = regulator_get(&haptic->client->dev,
295 reg_info[i].name);
296 if (IS_ERR(haptic->regs[i])) {
297 rc = PTR_ERR(haptic->regs[i]);
298 pr_err("%s:regulator get failed(%d)\n", __func__, rc);
299 goto put_regs;
300 }
301
302 if (regulator_count_voltages(haptic->regs[i]) > 0) {
303 rc = regulator_set_voltage(haptic->regs[i],
304 reg_info[i].min_uV, reg_info[i].max_uV);
305 if (rc) {
306 pr_err("%s: regulator_set_voltage failed(%d)\n",
307 __func__, rc);
308 regulator_put(haptic->regs[i]);
309 goto put_regs;
310 }
311 }
312 }
313
314 return rc;
315
316put_regs:
317 while (i--) {
318 if (regulator_count_voltages(haptic->regs[i]) > 0)
319 regulator_set_voltage(haptic->regs[i], 0,
320 reg_info[i].max_uV);
321 regulator_put(haptic->regs[i]);
322 }
323 kfree(haptic->regs);
324 return rc;
325}
326
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327static int __devinit isa1200_probe(struct i2c_client *client,
328 const struct i2c_device_id *id)
329{
330 struct isa1200_chip *haptic;
331 struct isa1200_platform_data *pdata;
332 int ret;
333
334 if (!i2c_check_functionality(client->adapter,
335 I2C_FUNC_SMBUS_BYTE_DATA)) {
336 dev_err(&client->dev, "%s: no support for i2c read/write"
337 "byte data\n", __func__);
338 return -EIO;
339 }
340
341 pdata = client->dev.platform_data;
342 if (!pdata) {
343 dev_err(&client->dev, "%s: no platform data\n", __func__);
344 return -EINVAL;
345 }
346
347 if (pdata->dev_setup) {
348 ret = pdata->dev_setup(true);
349 if (ret < 0) {
350 dev_err(&client->dev, "dev setup failed\n");
351 return -EINVAL;
352 }
353 }
354
355 haptic = kzalloc(sizeof(struct isa1200_chip), GFP_KERNEL);
356 if (!haptic) {
357 ret = -ENOMEM;
358 goto mem_alloc_fail;
359 }
360 haptic->client = client;
361 haptic->enable = 0;
362 haptic->pdata = pdata;
363
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530364 if (pdata->regulator_info) {
365 ret = isa1200_reg_setup(haptic, true);
366 if (ret) {
367 dev_err(&client->dev, "%s: regulator setup failed\n",
368 __func__);
369 goto reg_setup_fail;
370 }
371
372 ret = isa1200_reg_power(haptic, true);
373 if (ret) {
374 dev_err(&client->dev, "%s: regulator power failed\n",
375 __func__);
376 goto reg_pwr_fail;
377 }
378 }
379
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380 if (pdata->power_on) {
381 ret = pdata->power_on(1);
382 if (ret) {
383 dev_err(&client->dev, "%s: power-up failed\n",
384 __func__);
385 goto pwr_up_fail;
386 }
387 }
388
389 spin_lock_init(&haptic->lock);
390 INIT_WORK(&haptic->work, isa1200_chip_work);
391
392 hrtimer_init(&haptic->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
393 haptic->timer.function = isa1200_vib_timer_func;
394
395 /*register with timed output class*/
396 haptic->dev.name = pdata->name;
397 haptic->dev.get_time = isa1200_chip_get_time;
398 haptic->dev.enable = isa1200_chip_enable;
399 ret = timed_output_dev_register(&haptic->dev);
400 if (ret < 0)
401 goto timed_reg_fail;
402
403 i2c_set_clientdata(client, haptic);
404
405 ret = gpio_is_valid(pdata->hap_en_gpio);
406 if (ret) {
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530407 ret = gpio_request(pdata->hap_en_gpio, "haptic_en_gpio");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700408 if (ret) {
409 dev_err(&client->dev, "%s: gpio %d request failed\n",
410 __func__, pdata->hap_en_gpio);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530411 goto hen_gpio_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700412 }
413 } else {
414 dev_err(&client->dev, "%s: Invalid gpio %d\n", __func__,
415 pdata->hap_en_gpio);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530416 goto hen_gpio_fail;
417 }
418
419 haptic->is_len_gpio_valid = true;
420 ret = gpio_is_valid(haptic->pdata->hap_len_gpio);
421 if (ret) {
422 ret = gpio_request(pdata->hap_len_gpio,
423 "haptic_ldo_gpio");
424 if (ret) {
425 dev_err(&client->dev,
426 "%s: gpio %d request failed\n",
427 __func__, pdata->hap_len_gpio);
428 goto len_gpio_fail;
429 }
430 } else {
431 dev_err(&client->dev, "%s: gpio is not used/Invalid %d\n",
432 __func__, pdata->hap_len_gpio);
433 haptic->is_len_gpio_valid = false;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700434 }
435
436 ret = isa1200_setup(client);
437 if (ret) {
438 dev_err(&client->dev, "%s: setup fail %d\n", __func__, ret);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530439 goto setup_fail;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700440 }
441
442 if (haptic->pdata->mode_ctrl == PWM_INPUT_MODE) {
443 haptic->pwm = pwm_request(pdata->pwm_ch_id, id->name);
444 if (IS_ERR(haptic->pwm)) {
445 dev_err(&client->dev, "%s: pwm request failed\n",
446 __func__);
447 ret = PTR_ERR(haptic->pwm);
448 goto reset_hctrl0;
449 }
450 }
451
452 printk(KERN_INFO "%s: %s registered\n", __func__, id->name);
453 return 0;
454
455reset_hctrl0:
Mohan Pallakaacdca0f2011-11-21 13:08:00 +0530456 gpio_set_value_cansleep(haptic->pdata->hap_en_gpio, 0);
457 if (haptic->is_len_gpio_valid == true)
458 gpio_set_value_cansleep(haptic->pdata->hap_len_gpio, 0);
459 i2c_smbus_write_byte_data(client, ISA1200_HCTRL1,
460 ISA1200_HCTRL1_RESET);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700461 i2c_smbus_write_byte_data(client, ISA1200_HCTRL0,
462 ISA1200_HCTRL0_RESET);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530463setup_fail:
464 if (haptic->is_len_gpio_valid == true)
465 gpio_free(pdata->hap_len_gpio);
466len_gpio_fail:
467 gpio_free(pdata->hap_en_gpio);
468hen_gpio_fail:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700469 timed_output_dev_unregister(&haptic->dev);
470timed_reg_fail:
471 if (pdata->power_on)
472 pdata->power_on(0);
473pwr_up_fail:
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530474 if (pdata->regulator_info)
475 isa1200_reg_power(haptic, false);
476reg_pwr_fail:
477 if (pdata->regulator_info)
478 isa1200_reg_setup(haptic, false);
479reg_setup_fail:
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700480 kfree(haptic);
481mem_alloc_fail:
482 if (pdata->dev_setup)
483 pdata->dev_setup(false);
484 return ret;
485}
486
487static int __devexit isa1200_remove(struct i2c_client *client)
488{
489 struct isa1200_chip *haptic = i2c_get_clientdata(client);
490
491 hrtimer_cancel(&haptic->timer);
492 cancel_work_sync(&haptic->work);
493
494 /* turn-off current vibration */
495 isa1200_vib_set(haptic, 0);
496
497 if (haptic->pdata->mode_ctrl == PWM_INPUT_MODE)
498 pwm_free(haptic->pwm);
499
500 timed_output_dev_unregister(&haptic->dev);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530501
Mohan Pallakaacdca0f2011-11-21 13:08:00 +0530502 gpio_set_value_cansleep(haptic->pdata->hap_en_gpio, 0);
503 if (haptic->is_len_gpio_valid == true)
504 gpio_set_value_cansleep(haptic->pdata->hap_len_gpio, 0);
505
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700506 gpio_free(haptic->pdata->hap_en_gpio);
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530507 if (haptic->is_len_gpio_valid == true)
508 gpio_free(haptic->pdata->hap_len_gpio);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700509
510 /* reset hardware registers */
511 i2c_smbus_write_byte_data(client, ISA1200_HCTRL0,
512 ISA1200_HCTRL0_RESET);
513 i2c_smbus_write_byte_data(client, ISA1200_HCTRL1,
514 ISA1200_HCTRL1_RESET);
515
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700516
517 /* power-off the chip */
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530518 if (haptic->pdata->regulator_info) {
519 isa1200_reg_power(haptic, false);
520 isa1200_reg_setup(haptic, false);
521 }
522
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523 if (haptic->pdata->power_on)
524 haptic->pdata->power_on(0);
525
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530526 if (haptic->pdata->dev_setup)
527 haptic->pdata->dev_setup(false);
528
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700529 kfree(haptic);
530 return 0;
531}
532
533#ifdef CONFIG_PM
534static int isa1200_suspend(struct i2c_client *client, pm_message_t mesg)
535{
536 struct isa1200_chip *haptic = i2c_get_clientdata(client);
537 int ret;
538
539 hrtimer_cancel(&haptic->timer);
540 cancel_work_sync(&haptic->work);
541 /* turn-off current vibration */
542 isa1200_vib_set(haptic, 0);
543
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530544 gpio_set_value_cansleep(haptic->pdata->hap_en_gpio, 0);
545 if (haptic->is_len_gpio_valid == true)
546 gpio_set_value_cansleep(haptic->pdata->hap_len_gpio, 0);
547
548 if (haptic->pdata->regulator_info)
549 isa1200_reg_power(haptic, false);
550
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700551 if (haptic->pdata->power_on) {
552 ret = haptic->pdata->power_on(0);
553 if (ret) {
554 dev_err(&client->dev, "power-down failed\n");
555 return ret;
556 }
557 }
558
559 return 0;
560}
561
562static int isa1200_resume(struct i2c_client *client)
563{
564 struct isa1200_chip *haptic = i2c_get_clientdata(client);
565 int ret;
566
Mohan Pallaka73787fa2011-09-09 15:14:20 +0530567 if (haptic->pdata->regulator_info)
568 isa1200_reg_power(haptic, true);
569
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700570 if (haptic->pdata->power_on) {
571 ret = haptic->pdata->power_on(1);
572 if (ret) {
573 dev_err(&client->dev, "power-up failed\n");
574 return ret;
575 }
576 }
577
578 isa1200_setup(client);
579 return 0;
580}
581#else
582#define isa1200_suspend NULL
583#define isa1200_resume NULL
584#endif
585
586static const struct i2c_device_id isa1200_id[] = {
587 { "isa1200_1", 0 },
588 { },
589};
590MODULE_DEVICE_TABLE(i2c, isa1200_id);
591
592static struct i2c_driver isa1200_driver = {
593 .driver = {
594 .name = "isa1200",
595 },
596 .probe = isa1200_probe,
597 .remove = __devexit_p(isa1200_remove),
598 .suspend = isa1200_suspend,
599 .resume = isa1200_resume,
600 .id_table = isa1200_id,
601};
602
603static int __init isa1200_init(void)
604{
605 return i2c_add_driver(&isa1200_driver);
606}
607
608static void __exit isa1200_exit(void)
609{
610 i2c_del_driver(&isa1200_driver);
611}
612
613module_init(isa1200_init);
614module_exit(isa1200_exit);
615
616MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>");
617MODULE_DESCRIPTION("ISA1200 Haptic Motor driver");
618MODULE_LICENSE("GPL");