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>
7 #include <linux/delay.h>
9 #include <linux/module.h>
11 #include <linux/regmap.h>
15 static int pcm1789_i2c_probe(struct i2c_client
*client
)
17 struct regmap
*regmap
;
20 regmap
= devm_regmap_init_i2c(client
, &pcm1789_regmap_config
);
22 ret
= PTR_ERR(regmap
);
23 dev_err(&client
->dev
, "Failed to allocate regmap: %d\n", ret
);
27 return pcm1789_common_init(&client
->dev
, regmap
);
30 static void pcm1789_i2c_remove(struct i2c_client
*client
)
32 pcm1789_common_exit(&client
->dev
);
36 static const struct of_device_id pcm1789_of_match
[] = {
37 { .compatible
= "ti,pcm1789", },
40 MODULE_DEVICE_TABLE(of
, pcm1789_of_match
);
43 static const struct i2c_device_id pcm1789_i2c_ids
[] = {
47 MODULE_DEVICE_TABLE(i2c
, pcm1789_i2c_ids
);
49 static struct i2c_driver pcm1789_i2c_driver
= {
52 .of_match_table
= of_match_ptr(pcm1789_of_match
),
54 .id_table
= pcm1789_i2c_ids
,
55 .probe
= pcm1789_i2c_probe
,
56 .remove
= pcm1789_i2c_remove
,
59 module_i2c_driver(pcm1789_i2c_driver
);
61 MODULE_DESCRIPTION("ASoC PCM1789 I2C driver");
62 MODULE_AUTHOR("Mylène Josserand <mylene.josserand@bootlin.com>");
63 MODULE_LICENSE("GPL");