Received: by 10.192.165.156 with SMTP id m28csp433672imm; Thu, 19 Apr 2018 01:22:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+16DrZd3r3KI3NSAghH30ujrgN4D+Bfq9OWwtg8qw8PGdOgCVaaPtOJQHzQDbhpZ5jNdDT X-Received: by 10.101.93.14 with SMTP id e14mr4355433pgr.353.1524126179578; Thu, 19 Apr 2018 01:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524126179; cv=none; d=google.com; s=arc-20160816; b=oPPbXf2861BiK7+E67xm6IXy5Lzt1Aa5tzM3Ulv5alQkgSzhxA9W+zHBRyIaaz/0Qm +UsyDD2H5K9yCz9wRIVvTuTfdMcZcrRn+v6hvIbBEgB9PMKPNpo3noU1JseRmNf6YJNz fIMLI3FHn45o/7VVb4Tum2usCZbwYaPqxwfrZ3nXzCL/tstzH547JU/5jogT0EKB2rRz eMt4kZFKxY9kRLaFtMDCrxoWPDulIU7azEDG80YlurQ4Phkcu7LlMIWtdi98b+xERPHS /sCoONuFQBmdBbsqo4xu5zFSrgKk+mNr32Z1riQkcOIHFazxq2ks4UPY/C6axkBu2Mf8 XBVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:organization:message-id:date:subject:cc:to :from:dkim-signature:arc-authentication-results; bh=V6VLh2nT+Abn2HE72szniZO6SnubXDoVddrQX12kX10=; b=vm98Es4lc8BBG2mh3QBSpR0j87AKLLZma7MbJmZdMr4Y2q1I6XdIUelvMBk9IElgfb PL1qhpQubK/ikaUZN8Uip+RADpeUHKokAh4c0atIdC+9KiVrz3Sxe5mZ7ngSgfA0Ll2x FkrrspREnyJPiiXHlpxExrHDKgXpnt8YRkw376jC/QFWeLyzcRAkV2kesFKn1p+U8KVm SAv6TfO6fUFZXw2HDBjUaOox16GMozGcDGc595jDL1V8OGmnkxBWeHu6HeQSMRnwN3lg 7zO+abCZX8y8HF6WBwR2AHnnFTiSrVW89WG4oS+MHic5ymUT8zdsg3FDtVhqg8/nrcde ugqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=bf1OlVAS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2-v6si1916819pll.186.2018.04.19.01.22.46; Thu, 19 Apr 2018 01:22:59 -0700 (PDT) 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; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=bf1OlVAS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752970AbeDSIUd (ORCPT + 99 others); Thu, 19 Apr 2018 04:20:33 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:34296 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751070AbeDSIU3 (ORCPT ); Thu, 19 Apr 2018 04:20:29 -0400 Received: from avalon.localnet (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7072C5A53; Thu, 19 Apr 2018 10:20:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1524126028; bh=ftovIo+1h/NfTu4QPxwYMjej99n+IpFfpdxFeCxLXeo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bf1OlVASpr7XxYfUj45/Ir+brraTlpySKq2yQt332LkLLQopPzthE+L8dOamahMny Zst0uUPp5HyzjsUGO5v6t1Gj7V3lyYLSdrxQ8PkJ9B616r57W/SYgoV/NkANjtGN8Q ouhvHMMJPbdmIZDw/1PYRMMX8YJ0HaeWoPmXju14= From: Laurent Pinchart To: Philippe Cornu Cc: Archit Taneja , Andrzej Hajda , David Airlie , Rob Herring , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Yannick Fertre , Benjamin Gaignard , Alexandre Torgue Subject: Re: [PATCH 2/2] drm/bridge: sii902x: add optional power supplies Date: Thu, 19 Apr 2018 11:20:37 +0300 Message-ID: <3775994.jviQhGlOpf@avalon> Organization: Ideas on Board Oy In-Reply-To: <20180410051927.8268-3-philippe.cornu@st.com> References: <20180410051927.8268-1-philippe.cornu@st.com> <20180410051927.8268-3-philippe.cornu@st.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Philippe, Thank you for the patch. On Tuesday, 10 April 2018 08:19:27 EEST Philippe Cornu wrote: > Add the 3 optional power supplies using the exact description > found in the document named > "SiI9022A/SiI9024A HDMI Transmitter Data Sheet (August 2016)". > > Signed-off-by: Philippe Cornu > --- > drivers/gpu/drm/bridge/sii902x.c | 39 +++++++++++++++++++++++++++++++++---- > 1 file changed, 35 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/sii902x.c > b/drivers/gpu/drm/bridge/sii902x.c index 60373d7eb220..e17ba6db1ec8 100644 > --- a/drivers/gpu/drm/bridge/sii902x.c > +++ b/drivers/gpu/drm/bridge/sii902x.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -86,6 +87,7 @@ struct sii902x { > struct drm_bridge bridge; > struct drm_connector connector; > struct gpio_desc *reset_gpio; > + struct regulator_bulk_data supplies[3]; > }; > > static inline struct sii902x *bridge_to_sii902x(struct drm_bridge *bridge) > @@ -392,23 +394,43 @@ static int sii902x_probe(struct i2c_client *client, > return PTR_ERR(sii902x->reset_gpio); > } > > + sii902x->supplies[0].supply = "iovcc"; > + sii902x->supplies[1].supply = "avcc12"; > + sii902x->supplies[2].supply = "cvcc12"; > + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies), > + sii902x->supplies); > + if (ret) { > + dev_err(dev, "regulator_bulk_get failed\n"); Maybe "failed to get power supplies" to be a bit more explicit ? And while at it, printing the value of ret too ? > + return ret; > + } > + > + ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies), > + sii902x->supplies); > + if (ret) { > + dev_err(dev, "regulator_bulk_enable failed\n"); Same here ? > + return ret; > + } > + > + usleep_range(10000, 20000); > + > sii902x_reset(sii902x); > > ret = regmap_write(sii902x->regmap, SII902X_REG_TPI_RQB, 0x0); > if (ret) > - return ret; > + goto err_disable_regulator; > > ret = regmap_bulk_read(sii902x->regmap, SII902X_REG_CHIPID(0), > &chipid, 4); > if (ret) { > dev_err(dev, "regmap_read failed %d\n", ret); > - return ret; > + goto err_disable_regulator; > } > > if (chipid[0] != 0xb0) { > dev_err(dev, "Invalid chipid: %02x (expecting 0xb0)\n", > chipid[0]); > - return -EINVAL; > + ret = -EINVAL; > + goto err_disable_regulator; > } > > /* Clear all pending interrupts */ > @@ -424,7 +446,7 @@ static int sii902x_probe(struct i2c_client *client, > IRQF_ONESHOT, dev_name(dev), > sii902x); > if (ret) > - return ret; > + goto err_disable_regulator; > } > > sii902x->bridge.funcs = &sii902x_bridge_funcs; > @@ -434,6 +456,12 @@ static int sii902x_probe(struct i2c_client *client, > i2c_set_clientdata(client, sii902x); > > return 0; > + > +err_disable_regulator: > + regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), > + sii902x->supplies); > + > + return ret; > } > > static int sii902x_remove(struct i2c_client *client) > @@ -443,6 +471,9 @@ static int sii902x_remove(struct i2c_client *client) > > drm_bridge_remove(&sii902x->bridge); > > + regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), > + sii902x->supplies); > + While this seems functionally correct, would it be useful to only enable power supplies when needed to save power ? > return 0; > } -- Regards, Laurent Pinchart