15 #include <linux/module.h>
18 #include <linux/slab.h>
19 #include <linux/i2c.h>
42 static const struct mfd_cell palmas_children[] = {
44 .name =
"palmas-pmic",
48 .name =
"palmas-gpio",
52 .name =
"palmas-leds",
64 .name =
"palmas-pwrbutton",
68 .name =
"palmas-gpadc",
72 .name =
"palmas-resource",
237 static struct regmap_irq_chip palmas_irq_chip = {
256 ret = of_property_read_u32(node,
"ti,mux_pad1", &prop);
262 ret = of_property_read_u32(node,
"ti,mux_pad2", &prop);
269 ret = of_property_read_u32(node,
"ti,power_ctrl", &prop);
289 pdata = dev_get_platdata(&i2c->
dev);
291 if (node && !pdata) {
297 palmas_dt_to_pdata(node, pdata);
307 i2c_set_clientdata(i2c, palmas);
309 palmas->
id =
id->driver_data;
321 "can't attach client %d\n",
i);
327 &palmas_regmap_config[
i]);
328 if (IS_ERR(palmas->
regmap[
i])) {
329 ret = PTR_ERR(palmas->
regmap[
i]);
331 "Failed to allocate regmap %d, err: %d\n",
369 else if ((reg & PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK) ==
372 else if ((reg & PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK) ==
377 else if ((reg & PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK) ==
380 else if ((reg & PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK) ==
409 dev_info(palmas->
dev,
"Muxing GPIO %x, PWM %x, LED %x\n",
427 ret = of_platform_populate(node,
NULL,
NULL, &i2c->
dev);
434 children =
kmemdup(palmas_children,
sizeof(palmas_children),
476 static int palmas_i2c_remove(
struct i2c_client *i2c)
478 struct palmas *palmas = i2c_get_clientdata(i2c);
496 { .compatible =
"ti,palmas", },
500 static struct i2c_driver palmas_i2c_driver = {
503 .of_match_table = of_palmas_match_tbl,
506 .probe = palmas_i2c_probe,
507 .remove = palmas_i2c_remove,
508 .id_table = palmas_i2c_id,
511 static int __init palmas_i2c_init(
void)
513 return i2c_add_driver(&palmas_i2c_driver);
518 static void __exit palmas_i2c_exit(
void)