media: v4l: fwnode: Let the caller provide V4L2 fwnode endpoint
Instead of allocating the V4L2 fwnode endpoint in v4l2_fwnode_endpoint_alloc_parse, let the caller to do this. This allows setting default parameters for the endpoint which is a very common need for drivers. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Steve Longerbeam <steve_longerbeam@mentor.com> Tested-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
2d95e7ed07
commit
6970d37cc9
@@ -1347,8 +1347,9 @@ static struct ov2659_platform_data *
|
||||
ov2659_get_pdata(struct i2c_client *client)
|
||||
{
|
||||
struct ov2659_platform_data *pdata;
|
||||
struct v4l2_fwnode_endpoint *bus_cfg;
|
||||
struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
|
||||
struct device_node *endpoint;
|
||||
int ret;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
|
||||
return client->dev.platform_data;
|
||||
@@ -1357,8 +1358,9 @@ ov2659_get_pdata(struct i2c_client *client)
|
||||
if (!endpoint)
|
||||
return NULL;
|
||||
|
||||
bus_cfg = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(endpoint));
|
||||
if (IS_ERR(bus_cfg)) {
|
||||
ret = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(endpoint),
|
||||
&bus_cfg);
|
||||
if (ret) {
|
||||
pdata = NULL;
|
||||
goto done;
|
||||
}
|
||||
@@ -1367,17 +1369,17 @@ ov2659_get_pdata(struct i2c_client *client)
|
||||
if (!pdata)
|
||||
goto done;
|
||||
|
||||
if (!bus_cfg->nr_of_link_frequencies) {
|
||||
if (!bus_cfg.nr_of_link_frequencies) {
|
||||
dev_err(&client->dev,
|
||||
"link-frequencies property not found or too many\n");
|
||||
pdata = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
pdata->link_frequency = bus_cfg->link_frequencies[0];
|
||||
pdata->link_frequency = bus_cfg.link_frequencies[0];
|
||||
|
||||
done:
|
||||
v4l2_fwnode_endpoint_free(bus_cfg);
|
||||
v4l2_fwnode_endpoint_free(&bus_cfg);
|
||||
of_node_put(endpoint);
|
||||
return pdata;
|
||||
}
|
||||
|
Reference in New Issue
Block a user