drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_dphy.c- Extension
.c- Size
- 1889 bytes
- Lines
- 73
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/phy/phy.hlinux/regmap.hsun8i_a83t_dphy.hsun8i_a83t_mipi_csi2.h
Detected Declarations
function sun8i_a83t_dphy_configurefunction sun8i_a83t_dphy_power_onfunction sun8i_a83t_dphy_power_offfunction sun8i_a83t_dphy_register
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2020-2022 Bootlin
* Author: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
*/
#include <linux/phy/phy.h>
#include <linux/regmap.h>
#include "sun8i_a83t_dphy.h"
#include "sun8i_a83t_mipi_csi2.h"
static int sun8i_a83t_dphy_configure(struct phy *dphy,
union phy_configure_opts *opts)
{
return phy_mipi_dphy_config_validate(&opts->mipi_dphy);
}
static int sun8i_a83t_dphy_power_on(struct phy *dphy)
{
struct sun8i_a83t_mipi_csi2_device *csi2_dev = phy_get_drvdata(dphy);
struct regmap *regmap = csi2_dev->regmap;
regmap_write(regmap, SUN8I_A83T_DPHY_CTRL_REG,
SUN8I_A83T_DPHY_CTRL_RESET_N |
SUN8I_A83T_DPHY_CTRL_SHUTDOWN_N);
regmap_write(regmap, SUN8I_A83T_DPHY_ANA0_REG,
SUN8I_A83T_DPHY_ANA0_REXT_EN |
SUN8I_A83T_DPHY_ANA0_RINT(2) |
SUN8I_A83T_DPHY_ANA0_SNK(2));
return 0;
};
static int sun8i_a83t_dphy_power_off(struct phy *dphy)
{
struct sun8i_a83t_mipi_csi2_device *csi2_dev = phy_get_drvdata(dphy);
struct regmap *regmap = csi2_dev->regmap;
regmap_write(regmap, SUN8I_A83T_DPHY_CTRL_REG, 0);
return 0;
};
static const struct phy_ops sun8i_a83t_dphy_ops = {
.configure = sun8i_a83t_dphy_configure,
.power_on = sun8i_a83t_dphy_power_on,
.power_off = sun8i_a83t_dphy_power_off,
};
int sun8i_a83t_dphy_register(struct sun8i_a83t_mipi_csi2_device *csi2_dev)
{
struct device *dev = csi2_dev->dev;
struct phy_provider *phy_provider;
csi2_dev->dphy = devm_phy_create(dev, NULL, &sun8i_a83t_dphy_ops);
if (IS_ERR(csi2_dev->dphy)) {
dev_err(dev, "failed to create D-PHY\n");
return PTR_ERR(csi2_dev->dphy);
}
phy_set_drvdata(csi2_dev->dphy, csi2_dev);
phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
if (IS_ERR(phy_provider)) {
dev_err(dev, "failed to register D-PHY provider\n");
return PTR_ERR(phy_provider);
}
return 0;
}
Annotation
- Immediate include surface: `linux/phy/phy.h`, `linux/regmap.h`, `sun8i_a83t_dphy.h`, `sun8i_a83t_mipi_csi2.h`.
- Detected declarations: `function sun8i_a83t_dphy_configure`, `function sun8i_a83t_dphy_power_on`, `function sun8i_a83t_dphy_power_off`, `function sun8i_a83t_dphy_register`.
- Atlas domain: Driver Families / drivers/media.
- 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.