From patchwork Mon Dec 10 16:17:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 85 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f72.google.com (cartago.priv [10.11.12.1]) by cassiopea (Postfix) with ESMTPS id CA14D2E5487 for ; Mon, 10 Dec 2018 17:18:07 +0100 (CET) Received: by mail-wr1-f72.google.com with SMTP id e17sf3714324wrw.13 for ; Mon, 10 Dec 2018 08:18:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1544458687; cv=pass; d=google.com; s=arc-20160816; b=djymyncgoXkbtyJdJg3m4R6F4mra3u1p4pHez+2r9SUxIM66eVyqNV7cd88kpSvGTJ g84d0SfeaZ/1teByTM9NBkFfUsuu2sp9h0/6yR1B5y5bKRO5/xg9p94Z8mSZlDgxq76Z WJrCxj+sxm612YKmhCSXyPz6l08yvGohIaEII78Z5XZI1CYU6dORcbGY06Yd2dpkzn9r hOp5gzUAuwHp4K/SeHhy+QSL14vWTxYGfmACUe31ge/YbEpVp32aFegIXDj8If3t+u5m tGQoKnKgyo/BWxuVhrWl3yiX+o2/x+EoH4Sc1/hGpap88bgKaTWMn04IQkkTHmYTEoOG ChFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=00q3XfiQq5Un+1gbOZybpEVXgQFaLUYl4K2oxVIJvfo=; b=ypba48C4jZahndweZ2sTfPAR2lcYo29EPxBqN5QKOzmpCWyvAKf3gFMdW9g/v/hQ+9 ZM5UWv6JRVuMekF7ky86/08VRnbwOL6b4iZavOJG8NR2sC/bEqjzOjJEHB1LJB9+/s9/ i5Np/BJ42PyiXTHGvvtG51QPvvA4oGD1FGIxn3ncny8fU6tguDauOfeQffRNFg1vG0Te jp00JbIuUFbDxTtI7Zkpt8lIhJzaRyty9VPSz25JmoEN/bdqPNGqmq9W+1SEWnEP6FGA jb46/YoABraipzB9PO/B4MapVCEDYZb12LdO/H4kj6SvwfkCuPO4TKRZAZxGYua53KLx 9RTA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bdtJzKSo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=00q3XfiQq5Un+1gbOZybpEVXgQFaLUYl4K2oxVIJvfo=; b=I+FEu3JaYQEkneOIEf0C45r4O6f8ly/nhJ89mgwQhlnyzRs0nK2OGrgKRKqrRHFFWv Lmp4ZchkIgAd3nZ2JoYtkwYay/YOb++sLCwoAsmCf5iR1iU5KCD68tktJ6dNpjPUdTHI 5dPa4fFjh4C8AG/HPexv/KWHupco8yC50Norc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=00q3XfiQq5Un+1gbOZybpEVXgQFaLUYl4K2oxVIJvfo=; b=D5erUyVzubLUYxWuJvIIWD2VkqP0q9nj8ljV54xC3W3HAi9MO7fFvozyra/Fda8A9P KT+Ehalgvx+LgottxQ/hZ7hfKdG+5qN7AVFAUNUksQSG3J+k7S+06ucJajofqr+lPdx4 ztHomdm5kQDdk19oatSEp2uCWnRBYJDMp2oZAWD5OMmnVUgtjV58FouChfcrNua+x+W+ FlNuakaa31Tr7S2GFkRp+shlCwbU3xPqvu6fClX2sLRDJYP8aVaTuei7PTcwW0VfJ5iY q86XbtxNgkhcOERGnvmnrBTRWZI+NidyB9I5Afhy5q31rkUinwL4LBVwuzfgRa9E1PFN szYQ== X-Gm-Message-State: AA+aEWazA8CWbNE1bTs47O6O1lM4SUj35mD8S7Ss+8GFiVlCNECYAXvu NPUwRi4zgzWiFo/VQXI0V13rYrzd X-Google-Smtp-Source: AFSGD/X4Xuy776g9o/XhdVOoCEbtFZpaCaCooW1Sh2B9OkQ8vyquGysERpL4M29Zfb62ESdTrtEeMA== X-Received: by 2002:a7b:cd0b:: with SMTP id f11mr987001wmj.18.1544458687561; Mon, 10 Dec 2018 08:18:07 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:8274:: with SMTP id 107ls2256482wrb.10.gmail; Mon, 10 Dec 2018 08:18:07 -0800 (PST) X-Received: by 2002:adf:9c01:: with SMTP id f1mr10877143wrc.286.1544458687143; Mon, 10 Dec 2018 08:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544458687; cv=none; d=google.com; s=arc-20160816; b=kQXM14FNyi9qY+CoXh3IOYr//RnCbHioJEVTmFF78Ewtqkc9sGU8F48OBggB3gNSNm GOinLLrEUNNPBTxgb5tneqoNl61SWfcfTOjPW+lqJaP4fKDzOFaS6sG5eeE7J3mvuUib IvM5SGNIgkPCXCMNDeAeyh+AG/NZKEDwdiK6onJI+SI2t/bWWvk1ckj0s7+3eV1q8wk6 2nmbuE84WGXqAGKiaST0nuEK8jseI3ZAL3YgwXVy2HTxQYCO37NCyNAoYIo01LjISykm scLaTW8NkZJyxGjnkkiMSL+dm38B1RCy/uSCpqSE7MIWheNkKCLdibLkhVik+wWZlPCZ rX8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=00q3XfiQq5Un+1gbOZybpEVXgQFaLUYl4K2oxVIJvfo=; b=lfwgIXCM1P3Te3LdoSdBcbbAGpW8hh5BCl83mS1G13+C4YOMHJCaC6SsG1DSIxldVV 6AFC2l85TcQW0IqM0dPJ+eupL8lDtB+4Clrnt/Azq0N1piK/7XIsPFFm6O65qHfnOdgK DLMagY++SJdIyaiuTY26CrCkcs8NTeue0T2jydxxRK8LBWIUo6dkmolrrYIMcuM3Q8KA IK9qHYsyEr64z4UGeZzqmd5vDpY1k8v+k7OOO7esf4xhZi1B7m3rtY/w33q4flEVaf4w sRJcS3TQ0inxCokG3Zj5ySZFurbk8wU7hiAJEFEbW+aYqokcrLXdDnrKulcLx5+Trkw/ 4KbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bdtJzKSo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b6sor7679645wrx.31.2018.12.10.08.18.07 for (Google Transport Security); Mon, 10 Dec 2018 08:18:07 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:adf:a28d:: with SMTP id s13mr11073625wra.100.1544458686730; Mon, 10 Dec 2018 08:18:06 -0800 (PST) Received: from localhost.localdomain (ip-162-59.sn-213-198.clouditalia.com. [213.198.162.59]) by smtp.gmail.com with ESMTPSA id b13sm8397503wrn.28.2018.12.10.08.18.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Dec 2018 08:18:05 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Michael Turquette , Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Michael Trimarchi , linux-sunxi , linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v5 13/17] drm/sun4i: sun6i_mipi_dsi: Add support for VCC-DSI voltage regulator Date: Mon, 10 Dec 2018 21:47:25 +0530 Message-Id: <20181210161729.29720-14-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181210161729.29720-1-jagan@amarulasolutions.com> References: <20181210161729.29720-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bdtJzKSo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Some boards have VCC-DSI pin connected to voltage regulator which may not be turned on by default. Add support for such boards by adding voltage regulator handling code to MIPI DSI driver. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index cbcef7bf7681..a87b65fff0e0 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1023,6 +1023,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev) return PTR_ERR(base); } + dsi->regulator = devm_regulator_get(dev, "vcc-dsi"); + if (IS_ERR(dsi->regulator)) { + dev_err(dev, "Couldn't get VCC-DSI supply\n"); + return PTR_ERR(dsi->regulator); + } + dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base, &sun6i_dsi_regmap_config); if (IS_ERR(dsi->regs)) { @@ -1104,6 +1110,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev) static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev) { struct sun6i_dsi *dsi = dev_get_drvdata(dev); + int err; + + err = regulator_enable(dsi->regulator); + if (err) { + dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err); + return err; + } reset_control_deassert(dsi->reset); if (dsi->variant->has_mod_clk) @@ -1138,6 +1151,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) if (dsi->variant->has_mod_clk) clk_disable_unprepare(dsi->mod_clk); reset_control_assert(dsi->reset); + regulator_disable(dsi->regulator); return 0; } diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 597b62227019..0df60f84bab3 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -13,6 +13,8 @@ #include #include +#include + struct sun6i_dphy { struct clk *bus_clk; struct clk *mod_clk; @@ -32,6 +34,7 @@ struct sun6i_dsi { struct clk *bus_clk; struct clk *mod_clk; struct regmap *regs; + struct regulator *regulator; struct reset_control *reset; struct sun6i_dphy *dphy;