Message ID | 1422351097-25027-2-git-send-email-shobhit.kumar@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 01/27/2015 03:01 PM, Shobhit Kumar wrote: > For scenarios where OF is not available, we can use panel identification by > name. Any body had a look at this ? Regards Shobhit > > Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com> > --- > drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++ > include/drm/drm_panel.h | 3 +++ > 2 files changed, 21 insertions(+) > > diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c > index 2ef988e..e1cb8cf 100644 > --- a/drivers/gpu/drm/drm_panel.c > +++ b/drivers/gpu/drm/drm_panel.c > @@ -95,6 +95,24 @@ struct drm_panel *of_drm_find_panel(struct device_node *np) > EXPORT_SYMBOL(of_drm_find_panel); > #endif > > +struct drm_panel *drm_find_panel_by_name(const char *name) > +{ > + struct drm_panel *panel; > + > + mutex_lock(&panel_lock); > + > + list_for_each_entry(panel, &panel_list, list) { > + if (strcmp(panel->name, name) == 0) { > + mutex_unlock(&panel_lock); > + return panel; > + } > + } > + > + mutex_unlock(&panel_lock); > + return NULL; > +} > +EXPORT_SYMBOL(drm_find_panel_by_name); > + > MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>"); > MODULE_DESCRIPTION("DRM panel infrastructure"); > MODULE_LICENSE("GPL and additional rights"); > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h > index 1fbcc96..1ef9ff3 100644 > --- a/include/drm/drm_panel.h > +++ b/include/drm/drm_panel.h > @@ -74,6 +74,7 @@ struct drm_panel { > struct drm_device *drm; > struct drm_connector *connector; > struct device *dev; > + char name[NAME_MAX]; > > const struct drm_panel_funcs *funcs; > > @@ -137,4 +138,6 @@ static inline struct drm_panel *of_drm_find_panel(struct device_node *np) > } > #endif > > +struct drm_panel *drm_find_panel_by_name(const char *name); > + > #endif >
diff --git a/drivers/gpu/drm/drm_panel.c b/drivers/gpu/drm/drm_panel.c index 2ef988e..e1cb8cf 100644 --- a/drivers/gpu/drm/drm_panel.c +++ b/drivers/gpu/drm/drm_panel.c @@ -95,6 +95,24 @@ struct drm_panel *of_drm_find_panel(struct device_node *np) EXPORT_SYMBOL(of_drm_find_panel); #endif +struct drm_panel *drm_find_panel_by_name(const char *name) +{ + struct drm_panel *panel; + + mutex_lock(&panel_lock); + + list_for_each_entry(panel, &panel_list, list) { + if (strcmp(panel->name, name) == 0) { + mutex_unlock(&panel_lock); + return panel; + } + } + + mutex_unlock(&panel_lock); + return NULL; +} +EXPORT_SYMBOL(drm_find_panel_by_name); + MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>"); MODULE_DESCRIPTION("DRM panel infrastructure"); MODULE_LICENSE("GPL and additional rights"); diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 1fbcc96..1ef9ff3 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -74,6 +74,7 @@ struct drm_panel { struct drm_device *drm; struct drm_connector *connector; struct device *dev; + char name[NAME_MAX]; const struct drm_panel_funcs *funcs; @@ -137,4 +138,6 @@ static inline struct drm_panel *of_drm_find_panel(struct device_node *np) } #endif +struct drm_panel *drm_find_panel_by_name(const char *name); + #endif
For scenarios where OF is not available, we can use panel identification by name. Signed-off-by: Shobhit Kumar <shobhit.kumar@intel.com> --- drivers/gpu/drm/drm_panel.c | 18 ++++++++++++++++++ include/drm/drm_panel.h | 3 +++ 2 files changed, 21 insertions(+)