Re: [V3, 4/4] media: platform: dwc: Add MIPI CSI-2 controller driver

Luis de Oliveira
2019-01-10T16:11:28Z

On 10-Dec-18 12:39, Eugen.Hristev@microchip.com wrote:
>
>
> On 19.10.2018 15:52, Luis Oliveira wrote:
>> Add the Synopsys MIPI CSI-2 controller driver. This
>> controller driver is divided in platform dependent functions
>> and core functions. It also includes a platform for future
>> DesignWare drivers.
>>
>> Signed-off-by: Luis Oliveira <lolivei@synopsys.com>
>> ---
>> Changelog
>> v2-V3
>> - exposed IPI settings to userspace
>> - fixed headers
> [...]
>
> snip
>
>
>> +
>> +static int
>> +dw_mipi_csi_parse_dt(struct platform_device *pdev, struct mipi_csi_dev *dev)
>> +{
>> + struct device_node *node = pdev->dev.of_node;
>> + struct v4l2_fwnode_endpoint endpoint;
>
> Hello Luis,
>
> I believe you have to initialize "endpoint" here correctly, otherwise
> the parsing mechanism (fwnode_endpoint_parse) will consider you have a
> specific mbus type and fail to probe the endpoint: bail out with debug
> message "expecting bus type not found "
>
> (namely, initialize to zero which is the UNKNOWN mbus type, or , to a
> specific mbus (from DT or whatever source))
>
> Eugen
>
Hi Eugen,

Sorry for my late reply, I was on Christmas break.
You are right, I will add that fix.

>
>> + int ret;
>> +
>> + node = of_graph_get_next_endpoint(node, NULL);
>> + if (!node) {
>> + dev_err(&pdev->dev, "No port node at %s\n",
>> + pdev->dev.of_node->full_name);
>> + return -EINVAL;
>> + }
>> +
>> + ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &endpoint);
>> + if (ret)
>> + goto err;
>> +
>> + dev->index = endpoint.base.port - 1;
>> + if (dev->index >= CSI_MAX_ENTITIES) {
>> + ret = -ENXIO;
>> + goto err;
>> + }
>> + dev->hw.num_lanes = endpoint.bus.mipi_csi2.num_data_lanes;
>> +
>> +err:
>> + of_node_put(node);
>> + return ret;
>> +}
>> +
>
> snip
>
Thank you.