Re: [RFC v2 5/5] drm/dsi: Get DSI host by DT device node

2015-11-02 Thread Archit Taneja



On 11/02/2015 04:20 PM, Andrzej Hajda wrote:

On 10/06/2015 11:24 AM, Archit Taneja wrote:

mipi_dsi_devices are inherently aware of their host because they
share a parent-child hierarchy in the device tree.

Non-dsi drivers that create a dummy dsi device don't have this data.
In order to get this information, they require to a phandle to the dsi
host in the device tree.

Maintain a list of all the hosts DSI that are currently registered.

This list will be used to find the mipi_dsi_host corresponding to the
device_node passed in of_find_mipi_dsi_host_by_node.

Signed-off-by: Archit Taneja 


Looks OK, beside lack of documentation, after fixing it you can add
Reviewed-by: Andrzej Hajda 


I will add missing documentation before posting v3.

Thanks again for the review.

Archit



Regards
Andrzej


---
  drivers/gpu/drm/drm_mipi_dsi.c | 30 ++
  include/drm/drm_mipi_dsi.h |  2 ++
  2 files changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index cbb7373..c51d73e 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -216,6 +216,28 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)
return mipi_dsi_device_new(host, );
  }

+static DEFINE_MUTEX(host_lock);
+static LIST_HEAD(host_list);
+
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
+{
+   struct mipi_dsi_host *host;
+
+   mutex_lock(_lock);
+
+   list_for_each_entry(host, _list, list) {
+   if (host->dev->of_node == node) {
+   mutex_unlock(_lock);
+   return host;
+   }
+   }
+
+   mutex_unlock(_lock);
+
+   return NULL;
+}
+EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+
  int mipi_dsi_host_register(struct mipi_dsi_host *host)
  {
struct device_node *node;
@@ -227,6 +249,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
of_mipi_dsi_device_add(host, node);
}

+   mutex_lock(_lock);
+   list_add_tail(>list, _list);
+   mutex_unlock(_lock);
+
return 0;
  }
  EXPORT_SYMBOL(mipi_dsi_host_register);
@@ -243,6 +269,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
void *priv)
  void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
  {
device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
+
+   mutex_lock(_lock);
+   list_del_init(>list);
+   mutex_unlock(_lock);
  }
  EXPORT_SYMBOL(mipi_dsi_host_unregister);

diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 68f49f4..15d3068 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -100,10 +100,12 @@ struct mipi_dsi_host_ops {
  struct mipi_dsi_host {
struct device *dev;
const struct mipi_dsi_host_ops *ops;
+   struct list_head list;
  };

  int mipi_dsi_host_register(struct mipi_dsi_host *host);
  void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);

  /* DSI mode flags */





--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum, hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v2 5/5] drm/dsi: Get DSI host by DT device node

2015-11-02 Thread Andrzej Hajda
On 10/06/2015 11:24 AM, Archit Taneja wrote:
> mipi_dsi_devices are inherently aware of their host because they
> share a parent-child hierarchy in the device tree.
>
> Non-dsi drivers that create a dummy dsi device don't have this data.
> In order to get this information, they require to a phandle to the dsi
> host in the device tree.
>
> Maintain a list of all the hosts DSI that are currently registered.
>
> This list will be used to find the mipi_dsi_host corresponding to the
> device_node passed in of_find_mipi_dsi_host_by_node.
>
> Signed-off-by: Archit Taneja 

Looks OK, beside lack of documentation, after fixing it you can add
Reviewed-by: Andrzej Hajda 

Regards
Andrzej

> ---
>  drivers/gpu/drm/drm_mipi_dsi.c | 30 ++
>  include/drm/drm_mipi_dsi.h |  2 ++
>  2 files changed, 32 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
> index cbb7373..c51d73e 100644
> --- a/drivers/gpu/drm/drm_mipi_dsi.c
> +++ b/drivers/gpu/drm/drm_mipi_dsi.c
> @@ -216,6 +216,28 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, 
> struct device_node *node)
>   return mipi_dsi_device_new(host, );
>  }
>  
> +static DEFINE_MUTEX(host_lock);
> +static LIST_HEAD(host_list);
> +
> +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
> +{
> + struct mipi_dsi_host *host;
> +
> + mutex_lock(_lock);
> +
> + list_for_each_entry(host, _list, list) {
> + if (host->dev->of_node == node) {
> + mutex_unlock(_lock);
> + return host;
> + }
> + }
> +
> + mutex_unlock(_lock);
> +
> + return NULL;
> +}
> +EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
> +
>  int mipi_dsi_host_register(struct mipi_dsi_host *host)
>  {
>   struct device_node *node;
> @@ -227,6 +249,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
>   of_mipi_dsi_device_add(host, node);
>   }
>  
> + mutex_lock(_lock);
> + list_add_tail(>list, _list);
> + mutex_unlock(_lock);
> +
>   return 0;
>  }
>  EXPORT_SYMBOL(mipi_dsi_host_register);
> @@ -243,6 +269,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
> void *priv)
>  void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
>  {
>   device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
> +
> + mutex_lock(_lock);
> + list_del_init(>list);
> + mutex_unlock(_lock);
>  }
>  EXPORT_SYMBOL(mipi_dsi_host_unregister);
>  
> diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
> index 68f49f4..15d3068 100644
> --- a/include/drm/drm_mipi_dsi.h
> +++ b/include/drm/drm_mipi_dsi.h
> @@ -100,10 +100,12 @@ struct mipi_dsi_host_ops {
>  struct mipi_dsi_host {
>   struct device *dev;
>   const struct mipi_dsi_host_ops *ops;
> + struct list_head list;
>  };
>  
>  int mipi_dsi_host_register(struct mipi_dsi_host *host);
>  void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
> +struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node 
> *node);
>  
>  /* DSI mode flags */
>  

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC v2 5/5] drm/dsi: Get DSI host by DT device node

2015-10-06 Thread kbuild test robot
Hi Archit,

[auto build test WARNING on v4.3-rc4 -- if it's inappropriate base, please 
ignore]

reproduce: make htmldocs

All warnings (new ones prefixed by >>):

   drivers/gpu/drm/i915/i915_irq.c:491: warning: No description found for 
parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2217: warning: No description found for 
parameter 'dev'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for 
parameter 'wedged'
   drivers/gpu/drm/i915/i915_irq.c:2397: warning: No description found for 
parameter 'fmt'
   include/drm/drm_crtc.h:310: warning: No description found for parameter 
'mode_blob'
   include/drm/drm_crtc.h:748: warning: No description found for parameter 
'tile_blob_ptr'
   include/drm/drm_crtc.h:787: warning: No description found for parameter 
'rotation'
   include/drm/drm_crtc.h:883: warning: No description found for parameter 
'mutex'
   include/drm/drm_crtc.h:883: warning: No description found for parameter 
'helper_private'
   include/drm/drm_crtc.h:931: warning: Excess struct/union/enum/typedef member 
'base' description in 'drm_bridge'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tile_idr'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'delayed_event'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'edid_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'dpms_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'path_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tile_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'plane_type_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'rotation_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_src_x'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_src_y'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_src_w'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_src_h'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_crtc_x'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_crtc_y'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_crtc_w'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_crtc_h'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_fb_id'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_crtc_id'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_active'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'prop_mode_id'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'dvi_i_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'dvi_i_select_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_select_subconnector_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_mode_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_left_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_right_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_top_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_bottom_margin_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_brightness_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_contrast_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_flicker_reduction_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_overscan_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_saturation_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'tv_hue_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'scaling_mode_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'aspect_ratio_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'dirty_info_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'suggested_x_property'
   include/drm/drm_crtc.h:1169: warning: No description found for parameter 
'suggested_y_property'
   

[RFC v2 5/5] drm/dsi: Get DSI host by DT device node

2015-10-06 Thread Archit Taneja
mipi_dsi_devices are inherently aware of their host because they
share a parent-child hierarchy in the device tree.

Non-dsi drivers that create a dummy dsi device don't have this data.
In order to get this information, they require to a phandle to the dsi
host in the device tree.

Maintain a list of all the hosts DSI that are currently registered.

This list will be used to find the mipi_dsi_host corresponding to the
device_node passed in of_find_mipi_dsi_host_by_node.

Signed-off-by: Archit Taneja 
---
 drivers/gpu/drm/drm_mipi_dsi.c | 30 ++
 include/drm/drm_mipi_dsi.h |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index cbb7373..c51d73e 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -216,6 +216,28 @@ of_mipi_dsi_device_add(struct mipi_dsi_host *host, struct 
device_node *node)
return mipi_dsi_device_new(host, );
 }
 
+static DEFINE_MUTEX(host_lock);
+static LIST_HEAD(host_list);
+
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node)
+{
+   struct mipi_dsi_host *host;
+
+   mutex_lock(_lock);
+
+   list_for_each_entry(host, _list, list) {
+   if (host->dev->of_node == node) {
+   mutex_unlock(_lock);
+   return host;
+   }
+   }
+
+   mutex_unlock(_lock);
+
+   return NULL;
+}
+EXPORT_SYMBOL(of_find_mipi_dsi_host_by_node);
+
 int mipi_dsi_host_register(struct mipi_dsi_host *host)
 {
struct device_node *node;
@@ -227,6 +249,10 @@ int mipi_dsi_host_register(struct mipi_dsi_host *host)
of_mipi_dsi_device_add(host, node);
}
 
+   mutex_lock(_lock);
+   list_add_tail(>list, _list);
+   mutex_unlock(_lock);
+
return 0;
 }
 EXPORT_SYMBOL(mipi_dsi_host_register);
@@ -243,6 +269,10 @@ static int mipi_dsi_remove_device_fn(struct device *dev, 
void *priv)
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host)
 {
device_for_each_child(host->dev, NULL, mipi_dsi_remove_device_fn);
+
+   mutex_lock(_lock);
+   list_del_init(>list);
+   mutex_unlock(_lock);
 }
 EXPORT_SYMBOL(mipi_dsi_host_unregister);
 
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 68f49f4..15d3068 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -100,10 +100,12 @@ struct mipi_dsi_host_ops {
 struct mipi_dsi_host {
struct device *dev;
const struct mipi_dsi_host_ops *ops;
+   struct list_head list;
 };
 
 int mipi_dsi_host_register(struct mipi_dsi_host *host);
 void mipi_dsi_host_unregister(struct mipi_dsi_host *host);
+struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct device_node *node);
 
 /* DSI mode flags */
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation

--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html