Lines Matching refs:mtx
428 struct mtk_mutex_ctx *mtx = dev_get_drvdata(dev); in mtk_mutex_get() local
432 if (!mtx->mutex[i].claimed) { in mtk_mutex_get()
433 mtx->mutex[i].claimed = true; in mtk_mutex_get()
434 return &mtx->mutex[i]; in mtk_mutex_get()
443 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_put() local
446 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_put()
454 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_prepare() local
456 return clk_prepare_enable(mtx->clk); in mtk_mutex_prepare()
462 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_unprepare() local
464 clk_disable_unprepare(mtx->clk); in mtk_mutex_unprepare()
471 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_add_comp() local
477 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_add_comp()
502 if (mtx->data->mutex_mod[id] < 32) { in mtk_mutex_add_comp()
503 offset = DISP_REG_MUTEX_MOD(mtx->data->mutex_mod_reg, in mtk_mutex_add_comp()
505 reg = readl_relaxed(mtx->regs + offset); in mtk_mutex_add_comp()
506 reg |= 1 << mtx->data->mutex_mod[id]; in mtk_mutex_add_comp()
507 writel_relaxed(reg, mtx->regs + offset); in mtk_mutex_add_comp()
510 reg = readl_relaxed(mtx->regs + offset); in mtk_mutex_add_comp()
511 reg |= 1 << (mtx->data->mutex_mod[id] - 32); in mtk_mutex_add_comp()
512 writel_relaxed(reg, mtx->regs + offset); in mtk_mutex_add_comp()
517 writel_relaxed(mtx->data->mutex_sof[sof_id], in mtk_mutex_add_comp()
518 mtx->regs + in mtk_mutex_add_comp()
519 DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, mutex->id)); in mtk_mutex_add_comp()
526 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_remove_comp() local
531 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_remove_comp()
542 mtx->regs + in mtk_mutex_remove_comp()
543 DISP_REG_MUTEX_SOF(mtx->data->mutex_sof_reg, in mtk_mutex_remove_comp()
547 if (mtx->data->mutex_mod[id] < 32) { in mtk_mutex_remove_comp()
548 offset = DISP_REG_MUTEX_MOD(mtx->data->mutex_mod_reg, in mtk_mutex_remove_comp()
550 reg = readl_relaxed(mtx->regs + offset); in mtk_mutex_remove_comp()
551 reg &= ~(1 << mtx->data->mutex_mod[id]); in mtk_mutex_remove_comp()
552 writel_relaxed(reg, mtx->regs + offset); in mtk_mutex_remove_comp()
555 reg = readl_relaxed(mtx->regs + offset); in mtk_mutex_remove_comp()
556 reg &= ~(1 << (mtx->data->mutex_mod[id] - 32)); in mtk_mutex_remove_comp()
557 writel_relaxed(reg, mtx->regs + offset); in mtk_mutex_remove_comp()
566 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_enable() local
569 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_enable()
571 writel(1, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); in mtk_mutex_enable()
577 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_disable() local
580 WARN_ON(&mtx->mutex[mutex->id] != mutex); in mtk_mutex_disable()
582 writel(0, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); in mtk_mutex_disable()
588 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_acquire() local
592 writel(1, mtx->regs + DISP_REG_MUTEX_EN(mutex->id)); in mtk_mutex_acquire()
593 writel(1, mtx->regs + DISP_REG_MUTEX(mutex->id)); in mtk_mutex_acquire()
594 if (readl_poll_timeout_atomic(mtx->regs + DISP_REG_MUTEX(mutex->id), in mtk_mutex_acquire()
602 struct mtk_mutex_ctx *mtx = container_of(mutex, struct mtk_mutex_ctx, in mtk_mutex_release() local
605 writel(0, mtx->regs + DISP_REG_MUTEX(mutex->id)); in mtk_mutex_release()
612 struct mtk_mutex_ctx *mtx; in mtk_mutex_probe() local
616 mtx = devm_kzalloc(dev, sizeof(*mtx), GFP_KERNEL); in mtk_mutex_probe()
617 if (!mtx) in mtk_mutex_probe()
621 mtx->mutex[i].id = i; in mtk_mutex_probe()
623 mtx->data = of_device_get_match_data(dev); in mtk_mutex_probe()
625 if (!mtx->data->no_clk) { in mtk_mutex_probe()
626 mtx->clk = devm_clk_get(dev, NULL); in mtk_mutex_probe()
627 if (IS_ERR(mtx->clk)) { in mtk_mutex_probe()
628 if (PTR_ERR(mtx->clk) != -EPROBE_DEFER) in mtk_mutex_probe()
630 return PTR_ERR(mtx->clk); in mtk_mutex_probe()
635 mtx->regs = devm_ioremap_resource(dev, regs); in mtk_mutex_probe()
636 if (IS_ERR(mtx->regs)) { in mtk_mutex_probe()
638 return PTR_ERR(mtx->regs); in mtk_mutex_probe()
641 platform_set_drvdata(pdev, mtx); in mtk_mutex_probe()