blob: 5b57a2f9b52ae62bc2409134ec4d3d100ab959a5 [file] [log] [blame]
Laurent Pinchart4bf8e192013-06-19 13:54:11 +02001/*
2 * rcar_du_drv.h -- R-Car Display Unit DRM driver
3 *
4 * Copyright (C) 2013 Renesas Corporation
5 *
6 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __RCAR_DU_DRV_H__
15#define __RCAR_DU_DRV_H__
16
17#include <linux/kernel.h>
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020018#include <linux/platform_data/rcar-du.h>
19
20#include "rcar_du_crtc.h"
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020021#include "rcar_du_group.h"
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020022
23struct clk;
24struct device;
25struct drm_device;
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020026struct rcar_du_device;
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020027
Laurent Pinchartf66ee302013-06-14 14:15:01 +020028#define RCAR_DU_FEATURE_CRTC_IRQ_CLOCK (1 << 0) /* Per-CRTC IRQ and clock */
29
Laurent Pinchart481d3422013-06-14 13:38:33 +020030/*
31 * struct rcar_du_device_info - DU model-specific information
32 * @features: device features (RCAR_DU_FEATURE_*)
33 */
34struct rcar_du_device_info {
35 unsigned int features;
36};
37
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020038struct rcar_du_device {
39 struct device *dev;
40 const struct rcar_du_platform_data *pdata;
Laurent Pinchart481d3422013-06-14 13:38:33 +020041 const struct rcar_du_device_info *info;
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020042
43 void __iomem *mmio;
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020044
45 struct drm_device *ddev;
46
47 struct rcar_du_crtc crtcs[2];
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020048 unsigned int num_crtcs;
49
Laurent Pinchartcb2025d2013-06-16 21:01:02 +020050 struct rcar_du_group group;
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020051};
52
Laurent Pinchart481d3422013-06-14 13:38:33 +020053static inline bool rcar_du_has(struct rcar_du_device *rcdu,
54 unsigned int feature)
55{
56 return rcdu->info->features & feature;
57}
58
Laurent Pinchart4bf8e192013-06-19 13:54:11 +020059static inline u32 rcar_du_read(struct rcar_du_device *rcdu, u32 reg)
60{
61 return ioread32(rcdu->mmio + reg);
62}
63
64static inline void rcar_du_write(struct rcar_du_device *rcdu, u32 reg, u32 data)
65{
66 iowrite32(data, rcdu->mmio + reg);
67}
68
69#endif /* __RCAR_DU_DRV_H__ */