diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/mfd/aat2870-core.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/mfd/aat2870-core.c')
-rw-r--r-- | drivers/mfd/aat2870-core.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index f1beb4971f8..e7a4e2ab6cd 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c | |||
@@ -79,27 +79,22 @@ static struct mfd_cell aat2870_devs[] = { | |||
79 | { | 79 | { |
80 | .name = "aat2870-backlight", | 80 | .name = "aat2870-backlight", |
81 | .id = AAT2870_ID_BL, | 81 | .id = AAT2870_ID_BL, |
82 | .pdata_size = sizeof(struct aat2870_bl_platform_data), | ||
83 | }, | 82 | }, |
84 | { | 83 | { |
85 | .name = "aat2870-regulator", | 84 | .name = "aat2870-regulator", |
86 | .id = AAT2870_ID_LDOA, | 85 | .id = AAT2870_ID_LDOA, |
87 | .pdata_size = sizeof(struct regulator_init_data), | ||
88 | }, | 86 | }, |
89 | { | 87 | { |
90 | .name = "aat2870-regulator", | 88 | .name = "aat2870-regulator", |
91 | .id = AAT2870_ID_LDOB, | 89 | .id = AAT2870_ID_LDOB, |
92 | .pdata_size = sizeof(struct regulator_init_data), | ||
93 | }, | 90 | }, |
94 | { | 91 | { |
95 | .name = "aat2870-regulator", | 92 | .name = "aat2870-regulator", |
96 | .id = AAT2870_ID_LDOC, | 93 | .id = AAT2870_ID_LDOC, |
97 | .pdata_size = sizeof(struct regulator_init_data), | ||
98 | }, | 94 | }, |
99 | { | 95 | { |
100 | .name = "aat2870-regulator", | 96 | .name = "aat2870-regulator", |
101 | .id = AAT2870_ID_LDOD, | 97 | .id = AAT2870_ID_LDOD, |
102 | .pdata_size = sizeof(struct regulator_init_data), | ||
103 | }, | 98 | }, |
104 | }; | 99 | }; |
105 | 100 | ||
@@ -262,6 +257,13 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf) | |||
262 | return count; | 257 | return count; |
263 | } | 258 | } |
264 | 259 | ||
260 | static int aat2870_reg_open_file(struct inode *inode, struct file *file) | ||
261 | { | ||
262 | file->private_data = inode->i_private; | ||
263 | |||
264 | return 0; | ||
265 | } | ||
266 | |||
265 | static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, | 267 | static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, |
266 | size_t count, loff_t *ppos) | 268 | size_t count, loff_t *ppos) |
267 | { | 269 | { |
@@ -288,7 +290,7 @@ static ssize_t aat2870_reg_write_file(struct file *file, | |||
288 | { | 290 | { |
289 | struct aat2870_data *aat2870 = file->private_data; | 291 | struct aat2870_data *aat2870 = file->private_data; |
290 | char buf[32]; | 292 | char buf[32]; |
291 | ssize_t buf_size; | 293 | int buf_size; |
292 | char *start = buf; | 294 | char *start = buf; |
293 | unsigned long addr, val; | 295 | unsigned long addr, val; |
294 | int ret; | 296 | int ret; |
@@ -323,7 +325,7 @@ static ssize_t aat2870_reg_write_file(struct file *file, | |||
323 | } | 325 | } |
324 | 326 | ||
325 | static const struct file_operations aat2870_reg_fops = { | 327 | static const struct file_operations aat2870_reg_fops = { |
326 | .open = simple_open, | 328 | .open = aat2870_reg_open_file, |
327 | .read = aat2870_reg_read_file, | 329 | .read = aat2870_reg_read_file, |
328 | .write = aat2870_reg_write_file, | 330 | .write = aat2870_reg_write_file, |
329 | }; | 331 | }; |
@@ -400,13 +402,13 @@ static int aat2870_i2c_probe(struct i2c_client *client, | |||
400 | aat2870->init(aat2870); | 402 | aat2870->init(aat2870); |
401 | 403 | ||
402 | if (aat2870->en_pin >= 0) { | 404 | if (aat2870->en_pin >= 0) { |
403 | ret = gpio_request_one(aat2870->en_pin, GPIOF_OUT_INIT_HIGH, | 405 | ret = gpio_request(aat2870->en_pin, "aat2870-en"); |
404 | "aat2870-en"); | ||
405 | if (ret < 0) { | 406 | if (ret < 0) { |
406 | dev_err(&client->dev, | 407 | dev_err(&client->dev, |
407 | "Failed to request GPIO %d\n", aat2870->en_pin); | 408 | "Failed to request GPIO %d\n", aat2870->en_pin); |
408 | goto out_kfree; | 409 | goto out_kfree; |
409 | } | 410 | } |
411 | gpio_direction_output(aat2870->en_pin, 1); | ||
410 | } | 412 | } |
411 | 413 | ||
412 | aat2870_enable(aat2870); | 414 | aat2870_enable(aat2870); |
@@ -416,7 +418,7 @@ static int aat2870_i2c_probe(struct i2c_client *client, | |||
416 | if ((pdata->subdevs[i].id == aat2870_devs[j].id) && | 418 | if ((pdata->subdevs[i].id == aat2870_devs[j].id) && |
417 | !strcmp(pdata->subdevs[i].name, | 419 | !strcmp(pdata->subdevs[i].name, |
418 | aat2870_devs[j].name)) { | 420 | aat2870_devs[j].name)) { |
419 | aat2870_devs[j].platform_data = | 421 | aat2870_devs[j].mfd_data = |
420 | pdata->subdevs[i].platform_data; | 422 | pdata->subdevs[i].platform_data; |
421 | break; | 423 | break; |
422 | } | 424 | } |
@@ -424,7 +426,7 @@ static int aat2870_i2c_probe(struct i2c_client *client, | |||
424 | } | 426 | } |
425 | 427 | ||
426 | ret = mfd_add_devices(aat2870->dev, 0, aat2870_devs, | 428 | ret = mfd_add_devices(aat2870->dev, 0, aat2870_devs, |
427 | ARRAY_SIZE(aat2870_devs), NULL, 0, NULL); | 429 | ARRAY_SIZE(aat2870_devs), NULL, 0); |
428 | if (ret != 0) { | 430 | if (ret != 0) { |
429 | dev_err(aat2870->dev, "Failed to add subdev: %d\n", ret); | 431 | dev_err(aat2870->dev, "Failed to add subdev: %d\n", ret); |
430 | goto out_disable; | 432 | goto out_disable; |
@@ -461,10 +463,9 @@ static int aat2870_i2c_remove(struct i2c_client *client) | |||
461 | return 0; | 463 | return 0; |
462 | } | 464 | } |
463 | 465 | ||
464 | #ifdef CONFIG_PM_SLEEP | 466 | #ifdef CONFIG_PM |
465 | static int aat2870_i2c_suspend(struct device *dev) | 467 | static int aat2870_i2c_suspend(struct i2c_client *client, pm_message_t state) |
466 | { | 468 | { |
467 | struct i2c_client *client = to_i2c_client(dev); | ||
468 | struct aat2870_data *aat2870 = i2c_get_clientdata(client); | 469 | struct aat2870_data *aat2870 = i2c_get_clientdata(client); |
469 | 470 | ||
470 | aat2870_disable(aat2870); | 471 | aat2870_disable(aat2870); |
@@ -472,9 +473,8 @@ static int aat2870_i2c_suspend(struct device *dev) | |||
472 | return 0; | 473 | return 0; |
473 | } | 474 | } |
474 | 475 | ||
475 | static int aat2870_i2c_resume(struct device *dev) | 476 | static int aat2870_i2c_resume(struct i2c_client *client) |
476 | { | 477 | { |
477 | struct i2c_client *client = to_i2c_client(dev); | ||
478 | struct aat2870_data *aat2870 = i2c_get_clientdata(client); | 478 | struct aat2870_data *aat2870 = i2c_get_clientdata(client); |
479 | struct aat2870_register *reg = NULL; | 479 | struct aat2870_register *reg = NULL; |
480 | int i; | 480 | int i; |
@@ -490,12 +490,12 @@ static int aat2870_i2c_resume(struct device *dev) | |||
490 | 490 | ||
491 | return 0; | 491 | return 0; |
492 | } | 492 | } |
493 | #endif /* CONFIG_PM_SLEEP */ | 493 | #else |
494 | 494 | #define aat2870_i2c_suspend NULL | |
495 | static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, | 495 | #define aat2870_i2c_resume NULL |
496 | aat2870_i2c_resume); | 496 | #endif /* CONFIG_PM */ |
497 | 497 | ||
498 | static const struct i2c_device_id aat2870_i2c_id_table[] = { | 498 | static struct i2c_device_id aat2870_i2c_id_table[] = { |
499 | { "aat2870", 0 }, | 499 | { "aat2870", 0 }, |
500 | { } | 500 | { } |
501 | }; | 501 | }; |
@@ -505,10 +505,11 @@ static struct i2c_driver aat2870_i2c_driver = { | |||
505 | .driver = { | 505 | .driver = { |
506 | .name = "aat2870", | 506 | .name = "aat2870", |
507 | .owner = THIS_MODULE, | 507 | .owner = THIS_MODULE, |
508 | .pm = &aat2870_pm_ops, | ||
509 | }, | 508 | }, |
510 | .probe = aat2870_i2c_probe, | 509 | .probe = aat2870_i2c_probe, |
511 | .remove = aat2870_i2c_remove, | 510 | .remove = aat2870_i2c_remove, |
511 | .suspend = aat2870_i2c_suspend, | ||
512 | .resume = aat2870_i2c_resume, | ||
512 | .id_table = aat2870_i2c_id_table, | 513 | .id_table = aat2870_i2c_id_table, |
513 | }; | 514 | }; |
514 | 515 | ||