Skip to content

Commit 44760cf

Browse files
John CrispinLee Jones
authored andcommitted
mfd: mt6397: Add MT6323 support to MT6397 driver
Signed-off-by: John Crispin <blogic@openwrt.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 1d2c25e commit 44760cf

3 files changed

Lines changed: 464 additions & 0 deletions

File tree

‎drivers/mfd/mt6397-core.c‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@
1919
#include <linux/regmap.h>
2020
#include <linux/mfd/core.h>
2121
#include <linux/mfd/mt6397/core.h>
22+
#include <linux/mfd/mt6323/core.h>
2223
#include <linux/mfd/mt6397/registers.h>
24+
#include <linux/mfd/mt6323/registers.h>
2325

2426
#define MT6397_RTC_BASE 0xe000
2527
#define MT6397_RTC_SIZE 0x3e
2628

29+
#define MT6323_CID_CODE 0x23
2730
#define MT6391_CID_CODE 0x91
2831
#define MT6397_CID_CODE 0x97
2932

@@ -40,6 +43,13 @@ static const struct resource mt6397_rtc_resources[] = {
4043
},
4144
};
4245

46+
static const struct mfd_cell mt6323_devs[] = {
47+
{
48+
.name = "mt6323-regulator",
49+
.of_compatible = "mediatek,mt6323-regulator"
50+
},
51+
};
52+
4353
static const struct mfd_cell mt6397_devs[] = {
4454
{
4555
.name = "mt6397-rtc",
@@ -261,6 +271,15 @@ static int mt6397_probe(struct platform_device *pdev)
261271
}
262272

263273
switch (id & 0xff) {
274+
case MT6323_CID_CODE:
275+
pmic->int_con[0] = MT6323_INT_CON0;
276+
pmic->int_con[1] = MT6323_INT_CON1;
277+
pmic->int_status[0] = MT6323_INT_STATUS0;
278+
pmic->int_status[1] = MT6323_INT_STATUS1;
279+
ret = mfd_add_devices(&pdev->dev, -1, mt6323_devs,
280+
ARRAY_SIZE(mt6323_devs), NULL, 0, NULL);
281+
break;
282+
264283
case MT6397_CID_CODE:
265284
case MT6391_CID_CODE:
266285
pmic->int_con[0] = MT6397_INT_CON0;
@@ -302,6 +321,7 @@ static int mt6397_remove(struct platform_device *pdev)
302321

303322
static const struct of_device_id mt6397_of_match[] = {
304323
{ .compatible = "mediatek,mt6397" },
324+
{ .compatible = "mediatek,mt6323" },
305325
{ }
306326
};
307327
MODULE_DEVICE_TABLE(of, mt6397_of_match);

‎include/linux/mfd/mt6323/core.h‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* Copyright (c) 2016 Chen Zhong <chen.zhong@mediatek.com>
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
7+
*/
8+
9+
#ifndef __MFD_MT6323_CORE_H__
10+
#define __MFD_MT6323_CORE_H__
11+
12+
enum MT6323_IRQ_STATUS_numbers {
13+
MT6323_IRQ_STATUS_SPKL_AB = 0,
14+
MT6323_IRQ_STATUS_SPKL,
15+
MT6323_IRQ_STATUS_BAT_L,
16+
MT6323_IRQ_STATUS_BAT_H,
17+
MT6323_IRQ_STATUS_WATCHDOG,
18+
MT6323_IRQ_STATUS_PWRKEY,
19+
MT6323_IRQ_STATUS_THR_L,
20+
MT6323_IRQ_STATUS_THR_H,
21+
MT6323_IRQ_STATUS_VBATON_UNDET,
22+
MT6323_IRQ_STATUS_BVALID_DET,
23+
MT6323_IRQ_STATUS_CHRDET,
24+
MT6323_IRQ_STATUS_OV,
25+
MT6323_IRQ_STATUS_LDO = 16,
26+
MT6323_IRQ_STATUS_FCHRKEY,
27+
MT6323_IRQ_STATUS_ACCDET,
28+
MT6323_IRQ_STATUS_AUDIO,
29+
MT6323_IRQ_STATUS_RTC,
30+
MT6323_IRQ_STATUS_VPROC,
31+
MT6323_IRQ_STATUS_VSYS,
32+
MT6323_IRQ_STATUS_VPA,
33+
MT6323_IRQ_STATUS_NR,
34+
};
35+
36+
#endif /* __MFD_MT6323_CORE_H__ */

0 commit comments

Comments
 (0)