(CR):[Kane]:[kernel]motor int pin leakage
authorzhangyijie <zhangyijie@huaqin.com>
Sat, 12 Jan 2019 19:09:28 +0000 (03:09 +0800)
committerlingsen1 <lingsen1@lenovo.com>
Sun, 7 Feb 2021 09:36:54 +0000 (17:36 +0800)
motor add pinctrl for solve int pin leakage

Change-Id: I81e6fa136db21cd0f418c9cb0bc6f92d82167aa2

arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi
arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi
drivers/misc/aw8695_haptic/aw8695.c
drivers/misc/aw8695_haptic/aw8695.h

index 7c78c5ddb98a0e9d39675af43d02c302d5ded155..fc59d4ce21108b285c2840f002bcf1cb775759dd 100755 (executable)
                samsung,pin-val = <1>;
                samsung,pin-pud = <1>;
        };
+
+       lra_int_status: lra_int_status {
+                samsung,pins = "gpa2-7";
+                samsung,pin-function = <0>;
+                samsung,pin-val = <1>;
+                samsung,pin-pud = <3>;
+        };
+
 };
 
 &pinctrl_4 {
index 958aebccc71b6a569e366d5049606046208af11b..ee10b6cb26a5693d4eb0300b686c0107126217b7 100755 (executable)
@@ -20,6 +20,8 @@
        aw8695_haptic@5A {
                compatible = "awinic,aw8695_haptic";
                reg = <0x5A>;
+               pinctrl-names = "lra_int_status";
+               pinctrl-0 = <&lra_int_status>;
                reset-gpio = <&gpa2 5 0>;
                irq-gpio = <&gpa2 7 0>;
        };
index dc2706e3dac146b136c72e85cfc199b94892692f..644bfcf7f1c295d30635b30dd728af4438424c48 100755 (executable)
@@ -40,7 +40,7 @@
  ******************************************************/
 #define AW8695_I2C_NAME "aw8695_haptic"
 #define AW8695_HAPTIC_NAME "aw8695_haptic"
-
+#define AW8695_INT_PINCTRL_NAME "lra_int_status"
 #define AW8695_VERSION "v1.2.8"
 
 
@@ -3534,8 +3534,36 @@ static struct attribute *aw8695_attributes[] = {
 static struct attribute_group aw8695_attribute_group = {
     .attrs = aw8695_attributes
 };
+/******************************************************
+ *
+ * aw8695 pinctrl init
+ *
+ ******************************************************/
+static int aw8695_i2c_pinctrl_init(struct aw8695 *aw8695)
+{
+    int retval = 0;
+    aw8695->pinctrl = devm_pinctrl_get(&(aw8695->i2c->dev));
+    if (IS_ERR_OR_NULL(aw8695->pinctrl)) {
+        retval = PTR_ERR(aw8695->pinctrl);
+        pr_err("Target does not use pinctrl %d\n", retval);
+        goto no_pinctrl;
+    }
 
+    aw8695->pinctrl_state_active = pinctrl_lookup_state(aw8695->pinctrl, AW8695_INT_PINCTRL_NAME);
+    if (IS_ERR_OR_NULL(aw8695->pinctrl_state_active)) {
+        retval = PTR_ERR(aw8695->pinctrl);
+        pr_err("no such a pinctrl state %d\n", retval);
+       goto free_pinctrl;
+    }
 
+    retval = pinctrl_select_state(aw8695->pinctrl, aw8695->pinctrl_state_active);
+
+    return retval;
+free_pinctrl:
+    devm_pinctrl_put(aw8695->pinctrl);
+no_pinctrl:
+    return retval;
+}
 /******************************************************
  *
  * i2c driver
@@ -3593,6 +3621,7 @@ static int aw8695_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *
             goto err_irq_gpio_request;
         }
     }
+    aw8695_i2c_pinctrl_init(aw8695);
 
     /* aw8695 chip id */
     ret = aw8695_read_chipid(aw8695);
index 28b76aeb786b2e033c044c05e65433daa3b4be7b..90bb3411109bd293b009a13b60f2e3bc2c0b28e6 100755 (executable)
@@ -306,7 +306,8 @@ struct aw8695 {
 
     int reset_gpio;
     int irq_gpio;
-
+    struct pinctrl *pinctrl;
+    struct pinctrl_state *pinctrl_state_active;
     unsigned char hwen_flag;
     unsigned char flags;
     unsigned char chipid;