drivers/video/fbdev/matrox/matroxfb_maven.c
Source file repositories/reference/linux-study-clean/drivers/video/fbdev/matrox/matroxfb_maven.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/video/fbdev/matrox/matroxfb_maven.c- Extension
.c- Size
- 29971 bytes
- Lines
- 1303
- 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.
- 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
matroxfb_maven.hmatroxfb_misc.hmatroxfb_DAC1064.hlinux/i2c.hlinux/matroxfb.hlinux/slab.hasm/div64.h
Detected Declarations
struct mctlstruct maven_datastruct matrox_pll_features2struct matrox_pll_ctlfunction get_ctrl_idfunction get_ctrl_ptrfunction maven_get_regfunction maven_set_regfunction maven_set_reg_pairfunction matroxfb_PLL_mavenclockfunction matroxfb_mavenclockfunction DAC1064_calcclockfunction maven_compute_deflickerfunction maven_compute_bwlevelfunction maven_compute_gammafunction maven_init_TVdatafunction maven_init_TVfunction maven_find_exact_clocksfunction maven_compute_timmingfunction maven_program_timmingfunction maven_resyncfunction maven_get_queryctrlfunction maven_set_controlfunction maven_get_controlfunction maven_out_computefunction maven_out_programfunction maven_out_startfunction maven_out_verify_modefunction maven_out_get_queryctrlfunction maven_out_get_ctrlfunction maven_out_set_ctrlfunction maven_init_clientfunction maven_shutdown_clientfunction maven_probefunction maven_remove
Annotated Snippet
struct mctl {
struct v4l2_queryctrl desc;
size_t control;
};
#define BLMIN 0x0FF
#define WLMAX 0x3FF
static const struct mctl maven_controls[] =
{ { { V4L2_CID_BRIGHTNESS, V4L2_CTRL_TYPE_INTEGER,
"brightness",
0, WLMAX - BLMIN, 1, 379 - BLMIN,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.brightness) },
{ { V4L2_CID_CONTRAST, V4L2_CTRL_TYPE_INTEGER,
"contrast",
0, 1023, 1, 127,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.contrast) },
{ { V4L2_CID_SATURATION, V4L2_CTRL_TYPE_INTEGER,
"saturation",
0, 255, 1, 155,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.saturation) },
{ { V4L2_CID_HUE, V4L2_CTRL_TYPE_INTEGER,
"hue",
0, 255, 1, 0,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.hue) },
{ { V4L2_CID_GAMMA, V4L2_CTRL_TYPE_INTEGER,
"gamma",
0, ARRAY_SIZE(maven_gamma) - 1, 1, 3,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.gamma) },
{ { MATROXFB_CID_TESTOUT, V4L2_CTRL_TYPE_BOOLEAN,
"test output",
0, 1, 1, 0,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.testout) },
{ { MATROXFB_CID_DEFLICKER, V4L2_CTRL_TYPE_INTEGER,
"deflicker mode",
0, 2, 1, 0,
0,
}, offsetof(struct matrox_fb_info, altout.tvo_params.deflicker) },
};
#define MAVCTRLS ARRAY_SIZE(maven_controls)
/* Return: positive number: id found
-EINVAL: id not found, return failure
-ENOENT: id not found, create fake disabled control */
static int get_ctrl_id(__u32 v4l2_id) {
int i;
for (i = 0; i < MAVCTRLS; i++) {
if (v4l2_id < maven_controls[i].desc.id) {
if (maven_controls[i].desc.id == 0x08000000) {
return -EINVAL;
}
return -ENOENT;
}
if (v4l2_id == maven_controls[i].desc.id) {
return i;
}
}
return -EINVAL;
}
struct maven_data {
struct matrox_fb_info* primary_head;
struct i2c_client *client;
int version;
};
static int* get_ctrl_ptr(struct maven_data* md, int idx) {
return (int*)((char*)(md->primary_head) + maven_controls[idx].control);
}
static int maven_get_reg(struct i2c_client* c, char reg) {
char dst;
struct i2c_msg msgs[] = {
{
.addr = c->addr,
.flags = I2C_M_REV_DIR_ADDR,
.len = sizeof(reg),
.buf = ®
},
{
.addr = c->addr,
Annotation
- Immediate include surface: `matroxfb_maven.h`, `matroxfb_misc.h`, `matroxfb_DAC1064.h`, `linux/i2c.h`, `linux/matroxfb.h`, `linux/slab.h`, `asm/div64.h`.
- Detected declarations: `struct mctl`, `struct maven_data`, `struct matrox_pll_features2`, `struct matrox_pll_ctl`, `function get_ctrl_id`, `function get_ctrl_ptr`, `function maven_get_reg`, `function maven_set_reg`, `function maven_set_reg_pair`, `function matroxfb_PLL_mavenclock`.
- Atlas domain: Driver Families / drivers/video.
- Implementation status: source implementation candidate.
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.