qcom linux kernel 如何控制i2c的gpio

diff --git a/arch/arm/boot/dts/qcom/msm8916-mtp-ze550kl.dtsi b/arch/arm/boot/dts/qcom/msm8916-mtp-ze550kl.dtsi
index 51cd905..1790720 100644
--- a/arch/arm/boot/dts/qcom/msm8916-mtp-ze550kl.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8916-mtp-ze550kl.dtsi
@@ -37,6 +37,8 @@
  focaltech,name = "ft5346";
  focaltech,family-id = <0x54>;
  focaltech,reset-gpio = <&msm_gpio 12 0x0>;
+                        focaltech,scl-gpio = <&msm_gpio 19 0x0>;
+                        focaltech,sda-gpio = <&msm_gpio 18 0x0>;
  focaltech,irq-gpio = <&msm_gpio 13 0x2008>;
  focaltech,display-coords = <0 0 720 1280>;
  focaltech,panel-coords = <0 0 720 1400>;
diff --git a/arch/arm/boot/dts/qcom/msm8916-pinctrl-ze550kl.dtsi b/arch/arm/boot/dts/qcom/msm8916-pinctrl-ze550kl.dtsi
index a12a037..0f3eb45 100644
--- a/arch/arm/boot/dts/qcom/msm8916-pinctrl-ze550kl.dtsi
+++ b/arch/arm/boot/dts/qcom/msm8916-pinctrl-ze550kl.dtsi
@@ -436,7 +436,7 @@
 
  pmx_i2c_5 {
  /* CLK, DATA */
- qcom,pins = <&gp 19>, <&gp 18>;
+ qcom,pins = <&gp 0>, <&gp 1>;
  qcom,num-grp-pins = <2>;
  qcom,pin-func = <2>;
  label = "pmx_i2c_5";
diff --git a/drivers/input/touchscreen/ftxxxx_ts.c b/drivers/input/touchscreen/ftxxxx_ts.c
index 6b554ee..b2c315c 100755
--- a/drivers/input/touchscreen/ftxxxx_ts.c
+++ b/drivers/input/touchscreen/ftxxxx_ts.c
@@ -516,7 +516,7 @@ static void check_gesture(struct ftxxxx_ts_data *data, int gesture_id)
 
 // printk(KERN_EMERG "[Focal][Touch] %s :  gesture_id = 0x%x\n ", __func__, gesture_id);
  if(!ftxxxx_ts->cover_mode_states)
- Ps_status = proximity_check_status();
+ Ps_status =true ;//= proximity_check_status();
  if (!Ps_status) {
  switch (gesture_id) {
  /* ++++ touch gesture mode support part in ZE500CL ++++ */
@@ -1544,6 +1544,8 @@ static int fts_init_gpio_hw(struct ftxxxx_ts_data *ftxxxx_ts)
  int ret = 0;
 
  ret = gpio_request(ftxxxx_ts->pdata->rst_gpio, FTXXXX_RESET_PIN_NAME);
+ ret = gpio_request(ftxxxx_ts->pdata->scl_gpio,"matt-1");
+ ret = gpio_request(ftxxxx_ts->pdata->sda_gpio,"matt-2");
  if (ret) {
  printk("[Focal][Touch] %s: request GPIO %s for reset failed, ret = %d\n",
  __func__, FTXXXX_RESET_PIN_NAME, ret);
@@ -1551,6 +1553,8 @@ static int fts_init_gpio_hw(struct ftxxxx_ts_data *ftxxxx_ts)
  }
 
  ret = gpio_direction_output(ftxxxx_ts->pdata->rst_gpio, 1); /*asus change reset set output high*/
+ ret = gpio_direction_output(ftxxxx_ts->pdata->sda_gpio, 1);
+ ret = gpio_direction_output(ftxxxx_ts->pdata->scl_gpio, 1);
  if (ret) {
  printk("[Focal][Touch] %s: set %s gpio to out put high failed, ret = %d\n",
  __func__, FTXXXX_RESET_PIN_NAME, ret);
@@ -1640,6 +1644,13 @@ static int ft5x46_parse_dt(struct device *dev,
  if (pdata->intr_gpio < 0)
  return pdata->intr_gpio;
  /* ---reset, irq gpio info--- */
+ pdata->scl_gpio = of_get_named_gpio_flags(np, "focaltech,scl-gpio",
+ 0, &pdata->scl_gpio_flag);
+ gpio_set_value(pdata->scl_gpio, 0);
+
+ pdata->sda_gpio = of_get_named_gpio_flags(np, "focaltech,sda-gpio",
+ 0, &pdata->sda_gpio_flag);
+ //gpio_direction_output(ftxxxx_ts->pdata->sda_gpio, 0);
 
  return 0;
 }
diff --git a/drivers/input/touchscreen/ftxxxx_ts.h b/drivers/input/touchscreen/ftxxxx_ts.h
index bf8a995..ccc9a2a 100755
--- a/drivers/input/touchscreen/ftxxxx_ts.h
+++ b/drivers/input/touchscreen/ftxxxx_ts.h
@@ -128,6 +128,10 @@ struct focal_i2c_platform_data
  u32 intr_gpio;
  u32 intr_gpio_flag;
  u32 rst_gpio;
+ u32 scl_gpio;
+ u32 sda_gpio;
+ u32 scl_gpio_flag;
+ u32 sda_gpio_flag;
  u32 rst_gpio_flag;
  struct regulator *vdd;
  struct regulator *vcc;

你可能感兴趣的:(linux驱动)