linux/drivers/gpu/drm/gma500/psb_intel_drv.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Copyright (c) 2009-2011, Intel Corporation.
 */

#ifndef __INTEL_DRV_H__
#define __INTEL_DRV_H__

#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <drm/drm_crtc.h>
#include <drm/drm_encoder.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_vblank.h>
#include "gma_display.h"

/*
 * Display related stuff
 */

/* maximum connectors per crtcs in the mode set */
#define INTELFB_CONN_LIMIT

/* Intel Pipe Clone Bit */
#define INTEL_HDMIB_CLONE_BIT
#define INTEL_HDMIC_CLONE_BIT
#define INTEL_HDMID_CLONE_BIT
#define INTEL_HDMIE_CLONE_BIT
#define INTEL_HDMIF_CLONE_BIT
#define INTEL_SDVO_NON_TV_CLONE_BIT
#define INTEL_SDVO_TV_CLONE_BIT
#define INTEL_SDVO_LVDS_CLONE_BIT
#define INTEL_ANALOG_CLONE_BIT
#define INTEL_TV_CLONE_BIT
#define INTEL_DP_B_CLONE_BIT
#define INTEL_DP_C_CLONE_BIT
#define INTEL_DP_D_CLONE_BIT
#define INTEL_LVDS_CLONE_BIT
#define INTEL_DVO_TMDS_CLONE_BIT
#define INTEL_DVO_LVDS_CLONE_BIT
#define INTEL_EDP_CLONE_BIT

/* these are outputs from the chip - integrated only
 * external chips are via DVO or SDVO output */
#define INTEL_OUTPUT_UNUSED
#define INTEL_OUTPUT_ANALOG
#define INTEL_OUTPUT_DVO
#define INTEL_OUTPUT_SDVO
#define INTEL_OUTPUT_LVDS
#define INTEL_OUTPUT_TVOUT
#define INTEL_OUTPUT_HDMI
#define INTEL_OUTPUT_MIPI
#define INTEL_OUTPUT_MIPI2
#define INTEL_OUTPUT_DISPLAYPORT
#define INTEL_OUTPUT_EDP

/*
 * Hold information useally put on the device driver privates here,
 * since it needs to be shared across multiple of devices drivers privates.
 */
struct psb_intel_mode_device {};

struct gma_i2c_chan {};

struct gma_encoder {};

struct gma_connector {};

struct psb_intel_crtc_state {};

struct gma_crtc {};

#define to_gma_crtc(x)
#define to_gma_connector(x)
#define to_gma_encoder(x)
#define to_psb_intel_framebuffer(x)
#define to_gma_i2c_chan(x)

struct gma_i2c_chan *gma_i2c_create(struct drm_device *dev, const u32 reg,
				    const char *name);
void gma_i2c_destroy(struct gma_i2c_chan *chan);
int psb_intel_ddc_get_modes(struct drm_connector *connector,
			    struct i2c_adapter *adapter);
extern bool psb_intel_ddc_probe(struct i2c_adapter *adapter);

extern void psb_intel_crtc_init(struct drm_device *dev, int pipe,
			    struct psb_intel_mode_device *mode_dev);
extern bool psb_intel_sdvo_init(struct drm_device *dev, int output_device);
extern void psb_intel_lvds_init(struct drm_device *dev,
			    struct psb_intel_mode_device *mode_dev);
extern void psb_intel_lvds_set_brightness(struct drm_device *dev, int level);
extern void oaktrail_lvds_init(struct drm_device *dev,
			   struct psb_intel_mode_device *mode_dev);
struct gma_i2c_chan *oaktrail_lvds_i2c_init(struct drm_device *dev);

extern struct drm_encoder *gma_best_encoder(struct drm_connector *connector);
extern void gma_connector_attach_encoder(struct gma_connector *connector,
					 struct gma_encoder *encoder);

static inline struct gma_encoder *gma_attached_encoder(
						struct drm_connector *connector)
{}

extern struct drm_display_mode *psb_intel_crtc_mode_get(struct drm_device *dev,
						    struct drm_crtc *crtc);
extern struct drm_crtc *psb_intel_get_crtc_from_pipe(struct drm_device *dev,
						 int pipe);
extern bool psb_intel_lvds_mode_fixup(struct drm_encoder *encoder,
				      const struct drm_display_mode *mode,
				      struct drm_display_mode *adjusted_mode);
extern enum drm_mode_status psb_intel_lvds_mode_valid(struct drm_connector *connector,
				     struct drm_display_mode *mode);
extern int psb_intel_lvds_set_property(struct drm_connector *connector,
					struct drm_property *property,
					uint64_t value);
extern void psb_intel_lvds_destroy(struct drm_connector *connector);

/* intel_gmbus.c */
extern void gma_intel_i2c_reset(struct drm_device *dev);
extern int gma_intel_setup_gmbus(struct drm_device *dev);
extern void gma_intel_gmbus_set_speed(struct i2c_adapter *adapter, int speed);
extern void gma_intel_gmbus_force_bit(struct i2c_adapter *adapter, bool force_bit);
extern void gma_intel_teardown_gmbus(struct drm_device *dev);

/* DP support */
extern void cdv_intel_dp_init(struct drm_device *dev, struct psb_intel_mode_device *mode_dev, int output_reg);
extern void cdv_intel_dp_set_m_n(struct drm_crtc *crtc,
					struct drm_display_mode *mode,
					struct drm_display_mode *adjusted_mode);

extern int cdv_sb_read(struct drm_device *dev, u32 reg, u32 *val);
extern int cdv_sb_write(struct drm_device *dev, u32 reg, u32 val);
extern void cdv_sb_reset(struct drm_device *dev);

extern void cdv_intel_attach_force_audio_property(struct drm_connector *connector);
extern void cdv_intel_attach_broadcast_rgb_property(struct drm_connector *connector);

#endif				/* __INTEL_DRV_H__ */