xref: /linux/sound/hda/codecs/side-codecs/aw88399_hda_i2c.c (revision e5c91aac491def6ab3f90c4cc246e3fcb0f8f058)
1 // SPDX-License-Identifier: GPL-2.0-only
2 //
3 // AW88399 HDA I2C driver
4 //
5 // Based on cs35l41_hda_i2c.c
6 //
7 
8 #include <linux/i2c.h>
9 #include <linux/module.h>
10 #include <linux/regmap.h>
11 
12 #include "aw88399_hda.h"
13 
14 static int aw88399_hda_i2c_probe(struct i2c_client *clt)
15 {
16 	if (!strstr(dev_name(&clt->dev), "AWDZ8399"))
17 		return -ENODEV;
18 
19 	return aw88399_hda_probe(&clt->dev,
20 				 devm_regmap_init_i2c(clt, &aw88399_remap_config));
21 }
22 
23 static void aw88399_hda_i2c_remove(struct i2c_client *clt)
24 {
25 	aw88399_hda_remove(&clt->dev);
26 }
27 
28 static const struct i2c_device_id aw88399_hda_i2c_id[] = {
29 	{ .name = "aw88399-hda" },
30 	{ }
31 };
32 
33 static const struct acpi_device_id aw88399_acpi_hda_match[] = {
34 	{ "AWDZ8399", 0 },
35 	{ }
36 };
37 MODULE_DEVICE_TABLE(acpi, aw88399_acpi_hda_match);
38 
39 static struct i2c_driver aw88399_hda_i2c_driver = {
40 	.driver = {
41 		.name		= "aw88399-hda",
42 		.acpi_match_table = aw88399_acpi_hda_match,
43 		.pm		= &aw88399_hda_pm_ops,
44 	},
45 	.probe		= aw88399_hda_i2c_probe,
46 	.remove		= aw88399_hda_i2c_remove,
47 	.id_table	= aw88399_hda_i2c_id,
48 };
49 module_i2c_driver(aw88399_hda_i2c_driver);
50 
51 MODULE_DESCRIPTION("HDA AW88399 I2C driver");
52 MODULE_IMPORT_NS("SND_HDA_SCODEC_AW88399");
53 MODULE_AUTHOR("Yakov Till <yakov.till@gmail.com>");
54 MODULE_LICENSE("GPL");
55