blob: b9551334f6b4e10066e8af87283888c9300d05e2 [file] [log] [blame]
Lars-Peter Clausen6c3d7132014-02-17 13:16:54 +01001/*
2 * AD1936/AD1937 audio driver
3 *
4 * Copyright 2014 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2.
7 */
8
9#include <linux/module.h>
10#include <linux/i2c.h>
11#include <linux/regmap.h>
12
13#include <sound/soc.h>
14
15#include "ad193x.h"
16
17static const struct i2c_device_id ad193x_id[] = {
Cyrille Pitchene5224f52015-09-29 16:41:43 +020018 { "ad1936", AD193X },
19 { "ad1937", AD193X },
Lars-Peter Clausen6c3d7132014-02-17 13:16:54 +010020 { }
21};
22MODULE_DEVICE_TABLE(i2c, ad193x_id);
23
24static int ad193x_i2c_probe(struct i2c_client *client,
25 const struct i2c_device_id *id)
26{
27 struct regmap_config config;
28
29 config = ad193x_regmap_config;
30 config.val_bits = 8;
31 config.reg_bits = 8;
32
Cyrille Pitchene5224f52015-09-29 16:41:43 +020033 return ad193x_probe(&client->dev,
34 devm_regmap_init_i2c(client, &config),
35 (enum ad193x_type)id->driver_data);
Lars-Peter Clausen6c3d7132014-02-17 13:16:54 +010036}
37
Lars-Peter Clausen6c3d7132014-02-17 13:16:54 +010038static struct i2c_driver ad193x_i2c_driver = {
39 .driver = {
40 .name = "ad193x",
41 },
42 .probe = ad193x_i2c_probe,
Lars-Peter Clausen6c3d7132014-02-17 13:16:54 +010043 .id_table = ad193x_id,
44};
45module_i2c_driver(ad193x_i2c_driver);
46
47MODULE_DESCRIPTION("ASoC AD1936/AD1937 audio CODEC driver");
48MODULE_AUTHOR("Barry Song <21cnbao@gmail.com>");
49MODULE_LICENSE("GPL");