linux/drivers/hwmon/mr75203.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) 2020 MaxLinear, Inc.
 *
 * This driver is a hardware monitoring driver for PVT controller
 * (MR75203) which is used to configure & control Moortec embedded
 * analog IP to enable multiple embedded temperature sensor(TS),
 * voltage monitor(VM) & process detector(PD) modules.
 */
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/hwmon.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/mutex.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/units.h>

/* PVT Common register */
#define PVT_IP_CONFIG
#define TS_NUM_MSK
#define TS_NUM_SFT
#define PD_NUM_MSK
#define PD_NUM_SFT
#define VM_NUM_MSK
#define VM_NUM_SFT
#define CH_NUM_MSK
#define CH_NUM_SFT

#define VM_NUM_MAX

/* Macro Common Register */
#define CLK_SYNTH
#define CLK_SYNTH_LO_SFT
#define CLK_SYNTH_HI_SFT
#define CLK_SYNTH_HOLD_SFT
#define CLK_SYNTH_EN
#define CLK_SYS_CYCLES_MAX
#define CLK_SYS_CYCLES_MIN

#define SDIF_DISABLE

#define SDIF_STAT
#define SDIF_BUSY
#define SDIF_LOCK

#define SDIF_W
#define SDIF_PROG
#define SDIF_WRN_W
#define SDIF_WRN_R
#define SDIF_ADDR_SFT

#define SDIF_HALT
#define SDIF_CTRL
#define SDIF_SMPL_CTRL

/* TS & PD Individual Macro Register */
#define COM_REG_SIZE

#define SDIF_DONE(n)
#define SDIF_SMPL_DONE

#define SDIF_DATA(n)
#define SAMPLE_DATA_MSK

#define HILO_RESET(n)

/* VM Individual Macro Register */
#define VM_COM_REG_SIZE
#define VM_SDIF_DONE(vm)
#define VM_SDIF_DATA(vm, ch)

/* SDA Slave Register */
#define IP_CTRL
#define IP_RST_REL
#define IP_RUN_CONT
#define IP_AUTO
#define IP_VM_MODE

#define IP_CFG
#define CFG0_MODE_2
#define CFG0_PARALLEL_OUT
#define CFG0_12_BIT
#define CFG1_VOL_MEAS_MODE
#define CFG1_PARALLEL_OUT
#define CFG1_14_BIT

#define IP_DATA

#define IP_POLL
#define VM_CH_INIT
#define VM_CH_REQ

#define IP_TMR
#define POWER_DELAY_CYCLE_256
#define POWER_DELAY_CYCLE_64

#define PVT_POLL_DELAY_US
#define PVT_POLL_TIMEOUT_US
#define PVT_CONV_BITS
#define PVT_N_CONST
#define PVT_R_CONST

#define PVT_TEMP_MIN_mC
#define PVT_TEMP_MAX_mC

/* Temperature coefficients for series 5 */
#define PVT_SERIES5_H_CONST
#define PVT_SERIES5_G_CONST
#define PVT_SERIES5_J_CONST
#define PVT_SERIES5_CAL5_CONST

/* Temperature coefficients for series 6 */
#define PVT_SERIES6_H_CONST
#define PVT_SERIES6_G_CONST
#define PVT_SERIES6_J_CONST
#define PVT_SERIES6_CAL5_CONST

#define TEMPERATURE_SENSOR_SERIES_5
#define TEMPERATURE_SENSOR_SERIES_6

#define PRE_SCALER_X1
#define PRE_SCALER_X2

/**
 * struct voltage_device - VM single input parameters.
 * @vm_map: Map channel number to VM index.
 * @ch_map: Map channel number to channel index.
 * @pre_scaler: Pre scaler value (1 or 2) used to normalize the voltage output
 *              result.
 *
 * The structure provides mapping between channel-number (0..N-1) to VM-index
 * (0..num_vm-1) and channel-index (0..ch_num-1) where N = num_vm * ch_num.
 * It also provides normalization factor for the VM equation.
 */
struct voltage_device {};

/**
 * struct voltage_channels - VM channel count.
 * @total: Total number of channels in all VMs.
 * @max: Maximum number of channels among all VMs.
 *
 * The structure provides channel count information across all VMs.
 */
struct voltage_channels {};

struct temp_coeff {};

struct pvt_device {};

static ssize_t pvt_ts_coeff_j_read(struct file *file, char __user *user_buf,
				   size_t count, loff_t *ppos)
{}

static ssize_t pvt_ts_coeff_j_write(struct file *file,
				    const char __user *user_buf,
				    size_t count, loff_t *ppos)
{}

static const struct file_operations pvt_ts_coeff_j_fops =;

static void devm_pvt_ts_dbgfs_remove(void *data)
{}

static int pvt_ts_dbgfs_create(struct pvt_device *pvt, struct device *dev)
{}

static umode_t pvt_is_visible(const void *data, enum hwmon_sensor_types type,
			      u32 attr, int channel)
{}

static long pvt_calc_temp(struct pvt_device *pvt, u32 nbs)
{}

static int pvt_read_temp(struct device *dev, u32 attr, int channel, long *val)
{}

static int pvt_read_in(struct device *dev, u32 attr, int channel, long *val)
{}

static int pvt_read(struct device *dev, enum hwmon_sensor_types type,
		    u32 attr, int channel, long *val)
{}

static struct hwmon_channel_info pvt_temp =;

static struct hwmon_channel_info pvt_in =;

static const struct hwmon_ops pvt_hwmon_ops =;

static struct hwmon_chip_info pvt_chip_info =;

static int pvt_init(struct pvt_device *pvt)
{}

static struct regmap_config pvt_regmap_config =;

static int pvt_get_regmap(struct platform_device *pdev, char *reg_name,
			  struct pvt_device *pvt)
{}

static void pvt_reset_control_assert(void *data)
{}

static int pvt_reset_control_deassert(struct device *dev, struct pvt_device *pvt)
{}

static int pvt_get_active_channel(struct device *dev, struct pvt_device *pvt,
				  u32 vm_num, u32 ch_num, u8 *vm_idx)
{}

static int pvt_get_pre_scaler(struct device *dev, struct pvt_device *pvt)
{}

static int pvt_set_temp_coeff(struct device *dev, struct pvt_device *pvt)
{}

static int mr75203_probe(struct platform_device *pdev)
{}

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

static struct platform_driver moortec_pvt_driver =;
module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();