drivers/w1/masters/ds2490.c
Source file repositories/reference/linux-study-clean/drivers/w1/masters/ds2490.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/w1/masters/ds2490.c- Extension
.c- Size
- 26888 bytes
- Lines
- 1126
- Domain
- Driver Families
- Bucket
- drivers/w1
- 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.
- 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/module.hlinux/kernel.hlinux/mod_devicetable.hlinux/usb.hlinux/slab.hlinux/w1.h
Detected Declarations
struct ds_devicestruct ds_statusfunction ds_send_control_cmdfunction ds_send_control_modefunction ds_send_controlfunction ds_dump_statusfunction ds_recv_statusfunction ds_reset_devicefunction ds_recv_datafunction ds_send_datafunction ds_stop_pulsefunction ds_detectfunction ds_wait_statusfunction ds_resetfunction ds_set_speedfunction ds_set_pullupfunction ds_touch_bitfunction ds_write_bitfunction ds_write_bytefunction ds_read_bytefunction read_block_chunkfunction ds_read_blockfunction ds_write_blockfunction ds9490r_searchfunction ds_match_accessfunction ds_set_pathfunction ds9490r_touch_bitfunction ds9490r_write_bitfunction ds9490r_read_bitfunction ds9490r_write_bytefunction ds9490r_read_bytefunction ds9490r_write_blockfunction ds9490r_read_blockfunction ds9490r_resetfunction ds9490r_set_pullupfunction ds_w1_initfunction ds_w1_finifunction ds_probefunction ds_disconnect
Annotated Snippet
struct ds_device {
struct list_head ds_entry;
struct usb_device *udev;
struct usb_interface *intf;
int ep[NUM_EP];
/* Strong PullUp
* 0: pullup not active, else duration in milliseconds
*/
int spu_sleep;
/* spu_bit contains COMM_SPU or 0 depending on if the strong pullup
* should be active or not for writes.
*/
u16 spu_bit;
u8 st_buf[ST_SIZE];
u8 byte_buf;
struct w1_bus_master master;
};
struct ds_status {
u8 enable;
u8 speed;
u8 pullup_dur;
u8 ppuls_dur;
u8 pulldown_slew;
u8 write1_time;
u8 write0_time;
u8 reserved0;
u8 status;
u8 command0;
u8 command1;
u8 command_buffer_status;
u8 data_out_buffer_status;
u8 data_in_buffer_status;
u8 reserved1;
u8 reserved2;
};
static LIST_HEAD(ds_devices);
static DEFINE_MUTEX(ds_mutex);
static int ds_send_control_cmd(struct ds_device *dev, u16 value, u16 index)
{
int err;
err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
CONTROL_CMD, VENDOR, value, index, NULL, 0, 1000);
if (err < 0) {
dev_err(&dev->udev->dev,
"Failed to send command control message %x.%x: err=%d.\n",
value, index, err);
return err;
}
return err;
}
static int ds_send_control_mode(struct ds_device *dev, u16 value, u16 index)
{
int err;
err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
MODE_CMD, VENDOR, value, index, NULL, 0, 1000);
if (err < 0) {
dev_err(&dev->udev->dev,
"Failed to send mode control message %x.%x: err=%d.\n",
value, index, err);
return err;
}
return err;
}
static int ds_send_control(struct ds_device *dev, u16 value, u16 index)
{
int err;
err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, dev->ep[EP_CONTROL]),
COMM_CMD, VENDOR, value, index, NULL, 0, 1000);
if (err < 0) {
dev_err(&dev->udev->dev,
"Failed to send control message %x.%x: err=%d.\n",
value, index, err);
return err;
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/usb.h`, `linux/slab.h`, `linux/w1.h`.
- Detected declarations: `struct ds_device`, `struct ds_status`, `function ds_send_control_cmd`, `function ds_send_control_mode`, `function ds_send_control`, `function ds_dump_status`, `function ds_recv_status`, `function ds_reset_device`, `function ds_recv_data`, `function ds_send_data`.
- Atlas domain: Driver Families / drivers/w1.
- 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.