drivers/platform/x86/intel/int1092/intel_sar.c
Source file repositories/reference/linux-study-clean/drivers/platform/x86/intel/int1092/intel_sar.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/platform/x86/intel/int1092/intel_sar.c- Extension
.c- Size
- 9155 bytes
- Lines
- 327
- Domain
- Driver Families
- Bucket
- drivers/platform
- 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/acpi.hlinux/kobject.hlinux/platform_device.hlinux/sysfs.hintel_sar.h
Detected Declarations
function Copyrightfunction update_sar_datafunction parse_packagefunction sar_get_device_modefunction intc_data_showfunction intc_reg_showfunction intc_reg_storefunction sar_notifyfunction sar_get_datafunction sar_probefunction sar_remove
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021, Intel Corporation.
*/
#include <linux/acpi.h>
#include <linux/kobject.h>
#include <linux/platform_device.h>
#include <linux/sysfs.h>
#include "intel_sar.h"
/**
* get_int_value: Retrieve integer values from ACPI Object
* @obj: acpi_object pointer which has the integer value
* @out: output pointer will get integer value
*
* Function is used to retrieve integer value from acpi object.
*
* Return:
* * 0 on success
* * -EIO if there is an issue in acpi_object passed.
*/
static int get_int_value(union acpi_object *obj, int *out)
{
if (!obj || obj->type != ACPI_TYPE_INTEGER)
return -EIO;
*out = (int)obj->integer.value;
return 0;
}
/**
* update_sar_data: sar data is updated based on regulatory mode
* @context: pointer to driver context structure
*
* sar_data is updated based on regulatory value
* context->reg_value will never exceed MAX_REGULATORY
*/
static void update_sar_data(struct wwan_sar_context *context)
{
struct wwan_device_mode_configuration *config =
&context->config_data[context->reg_value];
if (config->device_mode_info &&
context->sar_data.device_mode < config->total_dev_mode) {
int itr = 0;
for (itr = 0; itr < config->total_dev_mode; itr++) {
if (context->sar_data.device_mode ==
config->device_mode_info[itr].device_mode) {
struct wwan_device_mode_info *dev_mode =
&config->device_mode_info[itr];
context->sar_data.antennatable_index = dev_mode->antennatable_index;
context->sar_data.bandtable_index = dev_mode->bandtable_index;
context->sar_data.sartable_index = dev_mode->sartable_index;
break;
}
}
}
}
/**
* parse_package: parse acpi package for retrieving SAR information
* @context: pointer to driver context structure
* @item : acpi_object pointer
*
* Given acpi_object is iterated to retrieve information for each device mode.
* If a given package corresponding to a specific device mode is faulty, it is
* skipped and the specific entry in context structure will have the default value
* of zero. Decoding of subsequent device modes is realized by having "continue"
* statements in the for loop on encountering error in parsing given device mode.
*
* Return:
* AE_OK if success
* AE_ERROR on error
*/
static acpi_status parse_package(struct wwan_sar_context *context, union acpi_object *item)
{
struct wwan_device_mode_configuration *data;
int value, itr, reg;
union acpi_object *num;
num = &item->package.elements[0];
if (get_int_value(num, &value) || value < 0 || value >= MAX_REGULATORY)
return AE_ERROR;
reg = value;
data = &context->config_data[reg];
if (data->total_dev_mode > MAX_DEV_MODES || data->total_dev_mode == 0 ||
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/kobject.h`, `linux/platform_device.h`, `linux/sysfs.h`, `intel_sar.h`.
- Detected declarations: `function Copyright`, `function update_sar_data`, `function parse_package`, `function sar_get_device_mode`, `function intc_data_show`, `function intc_reg_show`, `function intc_reg_store`, `function sar_notify`, `function sar_get_data`, `function sar_probe`.
- Atlas domain: Driver Families / drivers/platform.
- 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.