drivers/pmdomain/imx/imx8mp-blk-ctrl.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/imx/imx8mp-blk-ctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/imx/imx8mp-blk-ctrl.c- Extension
.c- Size
- 25370 bytes
- Lines
- 894
- Domain
- Driver Families
- Bucket
- drivers/pmdomain
- 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/clk.hlinux/clk-provider.hlinux/device.hlinux/interconnect.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_domain.hlinux/pm_runtime.hlinux/regmap.hdt-bindings/power/imx8mp-power.h
Detected Declarations
struct imx8mp_blk_ctrl_domainstruct imx8mp_blk_ctrlstruct imx8mp_blk_ctrl_domain_datastruct imx8mp_blk_ctrl_domainstruct imx8mp_blk_ctrl_datastruct clk_hsio_pllfunction to_imx8mp_blk_ctrl_domainfunction clk_hsio_pll_preparefunction clk_hsio_pll_unpreparefunction clk_hsio_pll_is_preparedfunction clk_hsio_pll_recalc_ratefunction imx8mp_hsio_blk_ctrl_probefunction imx8mp_hsio_blk_ctrl_power_onfunction imx8mp_hsio_blk_ctrl_power_offfunction imx8mp_hsio_power_notifierfunction imx8mp_hdmi_blk_ctrl_power_onfunction imx8mp_hdmi_blk_ctrl_power_offfunction imx8mp_hdmi_power_notifierfunction imx8mp_blk_ctrl_power_onfunction imx8mp_blk_ctrl_power_offfunction imx8mp_blk_ctrl_gpc_notifierfunction imx8mp_blk_ctrl_probefunction imx8mp_blk_ctrl_removefunction imx8mp_blk_ctrl_suspendfunction imx8mp_blk_ctrl_resume
Annotated Snippet
struct imx8mp_blk_ctrl {
struct device *dev;
struct notifier_block power_nb;
struct device *bus_power_dev;
struct regmap *regmap;
struct imx8mp_blk_ctrl_domain *domains;
struct genpd_onecell_data onecell_data;
void (*power_off) (struct imx8mp_blk_ctrl *bc, struct imx8mp_blk_ctrl_domain *domain);
void (*power_on) (struct imx8mp_blk_ctrl *bc, struct imx8mp_blk_ctrl_domain *domain);
};
struct imx8mp_blk_ctrl_domain_data {
const char *name;
const char * const *clk_names;
int num_clks;
const char * const *path_names;
int num_paths;
const char *gpc_name;
const unsigned int flags;
};
#define DOMAIN_MAX_CLKS 3
#define DOMAIN_MAX_PATHS 3
struct imx8mp_blk_ctrl_domain {
struct generic_pm_domain genpd;
const struct imx8mp_blk_ctrl_domain_data *data;
struct clk_bulk_data clks[DOMAIN_MAX_CLKS];
struct icc_bulk_data paths[DOMAIN_MAX_PATHS];
struct device *power_dev;
struct imx8mp_blk_ctrl *bc;
struct notifier_block power_nb;
int num_paths;
int id;
};
struct imx8mp_blk_ctrl_data {
int max_reg;
int (*probe) (struct imx8mp_blk_ctrl *bc);
notifier_fn_t power_notifier_fn;
void (*power_off) (struct imx8mp_blk_ctrl *bc, struct imx8mp_blk_ctrl_domain *domain);
void (*power_on) (struct imx8mp_blk_ctrl *bc, struct imx8mp_blk_ctrl_domain *domain);
const struct imx8mp_blk_ctrl_domain_data *domains;
int num_domains;
};
static inline struct imx8mp_blk_ctrl_domain *
to_imx8mp_blk_ctrl_domain(struct generic_pm_domain *genpd)
{
return container_of(genpd, struct imx8mp_blk_ctrl_domain, genpd);
}
struct clk_hsio_pll {
struct clk_hw hw;
struct regmap *regmap;
};
static inline struct clk_hsio_pll *to_clk_hsio_pll(struct clk_hw *hw)
{
return container_of(hw, struct clk_hsio_pll, hw);
}
static int clk_hsio_pll_prepare(struct clk_hw *hw)
{
struct clk_hsio_pll *clk = to_clk_hsio_pll(hw);
u32 val;
/* set the PLL configuration */
regmap_update_bits(clk->regmap, GPR_REG2,
P_PLL_MASK | M_PLL_MASK | S_PLL_MASK,
FIELD_PREP(P_PLL_MASK, 12) |
FIELD_PREP(M_PLL_MASK, 800) |
FIELD_PREP(S_PLL_MASK, 4));
/* de-assert PLL reset */
regmap_update_bits(clk->regmap, GPR_REG3, PLL_RST, PLL_RST);
/* enable PLL */
regmap_update_bits(clk->regmap, GPR_REG3, PLL_CKE, PLL_CKE);
return regmap_read_poll_timeout(clk->regmap, GPR_REG1, val,
val & PLL_LOCK, 10, 100);
}
static void clk_hsio_pll_unprepare(struct clk_hw *hw)
{
struct clk_hsio_pll *clk = to_clk_hsio_pll(hw);
regmap_update_bits(clk->regmap, GPR_REG3, PLL_RST | PLL_CKE, 0);
}
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/device.h`, `linux/interconnect.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct imx8mp_blk_ctrl_domain`, `struct imx8mp_blk_ctrl`, `struct imx8mp_blk_ctrl_domain_data`, `struct imx8mp_blk_ctrl_domain`, `struct imx8mp_blk_ctrl_data`, `struct clk_hsio_pll`, `function to_imx8mp_blk_ctrl_domain`, `function clk_hsio_pll_prepare`, `function clk_hsio_pll_unprepare`, `function clk_hsio_pll_is_prepared`.
- Atlas domain: Driver Families / drivers/pmdomain.
- 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.