2018-04-22 21:33:20 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2013-06-04 14:22:30 +00:00
|
|
|
/*
|
|
|
|
* vsp1.h -- R-Car VSP1 Driver
|
|
|
|
*
|
2014-02-06 17:42:31 +00:00
|
|
|
* Copyright (C) 2013-2014 Renesas Electronics Corporation
|
2013-06-04 14:22:30 +00:00
|
|
|
*
|
|
|
|
* Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
|
|
|
|
*/
|
|
|
|
#ifndef __VSP1_H__
|
|
|
|
#define __VSP1_H__
|
|
|
|
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
|
|
|
|
#include <media/media-device.h>
|
|
|
|
#include <media/v4l2-device.h>
|
|
|
|
#include <media/v4l2-subdev.h>
|
|
|
|
|
|
|
|
#include "vsp1_regs.h"
|
|
|
|
|
|
|
|
struct clk;
|
|
|
|
struct device;
|
2016-02-12 00:49:14 +00:00
|
|
|
struct rcar_fcp_device;
|
2013-06-04 14:22:30 +00:00
|
|
|
|
2015-08-02 21:37:01 +00:00
|
|
|
struct vsp1_drm;
|
2015-09-07 04:40:25 +00:00
|
|
|
struct vsp1_entity;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_platform_data;
|
2018-02-26 16:06:21 +00:00
|
|
|
struct vsp1_brx;
|
2015-11-12 01:04:44 +00:00
|
|
|
struct vsp1_clu;
|
2016-02-24 23:40:22 +00:00
|
|
|
struct vsp1_hgo;
|
2016-09-06 14:38:56 +00:00
|
|
|
struct vsp1_hgt;
|
2013-07-10 20:30:14 +00:00
|
|
|
struct vsp1_hsit;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_lif;
|
2013-07-10 15:03:30 +00:00
|
|
|
struct vsp1_lut;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_rwpf;
|
2013-07-10 15:03:30 +00:00
|
|
|
struct vsp1_sru;
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_uds;
|
|
|
|
|
2017-06-21 13:10:18 +00:00
|
|
|
#define VSP1_MAX_LIF 2
|
2014-05-27 15:59:39 +00:00
|
|
|
#define VSP1_MAX_RPF 5
|
|
|
|
#define VSP1_MAX_UDS 3
|
|
|
|
#define VSP1_MAX_WPF 4
|
2013-06-04 14:22:30 +00:00
|
|
|
|
2014-04-09 11:13:18 +00:00
|
|
|
#define VSP1_HAS_LUT (1 << 1)
|
|
|
|
#define VSP1_HAS_SRU (1 << 2)
|
2015-08-14 16:53:45 +00:00
|
|
|
#define VSP1_HAS_BRU (1 << 3)
|
2015-11-12 01:04:44 +00:00
|
|
|
#define VSP1_HAS_CLU (1 << 4)
|
2016-05-26 08:14:22 +00:00
|
|
|
#define VSP1_HAS_WPF_VFLIP (1 << 5)
|
|
|
|
#define VSP1_HAS_WPF_HFLIP (1 << 6)
|
2016-02-24 23:40:22 +00:00
|
|
|
#define VSP1_HAS_HGO (1 << 7)
|
2016-09-06 14:38:56 +00:00
|
|
|
#define VSP1_HAS_HGT (1 << 8)
|
2017-05-24 21:16:57 +00:00
|
|
|
#define VSP1_HAS_BRS (1 << 9)
|
2014-04-09 11:13:18 +00:00
|
|
|
|
2015-12-05 22:17:10 +00:00
|
|
|
struct vsp1_device_info {
|
|
|
|
u32 version;
|
2016-07-12 07:59:52 +00:00
|
|
|
const char *model;
|
2016-03-22 14:10:27 +00:00
|
|
|
unsigned int gen;
|
2014-04-09 11:13:18 +00:00
|
|
|
unsigned int features;
|
2017-06-21 13:10:18 +00:00
|
|
|
unsigned int lif_count;
|
2014-04-09 11:13:18 +00:00
|
|
|
unsigned int rpf_count;
|
|
|
|
unsigned int uds_count;
|
|
|
|
unsigned int wpf_count;
|
2015-08-03 12:46:26 +00:00
|
|
|
unsigned int num_bru_inputs;
|
2015-07-28 19:16:05 +00:00
|
|
|
bool uapi;
|
2014-04-09 11:13:18 +00:00
|
|
|
};
|
|
|
|
|
2013-06-04 14:22:30 +00:00
|
|
|
struct vsp1_device {
|
|
|
|
struct device *dev;
|
2015-12-05 22:17:10 +00:00
|
|
|
const struct vsp1_device_info *info;
|
2016-07-12 07:59:52 +00:00
|
|
|
u32 version;
|
2013-06-04 14:22:30 +00:00
|
|
|
|
|
|
|
void __iomem *mmio;
|
2016-02-12 00:49:14 +00:00
|
|
|
struct rcar_fcp_device *fcp;
|
2017-05-16 23:20:05 +00:00
|
|
|
struct device *bus_master;
|
2013-06-04 14:22:30 +00:00
|
|
|
|
2018-02-26 16:06:21 +00:00
|
|
|
struct vsp1_brx *brs;
|
|
|
|
struct vsp1_brx *bru;
|
2015-11-12 01:04:44 +00:00
|
|
|
struct vsp1_clu *clu;
|
2016-02-24 23:40:22 +00:00
|
|
|
struct vsp1_hgo *hgo;
|
2016-09-06 14:38:56 +00:00
|
|
|
struct vsp1_hgt *hgt;
|
2013-07-10 20:30:14 +00:00
|
|
|
struct vsp1_hsit *hsi;
|
|
|
|
struct vsp1_hsit *hst;
|
2017-06-21 13:10:18 +00:00
|
|
|
struct vsp1_lif *lif[VSP1_MAX_LIF];
|
2013-07-10 15:03:30 +00:00
|
|
|
struct vsp1_lut *lut;
|
2014-05-27 15:59:39 +00:00
|
|
|
struct vsp1_rwpf *rpf[VSP1_MAX_RPF];
|
2013-07-10 15:03:30 +00:00
|
|
|
struct vsp1_sru *sru;
|
2014-05-27 15:59:39 +00:00
|
|
|
struct vsp1_uds *uds[VSP1_MAX_UDS];
|
|
|
|
struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
|
2013-06-04 14:22:30 +00:00
|
|
|
|
|
|
|
struct list_head entities;
|
2015-07-28 18:46:00 +00:00
|
|
|
struct list_head videos;
|
2013-06-04 14:22:30 +00:00
|
|
|
|
|
|
|
struct v4l2_device v4l2_dev;
|
|
|
|
struct media_device media_dev;
|
2015-08-05 20:14:41 +00:00
|
|
|
struct media_entity_operations media_ops;
|
2015-09-07 04:40:25 +00:00
|
|
|
|
2015-08-02 21:37:01 +00:00
|
|
|
struct vsp1_drm *drm;
|
2013-06-04 14:22:30 +00:00
|
|
|
};
|
|
|
|
|
2014-05-31 11:50:32 +00:00
|
|
|
int vsp1_device_get(struct vsp1_device *vsp1);
|
2013-06-04 14:22:30 +00:00
|
|
|
void vsp1_device_put(struct vsp1_device *vsp1);
|
|
|
|
|
2015-09-07 04:40:25 +00:00
|
|
|
int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index);
|
|
|
|
|
2013-06-04 14:22:30 +00:00
|
|
|
static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
|
|
|
|
{
|
|
|
|
return ioread32(vsp1->mmio + reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
|
|
|
|
{
|
|
|
|
iowrite32(data, vsp1->mmio + reg);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __VSP1_H__ */
|