sun8i_dw_hdmi.h 1.4 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * Copyright (C) 2018 Jernej Skrabec <jernej.skrabec@siol.net>
 */

#ifndef _SUN8I_DW_HDMI_H_
#define _SUN8I_DW_HDMI_H_

#include <drm/bridge/dw_hdmi.h>
#include <drm/drm_encoder.h>
#include <linux/clk.h>
#include <linux/regmap.h>
#include <linux/reset.h>

15 16 17 18 19 20 21 22 23 24 25
struct sun8i_hdmi_phy;

struct sun8i_hdmi_phy_variant {
	void (*phy_init)(struct sun8i_hdmi_phy *phy);
	void (*phy_disable)(struct dw_hdmi *hdmi,
			    struct sun8i_hdmi_phy *phy);
	int  (*phy_config)(struct dw_hdmi *hdmi,
			   struct sun8i_hdmi_phy *phy,
			   unsigned int clk_rate);
};

26
struct sun8i_hdmi_phy {
27 28 29 30 31
	struct clk			*clk_bus;
	struct clk			*clk_mod;
	struct regmap			*regs;
	struct reset_control		*rst_phy;
	struct sun8i_hdmi_phy_variant	*variant;
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
};

struct sun8i_dw_hdmi {
	struct clk			*clk_tmds;
	struct device			*dev;
	struct dw_hdmi			*hdmi;
	struct drm_encoder		encoder;
	struct sun8i_hdmi_phy		*phy;
	struct dw_hdmi_plat_data	plat_data;
	struct reset_control		*rst_ctrl;
};

static inline struct sun8i_dw_hdmi *
encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder)
{
	return container_of(encoder, struct sun8i_dw_hdmi, encoder);
}

int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node);
void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi);

void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy);
const struct dw_hdmi_phy_ops *sun8i_hdmi_phy_get_ops(void);

#endif /* _SUN8I_DW_HDMI_H_ */