drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/rockchip/inno_hdmi-rockchip.c- Extension
.c- Size
- 5180 bytes
- Lines
- 191
- 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.
- 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/err.hlinux/hw_bitfield.hlinux/mfd/syscon.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hlinux/regmap.hdrm/bridge/inno_hdmi.hdrm/drm_bridge_connector.hdrm/drm_managed.hdrm/drm_of.hrockchip_drm_drv.h
Detected Declarations
struct inno_hdmi_connector_statestruct rockchip_inno_hdmienum inno_hdmi_dev_typefunction inno_hdmi_rk3036_enablefunction inno_hdmi_encoder_atomic_checkfunction inno_hdmi_rockchip_bindfunction inno_hdmi_rockchip_probefunction inno_hdmi_rockchip_remove
Annotated Snippet
struct inno_hdmi_connector_state {
struct drm_connector_state base;
unsigned int colorimetry;
};
struct rockchip_inno_hdmi {
struct inno_hdmi *base;
struct device *dev;
struct regmap *grf;
struct rockchip_encoder encoder;
};
static struct inno_hdmi_phy_config rk3036_hdmi_phy_configs[] = {
{ 74250000, 0x3f, 0xbb },
{ 165000000, 0x6f, 0xbb },
{ ~0UL, 0x00, 0x00 }
};
static struct inno_hdmi_phy_config rk3128_hdmi_phy_configs[] = {
{ 74250000, 0x3f, 0xaa },
{ 165000000, 0x5f, 0xaa },
{ ~0UL, 0x00, 0x00 }
};
static void inno_hdmi_rk3036_enable(struct device *dev, struct drm_display_mode *mode)
{
struct rockchip_inno_hdmi *hdmi = dev_get_drvdata(dev);
int value, psync;
psync = mode->flags & DRM_MODE_FLAG_PHSYNC ? 1 : 0;
value = FIELD_PREP_WM16(RK3036_HDMI_PHSYNC, psync);
psync = mode->flags & DRM_MODE_FLAG_PVSYNC ? 1 : 0;
value |= FIELD_PREP_WM16(RK3036_HDMI_PVSYNC, psync);
regmap_write(hdmi->grf, RK3036_GRF_SOC_CON2, value);
}
static int inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
struct rockchip_crtc_state *s = to_rockchip_crtc_state(crtc_state);
s->output_mode = ROCKCHIP_OUT_MODE_P888;
s->output_type = DRM_MODE_CONNECTOR_HDMIA;
return 0;
}
static const struct drm_encoder_helper_funcs inno_hdmi_rockchip_encoder_helper_funcs = {
.atomic_check = inno_hdmi_encoder_atomic_check,
};
static int inno_hdmi_rockchip_bind(struct device *dev, struct device *master, void *data)
{
struct drm_device *drm = data;
struct drm_connector *connector;
struct drm_encoder *encoder;
struct rockchip_inno_hdmi *hdmi;
const struct inno_hdmi_plat_data *plat_data;
int ret;
hdmi = drmm_kzalloc(drm, sizeof(*hdmi), GFP_KERNEL);
if (!hdmi)
return -ENOMEM;
hdmi->dev = dev;
plat_data = of_device_get_match_data(hdmi->dev);
if (!plat_data)
return -EINVAL;
if (of_device_is_compatible(dev->of_node, "rockchip,rk3036-inno-hdmi")) {
hdmi->grf = syscon_regmap_lookup_by_phandle(dev->of_node, "rockchip,grf");
if (IS_ERR(hdmi->grf))
return dev_err_probe(dev,
PTR_ERR(hdmi->grf), "Unable to get rockchip,grf\n");
}
encoder = &hdmi->encoder.encoder;
encoder->possible_crtcs = drm_of_find_possible_crtcs(drm, dev->of_node);
/*
* If we failed to find the CRTC(s) which this encoder is
* supposed to be connected to, it's because the CRTC has
* not been registered yet. Defer probing, and hope that
* the required CRTC is added later.
*/
if (encoder->possible_crtcs == 0)
return -EPROBE_DEFER;
Annotation
- Immediate include surface: `linux/err.h`, `linux/hw_bitfield.h`, `linux/mfd/syscon.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/platform_device.h`, `linux/regmap.h`, `drm/bridge/inno_hdmi.h`.
- Detected declarations: `struct inno_hdmi_connector_state`, `struct rockchip_inno_hdmi`, `enum inno_hdmi_dev_type`, `function inno_hdmi_rk3036_enable`, `function inno_hdmi_encoder_atomic_check`, `function inno_hdmi_rockchip_bind`, `function inno_hdmi_rockchip_probe`, `function inno_hdmi_rockchip_remove`.
- Atlas domain: Driver Families / drivers/gpu.
- 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.