linux/drivers/thermal/renesas/rcar_gen3_thermal.c

// SPDX-License-Identifier: GPL-2.0
/*
 *  R-Car Gen3 THS thermal sensor driver
 *  Based on rcar_thermal.c and work from Hien Dang and Khiem Nguyen.
 *
 * Copyright (C) 2016 Renesas Electronics Corporation.
 * Copyright (C) 2016 Sang Engineering
 */
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/thermal.h>

#include "../thermal_hwmon.h"

/* Register offsets */
#define REG_GEN3_IRQSTR
#define REG_GEN3_IRQMSK
#define REG_GEN3_IRQCTL
#define REG_GEN3_IRQEN
#define REG_GEN3_IRQTEMP1
#define REG_GEN3_IRQTEMP2
#define REG_GEN3_IRQTEMP3
#define REG_GEN3_THCTR
#define REG_GEN3_TEMP
#define REG_GEN3_THCODE1
#define REG_GEN3_THCODE2
#define REG_GEN3_THCODE3
#define REG_GEN3_PTAT1
#define REG_GEN3_PTAT2
#define REG_GEN3_PTAT3
#define REG_GEN3_THSCP
#define REG_GEN4_THSFMON00
#define REG_GEN4_THSFMON01
#define REG_GEN4_THSFMON02
#define REG_GEN4_THSFMON15
#define REG_GEN4_THSFMON16
#define REG_GEN4_THSFMON17

/* IRQ{STR,MSK,EN} bits */
#define IRQ_TEMP1
#define IRQ_TEMP2
#define IRQ_TEMP3
#define IRQ_TEMPD1
#define IRQ_TEMPD2
#define IRQ_TEMPD3

/* THCTR bits */
#define THCTR_PONM
#define THCTR_THSST

/* THSCP bits */
#define THSCP_COR_PARA_VLD

#define CTEMP_MASK

#define MCELSIUS(temp)
#define GEN3_FUSE_MASK
#define GEN4_FUSE_MASK

#define TSC_MAX_NUM

struct rcar_gen3_thermal_priv;

struct rcar_thermal_info {};

struct equation_set_coef {};

struct rcar_gen3_thermal_tsc {};

struct rcar_gen3_thermal_priv {};

static inline u32 rcar_gen3_thermal_read(struct rcar_gen3_thermal_tsc *tsc,
					 u32 reg)
{}

static inline void rcar_gen3_thermal_write(struct rcar_gen3_thermal_tsc *tsc,
					   u32 reg, u32 data)
{}

/*
 * Linear approximation for temperature
 *
 * [temp] = ((thadj - [reg]) * a) / b + adj
 * [reg] = thadj - ([temp] - adj) * b / a
 *
 * The constants a and b are calculated using two triplets of int values PTAT
 * and THCODE. PTAT and THCODE can either be read from hardware or use hard
 * coded values from the driver. The formula to calculate a and b are taken from
 * the datasheet. Different calculations are needed for a and b depending on
 * if the input variables ([temp] or [reg]) are above or below a threshold. The
 * threshold is also calculated from PTAT and THCODE using formulas from the
 * datasheet.
 *
 * The constant thadj is one of the THCODE values, which one to use depends on
 * the threshold and input value.
 *
 * The constants adj is taken verbatim from the datasheet. Two values exists,
 * which one to use depends on the input value and the calculated threshold.
 * Furthermore different SoC models supported by the driver have different sets
 * of values. The values for each model are stored in the device match data.
 */

static void rcar_gen3_thermal_shared_coefs(struct rcar_gen3_thermal_priv *priv)
{}
static void rcar_gen3_thermal_tsc_coefs(struct rcar_gen3_thermal_priv *priv,
					struct rcar_gen3_thermal_tsc *tsc)
{}

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

static int rcar_gen3_thermal_mcelsius_to_temp(struct rcar_gen3_thermal_tsc *tsc,
					      int mcelsius)
{}

static int rcar_gen3_thermal_set_trips(struct thermal_zone_device *tz, int low, int high)
{}

static const struct thermal_zone_device_ops rcar_gen3_tz_of_ops =;

static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data)
{}

static void rcar_gen3_thermal_read_fuses_gen3(struct rcar_gen3_thermal_priv *priv)
{}

static void rcar_gen3_thermal_read_fuses_gen4(struct rcar_gen3_thermal_priv *priv)
{}

static bool rcar_gen3_thermal_read_fuses(struct rcar_gen3_thermal_priv *priv)
{}

static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_priv *priv,
				   struct rcar_gen3_thermal_tsc *tsc)
{}

static const struct rcar_thermal_info rcar_m3w_thermal_info =;

static const struct rcar_thermal_info rcar_gen3_thermal_info =;

static const struct rcar_thermal_info rcar_gen4_thermal_info =;

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

static void rcar_gen3_thermal_remove(struct platform_device *pdev)
{}

static void rcar_gen3_hwmon_action(void *data)
{}

static int rcar_gen3_thermal_request_irqs(struct rcar_gen3_thermal_priv *priv,
					  struct platform_device *pdev)
{}

static int rcar_gen3_thermal_probe(struct platform_device *pdev)
{}

static int __maybe_unused rcar_gen3_thermal_resume(struct device *dev)
{}

static SIMPLE_DEV_PM_OPS(rcar_gen3_thermal_pm_ops, NULL,
			 rcar_gen3_thermal_resume);

static struct platform_driver rcar_gen3_thermal_driver =;
module_platform_driver();

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