Commit c5200609 authored by Hans de Goede's avatar Hans de Goede Committed by Rafael J. Wysocki

ACPI: PMIC: allow drivers to provide a custom lpat_raw_to_temp() function

The LPAT tables used in the DSDT for some PMICs require special handling,
allow the PMIC OpRegion drivers to provide an alternative implementation
by adding a lpat_raw_to_temp function pointer to struct pmic_table;
and initialize this to the default acpi_lpat_raw_to_temp function
for all PMICs.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e172e650
...@@ -95,7 +95,7 @@ static int pmic_read_temp(struct intel_pmic_opregion *opregion, ...@@ -95,7 +95,7 @@ static int pmic_read_temp(struct intel_pmic_opregion *opregion,
return 0; return 0;
} }
temp = acpi_lpat_raw_to_temp(opregion->lpat_table, raw_temp); temp = opregion->data->lpat_raw_to_temp(opregion->lpat_table, raw_temp);
if (temp < 0) if (temp < 0)
return temp; return temp;
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#ifndef __INTEL_PMIC_H #ifndef __INTEL_PMIC_H
#define __INTEL_PMIC_H #define __INTEL_PMIC_H
#include <acpi/acpi_lpat.h>
struct pmic_table { struct pmic_table {
int address; /* operation region address */ int address; /* operation region address */
int reg; /* corresponding thermal register */ int reg; /* corresponding thermal register */
...@@ -17,6 +19,8 @@ struct intel_pmic_opregion_data { ...@@ -17,6 +19,8 @@ struct intel_pmic_opregion_data {
int (*update_policy)(struct regmap *r, int reg, int bit, int enable); int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
int (*exec_mipi_pmic_seq_element)(struct regmap *r, u16 i2c_address, int (*exec_mipi_pmic_seq_element)(struct regmap *r, u16 i2c_address,
u32 reg_address, u32 value, u32 mask); u32 reg_address, u32 value, u32 mask);
int (*lpat_raw_to_temp)(struct acpi_lpat_conversion_table *lpat_table,
int raw);
struct pmic_table *power_table; struct pmic_table *power_table;
int power_table_count; int power_table_count;
struct pmic_table *thermal_table; struct pmic_table *thermal_table;
......
...@@ -376,6 +376,7 @@ static const struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = { ...@@ -376,6 +376,7 @@ static const struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = {
.update_aux = intel_bxtwc_pmic_update_aux, .update_aux = intel_bxtwc_pmic_update_aux,
.get_policy = intel_bxtwc_pmic_get_policy, .get_policy = intel_bxtwc_pmic_get_policy,
.update_policy = intel_bxtwc_pmic_update_policy, .update_policy = intel_bxtwc_pmic_update_policy,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
...@@ -278,6 +278,7 @@ static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = { ...@@ -278,6 +278,7 @@ static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
.update_aux = intel_crc_pmic_update_aux, .update_aux = intel_crc_pmic_update_aux,
.get_policy = intel_crc_pmic_get_policy, .get_policy = intel_crc_pmic_get_policy,
.update_policy = intel_crc_pmic_update_policy, .update_policy = intel_crc_pmic_update_policy,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count= ARRAY_SIZE(power_table), .power_table_count= ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* CHT Crystal Cove PMIC. * CHT Crystal Cove PMIC.
*/ */
static const struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = { static const struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = {
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.pmic_i2c_address = 0x6e, .pmic_i2c_address = 0x6e,
}; };
......
...@@ -98,6 +98,7 @@ static const struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = { ...@@ -98,6 +98,7 @@ static const struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = {
.get_power = chtdc_ti_pmic_get_power, .get_power = chtdc_ti_pmic_get_power,
.update_power = chtdc_ti_pmic_update_power, .update_power = chtdc_ti_pmic_update_power,
.get_raw_temp = chtdc_ti_pmic_get_raw_temp, .get_raw_temp = chtdc_ti_pmic_get_raw_temp,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = chtdc_ti_power_table, .power_table = chtdc_ti_power_table,
.power_table_count = ARRAY_SIZE(chtdc_ti_power_table), .power_table_count = ARRAY_SIZE(chtdc_ti_power_table),
.thermal_table = chtdc_ti_thermal_table, .thermal_table = chtdc_ti_thermal_table,
......
...@@ -257,6 +257,7 @@ static const struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = { ...@@ -257,6 +257,7 @@ static const struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = {
.get_power = intel_cht_wc_pmic_get_power, .get_power = intel_cht_wc_pmic_get_power,
.update_power = intel_cht_wc_pmic_update_power, .update_power = intel_cht_wc_pmic_update_power,
.exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element, .exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
}; };
......
...@@ -298,6 +298,7 @@ static const struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = { ...@@ -298,6 +298,7 @@ static const struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
.update_power = intel_xpower_pmic_update_power, .update_power = intel_xpower_pmic_update_power,
.get_raw_temp = intel_xpower_pmic_get_raw_temp, .get_raw_temp = intel_xpower_pmic_get_raw_temp,
.exec_mipi_pmic_seq_element = intel_xpower_exec_mipi_pmic_seq_element, .exec_mipi_pmic_seq_element = intel_xpower_exec_mipi_pmic_seq_element,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment