icnss2: Remove vbatt feature code from icnss2

This change removes vbatt feature code as adc tm
api's functionalities has been changed and no
longer supports vbatt feature.

Change-Id: I431c1dfe1a5529809fd7d68d1cb15632de3b801b
Signed-off-by: Sandeep Singh <quic_sandsing@quicinc.com>
此提交包含在:
Sandeep Singh
2022-03-14 19:41:47 +05:30
提交者 Gerrit - the friendly Code Review server
父節點 09128bd57d
當前提交 3974704e22
共有 6 個檔案被更改,包括 0 行新增276 行删除

查看文件

@@ -45,9 +45,6 @@ static struct icnss_clk_cfg icnss_adrestea_clk_list[] = {
#define ICNSS_CHAIN1_REGULATOR "vdd-3.3-ch1"
#define MAX_PROP_SIZE 32
#define ICNSS_THRESHOLD_HIGH 3600000
#define ICNSS_THRESHOLD_LOW 3450000
#define ICNSS_THRESHOLD_GUARD 20000
#define BT_CXMX_VOLTAGE_MV 950
#define ICNSS_MBOX_MSG_MAX_LEN 64
@@ -714,135 +711,6 @@ void icnss_put_resources(struct icnss_priv *priv)
icnss_put_vreg(priv);
}
static int icnss_get_phone_power(struct icnss_priv *priv, uint64_t *result_uv)
{
int ret = 0;
int result;
if (!priv->channel) {
icnss_pr_err("Channel doesn't exists\n");
ret = -EINVAL;
goto out;
}
ret = iio_read_channel_processed(priv->channel, &result);
if (ret < 0) {
icnss_pr_err("Error reading channel, ret = %d\n", ret);
goto out;
}
*result_uv = (uint64_t)result;
out:
return ret;
}
static void icnss_vph_notify(enum adc_tm_state state, void *ctx)
{
struct icnss_priv *priv = ctx;
u64 vph_pwr = 0;
u64 vph_pwr_prev;
int ret = 0;
bool update = true;
if (!priv) {
icnss_pr_err("Priv pointer is NULL\n");
return;
}
vph_pwr_prev = priv->vph_pwr;
ret = icnss_get_phone_power(priv, &vph_pwr);
if (ret < 0)
return;
if (vph_pwr < ICNSS_THRESHOLD_LOW) {
if (vph_pwr_prev < ICNSS_THRESHOLD_LOW)
update = false;
priv->vph_monitor_params.state_request =
ADC_TM_HIGH_THR_ENABLE;
priv->vph_monitor_params.high_thr = ICNSS_THRESHOLD_LOW +
ICNSS_THRESHOLD_GUARD;
priv->vph_monitor_params.low_thr = 0;
} else if (vph_pwr > ICNSS_THRESHOLD_HIGH) {
if (vph_pwr_prev > ICNSS_THRESHOLD_HIGH)
update = false;
priv->vph_monitor_params.state_request =
ADC_TM_LOW_THR_ENABLE;
priv->vph_monitor_params.low_thr = ICNSS_THRESHOLD_HIGH -
ICNSS_THRESHOLD_GUARD;
priv->vph_monitor_params.high_thr = 0;
} else {
if (vph_pwr_prev > ICNSS_THRESHOLD_LOW &&
vph_pwr_prev < ICNSS_THRESHOLD_HIGH)
update = false;
priv->vph_monitor_params.state_request =
ADC_TM_HIGH_LOW_THR_ENABLE;
priv->vph_monitor_params.low_thr = ICNSS_THRESHOLD_LOW;
priv->vph_monitor_params.high_thr = ICNSS_THRESHOLD_HIGH;
}
priv->vph_pwr = vph_pwr;
if (update) {
icnss_send_vbatt_update(priv, vph_pwr);
icnss_pr_dbg("set low threshold to %d, high threshold to %d Phone power=%llu\n",
priv->vph_monitor_params.low_thr,
priv->vph_monitor_params.high_thr, vph_pwr);
}
ret = adc_tm_channel_measure(priv->adc_tm_dev,
&priv->vph_monitor_params);
if (ret)
icnss_pr_err("TM channel setup failed %d\n", ret);
}
static int icnss_setup_vph_monitor(struct icnss_priv *priv)
{
int ret = 0;
if (!priv->adc_tm_dev) {
icnss_pr_err("ADC TM handler is NULL\n");
ret = -EINVAL;
goto out;
}
priv->vph_monitor_params.low_thr = ICNSS_THRESHOLD_LOW;
priv->vph_monitor_params.high_thr = ICNSS_THRESHOLD_HIGH;
priv->vph_monitor_params.state_request = ADC_TM_HIGH_LOW_THR_ENABLE;
priv->vph_monitor_params.channel = ADC5_VBAT_SNS;
priv->vph_monitor_params.btm_ctx = priv;
priv->vph_monitor_params.threshold_notification = &icnss_vph_notify;
icnss_pr_dbg("Set low threshold to %d, high threshold to %d\n",
priv->vph_monitor_params.low_thr,
priv->vph_monitor_params.high_thr);
ret = adc_tm_channel_measure(priv->adc_tm_dev,
&priv->vph_monitor_params);
if (ret)
icnss_pr_err("TM channel setup failed %d\n", ret);
out:
return ret;
}
int icnss_init_vph_monitor(struct icnss_priv *priv)
{
int ret = 0;
ret = icnss_get_phone_power(priv, &priv->vph_pwr);
if (ret < 0)
goto out;
icnss_pr_dbg("Phone power=%llu\n", priv->vph_pwr);
icnss_send_vbatt_update(priv, priv->vph_pwr);
ret = icnss_setup_vph_monitor(priv);
if (ret)
goto out;
out:
return ret;
}
int icnss_aop_mbox_init(struct icnss_priv *priv)
{
struct mbox_client *mbox = &priv->mbox_client_data;