From nobody Wed Nov 27 05:40:20 2024 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.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 1E9FA15B546 for ; Mon, 14 Oct 2024 10:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728900584; cv=none; b=Ux77vLgkxHV+TZjxghZTphP60HxL84JYfu7v4eGBjVgq/eYF3bEkYWBX0KlazydqjSgPe2fzsPIYhpsPLsQvQEuF7/dv1Ghb/CDddVn9gsbaIE3Xkbznv7zJkuZkFMSW2lLTyW1HSO0BYxp/sLfZdoPBNAEM8oaTP2IRX7hm/WM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728900584; c=relaxed/simple; bh=I2hKyJkE5lSaVfqcBggLmA5y3mTRzqksloo07yQRvt0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cCP9XSEKnlbwNrH6RCeixskSVpf2RJ85OYaQ5suNUv3AblQ8K0lhFx7mkON2b1WWpZniG01D2DCrxcXtAc2e+Nyq+F9X5ZowrQqmsA1CJ3vedlFzmKdf0luDr/RuaZRSpek6uCSPpnIHFyM14Zlgm4xAjNpc9l655S0dV/ugyQw= 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=dMlkLiEH; arc=none smtp.client-ip=209.85.128.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="dMlkLiEH" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4311d972e3eso21577205e9.3 for ; Mon, 14 Oct 2024 03:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1728900579; x=1729505379; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=tXD9nM+zJf+baf8I1HJHQEo8iyVRn909PphK3Jj4Bu4=; b=dMlkLiEHSDR0zyMuOpO1LL8Jc2QdRkZXqFzJeGnh0cWQG1N92yK3J0EeSoLed5cRnF OOZrUHgHU/nbWaHd3+D/IcxQirbG1cUBmJf4+7NUYvRwHsIL3e6zgz7QRwp5CYNonoOZ QNgVa7XzrJp47HKTzIbbD07izT+uqVjNtGADtOai4X9Kq+FobohTXi11KRjEASLqr64W Gb8/aGSWGJOdY24rN5VVMvvgtiKiW+LVYdem3wRxXeBY7hnhZ3UpHQwsppSOT3O5377h PtG0xJmsee7qJ5nD/BxA0qxPAesSnEBMfFKc/tmioap1pzAndJdm2OlttNukx5jeMVUu 5lhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728900579; x=1729505379; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tXD9nM+zJf+baf8I1HJHQEo8iyVRn909PphK3Jj4Bu4=; b=Or/bifQhMDTzc0bpqrP5mO/7Xh+iHkxQPZBzB0b/HmMTPW0m3zt1xUnFqfq3rsHCMU h4ULSCww81ipTHofRKKBUgGe8J/Xsk2mZESbwCQXTlykMZbP9xCn+RhOFjc7gAwViv6+ EJjTnmTngAdX6mhy9+XBydViS54xPNVvsz62Oo7fL0hF4cTUz+ZlQbfSNiykwTbcSSXH ZU3aobQN8a3Cr4ScrPhAwGvRV3fm0WfSJ/XF5R2qg0X7swQlPEJImCXiw2Zmyf4k0xWE /qOAKcK/ZwiRzYDULCWexq5JisJ12XpV2jRGeMTE6kBgpJkZ2lqPCTaSEzBwE68cz4z5 +gSQ== X-Forwarded-Encrypted: i=1; AJvYcCUo71z3nH+3p5d0SEVMQotQBp8F8O2xDxqHaaJbcvnv1iou4hrU9keBSXfZMZq29O4wa/AjDA9mEEm5cVQ=@vger.kernel.org X-Gm-Message-State: AOJu0YxNsZR5UyzOv3dn4Q4BHNUfqkyfZ5KxrQSdiG4WYqGxUizNkRK5 g+unn1X9AA7iMyV4oz9ars0CwW5mh+aHoO7hv3lEQIljgR/GBVSNKBEe7pmEZs8= X-Google-Smtp-Source: AGHT+IGSmgW6o07g4/8KAQfgtWH+HRp7++ZxjpoMsivKqGSwcc5AMgDayQqpF4/0Y+ilgr/D0dfuNg== X-Received: by 2002:a5d:4d8c:0:b0:374:bd48:fae9 with SMTP id ffacd0b85a97d-37d5ff2a6fbmr5815490f8f.20.1728900579364; Mon, 14 Oct 2024 03:09:39 -0700 (PDT) Received: from [127.0.1.1] (host-79-45-239-138.retail.telecomitalia.it. [79.45.239.138]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37d4b7ee0afsm10969352f8f.102.2024.10.14.03.09.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 03:09:38 -0700 (PDT) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Mon, 14 Oct 2024 12:08:09 +0200 Subject: [PATCH v6 3/8] iio: backend: extend features 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" Content-Transfer-Encoding: quoted-printable Message-Id: <20241014-wip-bl-ad3552r-axi-v0-iio-testing-v6-3-eeef0c1e0e56@baylibre.com> References: <20241014-wip-bl-ad3552r-axi-v0-iio-testing-v6-0-eeef0c1e0e56@baylibre.com> In-Reply-To: <20241014-wip-bl-ad3552r-axi-v0-iio-testing-v6-0-eeef0c1e0e56@baylibre.com> To: =?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, dlechner@baylibre.com, Mark Brown , Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Extend backend features with new calls needed later on this patchset from axi version of ad3552r. The follwoing calls are added: iio_backend_ddr_enable() enable ddr bus transfer iio_backend_ddr_disable() disable ddr bus transfer iio_backend_data_stream_enable() enable data stream over bus interface iio_backend_data_stream_disable() disable data stream over bus interface iio_backend_data_transfer_addr() define the target register address where the DAC sample will be written. Reviewed-by: Nuno Sa Signed-off-by: Angelo Dureghello --- drivers/iio/industrialio-backend.c | 78 ++++++++++++++++++++++++++++++++++= ++++ include/linux/iio/backend.h | 17 +++++++++ 2 files changed, 95 insertions(+) diff --git a/drivers/iio/industrialio-backend.c b/drivers/iio/industrialio-= backend.c index 20b3b5212da7..81f3d24f0c50 100644 --- a/drivers/iio/industrialio-backend.c +++ b/drivers/iio/industrialio-backend.c @@ -718,6 +718,84 @@ static int __devm_iio_backend_get(struct device *dev, = struct iio_backend *back) return 0; } =20 +/** + * iio_backend_ddr_enable - Enable interface DDR (Double Data Rate) mode + * @back: Backend device + * + * Enable DDR, data is generated by the IP at each front (raising and fall= ing) + * of the bus clock signal. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int iio_backend_ddr_enable(struct iio_backend *back) +{ + return iio_backend_op_call(back, ddr_enable); +} +EXPORT_SYMBOL_NS_GPL(iio_backend_ddr_enable, IIO_BACKEND); + +/** + * iio_backend_ddr_disable - Disable interface DDR (Double Data Rate) mode + * @back: Backend device + * + * Disable DDR, setting into SDR mode (Single Data Rate). + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int iio_backend_ddr_disable(struct iio_backend *back) +{ + return iio_backend_op_call(back, ddr_disable); +} +EXPORT_SYMBOL_NS_GPL(iio_backend_ddr_disable, IIO_BACKEND); + +/** + * iio_backend_data_stream_enable - Enable data stream + * @back: Backend device + * + * Enable data stream over the bus interface. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int iio_backend_data_stream_enable(struct iio_backend *back) +{ + return iio_backend_op_call(back, data_stream_enable); +} +EXPORT_SYMBOL_NS_GPL(iio_backend_data_stream_enable, IIO_BACKEND); + +/** + * iio_backend_data_stream_disable - Disable data stream + * @back: Backend device + * + * Disable data stream over the bus interface. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int iio_backend_data_stream_disable(struct iio_backend *back) +{ + return iio_backend_op_call(back, data_stream_disable); +} +EXPORT_SYMBOL_NS_GPL(iio_backend_data_stream_disable, IIO_BACKEND); + +/** + * iio_backend_data_transfer_addr - Set data address. + * @back: Backend device + * @address: Data register address + * + * Some devices may need to inform the backend about an address + * where to read or write the data. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int iio_backend_data_transfer_addr(struct iio_backend *back, u32 address) +{ + return iio_backend_op_call(back, data_transfer_addr, address); +} +EXPORT_SYMBOL_NS_GPL(iio_backend_data_transfer_addr, IIO_BACKEND); + static struct iio_backend *__devm_iio_backend_fwnode_get(struct device *de= v, const char *name, struct fwnode_handle *fwnode) { diff --git a/include/linux/iio/backend.h b/include/linux/iio/backend.h index 37d56914d485..10be00f3b120 100644 --- a/include/linux/iio/backend.h +++ b/include/linux/iio/backend.h @@ -14,12 +14,14 @@ struct iio_dev; enum iio_backend_data_type { IIO_BACKEND_TWOS_COMPLEMENT, IIO_BACKEND_OFFSET_BINARY, + IIO_BACKEND_DATA_UNSIGNED, IIO_BACKEND_DATA_TYPE_MAX }; =20 enum iio_backend_data_source { IIO_BACKEND_INTERNAL_CONTINUOUS_WAVE, IIO_BACKEND_EXTERNAL, + IIO_BACKEND_INTERNAL_RAMP_16BIT, IIO_BACKEND_DATA_SOURCE_MAX }; =20 @@ -89,6 +91,11 @@ enum iio_backend_sample_trigger { * @read_raw: Read a channel attribute from a backend device * @debugfs_print_chan_status: Print channel status into a buffer. * @debugfs_reg_access: Read or write register value of backend. + * @ddr_enable: Enable interface DDR (Double Data Rate) mode. + * @ddr_disable: Disable interface DDR (Double Data Rate) mode. + * @data_stream_enable: Enable data stream. + * @data_stream_disable: Disable data stream. + * @data_transfer_addr: Set data address. **/ struct iio_backend_ops { int (*enable)(struct iio_backend *back); @@ -129,6 +136,11 @@ struct iio_backend_ops { size_t len); int (*debugfs_reg_access)(struct iio_backend *back, unsigned int reg, unsigned int writeval, unsigned int *readval); + int (*ddr_enable)(struct iio_backend *back); + int (*ddr_disable)(struct iio_backend *back); + int (*data_stream_enable)(struct iio_backend *back); + int (*data_stream_disable)(struct iio_backend *back); + int (*data_transfer_addr)(struct iio_backend *back, u32 address); }; =20 /** @@ -164,6 +176,11 @@ int iio_backend_data_sample_trigger(struct iio_backend= *back, int devm_iio_backend_request_buffer(struct device *dev, struct iio_backend *back, struct iio_dev *indio_dev); +int iio_backend_ddr_enable(struct iio_backend *back); +int iio_backend_ddr_disable(struct iio_backend *back); +int iio_backend_data_stream_enable(struct iio_backend *back); +int iio_backend_data_stream_disable(struct iio_backend *back); +int iio_backend_data_transfer_addr(struct iio_backend *back, u32 address); ssize_t iio_backend_ext_info_set(struct iio_dev *indio_dev, uintptr_t priv= ate, const struct iio_chan_spec *chan, const char *buf, size_t len); --=20 2.45.0.rc1