Jernej Skrabec | b7c7436 | 2018-02-14 21:09:04 +0100 | [diff] [blame] | 1 | /* 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 Skrabec | 6fd9031 | 2018-03-01 22:34:36 +0100 | [diff] [blame^] | 15 | struct sun8i_hdmi_phy; |
| 16 | |
| 17 | struct 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 Skrabec | b7c7436 | 2018-02-14 21:09:04 +0100 | [diff] [blame] | 26 | struct sun8i_hdmi_phy { |
Jernej Skrabec | 6fd9031 | 2018-03-01 22:34:36 +0100 | [diff] [blame^] | 27 | 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 Skrabec | b7c7436 | 2018-02-14 21:09:04 +0100 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | struct 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 | |
| 44 | static inline struct sun8i_dw_hdmi * |
| 45 | encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) |
| 46 | { |
| 47 | return container_of(encoder, struct sun8i_dw_hdmi, encoder); |
| 48 | } |
| 49 | |
| 50 | int sun8i_hdmi_phy_probe(struct sun8i_dw_hdmi *hdmi, struct device_node *node); |
| 51 | void sun8i_hdmi_phy_remove(struct sun8i_dw_hdmi *hdmi); |
| 52 | |
| 53 | void sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy); |
| 54 | const struct dw_hdmi_phy_ops *sun8i_hdmi_phy_get_ops(void); |
| 55 | |
| 56 | #endif /* _SUN8I_DW_HDMI_H_ */ |