diff --git a/asoc/codecs/msm-cdc-pinctrl.c b/asoc/codecs/msm-cdc-pinctrl.c index 88121fd1e7..9f90a84337 100644 --- a/asoc/codecs/msm-cdc-pinctrl.c +++ b/asoc/codecs/msm-cdc-pinctrl.c @@ -1,5 +1,5 @@ // 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 @@ -21,6 +21,7 @@ struct msm_cdc_pinctrl_info { struct pinctrl *pinctrl; struct pinctrl_state *pinctrl_active; struct pinctrl_state *pinctrl_sleep; + struct pinctrl_state *pinctrl_alt_active; int gpio; bool state; 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); +/* + * 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 * @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); 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 */ if (!of_property_read_bool(pdev->dev.of_node, "qcom,lpi-gpios")) { /* Set pinctrl state to aud_sleep by default */ diff --git a/include/asoc/msm-cdc-pinctrl.h b/include/asoc/msm-cdc-pinctrl.h index 89fe699ccb..3179a8408e 100644 --- a/include/asoc/msm-cdc-pinctrl.h +++ b/include/asoc/msm-cdc-pinctrl.h @@ -1,5 +1,5 @@ /* 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_ @@ -11,6 +11,7 @@ #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_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_get_gpio_state(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; } +int msm_cdc_pinctrl_select_alt_active_state(struct device_node *np) +{ + return 0; +} int msm_cdc_get_gpio_state(struct device_node *np) { return 0;