diff mbox

[3/6] Support for TVP7002 in VPFE

Message ID 1251418631-16196-1-git-send-email-santiago.nunez@ridgerun.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

santiago.nunez@ridgerun.com Aug. 28, 2009, 12:17 a.m. UTC
From: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>

This patch adds support for TVP7002 in the DM365 VPFE inteface.

Signed-off-by: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
---
 drivers/media/video/davinci/vpfe_capture.c |   53 ++++++++++++++++++++++++++--
 1 files changed, 50 insertions(+), 3 deletions(-)

Comments

Vaibhav Hiremath Aug. 28, 2009, 4:39 a.m. UTC | #1
> -----Original Message-----
> From: davinci-linux-open-source-bounces@linux.davincidsp.com
> [mailto:davinci-linux-open-source-bounces@linux.davincidsp.com] On
> Behalf Of santiago.nunez@ridgerun.com
> Sent: Friday, August 28, 2009 5:47 AM
> To: Karicheri, Muralidharan
> Cc: davinci-linux-open-source@linux.davincidsp.com;
> clark.becker@ridgerun.com; Santiago Nunez-Corrales;
> todd.fischer@ridgerun.com
> Subject: [PATCH 3/6] Support for TVP7002 in VPFE
> 
> From: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
> 
> This patch adds support for TVP7002 in the DM365 VPFE inteface.
> 
> Signed-off-by: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
> ---
>  drivers/media/video/davinci/vpfe_capture.c |   53
> ++++++++++++++++++++++++++--
>  1 files changed, 50 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/video/davinci/vpfe_capture.c
> b/drivers/media/video/davinci/vpfe_capture.c
> index 2a4a05a..98c288a 100644
> --- a/drivers/media/video/davinci/vpfe_capture.c
> +++ b/drivers/media/video/davinci/vpfe_capture.c
> @@ -140,8 +140,17 @@ static DEFINE_MUTEX(ccdc_lock);
>  static struct ccdc_config *ccdc_cfg;
> 
>  const struct vpfe_standard vpfe_standards[] = {
> -	{V4L2_STD_525_60, 720, 480, {11, 10}, 1},
> -	{V4L2_STD_625_50, 720, 576, {54, 59}, 1},
> +	{V4L2_STD_480P_60, 720, 480, {11, 10}, 0},
> +	{V4L2_STD_480I_60, 720, 480, {11, 10}, 1},
> +	{V4L2_STD_576P_50, 720, 576, {54, 59}, 0},
> +	{V4L2_STD_576I_50, 720, 576, {54, 59}, 1},
> +	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
> +	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
> +	{V4L2_STD_720P_60, 1280, 720, {12, 10}, 0},
> +	{V4L2_STD_1080I_50, 1920, 1080, {12, 10}, 1},
> +	{V4L2_STD_1080I_60, 1920, 1080, {12, 10}, 1},
> +	{V4L2_STD_1080P_50, 1920, 1080, {12, 10}, 0},
> +	{V4L2_STD_1080P_60, 1920, 1080, {12, 10}, 0},
>  };
> 
>  /* Used when raw Bayer image from ccdc is directly captured to
> SDRAM */
> @@ -249,6 +258,7 @@ int vpfe_register_ccdc_device(struct
> ccdc_hw_device *dev)
>  	BUG_ON(!dev->hw_ops.set_image_window);
>  	BUG_ON(!dev->hw_ops.get_image_window);
>  	BUG_ON(!dev->hw_ops.get_line_length);
> +	BUG_ON(!dev->hw_ops.setfbaddr);
>  	BUG_ON(!dev->hw_ops.getfid);
> 
>  	mutex_lock(&ccdc_lock);
> @@ -276,6 +286,8 @@ int vpfe_register_ccdc_device(struct
> ccdc_hw_device *dev)
>  	}
> 
>  	ccdc_dev = dev;
> +	dev->hw_ops.set_ccdc_base(ccdc_cfg->ccdc_addr,
> +				  ccdc_cfg->ccdc_addr_size);
>  unlock:
>  	mutex_unlock(&ccdc_lock);
>  	return ret;
> @@ -2170,12 +2182,37 @@ static __init int vpfe_probe(struct
> platform_device *pdev)
>  	}
>  	vpfe_dev->ccdc_irq1 = res1->start;
> 
> +	/* Get address base of CCDC */
> +	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res1) {
> +		v4l2_err(pdev->dev.driver,
> +			"Unable to get register address map\n");
> +		ret = -ENOENT;
> +		goto probe_disable_clock;
> +	}
> +
> +	ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1;
> +	if (!request_mem_region(res1->start, ccdc_cfg->ccdc_addr_size,
> +				pdev->dev.driver->name)) {
> +		v4l2_err(pdev->dev.driver,
> +			"Failed request_mem_region for ccdc base\n");
> +		ret = -ENXIO;
> +		goto probe_disable_clock;
> +	}
> +	ccdc_cfg->ccdc_addr = ioremap_nocache(res1->start,
> +					     ccdc_cfg->ccdc_addr_size);
> +	if (!ccdc_cfg->ccdc_addr) {
> +		v4l2_err(pdev->dev.driver, "Unable to ioremap ccdc
> addr\n");
> +		ret = -ENXIO;
> +		goto probe_out_release_mem1;
> +	}
> +
[Hiremath, Vaibhav] may be I am missing something, the above changes is already there except changes in standard table (vpfe_standard). I am referring to the Murali's Arago repo.

Thanks,
Vaibhav
>  	ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr,
> IRQF_DISABLED,
>  			  "vpfe_capture0", vpfe_dev);
> 
>  	if (0 != ret) {
>  		v4l2_err(pdev->dev.driver, "Unable to request
> interrupt\n");
> -		goto probe_disable_clock;
> +		goto probe_out_unmap1;
>  	}
> 
>  	/* Allocate memory for video device */
> @@ -2331,6 +2368,10 @@ probe_out_video_release:
>  		video_device_release(vpfe_dev->video_dev);
>  probe_out_release_irq:
>  	free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
> +probe_out_unmap1:
> +	iounmap(ccdc_cfg->ccdc_addr);
> +probe_out_release_mem1:
> +	release_mem_region(res1->start, res1->end - res1->start + 1);
>  probe_disable_clock:
>  	vpfe_disable_clock(vpfe_dev);
>  	mutex_unlock(&ccdc_lock);
> @@ -2346,6 +2387,7 @@ probe_free_dev_mem:
>  static int vpfe_remove(struct platform_device *pdev)
>  {
>  	struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
> +	struct resource *res;
> 
>  	v4l2_info(pdev->dev.driver, "vpfe_remove\n");
> 
> @@ -2353,6 +2395,11 @@ static int vpfe_remove(struct platform_device
> *pdev)
>  	kfree(vpfe_dev->sd);
>  	v4l2_device_unregister(&vpfe_dev->v4l2_dev);
>  	video_unregister_device(vpfe_dev->video_dev);
> +	mutex_lock(&ccdc_lock);
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	release_mem_region(res->start, res->end - res->start + 1);
> +	iounmap(ccdc_cfg->ccdc_addr);
> +	mutex_unlock(&ccdc_lock);
>  	vpfe_disable_clock(vpfe_dev);
>  	kfree(vpfe_dev);
>  	kfree(ccdc_cfg);
> --
> 1.6.0.4
> 
> 
> _______________________________________________
> Davinci-linux-open-source mailing list
> Davinci-linux-open-source@linux.davincidsp.com
> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-
> source
Santiago Nunez-Corrales Aug. 28, 2009, 4:33 p.m. UTC | #2
Hiremath, Vaibhav wrote:
> [Hiremath, Vaibhav] may be I am missing something, the above changes is already there except changes in standard table (vpfe_standard). I am referring to the Murali's Arago repo.
>
> Thanks,
> Vaibhav
>   

Yes, my mistake. Those changes were already there, just did a git pull. 
Changing accordingly.

>>  	ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr,
>> IRQF_DISABLED,
>>  			  "vpfe_capture0", vpfe_dev);
>>
>>  	if (0 != ret) {
>>  		v4l2_err(pdev->dev.driver, "Unable to request
>> interrupt\n");
>> -		goto probe_disable_clock;
>> +		goto probe_out_unmap1;
>>  	}
>>
>>  	/* Allocate memory for video device */
>> @@ -2331,6 +2368,10 @@ probe_out_video_release:
>>  		video_device_release(vpfe_dev->video_dev);
>>  probe_out_release_irq:
>>  	free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
>> +probe_out_unmap1:
>> +	iounmap(ccdc_cfg->ccdc_addr);
>> +probe_out_release_mem1:
>> +	release_mem_region(res1->start, res1->end - res1->start + 1);
>>  probe_disable_clock:
>>  	vpfe_disable_clock(vpfe_dev);
>>  	mutex_unlock(&ccdc_lock);
>> @@ -2346,6 +2387,7 @@ probe_free_dev_mem:
>>  static int vpfe_remove(struct platform_device *pdev)
>>  {
>>  	struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
>> +	struct resource *res;
>>
>>  	v4l2_info(pdev->dev.driver, "vpfe_remove\n");
>>
>> @@ -2353,6 +2395,11 @@ static int vpfe_remove(struct platform_device
>> *pdev)
>>  	kfree(vpfe_dev->sd);
>>  	v4l2_device_unregister(&vpfe_dev->v4l2_dev);
>>  	video_unregister_device(vpfe_dev->video_dev);
>> +	mutex_lock(&ccdc_lock);
>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +	release_mem_region(res->start, res->end - res->start + 1);
>> +	iounmap(ccdc_cfg->ccdc_addr);
>> +	mutex_unlock(&ccdc_lock);
>>  	vpfe_disable_clock(vpfe_dev);
>>  	kfree(vpfe_dev);
>>  	kfree(ccdc_cfg);
>> --
>> 1.6.0.4
>>
>>
>> _______________________________________________
>> Davinci-linux-open-source mailing list
>> Davinci-linux-open-source@linux.davincidsp.com
>> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-
>> source
>>
Murali Karicheri Sept. 2, 2009, 6:57 p.m. UTC | #3
Santiago,

You are undoing one of my patch. Please use the latest from Arago for creating these patches...

Murali Karicheri
Software Design Engineer
Texas Instruments Inc.
Germantown, MD 20874
new phone: 301-407-9583
Old Phone : 301-515-3736 (will be deprecated)
email: m-karicheri2@ti.com

>-----Original Message-----
>From: Hiremath, Vaibhav
>Sent: Friday, August 28, 2009 12:39 AM
>To: santiago.nunez@ridgerun.com; Karicheri, Muralidharan
>Cc: davinci-linux-open-source@linux.davincidsp.com;
>clark.becker@ridgerun.com; todd.fischer@ridgerun.com
>Subject: RE: [PATCH 3/6] Support for TVP7002 in VPFE
>
>
>> -----Original Message-----
>> From: davinci-linux-open-source-bounces@linux.davincidsp.com
>> [mailto:davinci-linux-open-source-bounces@linux.davincidsp.com] On
>> Behalf Of santiago.nunez@ridgerun.com
>> Sent: Friday, August 28, 2009 5:47 AM
>> To: Karicheri, Muralidharan
>> Cc: davinci-linux-open-source@linux.davincidsp.com;
>> clark.becker@ridgerun.com; Santiago Nunez-Corrales;
>> todd.fischer@ridgerun.com
>> Subject: [PATCH 3/6] Support for TVP7002 in VPFE
>>
>> From: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
>>
>> This patch adds support for TVP7002 in the DM365 VPFE inteface.
>>
>> Signed-off-by: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
>> ---
>>  drivers/media/video/davinci/vpfe_capture.c |   53
>> ++++++++++++++++++++++++++--
>>  1 files changed, 50 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/video/davinci/vpfe_capture.c
>> b/drivers/media/video/davinci/vpfe_capture.c
>> index 2a4a05a..98c288a 100644
>> --- a/drivers/media/video/davinci/vpfe_capture.c
>> +++ b/drivers/media/video/davinci/vpfe_capture.c
>> @@ -140,8 +140,17 @@ static DEFINE_MUTEX(ccdc_lock);
>>  static struct ccdc_config *ccdc_cfg;
>>
>>  const struct vpfe_standard vpfe_standards[] = {
>> -	{V4L2_STD_525_60, 720, 480, {11, 10}, 1},
>> -	{V4L2_STD_625_50, 720, 576, {54, 59}, 1},
>> +	{V4L2_STD_480P_60, 720, 480, {11, 10}, 0},
>> +	{V4L2_STD_480I_60, 720, 480, {11, 10}, 1},
>> +	{V4L2_STD_576P_50, 720, 576, {54, 59}, 0},
>> +	{V4L2_STD_576I_50, 720, 576, {54, 59}, 1},
>> +	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
>> +	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
>> +	{V4L2_STD_720P_60, 1280, 720, {12, 10}, 0},
>> +	{V4L2_STD_1080I_50, 1920, 1080, {12, 10}, 1},
>> +	{V4L2_STD_1080I_60, 1920, 1080, {12, 10}, 1},
>> +	{V4L2_STD_1080P_50, 1920, 1080, {12, 10}, 0},
>> +	{V4L2_STD_1080P_60, 1920, 1080, {12, 10}, 0},
>>  };
>>
>>  /* Used when raw Bayer image from ccdc is directly captured to
>> SDRAM */
>> @@ -249,6 +258,7 @@ int vpfe_register_ccdc_device(struct
>> ccdc_hw_device *dev)
>>  	BUG_ON(!dev->hw_ops.set_image_window);
>>  	BUG_ON(!dev->hw_ops.get_image_window);
>>  	BUG_ON(!dev->hw_ops.get_line_length);
>> +	BUG_ON(!dev->hw_ops.setfbaddr);
>>  	BUG_ON(!dev->hw_ops.getfid);
>>
>>  	mutex_lock(&ccdc_lock);
>> @@ -276,6 +286,8 @@ int vpfe_register_ccdc_device(struct
>> ccdc_hw_device *dev)
>>  	}
>>
>>  	ccdc_dev = dev;
>> +	dev->hw_ops.set_ccdc_base(ccdc_cfg->ccdc_addr,
>> +				  ccdc_cfg->ccdc_addr_size);
>>  unlock:
>>  	mutex_unlock(&ccdc_lock);
>>  	return ret;
>> @@ -2170,12 +2182,37 @@ static __init int vpfe_probe(struct
>> platform_device *pdev)
>>  	}
>>  	vpfe_dev->ccdc_irq1 = res1->start;
>>
>> +	/* Get address base of CCDC */
>> +	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +	if (!res1) {
>> +		v4l2_err(pdev->dev.driver,
>> +			"Unable to get register address map\n");
>> +		ret = -ENOENT;
>> +		goto probe_disable_clock;
>> +	}
>> +
>> +	ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1;
>> +	if (!request_mem_region(res1->start, ccdc_cfg->ccdc_addr_size,
>> +				pdev->dev.driver->name)) {
>> +		v4l2_err(pdev->dev.driver,
>> +			"Failed request_mem_region for ccdc base\n");
>> +		ret = -ENXIO;
>> +		goto probe_disable_clock;
>> +	}
>> +	ccdc_cfg->ccdc_addr = ioremap_nocache(res1->start,
>> +					     ccdc_cfg->ccdc_addr_size);
>> +	if (!ccdc_cfg->ccdc_addr) {
>> +		v4l2_err(pdev->dev.driver, "Unable to ioremap ccdc
>> addr\n");
>> +		ret = -ENXIO;
>> +		goto probe_out_release_mem1;
>> +	}
>> +
>[Hiremath, Vaibhav] may be I am missing something, the above changes is
>already there except changes in standard table (vpfe_standard). I am
>referring to the Murali's Arago repo.
>
>Thanks,
>Vaibhav
>>  	ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr,
>> IRQF_DISABLED,
>>  			  "vpfe_capture0", vpfe_dev);
>>
>>  	if (0 != ret) {
>>  		v4l2_err(pdev->dev.driver, "Unable to request
>> interrupt\n");
>> -		goto probe_disable_clock;
>> +		goto probe_out_unmap1;
>>  	}
>>
>>  	/* Allocate memory for video device */
>> @@ -2331,6 +2368,10 @@ probe_out_video_release:
>>  		video_device_release(vpfe_dev->video_dev);
>>  probe_out_release_irq:
>>  	free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
>> +probe_out_unmap1:
>> +	iounmap(ccdc_cfg->ccdc_addr);
>> +probe_out_release_mem1:
>> +	release_mem_region(res1->start, res1->end - res1->start + 1);
>>  probe_disable_clock:
>>  	vpfe_disable_clock(vpfe_dev);
>>  	mutex_unlock(&ccdc_lock);
>> @@ -2346,6 +2387,7 @@ probe_free_dev_mem:
>>  static int vpfe_remove(struct platform_device *pdev)
>>  {
>>  	struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
>> +	struct resource *res;
>>
>>  	v4l2_info(pdev->dev.driver, "vpfe_remove\n");
>>
>> @@ -2353,6 +2395,11 @@ static int vpfe_remove(struct platform_device
>> *pdev)
>>  	kfree(vpfe_dev->sd);
>>  	v4l2_device_unregister(&vpfe_dev->v4l2_dev);
>>  	video_unregister_device(vpfe_dev->video_dev);
>> +	mutex_lock(&ccdc_lock);
>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +	release_mem_region(res->start, res->end - res->start + 1);
>> +	iounmap(ccdc_cfg->ccdc_addr);
>> +	mutex_unlock(&ccdc_lock);
>>  	vpfe_disable_clock(vpfe_dev);
>>  	kfree(vpfe_dev);
>>  	kfree(ccdc_cfg);
>> --
>> 1.6.0.4
>>
>>
>> _______________________________________________
>> Davinci-linux-open-source mailing list
>> Davinci-linux-open-source@linux.davincidsp.com
>> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-
>> source
Santiago Nunez-Corrales Sept. 2, 2009, 7:31 p.m. UTC | #4
Arrgh, it is true, I thought I made sure to double check this but 
slipped in the patch. Correcting.

Regards,

Karicheri, Muralidharan wrote:
> Santiago,
>
> You are undoing one of my patch. Please use the latest from Arago for creating these patches...
>
> Murali Karicheri
> Software Design Engineer
> Texas Instruments Inc.
> Germantown, MD 20874
> new phone: 301-407-9583
> Old Phone : 301-515-3736 (will be deprecated)
> email: m-karicheri2@ti.com
>
>   
>> -----Original Message-----
>> From: Hiremath, Vaibhav
>> Sent: Friday, August 28, 2009 12:39 AM
>> To: santiago.nunez@ridgerun.com; Karicheri, Muralidharan
>> Cc: davinci-linux-open-source@linux.davincidsp.com;
>> clark.becker@ridgerun.com; todd.fischer@ridgerun.com
>> Subject: RE: [PATCH 3/6] Support for TVP7002 in VPFE
>>
>>
>>     
>>> -----Original Message-----
>>> From: davinci-linux-open-source-bounces@linux.davincidsp.com
>>> [mailto:davinci-linux-open-source-bounces@linux.davincidsp.com] On
>>> Behalf Of santiago.nunez@ridgerun.com
>>> Sent: Friday, August 28, 2009 5:47 AM
>>> To: Karicheri, Muralidharan
>>> Cc: davinci-linux-open-source@linux.davincidsp.com;
>>> clark.becker@ridgerun.com; Santiago Nunez-Corrales;
>>> todd.fischer@ridgerun.com
>>> Subject: [PATCH 3/6] Support for TVP7002 in VPFE
>>>
>>> From: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
>>>
>>> This patch adds support for TVP7002 in the DM365 VPFE inteface.
>>>
>>> Signed-off-by: Santiago Nunez-Corrales <santiago.nunez@ridgerun.com>
>>> ---
>>>  drivers/media/video/davinci/vpfe_capture.c |   53
>>> ++++++++++++++++++++++++++--
>>>  1 files changed, 50 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/media/video/davinci/vpfe_capture.c
>>> b/drivers/media/video/davinci/vpfe_capture.c
>>> index 2a4a05a..98c288a 100644
>>> --- a/drivers/media/video/davinci/vpfe_capture.c
>>> +++ b/drivers/media/video/davinci/vpfe_capture.c
>>> @@ -140,8 +140,17 @@ static DEFINE_MUTEX(ccdc_lock);
>>>  static struct ccdc_config *ccdc_cfg;
>>>
>>>  const struct vpfe_standard vpfe_standards[] = {
>>> -	{V4L2_STD_525_60, 720, 480, {11, 10}, 1},
>>> -	{V4L2_STD_625_50, 720, 576, {54, 59}, 1},
>>> +	{V4L2_STD_480P_60, 720, 480, {11, 10}, 0},
>>> +	{V4L2_STD_480I_60, 720, 480, {11, 10}, 1},
>>> +	{V4L2_STD_576P_50, 720, 576, {54, 59}, 0},
>>> +	{V4L2_STD_576I_50, 720, 576, {54, 59}, 1},
>>> +	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
>>> +	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
>>> +	{V4L2_STD_720P_60, 1280, 720, {12, 10}, 0},
>>> +	{V4L2_STD_1080I_50, 1920, 1080, {12, 10}, 1},
>>> +	{V4L2_STD_1080I_60, 1920, 1080, {12, 10}, 1},
>>> +	{V4L2_STD_1080P_50, 1920, 1080, {12, 10}, 0},
>>> +	{V4L2_STD_1080P_60, 1920, 1080, {12, 10}, 0},
>>>  };
>>>
>>>  /* Used when raw Bayer image from ccdc is directly captured to
>>> SDRAM */
>>> @@ -249,6 +258,7 @@ int vpfe_register_ccdc_device(struct
>>> ccdc_hw_device *dev)
>>>  	BUG_ON(!dev->hw_ops.set_image_window);
>>>  	BUG_ON(!dev->hw_ops.get_image_window);
>>>  	BUG_ON(!dev->hw_ops.get_line_length);
>>> +	BUG_ON(!dev->hw_ops.setfbaddr);
>>>  	BUG_ON(!dev->hw_ops.getfid);
>>>
>>>  	mutex_lock(&ccdc_lock);
>>> @@ -276,6 +286,8 @@ int vpfe_register_ccdc_device(struct
>>> ccdc_hw_device *dev)
>>>  	}
>>>
>>>  	ccdc_dev = dev;
>>> +	dev->hw_ops.set_ccdc_base(ccdc_cfg->ccdc_addr,
>>> +				  ccdc_cfg->ccdc_addr_size);
>>>  unlock:
>>>  	mutex_unlock(&ccdc_lock);
>>>  	return ret;
>>> @@ -2170,12 +2182,37 @@ static __init int vpfe_probe(struct
>>> platform_device *pdev)
>>>  	}
>>>  	vpfe_dev->ccdc_irq1 = res1->start;
>>>
>>> +	/* Get address base of CCDC */
>>> +	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +	if (!res1) {
>>> +		v4l2_err(pdev->dev.driver,
>>> +			"Unable to get register address map\n");
>>> +		ret = -ENOENT;
>>> +		goto probe_disable_clock;
>>> +	}
>>> +
>>> +	ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1;
>>> +	if (!request_mem_region(res1->start, ccdc_cfg->ccdc_addr_size,
>>> +				pdev->dev.driver->name)) {
>>> +		v4l2_err(pdev->dev.driver,
>>> +			"Failed request_mem_region for ccdc base\n");
>>> +		ret = -ENXIO;
>>> +		goto probe_disable_clock;
>>> +	}
>>> +	ccdc_cfg->ccdc_addr = ioremap_nocache(res1->start,
>>> +					     ccdc_cfg->ccdc_addr_size);
>>> +	if (!ccdc_cfg->ccdc_addr) {
>>> +		v4l2_err(pdev->dev.driver, "Unable to ioremap ccdc
>>> addr\n");
>>> +		ret = -ENXIO;
>>> +		goto probe_out_release_mem1;
>>> +	}
>>> +
>>>       
>> [Hiremath, Vaibhav] may be I am missing something, the above changes is
>> already there except changes in standard table (vpfe_standard). I am
>> referring to the Murali's Arago repo.
>>
>> Thanks,
>> Vaibhav
>>     
>>>  	ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr,
>>> IRQF_DISABLED,
>>>  			  "vpfe_capture0", vpfe_dev);
>>>
>>>  	if (0 != ret) {
>>>  		v4l2_err(pdev->dev.driver, "Unable to request
>>> interrupt\n");
>>> -		goto probe_disable_clock;
>>> +		goto probe_out_unmap1;
>>>  	}
>>>
>>>  	/* Allocate memory for video device */
>>> @@ -2331,6 +2368,10 @@ probe_out_video_release:
>>>  		video_device_release(vpfe_dev->video_dev);
>>>  probe_out_release_irq:
>>>  	free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
>>> +probe_out_unmap1:
>>> +	iounmap(ccdc_cfg->ccdc_addr);
>>> +probe_out_release_mem1:
>>> +	release_mem_region(res1->start, res1->end - res1->start + 1);
>>>  probe_disable_clock:
>>>  	vpfe_disable_clock(vpfe_dev);
>>>  	mutex_unlock(&ccdc_lock);
>>> @@ -2346,6 +2387,7 @@ probe_free_dev_mem:
>>>  static int vpfe_remove(struct platform_device *pdev)
>>>  {
>>>  	struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
>>> +	struct resource *res;
>>>
>>>  	v4l2_info(pdev->dev.driver, "vpfe_remove\n");
>>>
>>> @@ -2353,6 +2395,11 @@ static int vpfe_remove(struct platform_device
>>> *pdev)
>>>  	kfree(vpfe_dev->sd);
>>>  	v4l2_device_unregister(&vpfe_dev->v4l2_dev);
>>>  	video_unregister_device(vpfe_dev->video_dev);
>>> +	mutex_lock(&ccdc_lock);
>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +	release_mem_region(res->start, res->end - res->start + 1);
>>> +	iounmap(ccdc_cfg->ccdc_addr);
>>> +	mutex_unlock(&ccdc_lock);
>>>  	vpfe_disable_clock(vpfe_dev);
>>>  	kfree(vpfe_dev);
>>>  	kfree(ccdc_cfg);
>>> --
>>> 1.6.0.4
>>>
>>>
>>> _______________________________________________
>>> Davinci-linux-open-source mailing list
>>> Davinci-linux-open-source@linux.davincidsp.com
>>> http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-
>>> source
>>>
diff mbox

Patch

diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c
index 2a4a05a..98c288a 100644
--- a/drivers/media/video/davinci/vpfe_capture.c
+++ b/drivers/media/video/davinci/vpfe_capture.c
@@ -140,8 +140,17 @@  static DEFINE_MUTEX(ccdc_lock);
 static struct ccdc_config *ccdc_cfg;
 
 const struct vpfe_standard vpfe_standards[] = {
-	{V4L2_STD_525_60, 720, 480, {11, 10}, 1},
-	{V4L2_STD_625_50, 720, 576, {54, 59}, 1},
+	{V4L2_STD_480P_60, 720, 480, {11, 10}, 0},
+	{V4L2_STD_480I_60, 720, 480, {11, 10}, 1},
+	{V4L2_STD_576P_50, 720, 576, {54, 59}, 0},
+	{V4L2_STD_576I_50, 720, 576, {54, 59}, 1},
+	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
+	{V4L2_STD_720P_50, 1280, 720, {12, 10}, 0},
+	{V4L2_STD_720P_60, 1280, 720, {12, 10}, 0},
+	{V4L2_STD_1080I_50, 1920, 1080, {12, 10}, 1},
+	{V4L2_STD_1080I_60, 1920, 1080, {12, 10}, 1},
+	{V4L2_STD_1080P_50, 1920, 1080, {12, 10}, 0},
+	{V4L2_STD_1080P_60, 1920, 1080, {12, 10}, 0},
 };
 
 /* Used when raw Bayer image from ccdc is directly captured to SDRAM */
@@ -249,6 +258,7 @@  int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
 	BUG_ON(!dev->hw_ops.set_image_window);
 	BUG_ON(!dev->hw_ops.get_image_window);
 	BUG_ON(!dev->hw_ops.get_line_length);
+	BUG_ON(!dev->hw_ops.setfbaddr);
 	BUG_ON(!dev->hw_ops.getfid);
 
 	mutex_lock(&ccdc_lock);
@@ -276,6 +286,8 @@  int vpfe_register_ccdc_device(struct ccdc_hw_device *dev)
 	}
 
 	ccdc_dev = dev;
+	dev->hw_ops.set_ccdc_base(ccdc_cfg->ccdc_addr,
+				  ccdc_cfg->ccdc_addr_size);
 unlock:
 	mutex_unlock(&ccdc_lock);
 	return ret;
@@ -2170,12 +2182,37 @@  static __init int vpfe_probe(struct platform_device *pdev)
 	}
 	vpfe_dev->ccdc_irq1 = res1->start;
 
+	/* Get address base of CCDC */
+	res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res1) {
+		v4l2_err(pdev->dev.driver,
+			"Unable to get register address map\n");
+		ret = -ENOENT;
+		goto probe_disable_clock;
+	}
+
+	ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1;
+	if (!request_mem_region(res1->start, ccdc_cfg->ccdc_addr_size,
+				pdev->dev.driver->name)) {
+		v4l2_err(pdev->dev.driver,
+			"Failed request_mem_region for ccdc base\n");
+		ret = -ENXIO;
+		goto probe_disable_clock;
+	}
+	ccdc_cfg->ccdc_addr = ioremap_nocache(res1->start,
+					     ccdc_cfg->ccdc_addr_size);
+	if (!ccdc_cfg->ccdc_addr) {
+		v4l2_err(pdev->dev.driver, "Unable to ioremap ccdc addr\n");
+		ret = -ENXIO;
+		goto probe_out_release_mem1;
+	}
+
 	ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, IRQF_DISABLED,
 			  "vpfe_capture0", vpfe_dev);
 
 	if (0 != ret) {
 		v4l2_err(pdev->dev.driver, "Unable to request interrupt\n");
-		goto probe_disable_clock;
+		goto probe_out_unmap1;
 	}
 
 	/* Allocate memory for video device */
@@ -2331,6 +2368,10 @@  probe_out_video_release:
 		video_device_release(vpfe_dev->video_dev);
 probe_out_release_irq:
 	free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
+probe_out_unmap1:
+	iounmap(ccdc_cfg->ccdc_addr);
+probe_out_release_mem1:
+	release_mem_region(res1->start, res1->end - res1->start + 1);
 probe_disable_clock:
 	vpfe_disable_clock(vpfe_dev);
 	mutex_unlock(&ccdc_lock);
@@ -2346,6 +2387,7 @@  probe_free_dev_mem:
 static int vpfe_remove(struct platform_device *pdev)
 {
 	struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev);
+	struct resource *res;
 
 	v4l2_info(pdev->dev.driver, "vpfe_remove\n");
 
@@ -2353,6 +2395,11 @@  static int vpfe_remove(struct platform_device *pdev)
 	kfree(vpfe_dev->sd);
 	v4l2_device_unregister(&vpfe_dev->v4l2_dev);
 	video_unregister_device(vpfe_dev->video_dev);
+	mutex_lock(&ccdc_lock);
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	release_mem_region(res->start, res->end - res->start + 1);
+	iounmap(ccdc_cfg->ccdc_addr);
+	mutex_unlock(&ccdc_lock);
 	vpfe_disable_clock(vpfe_dev);
 	kfree(vpfe_dev);
 	kfree(ccdc_cfg);