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