Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Cirrus Logic CS42448/CS42888 Audio CODEC DAI I2C driver
0003  *
0004  * Copyright (C) 2014 Freescale Semiconductor, Inc.
0005  *
0006  * Author: Nicolin Chen <Guangyu.Chen@freescale.com>
0007  *
0008  * This file is licensed under the terms of the GNU General Public License
0009  * version 2. This program is licensed "as is" without any warranty of any
0010  * kind, whether express or implied.
0011  */
0012 
0013 #include <linux/i2c.h>
0014 #include <linux/module.h>
0015 #include <linux/pm_runtime.h>
0016 #include <sound/soc.h>
0017 
0018 #include "cs42xx8.h"
0019 
0020 static int cs42xx8_i2c_probe(struct i2c_client *i2c)
0021 {
0022     int ret = cs42xx8_probe(&i2c->dev,
0023             devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config));
0024     if (ret)
0025         return ret;
0026 
0027     pm_runtime_enable(&i2c->dev);
0028     pm_request_idle(&i2c->dev);
0029 
0030     return 0;
0031 }
0032 
0033 static int cs42xx8_i2c_remove(struct i2c_client *i2c)
0034 {
0035     pm_runtime_disable(&i2c->dev);
0036 
0037     return 0;
0038 }
0039 
0040 static struct i2c_device_id cs42xx8_i2c_id[] = {
0041     {"cs42448", (kernel_ulong_t)&cs42448_data},
0042     {"cs42888", (kernel_ulong_t)&cs42888_data},
0043     {}
0044 };
0045 MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id);
0046 
0047 static struct i2c_driver cs42xx8_i2c_driver = {
0048     .driver = {
0049         .name = "cs42xx8",
0050         .pm = &cs42xx8_pm,
0051         .of_match_table = cs42xx8_of_match,
0052     },
0053     .probe_new = cs42xx8_i2c_probe,
0054     .remove = cs42xx8_i2c_remove,
0055     .id_table = cs42xx8_i2c_id,
0056 };
0057 
0058 module_i2c_driver(cs42xx8_i2c_driver);
0059 
0060 MODULE_DESCRIPTION("Cirrus Logic CS42448/CS42888 ALSA SoC Codec I2C Driver");
0061 MODULE_AUTHOR("Freescale Semiconductor, Inc.");
0062 MODULE_LICENSE("GPL");