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

pcm1789-i2c.c (1477B)


      1// SPDX-License-Identifier: GPL-2.0
      2// Audio driver for PCM1789 I2C
      3// Copyright (C) 2018 Bootlin
      4// Mylène Josserand <mylene.josserand@bootlin.com>
      5
      6#include <linux/clk.h>
      7#include <linux/delay.h>
      8#include <linux/i2c.h>
      9#include <linux/module.h>
     10#include <linux/of.h>
     11#include <linux/regmap.h>
     12
     13#include "pcm1789.h"
     14
     15static int pcm1789_i2c_probe(struct i2c_client *client)
     16{
     17	struct regmap *regmap;
     18	int ret;
     19
     20	regmap = devm_regmap_init_i2c(client, &pcm1789_regmap_config);
     21	if (IS_ERR(regmap)) {
     22		ret = PTR_ERR(regmap);
     23		dev_err(&client->dev, "Failed to allocate regmap: %d\n", ret);
     24		return ret;
     25	}
     26
     27	return pcm1789_common_init(&client->dev, regmap);
     28}
     29
     30static int pcm1789_i2c_remove(struct i2c_client *client)
     31{
     32	pcm1789_common_exit(&client->dev);
     33
     34	return 0;
     35}
     36
     37#ifdef CONFIG_OF
     38static const struct of_device_id pcm1789_of_match[] = {
     39	{ .compatible = "ti,pcm1789", },
     40	{ }
     41};
     42MODULE_DEVICE_TABLE(of, pcm1789_of_match);
     43#endif
     44
     45static const struct i2c_device_id pcm1789_i2c_ids[] = {
     46	{ "pcm1789", 0 },
     47	{ }
     48};
     49MODULE_DEVICE_TABLE(i2c, pcm1789_i2c_ids);
     50
     51static struct i2c_driver pcm1789_i2c_driver = {
     52	.driver = {
     53		.name	= "pcm1789",
     54		.of_match_table = of_match_ptr(pcm1789_of_match),
     55	},
     56	.id_table	= pcm1789_i2c_ids,
     57	.probe_new	= pcm1789_i2c_probe,
     58	.remove	= pcm1789_i2c_remove,
     59};
     60
     61module_i2c_driver(pcm1789_i2c_driver);
     62
     63MODULE_DESCRIPTION("ASoC PCM1789 I2C driver");
     64MODULE_AUTHOR("Mylène Josserand <mylene.josserand@bootlin.com>");
     65MODULE_LICENSE("GPL");