0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/module.h>
0011 #include <linux/of.h>
0012 #include <linux/i2c.h>
0013 #include <linux/regmap.h>
0014
0015 #include "pcm179x.h"
0016
0017 static int pcm179x_i2c_probe(struct i2c_client *client)
0018 {
0019 struct regmap *regmap;
0020 int ret;
0021
0022 regmap = devm_regmap_init_i2c(client, &pcm179x_regmap_config);
0023 if (IS_ERR(regmap)) {
0024 ret = PTR_ERR(regmap);
0025 dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret);
0026 return ret;
0027 }
0028
0029 return pcm179x_common_init(&client->dev, regmap);
0030 }
0031
0032 #ifdef CONFIG_OF
0033 static const struct of_device_id pcm179x_of_match[] = {
0034 { .compatible = "ti,pcm1792a", },
0035 { }
0036 };
0037 MODULE_DEVICE_TABLE(of, pcm179x_of_match);
0038 #endif
0039
0040 static const struct i2c_device_id pcm179x_i2c_ids[] = {
0041 { "pcm179x", 0 },
0042 { }
0043 };
0044 MODULE_DEVICE_TABLE(i2c, pcm179x_i2c_ids);
0045
0046 static struct i2c_driver pcm179x_i2c_driver = {
0047 .driver = {
0048 .name = "pcm179x",
0049 .of_match_table = of_match_ptr(pcm179x_of_match),
0050 },
0051 .id_table = pcm179x_i2c_ids,
0052 .probe_new = pcm179x_i2c_probe,
0053 };
0054
0055 module_i2c_driver(pcm179x_i2c_driver);
0056
0057 MODULE_DESCRIPTION("ASoC PCM179X I2C driver");
0058 MODULE_AUTHOR("Jacob Siverskog <jacob@teenage.engineering>");
0059 MODULE_LICENSE("GPL");