From nobody Fri Dec 19 20:58:09 2025 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 E57F0202F68 for ; Wed, 8 Jan 2025 17:30:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736357444; cv=none; b=VgjbT682JjpdT10W9zYjOlhCVdk1bq+zde/wzz4z1vs6wnOJHIAeQ8iX8+dknZ7KVSTaKXtj+4XaEpNvw5TlCet2C4uUtvJpV4BhiBk6WcsBOKsbqkFh8Wn6sGcbhG5Cnpgv/R5wnc0esk8H0wWtDH1jkK5ABKV91YXJFBrqmW0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736357444; c=relaxed/simple; bh=DnAjjx0PkSOieNJ5OJb2nk2Cce0Mvn+naUnXYCUW1PM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jtp8REeKiqGebqJ1ENpg31iNwPTOa3mlyxe3wdbLOdPK0PRcT8Dd308038bBTnHs8E8IV8IahhpOrUjERbQBagsR+yc21CntzWf8ZtzG0dM+pIdR7EAP63yaq4ODxWOlYGfiyb+XMxOh7ruMFe68YbQqO6foatdfHh/quIEkLrc= 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=Gp5+FlpH; arc=none smtp.client-ip=209.85.128.43 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="Gp5+FlpH" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4364a37a1d7so732025e9.3 for ; Wed, 08 Jan 2025 09:30:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1736357440; x=1736962240; 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=qABqYAhj0TrQzJxH7XVarpnbO7+OveXqYM2s3icznC4=; b=Gp5+FlpHJFNF4Iv1xZSRQrMCGxxP96zqrOhsI2nCDVQV/F2fhUcjpqib8XK0zowHCv jnfVioIcJ3MwAb5+dpn2F64Wj++/TmguihzKtLDRrrrgXGK1NT0kd7ad8gC2CRwEBkvK 91rSF/Ur53zPbINWSTxJhRi7CFc/qzsVE21DAllAbn+CZpPkhGdhohnG1EkcWzCUJ9m1 3rSXqdG3+6csNurp9ONIVEGPNiiC7EZJQd60qgA+wxzUEQMOReA2sbW8VUOgTzHzsuGI XuFNUXokkf2xrln0OzfMbzR55Awtcc7tvn/MmRd/+9DHyio+aqpIdX7aAUgurcKKeo2p 1tTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736357440; x=1736962240; 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=qABqYAhj0TrQzJxH7XVarpnbO7+OveXqYM2s3icznC4=; b=I1WZL8/UjA5HSrYnJPM5Vnr4ZnGcP/xrL2KABt7fgCePorGRqti1sC1Wf1yaeSdN17 dOuzu3flLElvEonhh4YP3w4xykOJpV8jVptJGky3G5x3wMZ68k3XjmHkEjIjhbXJMnBD KoHvslKfilHkv2ArMapK8rXWVhgIzLHDIskEwATV+dzTMB6NxckJhSU+WuKRIw/Vth5R +5/UqwXX3OCz6YV22T3hEqgoFb/CRrLfS0AOqfun5DoOpn9+I+jf3JwDyfXgnM5VnyWl sTpZOCZn1kYuZaqKmvZdCaFBQuSdHeVTC8hx3sqrKV/nSVVquHVIKoqMqW+BVmQb3LNt /6NQ== X-Forwarded-Encrypted: i=1; AJvYcCXyub7CxKwfZC/JCY3koV4a8MB+Tovq/okiR0TewsSUJPFd1Rqvqiyv3AKyXehRhqEGtSK0WwOOy6nOuxo=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9XWqRvG7fstkOpqfOln6PsDj26dHlVNQw3oR58VuI1934X6Ai kzGu/7Q2Af9PsTKpQnM/SOAPbMjr2fRm5OBoOH2ey+uPpJg2RsUGiUcdIZlsnR6MxqNKYBJVQXE L X-Gm-Gg: ASbGncst8CKu3AjDHyYvHG6itWul8S83chnaIlBIYc9dzYU1XihU1Cy0qWOrWURUzR7 O1BuUYK3uFicgtw5eKnbRNZDOgxQ5TmqJ/1oYgSRZuLcAej495Qzy8HbQDNoXJuXMpbNUMFAVE5 YJ9m8u20fYNu+VWlD9534I40tP/uc/jw50sJW4BtVNOsJfrTAhn9VaUzKQXz3NMUxdc8c0Z/ezT DSjWAazwy9pnstWmovtIve4bA668ajCvWAomw60Hlv/EhEtazp+o8Ns7iE= X-Google-Smtp-Source: AGHT+IF3nilwMU43g5/fpaBvcw4VZUw4Fkdm9sOic07GjpPunCK+W3hkn/+CE4mn9czZhiryv71U9w== X-Received: by 2002:a05:600c:1e09:b0:436:e751:e445 with SMTP id 5b1f17b1804b1-436e751e61fmr16540885e9.5.1736357438725; Wed, 08 Jan 2025 09:30:38 -0800 (PST) Received: from [127.0.1.1] ([87.13.70.66]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8330d4sm52782599f8f.29.2025.01.08.09.30.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jan 2025 09:30:38 -0800 (PST) From: Angelo Dureghello X-Google-Original-From: Angelo Dureghello Date: Wed, 08 Jan 2025 18:29:20 +0100 Subject: [PATCH v2 6/9] iio: dac: ad3552r-hs: use instruction mode for configuration 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: <20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-6-2dac02f04638@baylibre.com> References: <20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-0-2dac02f04638@baylibre.com> In-Reply-To: <20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-0-2dac02f04638@baylibre.com> To: Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Mihail Chindris , Nuno Sa , David Lechner Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Angelo Dureghello X-Mailer: b4 0.14.1 From: Angelo Dureghello Use "instruction" mode over initial configuration and all other non-streaming operations. DAC boots in streaming mode as default, and the driver is not changing this mode. Instruction r/w is still working becouse instruction is processed from the DAC after chip select is deasserted, this works until loop mode is 0 or greater than the instruction size. All initial operations should be more safely done in instruction mode, a mode provided for this. Signed-off-by: Angelo Dureghello --- drivers/iio/dac/ad3552r-hs.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c index 27949f207d42..991b11702273 100644 --- a/drivers/iio/dac/ad3552r-hs.c +++ b/drivers/iio/dac/ad3552r-hs.c @@ -132,6 +132,13 @@ static int ad3552r_hs_buffer_postenable(struct iio_dev= *indio_dev) return -EINVAL; } =20 + /* Primary region access, set streaming mode (now in SPI + SDR). */ + ret =3D ad3552r_qspi_update_reg_bits(st, + AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST, 0, 1); + if (ret) + return ret; + ret =3D st->data->bus_reg_write(st->back, AD3552R_REG_ADDR_STREAM_MODE, loop_len, 1); if (ret) @@ -198,6 +205,14 @@ static int ad3552r_hs_buffer_predisable(struct iio_dev= *indio_dev) if (ret) return ret; =20 + /* Back to single instruction mode, disabling loop. */ + ret =3D ad3552r_qspi_update_reg_bits(st, + AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST, + AD3552R_MASK_SINGLE_INST, 1); + if (ret) + return ret; + return 0; } =20 @@ -308,6 +323,13 @@ static int ad3552r_hs_setup(struct ad3552r_hs_state *s= t) if (ret) return ret; =20 + ret =3D st->data->bus_reg_write(st->back, + AD3552R_REG_ADDR_INTERFACE_CONFIG_B, + AD3552R_MASK_SINGLE_INST | + AD3552R_MASK_SHORT_INSTRUCTION, 1); + if (ret) + return ret; + ret =3D ad3552r_hs_scratch_pad_test(st); if (ret) return ret; --=20 2.47.0