Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2111746yba; Wed, 3 Apr 2019 01:18:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+eLQjO7I8vR3VC73Huca2VV6NjnWGokkigiiP3qq1hEc5pz+1w2kXpPqc2O82+YRHbE2r X-Received: by 2002:a62:204b:: with SMTP id g72mr68153153pfg.51.1554279525191; Wed, 03 Apr 2019 01:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554279525; cv=none; d=google.com; s=arc-20160816; b=bS8qHDdHzs1zvYgRq7ZfZ6SmED14tPTS3VS9BO5gXuBQUEbqnBakxji0Czw9FPzEpF 0JrSvKX43VuHr6HqaDkdEGrFzt0Hwy7tNvNCMpkAd7A0qEjv7R81V3HdHZrU4L5OL8OW XbB4dZHaTAW3sGT4eHUpaG5aCw/usyOK1JViE6/sgFmRmRvv9QsjIFwKpqPhqvyn4LfE CWE+QOQIEoiciucaGd4vR2cuv+VQCUG2RHbDtv+wdZfP9cjicrfMXMubKZreDopUfy/5 yxc0wSwetJrrAS0Y6+HYXSn/GNop022f4X41EUV0NtchUxh8WGEEyGqroT1zOOeZ2ZIr NwSA== 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:message-id:date:subject:to:from; bh=7qkUjaYA0LqZwD+b1fH+hxMmW4KhTkdYlwXPR43qViA=; b=cbGXHd9a+czasVCajesDdCWxoliF5b6NFU7gPPTB9DhIQghTEaejYXws7iNVv3ZsEL 35ncA3gn43Uk4j4WfiiIR4XxLoFC4Ju7xWHZLFkU2kv+E5MifdMAfUM4YlDBVWPvz/Uv 71o3MN15gdEykLxGx4YjiWKxCJUebG7rxlBXZmC5NGqqASpy79CPEZamr8YZxEN0MJC+ 9i+m8sG4pzpcNwGSaKUR0mhUiQpdfsPkaygMm860hTXC7FSZsugTaz7CxWrIcETebSTy fPHQOdVlfwD1miYlS8dbLTVpC9/qd1IwbUdQNC4/KrqULB+H7J99Q51upkL2aGeid9d8 iBfA== 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 cf15si132098plb.359.2019.04.03.01.18.29; Wed, 03 Apr 2019 01:18: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 S1728900AbfDCIRE (ORCPT + 99 others); Wed, 3 Apr 2019 04:17:04 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:2184 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728625AbfDCIQ7 (ORCPT ); Wed, 3 Apr 2019 04:16:59 -0400 Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x3386Kia029692; Wed, 3 Apr 2019 10:16:42 +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 2rmgmx2hdx-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 03 Apr 2019 10:16:42 +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 2F23538; Wed, 3 Apr 2019 08:16:42 +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 0767F1477; Wed, 3 Apr 2019 08:16:42 +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, 3 Apr 2019 10:16:41 +0200 Received: from localhost (10.201.23.97) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.435.0; Wed, 3 Apr 2019 10:16:41 +0200 From: =?UTF-8?q?Yannick=20Fertr=C3=A9?= To: Yannick Fertre , Philippe Cornu , Benjamin Gaignard , Vincent Abriou , David Airlie , Daniel Vetter , Rob Herring , "Mark Rutland" , Maxime Coquelin , Alexandre Torgue , , , , , Subject: [PATCH v1 2/5] drm/stm: dw_mipi_dsi-stm: add support of an optional regulator Date: Wed, 3 Apr 2019 10:16:26 +0200 Message-ID: <1554279389-27377-3-git-send-email-yannick.fertre@st.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554279389-27377-1-git-send-email-yannick.fertre@st.com> References: <1554279389-27377-1-git-send-email-yannick.fertre@st.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.201.23.97] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-04-03_04:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support of an optional regulator for the phy part of the DSI controller. Signed-off-by: Yannick Fertré --- drivers/gpu/drm/stm/dw_mipi_dsi-stm.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c index a672b59..84703d0 100644 --- a/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c +++ b/drivers/gpu/drm/stm/dw_mipi_dsi-stm.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -76,6 +77,7 @@ struct dw_mipi_dsi_stm { u32 hw_version; int lane_min_kbps; int lane_max_kbps; + struct regulator *vdd_supply; }; static inline void dsi_write(struct dw_mipi_dsi_stm *dsi, u32 reg, u32 val) @@ -318,16 +320,32 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) return PTR_ERR(dsi->base); } + dsi->vdd_supply = devm_regulator_get_optional(dev, "phy-dsi"); + if (IS_ERR(dsi->vdd_supply)) { + ret = PTR_ERR(dsi->vdd_supply); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to request regulator: %d\n", ret); + return ret; + } + + ret = regulator_enable(dsi->vdd_supply); + if (ret) { + dev_err(dev, "failed to enable regulator: %d\n", ret); + return ret; + } + dsi->pllref_clk = devm_clk_get(dev, "ref"); if (IS_ERR(dsi->pllref_clk)) { ret = PTR_ERR(dsi->pllref_clk); dev_err(dev, "Unable to get pll reference clock: %d\n", ret); + regulator_disable(dsi->vdd_supply); return ret; } ret = clk_prepare_enable(dsi->pllref_clk); if (ret) { dev_err(dev, "%s: Failed to enable pllref_clk\n", __func__); + regulator_disable(dsi->vdd_supply); return ret; } @@ -339,6 +357,7 @@ static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) dsi->dsi = dw_mipi_dsi_probe(pdev, &dw_mipi_dsi_stm_plat_data); if (IS_ERR(dsi->dsi)) { DRM_ERROR("Failed to initialize mipi dsi host\n"); + regulator_disable(dsi->vdd_supply); clk_disable_unprepare(dsi->pllref_clk); return PTR_ERR(dsi->dsi); } @@ -351,6 +370,7 @@ static int dw_mipi_dsi_stm_remove(struct platform_device *pdev) struct dw_mipi_dsi_stm *dsi = platform_get_drvdata(pdev); clk_disable_unprepare(dsi->pllref_clk); + regulator_disable(dsi->vdd_supply); dw_mipi_dsi_remove(dsi->dsi); return 0; -- 2.7.4