From: Kevin Hilman <khilman@baylibre.com> Date: 2017-06-09 16:10:33
The davinci VPIF is a single hardware block, but the existing driver
is broken up into a common library (vpif.c), output (vpif_display.c) and
intput (vpif_capture.c).
When migrating to DT, to better model the hardware, and because
registers, interrupts, etc. are all common,it was decided to
have a single VPIF hardware node[1].
Because davinci uses legacy, non-DT boot on several SoCs still, the
platform_drivers need to remain. But they are also needed in DT boot.
Since there are no DT nodes for the display/capture parts in DT
boot (there is a single node for the parent/common device) we need to
create platform_devices somewhere to instansiate the platform_drivers.
When VPIF display/capture are needed for a DT boot, the VPIF node
will have endpoints defined for its subdevs. Therefore, vpif_probe()
checks for the presence of endpoints, and if detected manually creates
the platform_devices for the display and capture platform_drivers.
[1] Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
Changes since v1:
- added proper error checking to kzalloc calls
- rebased onto media/master
drivers/media/platform/davinci/vpif.c | 57 ++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
@@ -435,6 +438,58 @@ static int vpif_probe(struct platform_device *pdev)spin_lock_init(&vpif_lock);dev_info(&pdev->dev,"vpif probe success\n");++/*+*IfVPIFNodehasendpoints,assume"new"DTsupport,+*wherecaptureanddisplaydriversdon'thaveDTnodes+*sotheirdevicesneedtoberegisteredmanuallyhere+*fortheirlegacyplatform_driverstowork.+*/+endpoint=of_graph_get_next_endpoint(pdev->dev.of_node,+endpoint);+if(!endpoint)+return0;++/*+*ForDTplatforms,manuallycreateplatform_devicesfor+*capture/displaydrivers.+*/+res_irq=platform_get_resource(pdev,IORESOURCE_IRQ,0);+if(!res_irq){+dev_warn(&pdev->dev,"Missing IRQ resource.\n");+return-EINVAL;+}++pdev_capture=devm_kzalloc(&pdev->dev,sizeof(*pdev_capture),+GFP_KERNEL);+if(pdev_capture){+pdev_capture->name="vpif_capture";+pdev_capture->id=-1;+pdev_capture->resource=res_irq;+pdev_capture->num_resources=1;+pdev_capture->dev.dma_mask=pdev->dev.dma_mask;+pdev_capture->dev.coherent_dma_mask=pdev->dev.coherent_dma_mask;+pdev_capture->dev.parent=&pdev->dev;+platform_device_register(pdev_capture);+}else{+dev_warn(&pdev->dev,"Unable to allocate memory for pdev_capture.\n");+}++pdev_display=devm_kzalloc(&pdev->dev,sizeof(*pdev_display),+GFP_KERNEL);+if(pdev_display){+pdev_display->name="vpif_display";+pdev_display->id=-1;+pdev_display->resource=res_irq;+pdev_display->num_resources=1;+pdev_display->dev.dma_mask=pdev->dev.dma_mask;+pdev_display->dev.coherent_dma_mask=pdev->dev.coherent_dma_mask;+pdev_display->dev.parent=&pdev->dev;+platform_device_register(pdev_display);+}else{+dev_warn(&pdev->dev,"Unable to allocate memory for pdev_display.\n");+}+return0;}
From: Kevin Hilman <khilman@baylibre.com> Date: 2017-06-15 20:12:38
Hi Hans, Mauro,
On Fri, Jun 9, 2017 at 9:10 AM, Kevin Hilman [off-list ref] wrote:
The davinci VPIF is a single hardware block, but the existing driver
is broken up into a common library (vpif.c), output (vpif_display.c) and
intput (vpif_capture.c).
When migrating to DT, to better model the hardware, and because
registers, interrupts, etc. are all common,it was decided to
have a single VPIF hardware node[1].
Because davinci uses legacy, non-DT boot on several SoCs still, the
platform_drivers need to remain. But they are also needed in DT boot.
Since there are no DT nodes for the display/capture parts in DT
boot (there is a single node for the parent/common device) we need to
create platform_devices somewhere to instansiate the platform_drivers.
When VPIF display/capture are needed for a DT boot, the VPIF node
will have endpoints defined for its subdevs. Therefore, vpif_probe()
checks for the presence of endpoints, and if detected manually creates
the platform_devices for the display and capture platform_drivers.
[1] Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Can this one make it for v4.13 along with the rest of the series that
it was initially sent with?
This one needed a respin for some error checking, but is otherwise
unchanged, and has been tested on top of media/next.
Thanks,
Kevin
From: Sakari Ailus <sakari.ailus@iki.fi> Date: 2017-06-16 08:43:52
Hi Kevin,
On Fri, Jun 09, 2017 at 09:10:26AM -0700, Kevin Hilman wrote:
quoted hunk
The davinci VPIF is a single hardware block, but the existing driver
is broken up into a common library (vpif.c), output (vpif_display.c) and
intput (vpif_capture.c).
When migrating to DT, to better model the hardware, and because
registers, interrupts, etc. are all common,it was decided to
have a single VPIF hardware node[1].
Because davinci uses legacy, non-DT boot on several SoCs still, the
platform_drivers need to remain. But they are also needed in DT boot.
Since there are no DT nodes for the display/capture parts in DT
boot (there is a single node for the parent/common device) we need to
create platform_devices somewhere to instansiate the platform_drivers.
When VPIF display/capture are needed for a DT boot, the VPIF node
will have endpoints defined for its subdevs. Therefore, vpif_probe()
checks for the presence of endpoints, and if detected manually creates
the platform_devices for the display and capture platform_drivers.
[1] Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
---
Changes since v1:
- added proper error checking to kzalloc calls
- rebased onto media/master
drivers/media/platform/davinci/vpif.c | 57 ++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
The davinci VPIF is a single hardware block, but the existing driver
is broken up into a common library (vpif.c), output (vpif_display.c) and
intput (vpif_capture.c).
When migrating to DT, to better model the hardware, and because
registers, interrupts, etc. are all common,it was decided to
have a single VPIF hardware node[1].
Because davinci uses legacy, non-DT boot on several SoCs still, the
platform_drivers need to remain. But they are also needed in DT boot.
Since there are no DT nodes for the display/capture parts in DT
boot (there is a single node for the parent/common device) we need to
create platform_devices somewhere to instansiate the platform_drivers.
When VPIF display/capture are needed for a DT boot, the VPIF node
will have endpoints defined for its subdevs. Therefore, vpif_probe()
checks for the presence of endpoints, and if detected manually creates
the platform_devices for the display and capture platform_drivers.
[1] Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
On Fri, Jun 9, 2017 at 5:10 PM, Kevin Hilman [off-list ref] wrote:
The davinci VPIF is a single hardware block, but the existing driver
is broken up into a common library (vpif.c), output (vpif_display.c) and
intput (vpif_capture.c).
When migrating to DT, to better model the hardware, and because
registers, interrupts, etc. are all common,it was decided to
have a single VPIF hardware node[1].
Because davinci uses legacy, non-DT boot on several SoCs still, the
platform_drivers need to remain. But they are also needed in DT boot.
Since there are no DT nodes for the display/capture parts in DT
boot (there is a single node for the parent/common device) we need to
create platform_devices somewhere to instansiate the platform_drivers.
When VPIF display/capture are needed for a DT boot, the VPIF node
will have endpoints defined for its subdevs. Therefore, vpif_probe()
checks for the presence of endpoints, and if detected manually creates
the platform_devices for the display and capture platform_drivers.
[1] Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signed-off-by: Kevin Hilman <khilman@baylibre.com>