summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormasonwang <masonwang@google.com>2021-07-27 10:47:07 +0800
committermasonwang <masonwang@google.com>2021-07-27 18:16:27 +0800
commite002b1da9af66baa83850abfa2b7b399852052b3 (patch)
tree8864213e44e90060dfc67f9a147631b379de5037
parentc4f998d424f1fd2ef0743a1b6656cc307758d955 (diff)
downloadhimax_touch-e002b1da9af66baa83850abfa2b7b399852052b3.tar.gz
touch/himax: configure settings of reset & irq & SPI pins.
1. Using gpio_request_one instead of gpio_request if using gpio_request(), the gpio name won't show by following command : adb shell cat ./sys/kernel/debug/gpio | egrep himax 2. using pinctrl for the setting of SPI pins. Bug: 193103114 Bug: 194352745 Test: Checking the settings of HW pins by following command: 1. TP reset & irq : adb shell cat ./sys/kernel/debug/gpio | egrep himax 2. SPI pins : adb shell cat d/pinctrl/10c40000.pinctrl-samsung-pinctrl/pins | egrep gpp23 Change-Id: I5616b78964363dcea9f8360d79fc9f82ab84ac96
-rw-r--r--himax_common.c3
-rw-r--r--himax_common.h2
-rw-r--r--himax_platform.c30
-rw-r--r--himax_platform.h1
4 files changed, 33 insertions, 3 deletions
diff --git a/himax_common.c b/himax_common.c
index 861859d..4504e6a 100644
--- a/himax_common.c
+++ b/himax_common.c
@@ -3062,6 +3062,9 @@ int himax_chip_common_init(void)
himax_gpio_power_config(pdata);
+ pdata->pinctrl = devm_pinctrl_get(&ts->spi->dev);
+ himax_ts_pinctrl_configure(ts, true);
+
#if !defined(CONFIG_OF)
if (pdata->power) {
ret = pdata->power(1);
diff --git a/himax_common.h b/himax_common.h
index f879a91..83c13d5 100644
--- a/himax_common.h
+++ b/himax_common.h
@@ -625,6 +625,8 @@ extern bool ic_boot_done;
int himax_parse_dt(struct himax_ts_data *ts, struct himax_platform_data *pdata);
+int himax_ts_pinctrl_configure(struct himax_ts_data *ts, bool enable);
+
extern void himax_parse_dt_ic_info(struct himax_ts_data *ts,
struct himax_platform_data *pdata);
diff --git a/himax_platform.c b/himax_platform.c
index c207533..7481657 100644
--- a/himax_platform.c
+++ b/himax_platform.c
@@ -688,7 +688,7 @@ err_regulator_not_on:
return error;
}
-#else
+#else //#if defined(CONFIG_HMX_DB)
int himax_gpio_power_config(struct himax_platform_data *pdata)
{
int error = 0;
@@ -696,7 +696,7 @@ int himax_gpio_power_config(struct himax_platform_data *pdata)
#if defined(HX_RST_PIN_FUNC)
if (pdata->gpio_reset >= 0) {
- error = gpio_request(pdata->gpio_reset, "himax-reset");
+ error = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_HIGH, "himax-reset");
if (error < 0) {
E("%s: request reset pin failed\n", __func__);
@@ -759,7 +759,7 @@ int himax_gpio_power_config(struct himax_platform_data *pdata)
if (gpio_is_valid(pdata->gpio_irq)) {
/* configure touchscreen irq gpio */
- error = gpio_request(pdata->gpio_irq, "himax_gpio_irq");
+ error = gpio_request_one(pdata->gpio_irq, GPIOF_DIR_IN, "himax-irq");
if (error) {
E("unable to request gpio [%d]\n", pdata->gpio_irq);
@@ -1178,6 +1178,28 @@ int drm_notifier_callback(struct notifier_block *self,
}
#endif
+int himax_ts_pinctrl_configure(struct himax_ts_data *ts, bool enable)
+{
+ struct pinctrl_state *state;
+
+ I("%s: %s\n", __func__, enable ? "ACTIVE" : "SUSPEND");
+
+ if (enable) {
+ state = pinctrl_lookup_state(ts->pdata->pinctrl, "on_state");
+ if (IS_ERR(ts->pdata->pinctrl))
+ E("%s: could not get active pinstate\n", __func__);
+ } else {
+ state = pinctrl_lookup_state(ts->pdata->pinctrl, "off_state");
+ if (IS_ERR(ts->pdata->pinctrl))
+ E("%s: could not get suspend pinstate\n", __func__);
+ }
+
+ if (!IS_ERR_OR_NULL(state))
+ return pinctrl_select_state(ts->pdata->pinctrl, state);
+
+ return 0;
+}
+
int himax_chip_common_probe(struct spi_device *spi)
{
struct himax_ts_data *ts;
@@ -1250,6 +1272,8 @@ int himax_chip_common_remove(struct spi_device *spi)
{
struct himax_ts_data *ts = spi_get_drvdata(spi);
+ himax_ts_pinctrl_configure(ts, false);
+
if (g_hx_chip_inited)
himax_chip_common_deinit();
diff --git a/himax_platform.h b/himax_platform.h
index c677e05..8eb4c83 100644
--- a/himax_platform.h
+++ b/himax_platform.h
@@ -100,6 +100,7 @@ struct himax_platform_data {
struct kobj_attribute *vk2Use;
int hx_config_size;
+ struct pinctrl *pinctrl;
#if defined(CONFIG_HMX_DB)
bool i2c_pull_up;
bool digital_pwr_regulator;