From patchwork Wed Nov 9 13:09:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laxman Dewangan X-Patchwork-Id: 692767 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tDRpC0hNRz9sdn for ; Thu, 10 Nov 2016 00:28:35 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753925AbcKIN2d (ORCPT ); Wed, 9 Nov 2016 08:28:33 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:9000 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753797AbcKIN2c (ORCPT ); Wed, 9 Nov 2016 08:28:32 -0500 Received: from hqnvupgp07.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com id ; Wed, 09 Nov 2016 05:47:23 -0800 Received: from HQMAIL101.nvidia.com ([172.20.13.39]) by hqnvupgp07.nvidia.com (PGP Universal service); Tue, 08 Nov 2016 17:27:28 -0800 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Tue, 08 Nov 2016 17:27:28 -0800 Received: from DRUKMAIL101.nvidia.com (10.25.59.19) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 9 Nov 2016 13:25:44 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by drukmail101.nvidia.com (10.25.59.19) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Wed, 9 Nov 2016 13:25:39 +0000 Received: from ldewanganubuntu-System-Product-Name.nvidia.com (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1210.3 via Frontend Transport; Wed, 9 Nov 2016 13:25:36 +0000 From: Laxman Dewangan To: , CC: , , , , Laxman Dewangan Subject: [PATCH V2 2/4] soc/tegra: pmc: Add interface to get IO pad power status Date: Wed, 9 Nov 2016 18:39:20 +0530 Message-ID: <1478696962-11831-3-git-send-email-ldewangan@nvidia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1478696962-11831-1-git-send-email-ldewangan@nvidia.com> References: <1478696962-11831-1-git-send-email-ldewangan@nvidia.com> MIME-Version: 1.0 Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Add API to get the IO pad power status of the Tegra IO pads. This will help client driver to get the current power status of IO pads for handling IO pad power. Signed-off-by: Laxman Dewangan --- Changes from V1: None --- drivers/soc/tegra/pmc.c | 22 ++++++++++++++++++++++ include/soc/tegra/pmc.h | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index bb3715f..44546bd 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -1063,6 +1063,28 @@ int tegra_io_pad_power_disable(enum tegra_io_pad id) } EXPORT_SYMBOL(tegra_io_pad_power_disable); +int tegra_io_pad_power_get_status(enum tegra_io_pad id) +{ + const struct tegra_io_pad_soc *pad; + unsigned long status; + u32 value; + int bit; + + pad = tegra_io_pad_find(pmc, id); + if (!pad) + return -ENOENT; + + if (pad->dpd == UINT_MAX) + return -ENOTSUPP; + + status = (pad->dpd < 32) ? IO_DPD_STATUS : IO_DPD2_STATUS; + bit = pad->dpd % 32; + value = tegra_pmc_readl(status); + + return !!(value & BIT(bit)); +} +EXPORT_SYMBOL(tegra_io_pad_power_get_status); + int tegra_io_pad_set_voltage(enum tegra_io_pad id, enum tegra_io_pad_voltage voltage) { diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h index 9c314a6..18cf172 100644 --- a/include/soc/tegra/pmc.h +++ b/include/soc/tegra/pmc.h @@ -152,6 +152,7 @@ int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk, int tegra_io_pad_power_enable(enum tegra_io_pad id); int tegra_io_pad_power_disable(enum tegra_io_pad id); +int tegra_io_pad_power_get_status(enum tegra_io_pad id); int tegra_io_pad_set_voltage(enum tegra_io_pad id, enum tegra_io_pad_voltage voltage); int tegra_io_pad_get_voltage(enum tegra_io_pad id); @@ -193,6 +194,11 @@ static inline int tegra_io_pad_power_disable(enum tegra_io_pad id) return -ENOSYS; } +static inline int tegra_io_pad_power_get_status(enum tegra_io_pad id) +{ + return -ENOSYS; +} + static inline int tegra_io_pad_set_voltage(enum tegra_io_pad id, enum tegra_io_pad_voltage voltage) {