drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c
Source file repositories/reference/linux-study-clean/drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/amlogic/phy-meson-g12a-mipi-dphy-analog.c- Extension
.c- Size
- 4656 bytes
- Lines
- 173
- Domain
- Driver Families
- Bucket
- drivers/phy
- 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/bitops.hlinux/module.hlinux/phy/phy.hlinux/regmap.hlinux/delay.hlinux/mfd/syscon.hlinux/of.hlinux/platform_device.hdt-bindings/phy/phy.h
Detected Declarations
struct phy_g12a_mipi_dphy_analog_privfunction phy_g12a_mipi_dphy_analog_configurefunction phy_g12a_mipi_dphy_analog_power_onfunction phy_g12a_mipi_dphy_analog_power_offfunction phy_g12a_mipi_dphy_analog_probe
Annotated Snippet
struct phy_g12a_mipi_dphy_analog_priv {
struct phy *phy;
struct regmap *regmap;
struct phy_configure_opts_mipi_dphy config;
};
static int phy_g12a_mipi_dphy_analog_configure(struct phy *phy,
union phy_configure_opts *opts)
{
struct phy_g12a_mipi_dphy_analog_priv *priv = phy_get_drvdata(phy);
int ret;
ret = phy_mipi_dphy_config_validate(&opts->mipi_dphy);
if (ret)
return ret;
memcpy(&priv->config, opts, sizeof(priv->config));
return 0;
}
static int phy_g12a_mipi_dphy_analog_power_on(struct phy *phy)
{
struct phy_g12a_mipi_dphy_analog_priv *priv = phy_get_drvdata(phy);
unsigned int reg;
regmap_write(priv->regmap, HHI_MIPI_CNTL0,
FIELD_PREP(HHI_MIPI_CNTL0_DIF_REF_CTL0, 0x8) |
FIELD_PREP(HHI_MIPI_CNTL0_DIF_REF_CTL1, 0xa487));
regmap_write(priv->regmap, HHI_MIPI_CNTL1,
FIELD_PREP(HHI_MIPI_CNTL2_DIF_REF_CTL2, 0x2e) |
HHI_MIPI_CNTL1_BANDGAP);
regmap_write(priv->regmap, HHI_MIPI_CNTL2,
FIELD_PREP(HHI_MIPI_CNTL2_DIF_TX_CTL0, 0x45a) |
FIELD_PREP(HHI_MIPI_CNTL2_DIF_TX_CTL1, 0x2680));
reg = DSI_LANE_CLK;
switch (priv->config.lanes) {
case 4:
reg |= DSI_LANE_3;
fallthrough;
case 3:
reg |= DSI_LANE_2;
fallthrough;
case 2:
reg |= DSI_LANE_1;
fallthrough;
case 1:
reg |= DSI_LANE_0;
break;
default:
reg = 0;
}
regmap_update_bits(priv->regmap, HHI_MIPI_CNTL2,
HHI_MIPI_CNTL2_CH_EN,
FIELD_PREP(HHI_MIPI_CNTL2_CH_EN, reg));
return 0;
}
static int phy_g12a_mipi_dphy_analog_power_off(struct phy *phy)
{
struct phy_g12a_mipi_dphy_analog_priv *priv = phy_get_drvdata(phy);
regmap_write(priv->regmap, HHI_MIPI_CNTL0, 0);
regmap_write(priv->regmap, HHI_MIPI_CNTL1, 0);
regmap_write(priv->regmap, HHI_MIPI_CNTL2, 0);
return 0;
}
static const struct phy_ops phy_g12a_mipi_dphy_analog_ops = {
.configure = phy_g12a_mipi_dphy_analog_configure,
.power_on = phy_g12a_mipi_dphy_analog_power_on,
.power_off = phy_g12a_mipi_dphy_analog_power_off,
.owner = THIS_MODULE,
};
static int phy_g12a_mipi_dphy_analog_probe(struct platform_device *pdev)
{
struct phy_provider *phy;
struct device *dev = &pdev->dev;
struct phy_g12a_mipi_dphy_analog_priv *priv;
struct device_node *np = dev->of_node, *parent_np;
struct regmap *map;
priv = devm_kmalloc(dev, sizeof(*priv), GFP_KERNEL);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/bitops.h`, `linux/module.h`, `linux/phy/phy.h`, `linux/regmap.h`, `linux/delay.h`, `linux/mfd/syscon.h`, `linux/of.h`.
- Detected declarations: `struct phy_g12a_mipi_dphy_analog_priv`, `function phy_g12a_mipi_dphy_analog_configure`, `function phy_g12a_mipi_dphy_analog_power_on`, `function phy_g12a_mipi_dphy_analog_power_off`, `function phy_g12a_mipi_dphy_analog_probe`.
- Atlas domain: Driver Families / drivers/phy.
- 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.