Merge tag 'drm-misc-next-2017-03-21' of git://anongit.freedesktop.org/git/drm-misc into drm-next
drm-misc for 4.12, 2nd attempt this week: - topic branch from Jon Corbet for the new graph kerneldoc support - lots of graphs for kms/atomic things using the above - some vblank query tuning from Chris - gem/cma_fops macros - moar docs Driver stuff: - vc4 hdmi audio, yay (Eric) - dw-hdmi polish from a bunch of people - some rockchip dp updates that didn't make last week (Chris Zhong) - misc bridge&driver updates * tag 'drm-misc-next-2017-03-21' of git://anongit.freedesktop.org/git/drm-misc: (37 commits) drm/edid: detect SCDC support in HF-VSDB drm/edid: detect SCDC support in HF-VSDB drm/edid: check for HF-VSDB block drm: Add SCDC helpers drm: bridge: dw-hdmi: add HDMI vendor specific infoframe config drm/bridge: dw_hdmi: support i2c extended read mode drm/msm: add stubs for msm_{perf,rd}_debugfs_cleanup drm: bochs: Don't remove uninitialized fbdev framebuffer drm: vc4: remove redundant check of plane being non-null drm/vc4: use platform_register_drivers dma-fence: add dma_fence_match_context helper drm/vc4: Add HDMI audio support dt-bindings: Document the dmas and dma-names properties for VC4 HDMI drm/atmel-hlcdc: Fix suspend/resume implementation drm: Skip the waitqueue setup for vblank queries drm: Defer disabling the vblank IRQ until the next interrupt (for instant-off) drm/doc: atomic overview, with graph drm/doc: diagram for mode objects and properties drm/doc: Consistent kerneldoc include order drm/doc: Add KMS overview graphs ...
This commit is contained in:
@@ -87,6 +87,53 @@ enum subpixel_order {
|
||||
SubPixelVerticalRGB,
|
||||
SubPixelVerticalBGR,
|
||||
SubPixelNone,
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* struct drm_scrambling: sink's scrambling support.
|
||||
*/
|
||||
struct drm_scrambling {
|
||||
/**
|
||||
* @supported: scrambling supported for rates > 340 Mhz.
|
||||
*/
|
||||
bool supported;
|
||||
/**
|
||||
* @low_rates: scrambling supported for rates <= 340 Mhz.
|
||||
*/
|
||||
bool low_rates;
|
||||
};
|
||||
|
||||
/*
|
||||
* struct drm_scdc - Information about scdc capabilities of a HDMI 2.0 sink
|
||||
*
|
||||
* Provides SCDC register support and capabilities related information on a
|
||||
* HDMI 2.0 sink. In case of a HDMI 1.4 sink, all parameter must be 0.
|
||||
*/
|
||||
struct drm_scdc {
|
||||
/**
|
||||
* @supported: status control & data channel present.
|
||||
*/
|
||||
bool supported;
|
||||
/**
|
||||
* @read_request: sink is capable of generating scdc read request.
|
||||
*/
|
||||
bool read_request;
|
||||
/**
|
||||
* @scrambling: sink's scrambling capabilities
|
||||
*/
|
||||
struct drm_scrambling scrambling;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* struct drm_hdmi_info - runtime information about the connected HDMI sink
|
||||
*
|
||||
* Describes if a given display supports advanced HDMI 2.0 features.
|
||||
* This information is available in CEA-861-F extension blocks (like HF-VSDB).
|
||||
*/
|
||||
struct drm_hdmi_info {
|
||||
struct drm_scdc scdc;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -204,6 +251,11 @@ struct drm_display_info {
|
||||
* @cea_rev: CEA revision of the HDMI sink.
|
||||
*/
|
||||
u8 cea_rev;
|
||||
|
||||
/**
|
||||
* @hdmi: advance features of a HDMI sink.
|
||||
*/
|
||||
struct drm_hdmi_info hdmi;
|
||||
};
|
||||
|
||||
int drm_display_info_set_bus_formats(struct drm_display_info *info,
|
||||
|
@@ -64,7 +64,6 @@ struct drm_mode_create_dumb;
|
||||
* structure for GEM drivers.
|
||||
*/
|
||||
struct drm_driver {
|
||||
|
||||
/**
|
||||
* @load:
|
||||
*
|
||||
@@ -76,14 +75,94 @@ struct drm_driver {
|
||||
* See drm_dev_init() and drm_dev_register() for proper and
|
||||
* race-free way to set up a &struct drm_device.
|
||||
*
|
||||
* This is deprecated, do not use!
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* Zero on success, non-zero value on failure.
|
||||
*/
|
||||
int (*load) (struct drm_device *, unsigned long flags);
|
||||
|
||||
/**
|
||||
* @open:
|
||||
*
|
||||
* Driver callback when a new &struct drm_file is opened. Useful for
|
||||
* setting up driver-private data structures like buffer allocators,
|
||||
* execution contexts or similar things. Such driver-private resources
|
||||
* must be released again in @postclose.
|
||||
*
|
||||
* Since the display/modeset side of DRM can only be owned by exactly
|
||||
* one &struct drm_file (see &drm_file.is_master and &drm_device.master)
|
||||
* there should never be a need to set up any modeset related resources
|
||||
* in this callback. Doing so would be a driver design bug.
|
||||
*
|
||||
* Returns:
|
||||
*
|
||||
* 0 on success, a negative error code on failure, which will be
|
||||
* promoted to userspace as the result of the open() system call.
|
||||
*/
|
||||
int (*open) (struct drm_device *, struct drm_file *);
|
||||
|
||||
/**
|
||||
* @preclose:
|
||||
*
|
||||
* One of the driver callbacks when a new &struct drm_file is closed.
|
||||
* Useful for tearing down driver-private data structures allocated in
|
||||
* @open like buffer allocators, execution contexts or similar things.
|
||||
*
|
||||
* Since the display/modeset side of DRM can only be owned by exactly
|
||||
* one &struct drm_file (see &drm_file.is_master and &drm_device.master)
|
||||
* there should never be a need to tear down any modeset related
|
||||
* resources in this callback. Doing so would be a driver design bug.
|
||||
*
|
||||
* FIXME: It is not really clear why there's both @preclose and
|
||||
* @postclose. Without a really good reason, use @postclose only.
|
||||
*/
|
||||
void (*preclose) (struct drm_device *, struct drm_file *file_priv);
|
||||
|
||||
/**
|
||||
* @postclose:
|
||||
*
|
||||
* One of the driver callbacks when a new &struct drm_file is closed.
|
||||
* Useful for tearing down driver-private data structures allocated in
|
||||
* @open like buffer allocators, execution contexts or similar things.
|
||||
*
|
||||
* Since the display/modeset side of DRM can only be owned by exactly
|
||||
* one &struct drm_file (see &drm_file.is_master and &drm_device.master)
|
||||
* there should never be a need to tear down any modeset related
|
||||
* resources in this callback. Doing so would be a driver design bug.
|
||||
*
|
||||
* FIXME: It is not really clear why there's both @preclose and
|
||||
* @postclose. Without a really good reason, use @postclose only.
|
||||
*/
|
||||
void (*postclose) (struct drm_device *, struct drm_file *);
|
||||
|
||||
/**
|
||||
* @lastclose:
|
||||
*
|
||||
* Called when the last &struct drm_file has been closed and there's
|
||||
* currently no userspace client for the &struct drm_device.
|
||||
*
|
||||
* Modern drivers should only use this to force-restore the fbdev
|
||||
* framebuffer using drm_fb_helper_restore_fbdev_mode_unlocked().
|
||||
* Anything else would indicate there's something seriously wrong.
|
||||
* Modern drivers can also use this to execute delayed power switching
|
||||
* state changes, e.g. in conjunction with the :ref:`vga_switcheroo`
|
||||
* infrastructure.
|
||||
*
|
||||
* This is called after @preclose and @postclose have been called.
|
||||
*
|
||||
* NOTE:
|
||||
*
|
||||
* All legacy drivers use this callback to de-initialize the hardware.
|
||||
* This is purely because of the shadow-attach model, where the DRM
|
||||
* kernel driver does not really own the hardware. Instead ownershipe is
|
||||
* handled with the help of userspace through an inheritedly racy dance
|
||||
* to set/unset the VT into raw mode.
|
||||
*
|
||||
* Legacy drivers initialize the hardware in the @firstopen callback,
|
||||
* which isn't even called for modern drivers.
|
||||
*/
|
||||
void (*lastclose) (struct drm_device *);
|
||||
|
||||
/**
|
||||
|
@@ -476,5 +476,4 @@ void drm_edid_get_monitor_name(struct edid *edid, char *name,
|
||||
struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
|
||||
int hsize, int vsize, int fresh,
|
||||
bool rb);
|
||||
|
||||
#endif /* __DRM_EDID_H__ */
|
||||
|
@@ -45,6 +45,7 @@ struct drm_device;
|
||||
* FIXME: Not sure we want to have drm_minor here in the end, but to avoid
|
||||
* header include loops we need it here for now.
|
||||
*/
|
||||
|
||||
enum drm_minor_type {
|
||||
DRM_MINOR_PRIMARY,
|
||||
DRM_MINOR_CONTROL,
|
||||
@@ -52,12 +53,19 @@ enum drm_minor_type {
|
||||
};
|
||||
|
||||
/**
|
||||
* DRM minor structure. This structure represents a drm minor number.
|
||||
* struct drm_minor - DRM device minor structure
|
||||
*
|
||||
* This structure represents a DRM minor number for device nodes in /dev.
|
||||
* Entirely opaque to drivers and should never be inspected directly by drivers.
|
||||
* Drivers instead should only interact with &struct drm_file and of course
|
||||
* &struct drm_device, which is also where driver-private data and resources can
|
||||
* be attached to.
|
||||
*/
|
||||
struct drm_minor {
|
||||
int index; /**< Minor device number */
|
||||
int type; /**< Control or render */
|
||||
struct device *kdev; /**< Linux device */
|
||||
/* private: */
|
||||
int index; /* Minor device number */
|
||||
int type; /* Control or render */
|
||||
struct device *kdev; /* Linux device */
|
||||
struct drm_device *dev;
|
||||
|
||||
struct dentry *debugfs_root;
|
||||
@@ -66,91 +74,286 @@ struct drm_minor {
|
||||
struct mutex debugfs_lock; /* Protects debugfs_list. */
|
||||
};
|
||||
|
||||
/* Event queued up for userspace to read */
|
||||
/**
|
||||
* struct drm_pending_event - Event queued up for userspace to read
|
||||
*
|
||||
* This represents a DRM event. Drivers can use this as a generic completion
|
||||
* mechanism, which supports kernel-internal &struct completion, &struct dma_fence
|
||||
* and also the DRM-specific &struct drm_event delivery mechanism.
|
||||
*/
|
||||
struct drm_pending_event {
|
||||
/**
|
||||
* @completion:
|
||||
*
|
||||
* Optional pointer to a kernel internal completion signalled when
|
||||
* drm_send_event() is called, useful to internally synchronize with
|
||||
* nonblocking operations.
|
||||
*/
|
||||
struct completion *completion;
|
||||
|
||||
/**
|
||||
* @completion_release:
|
||||
*
|
||||
* Optional callback currently only used by the atomic modeset helpers
|
||||
* to clean up the reference count for the structure @completion is
|
||||
* stored in.
|
||||
*/
|
||||
void (*completion_release)(struct completion *completion);
|
||||
|
||||
/**
|
||||
* @event:
|
||||
*
|
||||
* Pointer to the actual event that should be sent to userspace to be
|
||||
* read using drm_read(). Can be optional, since nowadays events are
|
||||
* also used to signal kernel internal threads with @completion or DMA
|
||||
* transactions using @fence.
|
||||
*/
|
||||
struct drm_event *event;
|
||||
|
||||
/**
|
||||
* @fence:
|
||||
*
|
||||
* Optional DMA fence to unblock other hardware transactions which
|
||||
* depend upon the nonblocking DRM operation this event represents.
|
||||
*/
|
||||
struct dma_fence *fence;
|
||||
struct list_head link;
|
||||
struct list_head pending_link;
|
||||
|
||||
/**
|
||||
* @file_priv:
|
||||
*
|
||||
* &struct drm_file where @event should be delivered to. Only set when
|
||||
* @event is set.
|
||||
*/
|
||||
struct drm_file *file_priv;
|
||||
pid_t pid; /* pid of requester, no guarantee it's valid by the time
|
||||
we deliver the event, for tracing only */
|
||||
|
||||
/**
|
||||
* @link:
|
||||
*
|
||||
* Double-linked list to keep track of this event. Can be used by the
|
||||
* driver up to the point when it calls drm_send_event(), after that
|
||||
* this list entry is owned by the core for its own book-keeping.
|
||||
*/
|
||||
struct list_head link;
|
||||
|
||||
/**
|
||||
* @pending_link:
|
||||
*
|
||||
* Entry on &drm_file.pending_event_list, to keep track of all pending
|
||||
* events for @file_priv, to allow correct unwinding of them when
|
||||
* userspace closes the file before the event is delivered.
|
||||
*/
|
||||
struct list_head pending_link;
|
||||
};
|
||||
|
||||
/** File private data */
|
||||
/**
|
||||
* struct drm_file - DRM file private data
|
||||
*
|
||||
* This structure tracks DRM state per open file descriptor.
|
||||
*/
|
||||
struct drm_file {
|
||||
/**
|
||||
* @authenticated:
|
||||
*
|
||||
* Whether the client is allowed to submit rendering, which for legacy
|
||||
* nodes means it must be authenticated.
|
||||
*
|
||||
* See also the :ref:`section on primary nodes and authentication
|
||||
* <drm_primary_node>`.
|
||||
*/
|
||||
unsigned authenticated :1;
|
||||
/* true when the client has asked us to expose stereo 3D mode flags */
|
||||
|
||||
/**
|
||||
* @stereo_allowed:
|
||||
*
|
||||
* True when the client has asked us to expose stereo 3D mode flags.
|
||||
*/
|
||||
unsigned stereo_allowed :1;
|
||||
/*
|
||||
* true if client understands CRTC primary planes and cursor planes
|
||||
* in the plane list
|
||||
|
||||
/**
|
||||
* @universal_planes:
|
||||
*
|
||||
* True if client understands CRTC primary planes and cursor planes
|
||||
* in the plane list. Automatically set when @atomic is set.
|
||||
*/
|
||||
unsigned universal_planes:1;
|
||||
/* true if client understands atomic properties */
|
||||
|
||||
/** @atomic: True if client understands atomic properties. */
|
||||
unsigned atomic:1;
|
||||
/*
|
||||
* This client is the creator of @master.
|
||||
* Protected by struct drm_device::master_mutex.
|
||||
|
||||
/**
|
||||
* @is_master:
|
||||
*
|
||||
* This client is the creator of @master. Protected by struct
|
||||
* &drm_device.master_mutex.
|
||||
*
|
||||
* See also the :ref:`section on primary nodes and authentication
|
||||
* <drm_primary_node>`.
|
||||
*/
|
||||
unsigned is_master:1;
|
||||
|
||||
struct pid *pid;
|
||||
drm_magic_t magic;
|
||||
struct list_head lhead;
|
||||
struct drm_minor *minor;
|
||||
unsigned long lock_count;
|
||||
/**
|
||||
* @master:
|
||||
*
|
||||
* Master this node is currently associated with. Only relevant if
|
||||
* drm_is_primary_client() returns true. Note that this only
|
||||
* matches &drm_device.master if the master is the currently active one.
|
||||
*
|
||||
* See also @authentication and @is_master and the :ref:`section on
|
||||
* primary nodes and authentication <drm_primary_node>`.
|
||||
*/
|
||||
struct drm_master *master;
|
||||
|
||||
/** Mapping of mm object handles to object pointers. */
|
||||
/** @pid: Process that opened this file. */
|
||||
struct pid *pid;
|
||||
|
||||
/** @magic: Authentication magic, see @authenticated. */
|
||||
drm_magic_t magic;
|
||||
|
||||
/**
|
||||
* @lhead:
|
||||
*
|
||||
* List of all open files of a DRM device, linked into
|
||||
* &drm_device.filelist. Protected by &drm_device.filelist_mutex.
|
||||
*/
|
||||
struct list_head lhead;
|
||||
|
||||
/** @minor: &struct drm_minor for this file. */
|
||||
struct drm_minor *minor;
|
||||
|
||||
/**
|
||||
* @object_idr:
|
||||
*
|
||||
* Mapping of mm object handles to object pointers. Used by the GEM
|
||||
* subsystem. Protected by @table_lock.
|
||||
*/
|
||||
struct idr object_idr;
|
||||
/** Lock for synchronization of access to object_idr. */
|
||||
|
||||
/** @table_lock: Protects @object_idr. */
|
||||
spinlock_t table_lock;
|
||||
|
||||
/** @filp: Pointer to the core file structure. */
|
||||
struct file *filp;
|
||||
|
||||
/**
|
||||
* @driver_priv:
|
||||
*
|
||||
* Optional pointer for driver private data. Can be allocated in
|
||||
* &drm_driver.open and should be freed in &drm_driver.postclose.
|
||||
*/
|
||||
void *driver_priv;
|
||||
|
||||
struct drm_master *master; /* master this node is currently associated with
|
||||
N.B. not always dev->master */
|
||||
/**
|
||||
* fbs - List of framebuffers associated with this file.
|
||||
* @fbs:
|
||||
*
|
||||
* Protected by fbs_lock. Note that the fbs list holds a reference on
|
||||
* the fb object to prevent it from untimely disappearing.
|
||||
* List of &struct drm_framebuffer associated with this file, using the
|
||||
* &drm_framebuffer.filp_head entry.
|
||||
*
|
||||
* Protected by @fbs_lock. Note that the @fbs list holds a reference on
|
||||
* the framebuffer object to prevent it from untimely disappearing.
|
||||
*/
|
||||
struct list_head fbs;
|
||||
|
||||
/** @fbs_lock: Protects @fbs. */
|
||||
struct mutex fbs_lock;
|
||||
|
||||
/** User-created blob properties; this retains a reference on the
|
||||
* property. */
|
||||
/**
|
||||
* @blobs:
|
||||
*
|
||||
* User-created blob properties; this retains a reference on the
|
||||
* property.
|
||||
*
|
||||
* Protected by @drm_mode_config.blob_lock;
|
||||
*/
|
||||
struct list_head blobs;
|
||||
|
||||
/** @event_wait: Waitqueue for new events added to @event_list. */
|
||||
wait_queue_head_t event_wait;
|
||||
|
||||
/**
|
||||
* @pending_event_list:
|
||||
*
|
||||
* List of pending &struct drm_pending_event, used to clean up pending
|
||||
* events in case this file gets closed before the event is signalled.
|
||||
* Uses the &drm_pending_event.pending_link entry.
|
||||
*
|
||||
* Protect by &drm_device.event_lock.
|
||||
*/
|
||||
struct list_head pending_event_list;
|
||||
|
||||
/**
|
||||
* @event_list:
|
||||
*
|
||||
* List of &struct drm_pending_event, ready for delivery to userspace
|
||||
* through drm_read(). Uses the &drm_pending_event.link entry.
|
||||
*
|
||||
* Protect by &drm_device.event_lock.
|
||||
*/
|
||||
struct list_head event_list;
|
||||
|
||||
/**
|
||||
* @event_space:
|
||||
*
|
||||
* Available event space to prevent userspace from
|
||||
* exhausting kernel memory. Currently limited to the fairly arbitrary
|
||||
* value of 4KB.
|
||||
*/
|
||||
int event_space;
|
||||
|
||||
/** @event_read_lock: Serializes drm_read(). */
|
||||
struct mutex event_read_lock;
|
||||
|
||||
/**
|
||||
* @prime:
|
||||
*
|
||||
* Per-file buffer caches used by the PRIME buffer sharing code.
|
||||
*/
|
||||
struct drm_prime_file_private prime;
|
||||
|
||||
/* private: */
|
||||
unsigned long lock_count; /* DRI1 legacy lock count */
|
||||
};
|
||||
|
||||
/**
|
||||
* drm_is_primary_client - is this an open file of the primary node
|
||||
* @file_priv: DRM file
|
||||
*
|
||||
* Returns true if this is an open file of the primary node, i.e.
|
||||
* &drm_file.minor of @file_priv is a primary minor.
|
||||
*
|
||||
* See also the :ref:`section on primary nodes and authentication
|
||||
* <drm_primary_node>`.
|
||||
*/
|
||||
static inline bool drm_is_primary_client(const struct drm_file *file_priv)
|
||||
{
|
||||
return file_priv->minor->type == DRM_MINOR_PRIMARY;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_is_render_client - is this an open file of the render node
|
||||
* @file_priv: DRM file
|
||||
*
|
||||
* Returns true if this is an open file of the render node, i.e.
|
||||
* &drm_file.minor of @file_priv is a render minor.
|
||||
*
|
||||
* See also the :ref:`section on render nodes <drm_render_node>`.
|
||||
*/
|
||||
static inline bool drm_is_render_client(const struct drm_file *file_priv)
|
||||
{
|
||||
return file_priv->minor->type == DRM_MINOR_RENDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_is_control_client - is this an open file of the control node
|
||||
* @file_priv: DRM file
|
||||
*
|
||||
* Control nodes are deprecated and in the process of getting removed from the
|
||||
* DRM userspace API. Do not ever use!
|
||||
*/
|
||||
static inline bool drm_is_control_client(const struct drm_file *file_priv)
|
||||
{
|
||||
return file_priv->minor->type == DRM_MINOR_CONTROL;
|
||||
}
|
||||
|
||||
static inline bool drm_is_primary_client(const struct drm_file *file_priv)
|
||||
{
|
||||
return file_priv->minor->type == DRM_MINOR_PRIMARY;
|
||||
}
|
||||
|
||||
int drm_open(struct inode *inode, struct file *filp);
|
||||
ssize_t drm_read(struct file *filp, char __user *buffer,
|
||||
size_t count, loff_t *offset);
|
||||
|
@@ -178,6 +178,32 @@ struct drm_gem_object {
|
||||
struct dma_buf_attachment *import_attach;
|
||||
};
|
||||
|
||||
/**
|
||||
* DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM drivers
|
||||
* @name: name for the generated structure
|
||||
*
|
||||
* This macro autogenerates a suitable &struct file_operations for GEM based
|
||||
* drivers, which can be assigned to &drm_driver.fops. Note that this structure
|
||||
* cannot be shared between drivers, because it contains a reference to the
|
||||
* current module using THIS_MODULE.
|
||||
*
|
||||
* Note that the declaration is already marked as static - if you need a
|
||||
* non-static version of this you're probably doing it wrong and will break the
|
||||
* THIS_MODULE reference by accident.
|
||||
*/
|
||||
#define DEFINE_DRM_GEM_FOPS(name) \
|
||||
static const struct file_operations name = {\
|
||||
.owner = THIS_MODULE,\
|
||||
.open = drm_open,\
|
||||
.release = drm_release,\
|
||||
.unlocked_ioctl = drm_ioctl,\
|
||||
.compat_ioctl = drm_compat_ioctl,\
|
||||
.poll = drm_poll,\
|
||||
.read = drm_read,\
|
||||
.llseek = noop_llseek,\
|
||||
.mmap = drm_gem_mmap,\
|
||||
}
|
||||
|
||||
void drm_gem_object_release(struct drm_gem_object *obj);
|
||||
void drm_gem_object_free(struct kref *kref);
|
||||
int drm_gem_object_init(struct drm_device *dev,
|
||||
|
@@ -26,6 +26,32 @@ to_drm_gem_cma_obj(struct drm_gem_object *gem_obj)
|
||||
return container_of(gem_obj, struct drm_gem_cma_object, base);
|
||||
}
|
||||
|
||||
/**
|
||||
* DEFINE_DRM_GEM_CMA_FOPS() - macro to generate file operations for CMA drivers
|
||||
* @name: name for the generated structure
|
||||
*
|
||||
* This macro autogenerates a suitable &struct file_operations for CMA based
|
||||
* drivers, which can be assigned to &drm_driver.fops. Note that this structure
|
||||
* cannot be shared between drivers, because it contains a reference to the
|
||||
* current module using THIS_MODULE.
|
||||
*
|
||||
* Note that the declaration is already marked as static - if you need a
|
||||
* non-static version of this you're probably doing it wrong and will break the
|
||||
* THIS_MODULE reference by accident.
|
||||
*/
|
||||
#define DEFINE_DRM_GEM_CMA_FOPS(name) \
|
||||
static const struct file_operations name = {\
|
||||
.owner = THIS_MODULE,\
|
||||
.open = drm_open,\
|
||||
.release = drm_release,\
|
||||
.unlocked_ioctl = drm_ioctl,\
|
||||
.compat_ioctl = drm_compat_ioctl,\
|
||||
.poll = drm_poll,\
|
||||
.read = drm_read,\
|
||||
.llseek = noop_llseek,\
|
||||
.mmap = drm_gem_cma_mmap,\
|
||||
}
|
||||
|
||||
/* free GEM object */
|
||||
void drm_gem_cma_free_object(struct drm_gem_object *gem_obj);
|
||||
|
||||
|
159
include/drm/drm_scdc_helper.h
Normal file
159
include/drm/drm_scdc_helper.h
Normal file
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 2015 NVIDIA Corporation. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sub license,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef DRM_SCDC_HELPER_H
|
||||
#define DRM_SCDC_HELPER_H
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#define SCDC_SINK_VERSION 0x01
|
||||
|
||||
#define SCDC_SOURCE_VERSION 0x02
|
||||
|
||||
#define SCDC_UPDATE_0 0x10
|
||||
#define SCDC_READ_REQUEST_TEST (1 << 2)
|
||||
#define SCDC_CED_UPDATE (1 << 1)
|
||||
#define SCDC_STATUS_UPDATE (1 << 0)
|
||||
|
||||
#define SCDC_UPDATE_1 0x11
|
||||
|
||||
#define SCDC_TMDS_CONFIG 0x20
|
||||
#define SCDC_TMDS_BIT_CLOCK_RATIO_BY_40 (1 << 1)
|
||||
#define SCDC_TMDS_BIT_CLOCK_RATIO_BY_10 (0 << 1)
|
||||
#define SCDC_SCRAMBLING_ENABLE (1 << 0)
|
||||
|
||||
#define SCDC_SCRAMBLER_STATUS 0x21
|
||||
#define SCDC_SCRAMBLING_STATUS (1 << 0)
|
||||
|
||||
#define SCDC_CONFIG_0 0x30
|
||||
#define SCDC_READ_REQUEST_ENABLE (1 << 0)
|
||||
|
||||
#define SCDC_STATUS_FLAGS_0 0x40
|
||||
#define SCDC_CH2_LOCK (1 < 3)
|
||||
#define SCDC_CH1_LOCK (1 < 2)
|
||||
#define SCDC_CH0_LOCK (1 < 1)
|
||||
#define SCDC_CH_LOCK_MASK (SCDC_CH2_LOCK | SCDC_CH1_LOCK | SCDC_CH0_LOCK)
|
||||
#define SCDC_CLOCK_DETECT (1 << 0)
|
||||
|
||||
#define SCDC_STATUS_FLAGS_1 0x41
|
||||
|
||||
#define SCDC_ERR_DET_0_L 0x50
|
||||
#define SCDC_ERR_DET_0_H 0x51
|
||||
#define SCDC_ERR_DET_1_L 0x52
|
||||
#define SCDC_ERR_DET_1_H 0x53
|
||||
#define SCDC_ERR_DET_2_L 0x54
|
||||
#define SCDC_ERR_DET_2_H 0x55
|
||||
#define SCDC_CHANNEL_VALID (1 << 7)
|
||||
|
||||
#define SCDC_ERR_DET_CHECKSUM 0x56
|
||||
|
||||
#define SCDC_TEST_CONFIG_0 0xc0
|
||||
#define SCDC_TEST_READ_REQUEST (1 << 7)
|
||||
#define SCDC_TEST_READ_REQUEST_DELAY(x) ((x) & 0x7f)
|
||||
|
||||
#define SCDC_MANUFACTURER_IEEE_OUI 0xd0
|
||||
#define SCDC_MANUFACTURER_IEEE_OUI_SIZE 3
|
||||
|
||||
#define SCDC_DEVICE_ID 0xd3
|
||||
#define SCDC_DEVICE_ID_SIZE 8
|
||||
|
||||
#define SCDC_DEVICE_HARDWARE_REVISION 0xdb
|
||||
#define SCDC_GET_DEVICE_HARDWARE_REVISION_MAJOR(x) (((x) >> 4) & 0xf)
|
||||
#define SCDC_GET_DEVICE_HARDWARE_REVISION_MINOR(x) (((x) >> 0) & 0xf)
|
||||
|
||||
#define SCDC_DEVICE_SOFTWARE_MAJOR_REVISION 0xdc
|
||||
#define SCDC_DEVICE_SOFTWARE_MINOR_REVISION 0xdd
|
||||
|
||||
#define SCDC_MANUFACTURER_SPECIFIC 0xde
|
||||
#define SCDC_MANUFACTURER_SPECIFIC_SIZE 34
|
||||
|
||||
ssize_t drm_scdc_read(struct i2c_adapter *adapter, u8 offset, void *buffer,
|
||||
size_t size);
|
||||
ssize_t drm_scdc_write(struct i2c_adapter *adapter, u8 offset,
|
||||
const void *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* drm_scdc_readb - read a single byte from SCDC
|
||||
* @adapter: I2C adapter
|
||||
* @offset: offset of register to read
|
||||
* @value: return location for the register value
|
||||
*
|
||||
* Reads a single byte from SCDC. This is a convenience wrapper around the
|
||||
* drm_scdc_read() function.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success or a negative error code on failure.
|
||||
*/
|
||||
static inline int drm_scdc_readb(struct i2c_adapter *adapter, u8 offset,
|
||||
u8 *value)
|
||||
{
|
||||
return drm_scdc_read(adapter, offset, value, sizeof(*value));
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_scdc_writeb - write a single byte to SCDC
|
||||
* @adapter: I2C adapter
|
||||
* @offset: offset of register to read
|
||||
* @value: return location for the register value
|
||||
*
|
||||
* Writes a single byte to SCDC. This is a convenience wrapper around the
|
||||
* drm_scdc_write() function.
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success or a negative error code on failure.
|
||||
*/
|
||||
static inline int drm_scdc_writeb(struct i2c_adapter *adapter, u8 offset,
|
||||
u8 value)
|
||||
{
|
||||
return drm_scdc_write(adapter, offset, &value, sizeof(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_scdc_set_scrambling - enable scrambling
|
||||
* @adapter: I2C adapter for DDC channel
|
||||
* @enable: bool to indicate if scrambling is to be enabled/disabled
|
||||
*
|
||||
* Writes the TMDS config register over SCDC channel, and:
|
||||
* enables scrambling when enable = 1
|
||||
* disables scrambling when enable = 0
|
||||
*
|
||||
* Returns:
|
||||
* True if scrambling is set/reset successfully, false otherwise.
|
||||
*/
|
||||
bool drm_scdc_set_scrambling(struct i2c_adapter *adapter, bool enable);
|
||||
|
||||
/**
|
||||
* drm_scdc_set_high_tmds_clock_ratio - set TMDS clock ratio
|
||||
* @adapter: I2C adapter for DDC channel
|
||||
* @set: ret or reset the high clock ratio
|
||||
*
|
||||
* Writes to the TMDS config register over SCDC channel, and:
|
||||
* sets TMDS clock ratio to 1/40 when set = 1
|
||||
* sets TMDS clock ratio to 1/10 when set = 0
|
||||
*
|
||||
* Returns:
|
||||
* True if write is successful, false otherwise.
|
||||
*/
|
||||
bool drm_scdc_set_high_tmds_clock_ratio(struct i2c_adapter *adapter, bool set);
|
||||
#endif
|
Reference in New Issue
Block a user