linux/drivers/thermal/sprd_thermal.c

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2020 Spreadtrum Communications Inc.

#include <linux/clk.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/thermal.h>

#define SPRD_THM_CTL
#define SPRD_THM_INT_EN
#define SPRD_THM_INT_STS
#define SPRD_THM_INT_RAW_STS
#define SPRD_THM_DET_PERIOD
#define SPRD_THM_INT_CLR
#define SPRD_THM_INT_CLR_ST
#define SPRD_THM_MON_PERIOD
#define SPRD_THM_MON_CTL
#define SPRD_THM_INTERNAL_STS1
#define SPRD_THM_RAW_READ_MSK

#define SPRD_THM_OFFSET(id)
#define SPRD_THM_TEMP(id)
#define SPRD_THM_THRES(id)

#define SPRD_THM_SEN(id)
#define SPRD_THM_SEN_OVERHEAT_EN(id)
#define SPRD_THM_SEN_OVERHEAT_ALARM_EN(id)

/* bits definitions for register THM_CTL */
#define SPRD_THM_SET_RDY_ST
#define SPRD_THM_SET_RDY
#define SPRD_THM_MON_EN
#define SPRD_THM_EN

/* bits definitions for register THM_INT_CTL */
#define SPRD_THM_BIT_INT_EN
#define SPRD_THM_OVERHEAT_EN
#define SPRD_THM_OTP_TRIP_SHIFT

/* bits definitions for register SPRD_THM_INTERNAL_STS1 */
#define SPRD_THM_TEMPER_RDY

#define SPRD_THM_DET_PERIOD_DATA
#define SPRD_THM_DET_PERIOD_MASK
#define SPRD_THM_MON_MODE
#define SPRD_THM_MON_MODE_MASK
#define SPRD_THM_MON_PERIOD_DATA
#define SPRD_THM_MON_PERIOD_MASK
#define SPRD_THM_THRES_MASK
#define SPRD_THM_INT_CLR_MASK

/* thermal sensor calibration parameters */
#define SPRD_THM_TEMP_LOW
#define SPRD_THM_TEMP_HIGH
#define SPRD_THM_OTP_TEMP
#define SPRD_THM_HOT_TEMP
#define SPRD_THM_RAW_DATA_LOW
#define SPRD_THM_RAW_DATA_HIGH
#define SPRD_THM_SEN_NUM
#define SPRD_THM_DT_OFFSET
#define SPRD_THM_RATION_OFFSET
#define SPRD_THM_RATION_SIGN

#define SPRD_THM_RDYST_POLLING_TIME
#define SPRD_THM_RDYST_TIMEOUT
#define SPRD_THM_TEMP_READY_POLL_TIME
#define SPRD_THM_TEMP_READY_TIMEOUT
#define SPRD_THM_MAX_SENSOR

struct sprd_thermal_sensor {};

struct sprd_thermal_data {};

/*
 * The conversion between ADC and temperature is based on linear relationship,
 * and use idea_k to specify the slope and ideal_b to specify the offset.
 *
 * Since different Spreadtrum SoCs have different ideal_k and ideal_b,
 * we should save ideal_k and ideal_b in the device data structure.
 */
struct sprd_thm_variant_data {};

static const struct sprd_thm_variant_data ums512_data =;

static inline void sprd_thm_update_bits(void __iomem *reg, u32 mask, u32 val)
{}

static int sprd_thm_cal_read(struct device_node *np, const char *cell_id,
			     u32 *val)
{}

static int sprd_thm_sensor_calibration(struct device_node *np,
				       struct sprd_thermal_data *thm,
				       struct sprd_thermal_sensor *sen)
{}

static int sprd_thm_rawdata_to_temp(struct sprd_thermal_sensor *sen,
				    u32 rawdata)
{}

static int sprd_thm_temp_to_rawdata(int temp, struct sprd_thermal_sensor *sen)
{}

static int sprd_thm_read_temp(struct thermal_zone_device *tz, int *temp)
{}

static const struct thermal_zone_device_ops sprd_thm_ops =;

static int sprd_thm_poll_ready_status(struct sprd_thermal_data *thm)
{}

static int sprd_thm_wait_temp_ready(struct sprd_thermal_data *thm)
{}

static int sprd_thm_set_ready(struct sprd_thermal_data *thm)
{}

static void sprd_thm_sensor_init(struct sprd_thermal_data *thm,
				 struct sprd_thermal_sensor *sen)
{}

static void sprd_thm_para_config(struct sprd_thermal_data *thm)
{}

static void sprd_thm_toggle_sensor(struct sprd_thermal_sensor *sen, bool on)
{}

static int sprd_thm_probe(struct platform_device *pdev)
{}

#ifdef CONFIG_PM_SLEEP
static void sprd_thm_hw_suspend(struct sprd_thermal_data *thm)
{}

static int sprd_thm_suspend(struct device *dev)
{}

static int sprd_thm_hw_resume(struct sprd_thermal_data *thm)
{}

static int sprd_thm_resume(struct device *dev)
{}
#endif

static void sprd_thm_remove(struct platform_device *pdev)
{}

static const struct of_device_id sprd_thermal_of_match[] =;
MODULE_DEVICE_TABLE(of, sprd_thermal_of_match);

static const struct dev_pm_ops sprd_thermal_pm_ops =;

static struct platform_driver sprd_thermal_driver =;

module_platform_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();