1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved. 3 */ 4 5#ifndef _DPU_HW_BLK_H 6#define _DPU_HW_BLK_H 7 8#include <linux/types.h> 9#include <linux/list.h> 10#include <linux/atomic.h> 11 12struct dpu_hw_blk; 13 14/** 15 * struct dpu_hw_blk_ops - common hardware block operations 16 * @start: start operation on first get 17 * @stop: stop operation on last put 18 */ 19struct dpu_hw_blk_ops { 20 int (*start)(struct dpu_hw_blk *); 21 void (*stop)(struct dpu_hw_blk *); 22}; 23 24/** 25 * struct dpu_hw_blk - definition of hardware block object 26 * @list: list of hardware blocks 27 * @type: hardware block type 28 * @id: instance id 29 * @refcount: reference/usage count 30 */ 31struct dpu_hw_blk { 32 struct list_head list; 33 u32 type; 34 int id; 35 atomic_t refcount; 36 struct dpu_hw_blk_ops ops; 37}; 38 39void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id, 40 struct dpu_hw_blk_ops *ops); 41void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk); 42 43struct dpu_hw_blk *dpu_hw_blk_get(struct dpu_hw_blk *hw_blk, u32 type, int id); 44void dpu_hw_blk_put(struct dpu_hw_blk *hw_blk); 45#endif /*_DPU_HW_BLK_H */ 46