1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Copyright 2011-2012 Texas Instruments Inc.
7 * Author: Graeme Gregory <gg@slimlogic.co.uk>
10 #include <linux/module.h>
11 #include <linux/moduleparam.h>
12 #include <linux/init.h>
13 #include <linux/slab.h>
14 #include <linux/i2c.h>
15 #include <linux/interrupt.h>
16 #include <linux/irq.h>
17 #include <linux/regmap.h>
18 #include <linux/err.h>
19 #include <linux/mfd/core.h>
20 #include <linux/mfd/palmas.h>
22 #include <linux/of_platform.h>
24 static const struct regmap_config palmas_regmap_config
[PALMAS_NUM_CLIENTS
] = {
28 .max_register
= PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE
,
29 PALMAS_PRIMARY_SECONDARY_PAD3
),
34 .max_register
= PALMAS_BASE_TO_REG(PALMAS_GPADC_BASE
,
35 PALMAS_GPADC_SMPS_VSEL_MONITORING
),
40 .max_register
= PALMAS_BASE_TO_REG(PALMAS_TRIM_GPADC_BASE
,
45 static const struct regmap_irq tps65917_irqs
[] = {
47 [TPS65917_RESERVED1
] = {
48 .mask
= TPS65917_RESERVED
,
50 [TPS65917_PWRON_IRQ
] = {
51 .mask
= TPS65917_INT1_STATUS_PWRON
,
53 [TPS65917_LONG_PRESS_KEY_IRQ
] = {
54 .mask
= TPS65917_INT1_STATUS_LONG_PRESS_KEY
,
56 [TPS65917_RESERVED2
] = {
57 .mask
= TPS65917_RESERVED
,
59 [TPS65917_PWRDOWN_IRQ
] = {
60 .mask
= TPS65917_INT1_STATUS_PWRDOWN
,
62 [TPS65917_HOTDIE_IRQ
] = {
63 .mask
= TPS65917_INT1_STATUS_HOTDIE
,
65 [TPS65917_VSYS_MON_IRQ
] = {
66 .mask
= TPS65917_INT1_STATUS_VSYS_MON
,
68 [TPS65917_RESERVED3
] = {
69 .mask
= TPS65917_RESERVED
,
72 [TPS65917_RESERVED4
] = {
73 .mask
= TPS65917_RESERVED
,
76 [TPS65917_OTP_ERROR_IRQ
] = {
77 .mask
= TPS65917_INT2_STATUS_OTP_ERROR
,
80 [TPS65917_WDT_IRQ
] = {
81 .mask
= TPS65917_INT2_STATUS_WDT
,
84 [TPS65917_RESERVED5
] = {
85 .mask
= TPS65917_RESERVED
,
88 [TPS65917_RESET_IN_IRQ
] = {
89 .mask
= TPS65917_INT2_STATUS_RESET_IN
,
92 [TPS65917_FSD_IRQ
] = {
93 .mask
= TPS65917_INT2_STATUS_FSD
,
96 [TPS65917_SHORT_IRQ
] = {
97 .mask
= TPS65917_INT2_STATUS_SHORT
,
100 [TPS65917_RESERVED6
] = {
101 .mask
= TPS65917_RESERVED
,
105 [TPS65917_GPADC_AUTO_0_IRQ
] = {
106 .mask
= TPS65917_INT3_STATUS_GPADC_AUTO_0
,
109 [TPS65917_GPADC_AUTO_1_IRQ
] = {
110 .mask
= TPS65917_INT3_STATUS_GPADC_AUTO_1
,
113 [TPS65917_GPADC_EOC_SW_IRQ
] = {
114 .mask
= TPS65917_INT3_STATUS_GPADC_EOC_SW
,
117 [TPS65917_RESREVED6
] = {
118 .mask
= TPS65917_RESERVED6
,
121 [TPS65917_RESERVED7
] = {
122 .mask
= TPS65917_RESERVED
,
125 [TPS65917_RESERVED8
] = {
126 .mask
= TPS65917_RESERVED
,
129 [TPS65917_RESERVED9
] = {
130 .mask
= TPS65917_RESERVED
,
133 [TPS65917_VBUS_IRQ
] = {
134 .mask
= TPS65917_INT3_STATUS_VBUS
,
138 [TPS65917_GPIO_0_IRQ
] = {
139 .mask
= TPS65917_INT4_STATUS_GPIO_0
,
142 [TPS65917_GPIO_1_IRQ
] = {
143 .mask
= TPS65917_INT4_STATUS_GPIO_1
,
146 [TPS65917_GPIO_2_IRQ
] = {
147 .mask
= TPS65917_INT4_STATUS_GPIO_2
,
150 [TPS65917_GPIO_3_IRQ
] = {
151 .mask
= TPS65917_INT4_STATUS_GPIO_3
,
154 [TPS65917_GPIO_4_IRQ
] = {
155 .mask
= TPS65917_INT4_STATUS_GPIO_4
,
158 [TPS65917_GPIO_5_IRQ
] = {
159 .mask
= TPS65917_INT4_STATUS_GPIO_5
,
162 [TPS65917_GPIO_6_IRQ
] = {
163 .mask
= TPS65917_INT4_STATUS_GPIO_6
,
166 [TPS65917_RESERVED10
] = {
167 .mask
= TPS65917_RESERVED10
,
172 static const struct regmap_irq palmas_irqs
[] = {
174 [PALMAS_CHARG_DET_N_VBUS_OVV_IRQ
] = {
175 .mask
= PALMAS_INT1_STATUS_CHARG_DET_N_VBUS_OVV
,
177 [PALMAS_PWRON_IRQ
] = {
178 .mask
= PALMAS_INT1_STATUS_PWRON
,
180 [PALMAS_LONG_PRESS_KEY_IRQ
] = {
181 .mask
= PALMAS_INT1_STATUS_LONG_PRESS_KEY
,
183 [PALMAS_RPWRON_IRQ
] = {
184 .mask
= PALMAS_INT1_STATUS_RPWRON
,
186 [PALMAS_PWRDOWN_IRQ
] = {
187 .mask
= PALMAS_INT1_STATUS_PWRDOWN
,
189 [PALMAS_HOTDIE_IRQ
] = {
190 .mask
= PALMAS_INT1_STATUS_HOTDIE
,
192 [PALMAS_VSYS_MON_IRQ
] = {
193 .mask
= PALMAS_INT1_STATUS_VSYS_MON
,
195 [PALMAS_VBAT_MON_IRQ
] = {
196 .mask
= PALMAS_INT1_STATUS_VBAT_MON
,
199 [PALMAS_RTC_ALARM_IRQ
] = {
200 .mask
= PALMAS_INT2_STATUS_RTC_ALARM
,
203 [PALMAS_RTC_TIMER_IRQ
] = {
204 .mask
= PALMAS_INT2_STATUS_RTC_TIMER
,
208 .mask
= PALMAS_INT2_STATUS_WDT
,
211 [PALMAS_BATREMOVAL_IRQ
] = {
212 .mask
= PALMAS_INT2_STATUS_BATREMOVAL
,
215 [PALMAS_RESET_IN_IRQ
] = {
216 .mask
= PALMAS_INT2_STATUS_RESET_IN
,
219 [PALMAS_FBI_BB_IRQ
] = {
220 .mask
= PALMAS_INT2_STATUS_FBI_BB
,
223 [PALMAS_SHORT_IRQ
] = {
224 .mask
= PALMAS_INT2_STATUS_SHORT
,
227 [PALMAS_VAC_ACOK_IRQ
] = {
228 .mask
= PALMAS_INT2_STATUS_VAC_ACOK
,
232 [PALMAS_GPADC_AUTO_0_IRQ
] = {
233 .mask
= PALMAS_INT3_STATUS_GPADC_AUTO_0
,
236 [PALMAS_GPADC_AUTO_1_IRQ
] = {
237 .mask
= PALMAS_INT3_STATUS_GPADC_AUTO_1
,
240 [PALMAS_GPADC_EOC_SW_IRQ
] = {
241 .mask
= PALMAS_INT3_STATUS_GPADC_EOC_SW
,
244 [PALMAS_GPADC_EOC_RT_IRQ
] = {
245 .mask
= PALMAS_INT3_STATUS_GPADC_EOC_RT
,
248 [PALMAS_ID_OTG_IRQ
] = {
249 .mask
= PALMAS_INT3_STATUS_ID_OTG
,
253 .mask
= PALMAS_INT3_STATUS_ID
,
256 [PALMAS_VBUS_OTG_IRQ
] = {
257 .mask
= PALMAS_INT3_STATUS_VBUS_OTG
,
260 [PALMAS_VBUS_IRQ
] = {
261 .mask
= PALMAS_INT3_STATUS_VBUS
,
265 [PALMAS_GPIO_0_IRQ
] = {
266 .mask
= PALMAS_INT4_STATUS_GPIO_0
,
269 [PALMAS_GPIO_1_IRQ
] = {
270 .mask
= PALMAS_INT4_STATUS_GPIO_1
,
273 [PALMAS_GPIO_2_IRQ
] = {
274 .mask
= PALMAS_INT4_STATUS_GPIO_2
,
277 [PALMAS_GPIO_3_IRQ
] = {
278 .mask
= PALMAS_INT4_STATUS_GPIO_3
,
281 [PALMAS_GPIO_4_IRQ
] = {
282 .mask
= PALMAS_INT4_STATUS_GPIO_4
,
285 [PALMAS_GPIO_5_IRQ
] = {
286 .mask
= PALMAS_INT4_STATUS_GPIO_5
,
289 [PALMAS_GPIO_6_IRQ
] = {
290 .mask
= PALMAS_INT4_STATUS_GPIO_6
,
293 [PALMAS_GPIO_7_IRQ
] = {
294 .mask
= PALMAS_INT4_STATUS_GPIO_7
,
299 static const struct regmap_irq_chip palmas_irq_chip
= {
302 .num_irqs
= ARRAY_SIZE(palmas_irqs
),
306 .status_base
= PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE
,
308 .mask_base
= PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE
,
312 static const struct regmap_irq_chip tps65917_irq_chip
= {
314 .irqs
= tps65917_irqs
,
315 .num_irqs
= ARRAY_SIZE(tps65917_irqs
),
319 .status_base
= PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE
,
321 .mask_base
= PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE
,
325 int palmas_ext_control_req_config(struct palmas
*palmas
,
326 enum palmas_external_requestor_id id
, int ext_ctrl
, bool enable
)
328 struct palmas_pmic_driver_data
*pmic_ddata
= palmas
->pmic_ddata
;
329 int preq_mask_bit
= 0;
333 if (!(ext_ctrl
& PALMAS_EXT_REQ
))
336 if (id
>= PALMAS_EXTERNAL_REQSTR_ID_MAX
)
339 if (ext_ctrl
& PALMAS_EXT_CONTROL_NSLEEP
) {
340 reg_add
= PALMAS_NSLEEP_RES_ASSIGN
;
342 } else if (ext_ctrl
& PALMAS_EXT_CONTROL_ENABLE1
) {
343 reg_add
= PALMAS_ENABLE1_RES_ASSIGN
;
345 } else if (ext_ctrl
& PALMAS_EXT_CONTROL_ENABLE2
) {
346 reg_add
= PALMAS_ENABLE2_RES_ASSIGN
;
350 bit_pos
= pmic_ddata
->sleep_req_info
[id
].bit_pos
;
351 reg_add
+= pmic_ddata
->sleep_req_info
[id
].reg_offset
;
353 ret
= palmas_update_bits(palmas
, PALMAS_RESOURCE_BASE
,
354 reg_add
, BIT(bit_pos
), BIT(bit_pos
));
356 ret
= palmas_update_bits(palmas
, PALMAS_RESOURCE_BASE
,
357 reg_add
, BIT(bit_pos
), 0);
359 dev_err(palmas
->dev
, "Resource reg 0x%02x update failed %d\n",
364 /* Unmask the PREQ */
365 ret
= palmas_update_bits(palmas
, PALMAS_PMU_CONTROL_BASE
,
366 PALMAS_POWER_CTRL
, BIT(preq_mask_bit
), 0);
368 dev_err(palmas
->dev
, "POWER_CTRL register update failed %d\n",
374 EXPORT_SYMBOL_GPL(palmas_ext_control_req_config
);
376 static int palmas_set_pdata_irq_flag(struct i2c_client
*i2c
,
377 struct palmas_platform_data
*pdata
)
379 struct irq_data
*irq_data
= irq_get_irq_data(i2c
->irq
);
381 dev_err(&i2c
->dev
, "Invalid IRQ: %d\n", i2c
->irq
);
385 pdata
->irq_flags
= irqd_get_trigger_type(irq_data
);
386 dev_info(&i2c
->dev
, "Irq flag is 0x%08x\n", pdata
->irq_flags
);
390 static void palmas_dt_to_pdata(struct i2c_client
*i2c
,
391 struct palmas_platform_data
*pdata
)
393 struct device_node
*node
= i2c
->dev
.of_node
;
397 ret
= of_property_read_u32(node
, "ti,mux-pad1", &prop
);
399 pdata
->mux_from_pdata
= 1;
403 ret
= of_property_read_u32(node
, "ti,mux-pad2", &prop
);
405 pdata
->mux_from_pdata
= 1;
409 /* The default for this register is all masked */
410 ret
= of_property_read_u32(node
, "ti,power-ctrl", &prop
);
412 pdata
->power_ctrl
= prop
;
414 pdata
->power_ctrl
= PALMAS_POWER_CTRL_NSLEEP_MASK
|
415 PALMAS_POWER_CTRL_ENABLE1_MASK
|
416 PALMAS_POWER_CTRL_ENABLE2_MASK
;
418 palmas_set_pdata_irq_flag(i2c
, pdata
);
420 pdata
->pm_off
= of_property_read_bool(node
,
421 "ti,system-power-controller");
424 static struct palmas
*palmas_dev
;
425 static void palmas_power_off(void)
430 struct device_node
*np
= palmas_dev
->dev
->of_node
;
432 if (of_property_read_bool(np
, "ti,palmas-override-powerhold")) {
433 addr
= PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE
,
434 PALMAS_PRIMARY_SECONDARY_PAD2
);
435 slave
= PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE
);
437 if (of_device_is_compatible(np
, "ti,tps65917"))
439 TPS65917_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK
;
442 PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK
;
444 ret
= regmap_update_bits(palmas_dev
->regmap
[slave
], addr
,
447 dev_err(palmas_dev
->dev
,
448 "Unable to write PRIMARY_SECONDARY_PAD2 %d\n",
452 slave
= PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE
);
453 addr
= PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE
, PALMAS_DEV_CTRL
);
455 ret
= regmap_update_bits(
456 palmas_dev
->regmap
[slave
],
458 PALMAS_DEV_CTRL_DEV_ON
,
462 pr_err("%s: Unable to write to DEV_CTRL_DEV_ON: %d\n",
466 struct palmas_driver_data
{
467 unsigned int features
;
468 const struct regmap_irq_chip
*irq_chip
;
471 static const struct palmas_driver_data palmas_data
= {
472 .features
= PALMAS_PMIC_FEATURE_SMPS10_BOOST
,
473 .irq_chip
= &palmas_irq_chip
,
476 static const struct palmas_driver_data tps659038_data
= {
477 .irq_chip
= &palmas_irq_chip
,
480 static const struct palmas_driver_data tps65917_data
= {
481 .irq_chip
= &tps65917_irq_chip
,
484 static int palmas_i2c_probe(struct i2c_client
*i2c
)
486 struct palmas
*palmas
;
487 struct palmas_platform_data
*pdata
;
488 const struct palmas_driver_data
*driver_data
;
489 struct device_node
*node
= i2c
->dev
.of_node
;
491 unsigned int reg
, addr
;
494 pdata
= dev_get_platdata(&i2c
->dev
);
496 if (node
&& !pdata
) {
497 pdata
= devm_kzalloc(&i2c
->dev
, sizeof(*pdata
), GFP_KERNEL
);
502 palmas_dt_to_pdata(i2c
, pdata
);
508 palmas
= devm_kzalloc(&i2c
->dev
, sizeof(struct palmas
), GFP_KERNEL
);
512 i2c_set_clientdata(i2c
, palmas
);
513 palmas
->dev
= &i2c
->dev
;
514 palmas
->irq
= i2c
->irq
;
516 driver_data
= i2c_get_match_data(i2c
);
517 palmas
->features
= driver_data
->features
;
519 for (i
= 0; i
< PALMAS_NUM_CLIENTS
; i
++) {
521 palmas
->i2c_clients
[i
] = i2c
;
523 palmas
->i2c_clients
[i
] =
524 i2c_new_dummy_device(i2c
->adapter
,
526 if (IS_ERR(palmas
->i2c_clients
[i
])) {
528 "can't attach client %d\n", i
);
529 ret
= PTR_ERR(palmas
->i2c_clients
[i
]);
532 palmas
->i2c_clients
[i
]->dev
.of_node
= of_node_get(node
);
534 palmas
->regmap
[i
] = devm_regmap_init_i2c(palmas
->i2c_clients
[i
],
535 &palmas_regmap_config
[i
]);
536 if (IS_ERR(palmas
->regmap
[i
])) {
537 ret
= PTR_ERR(palmas
->regmap
[i
]);
539 "Failed to allocate regmap %d, err: %d\n",
546 dev_warn(palmas
->dev
, "IRQ missing: skipping irq request\n");
550 /* Change interrupt line output polarity */
551 if (pdata
->irq_flags
& IRQ_TYPE_LEVEL_HIGH
)
552 reg
= PALMAS_POLARITY_CTRL_INT_POLARITY
;
555 ret
= palmas_update_bits(palmas
, PALMAS_PU_PD_OD_BASE
,
556 PALMAS_POLARITY_CTRL
, PALMAS_POLARITY_CTRL_INT_POLARITY
,
559 dev_err(palmas
->dev
, "POLARITY_CTRL update failed: %d\n", ret
);
563 /* Change IRQ into clear on read mode for efficiency */
564 slave
= PALMAS_BASE_TO_SLAVE(PALMAS_INTERRUPT_BASE
);
565 addr
= PALMAS_BASE_TO_REG(PALMAS_INTERRUPT_BASE
, PALMAS_INT_CTRL
);
566 reg
= PALMAS_INT_CTRL_INT_CLEAR
;
568 regmap_write(palmas
->regmap
[slave
], addr
, reg
);
570 ret
= regmap_add_irq_chip(palmas
->regmap
[slave
], palmas
->irq
,
571 IRQF_ONESHOT
| pdata
->irq_flags
, 0,
572 driver_data
->irq_chip
, &palmas
->irq_data
);
577 slave
= PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE
);
578 addr
= PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE
,
579 PALMAS_PRIMARY_SECONDARY_PAD1
);
581 if (pdata
->mux_from_pdata
) {
583 ret
= regmap_write(palmas
->regmap
[slave
], addr
, reg
);
587 ret
= regmap_read(palmas
->regmap
[slave
], addr
, ®
);
592 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_0
))
593 palmas
->gpio_muxed
|= PALMAS_GPIO_0_MUXED
;
594 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK
))
595 palmas
->gpio_muxed
|= PALMAS_GPIO_1_MUXED
;
596 else if ((reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK
) ==
597 (2 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT
))
598 palmas
->led_muxed
|= PALMAS_LED1_MUXED
;
599 else if ((reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_MASK
) ==
600 (3 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_1_SHIFT
))
601 palmas
->pwm_muxed
|= PALMAS_PWM1_MUXED
;
602 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK
))
603 palmas
->gpio_muxed
|= PALMAS_GPIO_2_MUXED
;
604 else if ((reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK
) ==
605 (2 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT
))
606 palmas
->led_muxed
|= PALMAS_LED2_MUXED
;
607 else if ((reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_MASK
) ==
608 (3 << PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_2_SHIFT
))
609 palmas
->pwm_muxed
|= PALMAS_PWM2_MUXED
;
610 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD1_GPIO_3
))
611 palmas
->gpio_muxed
|= PALMAS_GPIO_3_MUXED
;
613 addr
= PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE
,
614 PALMAS_PRIMARY_SECONDARY_PAD2
);
616 if (pdata
->mux_from_pdata
) {
618 ret
= regmap_write(palmas
->regmap
[slave
], addr
, reg
);
622 ret
= regmap_read(palmas
->regmap
[slave
], addr
, ®
);
627 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_4
))
628 palmas
->gpio_muxed
|= PALMAS_GPIO_4_MUXED
;
629 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_5_MASK
))
630 palmas
->gpio_muxed
|= PALMAS_GPIO_5_MUXED
;
631 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_6
))
632 palmas
->gpio_muxed
|= PALMAS_GPIO_6_MUXED
;
633 if (!(reg
& PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK
))
634 palmas
->gpio_muxed
|= PALMAS_GPIO_7_MUXED
;
636 dev_info(palmas
->dev
, "Muxing GPIO %x, PWM %x, LED %x\n",
637 palmas
->gpio_muxed
, palmas
->pwm_muxed
,
640 reg
= pdata
->power_ctrl
;
642 slave
= PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE
);
643 addr
= PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE
, PALMAS_POWER_CTRL
);
645 ret
= regmap_write(palmas
->regmap
[slave
], addr
, reg
);
650 * If we are probing with DT do this the DT way and return here
651 * otherwise continue and add devices using mfd helpers.
654 ret
= devm_of_platform_populate(&i2c
->dev
);
657 } else if (pdata
->pm_off
&& !pm_power_off
) {
659 pm_power_off
= palmas_power_off
;
666 regmap_del_irq_chip(palmas
->irq
, palmas
->irq_data
);
668 for (i
= 1; i
< PALMAS_NUM_CLIENTS
; i
++) {
669 if (palmas
->i2c_clients
[i
])
670 i2c_unregister_device(palmas
->i2c_clients
[i
]);
675 static void palmas_i2c_remove(struct i2c_client
*i2c
)
677 struct palmas
*palmas
= i2c_get_clientdata(i2c
);
680 regmap_del_irq_chip(palmas
->irq
, palmas
->irq_data
);
682 for (i
= 1; i
< PALMAS_NUM_CLIENTS
; i
++) {
683 if (palmas
->i2c_clients
[i
])
684 i2c_unregister_device(palmas
->i2c_clients
[i
]);
687 if (palmas
== palmas_dev
) {
693 static const struct of_device_id of_palmas_match_tbl
[] = {
694 { .compatible
= "ti,palmas", .data
= &palmas_data
},
695 { .compatible
= "ti,tps659038", .data
= &tps659038_data
},
696 { .compatible
= "ti,tps65917", .data
= &tps65917_data
},
699 MODULE_DEVICE_TABLE(of
, of_palmas_match_tbl
);
701 static const struct i2c_device_id palmas_i2c_id
[] = {
702 { "palmas", (kernel_ulong_t
)&palmas_data
},
703 { "twl6035", (kernel_ulong_t
)&palmas_data
},
704 { "twl6037", (kernel_ulong_t
)&palmas_data
},
705 { "tps65913", (kernel_ulong_t
)&palmas_data
},
708 MODULE_DEVICE_TABLE(i2c
, palmas_i2c_id
);
710 static struct i2c_driver palmas_i2c_driver
= {
713 .of_match_table
= of_palmas_match_tbl
,
715 .probe
= palmas_i2c_probe
,
716 .remove
= palmas_i2c_remove
,
717 .id_table
= palmas_i2c_id
,
720 static int __init
palmas_i2c_init(void)
722 return i2c_add_driver(&palmas_i2c_driver
);
724 /* init early so consumer devices can complete system boot */
725 subsys_initcall(palmas_i2c_init
);
727 static void __exit
palmas_i2c_exit(void)
729 i2c_del_driver(&palmas_i2c_driver
);
731 module_exit(palmas_i2c_exit
);
733 MODULE_AUTHOR("Graeme Gregory <gg@slimlogic.co.uk>");
734 MODULE_DESCRIPTION("Palmas chip family multi-function driver");
735 MODULE_LICENSE("GPL");