Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1260534 > unrolled thread

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

Started byAndrzej Hajda <a.hajda@samsung.com>
First post2015-11-02 12:00 +0100
Last post2015-11-03 08:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC v2 5/5] drm/dsi: Get DSI host by DT device node Andrzej Hajda <a.hajda@samsung.com> - 2015-11-02 12:00 +0100
    Re: [RFC v2 5/5] drm/dsi: Get DSI host by DT device node Archit Taneja <architt@codeaurora.org> - 2015-11-03 08:30 +0100

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

FromAndrzej Hajda <a.hajda@samsung.com>
Date2015-11-02 12:00 +0100
SubjectRe: [RFC v2 5/5] drm/dsi: Get DSI host by DT device node
Message-ID<qql0e-4in-21@gated-at.bofh.it>
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 <architt@codeaurora.org>

Looks OK, beside lack of documentation, after fixing it you can add
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

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, &info);
>  }
>  
> +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(&host_lock);
> +
> +	list_for_each_entry(host, &host_list, list) {
> +		if (host->dev->of_node == node) {
> +			mutex_unlock(&host_lock);
> +			return host;
> +		}
> +	}
> +
> +	mutex_unlock(&host_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(&host_lock);
> +	list_add_tail(&host->list, &host_list);
> +	mutex_unlock(&host_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(&host_lock);
> +	list_del_init(&host->list);
> +	mutex_unlock(&host_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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1261248

FromArchit Taneja <architt@codeaurora.org>
Date2015-11-03 08:30 +0100
Message-ID<qqEcy-83d-15@gated-at.bofh.it>
In reply to#1260534

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 <architt@codeaurora.org>
>
> Looks OK, beside lack of documentation, after fixing it you can add
> Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

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, &info);
>>   }
>>
>> +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(&host_lock);
>> +
>> +	list_for_each_entry(host, &host_list, list) {
>> +		if (host->dev->of_node == node) {
>> +			mutex_unlock(&host_lock);
>> +			return host;
>> +		}
>> +	}
>> +
>> +	mutex_unlock(&host_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(&host_lock);
>> +	list_add_tail(&host->list, &host_list);
>> +	mutex_unlock(&host_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(&host_lock);
>> +	list_del_init(&host->list);
>> +	mutex_unlock(&host_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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web