xref: /openbmc/linux/sound/soc/codecs/ssm2602-i2c.c (revision 93f5715e)
1 /*
2  * SSM2602/SSM2603/SSM2604 I2C 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 "ssm2602.h"
16 
17 /*
18  * ssm2602 2 wire address is determined by GPIO5
19  * state during powerup.
20  *    low  = 0x1a
21  *    high = 0x1b
22  */
23 static int ssm2602_i2c_probe(struct i2c_client *client,
24 			     const struct i2c_device_id *id)
25 {
26 	return ssm2602_probe(&client->dev, id->driver_data,
27 		devm_regmap_init_i2c(client, &ssm2602_regmap_config));
28 }
29 
30 static const struct i2c_device_id ssm2602_i2c_id[] = {
31 	{ "ssm2602", SSM2602 },
32 	{ "ssm2603", SSM2602 },
33 	{ "ssm2604", SSM2604 },
34 	{ }
35 };
36 MODULE_DEVICE_TABLE(i2c, ssm2602_i2c_id);
37 
38 static const struct of_device_id ssm2602_of_match[] = {
39 	{ .compatible = "adi,ssm2602", },
40 	{ .compatible = "adi,ssm2603", },
41 	{ .compatible = "adi,ssm2604", },
42 	{ }
43 };
44 MODULE_DEVICE_TABLE(of, ssm2602_of_match);
45 
46 static struct i2c_driver ssm2602_i2c_driver = {
47 	.driver = {
48 		.name = "ssm2602",
49 		.of_match_table = ssm2602_of_match,
50 	},
51 	.probe = ssm2602_i2c_probe,
52 	.id_table = ssm2602_i2c_id,
53 };
54 module_i2c_driver(ssm2602_i2c_driver);
55 
56 MODULE_DESCRIPTION("ASoC SSM2602/SSM2603/SSM2604 I2C driver");
57 MODULE_AUTHOR("Cliff Cai");
58 MODULE_LICENSE("GPL");
59