From patchwork Mon May 28 15:38:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Duszynski X-Patchwork-Id: 10433439 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 B769B602CB for ; Mon, 28 May 2018 15:41:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A79A828AE1 for ; Mon, 28 May 2018 15:41:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C30428AF7; Mon, 28 May 2018 15:41:28 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, 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 39D3E28AE1 for ; Mon, 28 May 2018 15:41:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030737AbeE1Pl0 (ORCPT ); Mon, 28 May 2018 11:41:26 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:35825 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030356AbeE1PlW (ORCPT ); Mon, 28 May 2018 11:41:22 -0400 Received: by mail-wm0-f65.google.com with SMTP id o78-v6so33235707wmg.0 for ; Mon, 28 May 2018 08:41:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=m7jYUdkssysg8e2SspUDQ54088UxccLFfpZ2WUflrzY=; b=VTu4dN+ozxQ7K6imU5icSdPqYWId+EHdmuaEneMOviqkWikagdWvOd/7WzrVtYvUz6 ZYn6sN4h9hediwEQltcs4TrRdxrApW9AZ+UYWmu8UpMhXL85NVvtWQpTT7Oa3rXWGsoO tZk5MrRmLRVE6TewUXR0H7Zw79OrG3UhAjHBkYMzG3PaF+iNskMfFSGdtaLxNqWIK9cj g11vw/7wcHkes/peD48tLqvC9F+AZkDwNDlsmRB7SzBSLrlzPxCTzG/ommnqFYh6CR2P wzYc626agmbFBhvVZU+EByCjFPcxhppPo663gKTWlSdUaLup9T5WXShXFZIUVOhZH+2a LFPQ== 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; bh=m7jYUdkssysg8e2SspUDQ54088UxccLFfpZ2WUflrzY=; b=iZyLSnFJkOcPptdb9haH01z2zkA1Ms6O53EjurKY0m0KeXFLgjFaR6M7/jiGB+0TkG IS8S+NX0guJDdNyFEs9zZJualOji07SicwvJzMWhYzCrZa4zGHRWK4mol8num07SwJiB 8sdKofrZ2/0eUPDhtgUyhZBEvBHayM33s6VRnznfCpc+SiXygsMbrTjmMxhRYEgL1KFt zZXg1bfG8ZtH4aeSK/FBmo4s+4ycdQRAP3jZIBYAalTqIV4qmLmtv+S100DaLUbHoWUZ M4XmgyvdDk7UutphisUOjeaeGXhjgWBdPojsnvmbBzP95OmPYJ0+bGFqmy1+kGbqavI/ gtFg== X-Gm-Message-State: ALKqPwfUCv1CIongrFSjAOB9ze9zAHpdOC312zfof4LQJYE2ijgzAUnZ hvzQ5urgN5tzdXYMfHPcHh9OjXgf X-Google-Smtp-Source: AB8JxZpNzw0w5ejhtkt+lIOmK4QWtyyih0kOp7gyPTnODU0iK34w02Jlm+xps549AyMbgLLDDCy+1g== X-Received: by 2002:a2e:6808:: with SMTP id c8-v6mr8574534lja.109.1527522080876; Mon, 28 May 2018 08:41:20 -0700 (PDT) Received: from localhost (89-70-31-6.dynamic.chello.pl. [89.70.31.6]) by smtp.gmail.com with ESMTPSA id t133-v6sm6941757lfe.60.2018.05.28.08.41.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 May 2018 08:41:20 -0700 (PDT) From: Tomasz Duszynski To: linux-iio@vger.kernel.org Cc: jic23@kernel.org, linus.walleij@linaro.org Subject: [PATCH] iio: pressure: bmp280: fix relative humidity unit Date: Mon, 28 May 2018 17:38:59 +0200 Message-Id: <20180528153859.813-1-tduszyns@gmail.com> X-Mailer: git-send-email 2.17.0 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 According to IIO ABI relative humidity reading should be returned in milli percent. This patch addresses that by applying proper scaling and returning integer instead of fractional format type specifier. Signed-off-by: Tomasz Duszynski Acked-by: Matt Ranostay --- drivers/iio/pressure/bmp280-core.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 5ec3e41b65f2..fe87d27779d9 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -415,10 +415,9 @@ static int bmp280_read_humid(struct bmp280_data *data, int *val, int *val2) } comp_humidity = bmp280_compensate_humidity(data, adc_humidity); - *val = comp_humidity; - *val2 = 1024; + *val = comp_humidity * 1000 / 1024; - return IIO_VAL_FRACTIONAL; + return IIO_VAL_INT; } static int bmp280_read_raw(struct iio_dev *indio_dev,