driver core: bus: use to_subsys_private and to_device_private_bus
[linux/fpc-iii.git] / sound / soc / codecs / cs42xx8-i2c.c
blob800c1d549347194a7aa80c514161eae8752ec3d7
1 /*
2 * Cirrus Logic CS42448/CS42888 Audio CODEC DAI I2C driver
4 * Copyright (C) 2014 Freescale Semiconductor, Inc.
6 * Author: Nicolin Chen <Guangyu.Chen@freescale.com>
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
13 #include <linux/i2c.h>
14 #include <linux/module.h>
15 #include <linux/pm_runtime.h>
16 #include <sound/soc.h>
18 #include "cs42xx8.h"
20 static int cs42xx8_i2c_probe(struct i2c_client *i2c,
21 const struct i2c_device_id *id)
23 int ret = cs42xx8_probe(&i2c->dev,
24 devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config));
25 if (ret)
26 return ret;
28 pm_runtime_enable(&i2c->dev);
29 pm_request_idle(&i2c->dev);
31 return 0;
34 static int cs42xx8_i2c_remove(struct i2c_client *i2c)
36 snd_soc_unregister_codec(&i2c->dev);
37 pm_runtime_disable(&i2c->dev);
39 return 0;
42 static struct i2c_device_id cs42xx8_i2c_id[] = {
43 {"cs42448", (kernel_ulong_t)&cs42448_data},
44 {"cs42888", (kernel_ulong_t)&cs42888_data},
47 MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id);
49 static struct i2c_driver cs42xx8_i2c_driver = {
50 .driver = {
51 .name = "cs42xx8",
52 .pm = &cs42xx8_pm,
53 .of_match_table = cs42xx8_of_match,
55 .probe = cs42xx8_i2c_probe,
56 .remove = cs42xx8_i2c_remove,
57 .id_table = cs42xx8_i2c_id,
60 module_i2c_driver(cs42xx8_i2c_driver);
62 MODULE_DESCRIPTION("Cirrus Logic CS42448/CS42888 ALSA SoC Codec I2C Driver");
63 MODULE_AUTHOR("Freescale Semiconductor, Inc.");
64 MODULE_LICENSE("GPL");