From patchwork Mon Dec 3 10:07:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10709065 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 104CB1923 for ; Mon, 3 Dec 2018 10:08:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 000232AFDA for ; Mon, 3 Dec 2018 10:08:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E84DC2AFDF; Mon, 3 Dec 2018 10:08:21 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE79A2AFDB for ; Mon, 3 Dec 2018 10:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726219AbeLCKIX (ORCPT ); Mon, 3 Dec 2018 05:08:23 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36759 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726209AbeLCKIW (ORCPT ); Mon, 3 Dec 2018 05:08:22 -0500 Received: by mail-wr1-f68.google.com with SMTP id u3so11452689wrs.3 for ; Mon, 03 Dec 2018 02:07:59 -0800 (PST) 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=Dg+DbPWOiIWTEBIboqaFlKrQScH+lEmDG+NCL3SG4qM=; b=Hr/xAyT52bglpYPM26vtwVjw0lVi0riGdwBTt/Uqb6wsvE2smy8q0cbYurg03WIILo cG805J7COWGGGcN1i/oPutV5O29qrzM/zr6QKkWDl7I1ma9c7znHWIEClb+j0PzuWgIu NIhsAm9mzdwTmQmwt2f9mKA0av9nbuxKtVIss= 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=Dg+DbPWOiIWTEBIboqaFlKrQScH+lEmDG+NCL3SG4qM=; b=s6qoSTTQII6RlD5WMY2HQEDBCQRJVa1+b0orpB42ycn9WWI9zCsIPmr7XcgUJg2r2p SNeXAuwxa4Dh3hIslw+8n1AT/8HW7e+dp4Q0GG4ix8FrueAjumeGOk340OMVwpyuPUHi T+dwll7AGwTlBa0pb/6GNvhWlWd0i/U32DEOxb0wAs7slD5HeHi1tiMqIZfKQQAVB2Yw FnwHJurogpU67BoqTMtb9MZcxMomHCTcduRosWQZ7wlYQhc8s1xJWtJO9bldfBa/uXBC 62xOQ4RAKRfqnWYO4GFyxAz+DTT77vgIW+IXRW/R11sFBbTsy1sCWp+nqp8rulc5PFkw LNVw== X-Gm-Message-State: AA+aEWbVKNU61LJRzRxsjJyaCra+qjWPFXvtCOP742rxTtMgUlMz33CJ yjidMGjiz/Rlxz4GhniRR3m8og== X-Google-Smtp-Source: AFSGD/UK9g8q6lqOZkyiIHQVvaX8DUIaGiep5wexUKg8ZFn8bAxbcvqvPj7E0tiWbgOM/Hf0bE/ZmQ== X-Received: by 2002:adf:f8d2:: with SMTP id f18mr9094939wrq.265.1543831679146; Mon, 03 Dec 2018 02:07:59 -0800 (PST) Received: from localhost.localdomain (conf.hotelmediterraneo.com. [2.228.78.71]) by smtp.gmail.com with ESMTPSA id n15sm18589236wrt.21.2018.12.03.02.07.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Dec 2018 02:07:58 -0800 (PST) From: Jagan Teki To: Yong Deng , Mauro Carvalho Chehab , Maxime Ripard , Rob Herring , Mark Rutland , Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jagan Teki Subject: [PATCH 3/5] media: sun6i: Add vcc-csi supply regulator Date: Mon, 3 Dec 2018 15:37:45 +0530 Message-Id: <20181203100747.16442-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181203100747.16442-1-jagan@amarulasolutions.com> References: <20181203100747.16442-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most of the Allwinner A64 CSI controllers are supply with VCC-PE pin, which may not be turned on by default. Add support for such boards by adding voltage regulator handling code to sun6i csi driver. Used vcc-csi instead of vcc-pe to have better naming convention wrt other controller pin supplies. Signed-off-by: Jagan Teki --- .../media/platform/sunxi/sun6i-csi/sun6i_csi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index 6950585edb5a..5836fa5e6b01 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ struct sun6i_csi_dev { struct clk *clk_mod; struct clk *clk_ram; struct reset_control *rstc_bus; + struct regulator *regulator; int planar_offset[3]; }; @@ -163,9 +165,16 @@ int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable) clk_disable_unprepare(sdev->clk_ram); clk_disable_unprepare(sdev->clk_mod); reset_control_assert(sdev->rstc_bus); + regulator_disable(sdev->regulator); return 0; } + ret = regulator_enable(sdev->regulator); + if (ret) { + dev_err(sdev->dev, "Enable vcc csi supply err %d\n", ret); + return ret; + } + ret = clk_prepare_enable(sdev->clk_mod); if (ret) { dev_err(sdev->dev, "Enable csi clk err %d\n", ret); @@ -809,6 +818,12 @@ static int sun6i_csi_resource_request(struct sun6i_csi_dev *sdev, if (IS_ERR(io_base)) return PTR_ERR(io_base); + sdev->regulator = devm_regulator_get(&pdev->dev, "vcc-csi"); + if (IS_ERR(sdev->regulator)) { + dev_err(&pdev->dev, "Unable to acquire csi vcc supply\n"); + return PTR_ERR(sdev->regulator); + } + sdev->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "bus", io_base, &sun6i_csi_regmap_config); if (IS_ERR(sdev->regmap)) {