asoc: msm-cdc-pinctrl: Add alternate pinctrl state for DSD input
Add additional pinctrl states to support alternative function. This change enables support of alternative pins through pinctrl framework. Change-Id: I1f3f9a13345846f1714b4ecaeecde975b5cf6813 Signed-off-by: Sanjana B <sanjb@codeaurora.org>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
fe3356fa53
commit
79fba80fa6
@@ -1,5 +1,5 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
@@ -21,6 +21,7 @@ struct msm_cdc_pinctrl_info {
|
|||||||
struct pinctrl *pinctrl;
|
struct pinctrl *pinctrl;
|
||||||
struct pinctrl_state *pinctrl_active;
|
struct pinctrl_state *pinctrl_active;
|
||||||
struct pinctrl_state *pinctrl_sleep;
|
struct pinctrl_state *pinctrl_sleep;
|
||||||
|
struct pinctrl_state *pinctrl_alt_active;
|
||||||
int gpio;
|
int gpio;
|
||||||
bool state;
|
bool state;
|
||||||
u32 tlmm_gpio[MAX_GPIOS];
|
u32 tlmm_gpio[MAX_GPIOS];
|
||||||
@@ -104,6 +105,31 @@ int msm_cdc_pinctrl_select_sleep_state(struct device_node *np)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(msm_cdc_pinctrl_select_sleep_state);
|
EXPORT_SYMBOL(msm_cdc_pinctrl_select_sleep_state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* msm_cdc_pinctrl_select_alt_active_state: select pinctrl alt_active state
|
||||||
|
* @np: pointer to struct device_node
|
||||||
|
*
|
||||||
|
* Returns error code for failure
|
||||||
|
*/
|
||||||
|
int msm_cdc_pinctrl_select_alt_active_state(struct device_node *np)
|
||||||
|
{
|
||||||
|
struct msm_cdc_pinctrl_info *gpio_data;
|
||||||
|
|
||||||
|
gpio_data = msm_cdc_pinctrl_get_gpiodata(np);
|
||||||
|
if (!gpio_data)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (!gpio_data->pinctrl_alt_active) {
|
||||||
|
pr_err("%s: pinctrl alt_active state is null\n", __func__);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
gpio_data->state = true;
|
||||||
|
|
||||||
|
return pinctrl_select_state(gpio_data->pinctrl,
|
||||||
|
gpio_data->pinctrl_alt_active);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(msm_cdc_pinctrl_select_alt_active_state);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* msm_cdc_pinctrl_select_active_state: select pinctrl active state
|
* msm_cdc_pinctrl_select_active_state: select pinctrl active state
|
||||||
* @np: pointer to struct device_node
|
* @np: pointer to struct device_node
|
||||||
@@ -231,6 +257,14 @@ static int msm_cdc_pinctrl_probe(struct platform_device *pdev)
|
|||||||
ret = PTR_ERR(gpio_data->pinctrl_sleep);
|
ret = PTR_ERR(gpio_data->pinctrl_sleep);
|
||||||
goto err_lookup_state;
|
goto err_lookup_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gpio_data->pinctrl_alt_active = pinctrl_lookup_state(
|
||||||
|
gpio_data->pinctrl, "aud_alt_active");
|
||||||
|
if (IS_ERR_OR_NULL(gpio_data->pinctrl_alt_active)) {
|
||||||
|
dev_dbg(&pdev->dev, "%s: Cannot get aud_alt_active pinctrl state:%ld\n",
|
||||||
|
__func__, PTR_ERR(gpio_data->pinctrl_alt_active));
|
||||||
|
}
|
||||||
|
|
||||||
/* skip setting to sleep state for LPI_TLMM GPIOs */
|
/* skip setting to sleep state for LPI_TLMM GPIOs */
|
||||||
if (!of_property_read_bool(pdev->dev.of_node, "qcom,lpi-gpios")) {
|
if (!of_property_read_bool(pdev->dev.of_node, "qcom,lpi-gpios")) {
|
||||||
/* Set pinctrl state to aud_sleep by default */
|
/* Set pinctrl state to aud_sleep by default */
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __MFD_CDC_PINCTRL_H_
|
#ifndef __MFD_CDC_PINCTRL_H_
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#if IS_ENABLED(CONFIG_MSM_CDC_PINCTRL)
|
#if IS_ENABLED(CONFIG_MSM_CDC_PINCTRL)
|
||||||
extern int msm_cdc_pinctrl_select_sleep_state(struct device_node *np);
|
extern int msm_cdc_pinctrl_select_sleep_state(struct device_node *np);
|
||||||
extern int msm_cdc_pinctrl_select_active_state(struct device_node *np);
|
extern int msm_cdc_pinctrl_select_active_state(struct device_node *np);
|
||||||
|
extern int msm_cdc_pinctrl_select_alt_active_state(struct device_node *np);
|
||||||
extern int msm_cdc_pinctrl_get_state(struct device_node *np);
|
extern int msm_cdc_pinctrl_get_state(struct device_node *np);
|
||||||
extern int msm_cdc_get_gpio_state(struct device_node *np);
|
extern int msm_cdc_get_gpio_state(struct device_node *np);
|
||||||
extern int msm_cdc_pinctrl_set_wakeup_capable(struct device_node *np,
|
extern int msm_cdc_pinctrl_set_wakeup_capable(struct device_node *np,
|
||||||
@@ -27,6 +28,10 @@ int msm_cdc_pinctrl_select_active_state(struct device_node *np)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
int msm_cdc_pinctrl_select_alt_active_state(struct device_node *np)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
int msm_cdc_get_gpio_state(struct device_node *np)
|
int msm_cdc_get_gpio_state(struct device_node *np)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user