2 * Copyright (C) 2013 Google, Inc.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
15 #ifndef __VIDEO_ADF_ADF_H
16 #define __VIDEO_ADF_ADF_H
18 #include <linux/idr.h>
19 #include <linux/list.h>
20 #include <video/adf.h>
23 struct adf_event_refcount
{
25 enum adf_event_type type
;
29 void adf_buffer_cleanup(struct adf_buffer
*buf
);
30 void adf_buffer_mapping_cleanup(struct adf_buffer_mapping
*mapping
,
31 struct adf_buffer
*buf
);
32 void adf_post_cleanup(struct adf_device
*dev
, struct adf_pending_post
*post
);
34 struct adf_attachment_list
*adf_attachment_find(struct list_head
*list
,
35 struct adf_overlay_engine
*eng
, struct adf_interface
*intf
);
36 int adf_attachment_validate(struct adf_device
*dev
,
37 struct adf_overlay_engine
*eng
, struct adf_interface
*intf
);
38 void adf_attachment_free(struct adf_attachment_list
*attachment
);
40 struct adf_event_refcount
*adf_obj_find_event_refcount(struct adf_obj
*obj
,
41 enum adf_event_type type
);
43 static inline int adf_obj_check_supports_event(struct adf_obj
*obj
,
44 enum adf_event_type type
)
46 if (!obj
->ops
|| !obj
->ops
->supports_event
)
48 if (!obj
->ops
->supports_event(obj
, type
))
53 static inline int adf_device_attach_op(struct adf_device
*dev
,
54 struct adf_overlay_engine
*eng
, struct adf_interface
*intf
)
56 if (!dev
->ops
->attach
)
59 return dev
->ops
->attach(dev
, eng
, intf
);
62 static inline int adf_device_detach_op(struct adf_device
*dev
,
63 struct adf_overlay_engine
*eng
, struct adf_interface
*intf
)
65 if (!dev
->ops
->detach
)
68 return dev
->ops
->detach(dev
, eng
, intf
);
71 #endif /* __VIDEO_ADF_ADF_H */