Skip to content

Commit a095068

Browse files
akku1139lag-linaro
authored andcommitted
mfd: mt6397: Properly fix CID of MT6328, MT6331 and MT6332
CIDs set for MT6328, MT6331 and MT6332 are not appropriate. Many Android downstream kernels define CID as below, MT6328: #define PMIC6328_E1_CID_CODE 0x2810 #define PMIC6328_E2_CID_CODE 0x2820 #define PMIC6328_E3_CID_CODE 0x2830 MT6331/MT6332: #define PMIC6331_E1_CID_CODE 0x3110 #define PMIC6331_E2_CID_CODE 0x3120 #define PMIC6331_E3_CID_CODE 0x3130 #define PMIC6332_E1_CID_CODE 0x3210 #define PMIC6332_E2_CID_CODE 0x3220 #define PMIC6332_E3_CID_CODE 0x3230 The current configuration incorrectly uses the revision code as the CID. Therefore, the driver cannot detect the same PMIC of different revisions. (E1/E2 for MT6328, E1/E3 for MT6331/MT6332) Based on these, the CID of MT6328, MT6331 and MT6332 should be corrected. Additionally, the incorrect MT6331/MT6332 CID overlaps with the MT6320's actual CID: #define PMIC6320_E1_CID_CODE 0x1020 #define PMIC6320_E2_CID_CODE 0x2020 This causes a conflict in the switch-case statement of mt6397-irq.c, this prevents adding support for MT6320. Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Link: https://patch.msgid.link/20260302140045.651727-1-akkun11.open@gmail.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 0995118 commit a095068

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/mfd/mt6397-core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ static const struct chip_data mt6323_core = {
297297

298298
static const struct chip_data mt6328_core = {
299299
.cid_addr = MT6328_HWCID,
300-
.cid_shift = 0,
300+
.cid_shift = 8,
301301
.cells = mt6328_devs,
302302
.cell_size = ARRAY_SIZE(mt6328_devs),
303303
.irq_init = mt6397_irq_init,
@@ -313,7 +313,7 @@ static const struct chip_data mt6357_core = {
313313

314314
static const struct chip_data mt6331_mt6332_core = {
315315
.cid_addr = MT6331_HWCID,
316-
.cid_shift = 0,
316+
.cid_shift = 8,
317317
.cells = mt6331_mt6332_devs,
318318
.cell_size = ARRAY_SIZE(mt6331_mt6332_devs),
319319
.irq_init = mt6397_irq_init,

include/linux/mfd/mt6397/core.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212

1313
enum chip_id {
1414
MT6323_CHIP_ID = 0x23,
15-
MT6328_CHIP_ID = 0x30,
16-
MT6331_CHIP_ID = 0x20,
17-
MT6332_CHIP_ID = 0x20,
15+
MT6328_CHIP_ID = 0x28,
16+
MT6331_CHIP_ID = 0x31,
17+
MT6332_CHIP_ID = 0x32,
1818
MT6357_CHIP_ID = 0x57,
1919
MT6358_CHIP_ID = 0x58,
2020
MT6359_CHIP_ID = 0x59,

0 commit comments

Comments
 (0)