davinci: VPIF: add DT support
v4 cover davinci: VPIF: add DT support
Add DT support, including getting subdevs from DT ports/endpoints.
Tested video capture to memory on da850-lcdk board using composite input.
Changes since v3:
- move to a single VPIF node, DT binding updated accordingly
- misc fixes/updates based on reviews from Sakari
Changes since v2:
- DT binding doc: fix example to use correct compatible
Changes since v1:
- more specific compatible strings, based on SoC: ti,da850-vpif*
- fix locking bug when unlocking over subdev s_stream
Kevin Hilman (4):
[media] davinci: vpif_capture: don't lock over s_stream [media] davinci: VPIF: add basic support for DT init [media] davinci: vpif_capture: get subdevs from DT [media] dt-bindings: add TI VPIF documentation
.../devicetree/bindings/media/ti,da850-vpif.txt | 67 ++++++++++ drivers/media/platform/davinci/vpif.c | 48 ++++++- drivers/media/platform/davinci/vpif_capture.c | 147 ++++++++++++++++++++- drivers/media/platform/davinci/vpif_display.c | 6 + include/media/davinci/vpif_types.h | 9 +- 5 files changed, 270 insertions(+), 7 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Signature · 1 line
2.9.3
PATCH v4 1/4 davinci: vpif_capture: don't lock over s_stream
Video capture subdevs may be over I2C and may sleep during xfer, so we cannot do IRQ-disabled locking when calling the subdev.
--- drivers/media/platform/davinci/vpif_capture.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/davinci/vpif_capture.c +3 -0
@@ -193,7 +193,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) } } +spin_unlock_irqrestore (&common->irqlock, flags); ret =v4l2_subdev_call (ch->sd, video, s_stream,1 ); +spin_lock_irqsave (&common->irqlock, flags); +if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV ) {vpif_dbg (1 , debug,"stream on failed in subdev\n" ); goto err;
Signature · 1 line
2.9.3
PATCH v4 1/4 davinci: vpif_capture: don't lock over s_stream
Hi Kevin,
Thank you for the patch.
Quoted 14 lines · On Tuesday 29 Nov 2016 15:57:09 Kevin Hilman wrote:
Video capture subdevs may be over I2C and may sleep during xfer, so we cannot do IRQ-disabled locking when calling the subdev.
Signed-off-by Kevin Hilman <[email protected]>--- drivers/media/platform/davinci/vpif_capture.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/media/platform/davinci/vpif_capture.cindex5104cc0ee40e..9f8f41c0f251100644
drivers/media/platform/davinci/vpif_capture.c static int vpif_start_streaming(struct vb2_queue *vq, · line 198
Quoted 6 lines
drivers/media/platform/davinci/vpif_capture.c +2
-0@@ -193,7 +193,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) } } +spin_unlock_irqrestore (&common->irqlock, flags); ret =v4l2_subdev_call (ch->sd, video, s_stream,1 ); +spin_lock_irqsave (&common->irqlock, flags);
I always get anxious when I see a spinlock being released randomly with an operation in the middle of a protected section. Looking at the code it looks like the spinlock is abused here. irqlock should only protect the dma_queue and should thus only be taken around the following code:
spin_lock_irqsave(&common->irqlock, flags);
/* Get the next frame from the buffer queue */ common->cur_frm = common->next_frm = list_entry(common->dma_queue.next,
struct vpif_cap_buffer, list);
/* Remove buffer from the buffer queue */list_del(&common->cur_frm->list);spin_unlock_irqrestore(&common->irqlock, flags);
The code that is currently protected by the lock in the start and stop streaming functions should be protected by a mutex instead.
Quoted 4 lines
drivers/media/platform/davinci/vpif_capture.c +1
-0+if (ret && ret != -ENOIOCTLCMD && ret != -ENODEV ) {vpif_dbg (1 , debug,"stream on failed in subdev\n" ); goto err;
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v4 1/4 davinci: vpif_capture: don't lock over s_stream
Quoted 31 lines · Laurent Pinchart
Hi Kevin,
Thank you for the patch.
Quoted 14 lines · On Tuesday 29 Nov 2016 15:57:09 Kevin Hilman wrote:
Video capture subdevs may be over I2C and may sleep during xfer, so we cannot do IRQ-disabled locking when calling the subdev.
Signed-off-by Kevin Hilman <[email protected]>--- drivers/media/platform/davinci/vpif_capture.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/media/platform/davinci/vpif_capture.cindex5104cc0ee40e..9f8f41c0f251100644drivers/media/platform/davinci/vpif_capture.c static int vpif_start_streaming(struct vb2_queue *vq, · line 198
Quoted 6 lines
drivers/media/platform/davinci/vpif_capture.c +2
-0@@ -193,7 +193,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) } } +spin_unlock_irqrestore (&common->irqlock, flags); ret =v4l2_subdev_call (ch->sd, video, s_stream,1 ); +spin_lock_irqsave (&common->irqlock, flags);I always get anxious when I see a spinlock being released randomly with an operation in the middle of a protected section. Looking at the code it looks like the spinlock is abused here. irqlock should only protect the
dma_queueand should thus only be taken around the following code:
Quoted 7 lines
spin_lock_irqsave(&common->irqlock, flags);
/* Get the next frame from the buffer queue */common->cur_frm=common->next_frm= list_entry(common->dma_queue.next,struct vpif_cap_buffer, list);/* Remove buffer from the buffer queue */
list_del(&common->cur_frm->list);spin_unlock_irqrestore(&common->irqlock, flags);
Yes, that looks correct. Will update.
Quoted 2 lines
The code that is currently protected by the lock in the start and stop streaming functions should be protected by a mutex instead.
I tried taking the mutex here, but lockdep pointed out a deadlock. I may not be fully understanding the V4L2 internals here, but it seems that the ioctl is already taking a mutex, so taking it again in start/stop streaming is a deadlock. Unless you think the locking should be nested here, it seems to me that the mutex isn't needed.
Kevin
PATCH v4 1/4 davinci: vpif_capture: don't lock over s_stream
Hi Kevin,
Quoted 40 lines · On Tuesday 06 Dec 2016 08:49:38 Kevin Hilman wrote:
Quoted 28 lines · Laurent Pinchart
Quoted 14 lines · On Tuesday 29 Nov 2016 15:57:09 Kevin Hilman wrote:
Video capture subdevs may be over I2C and may sleep during xfer, so we cannot do IRQ-disabled locking when calling the subdev.
Signed-off-by Kevin Hilman <[email protected]>--- drivers/media/platform/davinci/vpif_capture.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/media/platform/davinci/vpif_capture.cindex5104cc0ee40e..9f8f41c0f251100644drivers/media/platform/davinci/vpif_capture.c static int vpif_start_streaming(struct vb2_queue · line 199
Quoted 7 lines
drivers/media/platform/davinci/vpif_capture.c +2
-0@@ -193,7 +193,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) } } +spin_unlock_irqrestore (&common->irqlock, flags); ret =v4l2_subdev_call (ch->sd, video, s_stream,1 ); +spin_lock_irqsave (&common->irqlock, flags);I always get anxious when I see a spinlock being released randomly with an operation in the middle of a protected section. Looking at the code it looks like the spinlock is abused here. irqlock should only protect the
dma_queueand should thus only be taken around the following code:Quoted 8 lines
spin_lock_irqsave(&common->irqlock, flags);
/* Get the next frame from the buffer queue */common->cur_frm=common->next_frm= list_entry(common->dma_queue.next,struct vpif_cap_buffer, list);/* Remove buffer from the buffer queue */
list_del(&common->cur_frm->list);spin_unlock_irqrestore(&common->irqlock, flags);Yes, that looks correct. Will update.
Quoted 8 lines
Quoted 2 lines
The code that is currently protected by the lock in the start and stop streaming functions should be protected by a mutex instead.
I tried taking the mutex here, but lockdep pointed out a deadlock. I may not be fully understanding the V4L2 internals here, but it seems that the ioctl is already taking a mutex, so taking it again in start/stop streaming is a deadlock. Unless you think the locking should be nested here, it seems to me that the mutex isn't needed.
The V4L2 core can lock all ioctls using struct video_device::lock. For buffer- related ioctls, it can optionally use a separate lock from struct vb2_queue::lock. See v4l2_ioctl_get_lock() in drivers/media/v4l2-core/v4l2- ioctl.c.
The vpif-capture driver sets both the video_device and vb2_queue locks to the same lock (which would have the same effect as leaving the vb2_queue lock NULL). All ioctls are thus serialized. You would only need to handle locking in start_streaming and stop_streaming manually if you didn't rely on the core serializing the ioctls.
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v4 1/4 davinci: vpif_capture: don't lock over s_stream
Quoted 57 lines · Laurent Pinchart
Hi Kevin,
Quoted 40 lines · On Tuesday 06 Dec 2016 08:49:38 Kevin Hilman wrote:
Quoted 28 lines · Laurent Pinchart
Quoted 14 lines · On Tuesday 29 Nov 2016 15:57:09 Kevin Hilman wrote:
Video capture subdevs may be over I2C and may sleep during xfer, so we cannot do IRQ-disabled locking when calling the subdev.
Signed-off-by Kevin Hilman <[email protected]>--- drivers/media/platform/davinci/vpif_capture.c | 3 +++ 1 file changed, 3 insertions(+)(quoted diff) +0
-0
b/drivers/media/platform/davinci/vpif_capture.cindex5104cc0ee40e..9f8f41c0f251100644drivers/media/platform/davinci/vpif_capture.c static int vpif_start_streaming(struct vb2_queue · line 199
Quoted 7 lines
drivers/media/platform/davinci/vpif_capture.c +2
-0@@ -193,7 +193,10 @@ static int vpif_start_streaming(struct vb2_queue *vq, unsigned int count) } } +spin_unlock_irqrestore (&common->irqlock, flags); ret =v4l2_subdev_call (ch->sd, video, s_stream,1 ); +spin_lock_irqsave (&common->irqlock, flags);I always get anxious when I see a spinlock being released randomly with an operation in the middle of a protected section. Looking at the code it looks like the spinlock is abused here. irqlock should only protect the
dma_queueand should thus only be taken around the following code:Quoted 8 lines
spin_lock_irqsave(&common->irqlock, flags);
/* Get the next frame from the buffer queue */common->cur_frm=common->next_frm= list_entry(common->dma_queue.next,struct vpif_cap_buffer, list);/* Remove buffer from the buffer queue */
list_del(&common->cur_frm->list);spin_unlock_irqrestore(&common->irqlock, flags);Yes, that looks correct. Will update.
Quoted 8 lines
Quoted 2 lines
The code that is currently protected by the lock in the start and stop streaming functions should be protected by a mutex instead.
I tried taking the mutex here, but lockdep pointed out a deadlock. I may not be fully understanding the V4L2 internals here, but it seems that the ioctl is already taking a mutex, so taking it again in start/stop streaming is a deadlock. Unless you think the locking should be nested here, it seems to me that the mutex isn't needed.
The V4L2 core can lock all ioctls using struct
video_device::lock. For buffer- related ioctls, it can optionally use a separate lock from structvb2_queue::lock. Seev4l2_ioctl_get_lock()indrivers/media/v4l2-core/v4l2-ioctl.c.
Quoted 5 lines
The vpif-capture driver sets both the
video_deviceandvb2_queuelocks to the same lock (which would have the same effect as leaving thevb2_queuelock NULL). All ioctls are thus serialized. You would only need to handle locking instart_streamingandstop_streamingmanually if you didn't rely on the core serializing the ioctls.
OK, thanks for clarifying how that works.
Kevin
PATCH v4 2/4 davinci: VPIF: add basic support for DT init
In reply to Kevin HilmanAdd basic support for initialization via DT.
Because existing capture and display devices are implemented as separate platform_devices, and in order to preserve that legacy support, during DT boot, manually create capture and display platform devices to initialize capture and display support.
--- drivers/media/platform/davinci/vpif.c | 48 ++++++++++++++++++++++++++- drivers/media/platform/davinci/vpif_capture.c | 6 ++++ drivers/media/platform/davinci/vpif_display.c | 6 ++++ 3 files changed, 59 insertions(+), 1 deletion(-)
drivers/media/platform/davinci/vpif.c +47 -1
@@ -420,7 +420,8 @@ EXPORT_SYMBOL(vpif_channel_getfid);static int vpif_probe (struct platform_device *pdev) { -static struct resource *res; +static struct resource *res, *res_irq; +struct platform_device *pdev_capture, *pdev_display; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); vpif_base =devm_ioremap_resource (&pdev->dev, res);
@@ -432,6 +433,42 @@ static int vpif_probe(struct platform_device *pdev)spin_lock_init (&vpif_lock);dev_info (&pdev->dev,"vpif probe success\n" ); + +if (!pdev->dev.of_node) +return 0 ; + +/* +* For DT platforms, manually create platform_devices for +* capture/display drivers. +*/ + 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 ); + 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); + + pdev_display =devm_kzalloc (&pdev->dev,sizeof (*pdev_display), +GFP_KERNEL ); + 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); +return 0 ; }
@@ -464,8 +501,17 @@ static const struct dev_pm_ops vpif_pm = {#define vpif_pm_ops NULL#endif +#if IS_ENABLED (CONFIG_OF ) +static const struct of_device_id vpif_of_match[] = { + { .compatible ="ti,da850-vpif" , }, + {/* sentinel */ }, +}; +MODULE_DEVICE_TABLE (of, vpif_of_match); +#endif +static struct platform_driver vpif_driver = { .driver = { + .of_match_table =of_match_ptr (vpif_of_match), .name ="vpif" , .pm = vpif_pm_ops, },
drivers/media/platform/davinci/vpif_capture.c +6 -0
@@ -45,6 +45,7 @@ module_param(debug, int, 0644);MODULE_PARM_DESC (debug,"Debug level 0-1" );#define VPIF_DRIVER_NAME "vpif_capture" +MODULE_ALIAS ("platform:" VPIF_DRIVER_NAME );/* global variables */ static struct vpif_device vpif_obj = { {NULL } };
@@ -1438,6 +1439,11 @@ static __init int vpif_probe(struct platform_device *pdev)int res_idx =0 ;int i, err; +if (!pdev->dev.platform_data) { +dev_warn (&pdev->dev,"Missing platform data. Giving up.\n" ); +return -EINVAL ; + } + vpif_dev = &pdev->dev; err =initialize_vpif ();
drivers/media/platform/davinci/vpif_display.c +6 -0
@@ -42,6 +42,7 @@ module_param(debug, int, 0644);MODULE_PARM_DESC (debug,"Debug level 0-1" );#define VPIF_DRIVER_NAME "vpif_display" +MODULE_ALIAS ("platform:" VPIF_DRIVER_NAME );/* Is set to 1 in case of SDTV formats, 2 in case of HDTV formats. */ static int ycmux_mode;
@@ -1249,6 +1250,11 @@ static __init int vpif_probe(struct platform_device *pdev)int res_idx =0 ;int i, err; +if (!pdev->dev.platform_data) { +dev_warn (&pdev->dev,"Missing platform data. Giving up.\n" ); +return -EINVAL ; + } + vpif_dev = &pdev->dev; err =initialize_vpif ();
Signature · 1 line
2.9.3
PATCH v4 3/4 davinci: vpif_capture: get subdevs from DT
In reply to Kevin HilmanAllow getting of subdevs from DT ports and endpoints.
The _get_pdata() function was larely inspired by (i.e. stolen from) am437x-vpfe.c
--- drivers/media/platform/davinci/vpif_capture.c | 138 +++++++++++++++++++++++++- include/media/davinci/vpif_types.h | 9 +- 2 files changed, 141 insertions(+), 6 deletions(-)
drivers/media/platform/davinci/vpif_capture.c +136 -2
@@ -26,6 +26,8 @@#include <linux/slab.h> #include <media/v4l2-ioctl.h> +#include <media/v4l2-of.h> +#include <media/i2c/tvp514x.h> #include "vpif.h" #include "vpif_capture.h"
@@ -651,6 +653,10 @@ static int vpif_input_to_subdev(vpif_dbg (2 , debug,"vpif_input_to_subdev\n" ); +if (!chan_cfg) +return -1 ; +if (input_index >= chan_cfg->input_count) +return -1 ; subdev_name = chan_cfg->inputs[input_index].subdev_name;if (subdev_name ==NULL )return -1 ;
@@ -658,7 +664,7 @@ static int vpif_input_to_subdev(/* loop through the sub device list to get the sub device info */ for (i =0 ; i < vpif_cfg->subdev_count; i++) { subdev_info = &vpif_cfg->subdev_info[i]; -if (!strcmp (subdev_info->name, subdev_name)) +if (subdev_info && !strcmp (subdev_info->name, subdev_name))return i; }return -1 ;
@@ -1328,6 +1334,21 @@ static int vpif_async_bound(struct v4l2_async_notifier *notifier, {int i; +for (i =0 ; i < vpif_obj.config->asd_sizes[0 ]; i++) { +struct v4l2_async_subdev *_asd = vpif_obj.config->asd[i]; +const struct device_node *node = _asd->match.of.node; + +if (node == subdev->of_node) { + vpif_obj.sd[i] = subdev; + vpif_obj.config->chan_config->inputs[i].subdev_name = + (char *)subdev->of_node->full_name; +vpif_dbg (2 , debug, +"%s: setting input %d subdev_name = %s\n" , + __func__, i, subdev->of_node->full_name); +return 0 ; + } + } +for (i =0 ; i < vpif_obj.config->subdev_count; i++)if (!strcmp (vpif_obj.config->subdev_info[i].name, subdev->name)) {
@@ -1423,6 +1444,118 @@ static int vpif_async_complete(struct v4l2_async_notifier *notifier)return vpif_probe_complete (); } +static struct vpif_capture_config * +vpif_capture_get_pdata (struct platform_device *pdev) +{ +struct device_node *endpoint =NULL ; +struct v4l2_of_endpoint bus_cfg; +struct vpif_capture_config *pdata; +struct vpif_subdev_info *sdinfo; +struct vpif_capture_chan_config *chan; +unsigned int i; + +dev_dbg (&pdev->dev,"vpif_get_pdata\n" ); + +/* +* DT boot: OF node from parent device contains +* video ports & endpoints data. +*/ +if (pdev->dev.parent && pdev->dev.parent->of_node) + pdev->dev.of_node = pdev->dev.parent->of_node; +if (!IS_ENABLED (CONFIG_OF ) || !pdev->dev.of_node) +return pdev->dev.platform_data; + + pdata =devm_kzalloc (&pdev->dev,sizeof (*pdata),GFP_KERNEL ); +if (!pdata) +return NULL ; + pdata->subdev_info = +devm_kzalloc (&pdev->dev,sizeof (*pdata->subdev_info) * +VPIF_CAPTURE_NUM_CHANNELS ,GFP_KERNEL ); + +if (!pdata->subdev_info) +return NULL ; + +for (i =0 ; i <VPIF_CAPTURE_NUM_CHANNELS ; i++) { +struct device_node *rem; +unsigned int flags; +int err; + + endpoint =of_graph_get_next_endpoint (pdev->dev.of_node, + endpoint); +if (!endpoint) +break ; + + sdinfo = &pdata->subdev_info[i]; + chan = &pdata->chan_config[i]; + chan->inputs =devm_kzalloc (&pdev->dev, +sizeof (*chan->inputs) * +VPIF_CAPTURE_NUM_CHANNELS , +GFP_KERNEL ); + + chan->input_count++; + chan->inputs[i].input.type =V4L2_INPUT_TYPE_CAMERA ; + chan->inputs[i].input.std =V4L2_STD_ALL ; + chan->inputs[i].input.capabilities =V4L2_IN_CAP_STD ; + +/* +* FIXME: need a new property for input/output routing? +* All known boards are using ch0:composite ch1: s-video. +*/ +if (i ==0 ) + chan->inputs[i].input_route =INPUT_CVBS_VI2B ; +else + chan->inputs[i].input_route =INPUT_SVIDEO_VI2C_VI1C ; + chan->inputs[i].output_route =OUTPUT_10BIT_422_EMBEDDED_SYNC ; + + err =v4l2_of_parse_endpoint (endpoint, &bus_cfg); +if (err) { +dev_err (&pdev->dev,"Could not parse the endpoint\n" ); + goto done; + } +dev_dbg (&pdev->dev,"Endpoint %s, bus_width = %d\n" , + endpoint->full_name, bus_cfg.bus.parallel.bus_width); + flags = bus_cfg.bus.parallel.flags; + +if (flags &V4L2_MBUS_HSYNC_ACTIVE_HIGH ) + chan->vpif_if.hd_pol =1 ; + +if (flags &V4L2_MBUS_VSYNC_ACTIVE_HIGH ) + chan->vpif_if.vd_pol =1 ; + + chan->vpif_if.if_type =VPIF_IF_BT656 ; + rem =of_graph_get_remote_port_parent (endpoint); +if (!rem) { +dev_dbg (&pdev->dev,"Remote device at %s not found\n" , + endpoint->full_name); + goto done; + } + +dev_dbg (&pdev->dev,"Remote device %s, %s found\n" , + rem->name, rem->full_name); + sdinfo->name = rem->full_name; + + pdata->asd[i] =devm_kzalloc (&pdev->dev, +sizeof (struct v4l2_async_subdev ), +GFP_KERNEL ); +if (!pdata->asd[i]) { +of_node_put (rem); + pdata =NULL ; + goto done; + } + + pdata->asd[i]->match_type =V4L2_ASYNC_MATCH_OF ; + pdata->asd[i]->match.of.node = rem; +of_node_put (rem); + } + +done: + pdata->asd_sizes[0 ] = i; + pdata->subdev_count = i; + pdata->card_name ="DA850/OMAP-L138 Video Capture" ; + +return pdata; +} +/** * vpif_probe : This function probes the vpif capture driver * @pdev: platform device pointer
@@ -1439,6 +1572,7 @@ static __init int vpif_probe(struct platform_device *pdev)int res_idx =0 ;int i, err; + pdev->dev.platform_data =vpif_capture_get_pdata (pdev);if (!pdev->dev.platform_data) {dev_warn (&pdev->dev,"Missing platform data. Giving up.\n" );return -EINVAL ;
@@ -1481,7 +1615,7 @@ static __init int vpif_probe(struct platform_device *pdev) goto vpif_unregister; } -if (!vpif_obj.config->asd_sizes) { +if (!vpif_obj.config->asd_sizes[0 ]) { i2c_adap =i2c_get_adapter (1 );for (i =0 ; i < subdev_count; i++) { subdevdata = &vpif_obj.config->subdev_info[i];
include/media/davinci/vpif_types.h +5 -4
@@ -65,14 +65,14 @@ struct vpif_display_config {struct vpif_input {struct v4l2_input input; -const char *subdev_name; +char *subdev_name;u32 input_route;u32 output_route; };struct vpif_capture_chan_config {struct vpif_interface vpif_if; -const struct vpif_input *inputs; +struct vpif_input *inputs;int input_count; };
@@ -83,7 +83,8 @@ struct vpif_capture_config {struct vpif_subdev_info *subdev_info;int subdev_count;const char *card_name; -struct v4l2_async_subdev **asd;/* Flat array, arranged in groups */ - int *asd_sizes; /* 0-terminated array of asd group sizes */ + +struct v4l2_async_subdev *asd[VPIF_CAPTURE_MAX_CHANNELS ]; + int asd_sizes[VPIF_CAPTURE_MAX_CHANNELS]; };#endif /* _VPIF_TYPES_H */
Signature · 1 line
2.9.3
PATCH v4 4/4 dt-bindings: add TI VPIF documentation
In reply to Kevin Hilman--- .../devicetree/bindings/media/ti,da850-vpif.txt | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/ti,da850-vpif.txt
Documentation/devicetree/bindings/media/ti,da850-vpif.txt new file +67 -0
@@ -0,0 +1,67 @@ +Texas Instruments VPIF +---------------------- + +The TI Video Port InterFace (VPIF) is the primary component for video +capture and display on the DA850/AM18x family of TI DaVinci/Sitara +SoCs. + +TI Document reference: SPRUH82C, Chapter 35 +http://www.ti.com/lit/pdf/spruh82 + +Required properties: +- compatible: must be "ti,da850-vpif" +- reg: physical base address and length of the registers set for the device; +- interrupts: should contain IRQ line for the VPIF + +Video Capture: + +VPIF has a 16-bit parallel bus input, supporting 2 8-bit channels or a +single 16-bit channel. It should contain at least one port child node +with child 'endpoint' node. Please refer to the bindings defined in +Documentation/devicetree/bindings/media/video-interfaces.txt. + +Example using 2 8-bit input channels, one of which is connected to an +I2C-connected TVP5147 decoder: + + vpif: vpif at 217000 { + compatible = "ti,da850-vpif"; + reg = <0x217000 0x1000>; + interrupts = <92>; + + port { + vpif_ch0: endpoint at 0 { + reg = <0>; + bus-width = <8>; + remote-endpoint = <&composite>; + }; + + vpif_ch1: endpoint at 1 { + reg = <1>; + bus-width = <8>; + data-shift = <8>; + }; + }; + }; + +[ ... ] + +&i2c0 { + + tvp5147 at 5d { + compatible = "ti,tvp5147"; + reg = <0x5d>; + status = "okay"; + + port { + composite: endpoint { + hsync-active = <1>; + vsync-active = <1>; + pclk-sample = <0>; + + /* VPIF channel 0 (lower 8-bits) */ + remote-endpoint = <&vpif_ch0>; + bus-width = <8>; + }; + }; + }; +};
Signature · 1 line
2.9.3
Rob Herring
maintainerPATCH v4 4/4 dt-bindings: add TI VPIF documentation
Quoted 5 lines · Kevin Hilman
Signed-off-by Kevin Hilman <[email protected]>--- .../devicetree/bindings/media/ti,da850-vpif.txt | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/ti,da850-vpif.txt