diff options
author | Tomasz Figa <t.figa@samsung.com> | 2014-04-23 17:58:20 +0200 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 11:47:30 +0900 |
commit | 96a5c528f7dd4aa85024593f232e4de64d811b98 (patch) | |
tree | d491368862c97053c41314b7386332f61e10dd75 /drivers | |
parent | 4d4c98ab1473764fdf7d7110fa42f10bc36c8c91 (diff) | |
download | linux-3.10-96a5c528f7dd4aa85024593f232e4de64d811b98.tar.gz linux-3.10-96a5c528f7dd4aa85024593f232e4de64d811b98.tar.bz2 linux-3.10-96a5c528f7dd4aa85024593f232e4de64d811b98.zip |
misc: modem_if: Use pinctrl to properly configure pins
Configuring an interrupt pin as output/input manually using
gpio_direction_*() breaks interrupt settings and must not be done.
This patch adds necessary code to enable pull-down for interrupt pin
using pinctrl API instead of setting the pin to low output to fix
issues with missing modem interrupts.
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Change-Id: Ie56d84ace1941cef3199fea99d7eb907bb9b5c03
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/misc/modem_if/modem_modemctl_device_xmm6262.c | 27 | ||||
-rw-r--r-- | drivers/misc/modem_if/modem_prj.h | 4 |
2 files changed, 24 insertions, 7 deletions
diff --git a/drivers/misc/modem_if/modem_modemctl_device_xmm6262.c b/drivers/misc/modem_if/modem_modemctl_device_xmm6262.c index 09569069ae6..7438471db3c 100644 --- a/drivers/misc/modem_if/modem_modemctl_device_xmm6262.c +++ b/drivers/misc/modem_if/modem_modemctl_device_xmm6262.c @@ -30,16 +30,17 @@ static void xmm_gpio_revers_bias_clear(struct modem_ctl *mc) { gpio_direction_output(mc->gpio_pda_active, 0); - gpio_direction_output(mc->gpio_phone_active, 0); gpio_direction_output(mc->gpio_cp_dump_int, 0); gpio_direction_output(mc->mdm_data->link_pm_data->gpio_link_active, 0); - gpio_direction_output(mc->mdm_data->link_pm_data->gpio_link_hostwake, 0); gpio_direction_output(mc->mdm_data->link_pm_data->gpio_link_slavewake, 0); gpio_direction_output(mc->gpio_reset_req_n, 0); /* added by K */ gpio_direction_output(mc->gpio_cp_on, 0); /* added by K */ gpio_direction_output(mc->gpio_cp_reset, 0); /* added by K */ + if (!IS_ERR(mc->pinctrl_off)) + pinctrl_select_state(mc->pinctrl, mc->pinctrl_off); + /* if (umts_modem_data.gpio_sim_detect) gpio_direction_output(umts_modem_data.gpio_sim_detect, 0); @@ -54,9 +55,9 @@ static void xmm_gpio_revers_bias_restore(struct modem_ctl *mc) unsigned gpio_sim_detect = umts_modem_data.gpio_sim_detect; */ - s3c_gpio_cfgpin(mc->gpio_phone_active, S3C_GPIO_SFN(0xF)); - s3c_gpio_cfgpin(mc->mdm_data->link_pm_data->gpio_link_hostwake, - S3C_GPIO_SFN(0xF)); + if (!IS_ERR(mc->pinctrl_active)) + pinctrl_select_state(mc->pinctrl, mc->pinctrl_active); + gpio_direction_input(mc->gpio_cp_dump_int); /* if (gpio_sim_detect) { @@ -116,6 +117,8 @@ static int xmm6262_off(struct modem_ctl *mc) gpio_set_value(mc->gpio_cp_on, 0); gpio_set_value(mc->gpio_cp_reset, 0); + xmm_gpio_revers_bias_clear(mc); + return 0; } @@ -150,8 +153,6 @@ static int xmm6262_reset(struct modem_ctl *mc) xmm_gpio_revers_bias_restore(mc); /* vvv added by Kamil */ - gpio_direction_input(mc->mdm_data->link_pm_data->gpio_link_hostwake); - gpio_direction_input(mc->gpio_phone_active); gpio_direction_input(mc->gpio_cp_dump_int); gpio_set_value(mc->gpio_pda_active, 1); @@ -256,6 +257,18 @@ int xmm6262_init_modemctl_device(struct modem_ctl *mc, mc->gpio_revers_bias_restore = pdata->gpio_revers_bias_restore; pdev = to_platform_device(mc->dev); + + mc->pinctrl = devm_pinctrl_get(&pdev->dev); + if (!IS_ERR(mc->pinctrl)) { + mc->pinctrl_off = pinctrl_lookup_state(mc->pinctrl, + PINCTRL_STATE_DEFAULT); + mc->pinctrl_active = pinctrl_lookup_state(mc->pinctrl, + "active"); + } else { + mc->pinctrl_off = ERR_PTR(-EINVAL); + mc->pinctrl_active = ERR_PTR(-EINVAL); + } + mc->irq_phone_active = gpio_to_irq(mc->gpio_phone_active); if (mc->gpio_sim_detect) diff --git a/drivers/misc/modem_if/modem_prj.h b/drivers/misc/modem_if/modem_prj.h index d7ab4843687..f074655c456 100644 --- a/drivers/misc/modem_if/modem_prj.h +++ b/drivers/misc/modem_if/modem_prj.h @@ -528,6 +528,10 @@ struct modem_ctl { enum modem_state phone_state; struct sim_state sim_state; + struct pinctrl *pinctrl; + struct pinctrl_state *pinctrl_active; + struct pinctrl_state *pinctrl_off; + unsigned gpio_cp_on; unsigned gpio_reset_req_n; unsigned gpio_cp_reset; |