drivers/extcon/extcon-max14577.c
Source file repositories/reference/linux-study-clean/drivers/extcon/extcon-max14577.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/extcon/extcon-max14577.c- Extension
.c- Size
- 22107 bytes
- Lines
- 804
- Domain
- Driver Families
- Bucket
- drivers/extcon
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/devm-helpers.hlinux/kernel.hlinux/module.hlinux/i2c.hlinux/interrupt.hlinux/platform_device.hlinux/mfd/max14577.hlinux/mfd/max14577-private.hlinux/extcon-provider.h
Detected Declarations
struct max14577_muic_irqstruct max14577_muic_infoenum max14577_muic_adc_debounce_timeenum max14577_muic_statusenum max14577_muic_cable_groupenum max14577_muic_acc_typefunction max14577_muic_set_debounce_timefunction max14577_muic_set_pathfunction max14577_muic_get_cable_typefunction max14577_muic_jig_handlerfunction max14577_muic_adc_handlerfunction max14577_muic_chg_handlerfunction max14577_muic_irq_workfunction max14577_parse_irqfunction max77836_parse_irqfunction max14577_muic_irq_handlerfunction max14577_muic_detect_accessoryfunction max14577_muic_detect_cable_wqfunction max14577_muic_probe
Annotated Snippet
struct max14577_muic_irq {
unsigned int irq;
const char *name;
unsigned int virq;
};
static struct max14577_muic_irq max14577_muic_irqs[] = {
{ MAX14577_IRQ_INT1_ADC, "muic-ADC" },
{ MAX14577_IRQ_INT1_ADCLOW, "muic-ADCLOW" },
{ MAX14577_IRQ_INT1_ADCERR, "muic-ADCError" },
{ MAX14577_IRQ_INT2_CHGTYP, "muic-CHGTYP" },
{ MAX14577_IRQ_INT2_CHGDETRUN, "muic-CHGDETRUN" },
{ MAX14577_IRQ_INT2_DCDTMR, "muic-DCDTMR" },
{ MAX14577_IRQ_INT2_DBCHG, "muic-DBCHG" },
{ MAX14577_IRQ_INT2_VBVOLT, "muic-VBVOLT" },
};
static struct max14577_muic_irq max77836_muic_irqs[] = {
{ MAX14577_IRQ_INT1_ADC, "muic-ADC" },
{ MAX14577_IRQ_INT1_ADCLOW, "muic-ADCLOW" },
{ MAX14577_IRQ_INT1_ADCERR, "muic-ADCError" },
{ MAX77836_IRQ_INT1_ADC1K, "muic-ADC1K" },
{ MAX14577_IRQ_INT2_CHGTYP, "muic-CHGTYP" },
{ MAX14577_IRQ_INT2_CHGDETRUN, "muic-CHGDETRUN" },
{ MAX14577_IRQ_INT2_DCDTMR, "muic-DCDTMR" },
{ MAX14577_IRQ_INT2_DBCHG, "muic-DBCHG" },
{ MAX14577_IRQ_INT2_VBVOLT, "muic-VBVOLT" },
{ MAX77836_IRQ_INT2_VIDRM, "muic-VIDRM" },
};
struct max14577_muic_info {
struct device *dev;
struct max14577 *max14577;
struct extcon_dev *edev;
int prev_cable_type;
int prev_chg_type;
u8 status[MAX14577_MUIC_STATUS_END];
struct max14577_muic_irq *muic_irqs;
unsigned int muic_irqs_num;
bool irq_adc;
bool irq_chg;
struct work_struct irq_work;
struct mutex mutex;
/*
* Use delayed workqueue to detect cable state and then
* notify cable state to notifiee/platform through uevent.
* After completing the booting of platform, the extcon provider
* driver should notify cable state to upper layer.
*/
struct delayed_work wq_detcable;
/*
* Default usb/uart path whether UART/USB or AUX_UART/AUX_USB
* h/w path of COMP2/COMN1 on CONTROL1 register.
*/
int path_usb;
int path_uart;
};
enum max14577_muic_cable_group {
MAX14577_CABLE_GROUP_ADC = 0,
MAX14577_CABLE_GROUP_CHG,
};
/* Define supported accessory type */
enum max14577_muic_acc_type {
MAX14577_MUIC_ADC_GROUND = 0x0,
MAX14577_MUIC_ADC_SEND_END_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S1_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S2_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S3_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S4_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S5_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S6_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S7_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S8_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S9_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S10_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S11_BUTTON,
MAX14577_MUIC_ADC_REMOTE_S12_BUTTON,
MAX14577_MUIC_ADC_RESERVED_ACC_1,
MAX14577_MUIC_ADC_RESERVED_ACC_2,
MAX14577_MUIC_ADC_RESERVED_ACC_3,
MAX14577_MUIC_ADC_RESERVED_ACC_4,
MAX14577_MUIC_ADC_RESERVED_ACC_5,
MAX14577_MUIC_ADC_AUDIO_DEVICE_TYPE2,
MAX14577_MUIC_ADC_PHONE_POWERED_DEV,
MAX14577_MUIC_ADC_TTY_CONVERTER,
Annotation
- Immediate include surface: `linux/devm-helpers.h`, `linux/kernel.h`, `linux/module.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/platform_device.h`, `linux/mfd/max14577.h`, `linux/mfd/max14577-private.h`.
- Detected declarations: `struct max14577_muic_irq`, `struct max14577_muic_info`, `enum max14577_muic_adc_debounce_time`, `enum max14577_muic_status`, `enum max14577_muic_cable_group`, `enum max14577_muic_acc_type`, `function max14577_muic_set_debounce_time`, `function max14577_muic_set_path`, `function max14577_muic_get_cable_type`, `function max14577_muic_jig_handler`.
- Atlas domain: Driver Families / drivers/extcon.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.