Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp5992932ybc; Wed, 27 Nov 2019 13:03:55 -0800 (PST) X-Google-Smtp-Source: APXvYqyKN2nbykFw7DuU6SLPrqtgKV388n0u05fsFtQcY+SGoIiDJOSh0q5W0IXd4eRyPNvzBLnN X-Received: by 2002:a17:906:52c4:: with SMTP id w4mr49182433ejn.99.1574888635186; Wed, 27 Nov 2019 13:03:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574888635; cv=none; d=google.com; s=arc-20160816; b=VtG8tUxKZ7ZkrjOi0RSV1SWc/CyK8j0PVY8ieTob7KzfQglJjUgZmUoK1LympCFbEY 09Y7VoFTZscNVLjao9KQC4VzcVb0bTc+yV9uaakMfGe1gfHChGWz0P4YqDyPX9OjnGan Otr8AB8yp1Roaig7YQGsLtDWSfHLYyeEbNrhcHYlaBr5/H7NBof3WK2AHlYIJ4C11XfO V1A7eMc46f2yCPO2TEAsUOjnj4omd/JnxQAlYItMyLrgCZhLYvbRupc/sXlsNAytJBVC h3vVQiCGSe/SPrsbN2q7G3SHl8+SIbaYYZp5WL4SnxAXvAj6bxSW7kmsnRHwagUcwx0T pORQ== 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=xpo1RwbITWBlxsvOWtxqgtfG919G+DwPk7Bizw55rnU=; b=e93WcJzKvHKvQWqiC/vB94/F7oMm7UZAl+MTXqjxdML744Y60PDq4jSxS3rO84AmrH /YxNizzP2jFG/mPRG5OMkla/tNsw9EdFastGZYWZQECbuDQzaGt56CMxGLrRoluku4E3 svXx5sK7WG661j262CUUY4LZeCublSsXT0h1FtlU/b7ctHqXV8xyd3IqU+WtzP4j6ye9 57sOis44Kbp9rP7Ohcd1PImSbl3vibBsqMlg5noWg8FcL1Y9lgQhcQiQugZ3bicRao+V CuuKfqw4BhJNOYmuS2GoQ4HHj2OknGwDGrEcw0BEdBhiQgVsWvFStu/gYqqFd3NdOn1p A96A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="w/0Vy8wV"; 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 cw24si893984edb.382.2019.11.27.13.03.19; Wed, 27 Nov 2019 13:03:55 -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="w/0Vy8wV"; 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 S1731565AbfK0VA2 (ORCPT + 99 others); Wed, 27 Nov 2019 16:00:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:52332 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731554AbfK0VA0 (ORCPT ); Wed, 27 Nov 2019 16:00:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 77B082084B; Wed, 27 Nov 2019 21:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888425; bh=vmPorgr1AqtidpatjFnUpqU7k2gwi5CeAXMZW/HP/W8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w/0Vy8wVmtDZlnfhw7cAhghtnc3ZgA05CWngZMWtPXAw4kC6WvNnH5EG27fMHfvI3 zMcJi3IrGUlc2kXu7qk1RmP5ykZGOiXA8BdDmfEr+ZL4l633bTuDAnKjYQTKdCkzKE QjNclvkOBh/YLOJ1R4l0ibMII9rYvdS8zmFVcxhw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Chris Healy , Lee Jones , Sasha Levin Subject: [PATCH 4.19 128/306] mfd: mc13xxx-core: Fix PMIC shutdown when reading ADC values Date: Wed, 27 Nov 2019 21:29:38 +0100 Message-Id: <20191127203124.455975953@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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: 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