* [PATCH 2/4] ACPI / PMIC: Use common LPAT table handling functions
2015-01-28 19:56 [PATCH 1/4] ACPI / LPAT: Common table processing functions Srinivas Pandruvada
@ 2015-01-28 19:56 ` Srinivas Pandruvada
2015-01-28 19:56 ` [PATCH 3/4] Thermal/int340x: LPAT conversion for temperature Srinivas Pandruvada
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2015-01-28 19:56 UTC (permalink / raw)
To: rui.zhang, edubezval, rafael.j.wysocki
Cc: linux-pm, linux-acpi, Srinivas Pandruvada
The LPAT table processing functions from this modules are moved to a
standalone module with exported interface functions.
Using new interface functions in this module.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/acpi/pmic/intel_pmic.c | 133 ++++++-----------------------------------
1 file changed, 18 insertions(+), 115 deletions(-)
diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
index a732e5d..bd772cd 100644
--- a/drivers/acpi/pmic/intel_pmic.c
+++ b/drivers/acpi/pmic/intel_pmic.c
@@ -16,20 +16,15 @@
#include <linux/module.h>
#include <linux/acpi.h>
#include <linux/regmap.h>
+#include <acpi/acpi_lpat.h>
#include "intel_pmic.h"
#define PMIC_POWER_OPREGION_ID 0x8d
#define PMIC_THERMAL_OPREGION_ID 0x8c
-struct acpi_lpat {
- int temp;
- int raw;
-};
-
struct intel_pmic_opregion {
struct mutex lock;
- struct acpi_lpat *lpat;
- int lpat_count;
+ struct acpi_lpat_conversion_table *lpat_table;
struct regmap *regmap;
struct intel_pmic_opregion_data *data;
};
@@ -50,105 +45,6 @@ static int pmic_get_reg_bit(int address, struct pmic_table *table,
return -ENOENT;
}
-/**
- * raw_to_temp(): Return temperature from raw value through LPAT table
- *
- * @lpat: the temperature_raw mapping table
- * @count: the count of the above mapping table
- * @raw: the raw value, used as a key to get the temerature from the
- * above mapping table
- *
- * A positive value will be returned on success, a negative errno will
- * be returned in error cases.
- */
-static int raw_to_temp(struct acpi_lpat *lpat, int count, int raw)
-{
- int i, delta_temp, delta_raw, temp;
-
- for (i = 0; i < count - 1; i++) {
- if ((raw >= lpat[i].raw && raw <= lpat[i+1].raw) ||
- (raw <= lpat[i].raw && raw >= lpat[i+1].raw))
- break;
- }
-
- if (i == count - 1)
- return -ENOENT;
-
- delta_temp = lpat[i+1].temp - lpat[i].temp;
- delta_raw = lpat[i+1].raw - lpat[i].raw;
- temp = lpat[i].temp + (raw - lpat[i].raw) * delta_temp / delta_raw;
-
- return temp;
-}
-
-/**
- * temp_to_raw(): Return raw value from temperature through LPAT table
- *
- * @lpat: the temperature_raw mapping table
- * @count: the count of the above mapping table
- * @temp: the temperature, used as a key to get the raw value from the
- * above mapping table
- *
- * A positive value will be returned on success, a negative errno will
- * be returned in error cases.
- */
-static int temp_to_raw(struct acpi_lpat *lpat, int count, int temp)
-{
- int i, delta_temp, delta_raw, raw;
-
- for (i = 0; i < count - 1; i++) {
- if (temp >= lpat[i].temp && temp <= lpat[i+1].temp)
- break;
- }
-
- if (i == count - 1)
- return -ENOENT;
-
- delta_temp = lpat[i+1].temp - lpat[i].temp;
- delta_raw = lpat[i+1].raw - lpat[i].raw;
- raw = lpat[i].raw + (temp - lpat[i].temp) * delta_raw / delta_temp;
-
- return raw;
-}
-
-static void pmic_thermal_lpat(struct intel_pmic_opregion *opregion,
- acpi_handle handle, struct device *dev)
-{
- struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
- union acpi_object *obj_p, *obj_e;
- int *lpat, i;
- acpi_status status;
-
- status = acpi_evaluate_object(handle, "LPAT", NULL, &buffer);
- if (ACPI_FAILURE(status))
- return;
-
- obj_p = (union acpi_object *)buffer.pointer;
- if (!obj_p || (obj_p->type != ACPI_TYPE_PACKAGE) ||
- (obj_p->package.count % 2) || (obj_p->package.count < 4))
- goto out;
-
- lpat = devm_kmalloc(dev, sizeof(int) * obj_p->package.count,
- GFP_KERNEL);
- if (!lpat)
- goto out;
-
- for (i = 0; i < obj_p->package.count; i++) {
- obj_e = &obj_p->package.elements[i];
- if (obj_e->type != ACPI_TYPE_INTEGER) {
- devm_kfree(dev, lpat);
- goto out;
- }
- lpat[i] = (s64)obj_e->integer.value;
- }
-
- opregion->lpat = (struct acpi_lpat *)lpat;
- opregion->lpat_count = obj_p->package.count / 2;
-
-out:
- kfree(buffer.pointer);
-}
-
static acpi_status intel_pmic_power_handler(u32 function,
acpi_physical_address address, u32 bits, u64 *value64,
void *handler_context, void *region_context)
@@ -192,12 +88,12 @@ static int pmic_read_temp(struct intel_pmic_opregion *opregion,
if (raw_temp < 0)
return raw_temp;
- if (!opregion->lpat) {
+ if (!opregion->lpat_table) {
*value = raw_temp;
return 0;
}
- temp = raw_to_temp(opregion->lpat, opregion->lpat_count, raw_temp);
+ temp = acpi_lpat_raw_to_temp(opregion->lpat_table, raw_temp);
if (temp < 0)
return temp;
@@ -223,9 +119,8 @@ static int pmic_thermal_aux(struct intel_pmic_opregion *opregion, int reg,
if (!opregion->data->update_aux)
return -ENXIO;
- if (opregion->lpat) {
- raw_temp = temp_to_raw(opregion->lpat, opregion->lpat_count,
- *value);
+ if (opregion->lpat_table) {
+ raw_temp = acpi_lpat_temp_to_raw(opregion->lpat_table, *value);
if (raw_temp < 0)
return raw_temp;
} else {
@@ -314,6 +209,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
{
acpi_status status;
struct intel_pmic_opregion *opregion;
+ int ret;
if (!dev || !regmap || !d)
return -EINVAL;
@@ -327,14 +223,16 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
mutex_init(&opregion->lock);
opregion->regmap = regmap;
- pmic_thermal_lpat(opregion, handle, dev);
+ opregion->lpat_table = acpi_lpat_get_conversion_table(handle);
status = acpi_install_address_space_handler(handle,
PMIC_POWER_OPREGION_ID,
intel_pmic_power_handler,
NULL, opregion);
- if (ACPI_FAILURE(status))
- return -ENODEV;
+ if (ACPI_FAILURE(status)) {
+ ret = -ENODEV;
+ goto out_error;
+ }
status = acpi_install_address_space_handler(handle,
PMIC_THERMAL_OPREGION_ID,
@@ -343,11 +241,16 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
if (ACPI_FAILURE(status)) {
acpi_remove_address_space_handler(handle, PMIC_POWER_OPREGION_ID,
intel_pmic_power_handler);
- return -ENODEV;
+ ret = -ENODEV;
+ goto out_error;
}
opregion->data = d;
return 0;
+
+out_error:
+ acpi_lpat_free_conversion_table(opregion->lpat_table);
+ return ret;
}
EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler);
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] Thermal/int340x: LPAT conversion for temperature
2015-01-28 19:56 [PATCH 1/4] ACPI / LPAT: Common table processing functions Srinivas Pandruvada
2015-01-28 19:56 ` [PATCH 2/4] ACPI / PMIC: Use common LPAT table handling functions Srinivas Pandruvada
@ 2015-01-28 19:56 ` Srinivas Pandruvada
2015-01-28 19:56 ` [PATCH 4/4] Thermal/int340x/int3403: Support for thermistor and IR sensor Srinivas Pandruvada
2015-01-29 17:38 ` [PATCH 1/4] ACPI / LPAT: Common table processing functions Rafael J. Wysocki
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2015-01-28 19:56 UTC (permalink / raw)
To: rui.zhang, edubezval, rafael.j.wysocki
Cc: linux-pm, linux-acpi, Srinivas Pandruvada
When LPAT table is present, we need to convert raw temperature to
real temp using LPAT.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
.../thermal/int340x_thermal/int340x_thermal_zone.c | 20 +++++++++++++++++---
.../thermal/int340x_thermal/int340x_thermal_zone.h | 3 +++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
index 162e545..f88b088 100644
--- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.c
@@ -33,8 +33,17 @@ static int int340x_thermal_get_zone_temp(struct thermal_zone_device *zone,
if (ACPI_FAILURE(status))
return -EIO;
- /* _TMP returns the temperature in tenths of degrees Kelvin */
- *temp = DECI_KELVIN_TO_MILLICELSIUS(tmp);
+ if (d->lpat_table) {
+ int conv_temp;
+
+ conv_temp = acpi_lpat_raw_to_temp(d->lpat_table, (int)tmp);
+ if (conv_temp < 0)
+ return conv_temp;
+
+ *temp = (unsigned long)conv_temp * 10;
+ } else
+ /* _TMP returns the temperature in tenths of degrees Kelvin */
+ *temp = DECI_KELVIN_TO_MILLICELSIUS(tmp);
return 0;
}
@@ -227,6 +236,8 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
int34x_thermal_zone->act_trips[i].id = trip_cnt++;
int34x_thermal_zone->act_trips[i].valid = true;
}
+ int34x_thermal_zone->lpat_table = acpi_lpat_get_conversion_table(
+ adev->handle);
int34x_thermal_zone->zone = thermal_zone_device_register(
acpi_device_bid(adev),
@@ -237,11 +248,13 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
0, 0);
if (IS_ERR(int34x_thermal_zone->zone)) {
ret = PTR_ERR(int34x_thermal_zone->zone);
- goto free_mem;
+ goto free_lpat;
}
return int34x_thermal_zone;
+free_lpat:
+ acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
free_mem:
kfree(int34x_thermal_zone);
return ERR_PTR(ret);
@@ -252,6 +265,7 @@ void int340x_thermal_zone_remove(struct int34x_thermal_zone
*int34x_thermal_zone)
{
thermal_zone_device_unregister(int34x_thermal_zone->zone);
+ acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
kfree(int34x_thermal_zone);
}
EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove);
diff --git a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
index 11f2f52..9f38ab7 100644
--- a/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
+++ b/drivers/thermal/int340x_thermal/int340x_thermal_zone.h
@@ -16,6 +16,8 @@
#ifndef __INT340X_THERMAL_ZONE_H__
#define __INT340X_THERMAL_ZONE_H__
+#include <acpi/acpi_lpat.h>
+
#define INT340X_THERMAL_MAX_ACT_TRIP_COUNT 10
struct active_trip {
@@ -38,6 +40,7 @@ struct int34x_thermal_zone {
struct thermal_zone_device *zone;
struct thermal_zone_device_ops *override_ops;
void *priv_data;
+ struct acpi_lpat_conversion_table *lpat_table;
};
struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *,
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] Thermal/int340x/int3403: Support for thermistor and IR sensor
2015-01-28 19:56 [PATCH 1/4] ACPI / LPAT: Common table processing functions Srinivas Pandruvada
2015-01-28 19:56 ` [PATCH 2/4] ACPI / PMIC: Use common LPAT table handling functions Srinivas Pandruvada
2015-01-28 19:56 ` [PATCH 3/4] Thermal/int340x: LPAT conversion for temperature Srinivas Pandruvada
@ 2015-01-28 19:56 ` Srinivas Pandruvada
2015-01-29 17:38 ` [PATCH 1/4] ACPI / LPAT: Common table processing functions Rafael J. Wysocki
3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Pandruvada @ 2015-01-28 19:56 UTC (permalink / raw)
To: rui.zhang, edubezval, rafael.j.wysocki
Cc: linux-pm, linux-acpi, Srinivas Pandruvada
Added two more sensor types: Thermistor and IR sensor. Each of these
sensors have unique ptyp value.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/thermal/int340x_thermal/int3403_thermal.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/thermal/int340x_thermal/int3403_thermal.c b/drivers/thermal/int340x_thermal/int3403_thermal.c
index 50a7a08..2b5b140 100644
--- a/drivers/thermal/int340x_thermal/int3403_thermal.c
+++ b/drivers/thermal/int340x_thermal/int3403_thermal.c
@@ -24,6 +24,9 @@
#define INT3403_TYPE_SENSOR 0x03
#define INT3403_TYPE_CHARGER 0x0B
#define INT3403_TYPE_BATTERY 0x0C
+#define INT3403_TYPE_SENSOR_THERMISTOR 0x12
+#define INT3403_TYPE_SENSOR_IR 0x13
+
#define INT3403_PERF_CHANGED_EVENT 0x80
#define INT3403_THERMAL_EVENT 0x90
@@ -238,6 +241,8 @@ static int int3403_add(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
switch (priv->type) {
case INT3403_TYPE_SENSOR:
+ case INT3403_TYPE_SENSOR_THERMISTOR:
+ case INT3403_TYPE_SENSOR_IR:
result = int3403_sensor_add(priv);
break;
case INT3403_TYPE_CHARGER:
@@ -262,6 +267,8 @@ static int int3403_remove(struct platform_device *pdev)
switch (priv->type) {
case INT3403_TYPE_SENSOR:
+ case INT3403_TYPE_SENSOR_THERMISTOR:
+ case INT3403_TYPE_SENSOR_IR:
int3403_sensor_remove(priv);
break;
case INT3403_TYPE_CHARGER:
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/4] ACPI / LPAT: Common table processing functions
2015-01-28 19:56 [PATCH 1/4] ACPI / LPAT: Common table processing functions Srinivas Pandruvada
` (2 preceding siblings ...)
2015-01-28 19:56 ` [PATCH 4/4] Thermal/int340x/int3403: Support for thermistor and IR sensor Srinivas Pandruvada
@ 2015-01-29 17:38 ` Rafael J. Wysocki
3 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2015-01-29 17:38 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: rui.zhang, edubezval, rafael.j.wysocki, linux-pm, linux-acpi
On Wednesday, January 28, 2015 11:56:46 AM Srinivas Pandruvada wrote:
> Since LPAT table processing is also required for other thermal drivers,
> moved LPAT table related functions from intel PMIC driver (intel_pmic.c)
> to a stand alonge module with exported interfaces.
> In this way there will be no code duplication.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/acpi/Makefile | 1 +
> drivers/acpi/acpi_lpat.c | 161 +++++++++++++++++++++++++++++++++++++++++++++++
> include/acpi/acpi_lpat.h | 65 +++++++++++++++++++
> 3 files changed, 227 insertions(+)
> create mode 100644 drivers/acpi/acpi_lpat.c
> create mode 100644 include/acpi/acpi_lpat.h
>
> diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
> index f74317c..d22253d 100644
> --- a/drivers/acpi/Makefile
> +++ b/drivers/acpi/Makefile
> @@ -55,6 +55,7 @@ acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
> ifdef CONFIG_ACPI_VIDEO
> acpi-y += video_detect.o
> endif
> +acpi-y += acpi_lpat.o
>
> # These are (potentially) separate modules
>
> diff --git a/drivers/acpi/acpi_lpat.c b/drivers/acpi/acpi_lpat.c
> new file mode 100644
> index 0000000..feb61c1
> --- /dev/null
> +++ b/drivers/acpi/acpi_lpat.c
> @@ -0,0 +1,161 @@
> +/*
> + * acpi_lpat.c - LPAT table processing functions
> + *
> + * Copyright (C) 2015 Intel Corporation. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/acpi.h>
> +#include <acpi/acpi_lpat.h>
> +
> +/**
> + * acpi_lpat_raw_to_temp(): Return temperature from raw value through
> + * LPAT conversion table
> + *
> + * @lpat_table: the temperature_raw mapping table structure
> + * @raw: the raw value, used as a key to get the temerature from the
> + * above mapping table
> + *
> + * A positive converted temperarure value will be returned on success,
> + * a negative errno will be returned in error cases.
> + */
> +int acpi_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
> + int raw)
> +{
> + int i, delta_temp, delta_raw, temp;
> + struct acpi_lpat *lpat = lpat_table->lpat;
> +
> + for (i = 0; i < lpat_table->lpat_count - 1; i++) {
> + if ((raw >= lpat[i].raw && raw <= lpat[i+1].raw) ||
> + (raw <= lpat[i].raw && raw >= lpat[i+1].raw))
> + break;
> + }
> +
> + if (i == lpat_table->lpat_count - 1)
> + return -ENOENT;
> +
> + delta_temp = lpat[i+1].temp - lpat[i].temp;
> + delta_raw = lpat[i+1].raw - lpat[i].raw;
> + temp = lpat[i].temp + (raw - lpat[i].raw) * delta_temp / delta_raw;
> +
> + return temp;
> +}
> +EXPORT_SYMBOL_GPL(acpi_lpat_raw_to_temp);
> +
> +/**
> + * acpi_lpat_temp_to_raw(): Return raw value from temperature through
> + * LPAT conversion table
> + *
> + * @lpat: the temperature_raw mapping table
> + * @temp: the temperature, used as a key to get the raw value from the
> + * above mapping table
> + *
> + * A positive converted temperature value will be returned on success,
> + * a negative errno will be returned in error cases.
> + */
> +int acpi_lpat_temp_to_raw(struct acpi_lpat_conversion_table *lpat_table,
> + int temp)
> +{
> + int i, delta_temp, delta_raw, raw;
> + struct acpi_lpat *lpat = lpat_table->lpat;
> +
> + for (i = 0; i < lpat_table->lpat_count - 1; i++) {
> + if (temp >= lpat[i].temp && temp <= lpat[i+1].temp)
> + break;
> + }
> +
> + if (i == lpat_table->lpat_count - 1)
> + return -ENOENT;
> +
> + delta_temp = lpat[i+1].temp - lpat[i].temp;
> + delta_raw = lpat[i+1].raw - lpat[i].raw;
> + raw = lpat[i].raw + (temp - lpat[i].temp) * delta_raw / delta_temp;
> +
> + return raw;
> +}
> +EXPORT_SYMBOL_GPL(acpi_lpat_temp_to_raw);
> +
> +/**
> + * acpi_lpat_get_conversion_table(): Parse ACPI LPAT table if present.
> + *
> + * @handle: Handle to acpi device
> + *
> + * Parse LPAT table to a struct of type acpi_lpat_table. On success
> + * it returns a pointer to newly allocated table. This table must
> + * be freed by the caller when finished processing, using a call to
> + * acpi_lpat_free_conversion_table.
> + */
> +struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(acpi_handle
> + handle)
> +{
> + struct acpi_lpat_conversion_table *lpat_table = NULL;
> + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
> + union acpi_object *obj_p, *obj_e;
> + int *lpat, i;
> + acpi_status status;
> +
> + status = acpi_evaluate_object(handle, "LPAT", NULL, &buffer);
> + if (ACPI_FAILURE(status))
> + return NULL;
> +
> + obj_p = (union acpi_object *)buffer.pointer;
> + if (!obj_p || (obj_p->type != ACPI_TYPE_PACKAGE) ||
> + (obj_p->package.count % 2) || (obj_p->package.count < 4))
> + goto out;
> +
> + lpat = kcalloc(obj_p->package.count, sizeof(int), GFP_KERNEL);
> + if (!lpat)
> + goto out;
> +
> + for (i = 0; i < obj_p->package.count; i++) {
> + obj_e = &obj_p->package.elements[i];
> + if (obj_e->type != ACPI_TYPE_INTEGER) {
> + kfree(lpat);
> + goto out;
> + }
> + lpat[i] = (s64)obj_e->integer.value;
> + }
> +
> + lpat_table = kzalloc(sizeof(*lpat_table), GFP_KERNEL);
> + if (!lpat_table) {
> + kfree(lpat);
> + goto out;
> + }
> +
> + lpat_table->lpat = (struct acpi_lpat *)lpat;
> + lpat_table->lpat_count = obj_p->package.count / 2;
> +
> +out:
> + kfree(buffer.pointer);
> + return lpat_table;
> +}
> +EXPORT_SYMBOL_GPL(acpi_lpat_get_conversion_table);
> +
> +/**
> + * acpi_lpat_free_conversion_table(): Free LPAT table.
> + *
> + * @lpat_table: the temperature_raw mapping table structure
> + *
> + * Frees the LPAT table previously allocated by a call to
> + * acpi_lpat_get_conversion_table.
> + */
> +void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
> + *lpat_table)
> +{
> + if (lpat_table) {
> + kfree(lpat_table->lpat);
> + kfree(lpat_table);
> + }
> +}
> +EXPORT_SYMBOL_GPL(acpi_lpat_free_conversion_table);
> +
> +MODULE_LICENSE("GPL");
> diff --git a/include/acpi/acpi_lpat.h b/include/acpi/acpi_lpat.h
> new file mode 100644
> index 0000000..da37e12
> --- /dev/null
> +++ b/include/acpi/acpi_lpat.h
> @@ -0,0 +1,65 @@
> +/*
> + * acpi_lpat.h - LPAT table processing functions
> + *
> + * Copyright (C) 2015 Intel Corporation. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License version
> + * 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + */
> +
> +#ifndef ACPI_LPAT_H
> +#define ACPI_LPAT_H
> +
> +struct acpi_lpat {
> + int temp;
> + int raw;
> +};
> +
> +struct acpi_lpat_conversion_table {
> + struct acpi_lpat *lpat;
> + int lpat_count;
> +};
> +
> +#ifdef CONFIG_ACPI
> +
> +int acpi_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
> + int raw);
> +int acpi_lpat_temp_to_raw(struct acpi_lpat_conversion_table *lpat_table,
> + int temp);
> +struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(acpi_handle
> + handle);
> +void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
> + *lpat_table);
> +
> +#else
> +static int acpi_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
> + int raw)
> +{
> + return 0;
> +}
> +
> +static int acpi_lpat_temp_to_raw(struct acpi_lpat_conversion_table *lpat_table,
> + int temp)
> +{
> + return 0;
> +}
> +
> +static struct acpi_lpat_conversion_table *acpi_lpat_get_conversion_table(
> + acpi_handle handle)
> +{
> + return NULL;
> +}
> +
> +static void acpi_lpat_free_conversion_table(struct acpi_lpat_conversion_table
> + *lpat_table)
> +{
> +}
> +
> +#endif
> +#endif
>
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 5+ messages in thread