Commit d4e14066 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

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

Chanwoo writes:

Update extcon next for v5.14

Detailed description for this pull request:
1. Update extcon-sm5502 provider driver
- Convert devicetree binding document sytle with yaml
  for extcon-sm5502.c and add support for SM5504 chip to extcon-sm5502.c.
- Use devm_regmap_add_irq_chip and probe_new for extcon-sm5502.c

2. Add missing modalias string for extcon-max8997.c.

3. Initialize the status data of extcon-intel-mrfld.c on probe time
in order to prevent the mismatch issue.

* tag 'extcon-next-for-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
  extcon: sm5502: Add support for SM5504
  extcon: sm5502: Refactor driver to use chip-specific struct
  dt-bindings: extcon: sm5502: Document siliconmitus,sm5504-muic
  dt-bindings: extcon: sm5502: Convert to DT schema
  extcon: sm5502: Implement i2c_driver->probe_new()
  extcon: sm5502: Use devm_regmap_add_irq_chip()
  extcon: max8997: Add missing modalias string
  extcon: sm5502: Drop invalid register write in sm5502_reg_data
  extcon: intel-mrfld: Sync hardware and software state on init
parents 5471a812 d97c0ff5
* 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
- interrupts: Interrupt specifiers for detection interrupt sources.
Example:
sm5502@25 {
compatible = "siliconmitus,sm5502-muic";
interrupt-parent = <&gpx1>;
interrupts = <5 0>;
reg = <0x25>;
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/extcon/siliconmitus,sm5502-muic.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: SM5502/SM5504 MUIC (Micro-USB Interface Controller) device
maintainers:
- Chanwoo Choi <cw00.choi@samsung.com>
description:
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.
properties:
compatible:
enum:
- siliconmitus,sm5502-muic
- siliconmitus,sm5504-muic
reg:
maxItems: 1
description: I2C slave address of the device. Usually 0x25 for SM5502,
0x14 for SM5504.
interrupts:
maxItems: 1
required:
- compatible
- reg
- interrupts
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
extcon@25 {
compatible = "siliconmitus,sm5502-muic";
reg = <0x25>;
interrupt-parent = <&msmgpio>;
interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
};
};
...@@ -154,7 +154,7 @@ config EXTCON_RT8973A ...@@ -154,7 +154,7 @@ config EXTCON_RT8973A
from abnormal high input voltage (up to 28V). from abnormal high input voltage (up to 28V).
config EXTCON_SM5502 config EXTCON_SM5502
tristate "Silicon Mitus SM5502 EXTCON support" tristate "Silicon Mitus SM5502/SM5504 EXTCON support"
depends on I2C depends on I2C
select IRQ_DOMAIN select IRQ_DOMAIN
select REGMAP_I2C select REGMAP_I2C
......
...@@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev) ...@@ -197,6 +197,7 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent); struct intel_soc_pmic *pmic = dev_get_drvdata(dev->parent);
struct regmap *regmap = pmic->regmap; struct regmap *regmap = pmic->regmap;
struct mrfld_extcon_data *data; struct mrfld_extcon_data *data;
unsigned int status;
unsigned int id; unsigned int id;
int irq, ret; int irq, ret;
...@@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct platform_device *pdev) ...@@ -244,6 +245,14 @@ static int mrfld_extcon_probe(struct platform_device *pdev)
/* Get initial state */ /* Get initial state */
mrfld_extcon_role_detect(data); mrfld_extcon_role_detect(data);
/*
* Cached status value is used for cable detection, see comments
* in mrfld_extcon_cable_detect(), we need to sync cached value
* with a real state of the hardware.
*/
regmap_read(regmap, BCOVE_SCHGRIRQ1, &status);
data->status = status;
mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR); mrfld_extcon_clear(data, BCOVE_MIRQLVL1, BCOVE_LVL1_CHGR);
mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL); mrfld_extcon_clear(data, BCOVE_MCHGRIRQ1, BCOVE_CHGRIRQ_ALL);
......
...@@ -788,3 +788,4 @@ module_platform_driver(max8997_muic_driver); ...@@ -788,3 +788,4 @@ module_platform_driver(max8997_muic_driver);
MODULE_DESCRIPTION("Maxim MAX8997 Extcon driver"); MODULE_DESCRIPTION("Maxim MAX8997 Extcon driver");
MODULE_AUTHOR("Donggeun Kim <dg77.kim@samsung.com>"); MODULE_AUTHOR("Donggeun Kim <dg77.kim@samsung.com>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:max8997-muic");
This diff is collapsed.
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
#ifndef __LINUX_EXTCON_SM5502_H #ifndef __LINUX_EXTCON_SM5502_H
#define __LINUX_EXTCON_SM5502_H #define __LINUX_EXTCON_SM5502_H
enum sm5502_types {
TYPE_SM5502,
};
/* SM5502 registers */ /* SM5502 registers */
enum sm5502_reg { enum sm5502_reg {
SM5502_REG_DEVICE_ID = 0x01, SM5502_REG_DEVICE_ID = 0x01,
...@@ -93,6 +89,13 @@ enum sm5502_reg { ...@@ -93,6 +89,13 @@ enum sm5502_reg {
#define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT) #define SM5502_REG_CONTROL_RAW_DATA_MASK (0x1 << SM5502_REG_CONTROL_RAW_DATA_SHIFT)
#define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT) #define SM5502_REG_CONTROL_SW_OPEN_MASK (0x1 << SM5502_REG_CONTROL_SW_OPEN_SHIFT)
#define SM5504_REG_CONTROL_CHGTYP_SHIFT 5
#define SM5504_REG_CONTROL_USBCHDEN_SHIFT 6
#define SM5504_REG_CONTROL_ADC_EN_SHIFT 7
#define SM5504_REG_CONTROL_CHGTYP_MASK (0x1 << SM5504_REG_CONTROL_CHGTYP_SHIFT)
#define SM5504_REG_CONTROL_USBCHDEN_MASK (0x1 << SM5504_REG_CONTROL_USBCHDEN_SHIFT)
#define SM5504_REG_CONTROL_ADC_EN_MASK (0x1 << SM5504_REG_CONTROL_ADC_EN_SHIFT)
#define SM5502_REG_INTM1_ATTACH_SHIFT 0 #define SM5502_REG_INTM1_ATTACH_SHIFT 0
#define SM5502_REG_INTM1_DETACH_SHIFT 1 #define SM5502_REG_INTM1_DETACH_SHIFT 1
#define SM5502_REG_INTM1_KP_SHIFT 2 #define SM5502_REG_INTM1_KP_SHIFT 2
...@@ -123,6 +126,36 @@ enum sm5502_reg { ...@@ -123,6 +126,36 @@ enum sm5502_reg {
#define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT) #define SM5502_REG_INTM2_STUCK_KEY_RCV_MASK (0x1 << SM5502_REG_INTM2_STUCK_KEY_RCV_SHIFT)
#define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT) #define SM5502_REG_INTM2_MHL_MASK (0x1 << SM5502_REG_INTM2_MHL_SHIFT)
#define SM5504_REG_INTM1_ATTACH_SHIFT 0
#define SM5504_REG_INTM1_DETACH_SHIFT 1
#define SM5504_REG_INTM1_CHG_DET_SHIFT 2
#define SM5504_REG_INTM1_DCD_OUT_SHIFT 3
#define SM5504_REG_INTM1_OVP_EVENT_SHIFT 4
#define SM5504_REG_INTM1_CONNECT_SHIFT 5
#define SM5504_REG_INTM1_ADC_CHG_SHIFT 6
#define SM5504_REG_INTM1_ATTACH_MASK (0x1 << SM5504_REG_INTM1_ATTACH_SHIFT)
#define SM5504_REG_INTM1_DETACH_MASK (0x1 << SM5504_REG_INTM1_DETACH_SHIFT)
#define SM5504_REG_INTM1_CHG_DET_MASK (0x1 << SM5504_REG_INTM1_CHG_DET_SHIFT)
#define SM5504_REG_INTM1_DCD_OUT_MASK (0x1 << SM5504_REG_INTM1_DCD_OUT_SHIFT)
#define SM5504_REG_INTM1_OVP_EVENT_MASK (0x1 << SM5504_REG_INTM1_OVP_EVENT_SHIFT)
#define SM5504_REG_INTM1_CONNECT_MASK (0x1 << SM5504_REG_INTM1_CONNECT_SHIFT)
#define SM5504_REG_INTM1_ADC_CHG_MASK (0x1 << SM5504_REG_INTM1_ADC_CHG_SHIFT)
#define SM5504_REG_INTM2_RID_CHG_SHIFT 0
#define SM5504_REG_INTM2_UVLO_SHIFT 1
#define SM5504_REG_INTM2_POR_SHIFT 2
#define SM5504_REG_INTM2_OVP_FET_SHIFT 4
#define SM5504_REG_INTM2_OCP_LATCH_SHIFT 5
#define SM5504_REG_INTM2_OCP_EVENT_SHIFT 6
#define SM5504_REG_INTM2_OVP_OCP_EVENT_SHIFT 7
#define SM5504_REG_INTM2_RID_CHG_MASK (0x1 << SM5504_REG_INTM2_RID_CHG_SHIFT)
#define SM5504_REG_INTM2_UVLO_MASK (0x1 << SM5504_REG_INTM2_UVLO_SHIFT)
#define SM5504_REG_INTM2_POR_MASK (0x1 << SM5504_REG_INTM2_POR_SHIFT)
#define SM5504_REG_INTM2_OVP_FET_MASK (0x1 << SM5504_REG_INTM2_OVP_FET_SHIFT)
#define SM5504_REG_INTM2_OCP_LATCH_MASK (0x1 << SM5504_REG_INTM2_OCP_LATCH_SHIFT)
#define SM5504_REG_INTM2_OCP_EVENT_MASK (0x1 << SM5504_REG_INTM2_OCP_EVENT_SHIFT)
#define SM5504_REG_INTM2_OVP_OCP_EVENT_MASK (0x1 << SM5504_REG_INTM2_OVP_OCP_EVENT_SHIFT)
#define SM5502_REG_ADC_SHIFT 0 #define SM5502_REG_ADC_SHIFT 0
#define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT) #define SM5502_REG_ADC_MASK (0x1f << SM5502_REG_ADC_SHIFT)
...@@ -199,6 +232,9 @@ enum sm5502_reg { ...@@ -199,6 +232,9 @@ enum sm5502_reg {
#define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT) #define SM5502_REG_DEV_TYPE1_DEDICATED_CHG_MASK (0x1 << SM5502_REG_DEV_TYPE1_DEDICATED_CHG_SHIFT)
#define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT) #define SM5502_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5502_REG_DEV_TYPE1_USB_OTG_SHIFT)
#define SM5504_REG_DEV_TYPE1_USB_OTG_SHIFT 0
#define SM5504_REG_DEV_TYPE1_USB_OTG_MASK (0x1 << SM5504_REG_DEV_TYPE1_USB_OTG_SHIFT)
#define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0 #define SM5502_REG_DEV_TYPE2_JIG_USB_ON_SHIFT 0
#define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1 #define SM5502_REG_DEV_TYPE2_JIG_USB_OFF_SHIFT 1
#define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2 #define SM5502_REG_DEV_TYPE2_JIG_UART_ON_SHIFT 2
...@@ -277,4 +313,42 @@ enum sm5502_irq { ...@@ -277,4 +313,42 @@ enum sm5502_irq {
#define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4) #define SM5502_IRQ_INT2_STUCK_KEY_RCV_MASK BIT(4)
#define SM5502_IRQ_INT2_MHL_MASK BIT(5) #define SM5502_IRQ_INT2_MHL_MASK BIT(5)
/* SM5504 Interrupts */
enum sm5504_irq {
/* INT1 */
SM5504_IRQ_INT1_ATTACH,
SM5504_IRQ_INT1_DETACH,
SM5504_IRQ_INT1_CHG_DET,
SM5504_IRQ_INT1_DCD_OUT,
SM5504_IRQ_INT1_OVP_EVENT,
SM5504_IRQ_INT1_CONNECT,
SM5504_IRQ_INT1_ADC_CHG,
/* INT2 */
SM5504_IRQ_INT2_RID_CHG,
SM5504_IRQ_INT2_UVLO,
SM5504_IRQ_INT2_POR,
SM5504_IRQ_INT2_OVP_FET,
SM5504_IRQ_INT2_OCP_LATCH,
SM5504_IRQ_INT2_OCP_EVENT,
SM5504_IRQ_INT2_OVP_OCP_EVENT,
SM5504_IRQ_NUM,
};
#define SM5504_IRQ_INT1_ATTACH_MASK BIT(0)
#define SM5504_IRQ_INT1_DETACH_MASK BIT(1)
#define SM5504_IRQ_INT1_CHG_DET_MASK BIT(2)
#define SM5504_IRQ_INT1_DCD_OUT_MASK BIT(3)
#define SM5504_IRQ_INT1_OVP_MASK BIT(4)
#define SM5504_IRQ_INT1_CONNECT_MASK BIT(5)
#define SM5504_IRQ_INT1_ADC_CHG_MASK BIT(6)
#define SM5504_IRQ_INT2_RID_CHG_MASK BIT(0)
#define SM5504_IRQ_INT2_UVLO_MASK BIT(1)
#define SM5504_IRQ_INT2_POR_MASK BIT(2)
#define SM5504_IRQ_INT2_OVP_FET_MASK BIT(4)
#define SM5504_IRQ_INT2_OCP_LATCH_MASK BIT(5)
#define SM5504_IRQ_INT2_OCP_EVENT_MASK BIT(6)
#define SM5504_IRQ_INT2_OVP_OCP_EVENT_MASK BIT(7)
#endif /* __LINUX_EXTCON_SM5502_H */ #endif /* __LINUX_EXTCON_SM5502_H */
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