Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bc77136 authored by Vatsal Bucha's avatar Vatsal Bucha
Browse files

ASoC: rouleur: Reduce PA Gain for low state of charge based on dt node



Configure low PA Gain for low state of charge based on dt node.

Change-Id: I7f36cf4b17d9794a2763edc3c2fd5cec53a3521f
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent be8dfac3
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -108,6 +108,7 @@ struct rouleur_pdata {
	int num_supplies;
	int num_supplies;
	int reset_reg;
	int reset_reg;
	int foundry_id_reg;
	int foundry_id_reg;
	u32 soc_threshold_val;
};
};


struct wcd_ctrl_platform_data {
struct wcd_ctrl_platform_data {
+19 −9
Original line number Original line Diff line number Diff line
@@ -2087,7 +2087,7 @@ static void rouleur_evaluate_soc(struct work_struct *work)
		return;
		return;
	}
	}


	if (soc_val < SOC_THRESHOLD_LEVEL) {
	if (soc_val < pdata->soc_threshold_val) {
		dev_dbg(rouleur->dev,
		dev_dbg(rouleur->dev,
			"%s battery SoC less than threshold soc_val = %d\n",
			"%s battery SoC less than threshold soc_val = %d\n",
			__func__, soc_val);
			__func__, soc_val);
@@ -2224,14 +2224,6 @@ static int rouleur_soc_codec_probe(struct snd_soc_component *component)
	}
	}
	rouleur->low_soc = false;
	rouleur->low_soc = false;
	rouleur->dev_up = true;
	rouleur->dev_up = true;
	/* Register notifier to change gain based on state of charge */
	INIT_WORK(&rouleur->soc_eval_work, rouleur_evaluate_soc);
	rouleur->psy_nb.notifier_call = rouleur_battery_supply_cb;
	if (power_supply_reg_notifier(&rouleur->psy_nb) < 0)
		dev_dbg(rouleur->dev,
			"%s: could not register pwr supply notifier\n",
			__func__);
	queue_work(system_freezable_wq, &rouleur->soc_eval_work);
done:
done:
	return ret;
	return ret;
}
}
@@ -2471,6 +2463,16 @@ struct rouleur_pdata *rouleur_populate_dt_data(struct device *dev)
	else
	else
		pdata->foundry_id_reg = reg;
		pdata->foundry_id_reg = reg;


	if (of_property_read_u32(dev->of_node, "qcom,soc-threshold-voltage"
	    , &reg)) {
		dev_dbg(dev, "%s: Looking up %s property in node %s failed\n",
			__func__, "qcom,soc-threshold-voltage",
			dev->of_node->full_name);
		pdata->soc_threshold_val = SOC_THRESHOLD_LEVEL;
	} else {
		pdata->soc_threshold_val = reg;
	}

	/* Parse power supplies */
	/* Parse power supplies */
	msm_cdc_get_power_supplies(dev, &pdata->regulator,
	msm_cdc_get_power_supplies(dev, &pdata->regulator,
				   &pdata->num_supplies);
				   &pdata->num_supplies);
@@ -2688,6 +2690,14 @@ static int rouleur_bind(struct device *dev)
		goto err_irq;
		goto err_irq;
	}
	}


	/* Register notifier to change gain based on state of charge */
	INIT_WORK(&rouleur->soc_eval_work, rouleur_evaluate_soc);
	rouleur->psy_nb.notifier_call = rouleur_battery_supply_cb;
	if (power_supply_reg_notifier(&rouleur->psy_nb) < 0)
		dev_dbg(rouleur->dev,
			"%s: could not register pwr supply notifier\n",
			__func__);
	queue_work(system_freezable_wq, &rouleur->soc_eval_work);
	return ret;
	return ret;
err_irq:
err_irq:
	wcd_irq_exit(&rouleur->irq_info, rouleur->virq);
	wcd_irq_exit(&rouleur->irq_info, rouleur->virq);