From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-oa1-f54.google.com (mail-oa1-f54.google.com [209.85.160.54]) (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 E17D91AF0AA for ; Tue, 15 Oct 2024 14:38:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729003113; cv=none; b=q6Eo1aNxVQKgoxOgOa4LKJyeC62CfbRx3b1KYS7VRoFKUYVDHdfWlzQOVecVB6aHS3q7ojJ411g+OpSN9GnIQuXl8HxF3X7bS1PNYaYrtV9PuG5e8PkGsr06dJF+9yM0dG9aD20iwJoEQnoMfoHwDX3ZCMPgJSwgeiTay2YHJQI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729003113; c=relaxed/simple; bh=bGe7uxhpHxu3eQgZOBMZ7RzPKw8tYLJ/1ZxNYAJpONU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MDeydTSJSvECD7PovpbHmWDyRrVFXXLxFKVtdKmiPhpX+kXYXrVctr04fUY94lmBirTnUKfoiUSXpCzbPUf78M62MJPmNBatc/Jl0AGfnBAESfGROPa/L55mhir1G3QD4su7htwtXYMoDuCTZw25TBk2/uf8Lpl/bZm2uce869A= 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=kcl1rTj4; arc=none smtp.client-ip=209.85.160.54 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="kcl1rTj4" Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-2888165800fso1838165fac.3 for ; Tue, 15 Oct 2024 07:38:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1729003110; x=1729607910; 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=5hi7zBVgndnwQX01Ty7toic/X9giPub3nHqkgUw6waY=; b=kcl1rTj42Lf8UGTs41fBak5rW/mxBOstjXlyPR1nB41+kGRlpU6uYQldP2kOPrb7r9 f/ImFCpACHkdFw3rv8wm3+qhy/Vio1HF4EfOObzVNQyqedhFNmnzBEJwFgLPEkPb95/Y Hdtrd5ztv3tV/lr1Sha+ccoZIxVbPpjDX1nsvCtfV9Xd2etW5IsxEX203aurunCyrBOL DeB5oWscSPD3iepbmxGD8EUpK2mJaa1O1c/IeWVWHEjbVvdLMnxMkHJ18fWMNwdQ01BR lF6X6L6bbZFaitUbqb3a2pcwMMTQjTuuaOPuTM+8NL/Mq82MjzrX96qKalBluGGdZv9/ vIAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729003110; x=1729607910; 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=5hi7zBVgndnwQX01Ty7toic/X9giPub3nHqkgUw6waY=; b=VrmCNN5hww6BRAdH/T5jMPgaFf2jPiTD/avE/E9/xUiayRFGFZuC6JOuMufOydICNP wtfTIM02MuQh1EHzqxH6E4sqLgSHDehSO7n3aYdmEw1KekyyilQ/FrBD5+uqKRmEn+4q QD5UJw+Yye8RIv3en7lOo93ybO4DUzCZ/iZypuK8A6h2eo8WcWizZj58WeCRqFF7rMc1 qBvoA8q6MQYSrGbvo2Cu4m7NbocnB0m1MrKFDlqGb4snzTh4WMZsqkYBOFUz2BqxxGHJ i4WwH2kdrAVxBmsFfTRaSS/e2IvoxkYytFi01sT9XFc9XnQp/2mfkfzm7Dr6nNqUGcYs xT7g== X-Forwarded-Encrypted: i=1; AJvYcCUqV2hLm+gZxJJ5p2nCzrwU6d/JqvQEPJfCyvJ9qG01JB51ffE8aRCm0KCz0gGtzusGDBHnebcabTPl7bQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzufQxZFI1TRfaaG5QhxDVQzgytGfrKFBAnM8VV2Wm4pfPhzrm2 1NVSOaNio4iiTQU5yCxzJDSkr3+ed4xRAlV0AMXCu4QbPmvC/NtM2RvLvmhkXDY= X-Google-Smtp-Source: AGHT+IEMDvIg4Vgn+F1odN9xEZUpKQI2xdDrhvjJ0fLjwowbOOIHO+Da7a7B2ILJwx9yw0/uZSU7VA== X-Received: by 2002:a05:6871:4418:b0:277:ef62:e6a7 with SMTP id 586e51a60fabf-2886df8f33emr11046308fac.37.1729003110044; Tue, 15 Oct 2024 07:38:30 -0700 (PDT) Received: from [192.168.0.142] (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-288dae4f062sm312861fac.56.2024.10.15.07.38.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 15 Oct 2024 07:38:28 -0700 (PDT) Message-ID: <2815c8b0-e2ad-47cb-b5aa-00297cf57899@baylibre.com> Date: Tue, 15 Oct 2024 09:38:27 -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 v6 7/8] iio: dac: ad3552r: add high-speed platform driver To: =?UTF-8?Q?Nuno_S=C3=A1?= , Angelo Dureghello , =?UTF-8?Q?Nuno_S=C3=A1?= , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Olivier Moysan Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown References: <20241014-wip-bl-ad3552r-axi-v0-iio-testing-v6-0-eeef0c1e0e56@baylibre.com> <20241014-wip-bl-ad3552r-axi-v0-iio-testing-v6-7-eeef0c1e0e56@baylibre.com> <8642bdb546c6046e8fe1d20ef4c93e70c95c6f71.camel@gmail.com> Content-Language: en-US From: David Lechner In-Reply-To: <8642bdb546c6046e8fe1d20ef4c93e70c95c6f71.camel@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 10/15/24 1:37 AM, Nuno Sá wrote: > On Mon, 2024-10-14 at 16:15 -0500, David Lechner wrote: >> On 10/14/24 5:08 AM, Angelo Dureghello wrote: >>> From: Angelo Dureghello >>> >>> Add High Speed ad3552r platform driver. >>> >> >> ... >> >>> +static int ad3552r_hs_read_raw(struct iio_dev *indio_dev, >>> +        struct iio_chan_spec const *chan, >>> +        int *val, int *val2, long mask) >>> +{ >>> + struct ad3552r_hs_state *st = iio_priv(indio_dev); >>> + int ret; >>> + >>> + switch (mask) { >>> + case IIO_CHAN_INFO_SAMP_FREQ: { >>> + int sclk; >>> + >>> + ret = iio_backend_read_raw(st->back, chan, &sclk, 0, >>> +    IIO_CHAN_INFO_FREQUENCY); >> >> FWIW, this still seems like an odd way to get the stream mode SCLK >> rate from the backend to me. How does the backend know that we want >> the stream mode clock rate and not some other frequency value? > > In this case the backend has a dedicated compatible so sky is the limit :). But yeah, > I'm also not extremely happy with IIO_CHAN_INFO_FREQUENCY. But what do you have in > mind? Using the sampling frequency INFO or a dedicated OP? > It think it would be most straightforward to have something like a iio_backend_get_data_stream_clock_rate() callback since that is what we are getting. Re: the other recent discussions about getting too many callbacks. Instead of a dedicated function like this, we could make a set of generic functions: iio_backend_{g,s}et_property_{s,u}(8, 16, 32, 64}() that take an enum parameter for the property. This way, for each new property, we just have to add an enum member instead of creating a get/set callback pair. Unrelated to this particular case, but taking the idea even farther, we could also do the same with enable/disable functions. We talked before about cutting the number of callbacks in half by using a bool parameter instead of separate enable/disable callbacks. But we could cut it down even more by having an enum parameter for the thing we are enabling/disabling.