1bbed297dSCharles Keepax /* 2bbed297dSCharles Keepax * wm8804-i2c.c -- WM8804 S/PDIF transceiver driver - I2C 3bbed297dSCharles Keepax * 4bbed297dSCharles Keepax * Copyright 2015 Cirrus Logic Inc 5bbed297dSCharles Keepax * 6bbed297dSCharles Keepax * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> 7bbed297dSCharles Keepax * 8bbed297dSCharles Keepax * This program is free software; you can redistribute it and/or modify 9bbed297dSCharles Keepax * it under the terms of the GNU General Public License version 2 as 10bbed297dSCharles Keepax * published by the Free Software Foundation. 11bbed297dSCharles Keepax */ 12bbed297dSCharles Keepax 13bbed297dSCharles Keepax #include <linux/init.h> 14bbed297dSCharles Keepax #include <linux/module.h> 15bbed297dSCharles Keepax #include <linux/i2c.h> 16960cdd50SPierre-Louis Bossart #include <linux/acpi.h> 17bbed297dSCharles Keepax 18bbed297dSCharles Keepax #include "wm8804.h" 19bbed297dSCharles Keepax 20bbed297dSCharles Keepax static int wm8804_i2c_probe(struct i2c_client *i2c, 21bbed297dSCharles Keepax const struct i2c_device_id *id) 22bbed297dSCharles Keepax { 23bbed297dSCharles Keepax struct regmap *regmap; 24bbed297dSCharles Keepax 25bbed297dSCharles Keepax regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config); 26bbed297dSCharles Keepax if (IS_ERR(regmap)) 27bbed297dSCharles Keepax return PTR_ERR(regmap); 28bbed297dSCharles Keepax 29bbed297dSCharles Keepax return wm8804_probe(&i2c->dev, regmap); 30bbed297dSCharles Keepax } 31bbed297dSCharles Keepax 32bbed297dSCharles Keepax static int wm8804_i2c_remove(struct i2c_client *i2c) 33bbed297dSCharles Keepax { 34bbed297dSCharles Keepax wm8804_remove(&i2c->dev); 35bbed297dSCharles Keepax return 0; 36bbed297dSCharles Keepax } 37bbed297dSCharles Keepax 38bbed297dSCharles Keepax static const struct i2c_device_id wm8804_i2c_id[] = { 39bbed297dSCharles Keepax { "wm8804", 0 }, 40bbed297dSCharles Keepax { } 41bbed297dSCharles Keepax }; 42bbed297dSCharles Keepax MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); 43bbed297dSCharles Keepax 44960cdd50SPierre-Louis Bossart #if defined(CONFIG_OF) 45bbed297dSCharles Keepax static const struct of_device_id wm8804_of_match[] = { 46bbed297dSCharles Keepax { .compatible = "wlf,wm8804", }, 47bbed297dSCharles Keepax { } 48bbed297dSCharles Keepax }; 49bbed297dSCharles Keepax MODULE_DEVICE_TABLE(of, wm8804_of_match); 50960cdd50SPierre-Louis Bossart #endif 51960cdd50SPierre-Louis Bossart 52960cdd50SPierre-Louis Bossart #ifdef CONFIG_ACPI 53960cdd50SPierre-Louis Bossart static const struct acpi_device_id wm8804_acpi_match[] = { 54960cdd50SPierre-Louis Bossart { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */ 55960cdd50SPierre-Louis Bossart { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */ 56960cdd50SPierre-Louis Bossart { }, 57960cdd50SPierre-Louis Bossart }; 58960cdd50SPierre-Louis Bossart MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match); 59960cdd50SPierre-Louis Bossart #endif 60bbed297dSCharles Keepax 61bbed297dSCharles Keepax static struct i2c_driver wm8804_i2c_driver = { 62bbed297dSCharles Keepax .driver = { 63bbed297dSCharles Keepax .name = "wm8804", 641a60667fSCharles Keepax .pm = &wm8804_pm, 65960cdd50SPierre-Louis Bossart .of_match_table = of_match_ptr(wm8804_of_match), 66960cdd50SPierre-Louis Bossart .acpi_match_table = ACPI_PTR(wm8804_acpi_match), 67bbed297dSCharles Keepax }, 68bbed297dSCharles Keepax .probe = wm8804_i2c_probe, 69bbed297dSCharles Keepax .remove = wm8804_i2c_remove, 70bbed297dSCharles Keepax .id_table = wm8804_i2c_id 71bbed297dSCharles Keepax }; 72bbed297dSCharles Keepax 73bbed297dSCharles Keepax module_i2c_driver(wm8804_i2c_driver); 74bbed297dSCharles Keepax 75bbed297dSCharles Keepax MODULE_DESCRIPTION("ASoC WM8804 driver - I2C"); 76bbed297dSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>"); 77bbed297dSCharles Keepax MODULE_LICENSE("GPL"); 78