drivers/staging/nvec/nvec.h
Source file repositories/reference/linux-study-clean/drivers/staging/nvec/nvec.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/nvec/nvec.h- Extension
.h- Size
- 5770 bytes
- Lines
- 180
- Domain
- Driver Families
- Bucket
- drivers/staging
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/atomic.hlinux/clk.hlinux/completion.hlinux/list.hlinux/mutex.hlinux/notifier.hlinux/reset.hlinux/spinlock.hlinux/workqueue.h
Detected Declarations
struct nvec_msgstruct nvec_chipenum nvec_event_sizeenum nvec_msg_type
Annotated Snippet
struct nvec_msg {
struct list_head node;
unsigned char data[NVEC_MSG_SIZE];
unsigned short size;
unsigned short pos;
atomic_t used;
};
/**
* struct nvec_chip - A single connection to an NVIDIA Embedded controller
* @dev: The device
* @gpio: The same as for &struct nvec_platform_data
* @irq: The IRQ of the I2C device
* @i2c_addr: The address of the I2C slave
* @base: The base of the memory mapped region of the I2C device
* @i2c_clk: The clock of the I2C device
* @rst: The reset of the I2C device
* @notifier_list: Notifiers to be called on received messages, see
* nvec_register_notifier()
* @rx_data: Received messages that have to be processed
* @tx_data: Messages waiting to be sent to the controller
* @nvec_status_notifier: Internal notifier (see nvec_status_notifier())
* @rx_work: A work structure for the RX worker nvec_dispatch()
* @tx_work: A work structure for the TX worker nvec_request_master()
* @wq: The work queue in which @rx_work and @tx_work are executed
* @rx: The message currently being retrieved or %NULL
* @msg_pool: A pool of messages for allocation
* @tx: The message currently being transferred
* @tx_scratch: Used for building pseudo messages
* @ec_transfer: A completion that will be completed once a message has been
* received (see nvec_rx_completed())
* @tx_lock: Spinlock for modifications on @tx_data
* @rx_lock: Spinlock for modifications on @rx_data
* @sync_write_mutex: A mutex for nvec_write_sync()
* @sync_write: A completion to signal that a synchronous message is complete
* @sync_write_pending: The first two bytes of the request (type and subtype)
* @last_sync_msg: The last synchronous message.
* @state: State of our finite state machine used in nvec_interrupt()
*/
struct nvec_chip {
struct device *dev;
struct gpio_desc *gpiod;
int irq;
u32 i2c_addr;
void __iomem *base;
struct clk *i2c_clk;
struct reset_control *rst;
struct atomic_notifier_head notifier_list;
struct list_head rx_data, tx_data;
struct notifier_block nvec_status_notifier;
struct work_struct rx_work, tx_work;
struct workqueue_struct *wq;
struct nvec_msg msg_pool[NVEC_POOL_SIZE];
struct nvec_msg *rx;
struct nvec_msg *tx;
struct nvec_msg tx_scratch;
struct completion ec_transfer;
spinlock_t tx_lock, rx_lock;
/* sync write stuff */
struct mutex sync_write_mutex;
struct completion sync_write;
u16 sync_write_pending;
struct nvec_msg *last_sync_msg;
int state;
};
int nvec_write_async(struct nvec_chip *nvec, const unsigned char *data,
short size);
int nvec_write_sync(struct nvec_chip *nvec,
const unsigned char *data, short size,
struct nvec_msg **msg);
int nvec_register_notifier(struct nvec_chip *nvec,
struct notifier_block *nb,
unsigned int events);
int nvec_unregister_notifier(struct nvec_chip *dev, struct notifier_block *nb);
void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg);
#endif
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/clk.h`, `linux/completion.h`, `linux/list.h`, `linux/mutex.h`, `linux/notifier.h`, `linux/reset.h`, `linux/spinlock.h`.
- Detected declarations: `struct nvec_msg`, `struct nvec_chip`, `enum nvec_event_size`, `enum nvec_msg_type`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source 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.