blob: 0214e3ab9da00d387324373486860eb3ee8b8bf1 [file] [log] [blame]
Nicolin Chen0c516b42014-03-20 18:18:37 +08001/*
2 * Cirrus Logic CS42448/CS42888 Audio CODEC DAI I2C driver
3 *
4 * Copyright (C) 2014 Freescale Semiconductor, Inc.
5 *
6 * Author: Nicolin Chen <Guangyu.Chen@freescale.com>
7 *
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.
11 */
12
13#include <linux/i2c.h>
14#include <linux/module.h>
15#include <linux/pm_runtime.h>
16#include <sound/soc.h>
17
18#include "cs42xx8.h"
19
20static int cs42xx8_i2c_probe(struct i2c_client *i2c,
21 const struct i2c_device_id *id)
22{
Axel Lin5e4cb7b2015-06-25 21:44:13 +080023 int ret = cs42xx8_probe(&i2c->dev,
Nicolin Chen0c516b42014-03-20 18:18:37 +080024 devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config));
25 if (ret)
26 return ret;
27
28 pm_runtime_enable(&i2c->dev);
29 pm_request_idle(&i2c->dev);
30
31 return 0;
32}
33
34static int cs42xx8_i2c_remove(struct i2c_client *i2c)
35{
Nicolin Chen0c516b42014-03-20 18:18:37 +080036 pm_runtime_disable(&i2c->dev);
37
38 return 0;
39}
40
41static struct i2c_device_id cs42xx8_i2c_id[] = {
42 {"cs42448", (kernel_ulong_t)&cs42448_data},
43 {"cs42888", (kernel_ulong_t)&cs42888_data},
44 {}
45};
46MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id);
47
48static struct i2c_driver cs42xx8_i2c_driver = {
49 .driver = {
50 .name = "cs42xx8",
Nicolin Chen0c516b42014-03-20 18:18:37 +080051 .pm = &cs42xx8_pm,
Axel Lin5e4cb7b2015-06-25 21:44:13 +080052 .of_match_table = cs42xx8_of_match,
Nicolin Chen0c516b42014-03-20 18:18:37 +080053 },
54 .probe = cs42xx8_i2c_probe,
55 .remove = cs42xx8_i2c_remove,
56 .id_table = cs42xx8_i2c_id,
57};
58
59module_i2c_driver(cs42xx8_i2c_driver);
60
61MODULE_DESCRIPTION("Cirrus Logic CS42448/CS42888 ALSA SoC Codec I2C Driver");
62MODULE_AUTHOR("Freescale Semiconductor, Inc.");
63MODULE_LICENSE("GPL");