Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ecaf403 authored by Aviral Gupta's avatar Aviral Gupta
Browse files

ASoC: wcd9xxx: update the pinctrl for the slimbus based devices



Parse the pinctrl nodes from the dtsi file for the slimbus
based codecs.

Change-Id: I5f03bbeaad608ae0966395e8170ec8a6e64d9bb0
Signed-off-by: default avatarAviral Gupta <aviralg@codeaurora.org>
parent eb7cdd76
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -545,9 +545,10 @@ static void wcd9xxx_bring_down(struct wcd9xxx *wcd9xxx)
static int wcd9xxx_reset(struct wcd9xxx *wcd9xxx)
{
	int ret;
	struct wcd9xxx_pdata *pdata = wcd9xxx->dev->platform_data;

	if (wcd9xxx->reset_gpio && wcd9xxx->slim_device_bootup
			&& !wcd9xxx->use_pinctrl) {
			&& !pdata->use_pinctrl) {
		ret = gpio_request(wcd9xxx->reset_gpio, "CDC_RESET");
		if (ret) {
			pr_err("%s: Failed to request gpio %d\n", __func__,
@@ -557,26 +558,24 @@ static int wcd9xxx_reset(struct wcd9xxx *wcd9xxx)
		}
	}
	if (wcd9xxx->reset_gpio) {
		if (wcd9xxx->use_pinctrl) {
		if (pdata->use_pinctrl) {
			/* Reset the CDC PDM TLMM pins to a default state */
			ret = pinctrl_select_state(pinctrl_info.pinctrl,
				pinctrl_info.extncodec_act);
					pinctrl_info.extncodec_sus);
			if (ret != 0) {
				pr_err("%s: Failed to enable gpio pins; ret=%d\n",
				pr_err("%s: Failed to suspend reset pins, ret: %d\n",
						__func__, ret);
				return ret;
			}
			gpio_set_value_cansleep(wcd9xxx->reset_gpio, 0);
			msleep(20);
			gpio_set_value_cansleep(wcd9xxx->reset_gpio, 1);
			msleep(20);
			ret = pinctrl_select_state(pinctrl_info.pinctrl,
					pinctrl_info.extncodec_sus);
				pinctrl_info.extncodec_act);
			if (ret != 0) {
				pr_err("%s: Failed to suspend reset pins, ret: %d\n",
				pr_err("%s: Failed to enable gpio pins; ret=%d\n",
						__func__, ret);
				return ret;
			}
			msleep(20);
		} else {
			gpio_direction_output(wcd9xxx->reset_gpio, 0);
			msleep(20);
@@ -589,8 +588,9 @@ static int wcd9xxx_reset(struct wcd9xxx *wcd9xxx)

static void wcd9xxx_free_reset(struct wcd9xxx *wcd9xxx)
{
	struct wcd9xxx_pdata *pdata = wcd9xxx->dev->platform_data;
	if (wcd9xxx->reset_gpio) {
		if (!wcd9xxx->use_pinctrl) {
		if (!pdata->use_pinctrl) {
			gpio_free(wcd9xxx->reset_gpio);
			wcd9xxx->reset_gpio = 0;
		} else
@@ -1297,9 +1297,9 @@ static int wcd9xxx_i2c_probe(struct i2c_client *client,
		}
		ret = extcodec_get_pinctrl(&client->dev);
		if (ret < 0)
			wcd9xxx->use_pinctrl = false;
			pdata->use_pinctrl = false;
		else
			wcd9xxx->use_pinctrl = true;
			pdata->use_pinctrl = true;

		if (i2c_check_functionality(client->adapter,
					    I2C_FUNC_I2C) == 0) {
@@ -1815,6 +1815,12 @@ static int wcd9xxx_slim_probe(struct slim_device *slim)
	wcd9xxx->mclk_rate = pdata->mclk_rate;
	wcd9xxx->slim_device_bootup = true;

	ret = extcodec_get_pinctrl(&slim->dev);
	if (ret < 0)
		pdata->use_pinctrl = false;
	else
		pdata->use_pinctrl = true;

	ret = wcd9xxx_init_supplies(wcd9xxx, pdata);
	if (ret) {
		pr_err("%s: Fail to init Codec supplies %d\n", __func__, ret);
+0 −1
Original line number Diff line number Diff line
@@ -214,7 +214,6 @@ struct wcd9xxx {
	struct wcd9xxx_ch *rx_chs;
	struct wcd9xxx_ch *tx_chs;
	u32 mclk_rate;
	u16 use_pinctrl;

	const struct wcd9xxx_codec_type *codec_type;
};
+1 −0
Original line number Diff line number Diff line
@@ -182,6 +182,7 @@ struct wcd9xxx_pdata {
	u32 mclk_rate;
	u32 dmic_sample_rate;
	enum codec_variant cdc_variant;
	u16 use_pinctrl;
};

#endif