sde_hw_blk.h 1.1 KB

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