Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3777673imb; Tue, 5 Mar 2019 19:39:01 -0800 (PST) X-Google-Smtp-Source: APXvYqy9h+gNdty3dtGncNW6jybOXeGg5VTELfaKEhdGtvZ1HyNTx5bIfjNHVB0kTGdcRCSPK7lJ X-Received: by 2002:a63:eb56:: with SMTP id b22mr4401995pgk.287.1551843541440; Tue, 05 Mar 2019 19:39:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551843541; cv=none; d=google.com; s=arc-20160816; b=tPjx8FyZq5VbAwccuHWJa29sDHBcbcHJ5Wi8fLAdrB0MuNDIhrTqMHpj/SZxBbakx/ Y41cx95GFBmb8EOScpno2BZG9E4aJh1V3KANrIwpW46ATeJbGMf+iHAQ86ZMKMIoN6nm i1RV/W4B3kB6P/iXMhlSto6UUHSC3zUJneLFg+HRNNlGFldh0f3RdQF8Nv6Lc6WtyTJc mx/L998YLA75UxZK02OmQul+Y4N+mDZWPLe6fFi90pjYWN47s2wbI7txqLxShMGt4ud5 XR5qrCSkgjnxNxnKUtWGHoXZ/Tq5b7Rf98iHnhfpb6qCe0xoPEEVKaPdtSk7Pmo7Esyz bVQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from; bh=edbDh2mbFZW/pD031rxTUrUZFonriuVg+S7YGeEqS3M=; b=jt9NG3VPQa/RZ6teI0BNmk2BfLE0pTO6pbFvLlBgYotXZKwM4+PafXzbJ1qPwXbkI4 Zg9kQOxJXOBnX9DkvzIJjcSUgvXsY1OOgmVVHq4I0C9OBAYxF+FnfAEULz/nfE+KrAU7 +Kqo6cJsNuCus7tujhV23yEB/0dJDas/+oGj54gkzDIGANimDFRck1ksSxTo39olWjI6 7WlhSnTa8y8l9pkJ1Z23mFIzcgfsQqJM+gyLgJNtfQ5hwnEs68ubUoWnQ2QQ61ocV0W0 tg2PBZxjD87t2dkRe4qUKyj6qkFdrsTUWPOSc7cdffgtN6iH3fCb5zV4HOX4xTc19XeT laSA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f77si548580pfa.175.2019.03.05.19.38.44; Tue, 05 Mar 2019 19:39:01 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728616AbfCFCub (ORCPT + 99 others); Tue, 5 Mar 2019 21:50:31 -0500 Received: from mga18.intel.com ([134.134.136.126]:47833 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726430AbfCFCub (ORCPT ); Tue, 5 Mar 2019 21:50:31 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2019 18:50:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,446,1544515200"; d="scan'208";a="149634712" Received: from hu.sh.intel.com ([10.239.158.51]) by fmsmga004.fm.intel.com with ESMTP; 05 Mar 2019 18:50:27 -0800 From: "Chen, Hu" Cc: hu1.chen@intel.com, bo.he@intel.com, he@vger.kernel.org, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Hans de Goede , Stephan Gerhold , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] io: accel: kxcjk1013: restore the range after resume. Date: Wed, 6 Mar 2019 10:32:20 +0800 Message-Id: <20190306023224.23695-1-hu1.chen@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <23ced5ac-b0a0-7d87-76d7-bdec0c3e0e15@redhat.com> References: <23ced5ac-b0a0-7d87-76d7-bdec0c3e0e15@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "he, bo" On some laptops, kxcjk1013 is powered off when system enters S3. We need restore the range regiter during resume. Otherwise, the sensor doesn't work properly after S3. Signed-off-by: he, bo Signed-off-by: Chen, Hu --- v3: Avoid unnecessary mutex_unlock (Hans). v2: Handle return value independently (Jonathan). drivers/iio/accel/kxcjk-1013.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 7096e577b23f..50f3ff386bea 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1437,6 +1437,8 @@ static int kxcjk1013_resume(struct device *dev) mutex_lock(&data->mutex); ret = kxcjk1013_set_mode(data, OPERATION); + if (ret == 0) + ret = kxcjk1013_set_range(data, data->range); mutex_unlock(&data->mutex); return ret; -- 2.20.1