Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2708716imu; Tue, 6 Nov 2018 20:53:46 -0800 (PST) X-Google-Smtp-Source: AJdET5e3yG+RsOFN/pvGz8anLBCcbQ4glYCFRLesjxPDfHTeFXyCO5Gff2j6+dIk/Q0xk+aCSzXx X-Received: by 2002:a62:ab05:: with SMTP id p5-v6mr433573pff.211.1541566426911; Tue, 06 Nov 2018 20:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541566426; cv=none; d=google.com; s=arc-20160816; b=gTm134YdtC5Qj7AU+x18Stj6+bUHvxbQ0OX4bWQECMzvkw1lXAdNmoRDmrODNOFpOy ZRQzTNK4giEQUETGmedqkgZ70YFgoO+uvewLqRi6Q3M8cMZMDDAYP2dziDxsjJjhek2u glZF/J3oX5Whg82h0G5YULYs510v86sD12GVN5tuJpHpbhruAbmb3gzXoR+oJY4XZuf/ XBPGUzdCgNKHSWgIg5sQ/wrms1Li08k8UnvC7CXTqjSUYIyxV4FvEfXK/u6cWRlG8Hk2 5o+8D/mGwNYik5EMzbsXoyBJGCvUkcqk8zJmUvanZzj2P7KqPr8KjxtfSYfIFrjZXCv1 IP5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=gH82XB1mpX20Z4i5dO+fjlqW7wudLAc2+sqSLcMFRLo=; b=XwmRX2M/0gGq1DX/mVlq+jCnWHb/PQFYK1tY43/j8u5gs41De9xeJCzy7y+lTV1vfQ 1ze/nikHLcaDmaS0EjZDeOoueVZ5mvHKflK3+zVIpzVitfurTyWwZD/JqcmjjlhIJ2L/ prGcccRTz7qDCb6Py2RYHcwrdSFTt3yRLZ24/bcWMvEtj25kxdY/iH0OhjiyFZ2TTmdM tm7WzBvJkR+buKYCPepRfvQ4Pow/OmTTm8Z2xDOd1mGzbgdF0pzHqcgaKZmMwF2XY6nl ZCxo6mCYK1o+9FYrPdHnz9imShGc8geO/q5T1cdQy27RAhw6tS02KQZKcEHehwUueo1v hOYQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10-v6si11596216pfh.223.2018.11.06.20.53.21; Tue, 06 Nov 2018 20:53:46 -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; 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; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389017AbeKGODL (ORCPT + 99 others); Wed, 7 Nov 2018 09:03:11 -0500 Received: from lelv0143.ext.ti.com ([198.47.23.248]:59424 "EHLO lelv0143.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387839AbeKGODK (ORCPT ); Wed, 7 Nov 2018 09:03:10 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id wA74YUb0130889; Tue, 6 Nov 2018 22:34:30 -0600 Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id wA74YUEk083956 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Nov 2018 22:34:30 -0600 Received: from DLEE112.ent.ti.com (157.170.170.23) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 6 Nov 2018 22:34:30 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 6 Nov 2018 22:34:30 -0600 Received: from ula0393675.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id wA74YOvl020896; Tue, 6 Nov 2018 22:34:28 -0600 From: Keerthy To: , , CC: , , , , Subject: [PATCH 1/2] opp: ti-opp-supply: Dynamically update u_volt_min Date: Wed, 7 Nov 2018 10:04:22 +0530 Message-ID: <1541565263-8296-2-git-send-email-j-keerthy@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1541565263-8296-1-git-send-email-j-keerthy@ti.com> References: <1541565263-8296-1-git-send-email-j-keerthy@ti.com> MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The voltage range (min, max) provided in the device tree is from the data manual and is pretty big, catering to a wide range of devices. On a i2c read/write failure the regulator_set_voltage_triplet function falls back to set voltage between min and max. The min value from Device Tree can be lesser than the optimal value and in that case that can lead to a hang or crash. Hence set the u_volt_min dynamically to the optimal voltage value. Fixes: 9a835fa6e47 ("PM / OPP: Add ti-opp-supply driver") Signed-off-by: Keerthy --- drivers/opp/ti-opp-supply.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/opp/ti-opp-supply.c b/drivers/opp/ti-opp-supply.c index 9e5a9a3..29e08a4 100644 --- a/drivers/opp/ti-opp-supply.c +++ b/drivers/opp/ti-opp-supply.c @@ -290,6 +290,9 @@ static int ti_opp_supply_set_opp(struct dev_pm_set_opp_data *data) vdd_uv = _get_optimal_vdd_voltage(dev, &opp_data, new_supply_vbb->u_volt); + if (new_supply_vdd->u_volt_min < vdd_uv) + new_supply_vdd->u_volt_min = vdd_uv; + /* Scaling up? Scale voltage before frequency */ if (freq > old_freq) { ret = _opp_set_voltage(dev, new_supply_vdd, vdd_uv, vdd_reg, -- 1.9.1