1 /* 1 /* 2 * Cirrus Logic CS42448/CS42888 Audio CODEC DA 2 * Cirrus Logic CS42448/CS42888 Audio CODEC DAI I2C driver 3 * 3 * 4 * Copyright (C) 2014 Freescale Semiconductor, 4 * Copyright (C) 2014 Freescale Semiconductor, Inc. 5 * 5 * 6 * Author: Nicolin Chen <Guangyu.Chen@freescal 6 * Author: Nicolin Chen <Guangyu.Chen@freescale.com> 7 * 7 * 8 * This file is licensed under the terms of th 8 * This file is licensed under the terms of the GNU General Public License 9 * version 2. This program is licensed "as is" 9 * version 2. This program is licensed "as is" without any warranty of any 10 * kind, whether express or implied. 10 * kind, whether express or implied. 11 */ 11 */ 12 12 13 #include <linux/i2c.h> 13 #include <linux/i2c.h> 14 #include <linux/module.h> 14 #include <linux/module.h> 15 #include <linux/mod_devicetable.h> << 16 #include <linux/pm_runtime.h> 15 #include <linux/pm_runtime.h> 17 #include <sound/soc.h> 16 #include <sound/soc.h> 18 17 19 #include "cs42xx8.h" 18 #include "cs42xx8.h" 20 19 21 static int cs42xx8_i2c_probe(struct i2c_client !! 20 static int cs42xx8_i2c_probe(struct i2c_client *i2c, >> 21 const struct i2c_device_id *id) 22 { 22 { 23 int ret; !! 23 int ret = cs42xx8_probe(&i2c->dev, 24 struct cs42xx8_driver_data *drvdata; !! 24 devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config)); 25 << 26 drvdata = (struct cs42xx8_driver_data << 27 if (!drvdata) << 28 return dev_err_probe(&i2c->dev << 29 "failed t << 30 << 31 ret = cs42xx8_probe(&i2c->dev, << 32 devm_regmap_init_i2c(i2c, &cs4 << 33 if (ret) 25 if (ret) 34 return ret; 26 return ret; 35 27 36 pm_runtime_enable(&i2c->dev); 28 pm_runtime_enable(&i2c->dev); 37 pm_request_idle(&i2c->dev); 29 pm_request_idle(&i2c->dev); 38 30 39 return 0; 31 return 0; 40 } 32 } 41 33 42 static void cs42xx8_i2c_remove(struct i2c_clie !! 34 static int cs42xx8_i2c_remove(struct i2c_client *i2c) 43 { 35 { 44 pm_runtime_disable(&i2c->dev); 36 pm_runtime_disable(&i2c->dev); 45 } << 46 37 47 static const struct of_device_id cs42xx8_of_ma !! 38 return 0; 48 { .compatible = "cirrus,cs42448", .dat !! 39 } 49 { .compatible = "cirrus,cs42888", .dat << 50 { /* sentinel */ } << 51 }; << 52 MODULE_DEVICE_TABLE(of, cs42xx8_of_match); << 53 40 54 static const struct i2c_device_id cs42xx8_i2c_ !! 41 static struct i2c_device_id cs42xx8_i2c_id[] = { 55 {"cs42448", (kernel_ulong_t)&cs42448_d 42 {"cs42448", (kernel_ulong_t)&cs42448_data}, 56 {"cs42888", (kernel_ulong_t)&cs42888_d 43 {"cs42888", (kernel_ulong_t)&cs42888_data}, 57 {} 44 {} 58 }; 45 }; 59 MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id); 46 MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id); 60 47 61 static struct i2c_driver cs42xx8_i2c_driver = 48 static struct i2c_driver cs42xx8_i2c_driver = { 62 .driver = { 49 .driver = { 63 .name = "cs42xx8", 50 .name = "cs42xx8", 64 .pm = &cs42xx8_pm, 51 .pm = &cs42xx8_pm, 65 .of_match_table = cs42xx8_of_m 52 .of_match_table = cs42xx8_of_match, 66 }, 53 }, 67 .probe = cs42xx8_i2c_probe, 54 .probe = cs42xx8_i2c_probe, 68 .remove = cs42xx8_i2c_remove, 55 .remove = cs42xx8_i2c_remove, 69 .id_table = cs42xx8_i2c_id, 56 .id_table = cs42xx8_i2c_id, 70 }; 57 }; 71 58 72 module_i2c_driver(cs42xx8_i2c_driver); 59 module_i2c_driver(cs42xx8_i2c_driver); 73 60 74 MODULE_DESCRIPTION("Cirrus Logic CS42448/CS428 61 MODULE_DESCRIPTION("Cirrus Logic CS42448/CS42888 ALSA SoC Codec I2C Driver"); 75 MODULE_AUTHOR("Freescale Semiconductor, Inc.") 62 MODULE_AUTHOR("Freescale Semiconductor, Inc."); 76 MODULE_LICENSE("GPL"); 63 MODULE_LICENSE("GPL"); 77 64
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.