drm/connector: Add of_drm_find_connector
Subsystems (2)
PATCH v2 1/1 drm/connector: Add of_drm_find_connector
Add a function to look up a connector by device tree node, like what of_drm_find_bridge/panel does.
Signed-off-by Andy Yan <[email protected]>
Reported-by kernel test robot <[email protected]>
---
Changes in v2:
- Add function declaration
drivers/gpu/drm/drm_connector.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 14 ++++++++++++++ 2 files changed, 47 insertions(+)
drivers/gpu/drm/drm_connector.c +33 -0
@@ -743,6 +743,39 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter) }EXPORT_SYMBOL (drm_connector_list_iter_end); +#ifdef CONFIG_OF +/** +* of_drm_find_connector - look up a connector using a device tree node +* @np: device tree node of the connector +* +* +* Return: A pointer to the connector which match the specified device tree +* node or NULL if no panel matching the device tree node can be found, or +* -ENODEV: the device is not available (status != "okay" or "ok") +*/ +struct drm_connector *of_drm_find_connector (struct drm_device *dev,const struct device_node *np) +{ +struct drm_connector *connector; +struct drm_connector_list_iter conn_iter; + +if (!of_device_is_available (np)) +return ERR_PTR (-ENODEV ); + +drm_connector_list_iter_begin (dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (connector->of_node == np) { +drm_connector_list_iter_end (&conn_iter); +return connector; + } + } +drm_connector_list_iter_end (&conn_iter); + +return NULL ; +} +EXPORT_SYMBOL (of_drm_find_connector); +#endif + +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { { SubPixelUnknown,"Unknown" }, { SubPixelHorizontalRGB,"Horizontal RGB" },
include/drm/drm_connector.h +14 -0
@@ -1129,6 +1129,9 @@ struct drm_connector {/** @attr: sysfs attributes */ struct device_attribute *attr; +/** @of_node: device tree node */ +struct device_node *of_node; +/** * @head: *
@@ -1647,6 +1650,17 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);bool drm_connector_has_possible_encoder (struct drm_connector *connector,struct drm_encoder *encoder); +#if defined(CONFIG_OF ) +struct drm_connector * +of_drm_find_connector (struct drm_device *dev,const struct device_node *np); +#else +static inline struct drm_connector * +of_drm_find_connector (struct drm_device *dev,const struct device_node *np) +{ +return ERR_PTR (-ENODEV ); +} +#endif +/** * drm_for_each_connector_iter - connector_list iterator macro * @connector: &struct drm_connector pointer used as cursor
Signature · 1 line
2.17.1
ping
Quoted 92 lines · Andy Yan
Add a function to look up a connector by device tree node, like what of_drm_find_bridge/panel does.
Signed-off-by Andy Yan <[email protected]>Reported-by kernel test robot <[email protected]>---
Changes in v2:
- Add function declarationdrivers/gpu/drm/drm_connector.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 14 ++++++++++++++ 2 files changed, 47 insertions(+)drivers/gpu/drm/drm_connector.c +33
-0@@ -743,6 +743,39 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter) }EXPORT_SYMBOL (drm_connector_list_iter_end); +#ifdef CONFIG_OF +/** +* of_drm_find_connector - look up a connector using a device tree node +* @np: device tree node of the connector +* +* +* Return: A pointer to the connector which match the specified device tree +* node or NULL if no panel matching the device tree node can be found, or +* -ENODEV: the device is not available (status != "okay" or "ok") +*/ +struct drm_connector *of_drm_find_connector (struct drm_device *dev,const struct device_node *np) +{ +struct drm_connector *connector; +struct drm_connector_list_iter conn_iter; + +if (!of_device_is_available (np)) +return ERR_PTR (-ENODEV ); + +drm_connector_list_iter_begin (dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (connector->of_node == np) { +drm_connector_list_iter_end (&conn_iter); +return connector; + } + } +drm_connector_list_iter_end (&conn_iter); + +return NULL ; +} +EXPORT_SYMBOL (of_drm_find_connector); +#endif + +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { { SubPixelUnknown,"Unknown" }, { SubPixelHorizontalRGB,"Horizontal RGB" },include/drm/drm_connector.h +14
-0@@ -1129,6 +1129,9 @@ struct drm_connector {/** @attr: sysfs attributes */ struct device_attribute *attr; +/** @of_node: device tree node */ +struct device_node *of_node; +/** * @head: * @@ -1647,6 +1650,17 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);bool drm_connector_has_possible_encoder (struct drm_connector *connector,struct drm_encoder *encoder); +#if defined(CONFIG_OF ) +struct drm_connector * +of_drm_find_connector (struct drm_device *dev,const struct device_node *np); +#else +static inline struct drm_connector * +of_drm_find_connector (struct drm_device *dev,const struct device_node *np) +{ +return ERR_PTR (-ENODEV ); +} +#endif +/** * drm_for_each_connector_iter - connector_list iterator macro * @connector: &struct drm_connector pointer used as cursor
Quoted 10 lines · Andy Yan
ping
Quoted 6 lines · Andy Yan
Add a function to look up a connector by device tree node, like what of_drm_find_bridge/panel does.
Signed-off-by Andy Yan <[email protected]>Reported-by kernel test robot <[email protected]>
I'm pretty sure the answer is "no", but without a user for this it's impossible to tell I guess. Always send out the patches using new stuff together with the new stuff.
-Daniel
Quoted 88 lines
Quoted 86 lines
---
Changes in v2:
- Add function declarationdrivers/gpu/drm/drm_connector.c | 33 +++++++++++++++++++++++++++++++++ include/drm/drm_connector.h | 14 ++++++++++++++ 2 files changed, 47 insertions(+)drivers/gpu/drm/drm_connector.c +33
-0@@ -743,6 +743,39 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter) }EXPORT_SYMBOL (drm_connector_list_iter_end); +#ifdef CONFIG_OF +/** +* of_drm_find_connector - look up a connector using a device tree node +* @np: device tree node of the connector +* +* +* Return: A pointer to the connector which match the specified device tree +* node or NULL if no panel matching the device tree node can be found, or +* -ENODEV: the device is not available (status != "okay" or "ok") +*/ +struct drm_connector *of_drm_find_connector (struct drm_device *dev,const struct device_node *np) +{ +struct drm_connector *connector; +struct drm_connector_list_iter conn_iter; + +if (!of_device_is_available (np)) +return ERR_PTR (-ENODEV ); + +drm_connector_list_iter_begin (dev, &conn_iter); +drm_for_each_connector_iter (connector, &conn_iter) { +if (connector->of_node == np) { +drm_connector_list_iter_end (&conn_iter); +return connector; + } + } +drm_connector_list_iter_end (&conn_iter); + +return NULL ; +} +EXPORT_SYMBOL (of_drm_find_connector); +#endif + +static const struct drm_prop_enum_list drm_subpixel_enum_list[] = { { SubPixelUnknown,"Unknown" }, { SubPixelHorizontalRGB,"Horizontal RGB" },include/drm/drm_connector.h +14
-0@@ -1129,6 +1129,9 @@ struct drm_connector {/** @attr: sysfs attributes */ struct device_attribute *attr; +/** @of_node: device tree node */ +struct device_node *of_node; +/** * @head: * @@ -1647,6 +1650,17 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter);bool drm_connector_has_possible_encoder (struct drm_connector *connector,struct drm_encoder *encoder); +#if defined(CONFIG_OF ) +struct drm_connector * +of_drm_find_connector (struct drm_device *dev,const struct device_node *np); +#else +static inline struct drm_connector * +of_drm_find_connector (struct drm_device *dev,const struct device_node *np) +{ +return ERR_PTR (-ENODEV ); +} +#endif +/** * drm_for_each_connector_iter - connector_list iterator macro * @connector: &struct drm_connector pointer used as cursor
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel