Commit 02b1ce92 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab

media: omap3isp: Quit using struct v4l2_subdev.host_priv field

struct v4l2_subdev.host_priv is intended to be used by another driver. This
is hardly good design but back in the days of platform data was a quick
hack to get things done.

As the sub-device specific bus information can be stored to the ISP driver
specific struct allocated along with v4l2_async_subdev, keep the
information there and only there.
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Tested-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7e1db599
...@@ -2188,26 +2188,12 @@ static int isp_fwnodes_parse(struct device *dev, ...@@ -2188,26 +2188,12 @@ static int isp_fwnodes_parse(struct device *dev,
return -EINVAL; return -EINVAL;
} }
static int isp_subdev_notifier_bound(struct v4l2_async_notifier *async,
struct v4l2_subdev *subdev,
struct v4l2_async_subdev *asd)
{
struct isp_async_subdev *isd =
container_of(asd, struct isp_async_subdev, asd);
isd->sd = subdev;
isd->sd->host_priv = &isd->bus;
return 0;
}
static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async) static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
{ {
struct isp_device *isp = container_of(async, struct isp_device, struct isp_device *isp = container_of(async, struct isp_device,
notifier); notifier);
struct v4l2_device *v4l2_dev = &isp->v4l2_dev; struct v4l2_device *v4l2_dev = &isp->v4l2_dev;
struct v4l2_subdev *sd; struct v4l2_subdev *sd;
struct isp_bus_cfg *bus;
int ret; int ret;
ret = media_entity_enum_init(&isp->crashed, &isp->media_dev); ret = media_entity_enum_init(&isp->crashed, &isp->media_dev);
...@@ -2215,14 +2201,14 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async) ...@@ -2215,14 +2201,14 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
return ret; return ret;
list_for_each_entry(sd, &v4l2_dev->subdevs, list) { list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
/* Only try to link entities whose interface was set on bound */ if (!sd->asd)
if (sd->host_priv) { continue;
bus = (struct isp_bus_cfg *)sd->host_priv;
ret = isp_link_entity(isp, &sd->entity, bus->interface); ret = isp_link_entity(isp, &sd->entity,
v4l2_subdev_to_bus_cfg(sd)->interface);
if (ret < 0) if (ret < 0)
return ret; return ret;
} }
}
ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev); ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
if (ret < 0) if (ret < 0)
...@@ -2399,7 +2385,6 @@ static int isp_probe(struct platform_device *pdev) ...@@ -2399,7 +2385,6 @@ static int isp_probe(struct platform_device *pdev)
if (ret < 0) if (ret < 0)
goto error_register_entities; goto error_register_entities;
isp->notifier.bound = isp_subdev_notifier_bound;
isp->notifier.complete = isp_subdev_notifier_complete; isp->notifier.complete = isp_subdev_notifier_complete;
ret = v4l2_async_notifier_register(&isp->v4l2_dev, &isp->notifier); ret = v4l2_async_notifier_register(&isp->v4l2_dev, &isp->notifier);
......
...@@ -226,11 +226,13 @@ struct isp_device { ...@@ -226,11 +226,13 @@ struct isp_device {
}; };
struct isp_async_subdev { struct isp_async_subdev {
struct v4l2_subdev *sd;
struct isp_bus_cfg bus; struct isp_bus_cfg bus;
struct v4l2_async_subdev asd; struct v4l2_async_subdev asd;
}; };
#define v4l2_subdev_to_bus_cfg(sd) \
(&container_of((sd)->asd, struct isp_async_subdev, asd)->bus)
#define v4l2_dev_to_isp_device(dev) \ #define v4l2_dev_to_isp_device(dev) \
container_of(dev, struct isp_device, v4l2_dev) container_of(dev, struct isp_device, v4l2_dev)
......
...@@ -1139,8 +1139,10 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) ...@@ -1139,8 +1139,10 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
pad = media_entity_remote_pad(&ccdc->pads[CCDC_PAD_SINK]); pad = media_entity_remote_pad(&ccdc->pads[CCDC_PAD_SINK]);
sensor = media_entity_to_v4l2_subdev(pad->entity); sensor = media_entity_to_v4l2_subdev(pad->entity);
if (ccdc->input == CCDC_INPUT_PARALLEL) { if (ccdc->input == CCDC_INPUT_PARALLEL) {
parcfg = &((struct isp_bus_cfg *)sensor->host_priv) struct v4l2_subdev *sd =
->bus.parallel; to_isp_pipeline(&ccdc->subdev.entity)->external;
parcfg = &v4l2_subdev_to_bus_cfg(sd)->bus.parallel;
ccdc->bt656 = parcfg->bt656; ccdc->bt656 = parcfg->bt656;
} }
...@@ -2412,11 +2414,11 @@ static int ccdc_link_validate(struct v4l2_subdev *sd, ...@@ -2412,11 +2414,11 @@ static int ccdc_link_validate(struct v4l2_subdev *sd,
/* We've got a parallel sensor here. */ /* We've got a parallel sensor here. */
if (ccdc->input == CCDC_INPUT_PARALLEL) { if (ccdc->input == CCDC_INPUT_PARALLEL) {
struct isp_parallel_cfg *parcfg = struct v4l2_subdev *sd =
&((struct isp_bus_cfg *) media_entity_to_v4l2_subdev(link->source->entity);
media_entity_to_v4l2_subdev(link->source->entity) struct isp_bus_cfg *bus_cfg = v4l2_subdev_to_bus_cfg(sd);
->host_priv)->bus.parallel;
parallel_shift = parcfg->data_lane_shift; parallel_shift = bus_cfg->bus.parallel.data_lane_shift;
} else { } else {
parallel_shift = 0; parallel_shift = 0;
} }
......
...@@ -350,6 +350,7 @@ static void ccp2_lcx_config(struct isp_ccp2_device *ccp2, ...@@ -350,6 +350,7 @@ static void ccp2_lcx_config(struct isp_ccp2_device *ccp2,
*/ */
static int ccp2_if_configure(struct isp_ccp2_device *ccp2) static int ccp2_if_configure(struct isp_ccp2_device *ccp2)
{ {
struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity);
const struct isp_bus_cfg *buscfg; const struct isp_bus_cfg *buscfg;
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
struct media_pad *pad; struct media_pad *pad;
...@@ -361,7 +362,7 @@ static int ccp2_if_configure(struct isp_ccp2_device *ccp2) ...@@ -361,7 +362,7 @@ static int ccp2_if_configure(struct isp_ccp2_device *ccp2)
pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]); pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]);
sensor = media_entity_to_v4l2_subdev(pad->entity); sensor = media_entity_to_v4l2_subdev(pad->entity);
buscfg = sensor->host_priv; buscfg = v4l2_subdev_to_bus_cfg(pipe->external);
ret = ccp2_phyif_config(ccp2, &buscfg->bus.ccp2); ret = ccp2_phyif_config(ccp2, &buscfg->bus.ccp2);
if (ret < 0) if (ret < 0)
......
...@@ -566,7 +566,7 @@ static int csi2_configure(struct isp_csi2_device *csi2) ...@@ -566,7 +566,7 @@ static int csi2_configure(struct isp_csi2_device *csi2)
pad = media_entity_remote_pad(&csi2->pads[CSI2_PAD_SINK]); pad = media_entity_remote_pad(&csi2->pads[CSI2_PAD_SINK]);
sensor = media_entity_to_v4l2_subdev(pad->entity); sensor = media_entity_to_v4l2_subdev(pad->entity);
buscfg = sensor->host_priv; buscfg = v4l2_subdev_to_bus_cfg(pipe->external);
csi2->frame_skip = 0; csi2->frame_skip = 0;
v4l2_subdev_call(sensor, sensor, g_skip_frames, &csi2->frame_skip); v4l2_subdev_call(sensor, sensor, g_skip_frames, &csi2->frame_skip);
......
...@@ -165,10 +165,7 @@ static int csiphy_set_power(struct isp_csiphy *phy, u32 power) ...@@ -165,10 +165,7 @@ static int csiphy_set_power(struct isp_csiphy *phy, u32 power)
static int omap3isp_csiphy_config(struct isp_csiphy *phy) static int omap3isp_csiphy_config(struct isp_csiphy *phy)
{ {
struct isp_pipeline *pipe = to_isp_pipeline(phy->entity); struct isp_pipeline *pipe = to_isp_pipeline(phy->entity);
struct isp_async_subdev *isd = struct isp_bus_cfg *buscfg = v4l2_subdev_to_bus_cfg(pipe->external);
container_of(pipe->external->asd, struct isp_async_subdev, asd);
struct isp_bus_cfg *buscfg = pipe->external->host_priv ?
pipe->external->host_priv : &isd->bus;
struct isp_csiphy_lanes_cfg *lanes; struct isp_csiphy_lanes_cfg *lanes;
int csi2_ddrclk_khz; int csi2_ddrclk_khz;
unsigned int num_data_lanes, used_lanes = 0; unsigned int num_data_lanes, used_lanes = 0;
...@@ -311,7 +308,8 @@ void omap3isp_csiphy_release(struct isp_csiphy *phy) ...@@ -311,7 +308,8 @@ void omap3isp_csiphy_release(struct isp_csiphy *phy)
mutex_lock(&phy->mutex); mutex_lock(&phy->mutex);
if (phy->entity) { if (phy->entity) {
struct isp_pipeline *pipe = to_isp_pipeline(phy->entity); struct isp_pipeline *pipe = to_isp_pipeline(phy->entity);
struct isp_bus_cfg *buscfg = pipe->external->host_priv; struct isp_bus_cfg *buscfg =
v4l2_subdev_to_bus_cfg(pipe->external);
csiphy_routing_cfg(phy, buscfg->interface, false, csiphy_routing_cfg(phy, buscfg->interface, false,
buscfg->bus.ccp2.phy_layer); buscfg->bus.ccp2.phy_layer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment