Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1368676lqb; Thu, 30 May 2024 08:15:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXJ991H4yb8WzaF6trgJ2N2UEKtmPFycEglh0VIkCVBiQGrzefppx5pS9H8IXXT2H43glUK/lWem7VwcL6RVDKqllNAtV8FT39KESbwAg== X-Google-Smtp-Source: AGHT+IGQeMkv6Kebgqs9Digqhh54U/cgjaAwHCvEu+vnef8ZRXkEms+0U5qEK4cOHmWpVNEhU4ib X-Received: by 2002:a05:6a00:8d86:b0:6e6:9f47:c18c with SMTP id d2e1a72fcca58-702313e424bmr1580172b3a.33.1717082109537; Thu, 30 May 2024 08:15:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717082109; cv=pass; d=google.com; s=arc-20160816; b=STBcaHK2wcQfg+aha57HraGaEZlJvGdX9Evs+/SyREP3UNMwNhXDyKG9MghhHXoL3O 8DhsyOgl+KJN4we//ThKnV9gfb3ugr63cUHa3dTII0+HihfmLfwyVlIO/SUvWHECjsJR gIA3llbAkewi+MYdsLUvAxpbkJlPmFiLFGTpaZ7+999bfGfLJXk9c3iXNmYjfNZVJpM9 vHYxpttm2BCN2CNR6H8xo7kVkILHnA9Ljeo3rzv4kAYYauSSpku0mO8CcQVE+8mbe972 HfjPxgcCimmLfdzZtMRZ1SKTFJnfFVkPW48OKCevC6QCOg4ROgf3v74B1H/hDiaUZ/ZU sgVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=FbWYNDGeB4acdSvzLHvqWONXfu2Ni8kWHZVRyossuwM=; fh=+sE0AO/PAa2i+/sIFmqwvELEphRx3dpvv/rP6FtgNA4=; b=AS9981QS7TQDqla4Fs41nX9Hvdf3AfgUT33jGhwg5ksw5xhSqSGYkF5O+8nZQG6qaW 5LAK/LmLLApGqW6Q5MdRlYjlsLYe4QtcP3tiWnWL1agwBf8skKVy7tzmFREzOE70nP+1 RQoGIS0WoGx/mFMfdS1Crkg/bpD/XwJ9C59rBIh2K4Q6PuBdSriDSRKoMoHPJai7+klJ 36ycvEqz48lXm2SxSXdeHF2E/A3WLysR/Uz+kpj8uu8UulbYENbHfydYe5kiS7DItXSd 7pHJNRz0b35iqElk0I4BHakiVoS4QWZknvAAeBh8y4TNCKFcPKTPowTl43HEqf6z/xrQ Za8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=IA0CP7al; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-195584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195584-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6822779b98dsi12848256a12.367.2024.05.30.08.15.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:15:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-195584-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=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=IA0CP7al; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-195584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-195584-linux.lists.archive=gmail.com@vger.kernel.org" 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 27ACA287AD0 for ; Thu, 30 May 2024 15:15:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1EF11187542; Thu, 30 May 2024 15:14:33 +0000 (UTC) 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="IA0CP7al" Received: from mail-ot1-f44.google.com (mail-ot1-f44.google.com [209.85.210.44]) (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 2DE1C17D8B3 for ; Thu, 30 May 2024 15:14:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717082072; cv=none; b=th/EeQxaFSJFn+SVlyqdBZw22xvehqGl2coMRUHe6mkwpbBjNPcD2MqNGvblEn5vgxc6CcJoxBvDyfIFWTyCeuzZEvyNu1npzWJ9LSwr6vNgJDemaPP2MWiZC6faP2Fo5KN0UTPu7wng6W3myYyVD5YKOSm9dnVp3vk3Hj7c8YI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717082072; c=relaxed/simple; bh=ZRrBEnty0a3OvlAcxFKH/wVNDRG+6DSpTucqWWr66pQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YbWu2icWKjft3rudG0qq8jBmMsiDSfY7IVZBoh7I0ia/3y//qNvylB6rX6cDfUDsHMLEdbf3EBgqRHYuM+27HoDl4tnL6bc9SMdb2Ev0CHE9c1GFahdCvHVCLwSW5utzxILYqGcWk4U2e3qpBcUekb1d+z19oqZnDAECsqgqYO0= 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=IA0CP7al; arc=none smtp.client-ip=209.85.210.44 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 Received: by mail-ot1-f44.google.com with SMTP id 46e09a7af769-6f8d0a00a35so38690a34.2 for ; Thu, 30 May 2024 08:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1717082069; x=1717686869; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FbWYNDGeB4acdSvzLHvqWONXfu2Ni8kWHZVRyossuwM=; b=IA0CP7alcnAhoaw0ReGN3EZynNr/XEzvSWs+w6TKe4f+X5SVe04w8nFkvj+jymikic 5QYcY3eBou1//g9hryIINrBQirenZ85DvWk5ppdc+u3r6WskxZIiF7HSNvEwAE/jzyAz q2yC6I3p1fafA+YBZC60mQ+3n9sVqBVpTsUEGNBUcI78wkYFJ1m7gTTtluVKJlH40KM8 5WiXVRJNN2hWgQLNwU4M6wwQoNpuLO141M3B6wmMFttkd6CtZ6oblh94jTu6M4arzqs9 MAY2fxA7hG1pcCpnaiWSP3c6Ew/+6u32i4veEDCl9n3J3OK/iGJIl0rnYHa0ECqU7ne+ NNWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717082069; x=1717686869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FbWYNDGeB4acdSvzLHvqWONXfu2Ni8kWHZVRyossuwM=; b=hN5FvNcsJh0f2rr89oHiuZKBclOGq9T6rVo4xS+wNJjaETB9yYFPNaJ8n3z3JxjYTh 2QlwvtjCak94szlx6ayHfCHfgKEM2ZWa2yJXizsHtplH0x7l8yJ6k2z4dMt9Mr7t5NVM Ruz7ffnm0f7aBFhUFQtIvzG3McO7vIfx6sJZ1aTz7526PZOrjHMVQJFn20lsaWJvv5Rw /ogivFV+HFJojE1U6mL6DAqXrzpUsxpvlXeVkHnJcwHXF8jfAqAJnZJXgMToOPHxM0Kb eQ+BuuXqHZHSYUtsb73eCV6UU5PGYHVSfW00AAnP/Facbro1aDJprT70qhezFf07ddEd 5XTg== X-Forwarded-Encrypted: i=1; AJvYcCVje/4E3xZz7dyuIJvi7uyjAALPiHiqq0r+bcbg9cCBQQ/4nk92JE0mHZ4+oP7+haGKaJBmxpbRydWfUFT2GxOh63bw91tbqGyMbUaC X-Gm-Message-State: AOJu0Yw15Ohi3V4V+d9FOdlJC9eo6yH0BzWOLcKbEQMUw47DT1cKKRWR Kmp3gOTrc8+5XccP4c9oEYzmIb/1B1dHBOk68Xub7wJ7f54SSyjt1C69pRbQj3o= X-Received: by 2002:a9d:4802:0:b0:6f0:e7c3:945c with SMTP id 46e09a7af769-6f90af1c9b2mr2439771a34.36.1717082069189; Thu, 30 May 2024 08:14:29 -0700 (PDT) Received: from freyr.lechnology.com (ip98-183-112-25.ok.ok.cox.net. [98.183.112.25]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-6f8d0de6314sm2803425a34.41.2024.05.30.08.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 08:14:28 -0700 (PDT) From: David Lechner To: Jonathan Cameron Cc: David Lechner , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Julien Stephan , Esteban Blanc , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] iio: introduce struct iio_scan_type Date: Thu, 30 May 2024 10:14:08 -0500 Message-ID: <20240530-iio-add-support-for-multiple-scan-types-v3-1-cbc4acea2cfa@baylibre.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240530-iio-add-support-for-multiple-scan-types-v3-0-cbc4acea2cfa@baylibre.com> References: <20240530-iio-add-support-for-multiple-scan-types-v3-0-cbc4acea2cfa@baylibre.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="utf-8" X-Mailer: b4 0.12.4 Content-Transfer-Encoding: 8bit This gives the channel scan_type a named type so that it can be used to simplify code in later commits. Signed-off-by: David Lechner --- v3 changes: none v2 changes: none --- include/linux/iio/iio.h | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index 55e2b22086a1..19de573a944a 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -173,6 +173,27 @@ struct iio_event_spec { unsigned long mask_shared_by_all; }; +/** + * struct iio_scan_type - specification for channel data format in buffer + * @sign: 's' or 'u' to specify signed or unsigned + * @realbits: Number of valid bits of data + * @storagebits: Realbits + padding + * @shift: Shift right by this before masking out realbits. + * @repeat: Number of times real/storage bits repeats. When the + * repeat element is more than 1, then the type element in + * sysfs will show a repeat value. Otherwise, the number + * of repetitions is omitted. + * @endianness: little or big endian + */ +struct iio_scan_type { + char sign; + u8 realbits; + u8 storagebits; + u8 shift; + u8 repeat; + enum iio_endian endianness; +}; + /** * struct iio_chan_spec - specification of a single channel * @type: What type of measurement is the channel making. @@ -184,17 +205,6 @@ struct iio_event_spec { * @scan_index: Monotonic index to give ordering in scans when read * from a buffer. * @scan_type: struct describing the scan type - * @scan_type.sign: 's' or 'u' to specify signed or unsigned - * @scan_type.realbits: Number of valid bits of data - * @scan_type.storagebits: Realbits + padding - * @scan_type.shift: Shift right by this before masking out - * realbits. - * @scan_type.repeat: Number of times real/storage bits repeats. - * When the repeat element is more than 1, then - * the type element in sysfs will show a repeat - * value. Otherwise, the number of repetitions - * is omitted. - * @scan_type.endianness: little or big endian * @info_mask_separate: What information is to be exported that is specific to * this channel. * @info_mask_separate_available: What availability information is to be @@ -245,14 +255,7 @@ struct iio_chan_spec { int channel2; unsigned long address; int scan_index; - struct { - char sign; - u8 realbits; - u8 storagebits; - u8 shift; - u8 repeat; - enum iio_endian endianness; - } scan_type; + struct iio_scan_type scan_type; long info_mask_separate; long info_mask_separate_available; long info_mask_shared_by_type; -- 2.45.1