15 #include <linux/kernel.h>
16 #include <linux/module.h>
17 #include <linux/i2c.h>
20 #include <linux/slab.h>
27 static int wm831x_i2c_probe(
struct i2c_client *i2c,
37 i2c_set_clientdata(i2c, wm831x);
41 if (IS_ERR(wm831x->
regmap)) {
42 ret = PTR_ERR(wm831x->
regmap);
43 dev_err(wm831x->
dev,
"Failed to allocate register map: %d\n",
51 static int wm831x_i2c_remove(
struct i2c_client *i2c)
53 struct wm831x *wm831x = i2c_get_clientdata(i2c);
60 static int wm831x_i2c_suspend(
struct device *
dev)
67 static void wm831x_i2c_shutdown(
struct i2c_client *i2c)
69 struct wm831x *wm831x = i2c_get_clientdata(i2c);
86 static const struct dev_pm_ops wm831x_pm_ops = {
87 .suspend = wm831x_i2c_suspend,
96 .probe = wm831x_i2c_probe,
97 .remove = wm831x_i2c_remove,
98 .shutdown = wm831x_i2c_shutdown,
99 .id_table = wm831x_i2c_id,
102 static int __init wm831x_i2c_init(
void)
106 ret = i2c_add_driver(&wm831x_i2c_driver);
108 pr_err(
"Failed to register wm831x I2C driver: %d\n", ret);
114 static void __exit wm831x_i2c_exit(
void)