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