Received: by 10.192.165.148 with SMTP id m20csp392871imm; Wed, 25 Apr 2018 00:55:45 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Ye0jxJa2UJ9hnOnwIadO7xbu77TIy88CmvgLBJfGoyGUAfHKOuPjzQdJPpSxtYSBrSnEd X-Received: by 10.101.68.129 with SMTP id l1mr23039872pgq.239.1524642945545; Wed, 25 Apr 2018 00:55:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524642945; cv=none; d=google.com; s=arc-20160816; b=WLjJFUMBFJL0C1SqqtpL697ZexRsO44Fc5l5mU5gWZ4gc8RVa7xdos/YV6Bl731Zm/ YeMn5PIkw0iI5z6CHmJlnoiESEXR6BY39DRvUUmHOAnxkyr5HOFpnVq0xkRAi3/r6JOV tKeTzVtnzfKxpkA0EC0tx25v9+n0YWTqrVcTocPvdCdnqMCtefyhaFLq222yiQykwG7h K+Ka616cALynWp36kx+Vt2+ChoJ5OKRgzNBp/FUbltHZuVMcd9JQvaODVukUuqa91/MV sngQbdIscEsrhM8m9xJAw7sjafWIEWHZgdzs7rzMS8DNUup1rbvZx1pBuUQSdUSvw3Tu Q+QA== 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:arc-authentication-results; bh=2A4fV9JHhM4tZOh027mLEvhggUc29+RS+sOzSoBi8Ls=; b=fQtqNzJnz1axTaZPqhGIn40Je63LtU9Tu2cb4pAL157AD3tsPlamnG6qXxUfvHJkaD vviN5qduNy9Y6oiR3nsZ72Vw4ZC0rkNAqmShvqCOUOeGsGPH+lZXggeROVMx3R0hFjJk KK8Ke4q+lHO9CLKPP0oiXgkLj5BDXDWy/POQfxZ6aj6dke7TdyseiwBKE/6/HNgC8lx1 Qzi+VGCnZWT/2+OjIE/KFG8dnpGCmtbVzHTa59BRdh6H75Da64YTgcj5p8Gs3unf/gJd RQwjnsmAc6dfRBzFKk7zow4uZxC6QS+A0IZknKBkO0MbF47CCBAmsAdv8yB+nN++y3d5 E1JQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s3-v6si15781669plb.394.2018.04.25.00.55.31; Wed, 25 Apr 2018 00:55:45 -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; 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 S1751424AbeDYHyW (ORCPT + 99 others); Wed, 25 Apr 2018 03:54:22 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:62679 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751069AbeDYHyO (ORCPT ); Wed, 25 Apr 2018 03:54:14 -0400 Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id w3P7iaCx023800; Wed, 25 Apr 2018 09:53:56 +0200 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2hfu2u4b9d-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 25 Apr 2018 09:53:56 +0200 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 92C8E31; Wed, 25 Apr 2018 07:53:53 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas22.st.com [10.75.90.92]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 692E8245B; Wed, 25 Apr 2018 07:53:53 +0000 (GMT) Received: from SAFEX1HUBCAS23.st.com (10.75.90.47) by Safex1hubcas22.st.com (10.75.90.92) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 25 Apr 2018 09:53:53 +0200 Received: from localhost (10.129.5.66) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.361.1; Wed, 25 Apr 2018 09:53:52 +0200 From: Philippe Cornu To: Archit Taneja , Andrzej Hajda , Laurent Pinchart , David Airlie , Rob Herring , "Mark Rutland" , , , CC: Yannick Fertre , Philippe Cornu , Benjamin Gaignard , Alexandre Torgue Subject: [PATCH v2 2/2] drm/bridge: sii902x: add optional power supplies Date: Wed, 25 Apr 2018 09:53:14 +0200 Message-ID: <20180425075314.19137-3-philippe.cornu@st.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180425075314.19137-1-philippe.cornu@st.com> References: <20180425075314.19137-1-philippe.cornu@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.129.5.66] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-04-25_02:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add the optional power supplies using the description found in "SiI9022A/SiI9024A HDMI Transmitter Data Sheet (August 2016)". The sii902x input IOs are not "io safe" so it is important to enable/disable voltage regulators during probe/remove phases to avoid damages. Signed-off-by: Philippe Cornu --- drivers/gpu/drm/bridge/sii902x.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 60373d7eb220..c367d7b91ade 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[2]; }; static inline struct sii902x *bridge_to_sii902x(struct drm_bridge *bridge) @@ -392,23 +394,42 @@ static int sii902x_probe(struct i2c_client *client, return PTR_ERR(sii902x->reset_gpio); } + sii902x->supplies[0].supply = "iovcc"; + sii902x->supplies[1].supply = "vcc12"; + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies), + sii902x->supplies); + if (ret) { + dev_err(dev, "Failed to get power supplies: %d\n", ret); + return ret; + } + + ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies), + sii902x->supplies); + if (ret) { + dev_err(dev, "Failed to enable power supplies: %d\n", ret); + 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 +445,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 +455,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 +470,9 @@ static int sii902x_remove(struct i2c_client *client) drm_bridge_remove(&sii902x->bridge); + regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), + sii902x->supplies); + return 0; } -- 2.15.1