cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

cs42xx8-i2c.c (1462B)


      1/*
      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{
     22	int ret = cs42xx8_probe(&i2c->dev,
     23			devm_regmap_init_i2c(i2c, &cs42xx8_regmap_config));
     24	if (ret)
     25		return ret;
     26
     27	pm_runtime_enable(&i2c->dev);
     28	pm_request_idle(&i2c->dev);
     29
     30	return 0;
     31}
     32
     33static int cs42xx8_i2c_remove(struct i2c_client *i2c)
     34{
     35	pm_runtime_disable(&i2c->dev);
     36
     37	return 0;
     38}
     39
     40static struct i2c_device_id cs42xx8_i2c_id[] = {
     41	{"cs42448", (kernel_ulong_t)&cs42448_data},
     42	{"cs42888", (kernel_ulong_t)&cs42888_data},
     43	{}
     44};
     45MODULE_DEVICE_TABLE(i2c, cs42xx8_i2c_id);
     46
     47static struct i2c_driver cs42xx8_i2c_driver = {
     48	.driver = {
     49		.name = "cs42xx8",
     50		.pm = &cs42xx8_pm,
     51		.of_match_table = cs42xx8_of_match,
     52	},
     53	.probe_new = cs42xx8_i2c_probe,
     54	.remove = cs42xx8_i2c_remove,
     55	.id_table = cs42xx8_i2c_id,
     56};
     57
     58module_i2c_driver(cs42xx8_i2c_driver);
     59
     60MODULE_DESCRIPTION("Cirrus Logic CS42448/CS42888 ALSA SoC Codec I2C Driver");
     61MODULE_AUTHOR("Freescale Semiconductor, Inc.");
     62MODULE_LICENSE("GPL");