From patchwork Fri Oct 26 14:43:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10657619 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1F9E5A4 for ; Fri, 26 Oct 2018 15:49:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEF3C2C989 for ; Fri, 26 Oct 2018 15:49:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B2DF72C990; Fri, 26 Oct 2018 15:49:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 290AB2C989 for ; Fri, 26 Oct 2018 15:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kDeGGIQ87+5b2R9mH2dMm2zVfQTvh/uTPPkLscXOh+g=; b=pTrMV36dTh9KIJ QQV+1r/l6qlqOod+1Lh26i0eWarzTPsQfEXwlB7GDc1NuJUf7A7WJfnKhHB93sJ0+tQeuWuEXjKPN l43tOddZxEBNAGdjS8V19ez0kW1hKogvGph6qHE6n6B6/Xz5i0JcmEh4KS+vLgu4aP8Dxm6USzEEg R1Be5EuCsPCDlogSGPeMcf4SCnjypFmkRoCLKMtc/310Hi8+5MTJ9xCXRjSYGbtBa/pa1XtFHhQtF 4hr/bQ1Fav0hUwajdZkVQdO43bnBbut6WsiW2vrX8Ekvyr06cZqZvhpDJ6hto1KwN8vZtRKMzKRzc 2EvMEAHE/wbC0bcW00vQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG4MJ-0004if-99; Fri, 26 Oct 2018 15:49:11 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG4KQ-0003vT-La for linux-arm-kernel@bombadil.infradead.org; Fri, 26 Oct 2018 15:47:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=hFXSuNqrssYbWTTz3HCAz9AYQlGBmTmtTIlmYuYmHlg=; b=FfAQpwecDGA33KvpCbpLiKNpgU YctL0NR5eyr2aVvnLCUvYjNHAAgDkbeHPXBUQvRChEifL6l+oHzbERqVIrJgc2RW6zR/REw70Wj7j tapkDInnDDcOA5ulUY7xB9ZHnZIeCpYvDl3hIra3LhyyrCeBy5JOOArPLiP+aJI8XM0fNFlTAxpPb RXDmjEm9UnX9e6XHNmfxwFP58PZIEw1TdFgb7EpkosbP8/vdeeSGzdwHOFK87fAC4HnQzVpJe6j72 y7/eHLeMqTmFlFXnRJ2T+LIMvjmOA0XL1ZqDKhtCPEehMdeKNwES6DH4xduGYfKEASDJr8ZQjUfJ6 UyUP/jKw==; Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gG3N4-0002oq-QX for linux-arm-kernel@lists.infradead.org; Fri, 26 Oct 2018 14:45:55 +0000 Received: by mail-pg1-x542.google.com with SMTP id f8-v6so645562pgq.5 for ; Fri, 26 Oct 2018 07:45:44 -0700 (PDT) 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; bh=hFXSuNqrssYbWTTz3HCAz9AYQlGBmTmtTIlmYuYmHlg=; b=HRHXdaLJr2Aa2ePTF//BjBnnaaBcSB3te5TQbG7wiyI5IATlUrGSxvl60Wx3DdV34y woQuW34ue5NMJVWLSXFEOcQDjtO4ubgwevclD3cql3YCrDgF3c7BO3jvUmT9SLoXAye9 qrYY3ZZ4e6b68avKeliw6yWlzKElFu94zYy/c= 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; bh=hFXSuNqrssYbWTTz3HCAz9AYQlGBmTmtTIlmYuYmHlg=; b=CcH8iNaumZ+xy139RO4qZz6LEgV5yIZaGzRGR841f8Gp2ENbmk++p2P3pcauy5pg0j fvcHPu+Pvr1+pTMTRJDdRz6mLe8QslE4I2CRqsvp41NatbZpf6j5XCp8TDVzFsQjmsY3 WOlihFE3tDzCvJhkQUa0m1fLlcNOEzEZX/7THjWUzUGxv14ET6VSWGCYX43Du9PWpClh dT+DtoiOXNpX+uqaKSybVIz7Op/eNV3m/h0/IDzKDLJEr7fxmzJcD3fY/T/tDhJC3PmU xFz4u71k86hRuZJqHikTdAhJaBdiB9cxrQ08UBlqThuscR+iaAIqMdI5E/YCjs7e9M0K UoqA== X-Gm-Message-State: AGRZ1gIdYOs+SD8Ftlj0SlusdV+VQNueSRHoHoVAUh1JlKYJXpalIrP9 MAiRXpBDBfT2rkuQjUEzV35txg== X-Google-Smtp-Source: AJdET5fpKXQ9TMHJ93fYydde3aZ5tiYcPMcXp1K5AadZV/Op5N1E1lv427KgTgLNdNnB7ESJQ0yxnw== X-Received: by 2002:a63:df03:: with SMTP id u3-v6mr3640604pgg.362.1540565142552; Fri, 26 Oct 2018 07:45:42 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id z22-v6sm12044467pgv.24.2018.10.26.07.45.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Oct 2018 07:45:42 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v3 16/25] drm/sun4i: sun6i_mipi_dsi: Add support for VCC-DSI voltage regulator Date: Fri, 26 Oct 2018 20:13:35 +0530 Message-Id: <20181026144344.27778-17-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181026144344.27778-1-jagan@amarulasolutions.com> References: <20181026144344.27778-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181026_104554_900862_DDF92C20 X-CRM114-Status: GOOD ( 20.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Tested-by: Jagan Teki --- Changes for v3: - new patch Changes for v2: - none 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 42bd7506abaf..bc57343592e0 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -949,6 +949,12 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, dsi->drv = drv; + ret = regulator_enable(dsi->regulator); + if (ret) { + dev_err(dev, "Failed to enable regulator\n"); + return ret; + } + drm_encoder_helper_add(&dsi->encoder, &sun6i_dsi_enc_helper_funcs); ret = drm_encoder_init(drm, @@ -980,6 +986,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, err_cleanup_connector: drm_encoder_cleanup(&dsi->encoder); + regulator_disable(dsi->regulator); return ret; } @@ -989,6 +996,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct device *master, struct sun6i_dsi *dsi = dev_get_drvdata(dev); drm_panel_detach(dsi->panel); + regulator_disable(dsi->regulator); } static const struct component_ops sun6i_dsi_ops = { @@ -1022,6 +1030,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 regulator\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)) { 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;