/*
 * 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)
{
	int 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",
		.pm = &cs42xx8_pm,
		.of_match_table = cs42xx8_of_match,
	},
	.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");
/'>summary</a><a href='/cgit.cgi/linux/net-next.git/refs/?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>refs</a><a class='active' href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/arm/util/unwind-libunwind.c'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/tools/perf/arch/arm/util/unwind-libunwind.c?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>tree</a><a href='/cgit.cgi/linux/net-next.git/commit/tools/perf/arch/arm/util/unwind-libunwind.c?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/tools/perf/arch/arm/util/unwind-libunwind.c?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/arm/util/unwind-libunwind.c'>
<input type='hidden' name='id' value='3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>perf</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>arch</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/arm?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>arm</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/arm/util?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>util</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/arm/util/unwind-libunwind.c?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a'>unwind-libunwind.c</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/perf/arch/arm/util/unwind-libunwind.c?id=3f1a84e6962c7fd0703b9bb5db0355d1c28b201a&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
/tr>