Commit | Line | Data |
---|---|---|
b3fc5725 MF |
1 | /* |
2 | * ALSA SoC TLV320AIC23 codec driver I2C interface | |
3 | * | |
4 | * Author: Arun KS, <arunks@mistralsolutions.com> | |
5 | * Copyright: (C) 2008 Mistral Solutions Pvt Ltd., | |
6 | * | |
7 | * Based on sound/soc/codecs/wm8731.c by Richard Purdie | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License version 2 as | |
11 | * published by the Free Software Foundation. | |
12 | */ | |
13 | ||
14 | #include <linux/i2c.h> | |
15 | #include <linux/module.h> | |
16 | #include <linux/regmap.h> | |
17 | #include <sound/soc.h> | |
18 | ||
19 | #include "tlv320aic23.h" | |
20 | ||
21 | static int tlv320aic23_i2c_probe(struct i2c_client *i2c, | |
22 | const struct i2c_device_id *i2c_id) | |
23 | { | |
24 | struct regmap *regmap; | |
25 | ||
26 | if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) | |
27 | return -EINVAL; | |
28 | ||
29 | regmap = devm_regmap_init_i2c(i2c, &tlv320aic23_regmap); | |
30 | return tlv320aic23_probe(&i2c->dev, regmap); | |
31 | } | |
32 | ||
33 | static int __exit tlv320aic23_i2c_remove(struct i2c_client *i2c) | |
34 | { | |
35 | snd_soc_unregister_codec(&i2c->dev); | |
36 | return 0; | |
37 | } | |
38 | ||
39 | static const struct i2c_device_id tlv320aic23_id[] = { | |
40 | {"tlv320aic23", 0}, | |
41 | {} | |
42 | }; | |
43 | ||
44 | MODULE_DEVICE_TABLE(i2c, tlv320aic23_id); | |
45 | ||
3534b842 SW |
46 | static const struct of_device_id tlv320aic23_of_match[] = { |
47 | { .compatible = "ti,tlv320aic23", }, | |
48 | { } | |
49 | }; | |
50 | MODULE_DEVICE_TABLE(of, tlv320aic23_of_match); | |
51 | ||
b3fc5725 MF |
52 | static struct i2c_driver tlv320aic23_i2c_driver = { |
53 | .driver = { | |
54 | .name = "tlv320aic23-codec", | |
3534b842 | 55 | .of_match_table = of_match_ptr(tlv320aic23_of_match), |
b3fc5725 MF |
56 | }, |
57 | .probe = tlv320aic23_i2c_probe, | |
58 | .remove = __exit_p(tlv320aic23_i2c_remove), | |
59 | .id_table = tlv320aic23_id, | |
60 | }; | |
61 | ||
62 | module_i2c_driver(tlv320aic23_i2c_driver); | |
63 | ||
64 | MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver I2C"); | |
65 | MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>"); | |
66 | MODULE_LICENSE("GPL"); |