drivers/misc/mei/vsc-tp.c
Source file repositories/reference/linux-study-clean/drivers/misc/mei/vsc-tp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/mei/vsc-tp.c- Extension
.c- Size
- 14552 bytes
- Lines
- 578
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- 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/acpi.hlinux/cleanup.hlinux/crc32.hlinux/delay.hlinux/device.hlinux/interrupt.hlinux/iopoll.hlinux/irq.hlinux/irqreturn.hlinux/module.hlinux/mutex.hlinux/platform_device.hlinux/spi/spi.hlinux/types.hlinux/workqueue.hvsc-tp.h
Detected Declarations
struct vsc_tp_packet_hdrstruct vsc_tp_packetstruct vsc_tpfunction vsc_tp_isrfunction vsc_tp_event_workfunction vsc_tp_wakeup_requestfunction vsc_tp_wakeup_releasefunction vsc_tp_dev_xferfunction vsc_tp_xfer_helperfunction vsc_tp_xferfunction vsc_tp_rom_xferfunction vsc_tp_resetfunction vsc_tp_need_readfunction vsc_tp_register_event_cbfunction vsc_tp_intr_synchronizefunction vsc_tp_intr_enablefunction vsc_tp_intr_disablefunction vsc_tp_match_anyfunction vsc_tp_probefunction vsc_tp_remove
Annotated Snippet
struct vsc_tp_packet_hdr {
__u8 sync;
__u8 cmd;
__le16 len;
__le32 seq;
};
struct vsc_tp_packet {
struct vsc_tp_packet_hdr hdr;
__u8 buf[VSC_TP_MAX_XFER_SIZE - sizeof(struct vsc_tp_packet_hdr)];
};
struct vsc_tp {
/* do the actual data transfer */
struct spi_device *spi;
/* bind with mei framework */
struct platform_device *pdev;
struct gpio_desc *wakeuphost;
struct gpio_desc *resetfw;
struct gpio_desc *wakeupfw;
/* command sequence number */
u32 seq;
/* command buffer */
struct vsc_tp_packet *tx_buf;
struct vsc_tp_packet *rx_buf;
atomic_t assert_cnt;
wait_queue_head_t xfer_wait;
struct work_struct event_work;
vsc_tp_event_cb_t event_notify;
void *event_notify_context;
struct mutex event_notify_mutex; /* protects event_notify + context */
struct mutex mutex; /* protects command download */
};
/* GPIO resources */
static const struct acpi_gpio_params wakeuphost_gpio = { 0, 0, false };
static const struct acpi_gpio_params wakeuphostint_gpio = { 1, 0, false };
static const struct acpi_gpio_params resetfw_gpio = { 2, 0, false };
static const struct acpi_gpio_params wakeupfw = { 3, 0, false };
static const struct acpi_gpio_mapping vsc_tp_acpi_gpios[] = {
{ "wakeuphost-gpios", &wakeuphost_gpio, 1 },
{ "wakeuphostint-gpios", &wakeuphostint_gpio, 1 },
{ "resetfw-gpios", &resetfw_gpio, 1 },
{ "wakeupfw-gpios", &wakeupfw, 1 },
{}
};
static irqreturn_t vsc_tp_isr(int irq, void *data)
{
struct vsc_tp *tp = data;
atomic_inc(&tp->assert_cnt);
wake_up(&tp->xfer_wait);
schedule_work(&tp->event_work);
return IRQ_HANDLED;
}
static void vsc_tp_event_work(struct work_struct *work)
{
struct vsc_tp *tp = container_of(work, struct vsc_tp, event_work);
guard(mutex)(&tp->event_notify_mutex);
if (tp->event_notify)
tp->event_notify(tp->event_notify_context);
}
/* wakeup firmware and wait for response */
static int vsc_tp_wakeup_request(struct vsc_tp *tp)
{
int ret;
gpiod_set_value_cansleep(tp->wakeupfw, 0);
ret = wait_event_timeout(tp->xfer_wait,
atomic_read(&tp->assert_cnt),
VSC_TP_WAIT_FW_POLL_TIMEOUT);
if (!ret)
return -ETIMEDOUT;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/cleanup.h`, `linux/crc32.h`, `linux/delay.h`, `linux/device.h`, `linux/interrupt.h`, `linux/iopoll.h`, `linux/irq.h`.
- Detected declarations: `struct vsc_tp_packet_hdr`, `struct vsc_tp_packet`, `struct vsc_tp`, `function vsc_tp_isr`, `function vsc_tp_event_work`, `function vsc_tp_wakeup_request`, `function vsc_tp_wakeup_release`, `function vsc_tp_dev_xfer`, `function vsc_tp_xfer_helper`, `function vsc_tp_xfer`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: integration 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.