From f0103204b7b326ad5e1fb90e6e735440075612c7 Mon Sep 17 00:00:00 2001 From: dengwei1 Date: Fri, 26 Apr 2019 14:01:26 +0800 Subject: [PATCH] Troika : vib update voltage per key part, the vib voltage need update kane need not Change-Id: I344768b4866a5cd00d393e0035116eef9aa17f84 Signed-off-by: dengwei1 Reviewed-on: https://gerrit.mot.com/1343790 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Hua Tan Submit-Approved: Jira Key --- .../dts/exynos/exynos9610-robusta2-motor.dtsi | 2 ++ .../dts/exynos/exynos9610-troika-common.dtsi | 1 + .../dts/exynos/exynos9610-troika-motor.dtsi | 30 +++++++++++++++++++ drivers/misc/aw8695_haptic/aw8695.c | 19 ++++++++++-- drivers/misc/aw8695_haptic/aw8695.h | 4 +-- 5 files changed, 52 insertions(+), 4 deletions(-) create mode 100755 arch/arm64/boot/dts/exynos/exynos9610-troika-motor.dtsi diff --git a/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi b/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi index ee10b6cb26a5..f00e9ed3c9b2 100755 --- a/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos9610-robusta2-motor.dtsi @@ -24,5 +24,7 @@ pinctrl-0 = <&lra_int_status>; reset-gpio = <&gpa2 5 0>; irq-gpio = <&gpa2 7 0>; + aw8695,cont_drv_lvl = <98>; + aw8695,cont_drv_lvl_ov = <98>; }; }; diff --git a/arch/arm64/boot/dts/exynos/exynos9610-troika-common.dtsi b/arch/arm64/boot/dts/exynos/exynos9610-troika-common.dtsi index 917d253ce920..e60921e67e9f 100644 --- a/arch/arm64/boot/dts/exynos/exynos9610-troika-common.dtsi +++ b/arch/arm64/boot/dts/exynos/exynos9610-troika-common.dtsi @@ -13,4 +13,5 @@ #include "exynos9609-robusta2_common.dtsi" #include "exynos9610_troika_battery_data.dtsi" +#include "exynos9610-troika-motor.dtsi" diff --git a/arch/arm64/boot/dts/exynos/exynos9610-troika-motor.dtsi b/arch/arm64/boot/dts/exynos/exynos9610-troika-motor.dtsi new file mode 100755 index 000000000000..089a19fb5e48 --- /dev/null +++ b/arch/arm64/boot/dts/exynos/exynos9610-troika-motor.dtsi @@ -0,0 +1,30 @@ +/* + * SAMSUNG EXYNOS9820 SoC device tree source + * + * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * SAMSUNG EXYNOS9820 SoC device nodes are listed in this file. + * EXYNOS9820 based board files can include this file and provide + * values for board specfic bindings. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +&hsi2c_6 { + status = "okay"; + samsung,reset-before-trans; + clock-frequency = <400000>; + + 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>; + aw8695,cont_drv_lvl = <112>; + aw8695,cont_drv_lvl_ov = <112>; + }; +}; diff --git a/drivers/misc/aw8695_haptic/aw8695.c b/drivers/misc/aw8695_haptic/aw8695.c index aaf81b68a50d..e91bd1b55522 100755 --- a/drivers/misc/aw8695_haptic/aw8695.c +++ b/drivers/misc/aw8695_haptic/aw8695.c @@ -1752,8 +1752,9 @@ static int aw8695_haptic_init(struct aw8695 *aw8695) /* f0 calibration */ mutex_lock(&aw8695->lock); aw8695->f0_pre = AW8695_HAPTIC_F0_PRE; - aw8695->cont_drv_lvl = AW8695_HAPTIC_CONT_DRV_LVL; - aw8695->cont_drv_lvl_ov = AW8695_HAPTIC_CONT_DRV_LVL_OV; + /*CONT_DRV configed in dtsi, parse_dt will set value, so delete code below*/ + /*aw8695->cont_drv_lvl = AW8695_HAPTIC_CONT_DRV_LVL;*/ + /*aw8695->cont_drv_lvl_ov = AW8695_HAPTIC_CONT_DRV_LVL_OV;*/ aw8695->cont_td = AW8695_HAPTIC_CONT_TD; aw8695->cont_zc_thr = AW8695_HAPTIC_CONT_ZC_THR; aw8695->cont_num_brk = AW8695_HAPTIC_CONT_NUM_BRK; @@ -3383,6 +3384,8 @@ static irqreturn_t aw8695_irq(int irq, void *data) *****************************************************/ static int aw8695_parse_dt(struct device *dev, struct aw8695 *aw8695, struct device_node *np) { + int ret = -1; + aw8695->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0); if (aw8695->reset_gpio < 0) { dev_err(dev, "%s: no reset gpio provided, will not HW reset device\n", __func__); @@ -3397,6 +3400,18 @@ static int aw8695_parse_dt(struct device *dev, struct aw8695 *aw8695, dev_info(dev, "%s: irq gpio provided ok.\n", __func__); } + ret = of_property_read_u32(np, "aw8695,cont_drv_lvl", &aw8695->cont_drv_lvl); + if (0 > ret) { + aw8695->cont_drv_lvl = AW8695_HAPTIC_CONT_DRV_LVL; + pr_err("%s:get drv_lvl faild %d",__func__, aw8695->cont_drv_lvl); + } + + ret = of_property_read_u32(np, "aw8695,cont_drv_lvl_ov", &aw8695->cont_drv_lvl_ov); + if (0 > ret) { + aw8695->cont_drv_lvl_ov = AW8695_HAPTIC_CONT_DRV_LVL_OV; + pr_err("%s:get drv_lvl faild use default=%d",__func__, aw8695->cont_drv_lvl_ov); + } + return 0; } diff --git a/drivers/misc/aw8695_haptic/aw8695.h b/drivers/misc/aw8695_haptic/aw8695.h index 90bb3411109b..8bce6bad8f3a 100755 --- a/drivers/misc/aw8695_haptic/aw8695.h +++ b/drivers/misc/aw8695_haptic/aw8695.h @@ -342,8 +342,8 @@ struct aw8695 { unsigned int cont_f0; unsigned int cont_td; unsigned int cont_zc_thr; - unsigned char cont_drv_lvl; - unsigned char cont_drv_lvl_ov; + unsigned int cont_drv_lvl; + unsigned int cont_drv_lvl_ov; unsigned char cont_num_brk; unsigned char max_pos_beme; unsigned char max_neg_beme; -- 2.20.1