Files
linux-apfs/drivers/gpu/drm/rcar-du/rcar_du_drv.h
T

118 lines
3.1 KiB
C
Raw Normal View History

2013-06-19 13:54:11 +02:00
/*
* rcar_du_drv.h -- R-Car Display Unit DRM driver
*
2014-02-06 18:13:52 +01:00
* Copyright (C) 2013-2014 Renesas Electronics Corporation
2013-06-19 13:54:11 +02:00
*
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
*
* 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 __RCAR_DU_DRV_H__
#define __RCAR_DU_DRV_H__
#include <linux/kernel.h>
#include <linux/wait.h>
2013-06-19 13:54:11 +02:00
#include "rcar_du_crtc.h"
2013-06-16 21:01:02 +02:00
#include "rcar_du_group.h"
2013-06-19 13:54:11 +02:00
struct clk;
struct device;
struct drm_device;
2013-03-14 22:45:22 +01:00
struct drm_fbdev_cma;
2013-06-16 21:01:02 +02:00
struct rcar_du_device;
struct rcar_du_lvdsenc;
2013-06-19 13:54:11 +02:00
2013-06-14 14:15:01 +02:00
#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */
2014-12-09 00:21:12 +02:00
#define RCAR_DU_FEATURE_EXT_CTRL_REGS (1 << 1) /* Has extended control registers */
2013-11-13 13:33:45 +01:00
#define RCAR_DU_QUIRK_ALIGN_128B (1 << 0) /* Align pitches to 128 bytes */
2013-11-13 13:35:15 +01:00
#define RCAR_DU_QUIRK_LVDS_LANES (1 << 1) /* LVDS lanes 1 and 3 inverted */
2013-06-14 14:15:01 +02:00
2013-06-17 03:13:11 +02:00
/*
* struct rcar_du_output_routing - Output routing specification
* @possible_crtcs: bitmask of possible CRTCs for the output
* @encoder_type: DRM type of the internal encoder associated with the output
2014-01-21 15:57:26 +01:00
* @port: device tree port number corresponding to this output route
2013-06-17 03:13:11 +02:00
*
* The DU has 5 possible outputs (DPAD0/1, LVDS0/1, TCON). Output routing data
* specify the valid SoC outputs, which CRTCs can drive the output, and the type
* of in-SoC encoder for the output.
*/
struct rcar_du_output_routing {
unsigned int possible_crtcs;
unsigned int encoder_type;
2014-01-21 15:57:26 +01:00
unsigned int port;
2013-06-17 03:13:11 +02:00
};
/*
* struct rcar_du_device_info - DU model-specific information
* @features: device features (RCAR_DU_FEATURE_*)
2013-11-13 13:33:45 +01:00
* @quirks: device quirks (RCAR_DU_QUIRK_*)
* @num_crtcs: total number of CRTCs
2013-06-17 03:13:11 +02:00
* @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*)
* @num_lvds: number of internal LVDS encoders
*/
struct rcar_du_device_info {
unsigned int features;
2013-11-13 13:33:45 +01:00
unsigned int quirks;
unsigned int num_crtcs;
2013-06-17 03:13:11 +02:00
struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
unsigned int num_lvds;
};
#define RCAR_DU_MAX_CRTCS 3
#define RCAR_DU_MAX_GROUPS DIV_ROUND_UP(RCAR_DU_MAX_CRTCS, 2)
#define RCAR_DU_MAX_LVDS 2
2013-06-19 13:54:11 +02:00
struct rcar_du_device {
struct device *dev;
const struct rcar_du_device_info *info;
2013-06-19 13:54:11 +02:00
void __iomem *mmio;
struct drm_device *ddev;
2013-03-14 22:45:22 +01:00
struct drm_fbdev_cma *fbdev;
2013-06-19 13:54:11 +02:00
struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
2013-06-19 13:54:11 +02:00
unsigned int num_crtcs;
struct rcar_du_group groups[RCAR_DU_MAX_GROUPS];
unsigned int dpad0_source;
struct rcar_du_lvdsenc *lvds[RCAR_DU_MAX_LVDS];
struct {
wait_queue_head_t wait;
u32 pending;
} commit;
2013-06-19 13:54:11 +02:00
};
static inline bool rcar_du_has(struct rcar_du_device *rcdu,
unsigned int feature)
{
return rcdu->info->features & feature;
}
2013-11-13 13:33:45 +01:00
static inline bool rcar_du_needs(struct rcar_du_device *rcdu,
unsigned int quirk)
{
return rcdu->info->quirks & quirk;
}
2013-06-19 13:54:11 +02:00
static inline u32 rcar_du_read(struct rcar_du_device *rcdu, u32 reg)
{
return ioread32(rcdu->mmio + reg);
}
static inline void rcar_du_write(struct rcar_du_device *rcdu, u32 reg, u32 data)
{
iowrite32(data, rcdu->mmio + reg);
}
#endif /* __RCAR_DU_DRV_H__ */