1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2bbed297dSCharles Keepax /*
3bbed297dSCharles Keepax * wm8804-i2c.c -- WM8804 S/PDIF transceiver driver - I2C
4bbed297dSCharles Keepax *
5bbed297dSCharles Keepax * Copyright 2015 Cirrus Logic Inc
6bbed297dSCharles Keepax *
7bbed297dSCharles Keepax * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
8bbed297dSCharles Keepax */
9bbed297dSCharles Keepax
10bbed297dSCharles Keepax #include <linux/init.h>
11bbed297dSCharles Keepax #include <linux/module.h>
12bbed297dSCharles Keepax #include <linux/i2c.h>
13960cdd50SPierre-Louis Bossart #include <linux/acpi.h>
14bbed297dSCharles Keepax
15bbed297dSCharles Keepax #include "wm8804.h"
16bbed297dSCharles Keepax
wm8804_i2c_probe(struct i2c_client * i2c)1797b0b6e3SStephen Kitt static int wm8804_i2c_probe(struct i2c_client *i2c)
18bbed297dSCharles Keepax {
19bbed297dSCharles Keepax struct regmap *regmap;
20bbed297dSCharles Keepax
21bbed297dSCharles Keepax regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config);
22bbed297dSCharles Keepax if (IS_ERR(regmap))
23bbed297dSCharles Keepax return PTR_ERR(regmap);
24bbed297dSCharles Keepax
25bbed297dSCharles Keepax return wm8804_probe(&i2c->dev, regmap);
26bbed297dSCharles Keepax }
27bbed297dSCharles Keepax
wm8804_i2c_remove(struct i2c_client * i2c)28ed5c2f5fSUwe Kleine-König static void wm8804_i2c_remove(struct i2c_client *i2c)
29bbed297dSCharles Keepax {
30bbed297dSCharles Keepax wm8804_remove(&i2c->dev);
31bbed297dSCharles Keepax }
32bbed297dSCharles Keepax
33bbed297dSCharles Keepax static const struct i2c_device_id wm8804_i2c_id[] = {
34bbed297dSCharles Keepax { "wm8804", 0 },
35bbed297dSCharles Keepax { }
36bbed297dSCharles Keepax };
37bbed297dSCharles Keepax MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id);
38bbed297dSCharles Keepax
39960cdd50SPierre-Louis Bossart #if defined(CONFIG_OF)
40bbed297dSCharles Keepax static const struct of_device_id wm8804_of_match[] = {
41bbed297dSCharles Keepax { .compatible = "wlf,wm8804", },
42bbed297dSCharles Keepax { }
43bbed297dSCharles Keepax };
44bbed297dSCharles Keepax MODULE_DEVICE_TABLE(of, wm8804_of_match);
45960cdd50SPierre-Louis Bossart #endif
46960cdd50SPierre-Louis Bossart
47960cdd50SPierre-Louis Bossart #ifdef CONFIG_ACPI
48960cdd50SPierre-Louis Bossart static const struct acpi_device_id wm8804_acpi_match[] = {
49960cdd50SPierre-Louis Bossart { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */
50960cdd50SPierre-Louis Bossart { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */
51960cdd50SPierre-Louis Bossart { },
52960cdd50SPierre-Louis Bossart };
53960cdd50SPierre-Louis Bossart MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match);
54960cdd50SPierre-Louis Bossart #endif
55bbed297dSCharles Keepax
56bbed297dSCharles Keepax static struct i2c_driver wm8804_i2c_driver = {
57bbed297dSCharles Keepax .driver = {
58bbed297dSCharles Keepax .name = "wm8804",
591a60667fSCharles Keepax .pm = &wm8804_pm,
60960cdd50SPierre-Louis Bossart .of_match_table = of_match_ptr(wm8804_of_match),
61960cdd50SPierre-Louis Bossart .acpi_match_table = ACPI_PTR(wm8804_acpi_match),
62bbed297dSCharles Keepax },
63*9abcd240SUwe Kleine-König .probe = wm8804_i2c_probe,
64bbed297dSCharles Keepax .remove = wm8804_i2c_remove,
65bbed297dSCharles Keepax .id_table = wm8804_i2c_id
66bbed297dSCharles Keepax };
67bbed297dSCharles Keepax
68bbed297dSCharles Keepax module_i2c_driver(wm8804_i2c_driver);
69bbed297dSCharles Keepax
70bbed297dSCharles Keepax MODULE_DESCRIPTION("ASoC WM8804 driver - I2C");
71bbed297dSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
72bbed297dSCharles Keepax MODULE_LICENSE("GPL");
73