linux/include/video/omapfb_dss.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2016 Texas Instruments, Inc.
 */

#ifndef __OMAPFB_DSS_H
#define __OMAPFB_DSS_H

#include <linux/list.h>
#include <linux/kobject.h>
#include <linux/device.h>
#include <linux/interrupt.h>
#include <linux/platform_data/omapdss.h>

#include <video/videomode.h>

#define DISPC_IRQ_FRAMEDONE
#define DISPC_IRQ_VSYNC
#define DISPC_IRQ_EVSYNC_EVEN
#define DISPC_IRQ_EVSYNC_ODD
#define DISPC_IRQ_ACBIAS_COUNT_STAT
#define DISPC_IRQ_PROG_LINE_NUM
#define DISPC_IRQ_GFX_FIFO_UNDERFLOW
#define DISPC_IRQ_GFX_END_WIN
#define DISPC_IRQ_PAL_GAMMA_MASK
#define DISPC_IRQ_OCP_ERR
#define DISPC_IRQ_VID1_FIFO_UNDERFLOW
#define DISPC_IRQ_VID1_END_WIN
#define DISPC_IRQ_VID2_FIFO_UNDERFLOW
#define DISPC_IRQ_VID2_END_WIN
#define DISPC_IRQ_SYNC_LOST
#define DISPC_IRQ_SYNC_LOST_DIGIT
#define DISPC_IRQ_WAKEUP
#define DISPC_IRQ_SYNC_LOST2
#define DISPC_IRQ_VSYNC2
#define DISPC_IRQ_VID3_END_WIN
#define DISPC_IRQ_VID3_FIFO_UNDERFLOW
#define DISPC_IRQ_ACBIAS_COUNT_STAT2
#define DISPC_IRQ_FRAMEDONE2
#define DISPC_IRQ_FRAMEDONEWB
#define DISPC_IRQ_FRAMEDONETV
#define DISPC_IRQ_WBBUFFEROVERFLOW
#define DISPC_IRQ_WBUNCOMPLETEERROR
#define DISPC_IRQ_SYNC_LOST3
#define DISPC_IRQ_VSYNC3
#define DISPC_IRQ_ACBIAS_COUNT_STAT3
#define DISPC_IRQ_FRAMEDONE3

struct omap_dss_device;
struct omap_overlay_manager;
struct dss_lcd_mgr_config;
struct snd_aes_iec958;
struct snd_cea_861_aud_if;
struct hdmi_avi_infoframe;

enum omap_display_type {};

enum omap_plane {};

enum omap_channel {};

enum omap_color_mode {};

enum omap_dss_load_mode {};

enum omap_dss_trans_key_type {};

enum omap_dss_signal_level {};

enum omap_dss_signal_edge {};

enum omap_dss_venc_type {};

enum omap_dss_dsi_pixel_format {};

enum omap_dss_dsi_mode {};

enum omap_display_caps {};

enum omap_dss_display_state {};

enum omap_dss_rotation_type {};

/* clockwise rotation angle */
enum omap_dss_rotation_angle {};

enum omap_overlay_caps {};

enum omap_dss_output_id {};

/* DSI */

enum omap_dss_dsi_trans_mode {};

struct omap_dss_dsi_videomode_timings {};

struct omap_dss_dsi_config {};

struct omap_video_timings {};

/* Hardcoded timings for tv modes. Venc only uses these to
 * identify the mode, and does not actually use the configs
 * itself. However, the configs should be something that
 * a normal monitor can also show */
extern const struct omap_video_timings omap_dss_pal_timings;
extern const struct omap_video_timings omap_dss_ntsc_timings;

struct omap_dss_cpr_coefs {};

struct omap_overlay_info {};

struct omap_overlay {};

struct omap_overlay_manager_info {};

struct omap_overlay_manager {};

/* 22 pins means 1 clk lane and 10 data lanes */
#define OMAP_DSS_MAX_DSI_PINS

struct omap_dsi_pin_config {};

struct omap_dss_writeback_info {};

struct omapdss_dpi_ops {};

struct omapdss_sdi_ops {};

struct omapdss_dvi_ops {};

struct omapdss_atv_ops {};

struct omapdss_hdmi_ops {};

struct omapdss_dsi_ops {};

struct omap_dss_device {};

struct omap_dss_driver {};

#define for_each_dss_dev(d)

omap_dispc_isr_t;

#if IS_ENABLED(CONFIG_FB_OMAP2)

enum omapdss_version omapdss_get_version(void);
bool omapdss_is_initialized(void);

int omap_dss_register_driver(struct omap_dss_driver *);
void omap_dss_unregister_driver(struct omap_dss_driver *);

int omapdss_register_display(struct omap_dss_device *dssdev);
void omapdss_unregister_display(struct omap_dss_device *dssdev);

struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
void omap_dss_put_device(struct omap_dss_device *dssdev);
struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
struct omap_dss_device *omap_dss_find_device(void *data,
		int (*match)(struct omap_dss_device *dssdev, void *data));
const char *omapdss_get_default_display_name(void);

void videomode_to_omap_video_timings(const struct videomode *vm,
		struct omap_video_timings *ovt);
void omap_video_timings_to_videomode(const struct omap_video_timings *ovt,
		struct videomode *vm);

int dss_feat_get_num_mgrs(void);
int dss_feat_get_num_ovls(void);
enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane);



int omap_dss_get_num_overlay_managers(void);
struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);

int omap_dss_get_num_overlays(void);
struct omap_overlay *omap_dss_get_overlay(int num);

int omapdss_register_output(struct omap_dss_device *output);
void omapdss_unregister_output(struct omap_dss_device *output);
struct omap_dss_device *omap_dss_get_output(enum omap_dss_output_id id);
struct omap_dss_device *omap_dss_find_output(const char *name);
struct omap_dss_device *omap_dss_find_output_by_port_node(struct device_node *port);
int omapdss_output_set_device(struct omap_dss_device *out,
		struct omap_dss_device *dssdev);
int omapdss_output_unset_device(struct omap_dss_device *out);

struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device *dssdev);
struct omap_overlay_manager *omapdss_find_mgr_from_display(struct omap_dss_device *dssdev);

void omapdss_default_get_resolution(struct omap_dss_device *dssdev,
		u16 *xres, u16 *yres);
int omapdss_default_get_recommended_bpp(struct omap_dss_device *dssdev);
void omapdss_default_get_timings(struct omap_dss_device *dssdev,
		struct omap_video_timings *timings);

int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);

int omapdss_compat_init(void);
void omapdss_compat_uninit(void);

static inline bool omapdss_device_is_connected(struct omap_dss_device *dssdev)
{
	return dssdev->src;
}

static inline bool omapdss_device_is_enabled(struct omap_dss_device *dssdev)
{
	return dssdev->state == OMAP_DSS_DISPLAY_ACTIVE;
}

struct device_node *
omapdss_of_get_next_port(const struct device_node *parent,
			 struct device_node *prev);

struct device_node *
omapdss_of_get_next_endpoint(const struct device_node *parent,
			     struct device_node *prev);

struct omap_dss_device *
omapdss_of_find_source_for_first_ep(struct device_node *node);
#else

static inline enum omapdss_version omapdss_get_version(void)
{ return OMAPDSS_VER_UNKNOWN; };

static inline bool omapdss_is_initialized(void)
{ return false; };

static inline int omap_dispc_register_isr(omap_dispc_isr_t isr,
					  void *arg, u32 mask)
{ return 0; };

static inline int omap_dispc_unregister_isr(omap_dispc_isr_t isr,
					    void *arg, u32 mask)
{ return 0; };

static inline struct omap_dss_device
*omap_dss_get_device(struct omap_dss_device *dssdev)
{ return NULL; };

static inline struct omap_dss_device
*omap_dss_get_next_device(struct omap_dss_device *from)
{return NULL; };

static inline void omap_dss_put_device(struct omap_dss_device *dssdev) {};

static inline int omapdss_compat_init(void)
{ return 0; };

static inline void omapdss_compat_uninit(void) {};

static inline int omap_dss_get_num_overlay_managers(void)
{ return 0; };

static inline struct omap_overlay_manager *omap_dss_get_overlay_manager(int num)
{ return NULL; };

static inline int omap_dss_get_num_overlays(void)
{ return 0; };

static inline struct omap_overlay *omap_dss_get_overlay(int num)
{ return NULL; };


#endif /* FB_OMAP2 */


#endif /* __OMAPFB_DSS_H */