diff mbox series

[RFC,v1,13/18] gpu: host1x: mipi: Add of_tegra_mipi_request() API

Message ID 1591768960-31648-14-git-send-email-skomatineni@nvidia.com
State Changes Requested
Headers show
Series Support for Tegra video capture from external sensor | expand

Commit Message

Sowjanya Komatineni June 10, 2020, 6:02 a.m. UTC
This patch adds an API of_tegra_mipi_request() to allow creating
mipi device for specific device node rather than a device so Tegra
CSI driver can use it for calibrating MIPI pads for each stream
independently.

Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
---
 drivers/gpu/host1x/mipi.c | 10 ++++++++--
 include/linux/host1x.h    |  2 ++
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Dmitry Osipenko June 10, 2020, 1:33 p.m. UTC | #1
10.06.2020 09:02, Sowjanya Komatineni пишет:
> This patch adds an API of_tegra_mipi_request() to allow creating
> mipi device for specific device node rather than a device so Tegra
> CSI driver can use it for calibrating MIPI pads for each stream
> independently.
> 
> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
> ---
>  drivers/gpu/host1x/mipi.c | 10 ++++++++--
>  include/linux/host1x.h    |  2 ++
>  2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
> index e00809d..f51fe69 100644
> --- a/drivers/gpu/host1x/mipi.c
> +++ b/drivers/gpu/host1x/mipi.c
> @@ -206,9 +206,9 @@ static int tegra_mipi_power_down(struct tegra_mipi *mipi)
>  	return 0;
>  }
>  
> -struct tegra_mipi_device *tegra_mipi_request(struct device *device)
> +struct tegra_mipi_device *of_tegra_mipi_request(struct device *device,
> +						struct device_node *np)
>  {
> -	struct device_node *np = device->of_node;
>  	struct tegra_mipi_device *dev;
>  	struct of_phandle_args args;
>  	int err;
> @@ -252,6 +252,12 @@ struct tegra_mipi_device *tegra_mipi_request(struct device *device)
>  	of_node_put(args.np);
>  	return ERR_PTR(err);
>  }
> +EXPORT_SYMBOL(of_tegra_mipi_request);
> +
> +struct tegra_mipi_device *tegra_mipi_request(struct device *device)
> +{
> +	return of_tegra_mipi_request(device, device->of_node);
> +}
>  EXPORT_SYMBOL(tegra_mipi_request);
>  
>  void tegra_mipi_free(struct tegra_mipi_device *device)
> diff --git a/include/linux/host1x.h b/include/linux/host1x.h
> index c230b4e..a61ca52 100644
> --- a/include/linux/host1x.h
> +++ b/include/linux/host1x.h
> @@ -325,6 +325,8 @@ int host1x_client_resume(struct host1x_client *client);
>  
>  struct tegra_mipi_device;
>  
> +struct tegra_mipi_device *of_tegra_mipi_request(struct device *device,
> +						struct device_node *np);

Looks like adding a new function here is a bit of overkill. What about
to change tegra_mipi_request() to take the node argument?
Sowjanya Komatineni June 10, 2020, 5 p.m. UTC | #2
On 6/10/20 6:33 AM, Dmitry Osipenko wrote:
> 10.06.2020 09:02, Sowjanya Komatineni пишет:
>> This patch adds an API of_tegra_mipi_request() to allow creating
>> mipi device for specific device node rather than a device so Tegra
>> CSI driver can use it for calibrating MIPI pads for each stream
>> independently.
>>
>> Signed-off-by: Sowjanya Komatineni <skomatineni@nvidia.com>
>> ---
>>   drivers/gpu/host1x/mipi.c | 10 ++++++++--
>>   include/linux/host1x.h    |  2 ++
>>   2 files changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
>> index e00809d..f51fe69 100644
>> --- a/drivers/gpu/host1x/mipi.c
>> +++ b/drivers/gpu/host1x/mipi.c
>> @@ -206,9 +206,9 @@ static int tegra_mipi_power_down(struct tegra_mipi *mipi)
>>   	return 0;
>>   }
>>   
>> -struct tegra_mipi_device *tegra_mipi_request(struct device *device)
>> +struct tegra_mipi_device *of_tegra_mipi_request(struct device *device,
>> +						struct device_node *np)
>>   {
>> -	struct device_node *np = device->of_node;
>>   	struct tegra_mipi_device *dev;
>>   	struct of_phandle_args args;
>>   	int err;
>> @@ -252,6 +252,12 @@ struct tegra_mipi_device *tegra_mipi_request(struct device *device)
>>   	of_node_put(args.np);
>>   	return ERR_PTR(err);
>>   }
>> +EXPORT_SYMBOL(of_tegra_mipi_request);
>> +
>> +struct tegra_mipi_device *tegra_mipi_request(struct device *device)
>> +{
>> +	return of_tegra_mipi_request(device, device->of_node);
>> +}
>>   EXPORT_SYMBOL(tegra_mipi_request);
>>   
>>   void tegra_mipi_free(struct tegra_mipi_device *device)
>> diff --git a/include/linux/host1x.h b/include/linux/host1x.h
>> index c230b4e..a61ca52 100644
>> --- a/include/linux/host1x.h
>> +++ b/include/linux/host1x.h
>> @@ -325,6 +325,8 @@ int host1x_client_resume(struct host1x_client *client);
>>   
>>   struct tegra_mipi_device;
>>   
>> +struct tegra_mipi_device *of_tegra_mipi_request(struct device *device,
>> +						struct device_node *np);
> Looks like adding a new function here is a bit of overkill. What about
> to change tegra_mipi_request() to take the node argument?

thought to avoid changes to existing usage of that function in other 
drivers.

Will update in v2.
diff mbox series

Patch

diff --git a/drivers/gpu/host1x/mipi.c b/drivers/gpu/host1x/mipi.c
index e00809d..f51fe69 100644
--- a/drivers/gpu/host1x/mipi.c
+++ b/drivers/gpu/host1x/mipi.c
@@ -206,9 +206,9 @@  static int tegra_mipi_power_down(struct tegra_mipi *mipi)
 	return 0;
 }
 
-struct tegra_mipi_device *tegra_mipi_request(struct device *device)
+struct tegra_mipi_device *of_tegra_mipi_request(struct device *device,
+						struct device_node *np)
 {
-	struct device_node *np = device->of_node;
 	struct tegra_mipi_device *dev;
 	struct of_phandle_args args;
 	int err;
@@ -252,6 +252,12 @@  struct tegra_mipi_device *tegra_mipi_request(struct device *device)
 	of_node_put(args.np);
 	return ERR_PTR(err);
 }
+EXPORT_SYMBOL(of_tegra_mipi_request);
+
+struct tegra_mipi_device *tegra_mipi_request(struct device *device)
+{
+	return of_tegra_mipi_request(device, device->of_node);
+}
 EXPORT_SYMBOL(tegra_mipi_request);
 
 void tegra_mipi_free(struct tegra_mipi_device *device)
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index c230b4e..a61ca52 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -325,6 +325,8 @@  int host1x_client_resume(struct host1x_client *client);
 
 struct tegra_mipi_device;
 
+struct tegra_mipi_device *of_tegra_mipi_request(struct device *device,
+						struct device_node *np);
 struct tegra_mipi_device *tegra_mipi_request(struct device *device);
 void tegra_mipi_free(struct tegra_mipi_device *device);
 int tegra_mipi_enable(struct tegra_mipi_device *device);