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>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
09128bd57d
commit
3974704e22
@@ -27,8 +27,6 @@
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/thread_info.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/adc-tm-clients.h>
|
||||
#include <linux/iio/consumer.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_irq.h>
|
||||
@@ -876,9 +874,6 @@ static int icnss_driver_event_server_arrive(struct icnss_priv *priv,
|
||||
if (!priv->fw_early_crash_irq)
|
||||
register_early_crash_notifications(&priv->pdev->dev);
|
||||
|
||||
if (priv->vbatt_supported)
|
||||
icnss_init_vph_monitor(priv);
|
||||
|
||||
return ret;
|
||||
|
||||
device_info_failure:
|
||||
@@ -898,10 +893,6 @@ static int icnss_driver_event_server_exit(struct icnss_priv *priv)
|
||||
|
||||
icnss_clear_server(priv);
|
||||
|
||||
if (priv->adc_tm_dev && priv->vbatt_supported)
|
||||
adc_tm_disable_chan_meas(priv->adc_tm_dev,
|
||||
&priv->vph_monitor_params);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3743,44 +3734,6 @@ static void icnss_sysfs_destroy(struct icnss_priv *priv)
|
||||
devm_device_remove_group(&priv->pdev->dev, &icnss_attr_group);
|
||||
}
|
||||
|
||||
static int icnss_get_vbatt_info(struct icnss_priv *priv)
|
||||
{
|
||||
struct adc_tm_chip *adc_tm_dev = NULL;
|
||||
struct iio_channel *channel = NULL;
|
||||
int ret = 0;
|
||||
|
||||
adc_tm_dev = get_adc_tm(&priv->pdev->dev, "icnss");
|
||||
if (PTR_ERR(adc_tm_dev) == -EPROBE_DEFER) {
|
||||
icnss_pr_err("adc_tm_dev probe defer\n");
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
if (IS_ERR(adc_tm_dev)) {
|
||||
ret = PTR_ERR(adc_tm_dev);
|
||||
icnss_pr_err("Not able to get ADC dev, VBATT monitoring is disabled: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
channel = devm_iio_channel_get(&priv->pdev->dev, "icnss");
|
||||
if (PTR_ERR(channel) == -EPROBE_DEFER) {
|
||||
icnss_pr_err("channel probe defer\n");
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
|
||||
if (IS_ERR(channel)) {
|
||||
ret = PTR_ERR(channel);
|
||||
icnss_pr_err("Not able to get VADC dev, VBATT monitoring is disabled: %d\n",
|
||||
ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
priv->adc_tm_dev = adc_tm_dev;
|
||||
priv->channel = channel;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int icnss_resource_parse(struct icnss_priv *priv)
|
||||
{
|
||||
int ret = 0, i = 0;
|
||||
@@ -3789,13 +3742,6 @@ static int icnss_resource_parse(struct icnss_priv *priv)
|
||||
struct resource *res;
|
||||
u32 int_prop;
|
||||
|
||||
if (of_property_read_bool(pdev->dev.of_node, "qcom,icnss-adc_tm")) {
|
||||
ret = icnss_get_vbatt_info(priv);
|
||||
if (ret == -EPROBE_DEFER)
|
||||
goto out;
|
||||
priv->vbatt_supported = true;
|
||||
}
|
||||
|
||||
ret = icnss_get_vreg(priv);
|
||||
if (ret) {
|
||||
icnss_pr_err("Failed to get vreg, err = %d\n", ret);
|
||||
|
@@ -6,13 +6,10 @@
|
||||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#include <linux/adc-tm-clients.h>
|
||||
#include <linux/iio/consumer.h>
|
||||
#include <linux/irqreturn.h>
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/ipc_logging.h>
|
||||
#include <dt-bindings/iio/qcom,spmi-vadc.h>
|
||||
#include <soc/qcom/icnss2.h>
|
||||
#include "wlan_firmware_service_v01.h"
|
||||
#include <linux/mailbox_client.h>
|
||||
@@ -255,9 +252,6 @@ struct icnss_stats {
|
||||
uint32_t rejuvenate_ack_req;
|
||||
uint32_t rejuvenate_ack_resp;
|
||||
uint32_t rejuvenate_ack_err;
|
||||
uint32_t vbatt_req;
|
||||
uint32_t vbatt_resp;
|
||||
uint32_t vbatt_req_err;
|
||||
uint32_t device_info_req;
|
||||
uint32_t device_info_resp;
|
||||
uint32_t device_info_err;
|
||||
@@ -445,11 +439,6 @@ struct icnss_priv {
|
||||
uint32_t fw_early_crash_irq;
|
||||
struct smp2p_out_info smp2p_info[ICNSS_SMP2P_OUT_MAX];
|
||||
struct completion unblock_shutdown;
|
||||
struct adc_tm_param vph_monitor_params;
|
||||
struct adc_tm_chip *adc_tm_dev;
|
||||
struct iio_channel *channel;
|
||||
uint64_t vph_pwr;
|
||||
bool vbatt_supported;
|
||||
char function_name[WLFW_FUNCTION_NAME_LEN + 1];
|
||||
bool is_ssr;
|
||||
bool smmu_s1_enable;
|
||||
|
132
icnss2/power.c
132
icnss2/power.c
@@ -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;
|
||||
|
@@ -10,7 +10,6 @@ int icnss_hw_power_on(struct icnss_priv *priv);
|
||||
int icnss_hw_power_off(struct icnss_priv *priv);
|
||||
int icnss_get_clk(struct icnss_priv *priv);
|
||||
int icnss_get_vreg(struct icnss_priv *priv);
|
||||
int icnss_init_vph_monitor(struct icnss_priv *priv);
|
||||
void icnss_put_resources(struct icnss_priv *priv);
|
||||
void icnss_put_vreg(struct icnss_priv *priv);
|
||||
void icnss_put_clk(struct icnss_priv *priv);
|
||||
|
71
icnss2/qmi.c
71
icnss2/qmi.c
@@ -3087,77 +3087,6 @@ int icnss_send_wlan_disable_to_fw(struct icnss_priv *priv)
|
||||
return wlfw_wlan_mode_send_sync_msg(priv, mode);
|
||||
}
|
||||
|
||||
int icnss_send_vbatt_update(struct icnss_priv *priv, uint64_t voltage_uv)
|
||||
{
|
||||
int ret;
|
||||
struct wlfw_vbatt_req_msg_v01 *req;
|
||||
struct wlfw_vbatt_resp_msg_v01 *resp;
|
||||
struct qmi_txn txn;
|
||||
|
||||
if (!priv)
|
||||
return -ENODEV;
|
||||
|
||||
if (test_bit(ICNSS_FW_DOWN, &priv->state))
|
||||
return -EINVAL;
|
||||
|
||||
icnss_pr_dbg("Sending Vbatt message, state: 0x%lx\n", priv->state);
|
||||
|
||||
req = kzalloc(sizeof(*req), GFP_KERNEL);
|
||||
if (!req)
|
||||
return -ENOMEM;
|
||||
|
||||
resp = kzalloc(sizeof(*resp), GFP_KERNEL);
|
||||
if (!resp) {
|
||||
kfree(req);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
priv->stats.vbatt_req++;
|
||||
|
||||
req->voltage_uv = voltage_uv;
|
||||
|
||||
ret = qmi_txn_init(&priv->qmi, &txn, wlfw_vbatt_resp_msg_v01_ei, resp);
|
||||
if (ret < 0) {
|
||||
icnss_pr_err("Fail to init txn for Vbatt message resp %d\n",
|
||||
ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = qmi_send_request(&priv->qmi, NULL, &txn,
|
||||
QMI_WLFW_VBATT_REQ_V01,
|
||||
WLFW_VBATT_REQ_MSG_V01_MAX_MSG_LEN,
|
||||
wlfw_vbatt_req_msg_v01_ei, req);
|
||||
if (ret < 0) {
|
||||
qmi_txn_cancel(&txn);
|
||||
icnss_pr_err("Fail to send Vbatt message req %d\n", ret);
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = qmi_txn_wait(&txn, priv->ctrl_params.qmi_timeout);
|
||||
if (ret < 0) {
|
||||
icnss_pr_err("VBATT message resp wait failed with ret %d\n",
|
||||
ret);
|
||||
goto out;
|
||||
} else if (resp->resp.result != QMI_RESULT_SUCCESS_V01) {
|
||||
icnss_pr_err("QMI Vbatt message request rejected, result:%d error:%d\n",
|
||||
resp->resp.result, resp->resp.error);
|
||||
ret = -resp->resp.result;
|
||||
goto out;
|
||||
}
|
||||
|
||||
priv->stats.vbatt_resp++;
|
||||
|
||||
kfree(resp);
|
||||
kfree(req);
|
||||
return 0;
|
||||
|
||||
out:
|
||||
kfree(resp);
|
||||
kfree(req);
|
||||
priv->stats.vbatt_req_err++;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ICNSS2_DEBUG
|
||||
static inline u32 icnss_get_host_build_type(void)
|
||||
{
|
||||
|
@@ -126,12 +126,6 @@ static inline int icnss_register_fw_service(struct icnss_priv *priv)
|
||||
return 0;
|
||||
}
|
||||
static inline void icnss_unregister_fw_service(struct icnss_priv *priv) {}
|
||||
static inline int icnss_send_vbatt_update(struct icnss_priv *priv,
|
||||
uint64_t voltage_uv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int wlfw_device_info_send_msg(struct icnss_priv *priv)
|
||||
{
|
||||
return 0;
|
||||
@@ -232,7 +226,6 @@ int icnss_send_wlan_enable_to_fw(struct icnss_priv *priv,
|
||||
int icnss_send_wlan_disable_to_fw(struct icnss_priv *priv);
|
||||
int icnss_register_fw_service(struct icnss_priv *priv);
|
||||
void icnss_unregister_fw_service(struct icnss_priv *priv);
|
||||
int icnss_send_vbatt_update(struct icnss_priv *priv, uint64_t voltage_uv);
|
||||
int wlfw_host_cap_send_sync(struct icnss_priv *priv);
|
||||
int wlfw_device_info_send_msg(struct icnss_priv *priv);
|
||||
int wlfw_wlan_mode_send_sync_msg(struct icnss_priv *priv,
|
||||
|
Reference in New Issue
Block a user