drivers/gpu/drm/i915/display/dvo_ch7017.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/i915/display/dvo_ch7017.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/i915/display/dvo_ch7017.c- Extension
.c- Size
- 12680 bytes
- Lines
- 418
- Domain
- Driver Families
- Bucket
- drivers/gpu
- 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
drm/drm_print.hintel_display_types.hintel_dvo_dev.h
Detected Declarations
struct ch7017_privfunction ch7017_readfunction ch7017_writefunction ch7017_initfunction ch7017_detectfunction ch7017_mode_validfunction ch7017_mode_setfunction ch7017_dpmsfunction ch7017_get_hw_statefunction ch7017_dump_regsfunction ch7017_destroy
Annotated Snippet
struct ch7017_priv {
u8 dummy;
};
static void ch7017_dump_regs(struct intel_dvo_device *dvo);
static void ch7017_dpms(struct intel_dvo_device *dvo, bool enable);
static bool ch7017_read(struct intel_dvo_device *dvo, u8 addr, u8 *val)
{
struct i2c_msg msgs[] = {
{
.addr = dvo->target_addr,
.flags = 0,
.len = 1,
.buf = &addr,
},
{
.addr = dvo->target_addr,
.flags = I2C_M_RD,
.len = 1,
.buf = val,
}
};
return i2c_transfer(dvo->i2c_bus, msgs, 2) == 2;
}
static bool ch7017_write(struct intel_dvo_device *dvo, u8 addr, u8 val)
{
u8 buf[2] = { addr, val };
struct i2c_msg msg = {
.addr = dvo->target_addr,
.flags = 0,
.len = 2,
.buf = buf,
};
return i2c_transfer(dvo->i2c_bus, &msg, 1) == 1;
}
/** Probes for a CH7017 on the given bus and target address. */
static bool ch7017_init(struct intel_dvo_device *dvo,
struct i2c_adapter *adapter)
{
struct ch7017_priv *priv;
const char *str;
u8 val;
priv = kzalloc_obj(*priv);
if (priv == NULL)
return false;
dvo->i2c_bus = adapter;
dvo->dev_priv = priv;
if (!ch7017_read(dvo, CH7017_DEVICE_ID, &val))
goto fail;
switch (val) {
case CH7017_DEVICE_ID_VALUE:
str = "ch7017";
break;
case CH7018_DEVICE_ID_VALUE:
str = "ch7018";
break;
case CH7019_DEVICE_ID_VALUE:
str = "ch7019";
break;
default:
DRM_DEBUG_KMS("ch701x not detected, got %d: from %s "
"target %d.\n",
val, adapter->name, dvo->target_addr);
goto fail;
}
DRM_DEBUG_KMS("%s detected on %s, addr %d\n",
str, adapter->name, dvo->target_addr);
return true;
fail:
kfree(priv);
return false;
}
static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo)
{
return connector_status_connected;
}
static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo,
const struct drm_display_mode *mode)
{
Annotation
- Immediate include surface: `drm/drm_print.h`, `intel_display_types.h`, `intel_dvo_dev.h`.
- Detected declarations: `struct ch7017_priv`, `function ch7017_read`, `function ch7017_write`, `function ch7017_init`, `function ch7017_detect`, `function ch7017_mode_valid`, `function ch7017_mode_set`, `function ch7017_dpms`, `function ch7017_get_hw_state`, `function ch7017_dump_regs`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.