From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (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 682B01C07F1 for ; Mon, 23 Dec 2024 16:33:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734971624; cv=none; b=jOF7bjM26/ZcAtUBmaiAf8oT0sqhqLE/3Jrv+mBKm+GrOACXv2zlXgTpjHm51hlNUavZpv46Ae6j0RBXQDeHK9WPIqUjqFbFHXFVb74AFdYBa0BesjJ7y7IdpTEzIGm11O2+xLy3nDeCX5KXV85ILRtM19dnTusOxAObCxStZZw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734971624; c=relaxed/simple; bh=gHp/getcUO7eTngzfX1tPLqe+VFz1jDhuvKQASC1t48=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=O4EF1P890FQ6beZEgGrHCMghy+GI2FmuFQaCQ0esmx3UxzHpXJbkdqrXEHOrCMW3u4PLTPuqVD9yjhXA+H6T2l0MUgBVIL7e2Ih04a5OX4E8y9zM925ZKprqAGYYOEo89yP8ceWv0R/ICLtnbQKI0Qiblk1rCFyI8aN2AWdmH+g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=fxU3Hqaq; arc=none smtp.client-ip=209.85.160.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="fxU3Hqaq" Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-46741855f9bso37576501cf.2 for ; Mon, 23 Dec 2024 08:33:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1734971619; x=1735576419; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=/SA0lbMvAXbipK9BrrMsVmdVVOF+CvMmuegNIZAWTAw=; b=fxU3HqaqpJnh2CSOiIrhWoEbcZ0VH3juVGwQf6Blqpo8iqujjJY3INZXqHSXwrS9z/ f9vfmlDsKdB7f9qbsiYtye5V0TNP201gJqSisXlDXMto44xAgMhDCD4vcH/aYrDe58Fn np3hZPnzpJCn85+bmgBbWZGDEhFBqQREgpBAg4WpQHaZymhEbg14LVvzcu8WQlDPMe7d WWGTnFchWZdvNbkenSX6u1IuugwkFczu9vWcPx9IMDLCXplOdKjlhB62Ut92+JPakGAt 3A+5ZbgGN99eOFJo2tFoIU0s/xb/3QZ2GPS3SZz6AzLadq8ALKGt78pqapujaFS5pGX3 63LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734971619; x=1735576419; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=/SA0lbMvAXbipK9BrrMsVmdVVOF+CvMmuegNIZAWTAw=; b=stLwhH2E9ZCQ/Qt5kNmlvjMQHg5xcUow+4G6WETfAxmnVC+QRfA0iXvh1Cbz2f5V/A l+lImQRqNsm2VlcAvhzHRNOL+K0Yl1JITXGrrZD/U3LGJpPqT/qc3q6p1uX1yND2qm/m 88hYT81lnCfhwdgmOfFlYBE+ncCTj5SCXv9l2iwaR67EfQF4bzuo6WvTB1+uYs8rMcBx vUNC1LizKG0gw56PZDq6nc0ytHXdswOKgIPNqEmCGS5Guv/2hf9l/b8HlxGfr3ehzwF2 TVdK5EkVKTIPt41lHDQPHL7X4vU2zPfqIKpHG7GmlUIyJKwUgrP8u27I828XajUfpRpk P37w== X-Forwarded-Encrypted: i=1; AJvYcCWeNNFd2BtpHfZ7WbPQA5BrBpI0cB8dNk9eTPwmsBOxSPRb/9D5Scb+GRabXfan/c1jw+ClkmicRWwjMO4=@vger.kernel.org X-Gm-Message-State: AOJu0YydHjgdtNDQ9t/e7224KIy7i00cmgwiGv7TR0ERDOwAmhhdWh5F pyECDz8vdmG11IvImkLT7j03uqrYPn74KjaxCOmdjaCN0JP/1KFDTX1OLX2YM+0= X-Gm-Gg: ASbGnctXLUNzVmp7LSlfPTyP73WQwnXhbo72hIPhTHn47jUn14o+S71ZtR0jLsOTc3U Z+w1vcdHJG5jLAHK9ZQn3p7TgQ7Jqkm5UXEP4VRRb5R3bbvTf5NXSBuuPyh+fGDAuSKZHHP7EKm a3Gup9clZ4GZLV/q0dvcVCYV6N041By+2nAdRQWTYwlilZYVrOaO7KyXeJSNUfk8Lw8rQHkeF68 5glr7csiNL36czcHJ3w4XskkqXKol6Rn8eyYlK2oOrNaxuk/IPfK1m7aGcCgpMYxS9+sqsT0nhQ 2tdzqqURuSdxiOq5HqgJ192d X-Google-Smtp-Source: AGHT+IEpUycPZNs5cOOouNZJTjwM+ffbSpYr89ZBbzgPq6xyt3OVF9nnjxtO1B7bzyodulThYgS8QA== X-Received: by 2002:ac8:5a51:0:b0:467:b649:6a44 with SMTP id d75a77b69052e-46a4a970385mr208293661cf.40.1734971619282; Mon, 23 Dec 2024 08:33:39 -0800 (PST) Received: from [192.168.40.12] (d24-150-219-207.home.cgocable.net. [24.150.219.207]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-46a3eb17a2dsm45116571cf.59.2024.12.23.08.33.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Dec 2024 08:33:38 -0800 (PST) Message-ID: Date: Mon, 23 Dec 2024 11:33:37 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] iio: adc: ad4695: add offload-based oversampling support To: Jonathan Cameron Cc: Michael Hennerich , =?UTF-8?Q?Nuno_S=C3=A1?= , David Lechner , Lars-Peter Clausen , Jonathan Corbet , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org References: <20241217-ad4695-oversampling-v1-0-0b045d835dac@baylibre.com> <20241217-ad4695-oversampling-v1-1-0b045d835dac@baylibre.com> <20241219161301.3f708302@jic23-huawei> Content-Language: en-US From: Trevor Gamblin In-Reply-To: <20241219161301.3f708302@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-12-19 11:13, Jonathan Cameron wrote: > On Tue, 17 Dec 2024 16:47:28 -0500 > Trevor Gamblin wrote: > >> Add support for the ad4695's oversampling feature when SPI offload is >> available. This allows the ad4695 to set oversampling ratios on a >> per-channel basis, raising the effective-number-of-bits from 16 >> (OSR == 1) to 17 (4), 18 (16), or 19 (64) for a given sample (i.e. one >> full cycle through the auto-sequencer). The logic for reading and >> writing sampling frequency for a given channel is also adjusted based on >> the current oversampling ratio. >> >> The non-offload case isn't supported as there isn't a good way to >> trigger the CNV pin in this mode. Support could be added in the future >> if a use-case arises. >> >> Signed-off-by: Trevor Gamblin > Hi Trevor, > > The clamping fun of get_calibbias seems overkill. If this isn't going to ever > overflow an s64 maybe just use the high precision to do it the easy way. > I'm not sure you can't just fit it in an s32 for that matter. I've just > not done the maths to check. Hi Jonathan, Thanks for your feedback. I'll look it over again, do some testing, and see if it can be simplified. Trevor