mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 15:20:49 +07:00
1de238e0eb
GPIO support for Qualcomm SOCs requires interaction with the radio (baseband processor). This API allows the different boards to enable GPIO through the radio processor in a generic way. Signed-off-by: Gregory Bean <gbean@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org> Signed-off-by: Daniel Walker <dwalker@codeaurora.org> Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org> Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
86 lines
2.4 KiB
C
86 lines
2.4 KiB
C
/* linux/arch/arm/mach-msm/gpio.c
|
|
*
|
|
* Copyright (C) 2007 Google, Inc.
|
|
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
|
*
|
|
* This software is licensed under the terms of the GNU General Public
|
|
* License version 2, as published by the Free Software Foundation, and
|
|
* may be copied, distributed, and modified under those terms.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <mach/gpio.h>
|
|
#include "proc_comm.h"
|
|
|
|
int gpio_tlmm_config(unsigned config, unsigned disable)
|
|
{
|
|
return msm_proc_comm(PCOM_RPC_GPIO_TLMM_CONFIG_EX, &config, &disable);
|
|
}
|
|
EXPORT_SYMBOL(gpio_tlmm_config);
|
|
|
|
int msm_gpios_enable(const struct msm_gpio *table, int size)
|
|
{
|
|
int rc;
|
|
int i;
|
|
const struct msm_gpio *g;
|
|
for (i = 0; i < size; i++) {
|
|
g = table + i;
|
|
rc = gpio_tlmm_config(g->gpio_cfg, GPIO_ENABLE);
|
|
if (rc) {
|
|
pr_err("gpio_tlmm_config(0x%08x, GPIO_ENABLE)"
|
|
" <%s> failed: %d\n",
|
|
g->gpio_cfg, g->label ?: "?", rc);
|
|
pr_err("pin %d func %d dir %d pull %d drvstr %d\n",
|
|
GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg),
|
|
GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg),
|
|
GPIO_DRVSTR(g->gpio_cfg));
|
|
goto err;
|
|
}
|
|
}
|
|
return 0;
|
|
err:
|
|
msm_gpios_disable(table, i);
|
|
return rc;
|
|
}
|
|
EXPORT_SYMBOL(msm_gpios_enable);
|
|
|
|
void msm_gpios_disable(const struct msm_gpio *table, int size)
|
|
{
|
|
int rc;
|
|
int i;
|
|
const struct msm_gpio *g;
|
|
for (i = size-1; i >= 0; i--) {
|
|
g = table + i;
|
|
rc = gpio_tlmm_config(g->gpio_cfg, GPIO_DISABLE);
|
|
if (rc) {
|
|
pr_err("gpio_tlmm_config(0x%08x, GPIO_DISABLE)"
|
|
" <%s> failed: %d\n",
|
|
g->gpio_cfg, g->label ?: "?", rc);
|
|
pr_err("pin %d func %d dir %d pull %d drvstr %d\n",
|
|
GPIO_PIN(g->gpio_cfg), GPIO_FUNC(g->gpio_cfg),
|
|
GPIO_DIR(g->gpio_cfg), GPIO_PULL(g->gpio_cfg),
|
|
GPIO_DRVSTR(g->gpio_cfg));
|
|
}
|
|
}
|
|
}
|
|
EXPORT_SYMBOL(msm_gpios_disable);
|
|
|
|
int msm_gpios_request_enable(const struct msm_gpio *table, int size)
|
|
{
|
|
int rc = msm_gpios_enable(table, size);
|
|
return rc;
|
|
}
|
|
EXPORT_SYMBOL(msm_gpios_request_enable);
|
|
|
|
void msm_gpios_disable_free(const struct msm_gpio *table, int size)
|
|
{
|
|
msm_gpios_disable(table, size);
|
|
}
|
|
EXPORT_SYMBOL(msm_gpios_disable_free);
|