linux/drivers/iio/adc/qcom-vadc-common.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/bug.h>
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/fixp-arith.h>
#include <linux/iio/adc/qcom-vadc-common.h>
#include <linux/math64.h>
#include <linux/log2.h>
#include <linux/err.h>
#include <linux/module.h>
#include <linux/units.h>

/**
 * struct vadc_map_pt - Map the graph representation for ADC channel
 * @x: Represent the ADC digitized code.
 * @y: Represent the physical data which can be temperature, voltage,
 *     resistance.
 */
struct vadc_map_pt {};

/* Voltage to temperature */
static const struct vadc_map_pt adcmap_100k_104ef_104fb[] =;

/*
 * Voltage to temperature table for 100k pull up for NTCG104EF104 with
 * 1.875V reference.
 */
static const struct vadc_map_pt adcmap_100k_104ef_104fb_1875_vref[] =;

static const struct vadc_map_pt adcmap7_die_temp[] =;

/*
 * Resistance to temperature table for 100k pull up for NTCG104EF104.
 */
static const struct vadc_map_pt adcmap7_100k[] =;

static const struct u32_fract adc5_prescale_ratios[] =;

static int qcom_vadc_scale_hw_calib_volt(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_uv);
static int qcom_vadc_scale_hw_calib_therm(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec);
static int qcom_vadc7_scale_hw_calib_therm(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec);
static int qcom_vadc_scale_hw_smb_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec);
static int qcom_vadc_scale_hw_chg5_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec);
static int qcom_vadc_scale_hw_calib_die_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec);
static int qcom_vadc7_scale_hw_calib_die_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec);

static struct qcom_adc5_scale_type scale_adc5_fn[] =;

static int qcom_vadc_map_voltage_temp(const struct vadc_map_pt *pts,
				      u32 tablesize, s32 input, int *output)
{}

static s32 qcom_vadc_map_temp_voltage(const struct vadc_map_pt *pts,
				      u32 tablesize, int input)
{}

static void qcom_vadc_scale_calib(const struct vadc_linear_graph *calib_graph,
				  u16 adc_code,
				  bool absolute,
				  s64 *scale_voltage)
{}

static int qcom_vadc_scale_volt(const struct vadc_linear_graph *calib_graph,
				const struct u32_fract *prescale,
				bool absolute, u16 adc_code,
				int *result_uv)
{}

static int qcom_vadc_scale_therm(const struct vadc_linear_graph *calib_graph,
				 const struct u32_fract *prescale,
				 bool absolute, u16 adc_code,
				 int *result_mdec)
{}

static int qcom_vadc_scale_die_temp(const struct vadc_linear_graph *calib_graph,
				    const struct u32_fract *prescale,
				    bool absolute,
				    u16 adc_code, int *result_mdec)
{}

static int qcom_vadc_scale_chg_temp(const struct vadc_linear_graph *calib_graph,
				    const struct u32_fract *prescale,
				    bool absolute,
				    u16 adc_code, int *result_mdec)
{}

/* convert voltage to ADC code, using 1.875V reference */
static u16 qcom_vadc_scale_voltage_code(s32 voltage,
					const struct u32_fract *prescale,
					const u32 full_scale_code_volt,
					unsigned int factor)
{}

static int qcom_vadc_scale_code_voltage_factor(u16 adc_code,
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				unsigned int factor)
{}

static int qcom_vadc7_scale_hw_calib_therm(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{}

static int qcom_vadc_scale_hw_calib_volt(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_uv)
{}

static int qcom_vadc_scale_hw_calib_therm(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{}

static int qcom_vadc_scale_hw_calib_die_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{}

static int qcom_vadc7_scale_hw_calib_die_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{}

static int qcom_vadc_scale_hw_smb_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{}

static int qcom_vadc_scale_hw_chg5_temp(
				const struct u32_fract *prescale,
				const struct adc5_data *data,
				u16 adc_code, int *result_mdec)
{}

int qcom_vadc_scale(enum vadc_scale_fn_type scaletype,
		    const struct vadc_linear_graph *calib_graph,
		    const struct u32_fract *prescale,
		    bool absolute,
		    u16 adc_code, int *result)
{}
EXPORT_SYMBOL();

u16 qcom_adc_tm5_temp_volt_scale(unsigned int prescale_ratio,
				 u32 full_scale_code_volt, int temp)
{}
EXPORT_SYMBOL();

u16 qcom_adc_tm5_gen2_temp_res_scale(int temp)
{}
EXPORT_SYMBOL();

int qcom_adc5_hw_scale(enum vadc_scale_fn_type scaletype,
		    unsigned int prescale_ratio,
		    const struct adc5_data *data,
		    u16 adc_code, int *result)
{}
EXPORT_SYMBOL();

int qcom_adc5_prescaling_from_dt(u32 numerator, u32 denominator)
{}
EXPORT_SYMBOL();

int qcom_adc5_hw_settle_time_from_dt(u32 value,
				     const unsigned int *hw_settle)
{}
EXPORT_SYMBOL();

int qcom_adc5_avg_samples_from_dt(u32 value)
{}
EXPORT_SYMBOL();

int qcom_adc5_decimation_from_dt(u32 value, const unsigned int *decimation)
{}
EXPORT_SYMBOL();

int qcom_vadc_decimation_from_dt(u32 value)
{}
EXPORT_SYMBOL();

MODULE_LICENSE();
MODULE_DESCRIPTION();