2013-06-19 18:54:11 +07:00
|
|
|
/*
|
|
|
|
* rcar_du_drv.h -- R-Car Display Unit DRM driver
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 Renesas Corporation
|
|
|
|
*
|
|
|
|
* 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/platform_data/rcar-du.h>
|
|
|
|
|
|
|
|
#include "rcar_du_crtc.h"
|
2013-06-17 02:01:02 +07:00
|
|
|
#include "rcar_du_group.h"
|
2013-06-19 18:54:11 +07:00
|
|
|
|
|
|
|
struct clk;
|
|
|
|
struct device;
|
|
|
|
struct drm_device;
|
2013-03-15 04:45:22 +07:00
|
|
|
struct drm_fbdev_cma;
|
2013-06-17 02:01:02 +07:00
|
|
|
struct rcar_du_device;
|
2013-06-17 18:48:27 +07:00
|
|
|
struct rcar_du_lvdsenc;
|
2013-06-19 18:54:11 +07:00
|
|
|
|
2013-06-14 19:15:01 +07:00
|
|
|
#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */
|
2013-06-15 01:52:52 +07:00
|
|
|
#define RCAR_DU_FEATURE_ALIGN_128B (1 << 1) /* Align pitches to 128 bytes */
|
2013-06-15 07:40:57 +07:00
|
|
|
#define RCAR_DU_FEATURE_DEFR8 (1 << 2) /* Has DEFR8 register */
|
2013-06-14 19:15:01 +07:00
|
|
|
|
2013-06-17 08:13:11 +07: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
|
|
|
|
*
|
|
|
|
* 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;
|
|
|
|
};
|
|
|
|
|
2013-06-14 18:38:33 +07:00
|
|
|
/*
|
|
|
|
* struct rcar_du_device_info - DU model-specific information
|
|
|
|
* @features: device features (RCAR_DU_FEATURE_*)
|
2013-06-17 05:29:25 +07:00
|
|
|
* @num_crtcs: total number of CRTCs
|
2013-06-17 08:13:11 +07:00
|
|
|
* @routes: array of CRTC to output routes, indexed by output (RCAR_DU_OUTPUT_*)
|
2013-06-17 18:48:27 +07:00
|
|
|
* @num_lvds: number of internal LVDS encoders
|
2013-06-14 18:38:33 +07:00
|
|
|
*/
|
|
|
|
struct rcar_du_device_info {
|
|
|
|
unsigned int features;
|
2013-06-17 05:29:25 +07:00
|
|
|
unsigned int num_crtcs;
|
2013-06-17 08:13:11 +07:00
|
|
|
struct rcar_du_output_routing routes[RCAR_DU_OUTPUT_MAX];
|
2013-06-17 18:48:27 +07:00
|
|
|
unsigned int num_lvds;
|
2013-06-14 18:38:33 +07:00
|
|
|
};
|
|
|
|
|
2013-06-19 18:54:11 +07:00
|
|
|
struct rcar_du_device {
|
|
|
|
struct device *dev;
|
|
|
|
const struct rcar_du_platform_data *pdata;
|
2013-06-14 18:38:33 +07:00
|
|
|
const struct rcar_du_device_info *info;
|
2013-06-19 18:54:11 +07:00
|
|
|
|
|
|
|
void __iomem *mmio;
|
|
|
|
|
|
|
|
struct drm_device *ddev;
|
2013-03-15 04:45:22 +07:00
|
|
|
struct drm_fbdev_cma *fbdev;
|
2013-06-19 18:54:11 +07:00
|
|
|
|
2013-06-17 05:29:25 +07:00
|
|
|
struct rcar_du_crtc crtcs[3];
|
2013-06-19 18:54:11 +07:00
|
|
|
unsigned int num_crtcs;
|
|
|
|
|
2013-06-17 05:29:25 +07:00
|
|
|
struct rcar_du_group groups[2];
|
2013-06-17 08:20:08 +07:00
|
|
|
|
|
|
|
unsigned int dpad0_source;
|
2013-06-17 18:48:27 +07:00
|
|
|
struct rcar_du_lvdsenc *lvds[2];
|
2013-06-19 18:54:11 +07:00
|
|
|
};
|
|
|
|
|
2013-06-14 18:38:33 +07:00
|
|
|
static inline bool rcar_du_has(struct rcar_du_device *rcdu,
|
|
|
|
unsigned int feature)
|
|
|
|
{
|
|
|
|
return rcdu->info->features & feature;
|
|
|
|
}
|
|
|
|
|
2013-06-19 18:54:11 +07: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__ */
|