// 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) { … } /** * 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) { … } /** * 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) { … } /** * sar_get_device_mode: Extraction of information from BIOS via DSM calls * @device: ACPI device for which to retrieve the data * * Retrieve the current device mode information from the BIOS. * * Return: * AE_OK on success * AE_ERROR on error */ static acpi_status sar_get_device_mode(struct platform_device *device) { … } static const struct acpi_device_id sar_device_ids[] = …; MODULE_DEVICE_TABLE(acpi, sar_device_ids); static ssize_t intc_data_show(struct device *dev, struct device_attribute *attr, char *buf) { … } static DEVICE_ATTR_RO(intc_data); static ssize_t intc_reg_show(struct device *dev, struct device_attribute *attr, char *buf) { … } static ssize_t intc_reg_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { … } static DEVICE_ATTR_RW(intc_reg); static struct attribute *intcsar_attrs[] = …; static struct attribute_group intcsar_group = …; static void sar_notify(acpi_handle handle, u32 event, void *data) { … } static void sar_get_data(int reg, struct wwan_sar_context *context) { … } static int sar_probe(struct platform_device *device) { … } static void sar_remove(struct platform_device *device) { … } static struct platform_driver sar_driver = …; module_platform_driver(…) …; MODULE_LICENSE(…) …; MODULE_DESCRIPTION(…) …; MODULE_AUTHOR(…) …;