drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pai.c- Extension
.c- Size
- 4768 bytes
- Lines
- 174
- 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
linux/bitfield.hlinux/component.hlinux/module.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.hdrm/bridge/dw_hdmi.hsound/asoundef.h
Detected Declarations
struct imx8mp_hdmi_paifunction imx8mp_hdmi_pai_enablefunction imx8mp_hdmi_pai_disablefunction imx8mp_hdmi_pai_bindfunction imx8mp_hdmi_pai_probefunction imx8mp_hdmi_pai_remove
Annotated Snippet
struct imx8mp_hdmi_pai {
struct regmap *regmap;
struct device *dev;
};
static void imx8mp_hdmi_pai_enable(struct dw_hdmi *dw_hdmi, int channel,
int width, int rate, int non_pcm,
int iec958)
{
const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
struct imx8mp_hdmi_pai *hdmi_pai = pdata->priv_audio;
int val;
if (pm_runtime_resume_and_get(hdmi_pai->dev) < 0)
return;
/* PAI set control extended */
val = WTMK_HIGH(3) | WTMK_LOW(3);
val |= NUM_CH(channel);
regmap_write(hdmi_pai->regmap, HTX_PAI_CTRL_EXT, val);
/* IEC60958 format */
if (iec958) {
val = FIELD_PREP_CONST(P_SEL,
__bf_shf(IEC958_SUBFRAME_PARITY));
val |= FIELD_PREP_CONST(C_SEL,
__bf_shf(IEC958_SUBFRAME_CHANNEL_STATUS));
val |= FIELD_PREP_CONST(U_SEL,
__bf_shf(IEC958_SUBFRAME_USER_DATA));
val |= FIELD_PREP_CONST(V_SEL,
__bf_shf(IEC958_SUBFRAME_VALIDITY));
val |= FIELD_PREP_CONST(D_SEL,
__bf_shf(IEC958_SUBFRAME_SAMPLE_24_MASK));
val |= FIELD_PREP_CONST(PRE_SEL,
__bf_shf(IEC958_SUBFRAME_PREAMBLE_MASK));
} else {
/*
* The allowed PCM widths are 24bit and 32bit, as they are supported
* by aud2htx module.
* for 24bit, D_SEL = 0, select all the bits.
* for 32bit, D_SEL = 8, select 24bit in MSB.
*/
val = FIELD_PREP(D_SEL, width - 24);
}
regmap_write(hdmi_pai->regmap, HTX_PAI_FIELD_CTRL, val);
/* PAI start running */
regmap_write(hdmi_pai->regmap, HTX_PAI_CTRL, ENABLE);
}
static void imx8mp_hdmi_pai_disable(struct dw_hdmi *dw_hdmi)
{
const struct dw_hdmi_plat_data *pdata = dw_hdmi_to_plat_data(dw_hdmi);
struct imx8mp_hdmi_pai *hdmi_pai = pdata->priv_audio;
/* Stop PAI */
regmap_write(hdmi_pai->regmap, HTX_PAI_CTRL, 0);
pm_runtime_put_sync(hdmi_pai->dev);
}
static const struct regmap_config imx8mp_hdmi_pai_regmap_config = {
.reg_bits = 32,
.reg_stride = 4,
.val_bits = 32,
.max_register = HTX_PAI_FIELD_CTRL,
};
static int imx8mp_hdmi_pai_bind(struct device *dev, struct device *master, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
struct dw_hdmi_plat_data *plat_data = data;
struct imx8mp_hdmi_pai *hdmi_pai;
struct resource *res;
void __iomem *base;
int ret;
hdmi_pai = devm_kzalloc(dev, sizeof(*hdmi_pai), GFP_KERNEL);
if (!hdmi_pai)
return -ENOMEM;
base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
if (IS_ERR(base))
return PTR_ERR(base);
hdmi_pai->regmap = devm_regmap_init_mmio_clk(dev, "apb", base,
&imx8mp_hdmi_pai_regmap_config);
if (IS_ERR(hdmi_pai->regmap)) {
dev_err(dev, "regmap init failed\n");
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/component.h`, `linux/module.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `drm/bridge/dw_hdmi.h`.
- Detected declarations: `struct imx8mp_hdmi_pai`, `function imx8mp_hdmi_pai_enable`, `function imx8mp_hdmi_pai_disable`, `function imx8mp_hdmi_pai_bind`, `function imx8mp_hdmi_pai_probe`, `function imx8mp_hdmi_pai_remove`.
- 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.