blob: c8fce37e5cfa0655f6074d9526e3eb1a0057120b [file] [log] [blame]
Thomas Gleixnerfda8d262019-05-28 09:57:06 -07001// SPDX-License-Identifier: GPL-2.0-only
Lars-Peter Clausendab464b2014-05-27 10:53:18 +02002/*
Andreas Ireståld6dde632016-02-16 13:56:42 +01003 * Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961 codec
Lars-Peter Clausendab464b2014-05-27 10:53:18 +02004 *
5 * Copyright 2014 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
Lars-Peter Clausendab464b2014-05-27 10:53:18 +02007 */
8
9#include <linux/i2c.h>
10#include <linux/mod_devicetable.h>
11#include <linux/module.h>
12#include <linux/regmap.h>
13#include <sound/soc.h>
14
15#include "adau1761.h"
16
17static int adau1761_i2c_probe(struct i2c_client *client,
18 const struct i2c_device_id *id)
19{
20 struct regmap_config config;
21
22 config = adau1761_regmap_config;
23 config.val_bits = 8;
24 config.reg_bits = 16;
25
26 return adau1761_probe(&client->dev,
27 devm_regmap_init_i2c(client, &config),
28 id->driver_data, NULL);
29}
30
31static int adau1761_i2c_remove(struct i2c_client *client)
32{
Lars-Peter Clausen5d76de62016-06-15 15:07:27 +020033 adau17x1_remove(&client->dev);
Lars-Peter Clausendab464b2014-05-27 10:53:18 +020034 return 0;
35}
36
37static const struct i2c_device_id adau1761_i2c_ids[] = {
38 { "adau1361", ADAU1361 },
39 { "adau1461", ADAU1761 },
40 { "adau1761", ADAU1761 },
41 { "adau1961", ADAU1361 },
42 { }
43};
44MODULE_DEVICE_TABLE(i2c, adau1761_i2c_ids);
45
Andreas Irestålaaf0f3a2016-02-16 13:56:44 +010046#if defined(CONFIG_OF)
47static const struct of_device_id adau1761_i2c_dt_ids[] = {
48 { .compatible = "adi,adau1361", },
49 { .compatible = "adi,adau1461", },
50 { .compatible = "adi,adau1761", },
51 { .compatible = "adi,adau1961", },
52 { },
53};
54MODULE_DEVICE_TABLE(of, adau1761_i2c_dt_ids);
55#endif
56
Lars-Peter Clausendab464b2014-05-27 10:53:18 +020057static struct i2c_driver adau1761_i2c_driver = {
58 .driver = {
59 .name = "adau1761",
Andreas Irestålaaf0f3a2016-02-16 13:56:44 +010060 .of_match_table = of_match_ptr(adau1761_i2c_dt_ids),
Lars-Peter Clausendab464b2014-05-27 10:53:18 +020061 },
62 .probe = adau1761_i2c_probe,
63 .remove = adau1761_i2c_remove,
64 .id_table = adau1761_i2c_ids,
65};
66module_i2c_driver(adau1761_i2c_driver);
67
68MODULE_DESCRIPTION("ASoC ADAU1361/ADAU1461/ADAU1761/ADAU1961 CODEC I2C driver");
69MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
70MODULE_LICENSE("GPL");