drivers/video/fbdev/smscufx.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/smscufx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/smscufx.c- Extension
.c- Size
- 54019 bytes
- Lines
- 1954
- Domain
- Driver Families
- Bucket
- drivers/video
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/init.hlinux/usb.hlinux/uaccess.hlinux/mm.hlinux/fb.hlinux/vmalloc.hlinux/slab.hlinux/delay.hedid.h
Detected Declarations
struct dloareastruct urb_nodestruct urb_liststruct ufx_datastruct pll_valuesfunction ufx_reg_readfunction ufx_reg_writefunction ufx_reg_clear_and_set_bitsfunction ufx_reg_set_bitsfunction ufx_reg_clear_bitsfunction ufx_lite_resetfunction ufx_blankfunction ufx_unblankfunction ufx_disablefunction ufx_enablefunction ufx_config_sys_clkfunction ufx_config_ddr2function ufx_calc_rangefunction ufx_calc_pll_valuesfunction ufx_config_pix_clkfunction ufx_set_vid_modefunction ufx_ops_mmapfunction ufx_raw_rectfunction ufx_handle_damagefunction ufx_dpy_deferred_iofunction ufx_ops_ioctlfunction ufx_ops_setcolregfunction ufx_ops_openfunction instancefunction ufx_ops_destoryfunction ufx_release_urb_workfunction ufx_free_framebufferfunction ufx_ops_releasefunction ufx_is_valid_modefunction ufx_var_color_formatfunction ufx_ops_check_varfunction ufx_ops_set_parfunction ufx_ops_blankfunction ufx_ops_damage_rangefunction ufx_ops_damage_areafunction ufx_realloc_framebufferfunction ufx_i2c_initfunction ufx_i2c_configurefunction ufx_i2c_wait_busyfunction ufx_read_edidfunction ufx_setup_modesfunction ufx_usb_probefunction ufx_usb_disconnect
Annotated Snippet
struct dloarea {
int x, y;
int w, h;
};
struct urb_node {
struct list_head entry;
struct ufx_data *dev;
struct delayed_work release_urb_work;
struct urb *urb;
};
struct urb_list {
struct list_head list;
spinlock_t lock;
struct semaphore limit_sem;
int available;
int count;
size_t size;
};
struct ufx_data {
struct usb_device *udev;
struct device *gdev; /* &udev->dev */
struct fb_info *info;
struct urb_list urbs;
struct kref kref;
int fb_count;
bool virtualized; /* true when physical usb device not present */
atomic_t usb_active; /* 0 = update virtual buffer, but no usb traffic */
atomic_t lost_pixels; /* 1 = a render op failed. Need screen refresh */
u8 *edid; /* null until we read edid from hw or get from sysfs */
size_t edid_size;
u32 pseudo_palette[256];
};
static struct fb_fix_screeninfo ufx_fix = {
.id = "smscufx",
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_TRUECOLOR,
.xpanstep = 0,
.ypanstep = 0,
.ywrapstep = 0,
.accel = FB_ACCEL_NONE,
};
static const u32 smscufx_info_flags = FBINFO_READS_FAST |
FBINFO_VIRTFB | FBINFO_HWACCEL_IMAGEBLIT | FBINFO_HWACCEL_FILLRECT |
FBINFO_HWACCEL_COPYAREA | FBINFO_MISC_ALWAYS_SETPAR;
static const struct usb_device_id id_table[] = {
{USB_DEVICE(0x0424, 0x9d00),},
{USB_DEVICE(0x0424, 0x9d01),},
{},
};
MODULE_DEVICE_TABLE(usb, id_table);
/* module options */
static bool console; /* Optionally allow fbcon to consume first framebuffer */
static bool fb_defio = true; /* Optionally enable fb_defio mmap support */
/* ufx keeps a list of urbs for efficient bulk transfers */
static void ufx_urb_completion(struct urb *urb);
static struct urb *ufx_get_urb(struct ufx_data *dev);
static int ufx_submit_urb(struct ufx_data *dev, struct urb * urb, size_t len);
static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size);
static void ufx_free_urb_list(struct ufx_data *dev);
static DEFINE_MUTEX(disconnect_mutex);
/* reads a control register */
static int ufx_reg_read(struct ufx_data *dev, u32 index, u32 *data)
{
u32 *buf = kmalloc(4, GFP_KERNEL);
int ret;
BUG_ON(!dev);
if (!buf)
return -ENOMEM;
ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
USB_VENDOR_REQUEST_READ_REGISTER,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
00, index, buf, 4, USB_CTRL_GET_TIMEOUT);
le32_to_cpus(buf);
*data = *buf;
kfree(buf);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/init.h`, `linux/usb.h`, `linux/uaccess.h`, `linux/mm.h`, `linux/fb.h`, `linux/vmalloc.h`.
- Detected declarations: `struct dloarea`, `struct urb_node`, `struct urb_list`, `struct ufx_data`, `struct pll_values`, `function ufx_reg_read`, `function ufx_reg_write`, `function ufx_reg_clear_and_set_bits`, `function ufx_reg_set_bits`, `function ufx_reg_clear_bits`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.