Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp698895ybz; Fri, 1 May 2020 07:02:17 -0700 (PDT) X-Google-Smtp-Source: APiQypLE2OwR7eb71O2NgVE5L96QsTKNCi+ruEK9ATXESgqdHBKn4C5bWh/lXyVZBMCNv6Wy1YN1 X-Received: by 2002:aa7:c40c:: with SMTP id j12mr3519440edq.169.1588341737652; Fri, 01 May 2020 07:02:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588341737; cv=none; d=google.com; s=arc-20160816; b=EoN8gc/Ezjs1wEX9VBZnTubm1dPWKEjWi1jURMzntFMFl5zGqrkBYxYcyJI1VdKDOz KqEHmI7pjkutpY8RQtdWYA7HpnA8oSxf7iEZKx5UTYz6vPVtN1rkjfl48vBlrxyBuROM LLqRjVtHdrBeCt90FTW2RTA3T0tcPidjDgRf727aSluCw3SxdpiA5YYsT46eIBPN+OTl zbxPLoh/MrxU9cByDC3TXeQcsmbuK5fVC3oT9VuxQD1PRYyavOQDA/wlqqgvDuoPw6P5 r9og1rbJl879UB7mv3SHMH3vG+jnbUMe2psFeOFqQMDSGj4DJe6u8X/TFlqiPLBGo+Gr tUUA== 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=3139le/DFIl/v+zy1cG8k19VFfmO8eAxrmSguir8sbA=; b=l93S/eHVoWsmEAJM9ZoNHeV1tqjG41xh/ops2dBw4OC8C1BGB+jnoXbjiPAHD+dzph WucTZK1ixMZ9Gx8gIC2spryAf2wRixW9Aq862/KYVCF0320ATFa/02l9FRgER8SvaL+7 nqc0mkPvxCZ649mVLQpHf/rN0QHJUQNpYKhMTsU0zSv9QhqbnwTYQGjBh9efbAjuDQuJ P5vSgOVu0fdIpLVJ5TZiI7Kr1j+AYPY4ygFZJKVeU7Wb3H+rjFwDbqHEZN75+0oLKygZ ShoO0Gj1EZKQYMkdeYaO/sbcGZ8VO0PeLPNF/sUAJvcb0ff5yZ1IKqSjX9OZB+/MBviN nQHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i5F1R+si; 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 dp18si2224926ejc.498.2020.05.01.07.01.52; Fri, 01 May 2020 07:02:17 -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=i5F1R+si; 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 S1729790AbgEAN7j (ORCPT + 99 others); Fri, 1 May 2020 09:59:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:51886 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbgEAN2j (ORCPT ); Fri, 1 May 2020 09:28:39 -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 85305208DB; Fri, 1 May 2020 13:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588339719; bh=U+U2iYpx0DbAp2Qok+ROLY7JqeDXOVnqZQgUxYD8ArQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i5F1R+sino/VMeyQq/eOZ3Q56bxuORKI4DUoJ0qOtzIudonRWjW/cCtQt8B2uL5aB bsgMJ5vTyie6MHXZrmpuXioMyoSlWAP7+1mISgK9rp6xU0A52eAUhPI8XBz65yxP89 kCcZXECQ1kNKt8Xav4egAnR/ub9Vaqz25rv/Hpik= 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 4.9 32/80] iio: xilinx-xadc: Fix sequencer configuration for aux channels in simultaneous mode Date: Fri, 1 May 2020 15:21:26 +0200 Message-Id: <20200501131524.521873316@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131513.810761598@linuxfoundation.org> References: <20200501131513.810761598@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 @@ -785,6 +785,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;