2018-08-30 16:52:54 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2014-06-03 05:26:02 +00:00
|
|
|
/*
|
2018-08-30 16:52:54 +00:00
|
|
|
* Intel SoC PMIC Driver
|
2014-06-03 05:26:02 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
|
|
|
|
*
|
|
|
|
* Author: Yang, Bin <bin.yang@intel.com>
|
|
|
|
* Author: Zhu, Lejun <lejun.zhu@linux.intel.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INTEL_SOC_PMIC_H__
|
|
|
|
#define __INTEL_SOC_PMIC_H__
|
|
|
|
|
|
|
|
#include <linux/regmap.h>
|
|
|
|
|
2020-04-16 08:15:42 +00:00
|
|
|
/**
|
|
|
|
* struct intel_soc_pmic - Intel SoC PMIC data
|
|
|
|
* @irq: Master interrupt number of the parent PMIC device
|
|
|
|
* @regmap: Pointer to the parent PMIC device regmap structure
|
|
|
|
* @irq_chip_data: IRQ chip data for the PMIC itself
|
|
|
|
* @irq_chip_data_pwrbtn: Chained IRQ chip data for the Power Button
|
|
|
|
* @irq_chip_data_tmu: Chained IRQ chip data for the Time Management Unit
|
|
|
|
* @irq_chip_data_bcu: Chained IRQ chip data for the Burst Control Unit
|
|
|
|
* @irq_chip_data_adc: Chained IRQ chip data for the General Purpose ADC
|
|
|
|
* @irq_chip_data_chgr: Chained IRQ chip data for the External Charger
|
|
|
|
* @irq_chip_data_crit: Chained IRQ chip data for the Critical Event Handler
|
|
|
|
* @dev: Pointer to the parent PMIC device
|
|
|
|
* @scu: Pointer to the SCU IPC device data structure
|
|
|
|
*/
|
2014-06-03 05:26:02 +00:00
|
|
|
struct intel_soc_pmic {
|
|
|
|
int irq;
|
|
|
|
struct regmap *regmap;
|
|
|
|
struct regmap_irq_chip_data *irq_chip_data;
|
2018-08-30 16:52:52 +00:00
|
|
|
struct regmap_irq_chip_data *irq_chip_data_pwrbtn;
|
2016-11-07 20:11:47 +00:00
|
|
|
struct regmap_irq_chip_data *irq_chip_data_tmu;
|
mfd: intel_soc_pmic_bxtwc: Use chained IRQs for second level IRQ chips
Whishkey cove PMIC has support to mask/unmask interrupts at two levels.
At first level we can mask/unmask interrupt domains like TMU, GPIO, ADC,
CHGR, BCU THERMAL and PWRBTN and at second level, it provides facility
to mask/unmask individual interrupts belong each of this domain. For
example, in case of TMU, at first level we have TMU interrupt domain,
and at second level we have two interrupts, wake alarm, system alarm that
belong to the TMU interrupt domain.
Currently, in this driver all first level IRQs are registered as part of
IRQ chip(bxtwc_regmap_irq_chip). By default, after you register the IRQ
chip from your driver, all IRQs in that chip will masked and can only be
enabled if that IRQ is requested using request_irq() call. This is the
default Linux IRQ behavior model. And whenever a dependent device that
belongs to PMIC requests only the second level IRQ and not explicitly
unmask the first level IRQ, then in essence the second level IRQ will
still be disabled. For example, if TMU device driver request wake_alarm
IRQ and not explicitly unmask TMU level 1 IRQ then according to the default
Linux IRQ model, wake_alarm IRQ will still be disabled. So the proper
solution to fix this issue is to use the chained IRQ chip concept. We
should chain all the second level chip IRQs to the corresponding first
level IRQ. To do this, we need to create separate IRQ chips for every
group of second level IRQs.
In case of TMU, when adding second level IRQ chip, instead of using PMIC
IRQ we should use the corresponding first level IRQ. So the following
code will change from
ret = regmap_add_irq_chip(pmic->regmap, pmic->irq, ...)
to,
virq = regmap_irq_get_virq(&pmic->irq_chip_data, BXTWC_TMU_LVL1_IRQ);
ret = regmap_add_irq_chip(pmic->regmap, virq, ...)
In case of Whiskey Cove Type-C driver, Since USBC IRQ is moved under
charger level2 IRQ chip. We should use charger IRQ chip(irq_chip_data_chgr)
to get the USBC virtual IRQ number.
Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Revieved-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2017-06-05 19:08:05 +00:00
|
|
|
struct regmap_irq_chip_data *irq_chip_data_bcu;
|
|
|
|
struct regmap_irq_chip_data *irq_chip_data_adc;
|
|
|
|
struct regmap_irq_chip_data *irq_chip_data_chgr;
|
|
|
|
struct regmap_irq_chip_data *irq_chip_data_crit;
|
2015-09-14 16:39:18 +00:00
|
|
|
struct device *dev;
|
2020-04-16 08:15:42 +00:00
|
|
|
struct intel_scu_ipc_dev *scu;
|
2014-06-03 05:26:02 +00:00
|
|
|
};
|
|
|
|
|
2019-01-07 11:15:53 +00:00
|
|
|
int intel_soc_pmic_exec_mipi_pmic_seq_element(u16 i2c_address, u32 reg_address,
|
|
|
|
u32 value, u32 mask);
|
|
|
|
|
2014-06-03 05:26:02 +00:00
|
|
|
#endif /* __INTEL_SOC_PMIC_H__ */
|