#include <linux/clk.h>
#include <linux/cpufreq.h>
#include <linux/cpu_cooling.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
#include <linux/thermal.h>
#include <linux/nvmem-consumer.h>
#include <linux/pm_runtime.h>
#define REG_SET …
#define REG_CLR …
#define REG_TOG …
#define IMX6_MISC0 …
#define IMX6_MISC0_REFTOP_SELBIASOFF …
#define IMX6_MISC1 …
#define IMX6_MISC1_IRQ_TEMPHIGH …
#define IMX6_MISC1_IRQ_TEMPLOW …
#define IMX6_MISC1_IRQ_TEMPPANIC …
#define IMX6_TEMPSENSE0 …
#define IMX6_TEMPSENSE0_ALARM_VALUE_SHIFT …
#define IMX6_TEMPSENSE0_ALARM_VALUE_MASK …
#define IMX6_TEMPSENSE0_TEMP_CNT_SHIFT …
#define IMX6_TEMPSENSE0_TEMP_CNT_MASK …
#define IMX6_TEMPSENSE0_FINISHED …
#define IMX6_TEMPSENSE0_MEASURE_TEMP …
#define IMX6_TEMPSENSE0_POWER_DOWN …
#define IMX6_TEMPSENSE1 …
#define IMX6_TEMPSENSE1_MEASURE_FREQ …
#define IMX6_TEMPSENSE1_MEASURE_FREQ_SHIFT …
#define OCOTP_MEM0 …
#define OCOTP_ANA1 …
#define IMX6_TEMPSENSE2 …
#define IMX6_TEMPSENSE2_LOW_VALUE_SHIFT …
#define IMX6_TEMPSENSE2_LOW_VALUE_MASK …
#define IMX6_TEMPSENSE2_PANIC_VALUE_SHIFT …
#define IMX6_TEMPSENSE2_PANIC_VALUE_MASK …
#define IMX7_ANADIG_DIGPROG …
#define IMX7_TEMPSENSE0 …
#define IMX7_TEMPSENSE0_PANIC_ALARM_SHIFT …
#define IMX7_TEMPSENSE0_PANIC_ALARM_MASK …
#define IMX7_TEMPSENSE0_HIGH_ALARM_SHIFT …
#define IMX7_TEMPSENSE0_HIGH_ALARM_MASK …
#define IMX7_TEMPSENSE0_LOW_ALARM_SHIFT …
#define IMX7_TEMPSENSE0_LOW_ALARM_MASK …
#define IMX7_TEMPSENSE1 …
#define IMX7_TEMPSENSE1_MEASURE_FREQ_SHIFT …
#define IMX7_TEMPSENSE1_MEASURE_FREQ_MASK …
#define IMX7_TEMPSENSE1_FINISHED …
#define IMX7_TEMPSENSE1_MEASURE_TEMP …
#define IMX7_TEMPSENSE1_POWER_DOWN …
#define IMX7_TEMPSENSE1_TEMP_VALUE_SHIFT …
#define IMX7_TEMPSENSE1_TEMP_VALUE_MASK …
enum imx_thermal_trip { … };
#define IMX_POLLING_DELAY …
#define IMX_PASSIVE_DELAY …
#define TEMPMON_IMX6Q …
#define TEMPMON_IMX6SX …
#define TEMPMON_IMX7D …
struct thermal_soc_data { … };
static struct thermal_trip trips[] = …;
static struct thermal_soc_data thermal_imx6q_data = …;
static struct thermal_soc_data thermal_imx6sx_data = …;
static struct thermal_soc_data thermal_imx7d_data = …;
struct imx_thermal_data { … };
static void imx_set_panic_temp(struct imx_thermal_data *data,
int panic_temp)
{ … }
static void imx_set_alarm_temp(struct imx_thermal_data *data,
int alarm_temp)
{ … }
static int imx_get_temp(struct thermal_zone_device *tz, int *temp)
{ … }
static int imx_change_mode(struct thermal_zone_device *tz,
enum thermal_device_mode mode)
{ … }
static int imx_set_trip_temp(struct thermal_zone_device *tz,
const struct thermal_trip *trip, int temp)
{ … }
static int imx_bind(struct thermal_zone_device *tz,
struct thermal_cooling_device *cdev)
{ … }
static int imx_unbind(struct thermal_zone_device *tz,
struct thermal_cooling_device *cdev)
{ … }
static struct thermal_zone_device_ops imx_tz_ops = …;
static int imx_init_calib(struct platform_device *pdev, u32 ocotp_ana1)
{ … }
static void imx_init_temp_grade(struct platform_device *pdev, u32 ocotp_mem0)
{ … }
static int imx_init_from_tempmon_data(struct platform_device *pdev)
{ … }
static int imx_init_from_nvmem_cells(struct platform_device *pdev)
{ … }
static irqreturn_t imx_thermal_alarm_irq(int irq, void *dev)
{ … }
static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev)
{ … }
static const struct of_device_id of_imx_thermal_match[] = …;
MODULE_DEVICE_TABLE(of, of_imx_thermal_match);
#ifdef CONFIG_CPU_FREQ
static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
{ … }
static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
{ … }
#else
static inline int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data)
{
return 0;
}
static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data)
{
}
#endif
static int imx_thermal_probe(struct platform_device *pdev)
{ … }
static void imx_thermal_remove(struct platform_device *pdev)
{ … }
static int __maybe_unused imx_thermal_suspend(struct device *dev)
{ … }
static int __maybe_unused imx_thermal_resume(struct device *dev)
{ … }
static int __maybe_unused imx_thermal_runtime_suspend(struct device *dev)
{ … }
static int __maybe_unused imx_thermal_runtime_resume(struct device *dev)
{ … }
static const struct dev_pm_ops imx_thermal_pm_ops = …;
static struct platform_driver imx_thermal = …;
module_platform_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS(…) …;