Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp733324ybc; Sat, 16 Nov 2019 07:45:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyEAcKZaoTQQJ3kN8npVhObzw3pNKSElt2dkJuN9NBb1Jol2xb3q+/UL1sm+RnCVyhk6FGd X-Received: by 2002:a17:906:505:: with SMTP id j5mr10690255eja.167.1573919140639; Sat, 16 Nov 2019 07:45:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573919140; cv=none; d=google.com; s=arc-20160816; b=dk713dojO8l7329vPIq7fbuiaUiROb6K+XzkYFvJIhJkJKZFkTn+BiFHjeJEgweAT7 YSh85g/UH1bp4kqVYAwRNfedaCoxgcxvlOUKFVc4XZrsy7GOX6clV/A3gwUmNF1nPqaW pw4xBpM/EsK2TobaXTL+vz1B6ziAjvsqxVcopiz4gBMOmZ0ICUt6HSr3cyL4n4QnKuGk DKn/eqKJdOfPb419zZEygJ2NUAg4ujGoOJy8vB+BEsamQf5r1MG7Tuuhd8W4vmNBKtY7 TQVB09rzJ5duhjjs3NOGSLfjz9Ey6k40hd11zqLwR/L/qJwNTpoz1Om+U6SkPaRUwxkJ /T4w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xpo1RwbITWBlxsvOWtxqgtfG919G+DwPk7Bizw55rnU=; b=V3UFb5QXjSU1hSHU7YK/AHpjgt2MoianRJ5M7l4j2PrCrF1+7oC4g53ibrVx8bFi4B rwsShVqJWH7YQ8u3fjm3Z5orGFWeU+Z9XSbIV6Gan8rj33Vn/8v+KZG9th7p5ytrshET j2s3JoBgQHI7xbAShhCl3pzHPbrGdQw8jDq+FgOLFwkPuW8KgeZf+1c37Zrk96+M65MK aMEu2uR/bmKrII+U5SaY3ILSF5hbusjYR3Zl+Nb6nGXC3gEphpZNdBMff7cy/us7qrjQ BgpH9cz+IO3bD+6U48TQHqHcCglhfEUiraiQcEm1qIHcbM9WEJYZaHjZjN+v9ORvH5oQ vo4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=oL+VRJzv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si7935227eju.113.2019.11.16.07.45.15; Sat, 16 Nov 2019 07:45:40 -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; dkim=pass header.i=@kernel.org header.s=default header.b=oL+VRJzv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728749AbfKPPn3 (ORCPT + 99 others); Sat, 16 Nov 2019 10:43:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:47490 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728738AbfKPPn2 (ORCPT ); Sat, 16 Nov 2019 10:43:28 -0500 Received: from sasha-vm.mshome.net (unknown [50.234.116.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9D20E20815; Sat, 16 Nov 2019 15:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573919007; bh=vmPorgr1AqtidpatjFnUpqU7k2gwi5CeAXMZW/HP/W8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oL+VRJzvCi3FJYjGL9WLaaGqg/Pget3WjSLzJmwVlsiiTzP3eac8yrrZW201yzwln t+lG5AAI5WnsNDc3W3kr4l5aCqEZ3kQJK6uU8grH3qwY4B8AIy53TeIq+h78/xi4sH /0U4tDboTKJBIwzLM7fimBVolBTH0XClbzzxH+ZY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fabio Estevam , Chris Healy , Lee Jones , Sasha Levin Subject: [PATCH AUTOSEL 4.19 110/237] mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values Date: Sat, 16 Nov 2019 10:39:05 -0500 Message-Id: <20191116154113.7417-110-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191116154113.7417-1-sashal@kernel.org> References: <20191116154113.7417-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fabio Estevam [ Upstream commit 55143439b7b501882bea9d95a54adfe00ffc79a3 ] When trying to read any MC13892 ADC channel on a imx51-babbage board: The MC13892 PMIC shutdowns completely. After debugging this issue and comparing the MC13892 and MC13783 initializations done in the vendor kernel, it was noticed that the CHRGRAWDIV bit of the ADC0 register was not being set. This bit is set by default after power on, but the driver was clearing it. After setting this bit it is possible to read the ADC values correctly. Signed-off-by: Fabio Estevam Tested-by: Chris Healy Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/mfd/mc13xxx-core.c | 3 ++- include/linux/mfd/mc13xxx.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c index 234febfe6398b..d0bf50e3568d7 100644 --- a/drivers/mfd/mc13xxx-core.c +++ b/drivers/mfd/mc13xxx-core.c @@ -278,7 +278,8 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, if (ret) goto out; - adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2; + adc0 = MC13XXX_ADC0_ADINC1 | MC13XXX_ADC0_ADINC2 | + MC13XXX_ADC0_CHRGRAWDIV; adc1 = MC13XXX_ADC1_ADEN | MC13XXX_ADC1_ADTRIGIGN | MC13XXX_ADC1_ASC; /* diff --git a/include/linux/mfd/mc13xxx.h b/include/linux/mfd/mc13xxx.h index 54a3cd808f9e6..2ad9bdc0a5ec8 100644 --- a/include/linux/mfd/mc13xxx.h +++ b/include/linux/mfd/mc13xxx.h @@ -249,6 +249,7 @@ struct mc13xxx_platform_data { #define MC13XXX_ADC0_TSMOD0 (1 << 12) #define MC13XXX_ADC0_TSMOD1 (1 << 13) #define MC13XXX_ADC0_TSMOD2 (1 << 14) +#define MC13XXX_ADC0_CHRGRAWDIV (1 << 15) #define MC13XXX_ADC0_ADINC1 (1 << 16) #define MC13XXX_ADC0_ADINC2 (1 << 17) -- 2.20.1