Laurent Pinchart | 4bf8e19 | 2013-06-19 13:54:11 +0200 | [diff] [blame^] | 1 | /* |
| 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> |
| 18 | #include <linux/mutex.h> |
| 19 | #include <linux/platform_data/rcar-du.h> |
| 20 | |
| 21 | #include "rcar_du_crtc.h" |
| 22 | #include "rcar_du_plane.h" |
| 23 | |
| 24 | struct clk; |
| 25 | struct device; |
| 26 | struct drm_device; |
| 27 | |
| 28 | struct rcar_du_device { |
| 29 | struct device *dev; |
| 30 | const struct rcar_du_platform_data *pdata; |
| 31 | |
| 32 | void __iomem *mmio; |
| 33 | struct clk *clock; |
| 34 | unsigned int use_count; |
| 35 | |
| 36 | struct drm_device *ddev; |
| 37 | |
| 38 | struct rcar_du_crtc crtcs[2]; |
| 39 | unsigned int used_crtcs; |
| 40 | unsigned int num_crtcs; |
| 41 | |
| 42 | struct { |
| 43 | struct rcar_du_plane planes[RCAR_DU_NUM_SW_PLANES]; |
| 44 | unsigned int free; |
| 45 | struct mutex lock; |
| 46 | |
| 47 | struct drm_property *alpha; |
| 48 | struct drm_property *colorkey; |
| 49 | struct drm_property *zpos; |
| 50 | } planes; |
| 51 | }; |
| 52 | |
| 53 | int rcar_du_get(struct rcar_du_device *rcdu); |
| 54 | void rcar_du_put(struct rcar_du_device *rcdu); |
| 55 | |
| 56 | static inline u32 rcar_du_read(struct rcar_du_device *rcdu, u32 reg) |
| 57 | { |
| 58 | return ioread32(rcdu->mmio + reg); |
| 59 | } |
| 60 | |
| 61 | static inline void rcar_du_write(struct rcar_du_device *rcdu, u32 reg, u32 data) |
| 62 | { |
| 63 | iowrite32(data, rcdu->mmio + reg); |
| 64 | } |
| 65 | |
| 66 | #endif /* __RCAR_DU_DRV_H__ */ |