18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * wm8804-i2c.c -- WM8804 S/PDIF transceiver driver - I2C 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright 2015 Cirrus Logic Inc 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/init.h> 118c2ecf20Sopenharmony_ci#include <linux/module.h> 128c2ecf20Sopenharmony_ci#include <linux/i2c.h> 138c2ecf20Sopenharmony_ci#include <linux/acpi.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#include "wm8804.h" 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistatic int wm8804_i2c_probe(struct i2c_client *i2c, 188c2ecf20Sopenharmony_ci const struct i2c_device_id *id) 198c2ecf20Sopenharmony_ci{ 208c2ecf20Sopenharmony_ci struct regmap *regmap; 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config); 238c2ecf20Sopenharmony_ci if (IS_ERR(regmap)) 248c2ecf20Sopenharmony_ci return PTR_ERR(regmap); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ci return wm8804_probe(&i2c->dev, regmap); 278c2ecf20Sopenharmony_ci} 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic int wm8804_i2c_remove(struct i2c_client *i2c) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci wm8804_remove(&i2c->dev); 328c2ecf20Sopenharmony_ci return 0; 338c2ecf20Sopenharmony_ci} 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_cistatic const struct i2c_device_id wm8804_i2c_id[] = { 368c2ecf20Sopenharmony_ci { "wm8804", 0 }, 378c2ecf20Sopenharmony_ci { } 388c2ecf20Sopenharmony_ci}; 398c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(i2c, wm8804_i2c_id); 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#if defined(CONFIG_OF) 428c2ecf20Sopenharmony_cistatic const struct of_device_id wm8804_of_match[] = { 438c2ecf20Sopenharmony_ci { .compatible = "wlf,wm8804", }, 448c2ecf20Sopenharmony_ci { } 458c2ecf20Sopenharmony_ci}; 468c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, wm8804_of_match); 478c2ecf20Sopenharmony_ci#endif 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#ifdef CONFIG_ACPI 508c2ecf20Sopenharmony_cistatic const struct acpi_device_id wm8804_acpi_match[] = { 518c2ecf20Sopenharmony_ci { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */ 528c2ecf20Sopenharmony_ci { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */ 538c2ecf20Sopenharmony_ci { }, 548c2ecf20Sopenharmony_ci}; 558c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(acpi, wm8804_acpi_match); 568c2ecf20Sopenharmony_ci#endif 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_cistatic struct i2c_driver wm8804_i2c_driver = { 598c2ecf20Sopenharmony_ci .driver = { 608c2ecf20Sopenharmony_ci .name = "wm8804", 618c2ecf20Sopenharmony_ci .pm = &wm8804_pm, 628c2ecf20Sopenharmony_ci .of_match_table = of_match_ptr(wm8804_of_match), 638c2ecf20Sopenharmony_ci .acpi_match_table = ACPI_PTR(wm8804_acpi_match), 648c2ecf20Sopenharmony_ci }, 658c2ecf20Sopenharmony_ci .probe = wm8804_i2c_probe, 668c2ecf20Sopenharmony_ci .remove = wm8804_i2c_remove, 678c2ecf20Sopenharmony_ci .id_table = wm8804_i2c_id 688c2ecf20Sopenharmony_ci}; 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_cimodule_i2c_driver(wm8804_i2c_driver); 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("ASoC WM8804 driver - I2C"); 738c2ecf20Sopenharmony_ciMODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>"); 748c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL"); 75