1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2015 MediaTek Inc. 4 */ 5 6 #ifndef MTK_MUTEX_H 7 #define MTK_MUTEX_H 8 9 struct regmap; 10 struct device; 11 struct mtk_mutex; 12 13 enum mtk_mutex_mod_index { 14 /* MDP table index */ 15 MUTEX_MOD_IDX_MDP_RDMA0, 16 MUTEX_MOD_IDX_MDP_RSZ0, 17 MUTEX_MOD_IDX_MDP_RSZ1, 18 MUTEX_MOD_IDX_MDP_TDSHP0, 19 MUTEX_MOD_IDX_MDP_WROT0, 20 MUTEX_MOD_IDX_MDP_WDMA, 21 MUTEX_MOD_IDX_MDP_AAL0, 22 MUTEX_MOD_IDX_MDP_CCORR0, 23 MUTEX_MOD_IDX_MDP_HDR0, 24 MUTEX_MOD_IDX_MDP_COLOR0, 25 26 MUTEX_MOD_IDX_MAX /* ALWAYS keep at the end */ 27 }; 28 29 enum mtk_mutex_sof_index { 30 MUTEX_SOF_IDX_SINGLE_MODE, 31 32 MUTEX_SOF_IDX_MAX /* ALWAYS keep at the end */ 33 }; 34 35 struct mtk_mutex *mtk_mutex_get(struct device *dev); 36 int mtk_mutex_prepare(struct mtk_mutex *mutex); 37 void mtk_mutex_add_comp(struct mtk_mutex *mutex, 38 enum mtk_ddp_comp_id id); 39 void mtk_mutex_enable(struct mtk_mutex *mutex); 40 int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, 41 void *pkt); 42 void mtk_mutex_disable(struct mtk_mutex *mutex); 43 void mtk_mutex_remove_comp(struct mtk_mutex *mutex, 44 enum mtk_ddp_comp_id id); 45 void mtk_mutex_unprepare(struct mtk_mutex *mutex); 46 void mtk_mutex_put(struct mtk_mutex *mutex); 47 void mtk_mutex_acquire(struct mtk_mutex *mutex); 48 void mtk_mutex_release(struct mtk_mutex *mutex); 49 int mtk_mutex_write_mod(struct mtk_mutex *mutex, 50 enum mtk_mutex_mod_index idx, 51 bool clear); 52 int mtk_mutex_write_sof(struct mtk_mutex *mutex, 53 enum mtk_mutex_sof_index idx); 54 55 #endif /* MTK_MUTEX_H */ 56