0001
0002
0003
0004
0005
0006 #include <linux/clk.h>
0007 #include <linux/delay.h>
0008 #include <linux/i2c.h>
0009 #include <linux/module.h>
0010 #include <linux/of.h>
0011 #include <linux/regmap.h>
0012
0013 #include "pcm1789.h"
0014
0015 static int pcm1789_i2c_probe(struct i2c_client *client)
0016 {
0017 struct regmap *regmap;
0018 int ret;
0019
0020 regmap = devm_regmap_init_i2c(client, &pcm1789_regmap_config);
0021 if (IS_ERR(regmap)) {
0022 ret = PTR_ERR(regmap);
0023 dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret);
0024 return ret;
0025 }
0026
0027 return pcm1789_common_init(&client->dev, regmap);
0028 }
0029
0030 static int pcm1789_i2c_remove(struct i2c_client *client)
0031 {
0032 pcm1789_common_exit(&client->dev);
0033
0034 return 0;
0035 }
0036
0037 #ifdef CONFIG_OF
0038 static const struct of_device_id pcm1789_of_match[] = {
0039 { .compatible = "ti,pcm1789", },
0040 { }
0041 };
0042 MODULE_DEVICE_TABLE(of, pcm1789_of_match);
0043 #endif
0044
0045 static const struct i2c_device_id pcm1789_i2c_ids[] = {
0046 { "pcm1789", 0 },
0047 { }
0048 };
0049 MODULE_DEVICE_TABLE(i2c, pcm1789_i2c_ids);
0050
0051 static struct i2c_driver pcm1789_i2c_driver = {
0052 .driver = {
0053 .name = "pcm1789",
0054 .of_match_table = of_match_ptr(pcm1789_of_match),
0055 },
0056 .id_table = pcm1789_i2c_ids,
0057 .probe_new = pcm1789_i2c_probe,
0058 .remove = pcm1789_i2c_remove,
0059 };
0060
0061 module_i2c_driver(pcm1789_i2c_driver);
0062
0063 MODULE_DESCRIPTION("ASoC PCM1789 I2C driver");
0064 MODULE_AUTHOR("Mylène Josserand <mylene.josserand@bootlin.com>");
0065 MODULE_LICENSE("GPL");