Commit f8457d57 authored by Chanwoo Choi's avatar Chanwoo Choi Committed by MyungJoo Ham

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: default avatarChanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: default avatarMyungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
parent bf2627d6
......@@ -651,6 +651,8 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info)
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 */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment