mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
drm/rockchip: init subdev and registe to rockchip_drm_sub_dev_list
Change-Id: Iac3a7ab477abb987d4afd2fe39b5701c8046aae4 Signed-off-by: Sandy Huang <hjc@rock-chips.com>
This commit is contained in:
parent
4759d059b6
commit
d824c75d4b
|
|
@ -20,6 +20,8 @@
|
|||
#include <drm/drm_of.h>
|
||||
#include <drm/drmP.h>
|
||||
|
||||
#include "../rockchip/rockchip_drm_drv.h"
|
||||
|
||||
#define TVE_POWCR 0x03
|
||||
#define TVE_OFF 0X07
|
||||
#define TVE_ON 0x03
|
||||
|
|
@ -45,6 +47,7 @@ struct rk1000_tve {
|
|||
struct regmap *ctlmap;
|
||||
struct regmap *tvemap;
|
||||
u32 preferred_mode;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -314,14 +317,26 @@ static int rk1000_bridge_attach(struct drm_bridge *bridge)
|
|||
if (ret)
|
||||
dev_err(rk1000->dev, "rk1000 attach failed ret:%d", ret);
|
||||
|
||||
rk1000->sub_dev.connector = &rk1000->connector;
|
||||
rk1000->sub_dev.of_node = rk1000->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&rk1000->sub_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void rk1000_bridge_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk1000_tve *rk1000 = bridge_to_rk1000(bridge);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&rk1000->sub_dev);
|
||||
}
|
||||
|
||||
static struct drm_bridge_funcs rk1000_bridge_funcs = {
|
||||
.enable = rk1000_bridge_enable,
|
||||
.disable = rk1000_bridge_disable,
|
||||
.mode_set = rk1000_bridge_mode_set,
|
||||
.attach = rk1000_bridge_attach,
|
||||
.detach = rk1000_bridge_detach,
|
||||
};
|
||||
|
||||
static int rk1000_probe(struct i2c_client *client,
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
#include <drm/bridge/analogix_dp.h>
|
||||
|
||||
#include "../bridge/analogix/analogix_dp_core.h"
|
||||
|
||||
#include "rockchip_drm_drv.h"
|
||||
#include "rockchip_drm_psr.h"
|
||||
#include "rockchip_drm_vop.h"
|
||||
|
|
@ -79,6 +81,7 @@ struct rockchip_dp_device {
|
|||
|
||||
struct analogix_dp_device *adp;
|
||||
struct analogix_dp_plat_data plat_data;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
static int analogix_dp_psr_set(struct drm_encoder *encoder, bool enabled)
|
||||
|
|
@ -444,6 +447,10 @@ static int rockchip_dp_bind(struct device *dev, struct device *master,
|
|||
goto err_unreg_psr;
|
||||
}
|
||||
|
||||
dp->sub_dev.connector = &dp->adp->connector;
|
||||
dp->sub_dev.of_node = dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&dp->sub_dev);
|
||||
|
||||
return 0;
|
||||
err_unreg_psr:
|
||||
rockchip_drm_psr_unregister(&dp->encoder);
|
||||
|
|
@ -457,6 +464,7 @@ static void rockchip_dp_unbind(struct device *dev, struct device *master,
|
|||
{
|
||||
struct rockchip_dp_device *dp = dev_get_drvdata(dev);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&dp->sub_dev);
|
||||
analogix_dp_unbind(dp->adp);
|
||||
rockchip_drm_psr_unregister(&dp->encoder);
|
||||
dp->encoder.funcs->destroy(&dp->encoder);
|
||||
|
|
|
|||
|
|
@ -278,6 +278,7 @@ struct dw_mipi_dsi {
|
|||
unsigned long mode_flags;
|
||||
|
||||
const struct dw_mipi_dsi_plat_data *pdata;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
static inline struct dw_mipi_dsi *host_to_dsi(struct mipi_dsi_host *host)
|
||||
|
|
@ -1527,7 +1528,9 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master,
|
|||
DRM_DEV_ERROR(dev, "Failed to attach panel: %d\n", ret);
|
||||
goto connector_cleanup;
|
||||
}
|
||||
|
||||
dsi->sub_dev.connector = &dsi->connector;
|
||||
dsi->sub_dev.of_node = dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&dsi->sub_dev);
|
||||
} else {
|
||||
dsi->bridge->driver_private = &dsi->host;
|
||||
dsi->bridge->encoder = encoder;
|
||||
|
|
@ -1558,6 +1561,8 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct device *master,
|
|||
{
|
||||
struct dw_mipi_dsi *dsi = dev_get_drvdata(dev);
|
||||
|
||||
if (dsi->sub_dev.connector)
|
||||
rockchip_drm_unregister_sub_dev(&dsi->sub_dev);
|
||||
pm_runtime_disable(dsi->dev);
|
||||
if (dsi->slave)
|
||||
pm_runtime_disable(dsi->slave->dev);
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ struct rockchip_hdmi {
|
|||
unsigned int hdmi_quant_range;
|
||||
unsigned int phy_bus_width;
|
||||
enum drm_hdmi_output_type hdmi_output;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
#define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x)
|
||||
|
|
@ -1370,6 +1371,10 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master,
|
|||
clk_disable_unprepare(hdmi->vpll_clk);
|
||||
}
|
||||
|
||||
hdmi->sub_dev.connector = plat_data->connector;
|
||||
hdmi->sub_dev.of_node = dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&hdmi->sub_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1378,6 +1383,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master,
|
|||
{
|
||||
struct rockchip_hdmi *hdmi = dev_get_drvdata(dev);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&hdmi->sub_dev);
|
||||
dw_hdmi_unbind(hdmi->hdmi);
|
||||
clk_disable_unprepare(hdmi->vpll_clk);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
#include <video/videomode.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include "../rockchip_drm_drv.h"
|
||||
|
||||
#define HOSTREG(x) ((x) + 0x1000)
|
||||
#define DSI_VERSION HOSTREG(0x0000)
|
||||
#define DSI_PWR_UP HOSTREG(0x0004)
|
||||
|
|
@ -235,6 +237,7 @@ struct rk618_dsi {
|
|||
struct rk618 *parent;
|
||||
struct regmap *regmap;
|
||||
struct clk *clock;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -823,12 +826,23 @@ static int rk618_dsi_bridge_attach(struct drm_bridge *bridge)
|
|||
dev_err(dsi->dev, "Failed to attach panel\n");
|
||||
return ret;
|
||||
}
|
||||
dsi->sub_dev.connector = &dsi->connector;
|
||||
dsi->sub_dev.of_node = dsi->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&dsi->sub_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rk618_dsi_bridge_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_dsi *dsi = bridge_to_dsi(bridge);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&dsi->sub_dev);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs rk618_dsi_bridge_funcs = {
|
||||
.attach = rk618_dsi_bridge_attach,
|
||||
.detach = rk618_dsi_bridge_detach,
|
||||
.mode_set = rk618_dsi_bridge_mode_set,
|
||||
.enable = rk618_dsi_bridge_enable,
|
||||
.disable = rk618_dsi_bridge_disable,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <sound/hdmi-codec.h>
|
||||
|
||||
#include "../rockchip_drm_drv.h"
|
||||
|
||||
#define RK618_HDMI_BASE 0x0400
|
||||
|
||||
#define DDC_SEGMENT_ADDR 0x30
|
||||
|
|
@ -436,6 +438,7 @@ struct rk618_hdmi {
|
|||
#ifdef CONFIG_SWITCH
|
||||
struct switch_dev switchdev;
|
||||
#endif
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -1092,6 +1095,10 @@ static int rk618_hdmi_bridge_attach(struct drm_bridge *bridge)
|
|||
&rk618_hdmi_connector_helper_funcs);
|
||||
drm_connector_attach_encoder(connector, bridge->encoder);
|
||||
|
||||
hdmi->sub_dev.connector = &hdmi->connector;
|
||||
hdmi->sub_dev.of_node = hdmi->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&hdmi->sub_dev);
|
||||
|
||||
endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 1, -1);
|
||||
if (endpoint && of_device_is_available(endpoint)) {
|
||||
struct device_node *remote;
|
||||
|
|
@ -1116,8 +1123,16 @@ static int rk618_hdmi_bridge_attach(struct drm_bridge *bridge)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void rk618_hdmi_bridge_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_hdmi *hdmi = bridge_to_hdmi(bridge);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&hdmi->sub_dev);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs rk618_hdmi_bridge_funcs = {
|
||||
.attach = rk618_hdmi_bridge_attach,
|
||||
.detach = rk618_hdmi_bridge_detach,
|
||||
.mode_set = rk618_hdmi_bridge_mode_set,
|
||||
.enable = rk618_hdmi_bridge_enable,
|
||||
.disable = rk618_hdmi_bridge_disable,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <video/of_display_timing.h>
|
||||
#include <video/videomode.h>
|
||||
|
||||
#include "../rockchip_drm_drv.h"
|
||||
#include "rk618_dither.h"
|
||||
|
||||
enum {
|
||||
|
|
@ -41,6 +42,7 @@ struct rk618_lvds {
|
|||
struct rk618 *parent;
|
||||
bool dual_channel;
|
||||
u32 format;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
static inline struct rk618_lvds *bridge_to_lvds(struct drm_bridge *b)
|
||||
|
|
@ -190,11 +192,23 @@ static int rk618_lvds_bridge_attach(struct drm_bridge *bridge)
|
|||
return ret;
|
||||
}
|
||||
|
||||
lvds->sub_dev.connector = &lvds->connector;
|
||||
lvds->sub_dev.of_node = lvds->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&lvds->sub_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void rk618_lvds_bridge_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_lvds *lvds = bridge_to_lvds(bridge);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&lvds->sub_dev);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs rk618_lvds_bridge_funcs = {
|
||||
.attach = rk618_lvds_bridge_attach,
|
||||
.detach = rk618_lvds_bridge_detach,
|
||||
.mode_set = rk618_lvds_bridge_mode_set,
|
||||
.enable = rk618_lvds_bridge_enable,
|
||||
.disable = rk618_lvds_bridge_disable,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include <video/videomode.h>
|
||||
|
||||
#include "../rockchip_drm_drv.h"
|
||||
#include "rk618_dither.h"
|
||||
|
||||
struct rk618_rgb {
|
||||
|
|
@ -34,6 +35,7 @@ struct rk618_rgb {
|
|||
struct clk *clock;
|
||||
struct rk618 *parent;
|
||||
u32 id;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
static inline struct rk618_rgb *bridge_to_rgb(struct drm_bridge *b)
|
||||
|
|
@ -184,6 +186,10 @@ static int rk618_rgb_bridge_attach(struct drm_bridge *bridge)
|
|||
&rk618_rgb_connector_helper_funcs);
|
||||
drm_connector_attach_encoder(connector, bridge->encoder);
|
||||
drm_panel_attach(rgb->panel, connector);
|
||||
|
||||
rgb->sub_dev.connector = &rgb->connector;
|
||||
rgb->sub_dev.of_node = rgb->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&rgb->sub_dev);
|
||||
} else {
|
||||
ret = drm_bridge_attach(bridge->encoder, rgb->bridge, bridge);
|
||||
if (ret) {
|
||||
|
|
@ -195,8 +201,16 @@ static int rk618_rgb_bridge_attach(struct drm_bridge *bridge)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void rk618_rgb_bridge_detach(struct drm_bridge *bridge)
|
||||
{
|
||||
struct rk618_rgb *rgb = bridge_to_rgb(bridge);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&rgb->sub_dev);
|
||||
}
|
||||
|
||||
static const struct drm_bridge_funcs rk618_rgb_bridge_funcs = {
|
||||
.attach = rk618_rgb_bridge_attach,
|
||||
.detach = rk618_rgb_bridge_detach,
|
||||
.enable = rk618_rgb_bridge_enable,
|
||||
.disable = rk618_rgb_bridge_disable,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -539,6 +539,9 @@ static int rockchip_tve_bind(struct device *dev, struct device *master,
|
|||
dev_dbg(tve->dev, "failed to attach connector and encoder\n");
|
||||
goto err_free_connector;
|
||||
}
|
||||
tve->sub_dev.connector = &tve->connector;
|
||||
tve->sub_dev.of_node = tve->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&tve->sub_dev);
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
dev_dbg(tve->dev, "%s tv encoder probe ok\n", match->compatible);
|
||||
|
|
@ -557,6 +560,7 @@ static void rockchip_tve_unbind(struct device *dev, struct device *master,
|
|||
{
|
||||
struct rockchip_tve *tve = dev_get_drvdata(dev);
|
||||
|
||||
rockchip_drm_unregister_sub_dev(&tve->sub_dev);
|
||||
rockchip_tve_encoder_disable(&tve->encoder);
|
||||
|
||||
drm_connector_cleanup(&tve->connector);
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ struct rockchip_tve {
|
|||
u32 dac1level;
|
||||
u32 preferred_mode;
|
||||
struct mutex suspend_lock; /* mutex for tve resume operation*/
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
#endif /* _ROCKCHIP_DRM_TVE_ */
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ struct rockchip_lvds {
|
|||
struct drm_connector connector;
|
||||
struct drm_encoder encoder;
|
||||
struct drm_display_mode mode;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
static inline struct rockchip_lvds *connector_to_lvds(struct drm_connector *c)
|
||||
|
|
@ -312,6 +313,9 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master,
|
|||
"failed to attach panel: %d\n", ret);
|
||||
goto err_free_connector;
|
||||
}
|
||||
lvds->sub_dev.connector = &lvds->connector;
|
||||
lvds->sub_dev.of_node = lvds->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&lvds->sub_dev);
|
||||
} else {
|
||||
ret = drm_bridge_attach(encoder, lvds->bridge, NULL);
|
||||
if (ret) {
|
||||
|
|
@ -335,6 +339,8 @@ static void rockchip_lvds_unbind(struct device *dev, struct device *master,
|
|||
{
|
||||
struct rockchip_lvds *lvds = dev_get_drvdata(dev);
|
||||
|
||||
if (lvds->sub_dev.connector)
|
||||
rockchip_drm_unregister_sub_dev(&lvds->sub_dev);
|
||||
if (lvds->panel) {
|
||||
drm_panel_detach(lvds->panel);
|
||||
drm_connector_cleanup(&lvds->connector);
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ struct rockchip_rgb {
|
|||
struct regmap *grf;
|
||||
bool data_sync_bypass;
|
||||
const struct rockchip_rgb_funcs *funcs;
|
||||
struct rockchip_drm_sub_dev sub_dev;
|
||||
};
|
||||
|
||||
static inline struct rockchip_rgb *connector_to_rgb(struct drm_connector *c)
|
||||
|
|
@ -290,6 +291,9 @@ static int rockchip_rgb_bind(struct device *dev, struct device *master,
|
|||
DRM_DEV_ERROR(dev, "failed to attach panel: %d\n", ret);
|
||||
goto err_free_connector;
|
||||
}
|
||||
rgb->sub_dev.connector = &rgb->connector;
|
||||
rgb->sub_dev.of_node = rgb->dev->of_node;
|
||||
rockchip_drm_register_sub_dev(&rgb->sub_dev);
|
||||
} else {
|
||||
rgb->bridge->encoder = encoder;
|
||||
ret = drm_bridge_attach(encoder, rgb->bridge, NULL);
|
||||
|
|
@ -315,6 +319,8 @@ static void rockchip_rgb_unbind(struct device *dev, struct device *master,
|
|||
{
|
||||
struct rockchip_rgb *rgb = dev_get_drvdata(dev);
|
||||
|
||||
if (rgb->sub_dev.connector)
|
||||
rockchip_drm_register_sub_dev(&rgb->sub_dev);
|
||||
if (rgb->panel) {
|
||||
drm_panel_detach(rgb->panel);
|
||||
drm_connector_cleanup(&rgb->connector);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user