drivers/soc/qcom/qcom_pd_mapper.c
Source file repositories/reference/linux-study-clean/drivers/soc/qcom/qcom_pd_mapper.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/qcom/qcom_pd_mapper.c- Extension
.c- Size
- 17540 bytes
- Lines
- 757
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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/auxiliary_bus.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/of.hlinux/refcount.hlinux/slab.hlinux/soc/qcom/qmi.hpdr_internal.h
Detected Declarations
struct qcom_pdm_domain_datastruct qcom_pdm_domainstruct qcom_pdm_servicestruct qcom_pdm_datafunction list_for_each_entryfunction qcom_pdm_add_service_domainfunction list_for_each_entryfunction qcom_pdm_add_domainfunction qcom_pdm_free_domainsfunction list_for_each_entry_safefunction qcom_pdm_get_domain_listfunction list_for_each_entryfunction qcom_pdm_pfrfunction qcom_pdm_stopfunction qcom_pdm_probefunction qcom_pdm_remove
Annotated Snippet
struct qcom_pdm_domain_data {
const char *domain;
u32 instance_id;
/* NULL-terminated array */
const char * services[];
};
struct qcom_pdm_domain {
struct list_head list;
const char *name;
u32 instance_id;
};
struct qcom_pdm_service {
struct list_head list;
struct list_head domains;
const char *name;
};
struct qcom_pdm_data {
refcount_t refcnt;
struct qmi_handle handle;
struct list_head services;
};
static DEFINE_MUTEX(qcom_pdm_mutex); /* protects __qcom_pdm_data */
static struct qcom_pdm_data *__qcom_pdm_data;
static struct qcom_pdm_service *qcom_pdm_find(struct qcom_pdm_data *data,
const char *name)
{
struct qcom_pdm_service *service;
list_for_each_entry(service, &data->services, list) {
if (!strcmp(service->name, name))
return service;
}
return NULL;
}
static int qcom_pdm_add_service_domain(struct qcom_pdm_data *data,
const char *service_name,
const char *domain_name,
u32 instance_id)
{
struct qcom_pdm_service *service;
struct qcom_pdm_domain *domain;
service = qcom_pdm_find(data, service_name);
if (service) {
list_for_each_entry(domain, &service->domains, list) {
if (!strcmp(domain->name, domain_name))
return -EBUSY;
}
} else {
service = kzalloc_obj(*service);
if (!service)
return -ENOMEM;
INIT_LIST_HEAD(&service->domains);
service->name = service_name;
list_add_tail(&service->list, &data->services);
}
domain = kzalloc_obj(*domain);
if (!domain) {
if (list_empty(&service->domains)) {
list_del(&service->list);
kfree(service);
}
return -ENOMEM;
}
domain->name = domain_name;
domain->instance_id = instance_id;
list_add_tail(&domain->list, &service->domains);
return 0;
}
static int qcom_pdm_add_domain(struct qcom_pdm_data *data,
const struct qcom_pdm_domain_data *domain)
{
int ret;
int i;
ret = qcom_pdm_add_service_domain(data,
Annotation
- Immediate include surface: `linux/auxiliary_bus.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/of.h`, `linux/refcount.h`, `linux/slab.h`, `linux/soc/qcom/qmi.h`.
- Detected declarations: `struct qcom_pdm_domain_data`, `struct qcom_pdm_domain`, `struct qcom_pdm_service`, `struct qcom_pdm_data`, `function list_for_each_entry`, `function qcom_pdm_add_service_domain`, `function list_for_each_entry`, `function qcom_pdm_add_domain`, `function qcom_pdm_free_domains`, `function list_for_each_entry_safe`.
- Atlas domain: Driver Families / drivers/soc.
- 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.