mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
pm8xxx-adc: add the functions to set tuning parameters
We need to tune the board specific adcmap parameters So need functions to set specific parameters. void pm8xxx_set_adcmap_btm_threshold(void *pts, int size) void pm8xxx_set_adcmap_pa_therm(void *pts, int size) void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size) Change-Id: Ie78c11f5fb998ecc456defa3c8e3e7a3e0b9b45f
This commit is contained in:
parent
4a52ad6f2b
commit
2b64f6b785
2 changed files with 75 additions and 13 deletions
|
@ -25,7 +25,7 @@
|
|||
and provided to the battery driver in the units desired for
|
||||
their framework which is 0.1DegC. True resolution of 0.1DegC
|
||||
will result in the below table size to increase by 10 times */
|
||||
static const struct pm8xxx_adc_map_pt adcmap_btm_threshold[] = {
|
||||
static struct pm8xxx_adc_map_pt def_adcmap_btm_threshold[] = {
|
||||
{-300, 1642},
|
||||
{-200, 1544},
|
||||
{-100, 1414},
|
||||
|
@ -111,7 +111,7 @@ static const struct pm8xxx_adc_map_pt adcmap_btm_threshold[] = {
|
|||
{790, 203}
|
||||
};
|
||||
|
||||
static const struct pm8xxx_adc_map_pt adcmap_pa_therm[] = {
|
||||
static struct pm8xxx_adc_map_pt def_adcmap_pa_therm[] = {
|
||||
{1731, -30},
|
||||
{1726, -29},
|
||||
{1721, -28},
|
||||
|
@ -270,7 +270,7 @@ static const struct pm8xxx_adc_map_pt adcmap_pa_therm[] = {
|
|||
{49, 125}
|
||||
};
|
||||
|
||||
static const struct pm8xxx_adc_map_pt adcmap_ntcg_104ef_104fb[] = {
|
||||
static struct pm8xxx_adc_map_pt def_adcmap_ntcg_104ef_104fb[] = {
|
||||
{696483, -40960},
|
||||
{649148, -39936},
|
||||
{605368, -38912},
|
||||
|
@ -439,6 +439,40 @@ static const struct pm8xxx_adc_map_pt adcmap_ntcg_104ef_104fb[] = {
|
|||
{419, 128000}
|
||||
};
|
||||
|
||||
static struct pm8xxx_adc_map adcmap_btm_threshold = {
|
||||
.pt = def_adcmap_btm_threshold,
|
||||
.size = ARRAY_SIZE(def_adcmap_btm_threshold),
|
||||
};
|
||||
static struct pm8xxx_adc_map adcmap_pa_therm = {
|
||||
.pt = def_adcmap_pa_therm,
|
||||
.size = ARRAY_SIZE(def_adcmap_pa_therm),
|
||||
};
|
||||
static struct pm8xxx_adc_map adcmap_ntcg_104ef_104fb = {
|
||||
.pt = def_adcmap_ntcg_104ef_104fb,
|
||||
.size = ARRAY_SIZE(def_adcmap_ntcg_104ef_104fb),
|
||||
};
|
||||
|
||||
void pm8xxx_set_adcmap_btm_threshold(void *pts, int size)
|
||||
{
|
||||
adcmap_btm_threshold.pt = pts;
|
||||
adcmap_btm_threshold.size = size;
|
||||
}
|
||||
EXPORT_SYMBOL(pm8xxx_set_adcmap_btm_threshold);
|
||||
|
||||
void pm8xxx_set_adcmap_pa_therm(void *pts, int size)
|
||||
{
|
||||
adcmap_pa_therm.pt = pts;
|
||||
adcmap_pa_therm.size = size;
|
||||
}
|
||||
EXPORT_SYMBOL(pm8xxx_set_adcmap_pa_therm);
|
||||
|
||||
void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size)
|
||||
{
|
||||
adcmap_ntcg_104ef_104fb.pt = pts;
|
||||
adcmap_ntcg_104ef_104fb.size = size;
|
||||
}
|
||||
EXPORT_SYMBOL(pm8xxx_set_adcmap_ntcg_104ef_104fb);
|
||||
|
||||
static int32_t pm8xxx_adc_map_linear(const struct pm8xxx_adc_map_pt *pts,
|
||||
uint32_t tablesize, int32_t input, int64_t *output)
|
||||
{
|
||||
|
@ -622,8 +656,8 @@ int32_t pm8xxx_adc_scale_batt_therm(int32_t adc_code,
|
|||
adc_properties, chan_properties);
|
||||
|
||||
return pm8xxx_adc_map_batt_therm(
|
||||
adcmap_btm_threshold,
|
||||
ARRAY_SIZE(adcmap_btm_threshold),
|
||||
adcmap_btm_threshold.pt,
|
||||
adcmap_btm_threshold.size,
|
||||
bat_voltage,
|
||||
&adc_chan_result->physical);
|
||||
}
|
||||
|
@ -640,8 +674,8 @@ int32_t pm8xxx_adc_scale_pa_therm(int32_t adc_code,
|
|||
adc_properties, chan_properties);
|
||||
|
||||
return pm8xxx_adc_map_linear(
|
||||
adcmap_pa_therm,
|
||||
ARRAY_SIZE(adcmap_pa_therm),
|
||||
adcmap_pa_therm.pt,
|
||||
adcmap_pa_therm.size,
|
||||
pa_voltage,
|
||||
&adc_chan_result->physical);
|
||||
}
|
||||
|
@ -725,8 +759,8 @@ int32_t pm8xxx_adc_tdkntcg_therm(int32_t adc_code,
|
|||
xo_thm = pm8xxx_adc_scale_ratiometric_calib(adc_code,
|
||||
adc_properties, chan_properties);
|
||||
xo_thm <<= 4;
|
||||
pm8xxx_adc_map_linear(adcmap_ntcg_104ef_104fb,
|
||||
ARRAY_SIZE(adcmap_ntcg_104ef_104fb),
|
||||
pm8xxx_adc_map_linear(adcmap_ntcg_104ef_104fb.pt,
|
||||
adcmap_ntcg_104ef_104fb.size,
|
||||
xo_thm, &adc_chan_result->physical);
|
||||
|
||||
return 0;
|
||||
|
@ -740,8 +774,8 @@ int32_t pm8xxx_adc_batt_scaler(struct pm8xxx_adc_arb_btm_param *btm_param,
|
|||
int rc;
|
||||
|
||||
rc = pm8xxx_adc_map_linear(
|
||||
adcmap_btm_threshold,
|
||||
ARRAY_SIZE(adcmap_btm_threshold),
|
||||
adcmap_btm_threshold.pt,
|
||||
adcmap_btm_threshold.size,
|
||||
(btm_param->low_thr_temp),
|
||||
&btm_param->low_thr_voltage);
|
||||
if (rc)
|
||||
|
@ -754,8 +788,8 @@ int32_t pm8xxx_adc_batt_scaler(struct pm8xxx_adc_arb_btm_param *btm_param,
|
|||
chan_properties->adc_graph[ADC_CALIB_RATIOMETRIC].adc_gnd;
|
||||
|
||||
rc = pm8xxx_adc_map_linear(
|
||||
adcmap_btm_threshold,
|
||||
ARRAY_SIZE(adcmap_btm_threshold),
|
||||
adcmap_btm_threshold.pt,
|
||||
adcmap_btm_threshold.size,
|
||||
(btm_param->high_thr_temp),
|
||||
&btm_param->high_thr_voltage);
|
||||
if (rc)
|
||||
|
|
|
@ -247,6 +247,16 @@ struct pm8xxx_adc_map_pt {
|
|||
int32_t y;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pm8xxx_adc_map - container of pm8xxx_adc_map_pt
|
||||
* @pt: pointer of pm8xxx_adc_map_pt
|
||||
* @size: size of pm8xxx_adc_map_pt
|
||||
*/
|
||||
struct pm8xxx_adc_map {
|
||||
struct pm8xxx_adc_map_pt *pt;
|
||||
int size;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pm8xxx_adc_scaling_ratio - Represent scaling ratio for adc input
|
||||
* @num: Numerator scaling parameter
|
||||
|
@ -584,6 +594,21 @@ uint32_t pm8xxx_adc_btm_end(void);
|
|||
* events are triggered.
|
||||
*/
|
||||
uint32_t pm8xxx_adc_btm_configure(struct pm8xxx_adc_arb_btm_param *);
|
||||
|
||||
/**
|
||||
* pm8xxx_set_adcmap_btm_threshold()
|
||||
*/
|
||||
void pm8xxx_set_adcmap_btm_threshold(void *pts, int size);
|
||||
|
||||
/**
|
||||
* pm8xxx_set_adcmap_pa_therm()
|
||||
*/
|
||||
void pm8xxx_set_adcmap_pa_therm(void *pts, int size);
|
||||
|
||||
/**
|
||||
* pm8xxx_st_adcmap_ntcg_104ef_104fb()
|
||||
*/
|
||||
void pm8xxx_set_adcmap_ntcg_104ef_104fb(void *pts, int size);
|
||||
#else
|
||||
static inline uint32_t pm8xxx_adc_read(uint32_t channel,
|
||||
struct pm8xxx_adc_chan_result *result)
|
||||
|
@ -599,6 +624,9 @@ static inline uint32_t pm8xxx_adc_btm_end(void)
|
|||
static inline uint32_t pm8xxx_adc_btm_configure(
|
||||
struct pm8xxx_adc_arb_btm_param *param)
|
||||
{ return -ENXIO; }
|
||||
static inline void pm8xxx_set_adcmap_btm_threshold(void) { }
|
||||
static inline void pm8xxx_set_adcmap_pa_therm(void) { }
|
||||
static inline void pm8xxx_set_adcmap_ntcg_104ef_104fb(void) { }
|
||||
#endif
|
||||
|
||||
#endif /* PM8XXX_ADC_H */
|
||||
|
|
Loading…
Reference in a new issue