drivers/mfd/nct6694.c
Source file repositories/reference/linux-study-clean/drivers/mfd/nct6694.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mfd/nct6694.c- Extension
.c- Size
- 10555 bytes
- Lines
- 389
- Domain
- Driver Families
- Bucket
- drivers/mfd
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bits.hlinux/interrupt.hlinux/idr.hlinux/irq.hlinux/irqdomain.hlinux/kernel.hlinux/mfd/core.hlinux/mfd/nct6694.hlinux/module.hlinux/slab.hlinux/spinlock.hlinux/usb.h
Detected Declarations
function nct6694_response_err_handlingfunction nct6694_read_msgfunction nct6694_write_msgfunction usb_int_callbackfunction nct6694_irq_enablefunction nct6694_irq_disablefunction nct6694_irq_domain_mapfunction nct6694_irq_domain_unmapfunction nct6694_usb_probefunction nct6694_usb_disconnectexport nct6694_read_msgexport nct6694_write_msg
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2025 Nuvoton Technology Corp.
*
* Nuvoton NCT6694 core driver using USB interface to provide
* access to the NCT6694 hardware monitoring and control features.
*
* The NCT6694 is an integrated controller that provides GPIO, I2C,
* CAN, WDT, HWMON and RTC management.
*/
#include <linux/bits.h>
#include <linux/interrupt.h>
#include <linux/idr.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
#include <linux/kernel.h>
#include <linux/mfd/core.h>
#include <linux/mfd/nct6694.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/usb.h>
static const struct mfd_cell nct6694_devs[] = {
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-gpio"),
MFD_CELL_NAME("nct6694-i2c"),
MFD_CELL_NAME("nct6694-i2c"),
MFD_CELL_NAME("nct6694-i2c"),
MFD_CELL_NAME("nct6694-i2c"),
MFD_CELL_NAME("nct6694-i2c"),
MFD_CELL_NAME("nct6694-i2c"),
MFD_CELL_NAME("nct6694-canfd"),
MFD_CELL_NAME("nct6694-canfd"),
MFD_CELL_NAME("nct6694-wdt"),
MFD_CELL_NAME("nct6694-wdt"),
MFD_CELL_NAME("nct6694-hwmon"),
MFD_CELL_NAME("nct6694-rtc"),
};
static int nct6694_response_err_handling(struct nct6694 *nct6694, unsigned char err_status)
{
switch (err_status) {
case NCT6694_NO_ERROR:
return 0;
case NCT6694_NOT_SUPPORT_ERROR:
dev_err(nct6694->dev, "Command is not supported!\n");
break;
case NCT6694_NO_RESPONSE_ERROR:
dev_warn(nct6694->dev, "Command received no response!\n");
break;
case NCT6694_TIMEOUT_ERROR:
dev_warn(nct6694->dev, "Command timed out!\n");
break;
case NCT6694_PENDING:
dev_err(nct6694->dev, "Command is pending!\n");
break;
default:
return -EINVAL;
}
return -EIO;
}
/**
* nct6694_read_msg() - Read message from NCT6694 device
* @nct6694: NCT6694 device pointer
* @cmd_hd: command header structure
* @buf: buffer to store the response data
*
Annotation
- Immediate include surface: `linux/bits.h`, `linux/interrupt.h`, `linux/idr.h`, `linux/irq.h`, `linux/irqdomain.h`, `linux/kernel.h`, `linux/mfd/core.h`, `linux/mfd/nct6694.h`.
- Detected declarations: `function nct6694_response_err_handling`, `function nct6694_read_msg`, `function nct6694_write_msg`, `function usb_int_callback`, `function nct6694_irq_enable`, `function nct6694_irq_disable`, `function nct6694_irq_domain_map`, `function nct6694_irq_domain_unmap`, `function nct6694_usb_probe`, `function nct6694_usb_disconnect`.
- Atlas domain: Driver Families / drivers/mfd.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.