Merge airlied/drm-next into drm-misc-next

Backmerge the main pull request to sync up with all the newly landed
drivers. Otherwise we'll have chaos even before 4.12 started in
earnest.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
This commit is contained in:
Daniel Vetter
2017-02-26 21:34:42 +01:00
888 changed files with 20329 additions and 8037 deletions

View File

@@ -518,6 +518,7 @@ struct drm_device {
struct drm_minor *control; /**< Control node */
struct drm_minor *primary; /**< Primary node */
struct drm_minor *render; /**< Render node */
bool registered;
/* currently active master for this device. Protected by master_mutex */
struct drm_master *master;

View File

@@ -145,7 +145,7 @@ struct __drm_crtcs_state {
struct drm_crtc *ptr;
struct drm_crtc_state *state, *old_state, *new_state;
struct drm_crtc_commit *commit;
s64 __user *out_fence_ptr;
s32 __user *out_fence_ptr;
unsigned last_vblank_count;
};

View File

@@ -496,7 +496,7 @@ struct drm_mode_config {
/**
* @prop_out_fence_ptr: Sync File fd pointer representing the
* outgoing fences for a CRTC. Userspace should provide a pointer to a
* value of type s64, and then cast that pointer to u64.
* value of type s32, and then cast that pointer to u64.
*/
struct drm_property *prop_out_fence_ptr;
/**

View File

@@ -193,9 +193,9 @@ int drm_panel_attach(struct drm_panel *panel, struct drm_connector *connector);
int drm_panel_detach(struct drm_panel *panel);
#ifdef CONFIG_OF
struct drm_panel *of_drm_find_panel(struct device_node *np);
struct drm_panel *of_drm_find_panel(const struct device_node *np);
#else
static inline struct drm_panel *of_drm_find_panel(struct device_node *np)
static inline struct drm_panel *of_drm_find_panel(const struct device_node *np)
{
return NULL;
}

View File

@@ -0,0 +1,54 @@
/*
* ILI9341 LCD controller
*
* Copyright 2016 Noralf Trønnes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __LINUX_ILI9341_H
#define __LINUX_ILI9341_H
#define ILI9341_FRMCTR1 0xb1
#define ILI9341_FRMCTR2 0xb2
#define ILI9341_FRMCTR3 0xb3
#define ILI9341_INVTR 0xb4
#define ILI9341_PRCTR 0xb5
#define ILI9341_DISCTRL 0xb6
#define ILI9341_ETMOD 0xb7
#define ILI9341_PWCTRL1 0xc0
#define ILI9341_PWCTRL2 0xc1
#define ILI9341_VMCTRL1 0xc5
#define ILI9341_VMCTRL2 0xc7
#define ILI9341_PWCTRLA 0xcb
#define ILI9341_PWCTRLB 0xcf
#define ILI9341_RDID1 0xda
#define ILI9341_RDID2 0xdb
#define ILI9341_RDID3 0xdc
#define ILI9341_RDID4 0xd3
#define ILI9341_PGAMCTRL 0xe0
#define ILI9341_NGAMCTRL 0xe1
#define ILI9341_DGAMCTRL1 0xe2
#define ILI9341_DGAMCTRL2 0xe3
#define ILI9341_DTCTRLA 0xe8
#define ILI9341_DTCTRLB 0xea
#define ILI9341_PWRSEQ 0xed
#define ILI9341_EN3GAM 0xf2
#define ILI9341_IFCTRL 0xf6
#define ILI9341_PUMPCTRL 0xf7
#define ILI9341_MADCTL_MH BIT(2)
#define ILI9341_MADCTL_BGR BIT(3)
#define ILI9341_MADCTL_ML BIT(4)
#define ILI9341_MADCTL_MV BIT(5)
#define ILI9341_MADCTL_MX BIT(6)
#define ILI9341_MADCTL_MY BIT(7)
#endif /* __LINUX_ILI9341_H */

View File

@@ -0,0 +1,107 @@
/*
* MIPI Display Bus Interface (DBI) LCD controller support
*
* Copyright 2016 Noralf Trønnes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __LINUX_MIPI_DBI_H
#define __LINUX_MIPI_DBI_H
#include <drm/tinydrm/tinydrm.h>
struct spi_device;
struct gpio_desc;
struct regulator;
/**
* struct mipi_dbi - MIPI DBI controller
* @tinydrm: tinydrm base
* @spi: SPI device
* @enabled: Pipeline is enabled
* @cmdlock: Command lock
* @command: Bus specific callback executing commands.
* @read_commands: Array of read commands terminated by a zero entry.
* Reading is disabled if this is NULL.
* @dc: Optional D/C gpio.
* @tx_buf: Buffer used for transfer (copy clip rect area)
* @tx_buf9: Buffer used for Option 1 9-bit conversion
* @tx_buf9_len: Size of tx_buf9.
* @swap_bytes: Swap bytes in buffer before transfer
* @reset: Optional reset gpio
* @rotation: initial rotation in degrees Counter Clock Wise
* @backlight: backlight device (optional)
* @regulator: power regulator (optional)
*/
struct mipi_dbi {
struct tinydrm_device tinydrm;
struct spi_device *spi;
bool enabled;
struct mutex cmdlock;
int (*command)(struct mipi_dbi *mipi, u8 cmd, u8 *param, size_t num);
const u8 *read_commands;
struct gpio_desc *dc;
u16 *tx_buf;
void *tx_buf9;
size_t tx_buf9_len;
bool swap_bytes;
struct gpio_desc *reset;
unsigned int rotation;
struct backlight_device *backlight;
struct regulator *regulator;
};
static inline struct mipi_dbi *
mipi_dbi_from_tinydrm(struct tinydrm_device *tdev)
{
return container_of(tdev, struct mipi_dbi, tinydrm);
}
int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi,
struct gpio_desc *dc,
const struct drm_simple_display_pipe_funcs *pipe_funcs,
struct drm_driver *driver,
const struct drm_display_mode *mode,
unsigned int rotation);
int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi,
const struct drm_simple_display_pipe_funcs *pipe_funcs,
struct drm_driver *driver,
const struct drm_display_mode *mode, unsigned int rotation);
void mipi_dbi_pipe_enable(struct drm_simple_display_pipe *pipe,
struct drm_crtc_state *crtc_state);
void mipi_dbi_pipe_disable(struct drm_simple_display_pipe *pipe);
void mipi_dbi_hw_reset(struct mipi_dbi *mipi);
bool mipi_dbi_display_is_on(struct mipi_dbi *mipi);
int mipi_dbi_command_read(struct mipi_dbi *mipi, u8 cmd, u8 *val);
int mipi_dbi_command_buf(struct mipi_dbi *mipi, u8 cmd, u8 *data, size_t len);
/**
* mipi_dbi_command - MIPI DCS command with optional parameter(s)
* @mipi: MIPI structure
* @cmd: Command
* @seq...: Optional parameter(s)
*
* Send MIPI DCS command to the controller. Use mipi_dbi_command_read() for
* get/read.
*
* Returns:
* Zero on success, negative error code on failure.
*/
#define mipi_dbi_command(mipi, cmd, seq...) \
({ \
u8 d[] = { seq }; \
mipi_dbi_command_buf(mipi, cmd, d, ARRAY_SIZE(d)); \
})
#ifdef CONFIG_DEBUG_FS
int mipi_dbi_debugfs_init(struct drm_minor *minor);
#else
#define mipi_dbi_debugfs_init NULL
#endif
#endif /* __LINUX_MIPI_DBI_H */

View File

@@ -0,0 +1,81 @@
/*
* Copyright (C) 2016 Noralf Trønnes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __LINUX_TINYDRM_HELPERS_H
#define __LINUX_TINYDRM_HELPERS_H
struct backlight_device;
struct tinydrm_device;
struct drm_clip_rect;
struct spi_transfer;
struct spi_message;
struct spi_device;
struct device;
/**
* tinydrm_machine_little_endian - Machine is little endian
*
* Returns:
* true if *defined(__LITTLE_ENDIAN)*, false otherwise
*/
static inline bool tinydrm_machine_little_endian(void)
{
#if defined(__LITTLE_ENDIAN)
return true;
#else
return false;
#endif
}
bool tinydrm_merge_clips(struct drm_clip_rect *dst,
struct drm_clip_rect *src, unsigned int num_clips,
unsigned int flags, u32 max_width, u32 max_height);
void tinydrm_memcpy(void *dst, void *vaddr, struct drm_framebuffer *fb,
struct drm_clip_rect *clip);
void tinydrm_swab16(u16 *dst, void *vaddr, struct drm_framebuffer *fb,
struct drm_clip_rect *clip);
void tinydrm_xrgb8888_to_rgb565(u16 *dst, void *vaddr,
struct drm_framebuffer *fb,
struct drm_clip_rect *clip, bool swap);
struct backlight_device *tinydrm_of_find_backlight(struct device *dev);
int tinydrm_enable_backlight(struct backlight_device *backlight);
int tinydrm_disable_backlight(struct backlight_device *backlight);
size_t tinydrm_spi_max_transfer_size(struct spi_device *spi, size_t max_len);
bool tinydrm_spi_bpw_supported(struct spi_device *spi, u8 bpw);
int tinydrm_spi_transfer(struct spi_device *spi, u32 speed_hz,
struct spi_transfer *header, u8 bpw, const void *buf,
size_t len);
void _tinydrm_dbg_spi_message(struct spi_device *spi, struct spi_message *m);
#ifdef DEBUG
/**
* tinydrm_dbg_spi_message - Dump SPI message
* @spi: SPI device
* @m: SPI message
*
* Dumps info about the transfers in a SPI message including buffer content.
* DEBUG has to be defined for this function to be enabled alongside setting
* the DRM_UT_DRIVER bit of &drm_debug.
*/
static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
struct spi_message *m)
{
if (drm_debug & DRM_UT_DRIVER)
_tinydrm_dbg_spi_message(spi, m);
}
#else
static inline void tinydrm_dbg_spi_message(struct spi_device *spi,
struct spi_message *m)
{
}
#endif /* DEBUG */
#endif /* __LINUX_TINYDRM_HELPERS_H */

View File

@@ -0,0 +1,115 @@
/*
* Copyright (C) 2016 Noralf Trønnes
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#ifndef __LINUX_TINYDRM_H
#define __LINUX_TINYDRM_H
#include <drm/drm_gem_cma_helper.h>
#include <drm/drm_fb_cma_helper.h>
#include <drm/drm_simple_kms_helper.h>
/**
* struct tinydrm_device - tinydrm device
* @drm: DRM device
* @pipe: Display pipe structure
* @dirty_lock: Serializes framebuffer flushing
* @fbdev_cma: CMA fbdev structure
* @suspend_state: Atomic state when suspended
* @fb_funcs: Framebuffer functions used when creating framebuffers
*/
struct tinydrm_device {
struct drm_device *drm;
struct drm_simple_display_pipe pipe;
struct mutex dirty_lock;
struct drm_fbdev_cma *fbdev_cma;
struct drm_atomic_state *suspend_state;
const struct drm_framebuffer_funcs *fb_funcs;
};
static inline struct tinydrm_device *
pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
{
return container_of(pipe, struct tinydrm_device, pipe);
}
/**
* TINYDRM_GEM_DRIVER_OPS - default tinydrm gem operations
*
* This macro provides a shortcut for setting the tinydrm GEM operations in
* the &drm_driver structure.
*/
#define TINYDRM_GEM_DRIVER_OPS \
.gem_free_object = tinydrm_gem_cma_free_object, \
.gem_vm_ops = &drm_gem_cma_vm_ops, \
.prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
.prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
.gem_prime_import = drm_gem_prime_import, \
.gem_prime_export = drm_gem_prime_export, \
.gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, \
.gem_prime_import_sg_table = tinydrm_gem_cma_prime_import_sg_table, \
.gem_prime_vmap = drm_gem_cma_prime_vmap, \
.gem_prime_vunmap = drm_gem_cma_prime_vunmap, \
.gem_prime_mmap = drm_gem_cma_prime_mmap, \
.dumb_create = drm_gem_cma_dumb_create, \
.dumb_map_offset = drm_gem_cma_dumb_map_offset, \
.dumb_destroy = drm_gem_dumb_destroy, \
.fops = &tinydrm_fops
/**
* TINYDRM_MODE - tinydrm display mode
* @hd: Horizontal resolution, width
* @vd: Vertical resolution, height
* @hd_mm: Display width in millimeters
* @vd_mm: Display height in millimeters
*
* This macro creates a &drm_display_mode for use with tinydrm.
*/
#define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \
.hdisplay = (hd), \
.hsync_start = (hd), \
.hsync_end = (hd), \
.htotal = (hd), \
.vdisplay = (vd), \
.vsync_start = (vd), \
.vsync_end = (vd), \
.vtotal = (vd), \
.width_mm = (hd_mm), \
.height_mm = (vd_mm), \
.type = DRM_MODE_TYPE_DRIVER, \
.clock = 1 /* pass validation */
extern const struct file_operations tinydrm_fops;
void tinydrm_lastclose(struct drm_device *drm);
void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj);
struct drm_gem_object *
tinydrm_gem_cma_prime_import_sg_table(struct drm_device *drm,
struct dma_buf_attachment *attach,
struct sg_table *sgt);
int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
const struct drm_framebuffer_funcs *fb_funcs,
struct drm_driver *driver);
int devm_tinydrm_register(struct tinydrm_device *tdev);
void tinydrm_shutdown(struct tinydrm_device *tdev);
int tinydrm_suspend(struct tinydrm_device *tdev);
int tinydrm_resume(struct tinydrm_device *tdev);
void tinydrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *old_state);
int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state);
int
tinydrm_display_pipe_init(struct tinydrm_device *tdev,
const struct drm_simple_display_pipe_funcs *funcs,
int connector_type,
const uint32_t *formats,
unsigned int format_count,
const struct drm_display_mode *mode,
unsigned int rotation);
#endif /* __LINUX_TINYDRM_H */

View File

@@ -42,7 +42,7 @@
#include <linux/spinlock.h>
#include <linux/reservation.h>
#define TTM_MAX_BO_PRIORITY 16
#define TTM_MAX_BO_PRIORITY 16U
struct ttm_backend_func {
/**