Commit 16eb2bfc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'extcon-next-for-3.17' of...

Merge tag 'extcon-next-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for v3.17

This patchset add new extcon provider driver and fix minor issue of extcon driver.

Detailed description for patchset:
1. Add new Silicon-Mitus SM5502 MUIC (Micro-USB Interface Controller) device
- extcon-sm5502 driver  is capable of identifying the type of the external power
source and attached accessory. And external power sources, such as Dedicated
charger or a standard USB port, are able to charge the battery in the smart
phone via the connector.

2. Fix minor issue of extcon driver
- extcon-arizona driver
- extcon-palmas driver
- Remove unnecessary OOM messages for all extcon device drivers

3. Fix minor issue of extcon core
- Re-order the sequence of extcon device driver in Kconfig/Makefile alphabitically
- Set parent device of extcon device automatically using devm_extcon_dev_allocate()

4. Fix MAX77693 driver
- This patchset has dependency on MFD/Regulator/Extcon. So, Lee Jones
(MFD Maintainer) created Immutable branch between MFD and Extcon due
for v3.17 merge-window and then I merged this patchset from MFD git repo[1]
to Extcon git repo.
  [1] git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
  (branch: ib-mfd-extcon-regulator)
parents 7b9d1f0b d3b50314
* SM5502 MUIC (Micro-USB Interface Controller) device
The Silicon Mitus SM5502 is a MUIC (Micro-USB Interface Controller) device
which can detect the state of external accessory when external accessory is
attached or detached and button is pressed or released. It is interfaced to
the host controller using an I2C interface.
Required properties:
- compatible: Should be "siliconmitus,sm5502-muic"
- reg: Specifies the I2C slave address of the MUIC block. It should be 0x25
- interrupt-parent: Specifies the phandle of the interrupt controller to which
the interrupts from sm5502 are delivered to.
- interrupts: Interrupt specifiers for detection interrupt sources.
Example:
sm5502@25 {
compatible = "siliconmitus,sm5502-muic";
interrupt-parent = <&gpx1>;
interrupts = <5 0>;
reg = <0x25>;
};
...@@ -14,6 +14,20 @@ if EXTCON ...@@ -14,6 +14,20 @@ if EXTCON
comment "Extcon Device Drivers" comment "Extcon Device Drivers"
config EXTCON_ADC_JACK
tristate "ADC Jack extcon support"
depends on IIO
help
Say Y here to enable extcon device driver based on ADC values.
config EXTCON_ARIZONA
tristate "Wolfson Arizona EXTCON support"
depends on MFD_ARIZONA && INPUT && SND_SOC
help
Say Y here to enable support for external accessory detection
with Wolfson Arizona devices. These are audio CODECs with
advanced audio accessory detection support.
config EXTCON_GPIO config EXTCON_GPIO
tristate "GPIO extcon support" tristate "GPIO extcon support"
depends on GPIOLIB depends on GPIOLIB
...@@ -21,12 +35,6 @@ config EXTCON_GPIO ...@@ -21,12 +35,6 @@ config EXTCON_GPIO
Say Y here to enable GPIO based extcon support. Note that GPIO Say Y here to enable GPIO based extcon support. Note that GPIO
extcon supports single state per extcon instance. extcon supports single state per extcon instance.
config EXTCON_ADC_JACK
tristate "ADC Jack extcon support"
depends on IIO
help
Say Y here to enable extcon device driver based on ADC values.
config EXTCON_MAX14577 config EXTCON_MAX14577
tristate "MAX14577/77836 EXTCON Support" tristate "MAX14577/77836 EXTCON Support"
depends on MFD_MAX14577 depends on MFD_MAX14577
...@@ -55,14 +63,6 @@ config EXTCON_MAX8997 ...@@ -55,14 +63,6 @@ config EXTCON_MAX8997
Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
detector and switch. detector and switch.
config EXTCON_ARIZONA
tristate "Wolfson Arizona EXTCON support"
depends on MFD_ARIZONA && INPUT && SND_SOC
help
Say Y here to enable support for external accessory detection
with Wolfson Arizona devices. These are audio CODECs with
advanced audio accessory detection support.
config EXTCON_PALMAS config EXTCON_PALMAS
tristate "Palmas USB EXTCON support" tristate "Palmas USB EXTCON support"
depends on MFD_PALMAS depends on MFD_PALMAS
...@@ -70,4 +70,14 @@ config EXTCON_PALMAS ...@@ -70,4 +70,14 @@ config EXTCON_PALMAS
Say Y here to enable support for USB peripheral and USB host Say Y here to enable support for USB peripheral and USB host
detection by palmas usb. detection by palmas usb.
config EXTCON_SM5502
tristate "SM5502 EXTCON support"
select IRQ_DOMAIN
select REGMAP_I2C
select REGMAP_IRQ
help
If you say yes here you get support for the MUIC device of
Silicon Mitus SM5502. The SM5502 is a USB port accessory
detector and switch.
endif # MULTISTATE_SWITCH endif # MULTISTATE_SWITCH
#
# Makefile for external connector class (extcon) devices # Makefile for external connector class (extcon) devices
# #
obj-$(CONFIG_EXTCON) += extcon-class.o obj-$(CONFIG_EXTCON) += extcon-class.o
obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o
obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o obj-$(CONFIG_EXTCON_ADC_JACK) += extcon-adc-jack.o
obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o
obj-$(CONFIG_EXTCON_GPIO) += extcon-gpio.o
obj-$(CONFIG_EXTCON_MAX14577) += extcon-max14577.o obj-$(CONFIG_EXTCON_MAX14577) += extcon-max14577.o
obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o
obj-$(CONFIG_EXTCON_MAX8997) += extcon-max8997.o obj-$(CONFIG_EXTCON_MAX8997) += extcon-max8997.o
obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o
obj-$(CONFIG_EXTCON_PALMAS) += extcon-palmas.o obj-$(CONFIG_EXTCON_PALMAS) += extcon-palmas.o
obj-$(CONFIG_EXTCON_SM5502) += extcon-sm5502.o
...@@ -112,7 +112,6 @@ static int adc_jack_probe(struct platform_device *pdev) ...@@ -112,7 +112,6 @@ static int adc_jack_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to allocate extcon device\n"); dev_err(&pdev->dev, "failed to allocate extcon device\n");
return -ENOMEM; return -ENOMEM;
} }
data->edev->dev.parent = &pdev->dev;
data->edev->name = pdata->name; data->edev->name = pdata->name;
/* Check the length of array and set num_cables */ /* Check the length of array and set num_cables */
......
...@@ -39,6 +39,11 @@ ...@@ -39,6 +39,11 @@
#define ARIZONA_ACCDET_MODE_HPL 1 #define ARIZONA_ACCDET_MODE_HPL 1
#define ARIZONA_ACCDET_MODE_HPR 2 #define ARIZONA_ACCDET_MODE_HPR 2
#define ARIZONA_MICD_CLAMP_MODE_JDL 0x4
#define ARIZONA_MICD_CLAMP_MODE_JDH 0x5
#define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9
#define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb
#define ARIZONA_HPDET_MAX 10000 #define ARIZONA_HPDET_MAX 10000
#define HPDET_DEBOUNCE 500 #define HPDET_DEBOUNCE 500
...@@ -324,14 +329,17 @@ static void arizona_stop_mic(struct arizona_extcon_info *info) ...@@ -324,14 +329,17 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
} }
static struct { static struct {
unsigned int threshold;
unsigned int factor_a; unsigned int factor_a;
unsigned int factor_b; unsigned int factor_b;
} arizona_hpdet_b_ranges[] = { } arizona_hpdet_b_ranges[] = {
{ 5528, 362464 }, { 100, 5528, 362464 },
{ 11084, 6186851 }, { 169, 11084, 6186851 },
{ 11065, 65460395 }, { 169, 11065, 65460395 },
}; };
#define ARIZONA_HPDET_B_RANGE_MAX 0x3fb
static struct { static struct {
int min; int min;
int max; int max;
...@@ -386,7 +394,8 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info) ...@@ -386,7 +394,8 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
>> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT; >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT;
if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 && if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 &&
(val < 100 || val >= 0x3fb)) { (val < arizona_hpdet_b_ranges[range].threshold ||
val >= ARIZONA_HPDET_B_RANGE_MAX)) {
range++; range++;
dev_dbg(arizona->dev, "Moving to HPDET range %d\n", dev_dbg(arizona->dev, "Moving to HPDET range %d\n",
range); range);
...@@ -399,7 +408,8 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info) ...@@ -399,7 +408,8 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
} }
/* If we go out of range report top of range */ /* If we go out of range report top of range */
if (val < 100 || val >= 0x3fb) { if (val < arizona_hpdet_b_ranges[range].threshold ||
val >= ARIZONA_HPDET_B_RANGE_MAX) {
dev_dbg(arizona->dev, "Measurement out of range\n"); dev_dbg(arizona->dev, "Measurement out of range\n");
return ARIZONA_HPDET_MAX; return ARIZONA_HPDET_MAX;
} }
...@@ -664,9 +674,8 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info) ...@@ -664,9 +674,8 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info)
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
/* Just report headphone */ /* Just report headphone */
ret = extcon_update_state(info->edev, ret = extcon_set_cable_state_(info->edev,
1 << ARIZONA_CABLE_HEADPHONE, ARIZONA_CABLE_HEADPHONE, true);
1 << ARIZONA_CABLE_HEADPHONE);
if (ret != 0) if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret); dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
...@@ -723,9 +732,8 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info) ...@@ -723,9 +732,8 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info)
ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);
/* Just report headphone */ /* Just report headphone */
ret = extcon_update_state(info->edev, ret = extcon_set_cable_state_(info->edev,
1 << ARIZONA_CABLE_HEADPHONE, ARIZONA_CABLE_HEADPHONE, true);
1 << ARIZONA_CABLE_HEADPHONE);
if (ret != 0) if (ret != 0)
dev_err(arizona->dev, "Failed to report headphone: %d\n", ret); dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);
...@@ -812,16 +820,15 @@ static void arizona_micd_detect(struct work_struct *work) ...@@ -812,16 +820,15 @@ static void arizona_micd_detect(struct work_struct *work)
if (info->detecting && (val & ARIZONA_MICD_LVL_8)) { if (info->detecting && (val & ARIZONA_MICD_LVL_8)) {
arizona_identify_headphone(info); arizona_identify_headphone(info);
ret = extcon_update_state(info->edev, ret = extcon_set_cable_state_(info->edev,
1 << ARIZONA_CABLE_MICROPHONE, ARIZONA_CABLE_MICROPHONE, true);
1 << ARIZONA_CABLE_MICROPHONE);
if (ret != 0) if (ret != 0)
dev_err(arizona->dev, "Headset report failed: %d\n", dev_err(arizona->dev, "Headset report failed: %d\n",
ret); ret);
/* Don't need to regulate for button detection */ /* Don't need to regulate for button detection */
ret = regulator_allow_bypass(info->micvdd, false); ret = regulator_allow_bypass(info->micvdd, true);
if (ret != 0) { if (ret != 0) {
dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n", dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n",
ret); ret);
...@@ -962,10 +969,16 @@ static irqreturn_t arizona_jackdet(int irq, void *data) ...@@ -962,10 +969,16 @@ static irqreturn_t arizona_jackdet(int irq, void *data)
if (arizona->pdata.jd_gpio5) { if (arizona->pdata.jd_gpio5) {
mask = ARIZONA_MICD_CLAMP_STS; mask = ARIZONA_MICD_CLAMP_STS;
present = 0; if (arizona->pdata.jd_invert)
present = ARIZONA_MICD_CLAMP_STS;
else
present = 0;
} else { } else {
mask = ARIZONA_JD1_STS; mask = ARIZONA_JD1_STS;
present = ARIZONA_JD1_STS; if (arizona->pdata.jd_invert)
present = 0;
else
present = ARIZONA_JD1_STS;
} }
ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val); ret = regmap_read(arizona->regmap, ARIZONA_AOD_IRQ_RAW_STATUS, &val);
...@@ -1096,6 +1109,7 @@ static int arizona_extcon_probe(struct platform_device *pdev) ...@@ -1096,6 +1109,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
struct arizona_pdata *pdata = &arizona->pdata; struct arizona_pdata *pdata = &arizona->pdata;
struct arizona_extcon_info *info; struct arizona_extcon_info *info;
unsigned int val; unsigned int val;
unsigned int clamp_mode;
int jack_irq_fall, jack_irq_rise; int jack_irq_fall, jack_irq_rise;
int ret, mode, i, j; int ret, mode, i, j;
...@@ -1103,12 +1117,10 @@ static int arizona_extcon_probe(struct platform_device *pdev) ...@@ -1103,12 +1117,10 @@ static int arizona_extcon_probe(struct platform_device *pdev)
return -EPROBE_DEFER; return -EPROBE_DEFER;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info) { if (!info)
dev_err(&pdev->dev, "Failed to allocate memory\n");
return -ENOMEM; return -ENOMEM;
}
info->micvdd = devm_regulator_get(arizona->dev, "MICVDD"); info->micvdd = devm_regulator_get(&pdev->dev, "MICVDD");
if (IS_ERR(info->micvdd)) { if (IS_ERR(info->micvdd)) {
ret = PTR_ERR(info->micvdd); ret = PTR_ERR(info->micvdd);
dev_err(arizona->dev, "Failed to get MICVDD: %d\n", ret); dev_err(arizona->dev, "Failed to get MICVDD: %d\n", ret);
...@@ -1156,7 +1168,6 @@ static int arizona_extcon_probe(struct platform_device *pdev) ...@@ -1156,7 +1168,6 @@ static int arizona_extcon_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
info->edev->name = "Headset Jack"; info->edev->name = "Headset Jack";
info->edev->dev.parent = arizona->dev;
ret = devm_extcon_dev_register(&pdev->dev, info->edev); ret = devm_extcon_dev_register(&pdev->dev, info->edev);
if (ret < 0) { if (ret < 0) {
...@@ -1174,7 +1185,6 @@ static int arizona_extcon_probe(struct platform_device *pdev) ...@@ -1174,7 +1185,6 @@ static int arizona_extcon_probe(struct platform_device *pdev)
info->input->name = "Headset"; info->input->name = "Headset";
info->input->phys = "arizona/extcon"; info->input->phys = "arizona/extcon";
info->input->dev.parent = &pdev->dev;
if (pdata->num_micd_configs) { if (pdata->num_micd_configs) {
info->micd_modes = pdata->micd_configs; info->micd_modes = pdata->micd_configs;
...@@ -1305,15 +1315,21 @@ static int arizona_extcon_probe(struct platform_device *pdev) ...@@ -1305,15 +1315,21 @@ static int arizona_extcon_probe(struct platform_device *pdev)
regmap_write(arizona->regmap, ARIZONA_GPIO5_CTRL, regmap_write(arizona->regmap, ARIZONA_GPIO5_CTRL,
val); val);
regmap_update_bits(arizona->regmap, if (arizona->pdata.jd_invert)
ARIZONA_MICD_CLAMP_CONTROL, clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDH_GP5H;
ARIZONA_MICD_CLAMP_MODE_MASK, 0x9); else
clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDL_GP5H;
} else { } else {
regmap_update_bits(arizona->regmap, if (arizona->pdata.jd_invert)
ARIZONA_MICD_CLAMP_CONTROL, clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDH;
ARIZONA_MICD_CLAMP_MODE_MASK, 0x4); else
clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDL;
} }
regmap_update_bits(arizona->regmap,
ARIZONA_MICD_CLAMP_CONTROL,
ARIZONA_MICD_CLAMP_MODE_MASK, clamp_mode);
regmap_update_bits(arizona->regmap, regmap_update_bits(arizona->regmap,
ARIZONA_JACK_DETECT_DEBOUNCE, ARIZONA_JACK_DETECT_DEBOUNCE,
ARIZONA_MICD_CLAMP_DB, ARIZONA_MICD_CLAMP_DB,
......
...@@ -645,6 +645,8 @@ struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, ...@@ -645,6 +645,8 @@ struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
return edev; return edev;
} }
edev->dev.parent = dev;
*ptr = edev; *ptr = edev;
devres_add(dev, ptr); devres_add(dev, ptr);
......
...@@ -105,7 +105,6 @@ static int gpio_extcon_probe(struct platform_device *pdev) ...@@ -105,7 +105,6 @@ static int gpio_extcon_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
extcon_data->edev->name = pdata->name; extcon_data->edev->name = pdata->name;
extcon_data->edev->dev.parent = &pdev->dev;
extcon_data->gpio = pdata->gpio; extcon_data->gpio = pdata->gpio;
extcon_data->gpio_active_low = pdata->gpio_active_low; extcon_data->gpio_active_low = pdata->gpio_active_low;
......
...@@ -692,10 +692,9 @@ static int max14577_muic_probe(struct platform_device *pdev) ...@@ -692,10 +692,9 @@ static int max14577_muic_probe(struct platform_device *pdev)
u8 id; u8 id;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info) { if (!info)
dev_err(&pdev->dev, "failed to allocate memory\n");
return -ENOMEM; return -ENOMEM;
}
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->max14577 = max14577; info->max14577 = max14577;
......
...@@ -255,10 +255,10 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, ...@@ -255,10 +255,10 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
case ADC_DEBOUNCE_TIME_10MS: case ADC_DEBOUNCE_TIME_10MS:
case ADC_DEBOUNCE_TIME_25MS: case ADC_DEBOUNCE_TIME_25MS:
case ADC_DEBOUNCE_TIME_38_62MS: case ADC_DEBOUNCE_TIME_38_62MS:
ret = max77693_update_reg(info->max77693->regmap_muic, ret = regmap_update_bits(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL3, MAX77693_MUIC_REG_CTRL3,
time << CONTROL3_ADCDBSET_SHIFT, CONTROL3_ADCDBSET_MASK,
CONTROL3_ADCDBSET_MASK); time << CONTROL3_ADCDBSET_SHIFT);
if (ret) { if (ret) {
dev_err(info->dev, "failed to set ADC debounce time\n"); dev_err(info->dev, "failed to set ADC debounce time\n");
return ret; return ret;
...@@ -286,15 +286,15 @@ static int max77693_muic_set_path(struct max77693_muic_info *info, ...@@ -286,15 +286,15 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
u8 val, bool attached) u8 val, bool attached)
{ {
int ret = 0; int ret = 0;
u8 ctrl1, ctrl2 = 0; unsigned int ctrl1, ctrl2 = 0;
if (attached) if (attached)
ctrl1 = val; ctrl1 = val;
else else
ctrl1 = CONTROL1_SW_OPEN; ctrl1 = CONTROL1_SW_OPEN;
ret = max77693_update_reg(info->max77693->regmap_muic, ret = regmap_update_bits(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK); MAX77693_MUIC_REG_CTRL1, COMP_SW_MASK, ctrl1);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "failed to update MUIC register\n"); dev_err(info->dev, "failed to update MUIC register\n");
return ret; return ret;
...@@ -305,9 +305,9 @@ static int max77693_muic_set_path(struct max77693_muic_info *info, ...@@ -305,9 +305,9 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
else else
ctrl2 |= CONTROL2_LOWPWR_MASK; /* LowPwr=1, CPEn=0 */ ctrl2 |= CONTROL2_LOWPWR_MASK; /* LowPwr=1, CPEn=0 */
ret = max77693_update_reg(info->max77693->regmap_muic, ret = regmap_update_bits(info->max77693->regmap_muic,
MAX77693_MUIC_REG_CTRL2, ctrl2, MAX77693_MUIC_REG_CTRL2,
CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK); CONTROL2_LOWPWR_MASK | CONTROL2_CPEN_MASK, ctrl2);
if (ret < 0) { if (ret < 0) {
dev_err(info->dev, "failed to update MUIC register\n"); dev_err(info->dev, "failed to update MUIC register\n");
return ret; return ret;
...@@ -969,8 +969,8 @@ static void max77693_muic_irq_work(struct work_struct *work) ...@@ -969,8 +969,8 @@ static void max77693_muic_irq_work(struct work_struct *work)
if (info->irq == muic_irqs[i].virq) if (info->irq == muic_irqs[i].virq)
irq_type = muic_irqs[i].irq; irq_type = muic_irqs[i].irq;
ret = max77693_bulk_read(info->max77693->regmap_muic, ret = regmap_bulk_read(info->max77693->regmap_muic,
MAX77693_MUIC_REG_STATUS1, 2, info->status); MAX77693_MUIC_REG_STATUS1, info->status, 2);
if (ret) { if (ret) {
dev_err(info->dev, "failed to read MUIC register\n"); dev_err(info->dev, "failed to read MUIC register\n");
mutex_unlock(&info->mutex); mutex_unlock(&info->mutex);
...@@ -1042,8 +1042,8 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info) ...@@ -1042,8 +1042,8 @@ static int max77693_muic_detect_accessory(struct max77693_muic_info *info)
mutex_lock(&info->mutex); mutex_lock(&info->mutex);
/* Read STATUSx register to detect accessory */ /* Read STATUSx register to detect accessory */
ret = max77693_bulk_read(info->max77693->regmap_muic, ret = regmap_bulk_read(info->max77693->regmap_muic,
MAX77693_MUIC_REG_STATUS1, 2, info->status); MAX77693_MUIC_REG_STATUS1, info->status, 2);
if (ret) { if (ret) {
dev_err(info->dev, "failed to read MUIC register\n"); dev_err(info->dev, "failed to read MUIC register\n");
mutex_unlock(&info->mutex); mutex_unlock(&info->mutex);
...@@ -1095,14 +1095,13 @@ static int max77693_muic_probe(struct platform_device *pdev) ...@@ -1095,14 +1095,13 @@ static int max77693_muic_probe(struct platform_device *pdev)
int delay_jiffies; int delay_jiffies;
int ret; int ret;
int i; int i;
u8 id; unsigned int id;
info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info), info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_muic_info),
GFP_KERNEL); GFP_KERNEL);
if (!info) { if (!info)
dev_err(&pdev->dev, "failed to allocate memory\n");
return -ENOMEM; return -ENOMEM;
}
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->max77693 = max77693; info->max77693 = max77693;
if (info->max77693->regmap_muic) { if (info->max77693->regmap_muic) {
...@@ -1154,7 +1153,8 @@ static int max77693_muic_probe(struct platform_device *pdev) ...@@ -1154,7 +1153,8 @@ static int max77693_muic_probe(struct platform_device *pdev)
struct max77693_muic_irq *muic_irq = &muic_irqs[i]; struct max77693_muic_irq *muic_irq = &muic_irqs[i];
unsigned int virq = 0; unsigned int virq = 0;
virq = irq_create_mapping(max77693->irq_domain, muic_irq->irq); virq = regmap_irq_get_virq(max77693->irq_data_muic,
muic_irq->irq);
if (!virq) { if (!virq) {
ret = -EINVAL; ret = -EINVAL;
goto err_irq; goto err_irq;
...@@ -1183,7 +1183,6 @@ static int max77693_muic_probe(struct platform_device *pdev) ...@@ -1183,7 +1183,6 @@ static int max77693_muic_probe(struct platform_device *pdev)
goto err_irq; goto err_irq;
} }
info->edev->name = DEV_NAME; info->edev->name = DEV_NAME;
info->edev->dev.parent = &pdev->dev;
ret = devm_extcon_dev_register(&pdev->dev, info->edev); ret = devm_extcon_dev_register(&pdev->dev, info->edev);
if (ret) { if (ret) {
...@@ -1204,7 +1203,7 @@ static int max77693_muic_probe(struct platform_device *pdev) ...@@ -1204,7 +1203,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
enum max77693_irq_source irq_src enum max77693_irq_source irq_src
= MAX77693_IRQ_GROUP_NR; = MAX77693_IRQ_GROUP_NR;
max77693_write_reg(info->max77693->regmap_muic, regmap_write(info->max77693->regmap_muic,
init_data[i].addr, init_data[i].addr,
init_data[i].data); init_data[i].data);
...@@ -1262,7 +1261,7 @@ static int max77693_muic_probe(struct platform_device *pdev) ...@@ -1262,7 +1261,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
max77693_muic_set_path(info, info->path_uart, true); max77693_muic_set_path(info, info->path_uart, true);
/* Check revision number of MUIC device*/ /* Check revision number of MUIC device*/
ret = max77693_read_reg(info->max77693->regmap_muic, ret = regmap_read(info->max77693->regmap_muic,
MAX77693_MUIC_REG_ID, &id); MAX77693_MUIC_REG_ID, &id);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to read revision number\n"); dev_err(&pdev->dev, "failed to read revision number\n");
......
...@@ -661,10 +661,8 @@ static int max8997_muic_probe(struct platform_device *pdev) ...@@ -661,10 +661,8 @@ static int max8997_muic_probe(struct platform_device *pdev)
info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info),
GFP_KERNEL); GFP_KERNEL);
if (!info) { if (!info)
dev_err(&pdev->dev, "failed to allocate memory\n");
return -ENOMEM; return -ENOMEM;
}
info->dev = &pdev->dev; info->dev = &pdev->dev;
info->muic = max8997->muic; info->muic = max8997->muic;
...@@ -706,7 +704,6 @@ static int max8997_muic_probe(struct platform_device *pdev) ...@@ -706,7 +704,6 @@ static int max8997_muic_probe(struct platform_device *pdev)
goto err_irq; goto err_irq;
} }
info->edev->name = DEV_NAME; info->edev->name = DEV_NAME;
info->edev->dev.parent = &pdev->dev;
ret = devm_extcon_dev_register(&pdev->dev, info->edev); ret = devm_extcon_dev_register(&pdev->dev, info->edev);
if (ret) { if (ret) {
......
...@@ -194,7 +194,6 @@ static int palmas_usb_probe(struct platform_device *pdev) ...@@ -194,7 +194,6 @@ static int palmas_usb_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
palmas_usb->edev->name = kstrdup(node->name, GFP_KERNEL); palmas_usb->edev->name = kstrdup(node->name, GFP_KERNEL);
palmas_usb->edev->dev.parent = palmas_usb->dev;
palmas_usb->edev->mutually_exclusive = mutually_exclusive; palmas_usb->edev->mutually_exclusive = mutually_exclusive;
status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev); status = devm_extcon_dev_register(&pdev->dev, palmas_usb->edev);
...@@ -278,7 +277,7 @@ static int palmas_usb_resume(struct device *dev) ...@@ -278,7 +277,7 @@ static int palmas_usb_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(palmas_pm_ops, palmas_usb_suspend, palmas_usb_resume); static SIMPLE_DEV_PM_OPS(palmas_pm_ops, palmas_usb_suspend, palmas_usb_resume);
static struct of_device_id of_palmas_match_tbl[] = { static const struct of_device_id of_palmas_match_tbl[] = {
{ .compatible = "ti,palmas-usb", }, { .compatible = "ti,palmas-usb", },
{ .compatible = "ti,palmas-usb-vid", }, { .compatible = "ti,palmas-usb-vid", },
{ .compatible = "ti,twl6035-usb", }, { .compatible = "ti,twl6035-usb", },
......
This diff is collapsed.
...@@ -384,6 +384,7 @@ config MFD_MAX77693 ...@@ -384,6 +384,7 @@ config MFD_MAX77693
depends on I2C=y depends on I2C=y
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
select REGMAP_IRQ
help help
Say yes here to add support for Maxim Semiconductor MAX77693. Say yes here to add support for Maxim Semiconductor MAX77693.
This is a companion Power Management IC with Flash, Haptic, Charger, This is a companion Power Management IC with Flash, Haptic, Charger,
......
...@@ -116,7 +116,7 @@ obj-$(CONFIG_MFD_DA9063) += da9063.o ...@@ -116,7 +116,7 @@ obj-$(CONFIG_MFD_DA9063) += da9063.o
obj-$(CONFIG_MFD_MAX14577) += max14577.o obj-$(CONFIG_MFD_MAX14577) += max14577.o
obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o obj-$(CONFIG_MFD_MAX77686) += max77686.o max77686-irq.o
obj-$(CONFIG_MFD_MAX77693) += max77693.o max77693-irq.o obj-$(CONFIG_MFD_MAX77693) += max77693.o
obj-$(CONFIG_MFD_MAX8907) += max8907.o obj-$(CONFIG_MFD_MAX8907) += max8907.o
max8925-objs := max8925-core.o max8925-i2c.o max8925-objs := max8925-core.o max8925-i2c.o
obj-$(CONFIG_MFD_MAX8925) += max8925.o obj-$(CONFIG_MFD_MAX8925) += max8925.o
......
This diff is collapsed.
...@@ -49,62 +49,62 @@ static const struct mfd_cell max77693_devs[] = { ...@@ -49,62 +49,62 @@ static const struct mfd_cell max77693_devs[] = {
{ .name = "max77693-haptic", }, { .name = "max77693-haptic", },
}; };
int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest) static const struct regmap_config max77693_regmap_config = {
{ .reg_bits = 8,
unsigned int val; .val_bits = 8,
int ret; .max_register = MAX77693_PMIC_REG_END,
};
ret = regmap_read(map, reg, &val);
*dest = val;
return ret;
}
EXPORT_SYMBOL_GPL(max77693_read_reg);
int max77693_bulk_read(struct regmap *map, u8 reg, int count, u8 *buf)
{
int ret;
ret = regmap_bulk_read(map, reg, buf, count);
return ret;
}
EXPORT_SYMBOL_GPL(max77693_bulk_read);
int max77693_write_reg(struct regmap *map, u8 reg, u8 value)
{
int ret;
ret = regmap_write(map, reg, value);
return ret;
}
EXPORT_SYMBOL_GPL(max77693_write_reg);
int max77693_bulk_write(struct regmap *map, u8 reg, int count, u8 *buf)
{
int ret;
ret = regmap_bulk_write(map, reg, buf, count); static const struct regmap_irq max77693_led_irqs[] = {
{ .mask = LED_IRQ_FLED2_OPEN, },
{ .mask = LED_IRQ_FLED2_SHORT, },
{ .mask = LED_IRQ_FLED1_OPEN, },
{ .mask = LED_IRQ_FLED1_SHORT, },
{ .mask = LED_IRQ_MAX_FLASH, },
};
return ret; static const struct regmap_irq_chip max77693_led_irq_chip = {
} .name = "max77693-led",
EXPORT_SYMBOL_GPL(max77693_bulk_write); .status_base = MAX77693_LED_REG_FLASH_INT,
.mask_base = MAX77693_LED_REG_FLASH_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77693_led_irqs,
.num_irqs = ARRAY_SIZE(max77693_led_irqs),
};
int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask) static const struct regmap_irq max77693_topsys_irqs[] = {
{ { .mask = TOPSYS_IRQ_T120C_INT, },
int ret; { .mask = TOPSYS_IRQ_T140C_INT, },
{ .mask = TOPSYS_IRQ_LOWSYS_INT, },
};
ret = regmap_update_bits(map, reg, mask, val); static const struct regmap_irq_chip max77693_topsys_irq_chip = {
.name = "max77693-topsys",
.status_base = MAX77693_PMIC_REG_TOPSYS_INT,
.mask_base = MAX77693_PMIC_REG_TOPSYS_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77693_topsys_irqs,
.num_irqs = ARRAY_SIZE(max77693_topsys_irqs),
};
return ret; static const struct regmap_irq max77693_charger_irqs[] = {
} { .mask = CHG_IRQ_BYP_I, },
EXPORT_SYMBOL_GPL(max77693_update_reg); { .mask = CHG_IRQ_THM_I, },
{ .mask = CHG_IRQ_BAT_I, },
{ .mask = CHG_IRQ_CHG_I, },
{ .mask = CHG_IRQ_CHGIN_I, },
};
static const struct regmap_config max77693_regmap_config = { static const struct regmap_irq_chip max77693_charger_irq_chip = {
.reg_bits = 8, .name = "max77693-charger",
.val_bits = 8, .status_base = MAX77693_CHG_REG_CHG_INT,
.max_register = MAX77693_PMIC_REG_END, .mask_base = MAX77693_CHG_REG_CHG_INT_MASK,
.mask_invert = false,
.num_regs = 1,
.irqs = max77693_charger_irqs,
.num_irqs = ARRAY_SIZE(max77693_charger_irqs),
}; };
static const struct regmap_config max77693_regmap_muic_config = { static const struct regmap_config max77693_regmap_muic_config = {
...@@ -113,11 +113,42 @@ static const struct regmap_config max77693_regmap_muic_config = { ...@@ -113,11 +113,42 @@ static const struct regmap_config max77693_regmap_muic_config = {
.max_register = MAX77693_MUIC_REG_END, .max_register = MAX77693_MUIC_REG_END,
}; };
static const struct regmap_irq max77693_muic_irqs[] = {
{ .reg_offset = 0, .mask = MUIC_IRQ_INT1_ADC, },
{ .reg_offset = 0, .mask = MUIC_IRQ_INT1_ADC_LOW, },
{ .reg_offset = 0, .mask = MUIC_IRQ_INT1_ADC_ERR, },
{ .reg_offset = 0, .mask = MUIC_IRQ_INT1_ADC1K, },
{ .reg_offset = 1, .mask = MUIC_IRQ_INT2_CHGTYP, },
{ .reg_offset = 1, .mask = MUIC_IRQ_INT2_CHGDETREUN, },
{ .reg_offset = 1, .mask = MUIC_IRQ_INT2_DCDTMR, },
{ .reg_offset = 1, .mask = MUIC_IRQ_INT2_DXOVP, },
{ .reg_offset = 1, .mask = MUIC_IRQ_INT2_VBVOLT, },
{ .reg_offset = 1, .mask = MUIC_IRQ_INT2_VIDRM, },
{ .reg_offset = 2, .mask = MUIC_IRQ_INT3_EOC, },
{ .reg_offset = 2, .mask = MUIC_IRQ_INT3_CGMBC, },
{ .reg_offset = 2, .mask = MUIC_IRQ_INT3_OVP, },
{ .reg_offset = 2, .mask = MUIC_IRQ_INT3_MBCCHG_ERR, },
{ .reg_offset = 2, .mask = MUIC_IRQ_INT3_CHG_ENABLED, },
{ .reg_offset = 2, .mask = MUIC_IRQ_INT3_BAT_DET, },
};
static const struct regmap_irq_chip max77693_muic_irq_chip = {
.name = "max77693-muic",
.status_base = MAX77693_MUIC_REG_INT1,
.mask_base = MAX77693_MUIC_REG_INTMASK1,
.mask_invert = true,
.num_regs = 3,
.irqs = max77693_muic_irqs,
.num_irqs = ARRAY_SIZE(max77693_muic_irqs),
};
static int max77693_i2c_probe(struct i2c_client *i2c, static int max77693_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct max77693_dev *max77693; struct max77693_dev *max77693;
u8 reg_data; unsigned int reg_data;
int ret = 0; int ret = 0;
max77693 = devm_kzalloc(&i2c->dev, max77693 = devm_kzalloc(&i2c->dev,
...@@ -139,7 +170,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -139,7 +170,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
ret = max77693_read_reg(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2, ret = regmap_read(max77693->regmap, MAX77693_PMIC_REG_PMIC_ID2,
&reg_data); &reg_data);
if (ret < 0) { if (ret < 0) {
dev_err(max77693->dev, "device not found on this channel\n"); dev_err(max77693->dev, "device not found on this channel\n");
...@@ -176,9 +207,45 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -176,9 +207,45 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
goto err_regmap_muic; goto err_regmap_muic;
} }
ret = max77693_irq_init(max77693); ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
if (ret < 0) IRQF_ONESHOT | IRQF_SHARED |
goto err_irq; IRQF_TRIGGER_FALLING, 0,
&max77693_led_irq_chip,
&max77693->irq_data_led);
if (ret) {
dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
goto err_regmap_muic;
}
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
IRQF_ONESHOT | IRQF_SHARED |
IRQF_TRIGGER_FALLING, 0,
&max77693_topsys_irq_chip,
&max77693->irq_data_topsys);
if (ret) {
dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
goto err_irq_topsys;
}
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
IRQF_ONESHOT | IRQF_SHARED |
IRQF_TRIGGER_FALLING, 0,
&max77693_charger_irq_chip,
&max77693->irq_data_charger);
if (ret) {
dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
goto err_irq_charger;
}
ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
IRQF_ONESHOT | IRQF_SHARED |
IRQF_TRIGGER_FALLING, 0,
&max77693_muic_irq_chip,
&max77693->irq_data_muic);
if (ret) {
dev_err(max77693->dev, "failed to add irq chip: %d\n", ret);
goto err_irq_muic;
}
pm_runtime_set_active(max77693->dev); pm_runtime_set_active(max77693->dev);
...@@ -190,8 +257,14 @@ static int max77693_i2c_probe(struct i2c_client *i2c, ...@@ -190,8 +257,14 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
err_mfd: err_mfd:
max77693_irq_exit(max77693); mfd_remove_devices(max77693->dev);
err_irq: regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
err_irq_muic:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
err_irq_charger:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
err_irq_topsys:
regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
err_regmap_muic: err_regmap_muic:
i2c_unregister_device(max77693->haptic); i2c_unregister_device(max77693->haptic);
err_i2c_haptic: err_i2c_haptic:
...@@ -204,7 +277,12 @@ static int max77693_i2c_remove(struct i2c_client *i2c) ...@@ -204,7 +277,12 @@ static int max77693_i2c_remove(struct i2c_client *i2c)
struct max77693_dev *max77693 = i2c_get_clientdata(i2c); struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
mfd_remove_devices(max77693->dev); mfd_remove_devices(max77693->dev);
max77693_irq_exit(max77693);
regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
regmap_del_irq_chip(max77693->irq, max77693->irq_data_charger);
regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
i2c_unregister_device(max77693->muic); i2c_unregister_device(max77693->muic);
i2c_unregister_device(max77693->haptic); i2c_unregister_device(max77693->haptic);
...@@ -222,8 +300,11 @@ static int max77693_suspend(struct device *dev) ...@@ -222,8 +300,11 @@ static int max77693_suspend(struct device *dev)
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct max77693_dev *max77693 = i2c_get_clientdata(i2c); struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
if (device_may_wakeup(dev)) if (device_may_wakeup(dev)) {
irq_set_irq_wake(max77693->irq, 1); enable_irq_wake(max77693->irq);
disable_irq(max77693->irq);
}
return 0; return 0;
} }
...@@ -232,9 +313,12 @@ static int max77693_resume(struct device *dev) ...@@ -232,9 +313,12 @@ static int max77693_resume(struct device *dev)
struct i2c_client *i2c = container_of(dev, struct i2c_client, dev); struct i2c_client *i2c = container_of(dev, struct i2c_client, dev);
struct max77693_dev *max77693 = i2c_get_clientdata(i2c); struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
if (device_may_wakeup(dev)) if (device_may_wakeup(dev)) {
irq_set_irq_wake(max77693->irq, 0); disable_irq_wake(max77693->irq);
return max77693_irq_resume(max77693); enable_irq(max77693->irq);
}
return 0;
} }
static const struct dev_pm_ops max77693_pm = { static const struct dev_pm_ops max77693_pm = {
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/mfd/max77693.h> #include <linux/mfd/max77693.h>
#include <linux/mfd/max77693-private.h> #include <linux/mfd/max77693-private.h>
#include <linux/regulator/of_regulator.h> #include <linux/regulator/of_regulator.h>
#include <linux/regmap.h>
#define CHGIN_ILIM_STEP_20mA 20000 #define CHGIN_ILIM_STEP_20mA 20000
...@@ -39,9 +40,9 @@ ...@@ -39,9 +40,9 @@
static int max77693_chg_is_enabled(struct regulator_dev *rdev) static int max77693_chg_is_enabled(struct regulator_dev *rdev)
{ {
int ret; int ret;
u8 val; unsigned int val;
ret = max77693_read_reg(rdev->regmap, rdev->desc->enable_reg, &val); ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
if (ret) if (ret)
return ret; return ret;
...@@ -57,12 +58,11 @@ static int max77693_chg_get_current_limit(struct regulator_dev *rdev) ...@@ -57,12 +58,11 @@ static int max77693_chg_get_current_limit(struct regulator_dev *rdev)
{ {
unsigned int chg_min_uA = rdev->constraints->min_uA; unsigned int chg_min_uA = rdev->constraints->min_uA;
unsigned int chg_max_uA = rdev->constraints->max_uA; unsigned int chg_max_uA = rdev->constraints->max_uA;
u8 reg, sel; unsigned int reg, sel;
unsigned int val; unsigned int val;
int ret; int ret;
ret = max77693_read_reg(rdev->regmap, ret = regmap_read(rdev->regmap, MAX77693_CHG_REG_CHG_CNFG_09, &reg);
MAX77693_CHG_REG_CHG_CNFG_09, &reg);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -96,7 +96,7 @@ static int max77693_chg_set_current_limit(struct regulator_dev *rdev, ...@@ -96,7 +96,7 @@ static int max77693_chg_set_current_limit(struct regulator_dev *rdev,
/* the first four codes for charger current are all 60mA */ /* the first four codes for charger current are all 60mA */
sel += 3; sel += 3;
return max77693_write_reg(rdev->regmap, return regmap_write(rdev->regmap,
MAX77693_CHG_REG_CHG_CNFG_09, sel); MAX77693_CHG_REG_CHG_CNFG_09, sel);
} }
/* end of CHARGER regulator ops */ /* end of CHARGER regulator ops */
......
This diff is collapsed.
...@@ -127,6 +127,9 @@ struct arizona_pdata { ...@@ -127,6 +127,9 @@ struct arizona_pdata {
/** Internal pull on GPIO5 is disabled when used for jack detection */ /** Internal pull on GPIO5 is disabled when used for jack detection */
bool jd_gpio5_nopull; bool jd_gpio5_nopull;
/** set to true if jackdet contact opens on insert */
bool jd_invert;
/** Use the headphone detect circuit to identify the accessory */ /** Use the headphone detect circuit to identify the accessory */
bool hpdet_acc_id; bool hpdet_acc_id;
......
...@@ -262,6 +262,41 @@ enum max77693_irq_source { ...@@ -262,6 +262,41 @@ enum max77693_irq_source {
MAX77693_IRQ_GROUP_NR, MAX77693_IRQ_GROUP_NR,
}; };
#define LED_IRQ_FLED2_OPEN BIT(0)
#define LED_IRQ_FLED2_SHORT BIT(1)
#define LED_IRQ_FLED1_OPEN BIT(2)
#define LED_IRQ_FLED1_SHORT BIT(3)
#define LED_IRQ_MAX_FLASH BIT(4)
#define TOPSYS_IRQ_T120C_INT BIT(0)
#define TOPSYS_IRQ_T140C_INT BIT(1)
#define TOPSYS_IRQ_LOWSYS_INT BIT(3)
#define CHG_IRQ_BYP_I BIT(0)
#define CHG_IRQ_THM_I BIT(2)
#define CHG_IRQ_BAT_I BIT(3)
#define CHG_IRQ_CHG_I BIT(4)
#define CHG_IRQ_CHGIN_I BIT(6)
#define MUIC_IRQ_INT1_ADC BIT(0)
#define MUIC_IRQ_INT1_ADC_LOW BIT(1)
#define MUIC_IRQ_INT1_ADC_ERR BIT(2)
#define MUIC_IRQ_INT1_ADC1K BIT(3)
#define MUIC_IRQ_INT2_CHGTYP BIT(0)
#define MUIC_IRQ_INT2_CHGDETREUN BIT(1)
#define MUIC_IRQ_INT2_DCDTMR BIT(2)
#define MUIC_IRQ_INT2_DXOVP BIT(3)
#define MUIC_IRQ_INT2_VBVOLT BIT(4)
#define MUIC_IRQ_INT2_VIDRM BIT(5)
#define MUIC_IRQ_INT3_EOC BIT(0)
#define MUIC_IRQ_INT3_CGMBC BIT(1)
#define MUIC_IRQ_INT3_OVP BIT(2)
#define MUIC_IRQ_INT3_MBCCHG_ERR BIT(3)
#define MUIC_IRQ_INT3_CHG_ENABLED BIT(4)
#define MUIC_IRQ_INT3_BAT_DET BIT(5)
enum max77693_irq { enum max77693_irq {
/* PMIC - FLASH */ /* PMIC - FLASH */
MAX77693_LED_IRQ_FLED2_OPEN, MAX77693_LED_IRQ_FLED2_OPEN,
...@@ -282,6 +317,10 @@ enum max77693_irq { ...@@ -282,6 +317,10 @@ enum max77693_irq {
MAX77693_CHG_IRQ_CHG_I, MAX77693_CHG_IRQ_CHG_I,
MAX77693_CHG_IRQ_CHGIN_I, MAX77693_CHG_IRQ_CHGIN_I,
MAX77693_IRQ_NR,
};
enum max77693_irq_muic {
/* MUIC INT1 */ /* MUIC INT1 */
MAX77693_MUIC_IRQ_INT1_ADC, MAX77693_MUIC_IRQ_INT1_ADC,
MAX77693_MUIC_IRQ_INT1_ADC_LOW, MAX77693_MUIC_IRQ_INT1_ADC_LOW,
...@@ -304,7 +343,7 @@ enum max77693_irq { ...@@ -304,7 +343,7 @@ enum max77693_irq {
MAX77693_MUIC_IRQ_INT3_CHG_ENABLED, MAX77693_MUIC_IRQ_INT3_CHG_ENABLED,
MAX77693_MUIC_IRQ_INT3_BAT_DET, MAX77693_MUIC_IRQ_INT3_BAT_DET,
MAX77693_IRQ_NR, MAX77693_MUIC_IRQ_NR,
}; };
struct max77693_dev { struct max77693_dev {
...@@ -319,7 +358,10 @@ struct max77693_dev { ...@@ -319,7 +358,10 @@ struct max77693_dev {
struct regmap *regmap_muic; struct regmap *regmap_muic;
struct regmap *regmap_haptic; struct regmap *regmap_haptic;
struct irq_domain *irq_domain; struct regmap_irq_chip_data *irq_data_led;
struct regmap_irq_chip_data *irq_data_topsys;
struct regmap_irq_chip_data *irq_data_charger;
struct regmap_irq_chip_data *irq_data_muic;
int irq; int irq;
int irq_gpio; int irq_gpio;
...@@ -332,14 +374,6 @@ enum max77693_types { ...@@ -332,14 +374,6 @@ enum max77693_types {
TYPE_MAX77693, TYPE_MAX77693,
}; };
extern int max77693_read_reg(struct regmap *map, u8 reg, u8 *dest);
extern int max77693_bulk_read(struct regmap *map, u8 reg, int count,
u8 *buf);
extern int max77693_write_reg(struct regmap *map, u8 reg, u8 value);
extern int max77693_bulk_write(struct regmap *map, u8 reg, int count,
u8 *buf);
extern int max77693_update_reg(struct regmap *map, u8 reg, u8 val, u8 mask);
extern int max77693_irq_init(struct max77693_dev *max77686); extern int max77693_irq_init(struct max77693_dev *max77686);
extern void max77693_irq_exit(struct max77693_dev *max77686); extern void max77693_irq_exit(struct max77693_dev *max77686);
extern int max77693_irq_resume(struct max77693_dev *max77686); extern int max77693_irq_resume(struct max77693_dev *max77686);
......
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