Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4463689ybz; Tue, 28 Apr 2020 11:43:38 -0700 (PDT) X-Google-Smtp-Source: APiQypJ6d7bRY1CgzlGNFYBuW3ecsnUiRdzXA0kpkMDD1n91D3iDlgkRc007mZYOQDc4exmSjR3J X-Received: by 2002:aa7:c04a:: with SMTP id k10mr9630302edo.241.1588099418150; Tue, 28 Apr 2020 11:43:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588099418; cv=none; d=google.com; s=arc-20160816; b=PPBtfvd+K7AIef8YlMuVxyAD4oVkSvcaUXzVC7neSFl2gDAi73lq5eu2E1Wbq7OsdP 22CYDo4Jl0CUAUP8kjWA/GlifZqh/y5JxMsukrWlqRLeqOJleJpbNowo6/SR39uOgxyk D3MdrP7my3LyZE77GnhgrDXT22Yr1+rEXXU34giAdM1lFwKvRARZ16FsWDwZ3KOWsDvb wBvf/On31GAHAVJfU177V3x3EwWYFc9XNJ2ua0VyPA+Y1FIXnDaHoIMGLi3FOs9Ik4gj jF9rnxiN7QUAkka/Laz2YDCELfE/Q5Uk1i1ly6FyrCtMuOp8BjD0uQRuR4nwXEv1eXxY L0gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HvtidLvWRFkJnvRdftCOyqZq9bj+FBPdhajG6KAcit8=; b=JJ5QuKUwNk53qTnDuf22ViChYJKgQfPObf9/qJH6HTn7iM1ncKUGtB6ZfKqHEhZORA hC93gPs3NiG7Lu+JMk25jJeKDswYdmfn71RhgG5pO2/J36XySszUm5dxVfUBOuKtm0Nk IOJ7vgqSxk3rwiKoGMiO4mgnLij8a3pCflt2x0humO1Eg/DeaOuxncQaFtBPm0By2Oka 8k3ENMwnqUsF+ZFLAcda+JafXIok0NjRmQFhJdjvWrHLq+BJFbsAl8ebhWCCv3cjj3aK ydW7UnrGTpUHeFdZIvkkpOWdDOiBwe6Wco7xBqKDag1Y0gztiWLv4KA/3iUfIbq3Ya09 fo6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W4npwtWC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si2015971edx.256.2020.04.28.11.43.14; Tue, 28 Apr 2020 11:43:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=W4npwtWC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731059AbgD1SmA (ORCPT + 99 others); Tue, 28 Apr 2020 14:42:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:33618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731046AbgD1Sl5 (ORCPT ); Tue, 28 Apr 2020 14:41:57 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CE45D20B1F; Tue, 28 Apr 2020 18:41:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588099315; bh=okFhcd/SyvEwUKm90K1+K90VGZtWh3QimsVJ6c3i+xQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W4npwtWCBjFzYH6C9eUzymQqwx5pRIrEufLZY/DxTjQkxokT7HzATh9sPVoFmsTtk Oesr46EZUe9XlcNdbdiLvfZd/AZZrSnSIk99LsCU9pbUf063362cM1c+HFavHMDVhp 3gbIJYvSa+GzdEE/8PpDLZQFuZsBP+gCB81TVK78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars-Peter Clausen , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.4 093/168] iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode Date: Tue, 28 Apr 2020 20:24:27 +0200 Message-Id: <20200428182244.088837946@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200428182231.704304409@linuxfoundation.org> References: <20200428182231.704304409@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lars-Peter Clausen commit 8bef455c8b1694547ee59e8b1939205ed9d901a6 upstream. The XADC has two internal ADCs. Depending on the mode it is operating in either one or both of them are used. The device manual calls this continuous (one ADC) and simultaneous (both ADCs) mode. The meaning of the sequencing register for the aux channels changes depending on the mode. In continuous mode each bit corresponds to one of the 16 aux channels. And the single ADC will convert them one by one in order. In simultaneous mode the aux channels are split into two groups the first 8 channels are assigned to the first ADC and the other 8 channels to the second ADC. The upper 8 bits of the sequencing register are unused and the lower 8 bits control both ADCs. This means a bit needs to be set if either the corresponding channel from the first group or the second group (or both) are set. Currently the driver does not have the special handling required for simultaneous mode. Add it. Signed-off-by: Lars-Peter Clausen Fixes: bdc8cda1d010 ("iio:adc: Add Xilinx XADC driver") Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/adc/xilinx-xadc-core.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/drivers/iio/adc/xilinx-xadc-core.c +++ b/drivers/iio/adc/xilinx-xadc-core.c @@ -798,6 +798,16 @@ static int xadc_preenable(struct iio_dev if (ret) goto err; + /* + * In simultaneous mode the upper and lower aux channels are samples at + * the same time. In this mode the upper 8 bits in the sequencer + * register are don't care and the lower 8 bits control two channels + * each. As such we must set the bit if either the channel in the lower + * group or the upper group is enabled. + */ + if (seq_mode == XADC_CONF1_SEQ_SIMULTANEOUS) + scan_mask = ((scan_mask >> 8) | scan_mask) & 0xff0000; + ret = xadc_write_adc_reg(xadc, XADC_REG_SEQ(1), scan_mask >> 16); if (ret) goto err;