From f70e023e1a34ead2741a2be6e57136e6723aaf0d Mon Sep 17 00:00:00 2001 From: yangjq Date: Fri, 12 Jun 2020 18:14:17 +0800 Subject: [PATCH] aw8695: A fix of rtp playing from Awinic When frequently making a phone call and declining it, the waveform playing sometimes would fail to work due to the limitation of i2c's transmission speed. Awinic provides this solution and it not only works fine but also has been integrated to all their new software releases, even for aw8697. NO_PROP_NEEDED: This propagation is only needed when the change of framework for this new feature is integrated, being done by engineers in charge of that product. Change-Id: I6fea17ac70b0781e4e395c3f3c4e9bd2859d6f66 Signed-off-by: yangjq Reviewed-on: https://gerrit.mot.com/1616513 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang Submit-Approved: Jira Key --- drivers/misc/awinic/aw8695/aw8695.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/misc/awinic/aw8695/aw8695.c b/drivers/misc/awinic/aw8695/aw8695.c index 081dee6bb90d..d52638dfeace 100644 --- a/drivers/misc/awinic/aw8695/aw8695.c +++ b/drivers/misc/awinic/aw8695/aw8695.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "aw8695.h" @@ -61,6 +62,10 @@ #define AW8695_SEQ_NO_RTP_STOP 120000 #define AW8695_REPEAT_RTP_PLAYING + +#define PM_QOS_VALUE_VB 400 +struct pm_qos_request pm_qos_req_vb; + /****************************************************** * * variable @@ -1146,6 +1151,7 @@ static int aw8695_haptic_rtp_init(struct aw8695 *aw8695) unsigned char reg_val = 0; pr_info("%s enter\n", __func__); + pm_qos_add_request(&pm_qos_req_vb, PM_QOS_CPU_DMA_LATENCY, PM_QOS_VALUE_VB); aw8695->rtp_cnt = 0; @@ -1156,7 +1162,14 @@ static int aw8695_haptic_rtp_init(struct aw8695 *aw8695) pr_info("%s:aw8695_rtp is null break\n", __func__); break; } - if ((aw8695_rtp->len - aw8695->rtp_cnt) < (aw8695->ram.base_addr >> 2)) { + + if ((aw8695->rtp_cnt < aw8695->ram.base_addr)) { + if((aw8695_rtp->len-aw8695->rtp_cnt) < (aw8695->ram.base_addr)){ + buf_len = aw8695_rtp->len-aw8695->rtp_cnt; + } else { + buf_len = (aw8695->ram.base_addr); + } + } else if ((aw8695_rtp->len - aw8695->rtp_cnt) < (aw8695->ram.base_addr >> 2)) { buf_len = aw8695_rtp->len - aw8695->rtp_cnt; } else { buf_len = (aw8695->ram.base_addr >> 2); @@ -1169,6 +1182,7 @@ static int aw8695_haptic_rtp_init(struct aw8695 *aw8695) if ((aw8695->rtp_cnt == aw8695_rtp->len) || ((reg_val & 0x0f) == 0x00)) { pr_info("%s: rtp update complete\n", __func__); aw8695->rtp_cnt = 0; + pm_qos_remove_request(&pm_qos_req_vb); return 0; } } @@ -1176,7 +1190,7 @@ static int aw8695_haptic_rtp_init(struct aw8695 *aw8695) if (aw8695->play_mode == AW8695_HAPTIC_RTP_MODE) { aw8695_haptic_set_rtp_aei(aw8695, true); } - + pm_qos_remove_request(&pm_qos_req_vb); pr_info("%s exit\n", __func__); return 0;