From: zhangyijie Date: Sat, 12 Jan 2019 19:09:28 +0000 (+0800) Subject: EKKANE-541:[Kane]:[kernel]motor int pin leakage X-Git-Tag: MMI-QSAS30.62-33-3~284 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3619c53ea81c7303148b2fad4787baaaca12cdea;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git EKKANE-541:[Kane]:[kernel]motor int pin leakage motor add pinctrl for solve int pin leakage Change-Id: I81e6fa136db21cd0f418c9cb0bc6f92d82167aa2 --- diff --git a/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi b/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi index 7c78c5ddb98a..fc59d4ce2110 100755 --- a/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos9609-robusta2_common.dtsi @@ -1464,6 +1464,14 @@ 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 { diff --git a/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi b/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi index 958aebccc71b..ee10b6cb26a5 100755 --- a/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi @@ -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>; }; diff --git a/drivers/misc/aw8695_haptic/aw8695.c b/drivers/misc/aw8695_haptic/aw8695.c index dc2706e3dac1..644bfcf7f1c2 100755 --- a/drivers/misc/aw8695_haptic/aw8695.c +++ b/drivers/misc/aw8695_haptic/aw8695.c @@ -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); diff --git a/drivers/misc/aw8695_haptic/aw8695.h b/drivers/misc/aw8695_haptic/aw8695.h index 28b76aeb786b..90bb3411109b 100755 --- a/drivers/misc/aw8695_haptic/aw8695.h +++ b/drivers/misc/aw8695_haptic/aw8695.h @@ -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;