Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153AbcDUMCh (ORCPT ); Thu, 21 Apr 2016 08:02:37 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:49829 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751584AbcDUMCg (ORCPT ); Thu, 21 Apr 2016 08:02:36 -0400 Authentication-Results: ppops.net; spf=none smtp.mail=rf@opensource.wolfsonmicro.com From: Richard Fitzgerald To: CC: , , Subject: [PATCH] regulator: arizona-ldo1: Mark as always-on if no LDOENA Date: Thu, 21 Apr 2016 13:02:02 +0100 Message-ID: <1461240122-3942-1-git-send-email-rf@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1604210197 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1378 Lines: 41 If we don't have a GPIO for LDOENA it's impossible to turn the LDO1 regulator off so mark it as always-on. Signed-off-by: Richard Fitzgerald --- drivers/regulator/arizona-ldo1.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index f7c88ff..cc62ea2 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c @@ -290,9 +290,9 @@ static int arizona_ldo1_probe(struct platform_device *pdev) config.ena_gpio = arizona->pdata.ldoena; if (arizona->pdata.ldo1) - config.init_data = arizona->pdata.ldo1; - else - config.init_data = &ldo1->init_data; + ldo1->init_data = *arizona->pdata.ldo1; + + config.init_data = &ldo1->init_data; /* * LDO1 can only be used to supply DCVDD so if it has no @@ -301,6 +301,13 @@ static int arizona_ldo1_probe(struct platform_device *pdev) if (config.init_data->num_consumer_supplies == 0) arizona->external_dcvdd = true; + if (!arizona->external_dcvdd && (config.ena_gpio == 0) && + !config.ena_gpio_initialized) { + dev_warn(arizona->dev, + "No LDOENA: regulator will be always-on\n"); + ldo1->init_data.constraints.always_on = true; + } + ldo1->regulator = devm_regulator_register(&pdev->dev, desc, &config); of_node_put(config.of_node); -- 1.9.1