From patchwork Wed Mar 30 16:29:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 104965 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2692996lbc; Wed, 30 Mar 2016 09:29:51 -0700 (PDT) X-Received: by 10.66.244.233 with SMTP id xj9mr14618952pac.19.1459355391073; Wed, 30 Mar 2016 09:29:51 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n79si7474236pfi.149.2016.03.30.09.29.50; Wed, 30 Mar 2016 09:29:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-omap-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-omap-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-omap-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932209AbcC3Q3s (ORCPT + 3 others); Wed, 30 Mar 2016 12:29:48 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:57066 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932110AbcC3Q3q (ORCPT ); Wed, 30 Mar 2016 12:29:46 -0400 Received: from [64.55.107.4] (helo=finisterre) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1alIzz-0001BL-Au; Wed, 30 Mar 2016 16:29:39 +0000 Received: from broonie by finisterre with local (Exim 4.87) (envelope-from ) id 1alIzx-0007QT-D4; Wed, 30 Mar 2016 09:29:37 -0700 From: Mark Brown To: Tomi Valkeinen , Jean-Christophe Plagniol-Villard Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, Mark Brown Date: Wed, 30 Mar 2016 09:29:36 -0700 Message-Id: <1459355376-28507-1-git-send-email-broonie@kernel.org> X-Mailer: git-send-email 2.8.0.rc3 X-SA-Exim-Connect-IP: 64.55.107.4 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on mezzanine.sirena.org.uk X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.2 Subject: [PATCH] omapfb: Fix regulator API abuse in dss.c and hdmi4.c X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org The voltage changing code in this driver is broken and should be removed. The driver sets a single, exact voltage on probe. Unless there is a very good reason for this (which should be documented in comments) constraints like this need to be set via the machine constraints, voltage setting in a driver is expected to be used in cases where the voltage varies at runtime. In addition client drivers should almost never be calling regulator_can_set_voltage(), if the device needs to set a voltage it needs to set the voltage and the regulator core will handle the case where the regulator is fixed voltage. If the driver can skip setting the voltage it should just never set the voltage. Signed-off-by: Mark Brown --- drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 9 --------- drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c | 9 --------- 2 files changed, 18 deletions(-) -- 2.8.0.rc3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c index 0eec073b3919..cfd0e3d5f36a 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c @@ -1180,15 +1180,6 @@ static int dsi_regulator_init(struct platform_device *dsidev) return PTR_ERR(vdds_dsi); } - if (regulator_can_change_voltage(vdds_dsi)) { - r = regulator_set_voltage(vdds_dsi, 1800000, 1800000); - if (r) { - devm_regulator_put(vdds_dsi); - DSSERR("can't set the DSI regulator voltage\n"); - return r; - } - } - dsi->vdds_dsi_reg = vdds_dsi; return 0; diff --git a/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c b/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c index 7103c659a534..68b5ce1610ea 100644 --- a/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c +++ b/drivers/video/fbdev/omap2/omapfb/dss/hdmi4.c @@ -114,15 +114,6 @@ static int hdmi_init_regulator(void) return PTR_ERR(reg); } - if (regulator_can_change_voltage(reg)) { - r = regulator_set_voltage(reg, 1800000, 1800000); - if (r) { - devm_regulator_put(reg); - DSSWARN("can't set the regulator voltage\n"); - return r; - } - } - hdmi.vdda_reg = reg; return 0;