icnss2: Enable power supply framework for 5.15 kernel
Icnss driver indicates vbatt voltage level to wlan fw based on battery percentage. This change adds power supply framework code to enable icnss2 driver to measure battery percentage and update vbatt volatge level to wlan fw. Change-Id: I376805da38222a5e7a20ae4a1737bc978ee6a9ae Signed-off-by: Sandeep Singh <quic_sandsing@quicinc.com>
这个提交包含在:
@@ -922,6 +922,9 @@ 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->psf_supported)
|
||||
queue_work(priv->soc_update_wq, &priv->soc_update_work);
|
||||
|
||||
return ret;
|
||||
|
||||
device_info_failure:
|
||||
@@ -941,6 +944,9 @@ static int icnss_driver_event_server_exit(struct icnss_priv *priv)
|
||||
|
||||
icnss_clear_server(priv);
|
||||
|
||||
if (priv->psf_supported)
|
||||
priv->last_updated_voltage = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -3802,6 +3808,13 @@ static int icnss_resource_parse(struct icnss_priv *priv)
|
||||
goto put_vreg;
|
||||
}
|
||||
|
||||
if (of_property_read_bool(pdev->dev.of_node, "qcom,psf-supported")) {
|
||||
ret = icnss_get_psf_info(priv);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
priv->psf_supported = true;
|
||||
}
|
||||
|
||||
if (priv->device_id == ADRASTEA_DEVICE_ID) {
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||
"membase");
|
||||
@@ -4339,6 +4352,18 @@ void icnss_destroy_ramdump_device(struct icnss_ramdump_info *ramdump_info)
|
||||
kfree(ramdump_info);
|
||||
}
|
||||
|
||||
static void icnss_unregister_power_supply_notifier(struct icnss_priv *priv)
|
||||
{
|
||||
if (priv->batt_psy)
|
||||
power_supply_put(penv->batt_psy);
|
||||
|
||||
if (priv->psf_supported) {
|
||||
flush_workqueue(priv->soc_update_wq);
|
||||
destroy_workqueue(priv->soc_update_wq);
|
||||
power_supply_unreg_notifier(&priv->psf_nb);
|
||||
}
|
||||
}
|
||||
|
||||
static int icnss_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct icnss_priv *priv = dev_get_drvdata(&pdev->dev);
|
||||
@@ -4349,6 +4374,8 @@ static int icnss_remove(struct platform_device *pdev)
|
||||
|
||||
icnss_debugfs_destroy(priv);
|
||||
|
||||
icnss_unregister_power_supply_notifier(penv);
|
||||
|
||||
icnss_sysfs_destroy(priv);
|
||||
|
||||
complete_all(&priv->unblock_shutdown);
|
||||
|
在新工单中引用
屏蔽一个用户