Commit 83af0a48 authored by Benjamin Gaignard's avatar Benjamin Gaignard Committed by Daniel Vetter

drm: sti: use late_register and early_unregister callbacks

Make sti driver use register callback to move debugfs
initialization out of sub-components creation.
This will allow to convert driver .load() to
drm_dev_alloc() and drm_dev_register().

sti_compositor bring up 2 crtc but only one debugfs init is
needed so use drm_crtc_index to do it on the first one.
This can't be done in sti_drv because only sti_compositor have
access to the devices.
It is almost the same for sti_encoder which handle multiple
encoder while one only debugfs entry is needed so add a boolean
to avoid multiple debugfs initialization
Signed-off-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1466514580-15194-3-git-send-email-benjamin.gaignard@linaro.org
parent a104299b
...@@ -55,6 +55,26 @@ struct sti_compositor_data stih416_compositor_data = { ...@@ -55,6 +55,26 @@ struct sti_compositor_data stih416_compositor_data = {
}, },
}; };
int sti_compositor_debufs_init(struct sti_compositor *compo,
struct drm_minor *minor)
{
int ret = 0, i;
for (i = 0; compo->vid[i]; i++) {
ret = vid_debugfs_init(compo->vid[i], minor);
if (ret)
return ret;
}
for (i = 0; compo->mixer[i]; i++) {
ret = sti_mixer_debugfs_init(compo->mixer[i], minor);
if (ret)
return ret;
}
return 0;
}
static int sti_compositor_bind(struct device *dev, static int sti_compositor_bind(struct device *dev,
struct device *master, struct device *master,
void *data) void *data)
......
...@@ -81,4 +81,7 @@ struct sti_compositor { ...@@ -81,4 +81,7 @@ struct sti_compositor {
struct notifier_block vtg_vblank_nb; struct notifier_block vtg_vblank_nb;
}; };
int sti_compositor_debufs_init(struct sti_compositor *compo,
struct drm_minor *minor);
#endif #endif
...@@ -331,6 +331,17 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe) ...@@ -331,6 +331,17 @@ void sti_crtc_disable_vblank(struct drm_device *drm_dev, unsigned int pipe)
} }
} }
static int sti_crtc_late_register(struct drm_crtc *crtc)
{
struct sti_mixer *mixer = to_sti_mixer(crtc);
struct sti_compositor *compo = dev_get_drvdata(mixer->dev);
if (drm_crtc_index(crtc) == 0)
return sti_compositor_debufs_init(compo, crtc->dev->primary);
return 0;
}
static const struct drm_crtc_funcs sti_crtc_funcs = { static const struct drm_crtc_funcs sti_crtc_funcs = {
.set_config = drm_atomic_helper_set_config, .set_config = drm_atomic_helper_set_config,
.page_flip = drm_atomic_helper_page_flip, .page_flip = drm_atomic_helper_page_flip,
...@@ -339,6 +350,7 @@ static const struct drm_crtc_funcs sti_crtc_funcs = { ...@@ -339,6 +350,7 @@ static const struct drm_crtc_funcs sti_crtc_funcs = {
.reset = drm_atomic_helper_crtc_reset, .reset = drm_atomic_helper_crtc_reset,
.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
.late_register = sti_crtc_late_register,
}; };
bool sti_crtc_is_main(struct drm_crtc *crtc) bool sti_crtc_is_main(struct drm_crtc *crtc)
......
...@@ -329,6 +329,33 @@ static const struct drm_plane_helper_funcs sti_cursor_helpers_funcs = { ...@@ -329,6 +329,33 @@ static const struct drm_plane_helper_funcs sti_cursor_helpers_funcs = {
.atomic_disable = sti_cursor_atomic_disable, .atomic_disable = sti_cursor_atomic_disable,
}; };
static void sti_cursor_destroy(struct drm_plane *drm_plane)
{
DRM_DEBUG_DRIVER("\n");
drm_plane_helper_disable(drm_plane);
drm_plane_cleanup(drm_plane);
}
static int sti_cursor_late_register(struct drm_plane *drm_plane)
{
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_cursor *cursor = to_sti_cursor(plane);
return cursor_debugfs_init(cursor, drm_plane->dev->primary);
}
struct drm_plane_funcs sti_cursor_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = sti_cursor_destroy,
.set_property = sti_plane_set_property,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
.late_register = sti_cursor_late_register,
};
struct drm_plane *sti_cursor_create(struct drm_device *drm_dev, struct drm_plane *sti_cursor_create(struct drm_device *drm_dev,
struct device *dev, int desc, struct device *dev, int desc,
void __iomem *baseaddr, void __iomem *baseaddr,
...@@ -363,7 +390,7 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev, ...@@ -363,7 +390,7 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev,
res = drm_universal_plane_init(drm_dev, &cursor->plane.drm_plane, res = drm_universal_plane_init(drm_dev, &cursor->plane.drm_plane,
possible_crtcs, possible_crtcs,
&sti_plane_helpers_funcs, &sti_cursor_plane_helpers_funcs,
cursor_supported_formats, cursor_supported_formats,
ARRAY_SIZE(cursor_supported_formats), ARRAY_SIZE(cursor_supported_formats),
DRM_PLANE_TYPE_CURSOR, NULL); DRM_PLANE_TYPE_CURSOR, NULL);
...@@ -377,9 +404,6 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev, ...@@ -377,9 +404,6 @@ struct drm_plane *sti_cursor_create(struct drm_device *drm_dev,
sti_plane_init_property(&cursor->plane, DRM_PLANE_TYPE_CURSOR); sti_plane_init_property(&cursor->plane, DRM_PLANE_TYPE_CURSOR);
if (cursor_debugfs_init(cursor, drm_dev->primary))
DRM_ERROR("CURSOR debugfs setup failed\n");
return &cursor->plane.drm_plane; return &cursor->plane.drm_plane;
err_plane: err_plane:
......
...@@ -404,24 +404,29 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force) ...@@ -404,24 +404,29 @@ sti_dvo_connector_detect(struct drm_connector *connector, bool force)
return connector_status_disconnected; return connector_status_disconnected;
} }
static void sti_dvo_connector_destroy(struct drm_connector *connector) static int sti_dvo_late_register(struct drm_connector *connector)
{ {
struct sti_dvo_connector *dvo_connector struct sti_dvo_connector *dvo_connector
= to_sti_dvo_connector(connector); = to_sti_dvo_connector(connector);
struct sti_dvo *dvo = dvo_connector->dvo;
if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) {
DRM_ERROR("DVO debugfs setup failed\n");
return -EINVAL;
}
drm_connector_unregister(connector); return 0;
drm_connector_cleanup(connector);
kfree(dvo_connector);
} }
static const struct drm_connector_funcs sti_dvo_connector_funcs = { static const struct drm_connector_funcs sti_dvo_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms, .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_dvo_connector_detect, .detect = sti_dvo_connector_detect,
.destroy = sti_dvo_connector_destroy, .destroy = drm_connector_cleanup,
.reset = drm_atomic_helper_connector_reset, .reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
.late_register = sti_dvo_late_register,
}; };
static struct drm_encoder *sti_dvo_find_encoder(struct drm_device *dev) static struct drm_encoder *sti_dvo_find_encoder(struct drm_device *dev)
...@@ -502,9 +507,6 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data) ...@@ -502,9 +507,6 @@ static int sti_dvo_bind(struct device *dev, struct device *master, void *data)
goto err_sysfs; goto err_sysfs;
} }
if (dvo_debugfs_init(dvo, drm_dev->primary))
DRM_ERROR("DVO debugfs setup failed\n");
return 0; return 0;
err_sysfs: err_sysfs:
......
...@@ -866,6 +866,33 @@ static const struct drm_plane_helper_funcs sti_gdp_helpers_funcs = { ...@@ -866,6 +866,33 @@ static const struct drm_plane_helper_funcs sti_gdp_helpers_funcs = {
.atomic_disable = sti_gdp_atomic_disable, .atomic_disable = sti_gdp_atomic_disable,
}; };
static void sti_gdp_destroy(struct drm_plane *drm_plane)
{
DRM_DEBUG_DRIVER("\n");
drm_plane_helper_disable(drm_plane);
drm_plane_cleanup(drm_plane);
}
static int sti_gdp_late_register(struct drm_plane *drm_plane)
{
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_gdp *gdp = to_sti_gdp(plane);
return gdp_debugfs_init(gdp, drm_plane->dev->primary);
}
struct drm_plane_funcs sti_gdp_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = sti_gdp_destroy,
.set_property = sti_plane_set_property,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
.late_register = sti_gdp_late_register,
};
struct drm_plane *sti_gdp_create(struct drm_device *drm_dev, struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,
struct device *dev, int desc, struct device *dev, int desc,
void __iomem *baseaddr, void __iomem *baseaddr,
...@@ -892,7 +919,7 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev, ...@@ -892,7 +919,7 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,
res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane, res = drm_universal_plane_init(drm_dev, &gdp->plane.drm_plane,
possible_crtcs, possible_crtcs,
&sti_plane_helpers_funcs, &sti_gdp_plane_helpers_funcs,
gdp_supported_formats, gdp_supported_formats,
ARRAY_SIZE(gdp_supported_formats), ARRAY_SIZE(gdp_supported_formats),
type, NULL); type, NULL);
...@@ -905,9 +932,6 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev, ...@@ -905,9 +932,6 @@ struct drm_plane *sti_gdp_create(struct drm_device *drm_dev,
sti_plane_init_property(&gdp->plane, type); sti_plane_init_property(&gdp->plane, type);
if (gdp_debugfs_init(gdp, drm_dev->primary))
DRM_ERROR("GDP debugfs setup failed\n");
return &gdp->plane.drm_plane; return &gdp->plane.drm_plane;
err: err:
......
...@@ -681,24 +681,29 @@ sti_hda_connector_detect(struct drm_connector *connector, bool force) ...@@ -681,24 +681,29 @@ sti_hda_connector_detect(struct drm_connector *connector, bool force)
return connector_status_connected; return connector_status_connected;
} }
static void sti_hda_connector_destroy(struct drm_connector *connector) static int sti_hda_late_register(struct drm_connector *connector)
{ {
struct sti_hda_connector *hda_connector struct sti_hda_connector *hda_connector
= to_sti_hda_connector(connector); = to_sti_hda_connector(connector);
struct sti_hda *hda = hda_connector->hda;
if (hda_debugfs_init(hda, hda->drm_dev->primary)) {
DRM_ERROR("HDA debugfs setup failed\n");
return -EINVAL;
}
drm_connector_unregister(connector); return 0;
drm_connector_cleanup(connector);
kfree(hda_connector);
} }
static const struct drm_connector_funcs sti_hda_connector_funcs = { static const struct drm_connector_funcs sti_hda_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms, .dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_hda_connector_detect, .detect = sti_hda_connector_detect,
.destroy = sti_hda_connector_destroy, .destroy = drm_connector_cleanup,
.reset = drm_atomic_helper_connector_reset, .reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
.late_register = sti_hda_late_register,
}; };
static struct drm_encoder *sti_hda_find_encoder(struct drm_device *dev) static struct drm_encoder *sti_hda_find_encoder(struct drm_device *dev)
...@@ -769,9 +774,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data) ...@@ -769,9 +774,6 @@ static int sti_hda_bind(struct device *dev, struct device *master, void *data)
/* force to disable hd dacs at startup */ /* force to disable hd dacs at startup */
hda_enable_hd_dacs(hda, false); hda_enable_hd_dacs(hda, false);
if (hda_debugfs_init(hda, drm_dev->primary))
DRM_ERROR("HDA debugfs setup failed\n");
return 0; return 0;
err_sysfs: err_sysfs:
......
...@@ -1007,8 +1007,21 @@ sti_hdmi_connector_get_property(struct drm_connector *connector, ...@@ -1007,8 +1007,21 @@ sti_hdmi_connector_get_property(struct drm_connector *connector,
return -EINVAL; return -EINVAL;
} }
static int sti_hdmi_late_register(struct drm_connector *connector)
{
struct sti_hdmi_connector *hdmi_connector
= to_sti_hdmi_connector(connector);
struct sti_hdmi *hdmi = hdmi_connector->hdmi;
if (hdmi_debugfs_init(hdmi, hdmi->drm_dev->primary)) {
DRM_ERROR("HDMI debugfs setup failed\n");
return -EINVAL;
}
return 0;
}
static const struct drm_connector_funcs sti_hdmi_connector_funcs = { static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
.dpms = drm_atomic_helper_connector_dpms,
.fill_modes = drm_helper_probe_single_connector_modes, .fill_modes = drm_helper_probe_single_connector_modes,
.detect = sti_hdmi_connector_detect, .detect = sti_hdmi_connector_detect,
.destroy = sti_hdmi_connector_destroy, .destroy = sti_hdmi_connector_destroy,
...@@ -1018,6 +1031,7 @@ static const struct drm_connector_funcs sti_hdmi_connector_funcs = { ...@@ -1018,6 +1031,7 @@ static const struct drm_connector_funcs sti_hdmi_connector_funcs = {
.atomic_get_property = sti_hdmi_connector_get_property, .atomic_get_property = sti_hdmi_connector_get_property,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
.late_register = sti_hdmi_late_register,
}; };
static struct drm_encoder *sti_hdmi_find_encoder(struct drm_device *dev) static struct drm_encoder *sti_hdmi_find_encoder(struct drm_device *dev)
...@@ -1091,9 +1105,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -1091,9 +1105,6 @@ static int sti_hdmi_bind(struct device *dev, struct device *master, void *data)
/* Enable default interrupts */ /* Enable default interrupts */
hdmi_write(hdmi, HDMI_DEFAULT_INT, HDMI_INT_EN); hdmi_write(hdmi, HDMI_DEFAULT_INT, HDMI_INT_EN);
if (hdmi_debugfs_init(hdmi, drm_dev->primary))
DRM_ERROR("HDMI debugfs setup failed\n");
return 0; return 0;
err_sysfs: err_sysfs:
......
...@@ -1234,6 +1234,33 @@ static const struct drm_plane_helper_funcs sti_hqvdp_helpers_funcs = { ...@@ -1234,6 +1234,33 @@ static const struct drm_plane_helper_funcs sti_hqvdp_helpers_funcs = {
.atomic_disable = sti_hqvdp_atomic_disable, .atomic_disable = sti_hqvdp_atomic_disable,
}; };
static void sti_hqvdp_destroy(struct drm_plane *drm_plane)
{
DRM_DEBUG_DRIVER("\n");
drm_plane_helper_disable(drm_plane);
drm_plane_cleanup(drm_plane);
}
static int sti_hqvdp_late_register(struct drm_plane *drm_plane)
{
struct sti_plane *plane = to_sti_plane(drm_plane);
struct sti_hqvdp *hqvdp = to_sti_hqvdp(plane);
return hqvdp_debugfs_init(hqvdp, drm_plane->dev->primary);
}
struct drm_plane_funcs sti_hqvdp_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = sti_hqvdp_destroy,
.set_property = sti_plane_set_property,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
.late_register = sti_hqvdp_late_register,
};
static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev, static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev,
struct device *dev, int desc) struct device *dev, int desc)
{ {
...@@ -1246,7 +1273,7 @@ static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev, ...@@ -1246,7 +1273,7 @@ static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev,
sti_hqvdp_init(hqvdp); sti_hqvdp_init(hqvdp);
res = drm_universal_plane_init(drm_dev, &hqvdp->plane.drm_plane, 1, res = drm_universal_plane_init(drm_dev, &hqvdp->plane.drm_plane, 1,
&sti_plane_helpers_funcs, &sti_hqvdp_plane_helpers_funcs,
hqvdp_supported_formats, hqvdp_supported_formats,
ARRAY_SIZE(hqvdp_supported_formats), ARRAY_SIZE(hqvdp_supported_formats),
DRM_PLANE_TYPE_OVERLAY, NULL); DRM_PLANE_TYPE_OVERLAY, NULL);
...@@ -1259,9 +1286,6 @@ static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev, ...@@ -1259,9 +1286,6 @@ static struct drm_plane *sti_hqvdp_create(struct drm_device *drm_dev,
sti_plane_init_property(&hqvdp->plane, DRM_PLANE_TYPE_OVERLAY); sti_plane_init_property(&hqvdp->plane, DRM_PLANE_TYPE_OVERLAY);
if (hqvdp_debugfs_init(hqvdp, drm_dev->primary))
DRM_ERROR("HQVDP debugfs setup failed\n");
return &hqvdp->plane.drm_plane; return &hqvdp->plane.drm_plane;
} }
......
...@@ -181,7 +181,7 @@ static struct drm_info_list mixer1_debugfs_files[] = { ...@@ -181,7 +181,7 @@ static struct drm_info_list mixer1_debugfs_files[] = {
{ "mixer_aux", mixer_dbg_show, 0, NULL }, { "mixer_aux", mixer_dbg_show, 0, NULL },
}; };
static int mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor) int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor)
{ {
unsigned int i; unsigned int i;
struct drm_info_list *mixer_debugfs_files; struct drm_info_list *mixer_debugfs_files;
...@@ -393,8 +393,5 @@ struct sti_mixer *sti_mixer_create(struct device *dev, ...@@ -393,8 +393,5 @@ struct sti_mixer *sti_mixer_create(struct device *dev,
DRM_DEBUG_DRIVER("%s created. Regs=%p\n", DRM_DEBUG_DRIVER("%s created. Regs=%p\n",
sti_mixer_to_str(mixer), mixer->regs); sti_mixer_to_str(mixer), mixer->regs);
if (mixer_debugfs_init(mixer, drm_dev->primary))
DRM_ERROR("MIXER debugfs setup failed\n");
return mixer; return mixer;
} }
...@@ -55,6 +55,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer, ...@@ -55,6 +55,8 @@ int sti_mixer_active_video_area(struct sti_mixer *mixer,
void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable); void sti_mixer_set_background_status(struct sti_mixer *mixer, bool enable);
int sti_mixer_debugfs_init(struct sti_mixer *mixer, struct drm_minor *minor);
/* depth in Cross-bar control = z order */ /* depth in Cross-bar control = z order */
#define GAM_MIXER_NB_DEPTH_LEVEL 6 #define GAM_MIXER_NB_DEPTH_LEVEL 6
......
...@@ -106,17 +106,9 @@ void sti_plane_update_fps(struct sti_plane *plane, ...@@ -106,17 +106,9 @@ void sti_plane_update_fps(struct sti_plane *plane,
plane->fps_info.fips_str); plane->fps_info.fips_str);
} }
static void sti_plane_destroy(struct drm_plane *drm_plane) int sti_plane_set_property(struct drm_plane *drm_plane,
{ struct drm_property *property,
DRM_DEBUG_DRIVER("\n"); uint64_t val)
drm_plane_helper_disable(drm_plane);
drm_plane_cleanup(drm_plane);
}
static int sti_plane_set_property(struct drm_plane *drm_plane,
struct drm_property *property,
uint64_t val)
{ {
struct drm_device *dev = drm_plane->dev; struct drm_device *dev = drm_plane->dev;
struct sti_private *private = dev->dev_private; struct sti_private *private = dev->dev_private;
...@@ -170,13 +162,3 @@ void sti_plane_init_property(struct sti_plane *plane, ...@@ -170,13 +162,3 @@ void sti_plane_init_property(struct sti_plane *plane,
plane->drm_plane.base.id, plane->drm_plane.base.id,
sti_plane_to_str(plane), plane->zorder); sti_plane_to_str(plane), plane->zorder);
} }
struct drm_plane_funcs sti_plane_helpers_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
.destroy = sti_plane_destroy,
.set_property = sti_plane_set_property,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
};
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
#include <drm/drm_atomic_helper.h> #include <drm/drm_atomic_helper.h>
#include <drm/drm_plane_helper.h> #include <drm/drm_plane_helper.h>
extern struct drm_plane_funcs sti_plane_helpers_funcs;
#define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane) #define to_sti_plane(x) container_of(x, struct sti_plane, drm_plane)
#define STI_PLANE_TYPE_SHIFT 8 #define STI_PLANE_TYPE_SHIFT 8
...@@ -83,6 +81,11 @@ const char *sti_plane_to_str(struct sti_plane *plane); ...@@ -83,6 +81,11 @@ const char *sti_plane_to_str(struct sti_plane *plane);
void sti_plane_update_fps(struct sti_plane *plane, void sti_plane_update_fps(struct sti_plane *plane,
bool new_frame, bool new_frame,
bool new_field); bool new_field);
int sti_plane_set_property(struct drm_plane *drm_plane,
struct drm_property *property,
uint64_t val);
void sti_plane_init_property(struct sti_plane *plane, void sti_plane_init_property(struct sti_plane *plane,
enum drm_plane_type type); enum drm_plane_type type);
#endif #endif
...@@ -112,6 +112,7 @@ struct sti_tvout { ...@@ -112,6 +112,7 @@ struct sti_tvout {
struct drm_encoder *hdmi; struct drm_encoder *hdmi;
struct drm_encoder *hda; struct drm_encoder *hda;
struct drm_encoder *dvo; struct drm_encoder *dvo;
bool debugfs_registered;
}; };
struct sti_tvout_encoder { struct sti_tvout_encoder {
...@@ -625,8 +626,37 @@ static void sti_tvout_encoder_destroy(struct drm_encoder *encoder) ...@@ -625,8 +626,37 @@ static void sti_tvout_encoder_destroy(struct drm_encoder *encoder)
kfree(sti_encoder); kfree(sti_encoder);
} }
static int sti_tvout_late_register(struct drm_encoder *encoder)
{
struct sti_tvout *tvout = to_sti_tvout(encoder);
int ret;
if (tvout->debugfs_registered)
return 0;
ret = tvout_debugfs_init(tvout, encoder->dev->primary);
if (ret)
return ret;
tvout->debugfs_registered = true;
return 0;
}
static void sti_tvout_early_unregister(struct drm_encoder *encoder)
{
struct sti_tvout *tvout = to_sti_tvout(encoder);
if (!tvout->debugfs_registered)
return;
tvout_debugfs_exit(tvout, encoder->dev->primary);
tvout->debugfs_registered = false;
}
static const struct drm_encoder_funcs sti_tvout_encoder_funcs = { static const struct drm_encoder_funcs sti_tvout_encoder_funcs = {
.destroy = sti_tvout_encoder_destroy, .destroy = sti_tvout_encoder_destroy,
.late_register = sti_tvout_late_register,
.early_unregister = sti_tvout_early_unregister,
}; };
static void sti_dvo_encoder_enable(struct drm_encoder *encoder) static void sti_dvo_encoder_enable(struct drm_encoder *encoder)
...@@ -813,9 +843,6 @@ static int sti_tvout_bind(struct device *dev, struct device *master, void *data) ...@@ -813,9 +843,6 @@ static int sti_tvout_bind(struct device *dev, struct device *master, void *data)
sti_tvout_create_encoders(drm_dev, tvout); sti_tvout_create_encoders(drm_dev, tvout);
if (tvout_debugfs_init(tvout, drm_dev->primary))
DRM_ERROR("TVOUT debugfs setup failed\n");
return 0; return 0;
} }
...@@ -823,11 +850,8 @@ static void sti_tvout_unbind(struct device *dev, struct device *master, ...@@ -823,11 +850,8 @@ static void sti_tvout_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct sti_tvout *tvout = dev_get_drvdata(dev); struct sti_tvout *tvout = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
sti_tvout_destroy_encoders(tvout); sti_tvout_destroy_encoders(tvout);
tvout_debugfs_exit(tvout, drm_dev->primary);
} }
static const struct component_ops sti_tvout_ops = { static const struct component_ops sti_tvout_ops = {
......
...@@ -123,7 +123,7 @@ static struct drm_info_list vid_debugfs_files[] = { ...@@ -123,7 +123,7 @@ static struct drm_info_list vid_debugfs_files[] = {
{ "vid", vid_dbg_show, 0, NULL }, { "vid", vid_dbg_show, 0, NULL },
}; };
static int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor) int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor)
{ {
unsigned int i; unsigned int i;
...@@ -220,8 +220,5 @@ struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev, ...@@ -220,8 +220,5 @@ struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
sti_vid_init(vid); sti_vid_init(vid);
if (vid_debugfs_init(vid, drm_dev->primary))
DRM_ERROR("VID debugfs setup failed\n");
return vid; return vid;
} }
...@@ -26,4 +26,6 @@ void sti_vid_disable(struct sti_vid *vid); ...@@ -26,4 +26,6 @@ void sti_vid_disable(struct sti_vid *vid);
struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev, struct sti_vid *sti_vid_create(struct device *dev, struct drm_device *drm_dev,
int id, void __iomem *baseaddr); int id, void __iomem *baseaddr);
int vid_debugfs_init(struct sti_vid *vid, struct drm_minor *minor);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment