[Bugfix][T106][bug-view-528]The probability of call panic after play audio
On ly Configure :No
Affected branch:master
Affected module:call&& audio
Is it affected on both ZXIC and MTK:only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: Ia1e429e4e06cd4e901ee0f2eb2096b60e8038b03
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_ti3100.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
index 9959350..10d3f7c 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/sound/soc/sanechips/zx29_ti3100.c
@@ -369,26 +369,75 @@
+//l.yang fix T106 bug 528 call panic start
+static int zx29startup(struct snd_pcm_substream *substream)
+{
+ //int ret = 0;
+ print_audio("Alsa Entered func %s\n", __func__);
+ //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
- static int zx29startup(struct snd_pcm_substream *substream)
- {
- // int ret = 0;
- print_audio("Alsa Entered func %s\n", __func__);
- //CPPS_FUNC(cpps_callbacks, zDrv_Audio_Printf)("Alsa: zx29_startup device=%d,stream=%d\n", substream->pcm->device, substream->stream);
+ struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
+ struct snd_pcm *pcmC0D4p = snd_lookup_minor_data(20, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D0p = snd_lookup_minor_data(16, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D1p = snd_lookup_minor_data(17, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D2p = snd_lookup_minor_data(18, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- struct snd_pcm *pcmC0D3p = snd_lookup_minor_data(19, SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
- if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL))
- return -EINVAL;
- if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
- (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
- (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened))
- BUG();
+ struct snd_pcm *pcmC0D0c = snd_lookup_minor_data(24, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D1c = snd_lookup_minor_data(25, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D2c = snd_lookup_minor_data(26, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D3c = snd_lookup_minor_data(27, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+ struct snd_pcm *pcmC0D4c = snd_lookup_minor_data(28, SNDRV_DEVICE_TYPE_PCM_CAPTURE);
+
+ if ((pcmC0D0p == NULL) || (pcmC0D1p == NULL) || (pcmC0D2p == NULL) || (pcmC0D3p == NULL) || (pcmC0D4p == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0p=%p, pcmC0D1p=%p, pcmC0D2p=%p, pcmC0D3p=%p, pcmC0D4p=%p\n", __func__,
+ pcmC0D0p, pcmC0D1p, pcmC0D2p, pcmC0D3p, pcmC0D4p);
+ return -EINVAL;
+ }
+ if ((pcmC0D0p->streams[0].substream_opened && pcmC0D1p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D0p->streams[0].substream_opened && pcmC0D4p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D2p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D1p->streams[0].substream_opened && pcmC0D4p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D3p->streams[0].substream_opened) ||
+ (pcmC0D2p->streams[0].substream_opened && pcmC0D4p->streams[0].substream_opened) ||
+ (pcmC0D3p->streams[0].substream_opened && pcmC0D4p->streams[0].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0p.opened=%d, pcmC0D1p.opened=%d, pcmC0D2p.opened=%d, pcmC0D3p.opened=%d, pcmC0D4p.opened=%d,\n",
+ __func__, pcmC0D0p->streams[0].substream_opened, pcmC0D1p->streams[0].substream_opened,
+ pcmC0D2p->streams[0].substream_opened, pcmC0D3p->streams[0].substream_opened, pcmC0D4p->streams[0].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+
+ if ((pcmC0D0c == NULL) || (pcmC0D1c == NULL) || (pcmC0D2c == NULL) || (pcmC0D3c == NULL) || (pcmC0D4c == NULL))
+ {
+ print_audio("Alsa Entered func %s, pcmC0D0c=%p, pcmC0D1c=%p, pcmC0D2c=%p, pcmC0D3c=%p, pcmC0D4c=%p\n", __func__,
+ pcmC0D0c, pcmC0D1c, pcmC0D2c, pcmC0D3c, pcmC0D4c);
+ return -EINVAL;
+ }
+ if ((pcmC0D0c->streams[1].substream_opened && pcmC0D1c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D0c->streams[1].substream_opened && pcmC0D4c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D2c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D1c->streams[1].substream_opened && pcmC0D4c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D3c->streams[1].substream_opened) ||
+ (pcmC0D2c->streams[1].substream_opened && pcmC0D4c->streams[1].substream_opened) ||
+ (pcmC0D3c->streams[1].substream_opened && pcmC0D4c->streams[1].substream_opened))
+ {
+ print_audio("Alsa Entered func %s error busy, pcmC0D0c.opened=%d, pcmC0D1c.opened=%d, pcmC0D2c.opened=%d,pcmC0D3c.opened=%d, pcmC0D4c.opened=%d,\n",
+ __func__, pcmC0D0c->streams[1].substream_opened, pcmC0D1c->streams[1].substream_opened,
+ pcmC0D2c->streams[1].substream_opened, pcmC0D3c->streams[1].substream_opened, pcmC0D4c->streams[1].substream_opened);
+
+ return -EBUSY;
+ //BUG();
+ }
+//l.yang fix T106 bug 528 call panic end
#if 0
unsigned long flags;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/alsa_call.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/alsa_call.c
index 99143e4..0c36f1a 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/alsa_call.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/libvoice/alsa_call.c
@@ -89,15 +89,16 @@
/* data type for voice device handle */
-struct voice_handle
+//l.yang fix T106 bug 528 call panic start
+struct voiceHandle
{
struct pcm *pcm_voice_out;
struct pcm *pcm_voice_in;
};
/* static handle */
-static struct voice_handle voice_handle = {0};
-
+static struct voiceHandle voice_handle = {0};
+//l.yang fix T106 bug 528 call panic end
static int current_chanl = T_OUTPUT_RECEIVER;//T_OUTPUT_HEADSET;//T_OUTPUT_RECEIVER;
static int current_vol = T_VOICE_VOL_5_LEVEL;
static int dev_num = 1;
@@ -145,8 +146,8 @@
printf("mixer open fail, file(%s), line(%d)\n", __FILE__, __LINE__);
return -2;
}
-
-
+//l.yang fix T106 bug 528 call panic start
+#if 0
if(T_OUTPUT_SPEAKER == current_chanl) {
ret = mix_set_voice_path(voice_mixer,T_OUTPUT_SPEAKER);
@@ -179,7 +180,19 @@
return -2;
}
-
+#endif
+ if((T_OUTPUT_RECEIVER <= current_chanl) && (current_chanl < T_OUTPUT_MAX))
+ {
+ ret = mix_set_voice_path(voice_mixer, current_chanl);
+ printf("chanl HEADSET: mix_set_voice_path ret=%d!\n",ret);
+ }
+ else
+ {
+ printf("alsa_voice_open: chanl not support fail!\n");
+ mixer_close(voice_mixer);
+ return -2;
+ }
+//l.yang fix T106 bug 528 call panic end
/*close mixer */
mixer_close(voice_mixer);
@@ -230,32 +243,53 @@
return -2;
}
-
-
- if(!(voice_handle.pcm_voice_out = pcm_open(0, dev_num, PCM_OUT, &config_voice)))
- printf("pcm_out dev_num=%d open fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
-
+ //l.yang fix T106 bug 528 call panic start
+ voice_handle.pcm_voice_out = pcm_open(0, dev_num, PCM_OUT, &config_voice);
+ if(!(voice_handle.pcm_voice_out) || !pcm_is_ready(voice_handle.pcm_voice_out))
+ {
+ printf("alsa_voice_open: pcm_out dev_num=%d open fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
+ goto exit;
+ }
printf("%s:pcm_open pcm_voice_out dev_num=%d end!\n",__func__,dev_num);
-
- if(!(voice_handle.pcm_voice_in = pcm_open(0,dev_num,PCM_IN, &config_voice)))
- printf("pcm_in open dev_num=%d fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
-
+
+ voice_handle.pcm_voice_in = pcm_open(0,dev_num,PCM_IN, &config_voice);
+ if(!(voice_handle.pcm_voice_in) || !pcm_is_ready(voice_handle.pcm_voice_in))
+ {
+ printf("alsa_voice_open: pcm_in open dev_num=%d fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
+ goto exit;
+ }
printf("%s:pcm_open pcm_voice_in dev_num=%d end!\n",__func__,dev_num);
if(0 != pcm_prepare(voice_handle.pcm_voice_out))
- printf("pcm_out dev_num=%d prepare fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
-
+ {
+ printf("alsa_voice_open: pcm_out dev_num=%d prepare fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
+ goto exit;
+ }
printf("%s: pcm_voice_out pcm_prepare dev_num=%d end!\n",__func__,dev_num);
if(0 != pcm_prepare(voice_handle.pcm_voice_in))
- printf("pcm_in dev_num=%d prepare fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
-
-
+ {
+ printf("alsa_voice_open: pcm_in dev_num=%d prepare fail, file(%s), line(%d)\n",dev_num, __FILE__, __LINE__);
+ goto exit;
+ }
printf("%s: pcm_voice_in pcm_prepare vmode=%d dev_num=%d end!\n",__func__,vmode,dev_num);
current_mode = vmode;
printf("%s: end!\n",__func__);
return 0;
+exit:
+ if(voice_handle.pcm_voice_in) {
+ ret = pcm_close(voice_handle.pcm_voice_in);
+ voice_handle.pcm_voice_in = 0;
+ }
+
+ if(voice_handle.pcm_voice_out) {
+ ret = pcm_close(voice_handle.pcm_voice_out);
+ voice_handle.pcm_voice_out = 0;
+ }
+
+ return -2;
+ //l.yang fix T106 bug 528 call panic end
}
int alsa_voice_close(int vmode)
diff --git a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/telecom_svr/call/telecom_cc_ringback.c b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/telecom_svr/call/telecom_cc_ringback.c
index 89c9db1..d0a6b11 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/telecom_svr/call/telecom_cc_ringback.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/zxic_app_open/platform/telecom_svr/call/telecom_cc_ringback.c
@@ -175,6 +175,9 @@
}
pcm_close(pcm);
+ //l.yang fix T106 bug 528 call panic start
+ usleep(500000);
+ //l.yang fix T106 bug 528 call panic end
slog(TELSVR_PRINT, SLOG_DEBUG, "cc_play_sample play end!\n");
}