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 24 MUTEX_MOD_IDX_MAX /* ALWAYS keep at the end */ 25 }; 26 27 enum mtk_mutex_sof_index { 28 MUTEX_SOF_IDX_SINGLE_MODE, 29 30 MUTEX_SOF_IDX_MAX /* ALWAYS keep at the end */ 31 }; 32 33 struct mtk_mutex *mtk_mutex_get(struct device *dev); 34 int mtk_mutex_prepare(struct mtk_mutex *mutex); 35 void mtk_mutex_add_comp(struct mtk_mutex *mutex, 36 enum mtk_ddp_comp_id id); 37 void mtk_mutex_enable(struct mtk_mutex *mutex); 38 int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, 39 void *pkt); 40 void mtk_mutex_disable(struct mtk_mutex *mutex); 41 void mtk_mutex_remove_comp(struct mtk_mutex *mutex, 42 enum mtk_ddp_comp_id id); 43 void mtk_mutex_unprepare(struct mtk_mutex *mutex); 44 void mtk_mutex_put(struct mtk_mutex *mutex); 45 void mtk_mutex_acquire(struct mtk_mutex *mutex); 46 void mtk_mutex_release(struct mtk_mutex *mutex); 47 int mtk_mutex_write_mod(struct mtk_mutex *mutex, 48 enum mtk_mutex_mod_index idx, 49 bool clear); 50 int mtk_mutex_write_sof(struct mtk_mutex *mutex, 51 enum mtk_mutex_sof_index idx); 52 53 #endif /* MTK_MUTEX_H */ 54