From patchwork Wed Aug 21 07:53:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Klinger X-Patchwork-Id: 13771023 Received: from www571.your-server.de (www571.your-server.de [78.46.3.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9D5A1CF2BA; Wed, 21 Aug 2024 08:31:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.46.3.230 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724229120; cv=none; b=lTaKZYd93g/myqwOJ+nV+0YDBNPlwEkPehGbZ91750bJaRQLVqeSoh13WDi2f24R4HrUmhYQnGl00ccGHT1p33/lO8hdrtQh4tVE52TcIZOhmE/t7/D+ywu/YRiuvBMWCmZ1GwuZx8rnrd4iE7oZzYZ2QKaSiIKefEYD8eMahGU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724229120; c=relaxed/simple; bh=xrgOSU3+b3RWFVrBSCyrFAwO5C988wPDl/GjFT50as0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=OGHBNZx04IjvfrpwEUDlzT9LZE94ZgfxPA10qn1jIFce721mMC/DycW6vZ22Hon9APeBLvJVEyoHgrCknwjsH7Ls9XbpejNLzhI2zY0HZLF1kxLVq2n1OxwZ9Hsn6RaHUq60rr7iOoYiXSuVdeuToJLf07cuofUcHAsn1qGiZs0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=it-klinger.de; spf=pass smtp.mailfrom=it-klinger.de; arc=none smtp.client-ip=78.46.3.230 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=it-klinger.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=it-klinger.de Received: from sslproxy03.your-server.de ([88.198.220.132]) by www571.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1sggAH-000Hka-2y; Wed, 21 Aug 2024 09:53:58 +0200 Received: from [31.220.116.25] (helo=mail.your-server.de) by sslproxy03.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sggAH-0006xC-1A; Wed, 21 Aug 2024 09:53:57 +0200 Date: Wed, 21 Aug 2024 09:53:56 +0200 From: Andreas Klinger To: Jonathan Cameron , David Lechner Cc: Stephen Rothwell , Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Andreas Klinger Subject: [PATCH] iio: sgp40: retain documentation in driver Message-ID: Precedence: bulk X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-Authenticated-Sender: ak@it-klinger.de X-Virus-Scanned: Clear (ClamAV 1.0.5/27373/Tue Aug 20 10:46:09 2024) Retain documentation on how the voc index is actually calculated in driver code as it'll be removed in Documentation. This is a follow up on patch "[PATCH] iio: ABI: remove duplicate in_resistance_calibbias" from David. Signed-off-by: Andreas Klinger --- drivers/iio/chemical/sgp40.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/iio/chemical/sgp40.c b/drivers/iio/chemical/sgp40.c index 7f0de14a1956..07d8ab830211 100644 --- a/drivers/iio/chemical/sgp40.c +++ b/drivers/iio/chemical/sgp40.c @@ -14,11 +14,16 @@ * 1) read raw logarithmic resistance value from sensor * --> useful to pass it to the algorithm of the sensor vendor for * measuring deteriorations and improvements of air quality. + * It can be read from the attribute in_resistance_raw. * - * 2) calculate an estimated absolute voc index (0 - 500 index points) for - * measuring the air quality. + * 2) calculate an estimated absolute voc index (in_concentration_input) + * with 0 - 500 index points) for measuring the air quality. * For this purpose the value of the resistance for which the voc index - * will be 250 can be set up using calibbias. + * will be 250 can be set up using in_resistance_calibbias (default 30000). + * + * The voc index is calculated as: + * x = (in_resistance_raw - in_resistance_calibbias) * 0.65 + * in_concentration_input = 500 / (1 + e^x) * * Compensation values of relative humidity and temperature can be set up * by writing to the out values of temp and humidityrelative.