Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1349338ybp; Thu, 17 Oct 2019 11:26:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxXrkWZn3guSmEHrlGdhDCj1VEo2xqXnjgLpFEq6VRds9B7DaTxETk2b585rwzVmhUtDr9Z X-Received: by 2002:a17:906:f0d2:: with SMTP id dk18mr4898232ejb.281.1571336764540; Thu, 17 Oct 2019 11:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336764; cv=none; d=google.com; s=arc-20160816; b=ves40Km4bHJtmymKW5/nkDktBNghiAAS58lSqG3/UD4c3P53uQl9seyayNbDiyb0Rh xoMNaXohlV6vVZJ4LI9KvkbbuHplM5SotkUxeEwQ7eFdPDYbUN8b4dkzKnnqn8pSyy+B kRB3YDTYwR0Vv1Fyyh0nTSiIk1wfNPaD/SsGuDNqiaXKUjj2lb/GtpS8iHc+VHvioMjF k3QqWY6GkzudxTy24mzeLxpoScD3+dkZcgjhv4w1f4sRZxYT1EbQoV/MTue6408y73Dr KB+4cZCY1vYZvldQxZTJjp3pV39HdFgpmbXKaIJGbnSNJ+IXgSFOuDopFi7kNI51x+Ql 8keA== 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=Y1f1zVUcIfGMtPtzEI280CYiXGiuo59OfSlnqdhWSN8=; b=tE94Uzyupv1wr8jXT/FLU/zW0/cEb3ddOfsN/TR/LB35hot0Aw4A9w3M21mysx6g7n FY6VtPP0hr13E3A2mI3N8KCgNoUyOnvyPosC7eU7QkJSkOCe/30uzU3xyxJGpHZphDQF L94E9UypaqCllUj7el5GPt4AG1kkjtVe+AfG+2aOMeQvE5Lwyl6EtXBAJaBSZF+a4GW3 xhLVJWEFG9jw5C2hfArVVSTJyl4lcFmByBFOiFMzsjPjgoVtRgN39h++49HKxx2MAgfc lXADlE2asFvK2f9PJGykSpgkTeXHvkdx93Uz0aW2kZPrlgW3RTjpquZYhMA8NhZtdqbc wJjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dbQj6P92; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bo22si1903124ejb.369.2019.10.17.11.25.41; Thu, 17 Oct 2019 11:26:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=dbQj6P92; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406896AbfJPWFA (ORCPT + 99 others); Wed, 16 Oct 2019 18:05:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:52988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438325AbfJPV64 (ORCPT ); Wed, 16 Oct 2019 17:58:56 -0400 Received: from localhost (unknown [192.55.54.58]) (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 4C15E20872; Wed, 16 Oct 2019 21:58:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263135; bh=6Tth2jOeWpDQ2aUcTiGK2l5Bgddx8M/sL5/m/fEewoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dbQj6P92cG49D9P0zGqqvrMxbi7xH6PlbWeV8VcrseNx8xcYTmLN75cHuV7xAnCe/ IuAbhu8Ushz/PF66R3RCeWxDfxZcJDm8ZoZjtIIsaB5Sbg2dmqbcfvEmP5yzPdf1yU IImNoxLP0vsoX5/hQk0cBzofMcsGNXduMW/VWVvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Popa , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.3 059/112] iio: accel: adxl372: Fix/remove limitation for FIFO samples Date: Wed, 16 Oct 2019 14:50:51 -0700 Message-Id: <20191016214900.232869545@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@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: Stefan Popa commit d202ce4787e446556c6b9d01f84734c3f8174ba3 upstream. Currently, the driver sets the FIFO_SAMPLES register with the number of sample sets (maximum of 170 for 3 axis data, 256 for 2-axis and 512 for single axis). However, the FIFO_SAMPLES register should store the number of samples, regardless of how the FIFO format is configured. Signed-off-by: Stefan Popa Fixes: f4f55ce38e5f ("iio:adxl372: Add FIFO and interrupts support") Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/accel/adxl372.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/iio/accel/adxl372.c +++ b/drivers/iio/accel/adxl372.c @@ -474,12 +474,17 @@ static int adxl372_configure_fifo(struct if (ret < 0) return ret; - fifo_samples = st->watermark & 0xFF; + /* + * watermark stores the number of sets; we need to write the FIFO + * registers with the number of samples + */ + fifo_samples = (st->watermark * st->fifo_set_size); fifo_ctl = ADXL372_FIFO_CTL_FORMAT_MODE(st->fifo_format) | ADXL372_FIFO_CTL_MODE_MODE(st->fifo_mode) | - ADXL372_FIFO_CTL_SAMPLES_MODE(st->watermark); + ADXL372_FIFO_CTL_SAMPLES_MODE(fifo_samples); - ret = regmap_write(st->regmap, ADXL372_FIFO_SAMPLES, fifo_samples); + ret = regmap_write(st->regmap, + ADXL372_FIFO_SAMPLES, fifo_samples & 0xFF); if (ret < 0) return ret;