From patchwork Mon Mar 5 07:49:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Jha X-Patchwork-Id: 10258299 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3E70760134 for ; Mon, 5 Mar 2018 07:51:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E7C32896B for ; Mon, 5 Mar 2018 07:51:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 22F302896E; Mon, 5 Mar 2018 07:51:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C77262896B for ; Mon, 5 Mar 2018 07:51:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933116AbeCEHvC (ORCPT ); Mon, 5 Mar 2018 02:51:02 -0500 Received: from mail-pl0-f66.google.com ([209.85.160.66]:37021 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933265AbeCEHuf (ORCPT ); Mon, 5 Mar 2018 02:50:35 -0500 Received: by mail-pl0-f66.google.com with SMTP id ay8-v6so9206991plb.4; Sun, 04 Mar 2018 23:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GfEBVCWROtg+yx+pvIIOL4hE6sDHe1ZCYS+TfwUB0wk=; b=om+5mHN7pueXeHQjsOFqa1S+ExOPl1aX13xYPyvv2OFlZX4Hob+n78VBJ13vt62ize G9beSY8Nb+3fXs3tadWzanibderg7Cqg5NR+zjbV2Fhg19a4sw9b7IMQ6Koha2fs4SJn qLRA9qc5kpenMz8o4krlmuHU4v5N50IwYVM/fFr7gwf8vupslbGZto5xYRZvkLOx7TIX MZjvZGnBPdgEa1rNDrp4Tw67MfelhahFJqhYrZv2sVGh0cO8SoiCzAWH63fripf95NHU RN/3nTLDJ4yuzv9UvPPp/bSSOOe6bGfsYl90VwINZeEqd63Eh6oRnwzEbgDlHrmsKHjm cqUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GfEBVCWROtg+yx+pvIIOL4hE6sDHe1ZCYS+TfwUB0wk=; b=rJqicrD1FtLJb4liGfKI6La/m4m+NqmEuhkl9R5AtRUYwDolWQcix+uuDTeejcFOoc HgbKJHGJrlY7uTd2PXYKO5Kd2QREFP/S5RejgN+a74BC3lGCtsCkU+8XN7OdW4XNIEdj w0aTPgJ48ETuVpazZhEOz87ZBFQGroBQQJ9B/F/4feQgJLvFTzOpgWVWvuL/oHb9tTT4 ViH9+miSskqB/botk8RzFgIeZBu/tdez9iiCwSI6nWE8LifaSFOYi+ZXNe6/o45fe7UJ +CgQCYTBssYgDOqD8L0q8Pz3yPGW+INEYB857/WAj0UZG6u10mjxkqGHQ44R9ofGiIA+ fbXA== X-Gm-Message-State: APf1xPBDl9ttIs/a6WaABpJoXLItSvUdtTZSZZnWxf57ndgIkCfQMPVe BMU5wK60U8QhZk3oUd7ZNxQ= X-Google-Smtp-Source: AG47ELtBwnLmhbf077KZKA28AuIaWE/c+DjrARyPerS3esSkDfH/EQ93W+SAFLe/TkZ3RdN6j/ZyTA== X-Received: by 2002:a17:902:225:: with SMTP id 34-v6mr12358916plc.415.1520236235383; Sun, 04 Mar 2018 23:50:35 -0800 (PST) Received: from localhost.localdomain ([103.46.193.14]) by smtp.gmail.com with ESMTPSA id 125sm21674256pff.114.2018.03.04.23.50.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 04 Mar 2018 23:50:34 -0800 (PST) From: Himanshu Jha To: jic23@kernel.org Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, linux-iio@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, daniel.baluta@gmail.com, Himanshu Jha Subject: [PATCH 10/11] Staging: iio: accel: Add comments about units in data read function Date: Mon, 5 Mar 2018 13:19:29 +0530 Message-Id: <1520236170-14668-11-git-send-email-himanshujha199640@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> References: <1520236170-14668-1-git-send-email-himanshujha199640@gmail.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Clarify the conversion and formation of resultant data in the adis16201_read_raw() with sufficient comments. Signed-off-by: Himanshu Jha --- drivers/staging/iio/accel/adis16201.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/iio/accel/adis16201.c b/drivers/staging/iio/accel/adis16201.c index 8d795e2..946c7b1 100644 --- a/drivers/staging/iio/accel/adis16201.c +++ b/drivers/staging/iio/accel/adis16201.c @@ -130,6 +130,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, *val2 = 0; return IIO_VAL_INT_PLUS_MICRO; case IIO_ACCEL: + /* + * IIO base unit for sensitivity of accelerometer + * is milli g. + * 1 LSB represents 0.244 mg. + */ *val = 0; *val2 = IIO_G_TO_M_S_2(462400); return IIO_VAL_INT_PLUS_NANO; @@ -142,6 +147,11 @@ static int adis16201_read_raw(struct iio_dev *indio_dev, } break; case IIO_CHAN_INFO_OFFSET: + /* + * The raw ADC value is 0x4FE when the temperature + * is 25 degrees and the scale factor per milli + * degree celcius is -470. + */ *val = 25000 / -470 - 1278; return IIO_VAL_INT; case IIO_CHAN_INFO_CALIBBIAS: