Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3385617pxb; Mon, 17 Jan 2022 19:16:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyQGl8sNuZ9pH2MF0o6Zna4b9eM9OaOTEeEa/b44j8rKikGNdKVJMkw2Qb650Go9i3CzRDt X-Received: by 2002:a63:b90e:: with SMTP id z14mr21500866pge.189.1642475794990; Mon, 17 Jan 2022 19:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642475794; cv=none; d=google.com; s=arc-20160816; b=Zu9OnvuEtZawHt/QkUDKPwFSEQSOJgV9Wcxqo9k8sYXVtogfb7zmKsu7XIFbmYaf2g lYRi4IFwsLW4IenHpo8uDToAxNoFZqOkkM6r4k6i1SA/Ai034jxVyxfiWIZwN48HMc3d r1v0XEqmv577/MkTq1XmN6U7Y73SuHVSxxdgLz+qhBfSSu5k6/L0LuplF+U7lvJ8kk9i zsqFFIod/tpdq4zts4IWNPU8czIIRltgF3HRFhAap2DZtq+Zu+qTdxK99hcp8eXJmhoQ /urbFP5BfG5Kle3hRJJ8d8gGIsGfcAG4TcgK0Zubozm4jf4ODIAL3bQh2gqaGYrGHlYu 962w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gmUfoLBonp2GzQb+ELK9Di2TXy4TXAJI4QD6FiC5gc0=; b=W+vMRi6gzN6CS2Otbl9t57sue6IUa5R5yOWM1yEYi9jAOpAYxYEk8KfL3HnY02ox/Y s+12QlPQ69PAX5kWTHQGuYslt41mnRG6dU7dmZHhS5ARAXTzxWRfl3tXITavOn6cv4uG 8BMVJ9kboDrq4rSc9Qe4H4GNSlo6IBTTFaM7p7KhSY0EdCJPo7FRTnpHVA2zs9Dx0swD +LGuEgnEFYhRwc8Yt+1BHobA/oSVKQi7fB+7/G1+ZSppPzfU9PJjmsBCvTjalB5AtdB8 0fmlWlv8FDdQJcRtWwzI1/gT/LYyVrjNNfcRr89O55pqcMswsJ+niH/wz0daBEglaA4N ovYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o2wMVLFU; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si1318962pjl.107.2022.01.17.19.16.20; Mon, 17 Jan 2022 19:16:34 -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=@kernel.org header.s=k20201202 header.b=o2wMVLFU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245123AbiARC0U (ORCPT + 99 others); Mon, 17 Jan 2022 21:26:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244638AbiARCYS (ORCPT ); Mon, 17 Jan 2022 21:24:18 -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 07E28C0617BF; Mon, 17 Jan 2022 18:23:53 -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 ACC6CB81250; Tue, 18 Jan 2022 02:23:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB413C36AF2; Tue, 18 Jan 2022 02:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472630; bh=AXo2SKIfBrFl+rOiVbbS6B5EIC7YCr/SvPrUDVh/G4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o2wMVLFUeDteY3zngSVAwfw7/KOk/4SbouEIE5nj6XkRauG3DoARf6u+E0HdNpGQS oOz5LBVYjAxjcpuIm/ZIV50Wrcw7i24xB8XwksxvbN44/7NJSDutbZz3IhEVCPWCzx HPaB9URKZcOrseraDMkt/p+ekGHV7sEIsOIWkUbgRTVE7tEspMH2lYyQ6FxfePGhf/ Jqm2U5CF4IwudkGw28WATdAaJ/bdtMYyReymZLqXZfdCMV0bPu7pIpXNNGLZwqq2+g M6/FVnLToxxdSR4QmrhXEubOTu9CMMJhbWVBmmn01lb4viM5uULrcacKWIxc0MC304 KBqAD7nlmYWSw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Adam Ward , Mark Brown , Sasha Levin , support.opensource@diasemi.com, lgirdwood@gmail.com Subject: [PATCH AUTOSEL 5.16 081/217] regulator: da9121: Prevent current limit change when enabled Date: Mon, 17 Jan 2022 21:17:24 -0500 Message-Id: <20220118021940.1942199-81-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Adam Ward [ Upstream commit 24f0853228f3b98f1ef08d5824376c69bb8124d2 ] Prevent changing current limit when enabled as a precaution against possibile instability due to tight integration with switching cycle Signed-off-by: Adam Ward Link: https://lore.kernel.org/r/52ee682476004a1736c1e0293358987319c1c415.1638223185.git.Adam.Ward.opensource@diasemi.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/da9121-regulator.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/regulator/da9121-regulator.c b/drivers/regulator/da9121-regulator.c index e669250902580..0a4fd449c27d1 100644 --- a/drivers/regulator/da9121-regulator.c +++ b/drivers/regulator/da9121-regulator.c @@ -253,6 +253,11 @@ static int da9121_set_current_limit(struct regulator_dev *rdev, goto error; } + if (rdev->desc->ops->is_enabled(rdev)) { + ret = -EBUSY; + goto error; + } + ret = da9121_ceiling_selector(rdev, min_ua, max_ua, &sel); if (ret < 0) goto error; -- 2.34.1