linux/drivers/thermal/k3_j72xx_bandgap.c

// SPDX-License-Identifier: GPL-2.0
/*
 * TI Bandgap temperature sensor driver for J72XX SoC Family
 *
 * Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com/
 */

#include <linux/math.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/err.h>
#include <linux/types.h>
#include <linux/io.h>
#include <linux/thermal.h>
#include <linux/of.h>
#include <linux/delay.h>
#include <linux/slab.h>

#define K3_VTM_DEVINFO_PWR0_OFFSET
#define K3_VTM_DEVINFO_PWR0_TEMPSENS_CT_MASK
#define K3_VTM_TMPSENS0_CTRL_OFFSET
#define K3_VTM_MISC_CTRL_OFFSET
#define K3_VTM_TMPSENS_STAT_OFFSET
#define K3_VTM_ANYMAXT_OUTRG_ALERT_EN
#define K3_VTM_MISC_CTRL2_OFFSET
#define K3_VTM_TS_STAT_DTEMP_MASK
#define K3_VTM_MAX_NUM_TS
#define K3_VTM_TMPSENS_CTRL_SOC
#define K3_VTM_TMPSENS_CTRL_CLRZ
#define K3_VTM_TMPSENS_CTRL_CLKON_REQ
#define K3_VTM_TMPSENS_CTRL_MAXT_OUTRG_EN

#define K3_VTM_CORRECTION_TEMP_CNT

#define MINUS40CREF
#define PLUS30CREF
#define PLUS125CREF
#define PLUS150CREF

#define TABLE_SIZE
#define MAX_TEMP
#define COOL_DOWN_TEMP

#define FACTORS_REDUCTION
static int *derived_table;

static int compute_value(int index, const s64 *factors, int nr_factors,
			 int reduction)
{}

static void init_table(int factors_size, int *table, const s64 *factors)
{}

/**
 * struct err_values - structure containing error/reference values
 * @refs: reference error values for -40C, 30C, 125C & 150C
 * @errs: Actual error values for -40C, 30C, 125C & 150C read from the efuse
 */
struct err_values {};

static void create_table_segments(struct err_values *err_vals, int seg,
				  int *ref_table)
{}

static int prep_lookup_table(struct err_values *err_vals, int *ref_table)
{}

struct k3_thermal_data;

struct k3_j72xx_bandgap {};

/* common data structures */
struct k3_thermal_data {};

static int two_cmp(int tmp, int mask)
{}

static unsigned int vtm_get_best_value(unsigned int s0, unsigned int s1,
				       unsigned int s2)
{}

static inline int k3_bgp_read_temp(struct k3_thermal_data *devdata,
				   int *temp)
{}

/* Get temperature callback function for thermal zone */
static int k3_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
{}

static const struct thermal_zone_device_ops k3_of_thermal_ops =;

static int k3_j72xx_bandgap_temp_to_adc_code(int temp)
{}

static void get_efuse_values(int id, struct k3_thermal_data *data, int *err,
			     void __iomem *fuse_base)
{}

static void print_look_up_table(struct device *dev, int *ref_table)
{}

static void k3_j72xx_bandgap_init_hw(struct k3_j72xx_bandgap *bgp)
{}

struct k3_j72xx_bandgap_data {};

static int k3_j72xx_bandgap_probe(struct platform_device *pdev)
{}

static void k3_j72xx_bandgap_remove(struct platform_device *pdev)
{}

static int k3_j72xx_bandgap_suspend(struct device *dev)
{}

static int k3_j72xx_bandgap_resume(struct device *dev)
{}

static DEFINE_SIMPLE_DEV_PM_OPS(k3_j72xx_bandgap_pm_ops,
				k3_j72xx_bandgap_suspend,
				k3_j72xx_bandgap_resume);

static const struct k3_j72xx_bandgap_data k3_j72xx_bandgap_j721e_data =;

static const struct k3_j72xx_bandgap_data k3_j72xx_bandgap_j7200_data =;

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

static struct platform_driver k3_j72xx_bandgap_sensor_driver =;

module_platform_driver();

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