Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2241160imb; Sun, 3 Mar 2019 23:24:47 -0800 (PST) X-Google-Smtp-Source: APXvYqxplOBf8Zpex69PG7iC685kjgacHNm0AMUgvDI5E6X3UVGSZsercF7XYi1d9qp2joHEx7vU X-Received: by 2002:a17:902:ba8c:: with SMTP id k12mr19236069pls.193.1551684287534; Sun, 03 Mar 2019 23:24:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551684287; cv=none; d=google.com; s=arc-20160816; b=dTfoRp4udH2nvd+V7l76zHLGVV0BovbRxp5Npkskmu/K66AF7wPmSHuVxKnjcMIyx0 tTq9SgaewXdaWVsexdVs+3+kAlYDBwOT8ajbdanqD3biIZdDtKxLxx9nfmSnCChs7aI0 XtwUbol2DwlkB0lioauxjyPX79pF91igJrmjNXDFxo47HrillMlt0ENAdknh0NVka/mg ViBdU9k3zC9vENdiiGMLQ16F/Z8S+Aj8v5qiWjpsHV8Q0Z89YJNKGWXTnoKg2C61WbCp UgbdZ4x5dAW/AaozbDc6kFlhsHgCO+1lbWNjwnRxCCgwG/PSEs3T97J18lLUfS4lTDHz YImQ== 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=kuRUEwCj1Mt1t1IUEv3jZ0kiBxGxsS1kj6LgyairbtI=; b=lRbjvZ+JLOKbPgH3UgyG2h0p3/uKGiik9aj8EiX1ttx/jpYGxN+o+q58Zgfv2O+aPs D5YfPwPb3coEFgDnhwOp6TeN8L48XWPepM+JpJVNlm890ZNZLk+1iYvButT1McrOvIwG L46f55nHlB7pGrYlRWcObrL4tHrtjaDNdESLqNzAgNjqcmmUXuB6NDGaEXbibDbgUuyu ubSNxS5qwvTyRtPED1BsPM2k9cqfZBqzQ3MwseUqQIZZpYv9dJZVVzCJ59u1LseASdia nxgpWzBFlAnD1Uu4DZiQaQ+dCD+zxIhdd1lTtcQ5BNbwp9t5HF5wvb3KJqJhMVweeIZP 8Uaw== 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 b13si4326870pgt.374.2019.03.03.23.24.28; Sun, 03 Mar 2019 23:24:47 -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 S1726100AbfCDHYC (ORCPT + 99 others); Mon, 4 Mar 2019 02:24:02 -0500 Received: from mga04.intel.com ([192.55.52.120]:54407 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbfCDHYC (ORCPT ); Mon, 4 Mar 2019 02:24:02 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2019 23:24:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,439,1544515200"; d="scan'208";a="119387287" Received: from hu.sh.intel.com ([10.239.158.51]) by orsmga007.jf.intel.com with ESMTP; 03 Mar 2019 23:23:58 -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 v2] io: accel: kxcjk1013: restore the range after resume. Date: Mon, 4 Mar 2019 15:05:55 +0800 Message-Id: <20190304070556.24681-1-hu1.chen@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190303161728.3571869e@archlinux> References: <20190303161728.3571869e@archlinux> 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 --- Changes in v2: - Handle return value independently in resume callback. drivers/iio/accel/kxcjk-1013.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c index 7096e577b23f..17837e26bcf2 100644 --- a/drivers/iio/accel/kxcjk-1013.c +++ b/drivers/iio/accel/kxcjk-1013.c @@ -1437,6 +1437,11 @@ static int kxcjk1013_resume(struct device *dev) mutex_lock(&data->mutex); ret = kxcjk1013_set_mode(data, OPERATION); + if (ret < 0) { + mutex_unlock(&data->mutex); + return ret; + } + ret = kxcjk1013_set_range(data, data->range); mutex_unlock(&data->mutex); return ret; -- 2.20.1