
drm-misc-next for v5.6: UAPI Changes: - Add support for DMA-BUF HEAPS. Cross-subsystem Changes: - mipi dsi definition updates, pulled into drm-intel as well. - Add lockdep annotations for dma_resv vs mmap_sem and fs_reclaim. - Remove support for dma-buf kmap/kunmap. - Constify fb_ops in all fbdev drivers, including drm drivers and drm-core, and media as well. Core Changes: - Small cleanups to ttm. - Fix SCDC definition. - Assorted cleanups to core. - Add todo to remove load/unload hooks, and use generic fbdev emulation. - Assorted documentation updates. - Use blocking ww lock in ttm fault handler. - Remove drm_fb_helper_fbdev_setup/teardown. - Warning fixes with W=1 for atomic. - Use drm_debug_enabled() instead of drm_debug flag testing in various drivers. - Fallback to nontiled mode in fbdev emulation when not all tiles are present. (Later on reverted) - Various kconfig indentation fixes in core and drivers. - Fix freeing transactions in dp-mst correctly. - Sean Paul is steping down as core maintainer. :-( - Add lockdep annotations for atomic locks vs dma-resv. - Prevent use-after-free for a bad job in drm_scheduler. - Fill out all block sizes in the P01x and P210 definitions. - Avoid division by zero in drm/rect, and fix bounds. - Add drm/rect selftests. - Add aspect ratio and alternate clocks for HDMI 4k modes. - Add todo for drm_framebuffer_funcs and fb_create cleanup. - Drop DRM_AUTH for prime import/export ioctls. - Clear DP-MST payload id tables downstream when initializating. - Fix for DSC throughput definition. - Add extra FEC definitions. - Fix fake offset in drm_gem_object_funs.mmap. - Stop using encoder->bridge in core directly - Handle bridge chaining slightly better. - Add backlight support to drm/panel, and use it in many panel drivers. - Increase max number of y420 modes from 128 to 256, as preparation to add the new modes. Driver Changes: - Small fixes all over. - Fix documentation in vkms. - Fix mmap_sem vs dma_resv in nouveau. - Small cleanup in komeda. - Add page flip support in gma500 for psb/cdv. - Add ddc symlink in the connector sysfs directory for many drivers. - Add support for analogic an6345, and fix small bugs in it. - Add atomic modesetting support to ast. - Fix radeon fault handler VMA race. - Switch udl to use generic shmem helpers. - Unconditional vblank handling for mcde. - Miscellaneous fixes to mcde. - Tweak debug output from komeda using debugfs. - Add gamma and color transform support to komeda for DOU-IPS. - Add support for sony acx424AKP panel. - Various small cleanups to gma500. - Use generic fbdev emulation in udl, and replace udl_framebuffer with generic implementation. - Add support for Logic PD Type 28 panel. - Use drm_panel_* wrapper functions in exynos/tegra/msm. - Add devicetree bindings for generic DSI panels. - Don't include drm_pci.h directly in many drivers. - Add support for begin/end_cpu_access in udmabuf. - Stop using drm_get_pci_dev in gma500 and mga200. - Fixes to UDL damage handling, and use dma_buf_begin/end_cpu_access. - Add devfreq thermal support to panfrost. - Fix hotplug with daisy chained monitors by removing VCPI when disabling topology manager. - meson: Add support for OSD1 plane AFBC commit. - Stop displaying garbage when toggling ast primary plane on/off. - More cleanups and fixes to UDL. - Add D32 suport to komeda. - Remove globle copy of drm_dev in gma500. - Add support for Boe Himax8279d MIPI-DSI LCD panel. - Add support for ingenic JZ4770 panel. - Small null pointer deference fix in ingenic. - Remove support for the special tfp420 driver, as there is a generic way to do it. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/ba73535a-9334-5302-2e1f-5208bd7390bd@linux.intel.com
321 lines
8.1 KiB
C
321 lines
8.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
/*
|
|
* Copyright (c) 2009-2013, NVIDIA Corporation. All rights reserved.
|
|
*/
|
|
|
|
#ifndef __LINUX_HOST1X_H
|
|
#define __LINUX_HOST1X_H
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/types.h>
|
|
|
|
enum host1x_class {
|
|
HOST1X_CLASS_HOST1X = 0x1,
|
|
HOST1X_CLASS_GR2D = 0x51,
|
|
HOST1X_CLASS_GR2D_SB = 0x52,
|
|
HOST1X_CLASS_VIC = 0x5D,
|
|
HOST1X_CLASS_GR3D = 0x60,
|
|
};
|
|
|
|
struct host1x_client;
|
|
struct iommu_group;
|
|
|
|
/**
|
|
* struct host1x_client_ops - host1x client operations
|
|
* @init: host1x client initialization code
|
|
* @exit: host1x client tear down code
|
|
*/
|
|
struct host1x_client_ops {
|
|
int (*init)(struct host1x_client *client);
|
|
int (*exit)(struct host1x_client *client);
|
|
};
|
|
|
|
/**
|
|
* struct host1x_client - host1x client structure
|
|
* @list: list node for the host1x client
|
|
* @parent: pointer to struct device representing the host1x controller
|
|
* @dev: pointer to struct device backing this host1x client
|
|
* @group: IOMMU group that this client is a member of
|
|
* @ops: host1x client operations
|
|
* @class: host1x class represented by this client
|
|
* @channel: host1x channel associated with this client
|
|
* @syncpts: array of syncpoints requested for this client
|
|
* @num_syncpts: number of syncpoints requested for this client
|
|
*/
|
|
struct host1x_client {
|
|
struct list_head list;
|
|
struct device *parent;
|
|
struct device *dev;
|
|
struct iommu_group *group;
|
|
|
|
const struct host1x_client_ops *ops;
|
|
|
|
enum host1x_class class;
|
|
struct host1x_channel *channel;
|
|
|
|
struct host1x_syncpt **syncpts;
|
|
unsigned int num_syncpts;
|
|
};
|
|
|
|
/*
|
|
* host1x buffer objects
|
|
*/
|
|
|
|
struct host1x_bo;
|
|
struct sg_table;
|
|
|
|
struct host1x_bo_ops {
|
|
struct host1x_bo *(*get)(struct host1x_bo *bo);
|
|
void (*put)(struct host1x_bo *bo);
|
|
struct sg_table *(*pin)(struct device *dev, struct host1x_bo *bo,
|
|
dma_addr_t *phys);
|
|
void (*unpin)(struct device *dev, struct sg_table *sgt);
|
|
void *(*mmap)(struct host1x_bo *bo);
|
|
void (*munmap)(struct host1x_bo *bo, void *addr);
|
|
};
|
|
|
|
struct host1x_bo {
|
|
const struct host1x_bo_ops *ops;
|
|
};
|
|
|
|
static inline void host1x_bo_init(struct host1x_bo *bo,
|
|
const struct host1x_bo_ops *ops)
|
|
{
|
|
bo->ops = ops;
|
|
}
|
|
|
|
static inline struct host1x_bo *host1x_bo_get(struct host1x_bo *bo)
|
|
{
|
|
return bo->ops->get(bo);
|
|
}
|
|
|
|
static inline void host1x_bo_put(struct host1x_bo *bo)
|
|
{
|
|
bo->ops->put(bo);
|
|
}
|
|
|
|
static inline struct sg_table *host1x_bo_pin(struct device *dev,
|
|
struct host1x_bo *bo,
|
|
dma_addr_t *phys)
|
|
{
|
|
return bo->ops->pin(dev, bo, phys);
|
|
}
|
|
|
|
static inline void host1x_bo_unpin(struct device *dev, struct host1x_bo *bo,
|
|
struct sg_table *sgt)
|
|
{
|
|
bo->ops->unpin(dev, sgt);
|
|
}
|
|
|
|
static inline void *host1x_bo_mmap(struct host1x_bo *bo)
|
|
{
|
|
return bo->ops->mmap(bo);
|
|
}
|
|
|
|
static inline void host1x_bo_munmap(struct host1x_bo *bo, void *addr)
|
|
{
|
|
bo->ops->munmap(bo, addr);
|
|
}
|
|
|
|
/*
|
|
* host1x syncpoints
|
|
*/
|
|
|
|
#define HOST1X_SYNCPT_CLIENT_MANAGED (1 << 0)
|
|
#define HOST1X_SYNCPT_HAS_BASE (1 << 1)
|
|
|
|
struct host1x_syncpt_base;
|
|
struct host1x_syncpt;
|
|
struct host1x;
|
|
|
|
struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, u32 id);
|
|
u32 host1x_syncpt_id(struct host1x_syncpt *sp);
|
|
u32 host1x_syncpt_read_min(struct host1x_syncpt *sp);
|
|
u32 host1x_syncpt_read_max(struct host1x_syncpt *sp);
|
|
u32 host1x_syncpt_read(struct host1x_syncpt *sp);
|
|
int host1x_syncpt_incr(struct host1x_syncpt *sp);
|
|
u32 host1x_syncpt_incr_max(struct host1x_syncpt *sp, u32 incrs);
|
|
int host1x_syncpt_wait(struct host1x_syncpt *sp, u32 thresh, long timeout,
|
|
u32 *value);
|
|
struct host1x_syncpt *host1x_syncpt_request(struct host1x_client *client,
|
|
unsigned long flags);
|
|
void host1x_syncpt_free(struct host1x_syncpt *sp);
|
|
|
|
struct host1x_syncpt_base *host1x_syncpt_get_base(struct host1x_syncpt *sp);
|
|
u32 host1x_syncpt_base_id(struct host1x_syncpt_base *base);
|
|
|
|
/*
|
|
* host1x channel
|
|
*/
|
|
|
|
struct host1x_channel;
|
|
struct host1x_job;
|
|
|
|
struct host1x_channel *host1x_channel_request(struct host1x_client *client);
|
|
struct host1x_channel *host1x_channel_get(struct host1x_channel *channel);
|
|
void host1x_channel_put(struct host1x_channel *channel);
|
|
int host1x_job_submit(struct host1x_job *job);
|
|
|
|
/*
|
|
* host1x job
|
|
*/
|
|
|
|
#define HOST1X_RELOC_READ (1 << 0)
|
|
#define HOST1X_RELOC_WRITE (1 << 1)
|
|
|
|
struct host1x_reloc {
|
|
struct {
|
|
struct host1x_bo *bo;
|
|
unsigned long offset;
|
|
} cmdbuf;
|
|
struct {
|
|
struct host1x_bo *bo;
|
|
unsigned long offset;
|
|
} target;
|
|
unsigned long shift;
|
|
unsigned long flags;
|
|
};
|
|
|
|
struct host1x_job {
|
|
/* When refcount goes to zero, job can be freed */
|
|
struct kref ref;
|
|
|
|
/* List entry */
|
|
struct list_head list;
|
|
|
|
/* Channel where job is submitted to */
|
|
struct host1x_channel *channel;
|
|
|
|
/* client where the job originated */
|
|
struct host1x_client *client;
|
|
|
|
/* Gathers and their memory */
|
|
struct host1x_job_gather *gathers;
|
|
unsigned int num_gathers;
|
|
|
|
/* Array of handles to be pinned & unpinned */
|
|
struct host1x_reloc *relocs;
|
|
unsigned int num_relocs;
|
|
struct host1x_job_unpin_data *unpins;
|
|
unsigned int num_unpins;
|
|
|
|
dma_addr_t *addr_phys;
|
|
dma_addr_t *gather_addr_phys;
|
|
dma_addr_t *reloc_addr_phys;
|
|
|
|
/* Sync point id, number of increments and end related to the submit */
|
|
u32 syncpt_id;
|
|
u32 syncpt_incrs;
|
|
u32 syncpt_end;
|
|
|
|
/* Maximum time to wait for this job */
|
|
unsigned int timeout;
|
|
|
|
/* Index and number of slots used in the push buffer */
|
|
unsigned int first_get;
|
|
unsigned int num_slots;
|
|
|
|
/* Copy of gathers */
|
|
size_t gather_copy_size;
|
|
dma_addr_t gather_copy;
|
|
u8 *gather_copy_mapped;
|
|
|
|
/* Check if register is marked as an address reg */
|
|
int (*is_addr_reg)(struct device *dev, u32 class, u32 reg);
|
|
|
|
/* Check if class belongs to the unit */
|
|
int (*is_valid_class)(u32 class);
|
|
|
|
/* Request a SETCLASS to this class */
|
|
u32 class;
|
|
|
|
/* Add a channel wait for previous ops to complete */
|
|
bool serialize;
|
|
};
|
|
|
|
struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
|
|
u32 num_cmdbufs, u32 num_relocs);
|
|
void host1x_job_add_gather(struct host1x_job *job, struct host1x_bo *bo,
|
|
unsigned int words, unsigned int offset);
|
|
struct host1x_job *host1x_job_get(struct host1x_job *job);
|
|
void host1x_job_put(struct host1x_job *job);
|
|
int host1x_job_pin(struct host1x_job *job, struct device *dev);
|
|
void host1x_job_unpin(struct host1x_job *job);
|
|
|
|
/*
|
|
* subdevice probe infrastructure
|
|
*/
|
|
|
|
struct host1x_device;
|
|
|
|
/**
|
|
* struct host1x_driver - host1x logical device driver
|
|
* @driver: core driver
|
|
* @subdevs: table of OF device IDs matching subdevices for this driver
|
|
* @list: list node for the driver
|
|
* @probe: called when the host1x logical device is probed
|
|
* @remove: called when the host1x logical device is removed
|
|
* @shutdown: called when the host1x logical device is shut down
|
|
*/
|
|
struct host1x_driver {
|
|
struct device_driver driver;
|
|
|
|
const struct of_device_id *subdevs;
|
|
struct list_head list;
|
|
|
|
int (*probe)(struct host1x_device *device);
|
|
int (*remove)(struct host1x_device *device);
|
|
void (*shutdown)(struct host1x_device *device);
|
|
};
|
|
|
|
static inline struct host1x_driver *
|
|
to_host1x_driver(struct device_driver *driver)
|
|
{
|
|
return container_of(driver, struct host1x_driver, driver);
|
|
}
|
|
|
|
int host1x_driver_register_full(struct host1x_driver *driver,
|
|
struct module *owner);
|
|
void host1x_driver_unregister(struct host1x_driver *driver);
|
|
|
|
#define host1x_driver_register(driver) \
|
|
host1x_driver_register_full(driver, THIS_MODULE)
|
|
|
|
struct host1x_device {
|
|
struct host1x_driver *driver;
|
|
struct list_head list;
|
|
struct device dev;
|
|
|
|
struct mutex subdevs_lock;
|
|
struct list_head subdevs;
|
|
struct list_head active;
|
|
|
|
struct mutex clients_lock;
|
|
struct list_head clients;
|
|
|
|
bool registered;
|
|
|
|
struct device_dma_parameters dma_parms;
|
|
};
|
|
|
|
static inline struct host1x_device *to_host1x_device(struct device *dev)
|
|
{
|
|
return container_of(dev, struct host1x_device, dev);
|
|
}
|
|
|
|
int host1x_device_init(struct host1x_device *device);
|
|
int host1x_device_exit(struct host1x_device *device);
|
|
|
|
int host1x_client_register(struct host1x_client *client);
|
|
int host1x_client_unregister(struct host1x_client *client);
|
|
|
|
struct tegra_mipi_device;
|
|
|
|
struct tegra_mipi_device *tegra_mipi_request(struct device *device);
|
|
void tegra_mipi_free(struct tegra_mipi_device *device);
|
|
int tegra_mipi_enable(struct tegra_mipi_device *device);
|
|
int tegra_mipi_disable(struct tegra_mipi_device *device);
|
|
int tegra_mipi_calibrate(struct tegra_mipi_device *device);
|
|
|
|
#endif
|