
The vc4 CRTC will use the encoder type to control its output clock muxing. However, this will be different from HDMI0 to HDMI1, so let's store our type in the variant structure so that we can support multiple controllers later on. Signed-off-by: Maxime Ripard <maxime@cerno.tech> Tested-by: Chanwoo Choi <cw00.choi@samsung.com> Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com> Tested-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Link: https://patchwork.freedesktop.org/patch/msgid/2736a86b498551ba9dbc5803c5bb910627a2550c.1599120059.git-series.maxime@cerno.tech
130 lines
3.2 KiB
C
130 lines
3.2 KiB
C
#ifndef _VC4_HDMI_H_
|
|
#define _VC4_HDMI_H_
|
|
|
|
#include <drm/drm_connector.h>
|
|
#include <media/cec.h>
|
|
#include <sound/dmaengine_pcm.h>
|
|
#include <sound/soc.h>
|
|
|
|
#include "vc4_drv.h"
|
|
|
|
/* VC4 HDMI encoder KMS struct */
|
|
struct vc4_hdmi_encoder {
|
|
struct vc4_encoder base;
|
|
bool hdmi_monitor;
|
|
bool limited_rgb_range;
|
|
};
|
|
|
|
static inline struct vc4_hdmi_encoder *
|
|
to_vc4_hdmi_encoder(struct drm_encoder *encoder)
|
|
{
|
|
return container_of(encoder, struct vc4_hdmi_encoder, base.base);
|
|
}
|
|
|
|
struct drm_display_mode;
|
|
|
|
struct vc4_hdmi;
|
|
struct vc4_hdmi_register;
|
|
|
|
struct vc4_hdmi_variant {
|
|
/* Encoder Type for that controller */
|
|
enum vc4_encoder_type encoder_type;
|
|
|
|
/* List of the registers available on that variant */
|
|
const struct vc4_hdmi_register *registers;
|
|
|
|
/* Number of registers on that variant */
|
|
unsigned int num_registers;
|
|
|
|
/* Callback to get the resources (memory region, interrupts,
|
|
* clocks, etc) for that variant.
|
|
*/
|
|
int (*init_resources)(struct vc4_hdmi *vc4_hdmi);
|
|
|
|
/* Callback to reset the HDMI block */
|
|
void (*reset)(struct vc4_hdmi *vc4_hdmi);
|
|
|
|
/* Callback to enable / disable the CSC */
|
|
void (*csc_setup)(struct vc4_hdmi *vc4_hdmi, bool enable);
|
|
|
|
/* Callback to configure the video timings in the HDMI block */
|
|
void (*set_timings)(struct vc4_hdmi *vc4_hdmi,
|
|
struct drm_display_mode *mode);
|
|
|
|
/* Callback to initialize the PHY according to the mode */
|
|
void (*phy_init)(struct vc4_hdmi *vc4_hdmi,
|
|
struct drm_display_mode *mode);
|
|
|
|
/* Callback to disable the PHY */
|
|
void (*phy_disable)(struct vc4_hdmi *vc4_hdmi);
|
|
|
|
/* Callback to enable the RNG in the PHY */
|
|
void (*phy_rng_enable)(struct vc4_hdmi *vc4_hdmi);
|
|
|
|
/* Callback to disable the RNG in the PHY */
|
|
void (*phy_rng_disable)(struct vc4_hdmi *vc4_hdmi);
|
|
};
|
|
|
|
/* HDMI audio information */
|
|
struct vc4_hdmi_audio {
|
|
struct snd_soc_card card;
|
|
struct snd_soc_dai_link link;
|
|
struct snd_soc_dai_link_component cpu;
|
|
struct snd_soc_dai_link_component codec;
|
|
struct snd_soc_dai_link_component platform;
|
|
int samplerate;
|
|
int channels;
|
|
struct snd_dmaengine_dai_dma_data dma_data;
|
|
struct snd_pcm_substream *substream;
|
|
};
|
|
|
|
/* General HDMI hardware state. */
|
|
struct vc4_hdmi {
|
|
struct vc4_hdmi_audio audio;
|
|
|
|
struct platform_device *pdev;
|
|
const struct vc4_hdmi_variant *variant;
|
|
|
|
struct vc4_hdmi_encoder encoder;
|
|
struct drm_connector connector;
|
|
|
|
struct i2c_adapter *ddc;
|
|
void __iomem *hdmicore_regs;
|
|
void __iomem *hd_regs;
|
|
int hpd_gpio;
|
|
bool hpd_active_low;
|
|
|
|
struct cec_adapter *cec_adap;
|
|
struct cec_msg cec_rx_msg;
|
|
bool cec_tx_ok;
|
|
bool cec_irq_was_rx;
|
|
|
|
struct clk *pixel_clock;
|
|
struct clk *hsm_clock;
|
|
|
|
struct debugfs_regset32 hdmi_regset;
|
|
struct debugfs_regset32 hd_regset;
|
|
};
|
|
|
|
static inline struct vc4_hdmi *
|
|
connector_to_vc4_hdmi(struct drm_connector *connector)
|
|
{
|
|
return container_of(connector, struct vc4_hdmi, connector);
|
|
}
|
|
|
|
static inline struct vc4_hdmi *
|
|
encoder_to_vc4_hdmi(struct drm_encoder *encoder)
|
|
{
|
|
struct vc4_hdmi_encoder *_encoder = to_vc4_hdmi_encoder(encoder);
|
|
|
|
return container_of(_encoder, struct vc4_hdmi, encoder);
|
|
}
|
|
|
|
void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,
|
|
struct drm_display_mode *mode);
|
|
void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi);
|
|
void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi);
|
|
void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi);
|
|
|
|
#endif /* _VC4_HDMI_H_ */
|