Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp2048457lqg; Mon, 4 Mar 2024 11:09:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVeudOhUjRpTwoWsQC5X3D/jHaF9dvF64mHdokZ3RskjJVlp2u9X7redFmkHAzIMg7HJl3Cc967jRTmv1GBkPRkkfK9JdYat6p0XptUuA== X-Google-Smtp-Source: AGHT+IHVhG8xpqobsvhC1Z31Ew8fe5qPIhJUKNcAinunNHek425Ax0AcBOnWJYDn1vyvJ1G3zJRM X-Received: by 2002:a17:902:e805:b0:1db:d2f7:68a4 with SMTP id u5-20020a170902e80500b001dbd2f768a4mr10699436plg.24.1709579341209; Mon, 04 Mar 2024 11:09:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709579341; cv=pass; d=google.com; s=arc-20160816; b=HB50h/d5AK050EekgW9oySIwFqmswqEaPw+dr6kGM+ACzmbLXQn/N/FLlFl3cDDLEc JS9lDFsA3+6JFDG7XyBOXRNjHgEUrDfZPKXMfeCrvcxk1pUC7aUI/BVHTJzZ0NjVKxJI t78JkQHe1oEOfVZyo0opJve46ydr9WeEK//c5f/42nl8jxtWyPD0vY4FvY2XdonFDcuQ MaiQEFuHJICjyUP1Lt688fvct83PvlI69pIBAR+PBhhBARzyaW5gQbpRFSUl09CRE2w/ CQvSV1pdYlXwwFqFdaVo4kmEcZbBh/oQlZyRm16cYvaghPfFVWAngiQFLY9YBxk6VZh3 dmCA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:date:from:dkim-signature; bh=Yg8xEMBWIK3KAwZ8WBuzzba30QNUj6pIsKl/SjToOww=; fh=FSWjCwZswSO0HR0QdGU1EEMiZE04OxaMSSGzKGYld9o=; b=WLs+4xBNc5Ly7/yh625D4N7KIPOpuh/dz/LQViX4qJmcfkNlWyl01X123q57RxKkX+ GhRpmTpuiUwlqY8V2biLpcppQ681p5lLhGo0s9IgScfwAxjOTY6mkQAR31GnZm1i+nnO LYbEjteCvUteuDYDw0SJHALCdKlZ5cCVHyRkdVtW7+H947gc830wwFiP7bgz8SAo0ZlV RS5TVy9iYsXD6vkrLD+JrpVzPWG7vgyfGu9qPEiTtWL1JxNkcnvk3DtLd2bO34ON+NbO WPqGU/MAdBRiLJkIvtQc+lNgTzRLXL3rPL+LukrWqj+TrwPgApppHJLiKpQ09eCUvQTD QhFA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aG4JkGbA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l10-20020a17090270ca00b001dc19ea471dsi8456504plt.183.2024.03.04.11.09.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 11:09:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=aG4JkGbA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-91147-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91147-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F0EC8281256 for ; Mon, 4 Mar 2024 19:08:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C354778B50; Mon, 4 Mar 2024 19:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aG4JkGbA" Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4801278B5C; Mon, 4 Mar 2024 19:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709579325; cv=none; b=g43CfGhYiEWV6DI64wHexy2hGGSt2VIH/egBsoHfuf1ObDsL6gbXPII4HTzVYVW/zF/DwxzWrJRLqR4IWsJ8+eBZjt+XGSZIYv188gPYrCoLY0Se+2uIJZArxv1s40K2YAHPjmKr0/TquGRNtcjbBHpGC7pXl5in06Gt7+oBkMM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709579325; c=relaxed/simple; bh=acNWKsK8v0Hl0gWc0y1JCgujLyd6CVhwRPtUiZdy3rI=; h=From:Date:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NKL0pRfixEpPSUwnnLmSsINrCOnAjd+OhsKUgRplQbY7GuH9OKzaM37ZUyjqGFRzaujMrxor1yROSAxU31kT4tiQuGhcpnaER8h1RqUftn/edCE8AhW/H/4yGZt+GYnKD+HKE1HGyfgXyW7f7DEfXAkFjT3ijznT3RQi2UwhxfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aG4JkGbA; arc=none smtp.client-ip=209.85.208.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d21cdbc85bso59197381fa.2; Mon, 04 Mar 2024 11:08:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709579321; x=1710184121; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:from:to:cc:subject:date:message-id:reply-to; bh=Yg8xEMBWIK3KAwZ8WBuzzba30QNUj6pIsKl/SjToOww=; b=aG4JkGbAqMAVLoALaIXHjfO7CRUsw9Jf56AJNwx9+it1Yrff6ZF0BFjpjzM2tScGDN VN2PE1u2y5Seexwf3VgrTQXHtJa5SWVhjF9JmGzavlC5tvjyn/E0DUhLY01u7k3WeRgH Y2DVdTZqdicqzkjOY1wRa30lsZhVTYG2GT2n5z//FA+hw6V7a2EErseF4KwGGVAIb+Xf lmyf46FIflxkiQquw9ORrj90LV8vKf5SrLkSbcmdkEe1ah0N1HUn0DgM8TXCg3UM/GnV Xfm0LKKELtM5ssETeQr8UzrUsDDyZprpEMYbKuOmR+8Ru2oTFIn5YMcWviubyM+QvV1m Msqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709579321; x=1710184121; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:date:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Yg8xEMBWIK3KAwZ8WBuzzba30QNUj6pIsKl/SjToOww=; b=ertZIhxj+U9GMANL4aFECII0rqzgHBmYk15UuI+YJqcj+WhmAJ12r/brKNfMndHfhv boLPOiv8mPeHEa6LFw9Ml1IxtpKq3N5LKv+a+KhQc1vP/KuBYTp7k0x5a7A38SewOLq9 CGuza3td1Ljq0refCf5FOY2r/2ywNKua25Y6GRlrGZ9algUowtoxMEv8Yk3H39pFKX44 9UuTLEBuA74bgfIfDspn4GfjVeSaHZTxmiF+ba90BSN8UPQqFJHHq07w3JwFIr1wWEKO HoOoDQMsp8x8W87guG+YGAJLEITbIZW1K642AABatUWe85KHI1n0fhbTM0dlh4w2XyDe vG+Q== X-Forwarded-Encrypted: i=1; AJvYcCWcd0a3IEq8A65iqPBvCbow+iRUWtOaGESAjW5BP4NiP0BM4yeYPW4RWgaN0iw6LkMyD/xxLNZqO5rRhFfOY/Lc8wkLAyUHF+4EHGd7sATlc4rZbaKBVWRE8XCm6Nzb/OiCG30jX5p9 X-Gm-Message-State: AOJu0YzG6wNiyen3Eg+rPzakiCM5pUyys9jMOimi/+VTek7rTWMSiXiD yBJlS9bwSOZm05BzV4fx103YrWaq6ijWDcRVnub+04rPFEvphUwF X-Received: by 2002:a2e:99d8:0:b0:2d0:f258:df02 with SMTP id l24-20020a2e99d8000000b002d0f258df02mr6571600ljj.51.1709579321170; Mon, 04 Mar 2024 11:08:41 -0800 (PST) Received: from vamoiridPC ([2a04:ee41:82:7577:d458:fb5d:c4e5:fb19]) by smtp.gmail.com with ESMTPSA id p17-20020a056402075100b005662f95fa6dsm4917583edy.89.2024.03.04.11.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 11:08:40 -0800 (PST) From: Vasileios Amoiridis X-Google-Original-From: Vasileios Amoiridis Date: Mon, 4 Mar 2024 20:08:38 +0100 To: Andy Shevchenko Cc: Vasileios Amoiridis , jic23@kernel.org, lars@metafoo.de, ang.iglesiasg@gmail.com, mazziesaccount@gmail.com, ak@it-klinger.de, petre.rodan@subdimension.ro, phil@raspberrypi.com, 579lpy@gmail.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] iio: pressure: Add triggered buffer support for BMP280 driver Message-ID: <20240304190838.GA4431@vamoiridPC> References: <20240303165300.468011-1-vassilisamir@gmail.com> <20240303165300.468011-5-vassilisamir@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Mar 04, 2024 at 01:52:05PM +0200, Andy Shevchenko wrote: > On Sun, Mar 03, 2024 at 05:53:00PM +0100, Vasileios Amoiridis wrote: > > Add a buffer struct that will hold the values of the measurements > > and will be pushed to userspace. Modify all read_* functions in order > > to just read and compensate the data without though converting to the > > required IIO measurement units which are used for the oneshot captures. > > > +#include > > #include > > #include > > +#include > > +#include > > +#include > > Yes, taking into account the comment against patch 1, this will become the part > of iio/* group. > > ... > > > + /* val might be NULL if we're called by the buffer handler */ > > + if (val) { > > + *val = comp_press; > > + /* Compensated pressure is in cPa (centipascals) */ > > + *val2 = 100000; > > Here and everywhere else where it makes sense > > *val2 = CENTI * 1000; // (What is 1000 here?) > > from units.h? > I didn't change these values, the addition here is that I put them under an if statement that checks if we were called by the buffer handler or by the oneshot capture read_raw function. The point is that every sensor provides values that need different scaling in order to have the IIO standard measurement units. In the above code I guess since 1kPa=100000cPa that's why *val2=100000. The *val and *val2 values could be moved to the read_raw function as it will already happen for the IIO_CHAN_INFO_SCALE values from chip_info arrays as you proposed in Patch No.2. This would require though that all the functions like this one you commented would need to change. Is that something that you think as better? > > + return IIO_VAL_FRACTIONAL; > > + } > > ... > > > + struct { > > + s32 temperature; > > + u32 pressure; > > + u32 humidity; > > > + s64 timestamp; > > Shouldn't this be aligned properly? > I saw that in some drivers it was added and in some it was not. What is the difference of aligning just the timestamp of the kernel? > > + } iio_buffer; > > -- > With Best Regards, > Andy Shevchenko > >