diff --git a/drivers/amlogic/media/frame_sync/ptsserv.c b/drivers/amlogic/media/frame_sync/ptsserv.c index de2e8b5b6da8..206e50d12f8b 100644 --- a/drivers/amlogic/media/frame_sync/ptsserv.c +++ b/drivers/amlogic/media/frame_sync/ptsserv.c @@ -510,9 +510,9 @@ static int pts_checkin_offset_inline(u8 type, u32 offset, u32 val, u64 uS64) pr_info("init apts[%d] at 0x%x\n", type, val); if (type == PTS_TYPE_VIDEO) - WRITE_PARSER_REG(VIDEO_PTS, val); + timestamp_vpts_set(val); else if (type == PTS_TYPE_AUDIO) - WRITE_PARSER_REG(AUDIO_PTS, val); + timestamp_apts_set(val); pTable->status = PTS_RUNNING; } @@ -1391,7 +1391,7 @@ int pts_start(u8 type) pTable->buf_size = READ_VREG(HEVC_STREAM_END_ADDR) - pTable->buf_start; #endif - WRITE_PARSER_REG(VIDEO_PTS, 0); + timestamp_vpts_set(0); timestamp_pcrscr_set(0); /* video always need the pcrscr,*/ /*Clear it to use later */ @@ -1424,8 +1424,7 @@ int pts_start(u8 type) * streaming buffer though. */ /* BUG_ON(pTable->buf_size <= 0x10000); */ - - WRITE_PARSER_REG(VIDEO_PTS, 0); + timestamp_vpts_set(0); timestamp_pcrscr_set(0); /* video always need the pcrscr, */ /*Clear it to use later*/ @@ -1442,8 +1441,7 @@ int pts_start(u8 type) - pTable->buf_start + 8; /* BUG_ON(pTable->buf_size <= 0x10000); */ - - WRITE_PARSER_REG(AUDIO_PTS, 0); + timestamp_apts_set(0); timestamp_firstapts_set(0); pTable->first_checkin_pts = -1; pTable->first_lookup_ok = 0; diff --git a/drivers/amlogic/media/frame_sync/timestamp.c b/drivers/amlogic/media/frame_sync/timestamp.c index fd19c64862cc..c3e811b574cc 100644 --- a/drivers/amlogic/media/frame_sync/timestamp.c +++ b/drivers/amlogic/media/frame_sync/timestamp.c @@ -38,6 +38,8 @@ static u32 first_vpts; static u32 first_checkin_vpts; static u32 first_apts; static u32 pcrscr_lantcy = 200*90; +static u32 video_pts; +static u32 audio_pts; static u32 system_time_scale_base = 1; static u32 system_time_scale_remainder; @@ -53,31 +55,31 @@ void set_timestamp_inc_factor(u32 factor) u32 timestamp_vpts_get(void) { - return (u32) READ_PARSER_REG(VIDEO_PTS); + return video_pts; } EXPORT_SYMBOL(timestamp_vpts_get); void timestamp_vpts_set(u32 pts) { - WRITE_PARSER_REG(VIDEO_PTS, pts); + video_pts = pts; } EXPORT_SYMBOL(timestamp_vpts_set); void timestamp_vpts_inc(s32 val) { - WRITE_PARSER_REG(VIDEO_PTS, READ_PARSER_REG(VIDEO_PTS) + val); + video_pts += val; } EXPORT_SYMBOL(timestamp_vpts_inc); u32 timestamp_apts_get(void) { - return (u32) READ_PARSER_REG(AUDIO_PTS); + return audio_pts; } EXPORT_SYMBOL(timestamp_apts_get); void timestamp_apts_set(u32 pts) { - WRITE_PARSER_REG(AUDIO_PTS, pts); + audio_pts = pts; } EXPORT_SYMBOL(timestamp_apts_set); @@ -87,7 +89,7 @@ void timestamp_apts_inc(s32 inc) #ifdef MODIFY_TIMESTAMP_INC_WITH_PLL inc = inc * timestamp_inc_factor / PLL_FACTOR; #endif - WRITE_PARSER_REG(AUDIO_PTS, READ_PARSER_REG(AUDIO_PTS) + inc); + audio_pts += inc; } } EXPORT_SYMBOL(timestamp_apts_inc);