blob: 6feb0901dfeba0e516cb1c519139f3a5cfcd5cc5 [file] [log] [blame]
Damien.Horsleya9b17a62015-12-08 15:59:00 +00001/*
2 * PCM3168A codec i2c driver
3 *
4 * Copyright (C) 2015 Imagination Technologies Ltd.
5 *
6 * Author: Damien Horsley <Damien.Horsley@imgtec.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 */
12
13#include <linux/i2c.h>
14#include <linux/init.h>
15#include <linux/module.h>
16
17#include <sound/soc.h>
18
19#include "pcm3168a.h"
20
21static int pcm3168a_i2c_probe(struct i2c_client *i2c,
22 const struct i2c_device_id *id)
23{
24 struct regmap *regmap;
25
26 regmap = devm_regmap_init_i2c(i2c, &pcm3168a_regmap);
27 if (IS_ERR(regmap))
28 return PTR_ERR(regmap);
29
30 return pcm3168a_probe(&i2c->dev, regmap);
31}
32
33static int pcm3168a_i2c_remove(struct i2c_client *i2c)
34{
35 pcm3168a_remove(&i2c->dev);
36
37 return 0;
38}
39
40static const struct i2c_device_id pcm3168a_i2c_id[] = {
41 { "pcm3168a", },
42 { }
43};
44MODULE_DEVICE_TABLE(i2c, pcm3168a_i2c_id);
45
46static const struct of_device_id pcm3168a_of_match[] = {
47 { .compatible = "ti,pcm3168a", },
48 { }
49};
50MODULE_DEVICE_TABLE(of, pcm3168a_of_match);
51
52static struct i2c_driver pcm3168a_i2c_driver = {
53 .probe = pcm3168a_i2c_probe,
54 .remove = pcm3168a_i2c_remove,
55 .id_table = pcm3168a_i2c_id,
56 .driver = {
57 .name = "pcm3168a",
58 .of_match_table = pcm3168a_of_match,
59 .pm = &pcm3168a_pm_ops,
60 },
61};
62module_i2c_driver(pcm3168a_i2c_driver);
63
64MODULE_DESCRIPTION("PCM3168A I2C codec driver");
65MODULE_AUTHOR("Damien Horsley <Damien.Horsley@imgtec.com>");
66MODULE_LICENSE("GPL v2");