* @type: interface type (see enum @adf_interface_type)
* @idx: which interface of type @type;
* e.g. interface DSI.1 -> @type=%ADF_INTF_TYPE_DSI, @idx=1
+ * @flags: informational flags (bitmask of %ADF_INTF_FLAG_* values)
* @ops: the interface's associated ops
* @fmt: formatting string for the display interface's name
*
* Returns 0 on success or error code (<0) on failure.
*/
int adf_interface_init(struct adf_interface *intf, struct adf_device *dev,
- enum adf_interface_type type, u32 idx,
+ enum adf_interface_type type, u32 idx, u32 flags,
const struct adf_interface_ops *ops, const char *fmt, ...)
{
int ret;
va_list args;
+ const u32 allowed_flags = ADF_INTF_FLAG_PRIMARY |
+ ADF_INTF_FLAG_EXTERNAL;
if (dev->n_interfaces == ADF_MAX_INTERFACES) {
pr_err("%s: parent device %s has too many interfaces\n",
return -EINVAL;
}
+ if (flags & ~allowed_flags) {
+ pr_err("%s: invalid interface flags 0x%X\n", __func__,
+ flags & ~allowed_flags);
+ return -EINVAL;
+ }
+
memset(intf, 0, sizeof(*intf));
va_start(args, fmt);
intf->type = type;
intf->idx = idx;
+ intf->flags = flags;
intf->ops = ops;
init_waitqueue_head(&intf->vsync_wait);
rwlock_init(&intf->vsync_lock);
data.type = intf->type;
data.id = intf->idx;
+ data.flags = intf->flags;
err = adf_interface_get_screen_size(intf, &data.width_mm,
&data.height_mm);
copy_in_user(&arg->type, &data->type,
sizeof(arg->type)) ||
copy_in_user(&arg->id, &data->id, sizeof(arg->id)) ||
+ copy_in_user(&arg->flags, &data->flags,
+ sizeof(arg->flags)) ||
copy_in_user(&arg->dpms_state, &data->dpms_state,
sizeof(arg->dpms_state)) ||
copy_in_user(&arg->hotplug_detect,
__u8 type;
__u32 id;
/* e.g. type=ADF_INTF_TYPE_DSI, id=1 => DSI.1 */
+ __u32 flags;
__u8 dpms_state;
__u8 hotplug_detect;
ADF_INTF_TYPE_MAX = (~(__u32)0),
};
+#define ADF_INTF_FLAG_PRIMARY (1 << 0)
+#define ADF_INTF_FLAG_EXTERNAL (1 << 1)
+
enum adf_event_type {
ADF_EVENT_VSYNC = 0,
ADF_EVENT_HOTPLUG = 1,
* @type: interface type (see enum @adf_interface_type)
* @id: which interface of type @type;
* e.g. interface DSI.1 -> @type=@ADF_INTF_TYPE_DSI, @id=1
+ * @flags: informational flags (bitmask of %ADF_INTF_FLAG_* values)
* @dpms_state: DPMS state (one of @DRM_MODE_DPMS_* defined in drm_mode.h)
* @hotplug_detect: whether a display is plugged in
* @width_mm: screen width in millimeters, or 0 if unknown
__u32 type;
__u32 id;
/* e.g. type=ADF_INTF_TYPE_DSI, id=1 => DSI.1 */
+ __u32 flags;
__u8 dpms_state;
__u8 hotplug_detect;
enum adf_interface_type type;
u32 idx;
+ u32 flags;
wait_queue_head_t vsync_wait;
ktime_t vsync_timestamp;
struct device *parent, const struct adf_device_ops *ops,
const char *fmt, ...);
void adf_device_destroy(struct adf_device *dev);
-int __printf(6, 7) adf_interface_init(struct adf_interface *intf,
+int __printf(7, 8) adf_interface_init(struct adf_interface *intf,
struct adf_device *dev, enum adf_interface_type type, u32 idx,
- const struct adf_interface_ops *ops, const char *fmt, ...);
+ u32 flags, const struct adf_interface_ops *ops, const char *fmt,
+ ...);
void adf_interface_destroy(struct adf_interface *intf);
static inline struct adf_device *adf_interface_parent(
struct adf_interface *intf)