diff options
author | Mark Brown <broonie@linaro.org> | 2014-03-23 15:00:48 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-03-23 15:00:48 +0100 |
commit | b4d032b3fbe444c7978eb5aeda5d24164a9e8c2e (patch) | |
tree | 740a8899f25e30a7de053f5cc53cb908f78fa088 /sound/soc/codecs/cs42xx8-i2c.c | |
parent | Merge remote-tracking branch 'asoc/topic/codecs' into asoc-next (diff) | |
parent | ASoC: cs42xx8: Add codec driver support for CS42448/CS42888 (diff) | |
download | linux-b4d032b3fbe444c7978eb5aeda5d24164a9e8c2e.tar.xz linux-b4d032b3fbe444c7978eb5aeda5d24164a9e8c2e.zip |
Merge remote-tracking branch 'asoc/topic/cs42xx8' into asoc-next
Diffstat (limited to 'sound/soc/codecs/cs42xx8-i2c.c')
-rw-r--r-- | sound/soc/codecs/cs42xx8-i2c.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/sound/soc/codecs/cs42xx8-i2c.c b/sound/soc/codecs/cs42xx8-i2c.c new file mode 100644 index 000000000000..657dce27eade --- /dev/null +++ b/sound/soc/codecs/cs42xx8-i2c.c @@ -0,0 +1,64 @@ +/* + * Cirrus Logic CS42448/CS42888 Audio CODEC DAI I2C driver + * + * Copyright (C) 2014 Freescale Semiconductor, Inc. + * + * Author: Nicolin Chen <Guangyu.Chen@freescale.com> + * + * This file is licensed under the terms of the GNU General Public License + * version 2. This program is licensed "as is" without any warranty of any + * kind, whether express or implied. + */ + +#include <linux/i2c.h> +#include <linux/module.h> +#include <linux/pm_runtime.h> +#include <sound/soc.h> + +#include "cs42xx8.h" + +static int cs42xx8_i2c_probe(struct i2c_client *i2c, + const struct i2c_device_id *id) +{ + u32 ret = cs42xx8_probe(&i2c->dev, + devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config)); + if (ret) + return ret; + + pm_runtime_enable(&i2c->dev); + pm_request_idle(&i2c->dev); + + return 0; +} + +static int cs42xx8_i2c_remove(struct i2c_client *i2c) +{ + snd_soc_unregister_codec(&i2c->dev); + pm_runtime_disable(&i2c->dev); + + return 0; +} + +static struct i2c_device_id cs42xx8_i2c_id[] = { + {"cs42448", (kernel_ulong_t)&cs42448_data}, + {"cs42888", (kernel_ulong_t)&cs42888_data}, + {} +}; +MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id); + +static struct i2c_driver cs42xx8_i2c_driver = { + .driver = { + .name = "cs42xx8", + .owner = THIS_MODULE, + .pm = &cs42xx8_pm, + }, + .probe = cs42xx8_i2c_probe, + .remove = cs42xx8_i2c_remove, + .id_table = cs42xx8_i2c_id, +}; + +module_i2c_driver(cs42xx8_i2c_driver); + +MODULE_DESCRIPTION("Cirrus Logic CS42448/CS42888 ALSA SoC Codec I2C Driver"); +MODULE_AUTHOR("Freescale Semiconductor, Inc."); +MODULE_LICENSE("GPL"); |