blob: 1e9eb60726159dcc71849813b2ddb4954e6664d5 [file] [log] [blame]
Jernej Skrabecb7c74362018-02-14 21:09:04 +01001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * Copyright (C) 2018 Jernej Skrabec <jernej.skrabec@siol.net>
4 */
5
6#ifndef _SUN8I_DW_HDMI_H_
7#define _SUN8I_DW_HDMI_H_
8
9#include <drm/bridge/dw_hdmi.h>
10#include <drm/drm_encoder.h>
11#include <linux/clk.h>
12#include <linux/regmap.h>
13#include <linux/reset.h>
14
Jernej Skrabec6fd90312018-03-01 22:34:36 +010015struct sun8i_hdmi_phy;
16
17struct sun8i_hdmi_phy_variant {
18 void (*phy_init)(struct sun8i_hdmi_phy *phy);
19 void (*phy_disable)(struct dw_hdmi *hdmi,
20 struct sun8i_hdmi_phy *phy);
21 int (*phy_config)(struct dw_hdmi *hdmi,
22 struct sun8i_hdmi_phy *phy,
23 unsigned int clk_rate);
24};
25
Jernej Skrabecb7c74362018-02-14 21:09:04 +010026struct sun8i_hdmi_phy {
Jernej Skrabec6fd90312018-03-01 22:34:36 +010027 struct clk *clk_bus;
28 struct clk *clk_mod;
29 struct regmap *regs;
30 struct reset_control *rst_phy;
31 struct sun8i_hdmi_phy_variant *variant;
Jernej Skrabecb7c74362018-02-14 21:09:04 +010032};
33
34struct sun8i_dw_hdmi {
35 struct clk *clk_tmds;
36 struct device *dev;
37 struct dw_hdmi *hdmi;
38 struct drm_encoder encoder;
39 struct sun8i_hdmi_phy *phy;
40 struct dw_hdmi_plat_data plat_data;
41 struct reset_control *rst_ctrl;
42};
43
44static inline struct sun8i_dw_hdmi *
45encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder)
46{
47 return container_of(encoder, struct sun8i_dw_hdmi, encoder);
48}
49
50int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node);
51void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi);
52
53void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy);
54const struct dw_hdmi_phy_ops *sun8i_hdmi_phy_get_ops(void);
55
56#endif /* _SUN8I_DW_HDMI_H_ */