Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3724450pxb; Mon, 24 Jan 2022 16:23:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpTL3A+VvFqtkhDjdW+DUenkD2P6GqcnfwlPQJNp1+wGWSyQGv06CmiG6/D7FWMur9QOLN X-Received: by 2002:a63:6c84:: with SMTP id h126mr13611305pgc.148.1643070204585; Mon, 24 Jan 2022 16:23:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643070204; cv=none; d=google.com; s=arc-20160816; b=EQ7ywDJ5nwG3i2GjqRAqBGTTeWvlds+4sJGIK9/xa3o2u3jS6uQk+pkExoIoTkR/hz 76AWACdYgVOXDwq/FoL5mu/Xj43PWt5iXYIvngc60VBNGRRod12IE+88sj7nezfJZ4QH jWCUWiBsMBULKmxhenJ/tpWDUwYqHh05XKNyTpYG2cetqMPY/SJGfVHmN5ECFGwO9FN8 A83VAw4l17CVa/KfS6CJJsLN21w4uM7jDwV2s3CYreCAV/8apJyqwhwDmA/BsDiRne2P 3RJlsebwszmq1ew2j2CC+Ys4TSJywz69mJtflcCJYRJeEXNnZM/w2fXBFcTac+uvywC+ BXjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9172myW/NqTgh0L7sXUQPh9tyxnQgeSnqpGfNt+y4Jo=; b=0bT+iat4oguPbBbse4IMnAEjWs5WfOJlJnvLM3To0nknvgtAii9CBJEt5A7sGpdcaC wd7N4/skj9cuSBBfwZjZPr4eb2EWR6e0GkiTbKIInzswvELXdrXxnxi6nrIFv9uFDlDL QcmvHhlaI6z6FPGOjs/tUmkWYDWgI77rIfi/omvi/p9JgqSAwQ22+ty9G/EIPWjMCtD9 Cqi+rOmbi44TBiOVSeMVUnLJrtGWXVuD/ZJtejuBh3j+l4spFq73JEk149yihaAVUAcO yDgm/IHHqG/nUmSDYqBKfbDMlKFiZ8pxAUfXudQlMKTIuE76TfBYka2EZ9uhtCSjuYI+ rlKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2crNjcGr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s79si15436575pgs.344.2022.01.24.16.23.12; Mon, 24 Jan 2022 16:23:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=2crNjcGr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2374453AbiAYARE (ORCPT + 99 others); Mon, 24 Jan 2022 19:17:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1850701AbiAXXah (ORCPT ); Mon, 24 Jan 2022 18:30:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13DDAC07595C; Mon, 24 Jan 2022 13:35:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CAFD2B80CCF; Mon, 24 Jan 2022 21:35:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BC8AC340E4; Mon, 24 Jan 2022 21:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060106; bh=2XYLbk5nhzUYg8pfk+MC07Cy/191v7DzF5yYA5/9A2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2crNjcGraS2Qb0DqyzfY9o22BuSUa545pUfqggfpIhAijd6Lan9nnXq0mbwOmWyVN Ubts6YHatFNcvhZWstCpw1MGJPikvjQFdQNReaEgEe0MzuvLJnrfKlHL4/fpFLWa/R FR7dibf5rT6e4mal/qpTmgXkVoQyLk68QWWuO8sw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Lee Jones , Svyatoslav Ryhel Subject: [PATCH 5.16 0842/1039] mfd: tps65910: Set PWR_OFF bit during driver probe Date: Mon, 24 Jan 2022 19:43:51 +0100 Message-Id: <20220124184153.596841349@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 7620ad0bdfac1efff4a1228cd36ae62a9d8206b0 upstream. The PWR_OFF bit needs to be set in order to power off properly, without hanging PMIC. This bit needs to be set early in order to allow thermal protection of NVIDIA Terga SoCs to power off hardware properly, otherwise a battery re-plug may be needed on some devices to recover after the hang. Cc: Signed-off-by: Dmitry Osipenko Tested-by: Svyatoslav Ryhel # ASUS TF201 Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211124190104.23554-1-digetx@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/mfd/tps65910.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) --- a/drivers/mfd/tps65910.c +++ b/drivers/mfd/tps65910.c @@ -436,15 +436,6 @@ static void tps65910_power_off(void) tps65910 = dev_get_drvdata(&tps65910_i2c_client->dev); - /* - * The PWR_OFF bit needs to be set separately, before transitioning - * to the OFF state. It enables the "sequential" power-off mode on - * TPS65911, it's a NO-OP on TPS65910. - */ - if (regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, - DEVCTRL_PWR_OFF_MASK) < 0) - return; - regmap_update_bits(tps65910->regmap, TPS65910_DEVCTRL, DEVCTRL_DEV_OFF_MASK | DEVCTRL_DEV_ON_MASK, DEVCTRL_DEV_OFF_MASK); @@ -504,6 +495,19 @@ static int tps65910_i2c_probe(struct i2c tps65910_sleepinit(tps65910, pmic_plat_data); if (pmic_plat_data->pm_off && !pm_power_off) { + /* + * The PWR_OFF bit needs to be set separately, before + * transitioning to the OFF state. It enables the "sequential" + * power-off mode on TPS65911, it's a NO-OP on TPS65910. + */ + ret = regmap_set_bits(tps65910->regmap, TPS65910_DEVCTRL, + DEVCTRL_PWR_OFF_MASK); + if (ret) { + dev_err(&i2c->dev, "failed to set power-off mode: %d\n", + ret); + return ret; + } + tps65910_i2c_client = i2c; pm_power_off = tps65910_power_off; }