From patchwork Wed Sep 27 19:29:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 9974601 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7D07460375 for ; Wed, 27 Sep 2017 19:29:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6D589292E5 for ; Wed, 27 Sep 2017 19:29:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61C84292EA; Wed, 27 Sep 2017 19:29:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC996292E5 for ; Wed, 27 Sep 2017 19:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751154AbdI0T3e (ORCPT ); Wed, 27 Sep 2017 15:29:34 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35280 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbdI0T3d (ORCPT ); Wed, 27 Sep 2017 15:29:33 -0400 Received: by mail-wr0-f194.google.com with SMTP id n64so6170947wrb.2 for ; Wed, 27 Sep 2017 12:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BC8WIVXXe/2qR0smS5b+Eua8k2bSsahjEO/5BDKGtDI=; b=vZ7vlxQQnPF1SKknz4jzqOGVDrZzVyNdPxTTnpKXc9L7qNSSnEuGsWf7QvGLbgwNwd BmWE836jxveZLlMJXmxk+B0Q4QwRsKlPw/37CkgvgvTOMlEGdd3f2soH8ecbRBt4clhg 2xiwnQ68gBOWo/SgcpBSH0J4J7HXBS//fbKD84QeQfuN86ou4YYn+nyUx4dZ6MKhiyxt viczSRkmI67JYq1RRRg6ICJEEE9dRjhchRGwekCAbvkaXg7VAl8ia56l5YBM0htbFtAY yiiQcs7Z7db+S1QEWjdYs81ijq0du/QA0GHw28DMnmVneDZ7oj0j70VMYU7j56Ukl8OF Yczg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BC8WIVXXe/2qR0smS5b+Eua8k2bSsahjEO/5BDKGtDI=; b=LmJlyLF4if7KkIHTWQOlwl766S0bjzNwauAmgtO38d+Nk4jmV3WS8JYroIRu/qRPHt ajdgfEJFuLQWV9z8EhJVPCQJPp87621ttRO7tA1ANZIVWdddiYI1NEWsdV5Rqahvdoe2 CPuUkG46UGJqIP7j6P3mdmeR1NH1+t+OxNg6V87wH/oSVEPIsWoW0VWaDUP9wCvarlZi +X4DJqb7zHjq0+7WzaqOkQXoMro7TlZ7pPyg0KTePQ85r43amIZvGb6UbthPz6ODPoai /TncXoDxvQBQCWIPL0IdG9bQjIzFwoMnLoClB/xrDhHX3Vs3JXt2Gcz/Kl1pRTEgXQs1 Ituw== X-Gm-Message-State: AHPjjUhWMaRhzxizP5bSzlCiMAtlRdY9TgpCMv3eVewNWxWHsHXv/qxg 1JmzYBiyH3sFWDKwYdycCDY= X-Google-Smtp-Source: AOwi7QAV3whNcQrNrLyFFx5TYekEjDza1YeEfYctp89lsIISyl23xN/QH4KYLo6VbZ097xAhLj8JkA== X-Received: by 10.223.186.6 with SMTP id o6mr2151709wrg.263.1506540572386; Wed, 27 Sep 2017 12:29:32 -0700 (PDT) Received: from localhost.localdomain ([151.66.56.134]) by smtp.gmail.com with ESMTPSA id k52sm20702238wrf.62.2017.09.27.12.29.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Sep 2017 12:29:31 -0700 (PDT) From: Lorenzo Bianconi X-Google-Original-From: Lorenzo Bianconi To: jic23@kernel.org Cc: linux-iio@vger.kernel.org, lorenzo.bianconi@st.com Subject: [PATCH 1/4] iio: imu: st_lsm6dsx: convert max_fifo_size in fifo words Date: Wed, 27 Sep 2017 21:29:25 +0200 Message-Id: <20170927192928.16160-2-lorenzo.bianconi@st.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170927192928.16160-1-lorenzo.bianconi@st.com> References: <20170927192928.16160-1-lorenzo.bianconi@st.com> Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Express max fifo depth in fifo words instead of in bytes. That change will be necessary to properly support more devices in st_lsm6dsx driver Signed-off-by: Lorenzo Bianconi --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index debf4064f474..e6e0363cd1c2 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -156,21 +156,21 @@ static const struct st_lsm6dsx_fs_table_entry st_lsm6dsx_fs_table[] = { static const struct st_lsm6dsx_settings st_lsm6dsx_sensor_settings[] = { { .wai = 0x69, - .max_fifo_size = 8192, + .max_fifo_size = 1365, .id = { [0] = ST_LSM6DS3_ID, }, }, { .wai = 0x69, - .max_fifo_size = 4096, + .max_fifo_size = 682, .id = { [0] = ST_LSM6DS3H_ID, }, }, { .wai = 0x6a, - .max_fifo_size = 4096, + .max_fifo_size = 682, .id = { [0] = ST_LSM6DSL_ID, [1] = ST_LSM6DSM_ID, @@ -462,10 +462,9 @@ static int st_lsm6dsx_set_watermark(struct iio_dev *iio_dev, unsigned int val) { struct st_lsm6dsx_sensor *sensor = iio_priv(iio_dev); struct st_lsm6dsx_hw *hw = sensor->hw; - int err, max_fifo_len; + int err; - max_fifo_len = hw->settings->max_fifo_size / ST_LSM6DSX_SAMPLE_SIZE; - if (val < 1 || val > max_fifo_len) + if (val < 1 || val > hw->settings->max_fifo_size) return -EINVAL; err = st_lsm6dsx_update_watermark(sensor, val);