Lines Matching refs:mutex

316 	struct mtk_mutex		mutex[MTK_MUTEX_MAX_HANDLES];  member
722 if (!mtx->mutex[i].claimed) { in mtk_mutex_get()
723 mtx->mutex[i].claimed = true; in mtk_mutex_get()
724 return &mtx->mutex[i]; in mtk_mutex_get()
731 void mtk_mutex_put(struct mtk_mutex *mutex) in mtk_mutex_put() argument
733 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_put()
734 mutex[mutex->id]); in mtk_mutex_put()
736 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_put()
738 mutex->claimed = false; in mtk_mutex_put()
742 int mtk_mutex_prepare(struct mtk_mutex *mutex) in mtk_mutex_prepare() argument
744 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_prepare()
745 mutex[mutex->id]); in mtk_mutex_prepare()
750 void mtk_mutex_unprepare(struct mtk_mutex *mutex) in mtk_mutex_unprepare() argument
752 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_unprepare()
753 mutex[mutex->id]); in mtk_mutex_unprepare()
758 void mtk_mutex_add_comp(struct mtk_mutex *mutex, in mtk_mutex_add_comp() argument
761 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_add_comp()
762 mutex[mutex->id]); in mtk_mutex_add_comp()
767 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_add_comp()
797 mutex->id); in mtk_mutex_add_comp()
802 offset = DISP_REG_MUTEX_MOD2(mutex->id); in mtk_mutex_add_comp()
812 DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, mutex->id)); in mtk_mutex_add_comp()
816 void mtk_mutex_remove_comp(struct mtk_mutex *mutex, in mtk_mutex_remove_comp() argument
819 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_remove_comp()
820 mutex[mutex->id]); in mtk_mutex_remove_comp()
824 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_remove_comp()
838 mutex->id)); in mtk_mutex_remove_comp()
843 mutex->id); in mtk_mutex_remove_comp()
848 offset = DISP_REG_MUTEX_MOD2(mutex->id); in mtk_mutex_remove_comp()
858 void mtk_mutex_enable(struct mtk_mutex *mutex) in mtk_mutex_enable() argument
860 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_enable()
861 mutex[mutex->id]); in mtk_mutex_enable()
863 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_enable()
865 writel(1, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); in mtk_mutex_enable()
869 int mtk_mutex_enable_by_cmdq(struct mtk_mutex *mutex, void *pkt) in mtk_mutex_enable_by_cmdq() argument
871 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_enable_by_cmdq()
872 mutex[mutex->id]); in mtk_mutex_enable_by_cmdq()
875 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_enable_by_cmdq()
883 mtx->addr + DISP_REG_MUTEX_EN(mutex->id), 1); in mtk_mutex_enable_by_cmdq()
888 void mtk_mutex_disable(struct mtk_mutex *mutex) in mtk_mutex_disable() argument
890 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_disable()
891 mutex[mutex->id]); in mtk_mutex_disable()
893 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_disable()
895 writel(0, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); in mtk_mutex_disable()
899 void mtk_mutex_acquire(struct mtk_mutex *mutex) in mtk_mutex_acquire() argument
901 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_acquire()
902 mutex[mutex->id]); in mtk_mutex_acquire()
905 writel(1, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); in mtk_mutex_acquire()
906 writel(1, mtx->regs + DISP_REG_MUTEX(mutex->id)); in mtk_mutex_acquire()
907 if (readl_poll_timeout_atomic(mtx->regs + DISP_REG_MUTEX(mutex->id), in mtk_mutex_acquire()
909 pr_err("could not acquire mutex %d\n", mutex->id); in mtk_mutex_acquire()
913 void mtk_mutex_release(struct mtk_mutex *mutex) in mtk_mutex_release() argument
915 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_release()
916 mutex[mutex->id]); in mtk_mutex_release()
918 writel(0, mtx->regs + DISP_REG_MUTEX(mutex->id)); in mtk_mutex_release()
922 int mtk_mutex_write_mod(struct mtk_mutex *mutex, in mtk_mutex_write_mod() argument
925 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_write_mod()
926 mutex[mutex->id]); in mtk_mutex_write_mod()
930 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_write_mod()
952 mutex->id); in mtk_mutex_write_mod()
955 mutex->id); in mtk_mutex_write_mod()
971 int mtk_mutex_write_sof(struct mtk_mutex *mutex, in mtk_mutex_write_sof() argument
974 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_write_sof()
975 mutex[mutex->id]); in mtk_mutex_write_sof()
977 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_write_sof()
986 DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, mutex->id)); in mtk_mutex_write_sof()
1004 mtx->mutex[i].id = i; in mtk_mutex_probe()