Lines Matching refs:opregion
54 struct intel_pmic_opregion *opregion = region_context; in intel_pmic_power_handler() local
55 struct regmap *regmap = opregion->regmap; in intel_pmic_power_handler()
56 const struct intel_pmic_opregion_data *d = opregion->data; in intel_pmic_power_handler()
70 mutex_lock(&opregion->lock); in intel_pmic_power_handler()
76 mutex_unlock(&opregion->lock); in intel_pmic_power_handler()
81 static int pmic_read_temp(struct intel_pmic_opregion *opregion, in pmic_read_temp() argument
86 if (!opregion->data->get_raw_temp) in pmic_read_temp()
89 raw_temp = opregion->data->get_raw_temp(opregion->regmap, reg); in pmic_read_temp()
93 if (!opregion->lpat_table) { in pmic_read_temp()
98 temp = opregion->data->lpat_raw_to_temp(opregion->lpat_table, raw_temp); in pmic_read_temp()
106 static int pmic_thermal_temp(struct intel_pmic_opregion *opregion, int reg, in pmic_thermal_temp() argument
110 pmic_read_temp(opregion, reg, value) : -EINVAL; in pmic_thermal_temp()
113 static int pmic_thermal_aux(struct intel_pmic_opregion *opregion, int reg, in pmic_thermal_aux() argument
119 return pmic_read_temp(opregion, reg, value); in pmic_thermal_aux()
121 if (!opregion->data->update_aux) in pmic_thermal_aux()
124 if (opregion->lpat_table) { in pmic_thermal_aux()
125 raw_temp = acpi_lpat_temp_to_raw(opregion->lpat_table, *value); in pmic_thermal_aux()
132 return opregion->data->update_aux(opregion->regmap, reg, raw_temp); in pmic_thermal_aux()
135 static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg, in pmic_thermal_pen() argument
138 const struct intel_pmic_opregion_data *d = opregion->data; in pmic_thermal_pen()
139 struct regmap *regmap = opregion->regmap; in pmic_thermal_pen()
173 struct intel_pmic_opregion *opregion = region_context; in intel_pmic_thermal_handler() local
174 const struct intel_pmic_opregion_data *d = opregion->data; in intel_pmic_thermal_handler()
185 mutex_lock(&opregion->lock); in intel_pmic_thermal_handler()
188 result = pmic_thermal_temp(opregion, reg, function, value64); in intel_pmic_thermal_handler()
190 result = pmic_thermal_aux(opregion, reg, function, value64); in intel_pmic_thermal_handler()
192 result = pmic_thermal_pen(opregion, reg, bit, in intel_pmic_thermal_handler()
197 mutex_unlock(&opregion->lock); in intel_pmic_thermal_handler()
213 struct intel_pmic_opregion *opregion = region_context; in intel_pmic_regs_handler() local
221 opregion->ctx.addr |= (*value64 & 0xff) << 8; in intel_pmic_regs_handler()
224 opregion->ctx.addr |= *value64 & 0xff; in intel_pmic_regs_handler()
227 opregion->ctx.val = *value64 & 0xff; in intel_pmic_regs_handler()
231 result = regmap_write(opregion->regmap, opregion->ctx.addr, in intel_pmic_regs_handler()
232 opregion->ctx.val); in intel_pmic_regs_handler()
234 result = regmap_read(opregion->regmap, opregion->ctx.addr, in intel_pmic_regs_handler()
235 &opregion->ctx.val); in intel_pmic_regs_handler()
237 opregion->ctx.addr = 0; in intel_pmic_regs_handler()
242 *value64 = opregion->ctx.val; in intel_pmic_regs_handler()
261 struct intel_pmic_opregion *opregion; in intel_pmic_install_opregion_handler() local
270 opregion = devm_kzalloc(dev, sizeof(*opregion), GFP_KERNEL); in intel_pmic_install_opregion_handler()
271 if (!opregion) in intel_pmic_install_opregion_handler()
274 mutex_init(&opregion->lock); in intel_pmic_install_opregion_handler()
275 opregion->regmap = regmap; in intel_pmic_install_opregion_handler()
276 opregion->lpat_table = acpi_lpat_get_conversion_table(handle); in intel_pmic_install_opregion_handler()
282 NULL, opregion); in intel_pmic_install_opregion_handler()
292 NULL, opregion); in intel_pmic_install_opregion_handler()
300 opregion); in intel_pmic_install_opregion_handler()
306 opregion->data = d; in intel_pmic_install_opregion_handler()
307 intel_pmic_opregion = opregion; in intel_pmic_install_opregion_handler()
323 acpi_lpat_free_conversion_table(opregion->lpat_table); in intel_pmic_install_opregion_handler()