From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (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 A8C442F83A0 for ; Mon, 18 May 2026 15:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779116713; cv=none; b=R1M1F8evb+d3d4qsbFJE3m0QlQT1AhGgzTM6V0uzTDlqvcZtUgmXSZ5bD84uVL9dGg7/LMS3+xQHGVsgVhESsX9qnQsteLXW/BMwHaCUQblbZJT7g8uuYaFOz1K7Ww7kveZWSfcjNd+9KJjh2Fw/9mMxZx/emTPfdbK/SM7gG+g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779116713; c=relaxed/simple; bh=DrQFqVK7ClQwUsYNDfngLJu8LH50pdn60WsQM9mVJjk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Vl2AbEbli0+MVU0ht+H/8lGu1tSWyyk4PrZGdEyHfb2ESpFY5e+WRXGHlLNvKWdhVZkdSEaNfE7hf42dxK6smDf3drclUzGMj6EMJMQN0MZ75qbGdjo16QhSn4cvpdVeose5Pl0MZkUX0YKinXHQvuCEtd0q/KpvNJ4E4b8sI3Q= 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 header.i=@baylibre.com header.b=ouBieWJQ; arc=none smtp.client-ip=209.85.210.51 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 header.i=@baylibre.com header.b="ouBieWJQ" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-7dbec19732eso2958633a34.3 for ; Mon, 18 May 2026 08:05:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre.com; s=google; t=1779116710; x=1779721510; 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=vzeCgn9mFtApC0ztEgdeNOw9BPgUS/EnSmz8TCLSDFQ=; b=ouBieWJQc8AfqoM6SDbP7Z7RbowQ+30DVzGfm+fCD/1vjyHR2XCXclmO1Up7IOwg1M C39r04RYn3mCgJDMLdaYEP3jX1k/CFmuziAC9axzSe1nBvFbEpQ9fR95XaDGPcw1Kxj4 2lDT5azjgghFAh+Uv2jGGhU4a6nuXk/hRAV8I8YxhmBlLmEBSQ4TcACaw9W7AT9XXoR1 9QBWJOZrY4y+9Q6+/wd0japV8X9YzEd7xdDpt4KetP50EIyN3AI0lXhmot5kqkQ/Y+i/ 7ZF5qQBc57gf3TydypXhnf02OI6Xd8ti4biQJAqTMSblKLMGx6LXthYXt9j21lTzAk/O OJgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779116710; x=1779721510; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vzeCgn9mFtApC0ztEgdeNOw9BPgUS/EnSmz8TCLSDFQ=; b=peKcq9Ixh4xTBYq3C9Gi+e/wv2kSpGjbDGNZ5pHo5qIbfFWelJtT5H/YDp3xdbzBO9 pwjdsXrtLAGKjIK0AsdtZzVhElWWdCvzHYagPHkk4vFqSd1eozEx/FrmZ1TJeMmcez+6 pvYFEsrbXULqannxmrEWVcYsEvUjEr16FYxaLwWe5HGvdm1eZPx+JN1YVd09mZUxmosv XHorPDHngVLwogztMD0gZ8efI1tJR0aqiLcP5NJJ6D9YHI1B63Aj5HyeCjgGnKmJXs9n F+nUN7QF5PCAf3P8TOpEpz805U888/Vl7vEgteDDz6ghCZhEkisnyYuUUOLihljoq52u JjNA== X-Forwarded-Encrypted: i=1; AFNElJ97rUokZM72U5Ox9RiKUkeUml0NZYFLRatR3jqq4xSuvaayJAx4FQZ3JQuE2OfEDhPvpXO/Ki33idaV4tQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzJHYVHVAscSqTQxKT5pkWRl0P0k9DvxcMIPDHsag7ndqQ/PS5+ dMteVp/vFPX0pd8qD0pc+udphqZYTdltrE5C6lLH5LDjsTI9bSAhWMZN5HneyyjAVwo= X-Gm-Gg: Acq92OGOsm8UkZg+BquWLcfvrXLRpXT4drj1UvQuHylk8GLiCEWSwnaDZXPOM2FL3xh 3DdK3akHGovDtQ1Z9mAAcEuew1smKxNiASiQjR7welLmjHjAhJ6IJMcZqNczZxesH2QX+wSzZqs ZMkoJYu27NVyL+lhnClks+CBk8PiA9EDeBtCzLgCJ4LPn5vbUk00NJww+JXCdkp3i5gAdsnI4mQ YNPIdQhVN43wcEjcmuxcoTkLNb+dKocT5sWjPg27raNZNr9aQ+pApWMnn037+qFkhsUPpEdtuz+ 0rgEbwiU2rE+MOEdlwz0KD8cEeMrSi8DUaUygVUxbpJ87wDkoh+UKBcY0ADHD85pR8tfKY2QLHY o72TjCNF/5K/hoWgwDBZi9OAriRniue3BREt3tkq8zr1seQ8EzvKzyfDoPMhyf9Bzfi5RMCdMHx D7SDJ95Ek3eMGqDg++o5I8Vk8clhVaS8UcrYJqj+sGqziywNbZ0fhADIS6Spx9r5RcUaM9Znosi w== X-Received: by 2002:a05:6830:3903:b0:7d7:ef0a:1ce5 with SMTP id 46e09a7af769-7e4ea07e9demr10482946a34.9.1779116710621; Mon, 18 May 2026 08:05:10 -0700 (PDT) Received: from ?IPV6:2600:8803:e7e4:500:3be6:1187:fed4:378b? ([2600:8803:e7e4:500:3be6:1187:fed4:378b]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e55b81c8a0sm7696080a34.10.2026.05.18.08.05.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 May 2026 08:05:10 -0700 (PDT) Message-ID: <7d338351-5f1f-4eb8-a266-b8756d0e60f5@baylibre.com> Date: Mon, 18 May 2026 10:05:09 -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 v11 2/6] iio: adc: ad4691: add initial driver for AD4691 family To: "Sabau, Radu bogdan" , Lars-Peter Clausen , "Hennerich, Michael" , Jonathan Cameron , "Sa, Nuno" , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Liam Girdwood , Mark Brown , Linus Walleij , Bartosz Golaszewski , Philipp Zabel , Jonathan Corbet , Shuah Khan Cc: "linux-iio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-pwm@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-doc@vger.kernel.org" References: <20260515-ad4692-multichannel-sar-adc-driver-v11-0-eab27d852ac2@analog.com> <20260515-ad4692-multichannel-sar-adc-driver-v11-2-eab27d852ac2@analog.com> <0696b662-f478-4d1a-95e0-0338bbdb719e@baylibre.com> Content-Language: en-US From: David Lechner In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/18/26 9:59 AM, Sabau, Radu bogdan wrote: >> -----Original Message----- >> From: David Lechner >> Sent: Saturday, May 16, 2026 8:11 PM > > ... > >>> +static int ad4691_reg_read(void *context, unsigned int reg, unsigned int >> *val) >>> +{ >>> + struct spi_device *spi = context; >>> + u8 tx[2], rx[4]; >>> + int ret; >>> + >>> + /* Set bit 15 to mark the operation as READ. */ >> >> Can't we just set read_flag_mask in the regmap config? >> > > As far as I can tell read_flag_mask is applied by the standard SPI regmap bus > backend, which constructs and sends the address byte itself before reading > the response. When using devm_regmap_init() with custom reg_read/reg_write > callbacks, the regmap core calls those callbacks directly with the raw register > address - it never touches read_flag_mask. > >>> + put_unaligned_be16(0x8000 | reg, tx); >>> + >>> + switch (reg) { >>> + case 0 ... AD4691_OSC_FREQ_REG: >>> + case AD4691_SPARE_CONTROL ... AD4691_ACC_MASK_REG - 1: > > ... > >>> +static int ad4691_write_raw(struct iio_dev *indio_dev, >>> + struct iio_chan_spec const *chan, >>> + int val, int val2, long mask) >>> +{ >>> + switch (mask) { >>> + case IIO_CHAN_INFO_SAMP_FREQ: >> >> Should we aquire direct mode so that we can't change the rate during >> buffered read? >> > > It is in set_sampling_freq already. Do you think it would make more sense > to move it here in order to help readability? > IIRC, I think it was resolved in a later patch in the series. So could just be a problem of it not getting added in the right patch. In general though, yes it would make it easier review if the direct mode claim was made here.