2019-05-27 14:55:21 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-02-22 20:15:29 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2014 MediaTek Inc.
|
|
|
|
* Author: Flora Fu, MediaTek
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MFD_MT6397_CORE_H__
|
|
|
|
#define __MFD_MT6397_CORE_H__
|
|
|
|
|
2019-08-18 21:56:04 +08:00
|
|
|
#include <linux/mutex.h>
|
2020-04-21 11:00:07 +08:00
|
|
|
#include <linux/notifier.h>
|
2019-08-18 21:56:04 +08:00
|
|
|
|
2019-08-05 13:21:50 +08:00
|
|
|
enum chip_id {
|
|
|
|
MT6323_CHIP_ID = 0x23,
|
2020-04-21 11:00:10 +08:00
|
|
|
MT6358_CHIP_ID = 0x58,
|
2021-05-26 14:52:04 +08:00
|
|
|
MT6359_CHIP_ID = 0x59,
|
2019-08-05 13:21:50 +08:00
|
|
|
MT6391_CHIP_ID = 0x91,
|
|
|
|
MT6397_CHIP_ID = 0x97,
|
|
|
|
};
|
|
|
|
|
2015-02-22 20:15:29 +08:00
|
|
|
enum mt6397_irq_numbers {
|
|
|
|
MT6397_IRQ_SPKL_AB = 0,
|
|
|
|
MT6397_IRQ_SPKR_AB,
|
|
|
|
MT6397_IRQ_SPKL,
|
|
|
|
MT6397_IRQ_SPKR,
|
|
|
|
MT6397_IRQ_BAT_L,
|
|
|
|
MT6397_IRQ_BAT_H,
|
|
|
|
MT6397_IRQ_FG_BAT_L,
|
|
|
|
MT6397_IRQ_FG_BAT_H,
|
|
|
|
MT6397_IRQ_WATCHDOG,
|
|
|
|
MT6397_IRQ_PWRKEY,
|
|
|
|
MT6397_IRQ_THR_L,
|
|
|
|
MT6397_IRQ_THR_H,
|
|
|
|
MT6397_IRQ_VBATON_UNDET,
|
|
|
|
MT6397_IRQ_BVALID_DET,
|
|
|
|
MT6397_IRQ_CHRDET,
|
|
|
|
MT6397_IRQ_OV,
|
|
|
|
MT6397_IRQ_LDO,
|
|
|
|
MT6397_IRQ_HOMEKEY,
|
|
|
|
MT6397_IRQ_ACCDET,
|
|
|
|
MT6397_IRQ_AUDIO,
|
|
|
|
MT6397_IRQ_RTC,
|
|
|
|
MT6397_IRQ_PWRKEY_RSTB,
|
|
|
|
MT6397_IRQ_HDMI_SIFM,
|
|
|
|
MT6397_IRQ_HDMI_CEC,
|
|
|
|
MT6397_IRQ_VCA15,
|
|
|
|
MT6397_IRQ_VSRMCA15,
|
|
|
|
MT6397_IRQ_VCORE,
|
|
|
|
MT6397_IRQ_VGPU,
|
|
|
|
MT6397_IRQ_VIO18,
|
|
|
|
MT6397_IRQ_VPCA7,
|
|
|
|
MT6397_IRQ_VSRMCA7,
|
|
|
|
MT6397_IRQ_VDRM,
|
|
|
|
MT6397_IRQ_NR,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct mt6397_chip {
|
|
|
|
struct device *dev;
|
|
|
|
struct regmap *regmap;
|
2020-04-21 11:00:07 +08:00
|
|
|
struct notifier_block pm_nb;
|
2015-02-22 20:15:29 +08:00
|
|
|
int irq;
|
|
|
|
struct irq_domain *irq_domain;
|
|
|
|
struct mutex irqlock;
|
2015-08-10 21:10:45 +08:00
|
|
|
u16 wake_mask[2];
|
2015-02-22 20:15:29 +08:00
|
|
|
u16 irq_masks_cur[2];
|
|
|
|
u16 irq_masks_cache[2];
|
2016-01-27 19:47:36 +08:00
|
|
|
u16 int_con[2];
|
|
|
|
u16 int_status[2];
|
2019-08-05 13:21:50 +08:00
|
|
|
u16 chip_id;
|
2020-04-21 11:00:10 +08:00
|
|
|
void *irq_data;
|
2015-02-22 20:15:29 +08:00
|
|
|
};
|
|
|
|
|
2020-04-21 11:00:10 +08:00
|
|
|
int mt6358_irq_init(struct mt6397_chip *chip);
|
2019-08-05 13:21:50 +08:00
|
|
|
int mt6397_irq_init(struct mt6397_chip *chip);
|
|
|
|
|
2015-02-22 20:15:29 +08:00
|
|
|
#endif /* __MFD_MT6397_CORE_H__ */
|