From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755122AbcKJETD (ORCPT ); Wed, 9 Nov 2016 23:19:03 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:15889 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbcKJETB (ORCPT ); Wed, 9 Nov 2016 23:19:01 -0500 X-Greylist: delayed 431 seconds by postgrey-1.27 at vger.kernel.org; Wed, 09 Nov 2016 23:19:00 EST Subject: Re: [PATCH 2/4] mfd: palmas: Reset the POWERHOLD mux during power off To: Lee Jones References: <1477559414-12520-1-git-send-email-j-keerthy@ti.com> <1477559414-12520-3-git-send-email-j-keerthy@ti.com> <20161109161419.GJ13127@dell> CC: , , , , , , , From: Keerthy Message-ID: <7f78b9be-8f47-c4f6-7392-15d9b1441496@ti.com> Date: Thu, 10 Nov 2016 09:48:51 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20161109161419.GJ13127@dell> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 09 November 2016 09:44 PM, Lee Jones wrote: > On Thu, 27 Oct 2016, Keerthy wrote: > >> POWERHOLD signal has higher priority over the DEV_ON bit. >> So power off will not happen if the POWERHOLD is held high. >> Hence reset the MUX to GPIO_7 mode to release the POWERHOLD >> and the DEV_ON bit to take effect to power off the PMIC. >> >> PMIC Power off happens in dire situations like thermal shutdown >> so irrespective of the POWERHOLD setting go ahead and turn off >> the powerhold. Currently poweroff is broken on boards that have >> powerhold enabled. This fixes poweroff on those boards. >> >> Signed-off-by: Keerthy >> --- >> drivers/mfd/palmas.c | 18 ++++++++++++++++++ >> 1 file changed, 18 insertions(+) >> >> diff --git a/drivers/mfd/palmas.c b/drivers/mfd/palmas.c >> index 8f8bacb..8fbc5e0 100644 >> --- a/drivers/mfd/palmas.c >> +++ b/drivers/mfd/palmas.c >> @@ -430,10 +430,28 @@ static void palmas_power_off(void) >> { >> unsigned int addr; >> int ret, slave; >> + struct device_node *node; >> + bool override_powerhold; >> >> if (!palmas_dev) > > Can this happen? pm_power_off and palmas_dev are always assigned together. You are right this is redundant and can be removed. > >> return; >> >> + node = palmas_dev->dev->of_node; > > Just do: > > struct device_node *np = palmas_dev->dev->of_node; > >> + override_powerhold = of_property_read_bool(node, >> + "ti,palmas-override-powerhold"); > > Break the line after the '=' instead. okay. > >> + if (override_powerhold) { > > if (of_property_read_bool(node, "ti,palmas-override-powerhold")) > > Then remove 'override_powerhold'. Okay. > >> + addr = PALMAS_BASE_TO_REG(PALMAS_PU_PD_OD_BASE, >> + PALMAS_PRIMARY_SECONDARY_PAD2); >> + slave = PALMAS_BASE_TO_SLAVE(PALMAS_PU_PD_OD_BASE); >> + >> + ret = regmap_update_bits(palmas_dev->regmap[slave], addr, >> + PALMAS_PRIMARY_SECONDARY_PAD2_GPIO_7_MASK, 0); >> + if (ret) >> + pr_err("%s: Unable to write PALMAS_PRIMARY_SECONDARY_PAD2 %d\n", >> + __func__, ret); > > Don't use __func__ in live code. okay. > > And use dev_err(); sure. > > >> + } >> + >> slave = PALMAS_BASE_TO_SLAVE(PALMAS_PMU_CONTROL_BASE); >> addr = PALMAS_BASE_TO_REG(PALMAS_PMU_CONTROL_BASE, PALMAS_DEV_CTRL); >> >