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> 16bbed297dSCharles Keepax 17bbed297dSCharles Keepax #include "wm8804.h" 18bbed297dSCharles Keepax 19bbed297dSCharles Keepax static int wm8804_i2c_probe(struct i2c_client *i2c, 20bbed297dSCharles Keepax const struct i2c_device_id *id) 21bbed297dSCharles Keepax { 22bbed297dSCharles Keepax struct regmap *regmap; 23bbed297dSCharles Keepax 24bbed297dSCharles Keepax regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config); 25bbed297dSCharles Keepax if (IS_ERR(regmap)) 26bbed297dSCharles Keepax return PTR_ERR(regmap); 27bbed297dSCharles Keepax 28bbed297dSCharles Keepax return wm8804_probe(&i2c->dev, regmap); 29bbed297dSCharles Keepax } 30bbed297dSCharles Keepax 31bbed297dSCharles Keepax static int wm8804_i2c_remove(struct i2c_client *i2c) 32bbed297dSCharles Keepax { 33bbed297dSCharles Keepax wm8804_remove(&i2c->dev); 34bbed297dSCharles Keepax return 0; 35bbed297dSCharles Keepax } 36bbed297dSCharles Keepax 37bbed297dSCharles Keepax static const struct i2c_device_id wm8804_i2c_id[] = { 38bbed297dSCharles Keepax { "wm8804", 0 }, 39bbed297dSCharles Keepax { } 40bbed297dSCharles Keepax }; 41bbed297dSCharles Keepax MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); 42bbed297dSCharles Keepax 43bbed297dSCharles Keepax static const struct of_device_id wm8804_of_match[] = { 44bbed297dSCharles Keepax { .compatible = "wlf,wm8804", }, 45bbed297dSCharles Keepax { } 46bbed297dSCharles Keepax }; 47bbed297dSCharles Keepax MODULE_DEVICE_TABLE(of, wm8804_of_match); 48bbed297dSCharles Keepax 49bbed297dSCharles Keepax static struct i2c_driver wm8804_i2c_driver = { 50bbed297dSCharles Keepax .driver = { 51bbed297dSCharles Keepax .name = "wm8804", 52bbed297dSCharles Keepax .owner = THIS_MODULE, 531a60667fSCharles Keepax .pm = &wm8804_pm, 54bbed297dSCharles Keepax .of_match_table = wm8804_of_match, 55bbed297dSCharles Keepax }, 56bbed297dSCharles Keepax .probe = wm8804_i2c_probe, 57bbed297dSCharles Keepax .remove = wm8804_i2c_remove, 58bbed297dSCharles Keepax .id_table = wm8804_i2c_id 59bbed297dSCharles Keepax }; 60bbed297dSCharles Keepax 61bbed297dSCharles Keepax module_i2c_driver(wm8804_i2c_driver); 62bbed297dSCharles Keepax 63bbed297dSCharles Keepax MODULE_DESCRIPTION("ASoC WM8804 driver - I2C"); 64bbed297dSCharles Keepax MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>"); 65bbed297dSCharles Keepax MODULE_LICENSE("GPL"); 66