mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 08:01:59 +00:00
extcon: MAX77693: Add platform data for MUIC device to initialize registers
This patch add platform data for MUIC device to initialize register on probe() call because it should unmask interrupt mask register and initialize some register related to MUIC device. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
This commit is contained in:
parent
bf2627d66d
commit
f8457d574f
@ -651,6 +651,8 @@ out:
|
||||
static int __devinit max77693_muic_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct max77693_dev *max77693 = dev_get_drvdata(pdev->dev.parent);
|
||||
struct max77693_platform_data *pdata = dev_get_platdata(max77693->dev);
|
||||
struct max77693_muic_platform_data *muic_pdata = pdata->muic_data;
|
||||
struct max77693_muic_info *info;
|
||||
int ret, i;
|
||||
u8 id;
|
||||
@ -721,6 +723,31 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
|
||||
goto err_extcon;
|
||||
}
|
||||
|
||||
/* Initialize MUIC register by using platform data */
|
||||
for (i = 0 ; i < muic_pdata->num_init_data ; i++) {
|
||||
enum max77693_irq_source irq_src = MAX77693_IRQ_GROUP_NR;
|
||||
|
||||
max77693_write_reg(info->max77693->regmap_muic,
|
||||
muic_pdata->init_data[i].addr,
|
||||
muic_pdata->init_data[i].data);
|
||||
|
||||
switch (muic_pdata->init_data[i].addr) {
|
||||
case MAX77693_MUIC_REG_INTMASK1:
|
||||
irq_src = MUIC_INT1;
|
||||
break;
|
||||
case MAX77693_MUIC_REG_INTMASK2:
|
||||
irq_src = MUIC_INT2;
|
||||
break;
|
||||
case MAX77693_MUIC_REG_INTMASK3:
|
||||
irq_src = MUIC_INT3;
|
||||
break;
|
||||
}
|
||||
|
||||
if (irq_src < MAX77693_IRQ_GROUP_NR)
|
||||
info->max77693->irq_masks_cur[irq_src]
|
||||
= muic_pdata->init_data[i].data;
|
||||
}
|
||||
|
||||
/* Check revision number of MUIC device*/
|
||||
ret = max77693_read_reg(info->max77693->regmap_muic,
|
||||
MAX77693_MUIC_REG_ID, &id);
|
||||
|
@ -30,7 +30,20 @@
|
||||
#ifndef __LINUX_MFD_MAX77693_H
|
||||
#define __LINUX_MFD_MAX77693_H
|
||||
|
||||
struct max77693_reg_data {
|
||||
u8 addr;
|
||||
u8 data;
|
||||
};
|
||||
|
||||
struct max77693_muic_platform_data {
|
||||
struct max77693_reg_data *init_data;
|
||||
int num_init_data;
|
||||
};
|
||||
|
||||
struct max77693_platform_data {
|
||||
int wakeup;
|
||||
|
||||
/* muic data */
|
||||
struct max77693_muic_platform_data *muic_data;
|
||||
};
|
||||
#endif /* __LINUX_MFD_MAX77693_H */
|
||||
|
Loading…
Reference in New Issue
Block a user