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

Commit da5dc27b authored by Rama Krishna Phani A's avatar Rama Krishna Phani A
Browse files

hwmon: qpnp-adc-tm: Add version check for VADC_TM channel



vph_pwr channel should be supported for VADC_TM for pm8950 2.0.
Add version check to detect the PMIC used and support channel
accordingly.

Change-Id: I1e0a0a269e9e0f164150766a5dabaf51791b21cc
Signed-off-by: default avatarRama Krishna Phani A <rphani@codeaurora.org>
parent f1af45a9
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -2019,7 +2019,7 @@ int32_t qpnp_adc_tm_channel_measure(struct qpnp_adc_tm_chip *chip,
					struct qpnp_adc_tm_btm_param *param)
{
	uint32_t channel, dt_index = 0, scale_type = 0;
	int rc = 0, i = 0;
	int rc = 0, i = 0, version = 0;
	bool chan_found = false;

	if (qpnp_adc_tm_is_valid(chip)) {
@@ -2035,6 +2035,16 @@ int32_t qpnp_adc_tm_channel_measure(struct qpnp_adc_tm_chip *chip,
	mutex_lock(&chip->adc->adc_lock);

	channel = param->channel;

	if (channel == VSYS) {
		version = qpnp_adc_get_revid_version(chip->dev);
		if (version == QPNP_REV_ID_PM8950_1_0) {
			pr_debug("Channel not supported\n");
			rc = -EINVAL;
			goto fail_unlock;
		}
	}

	while (i < chip->max_channels_available) {
		if (chip->adc->adc_channels[i].channel_num ==
							channel) {