xref: /linux/sound/soc/codecs/pcm3168a-i2c.c (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * PCM3168A codec i2c driver
4  *
5  * Copyright (C) 2015 Imagination Technologies Ltd.
6  *
7  * Author: Damien Horsley <Damien.Horsley@imgtec.com>
8  */
9 
10 #include <linux/i2c.h>
11 #include <linux/init.h>
12 #include <linux/module.h>
13 
14 #include <sound/soc.h>
15 
16 #include "pcm3168a.h"
17 
18 static int pcm3168a_i2c_probe(struct i2c_client *i2c)
19 {
20 	struct regmap *regmap;
21 
22 	regmap = devm_regmap_init_i2c(i2c, &pcm3168a_regmap);
23 	if (IS_ERR(regmap))
24 		return PTR_ERR(regmap);
25 
26 	return pcm3168a_probe(&i2c->dev, regmap);
27 }
28 
29 static void pcm3168a_i2c_remove(struct i2c_client *i2c)
30 {
31 	pcm3168a_remove(&i2c->dev);
32 }
33 
34 static const struct i2c_device_id pcm3168a_i2c_id[] = {
35 	{ "pcm3168a", },
36 	{ }
37 };
38 MODULE_DEVICE_TABLE(i2c, pcm3168a_i2c_id);
39 
40 static const struct of_device_id pcm3168a_of_match[] = {
41 	{ .compatible = "ti,pcm3168a", },
42 	{ }
43 };
44 MODULE_DEVICE_TABLE(of, pcm3168a_of_match);
45 
46 static struct i2c_driver pcm3168a_i2c_driver = {
47 	.probe		= pcm3168a_i2c_probe,
48 	.remove		= pcm3168a_i2c_remove,
49 	.id_table	= pcm3168a_i2c_id,
50 	.driver		= {
51 		.name	= "pcm3168a",
52 		.of_match_table = pcm3168a_of_match,
53 		.pm		= &pcm3168a_pm_ops,
54 	},
55 };
56 module_i2c_driver(pcm3168a_i2c_driver);
57 
58 MODULE_DESCRIPTION("PCM3168A I2C codec driver");
59 MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
60 MODULE_LICENSE("GPL v2");
61