diff options
author | Tomasz Wasilczyk <twasilczyk@google.com> | 2017-06-09 22:25:33 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-06-09 22:25:35 +0000 |
commit | e2adb6d923f83007d64e7a1e28440a2219d18f49 (patch) | |
tree | a4637c1e6bb6fe1e965e42b10e231b53817ef448 | |
parent | 2d2b5fb5bc55a29a35b9a3ec56b94733a6155a00 (diff) | |
parent | f292d562d4d4766d9bbec87442d92eb0ecf0768b (diff) | |
download | libhardware-e2adb6d923f83007d64e7a1e28440a2219d18f49.tar.gz |
Merge "tune command execute time to resolve FPE_INTDIV error"
-rw-r--r-- | modules/radio/radio_hw.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/modules/radio/radio_hw.c b/modules/radio/radio_hw.c index 298bf755..cf47e3cf 100644 --- a/modules/radio/radio_hw.c +++ b/modules/radio/radio_hw.c @@ -114,8 +114,19 @@ typedef enum { CMD_CANCEL, CMD_METADATA, CMD_ANNOUNCEMENTS, + CMD_NUM } thread_cmd_type_t; +uint32_t thread_cmd_delay_ms[CMD_NUM] = { + [CMD_EXIT] = 0, + [CMD_CONFIG] = 50, + [CMD_STEP] = 100, + [CMD_SCAN] = 200, + [CMD_TUNE] = 150, + [CMD_CANCEL] = 0, + [CMD_METADATA] = 1000, + [CMD_ANNOUNCEMENTS] = 1000 +}; struct thread_command { struct listnode node; thread_cmd_type_t type; @@ -398,7 +409,7 @@ static void *callback_thread_loop(void *context) if (tuner->program.tuned) { prepare_metadata(tuner, &tuner->program.metadata, true); - send_command_l(tuner, CMD_ANNOUNCEMENTS, 1000, NULL); + send_command_l(tuner, CMD_ANNOUNCEMENTS, thread_cmd_delay_ms[CMD_ANNOUNCEMENTS], NULL); } else { if (tuner->program.metadata != NULL) radio_metadata_deallocate(tuner->program.metadata); @@ -481,7 +492,7 @@ static void *callback_thread_loop(void *context) free(cmd); } } - send_command_l(tuner, CMD_METADATA, 1000, NULL); + send_command_l(tuner, CMD_METADATA, thread_cmd_delay_ms[CMD_METADATA], NULL); } } @@ -506,8 +517,8 @@ static int tuner_set_configuration(const struct radio_tuner *tuner, status = -EINVAL; goto exit; } - send_command_l(stub_tuner, CMD_CANCEL, 0, NULL); - send_command_l(stub_tuner, CMD_CONFIG, 500, (void *)config); + send_command_l(stub_tuner, CMD_CANCEL, thread_cmd_delay_ms[CMD_CANCEL], NULL); + send_command_l(stub_tuner, CMD_CONFIG, thread_cmd_delay_ms[CMD_CONFIG], (void *)config); exit: pthread_mutex_unlock(&stub_tuner->lock); @@ -552,7 +563,7 @@ static int tuner_step(const struct radio_tuner *tuner, __func__, stub_tuner, direction, skip_sub_channel); pthread_mutex_lock(&stub_tuner->lock); - send_command_l(stub_tuner, CMD_STEP, 20, &direction); + send_command_l(stub_tuner, CMD_STEP, thread_cmd_delay_ms[CMD_STEP], &direction); pthread_mutex_unlock(&stub_tuner->lock); return 0; } @@ -566,7 +577,7 @@ static int tuner_scan(const struct radio_tuner *tuner, __func__, stub_tuner, direction, skip_sub_channel); pthread_mutex_lock(&stub_tuner->lock); - send_command_l(stub_tuner, CMD_SCAN, 200, &direction); + send_command_l(stub_tuner, CMD_SCAN, thread_cmd_delay_ms[CMD_SCAN], &direction); pthread_mutex_unlock(&stub_tuner->lock); return 0; } @@ -585,7 +596,7 @@ static int tuner_tune(const struct radio_tuner *tuner, ALOGI("%s channel out of range", __func__); return -EINVAL; } - send_command_l(stub_tuner, CMD_TUNE, 100, &channel); + send_command_l(stub_tuner, CMD_TUNE, thread_cmd_delay_ms[CMD_TUNE], &channel); pthread_mutex_unlock(&stub_tuner->lock); return 0; } @@ -597,7 +608,7 @@ static int tuner_cancel(const struct radio_tuner *tuner) ALOGI("%s stub_tuner %p", __func__, stub_tuner); pthread_mutex_lock(&stub_tuner->lock); - send_command_l(stub_tuner, CMD_CANCEL, 0, NULL); + send_command_l(stub_tuner, CMD_CANCEL, thread_cmd_delay_ms[CMD_CANCEL], NULL); pthread_mutex_unlock(&stub_tuner->lock); return 0; } @@ -686,7 +697,7 @@ static int rdev_open_tuner(const struct radio_hw_device *dev, list_init(&rdev->tuner->command_list); pthread_mutex_lock(&rdev->tuner->lock); - send_command_l(rdev->tuner, CMD_CONFIG, 500, (void *)config); + send_command_l(rdev->tuner, CMD_CONFIG, thread_cmd_delay_ms[CMD_CONFIG], (void *)config); pthread_mutex_unlock(&rdev->tuner->lock); *tuner = &rdev->tuner->interface; @@ -714,7 +725,7 @@ static int rdev_close_tuner(const struct radio_hw_device *dev, pthread_mutex_lock(&stub_tuner->lock); stub_tuner->callback = NULL; - send_command_l(stub_tuner, CMD_EXIT, 0, NULL); + send_command_l(stub_tuner, CMD_EXIT, thread_cmd_delay_ms[CMD_EXIT], NULL); pthread_mutex_unlock(&stub_tuner->lock); pthread_join(stub_tuner->callback_thread, (void **) NULL); |