Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * wm8804-i2c.c  --  WM8804 S/PDIF transceiver driver - I2C
0004  *
0005  * Copyright 2015 Cirrus Logic Inc
0006  *
0007  * Author: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
0008  */
0009 
0010 #include <linux/init.h>
0011 #include <linux/module.h>
0012 #include <linux/i2c.h>
0013 #include <linux/acpi.h>
0014 
0015 #include "wm8804.h"
0016 
0017 static int wm8804_i2c_probe(struct i2c_client *i2c)
0018 {
0019     struct regmap *regmap;
0020 
0021     regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config);
0022     if (IS_ERR(regmap))
0023         return PTR_ERR(regmap);
0024 
0025     return wm8804_probe(&i2c->dev, regmap);
0026 }
0027 
0028 static int wm8804_i2c_remove(struct i2c_client *i2c)
0029 {
0030     wm8804_remove(&i2c->dev);
0031     return 0;
0032 }
0033 
0034 static const struct i2c_device_id wm8804_i2c_id[] = {
0035     { "wm8804", 0 },
0036     { }
0037 };
0038 MODULE_DEVICE_TABLE(i2c, wm8804_i2c_id);
0039 
0040 #if defined(CONFIG_OF)
0041 static const struct of_device_id wm8804_of_match[] = {
0042     { .compatible = "wlf,wm8804", },
0043     { }
0044 };
0045 MODULE_DEVICE_TABLE(of, wm8804_of_match);
0046 #endif
0047 
0048 #ifdef CONFIG_ACPI
0049 static const struct acpi_device_id wm8804_acpi_match[] = {
0050     { "1AEC8804", 0 }, /* Wolfson PCI ID + part ID */
0051     { "10138804", 0 }, /* Cirrus Logic PCI ID + part ID */
0052     { },
0053 };
0054 MODULE_DEVICE_TABLE(acpi, wm8804_acpi_match);
0055 #endif
0056 
0057 static struct i2c_driver wm8804_i2c_driver = {
0058     .driver = {
0059         .name = "wm8804",
0060         .pm = &wm8804_pm,
0061         .of_match_table = of_match_ptr(wm8804_of_match),
0062         .acpi_match_table = ACPI_PTR(wm8804_acpi_match),
0063     },
0064     .probe_new = wm8804_i2c_probe,
0065     .remove = wm8804_i2c_remove,
0066     .id_table = wm8804_i2c_id
0067 };
0068 
0069 module_i2c_driver(wm8804_i2c_driver);
0070 
0071 MODULE_DESCRIPTION("ASoC WM8804 driver - I2C");
0072 MODULE_AUTHOR("Charles Keepax <ckeepax@opensource.wolfsonmicro.com>");
0073 MODULE_LICENSE("GPL");