linux/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_blk.h
<<
>>
Prefs
   1/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
   2 *
   3 * This program is free software; you can redistribute it and/or modify
   4 * it under the terms of the GNU General Public License version 2 and
   5 * only version 2 as published by the Free Software Foundation.
   6 *
   7 * This program is distributed in the hope that it will be useful,
   8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
   9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10 * GNU General Public License for more details.
  11 */
  12
  13#ifndef _DPU_HW_BLK_H
  14#define _DPU_HW_BLK_H
  15
  16#include <linux/types.h>
  17#include <linux/list.h>
  18#include <linux/atomic.h>
  19
  20struct dpu_hw_blk;
  21
  22/**
  23 * struct dpu_hw_blk_ops - common hardware block operations
  24 * @start: start operation on first get
  25 * @stop: stop operation on last put
  26 */
  27struct dpu_hw_blk_ops {
  28        int (*start)(struct dpu_hw_blk *);
  29        void (*stop)(struct dpu_hw_blk *);
  30};
  31
  32/**
  33 * struct dpu_hw_blk - definition of hardware block object
  34 * @list: list of hardware blocks
  35 * @type: hardware block type
  36 * @id: instance id
  37 * @refcount: reference/usage count
  38 */
  39struct dpu_hw_blk {
  40        struct list_head list;
  41        u32 type;
  42        int id;
  43        atomic_t refcount;
  44        struct dpu_hw_blk_ops ops;
  45};
  46
  47void dpu_hw_blk_init(struct dpu_hw_blk *hw_blk, u32 type, int id,
  48                struct dpu_hw_blk_ops *ops);
  49void dpu_hw_blk_destroy(struct dpu_hw_blk *hw_blk);
  50
  51struct dpu_hw_blk *dpu_hw_blk_get(struct dpu_hw_blk *hw_blk, u32 type, int id);
  52void dpu_hw_blk_put(struct dpu_hw_blk *hw_blk);
  53#endif /*_DPU_HW_BLK_H */
  54