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 17*97b0b6e3SStephen 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 28bbed297dSCharles Keepax static int wm8804_i2c_remove(struct i2c_client *i2c) 29bbed297dSCharles Keepax { 30bbed297dSCharles Keepax wm8804_remove(&i2c->dev); 31bbed297dSCharles Keepax return 0; 32bbed297dSCharles Keepax } 33bbed297dSCharles Keepax 34bbed297dSCharles Keepax static const struct i2c_device_id wm8804_i2c_id[] = { 35bbed297dSCharles Keepax { "wm8804", 0 }, 36bbed297dSCharles Keepax { } 37bbed297dSCharles Keepax }; 38bbed297dSCharles Keepax MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); 39bbed297dSCharles Keepax 40960cdd50SPierre-Louis Bossart #if defined(CONFIG_OF) 41bbed297dSCharles Keepax static const struct of_device_id wm8804_of_match[] = { 42bbed297dSCharles Keepax { .compatible = "wlf,wm8804", }, 43bbed297dSCharles Keepax { } 44bbed297dSCharles Keepax }; 45bbed297dSCharles Keepax MODULE_DEVICE_TABLE(of, wm8804_of_match); 46960cdd50SPierre-Louis Bossart #endif 47960cdd50SPierre-Louis Bossart 48960cdd50SPierre-Louis Bossart #ifdef CONFIG_ACPI 49960cdd50SPierre-Louis Bossart static const struct acpi_device_id wm8804_acpi_match[] = { 50960cdd50SPierre-Louis Bossart { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */ 51960cdd50SPierre-Louis Bossart { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */ 52960cdd50SPierre-Louis Bossart { }, 53960cdd50SPierre-Louis Bossart }; 54960cdd50SPierre-Louis Bossart MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match); 55960cdd50SPierre-Louis Bossart #endif 56bbed297dSCharles Keepax 57bbed297dSCharles Keepax static struct i2c_driver wm8804_i2c_driver = { 58bbed297dSCharles Keepax .driver = { 59bbed297dSCharles Keepax .name = "wm8804", 601a60667fSCharles Keepax .pm = &wm8804_pm, 61960cdd50SPierre-Louis Bossart .of_match_table = of_match_ptr(wm8804_of_match), 62960cdd50SPierre-Louis Bossart .acpi_match_table = ACPI_PTR(wm8804_acpi_match), 63bbed297dSCharles Keepax }, 64*97b0b6e3SStephen Kitt .probe_new = wm8804_i2c_probe, 65bbed297dSCharles Keepax .remove = wm8804_i2c_remove, 66bbed297dSCharles Keepax .id_table = wm8804_i2c_id 67bbed297dSCharles Keepax }; 68bbed297dSCharles Keepax 69bbed297dSCharles Keepax module_i2c_driver(wm8804_i2c_driver); 70bbed297dSCharles Keepax 71bbed297dSCharles Keepax MODULE_DESCRIPTION("ASoC WM8804 driver - I2C"); 72bbed297dSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>"); 73bbed297dSCharles Keepax MODULE_LICENSE("GPL"); 74