Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * ALSA SoC TLV320AIC23 codec driver I2C interface
0004  *
0005  * Author:      Arun KS, <arunks@mistralsolutions.com>
0006  * Copyright:   (C) 2008 Mistral Solutions Pvt Ltd.,
0007  *
0008  * Based on sound/soc/codecs/wm8731.c by Richard Purdie
0009  */
0010 
0011 #include <linux/i2c.h>
0012 #include <linux/module.h>
0013 #include <linux/of.h>
0014 #include <linux/regmap.h>
0015 #include <sound/soc.h>
0016 
0017 #include "tlv320aic23.h"
0018 
0019 static int tlv320aic23_i2c_probe(struct i2c_client *i2c)
0020 {
0021     struct regmap *regmap;
0022 
0023     if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
0024         return -EINVAL;
0025 
0026     regmap = devm_regmap_init_i2c(i2c, &tlv320aic23_regmap);
0027     return tlv320aic23_probe(&i2c->dev, regmap);
0028 }
0029 
0030 static const struct i2c_device_id tlv320aic23_id[] = {
0031     {"tlv320aic23", 0},
0032     {}
0033 };
0034 
0035 MODULE_DEVICE_TABLE(i2c, tlv320aic23_id);
0036 
0037 #ifdef CONFIG_OF
0038 static const struct of_device_id tlv320aic23_of_match[] = {
0039     { .compatible = "ti,tlv320aic23", },
0040     { }
0041 };
0042 MODULE_DEVICE_TABLE(of, tlv320aic23_of_match);
0043 #endif
0044 
0045 static struct i2c_driver tlv320aic23_i2c_driver = {
0046     .driver = {
0047            .name = "tlv320aic23-codec",
0048            .of_match_table = of_match_ptr(tlv320aic23_of_match),
0049            },
0050     .probe_new = tlv320aic23_i2c_probe,
0051     .id_table = tlv320aic23_id,
0052 };
0053 
0054 module_i2c_driver(tlv320aic23_i2c_driver);
0055 
0056 MODULE_DESCRIPTION("ASoC TLV320AIC23 codec driver I2C");
0057 MODULE_AUTHOR("Arun KS <arunks@mistralsolutions.com>");
0058 MODULE_LICENSE("GPL");