aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/platform/hisi/isp/isp.c
diff options
context:
space:
mode:
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2018-11-23 21:22:37 +0530
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>2018-11-23 21:22:37 +0530
commite89b90550f3bfdf483d472e0723bcb8b57ecdd34 (patch)
tree640081094a96332d3a4b94732e881ed23e2c1a4c /drivers/media/platform/hisi/isp/isp.c
parentd68335c072a803e002b21519e5ca27269e8a0bfe (diff)
download96b-common-hikey_v4l2_4.15.tar.gz
media: hisi: ISP: Add video device and some cleanupshikey_v4l2_4.15
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Diffstat (limited to 'drivers/media/platform/hisi/isp/isp.c')
-rw-r--r--drivers/media/platform/hisi/isp/isp.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/drivers/media/platform/hisi/isp/isp.c b/drivers/media/platform/hisi/isp/isp.c
index f71fbe6fbaf2..7b0cceee74ca 100644
--- a/drivers/media/platform/hisi/isp/isp.c
+++ b/drivers/media/platform/hisi/isp/isp.c
@@ -96,17 +96,20 @@ int frame_num2Offset(struct isp *isp, int frame_num)
void isp_config_smmu_bypass(struct isp *isp)
{
+ pr_info("%s: %d\n", __func__, __LINE__);
isp_writel(isp->smmu_ctrl, 0x0, 0x1);
}
void isp_ispss_enable_irq(struct isp *isp)
{
+ pr_info("%s: %d\n", __func__, __LINE__);
isp_writel(isp->irq_merger2, IRQ_MERGER_IMSC_DEBUG1, 0xFFFFFFFF);
isp_writel(isp->irq_merger2, IRQ_MERGER_IMSC_FRPROC0, 0xFFFFFFFF);
}
void isp_ispss_clear_irq_state(struct isp *isp)
{
+ pr_info("%s: %d\n", __func__, __LINE__);
isp_writel(isp->irq_merger2, IRQ_MERGER_ICR_DEBUG0, 0xFFFFFFFF);
isp_writel(isp->irq_merger2, IRQ_MERGER_ICR_DEBUG1, 0xFFFFFFFF);
isp_writel(isp->irq_merger2, IRQ_MERGER_ICR_DEBUG2, 0xFFFFFFFF);
@@ -226,32 +229,25 @@ int isp_get_pixel_clock(struct media_entity *entity, u32 *pixel_clock)
*/
static int isp_of_parse_endpoint_node(struct device *dev,
struct device_node *node,
- struct isp_async_subdev *csd)
+ struct isp_async_subdev *csd,
+ struct v4l2_async_notifier *async)
{
- struct csiphy_lanes_cfg *lncfg = &csd->interface.csi2.lane_cfg;
+ struct csiphy_config *cfg = &csd->interface.cfg;
struct v4l2_fwnode_bus_mipi_csi2 *mipi_csi2;
- struct v4l2_fwnode_endpoint vep = { { 0 } };
+ struct v4l2_fwnode_endpoint vep = { .bus_type = 0 };
+ struct isp *isp = container_of(async, struct isp, notifier);
unsigned int i;
v4l2_fwnode_endpoint_parse(of_fwnode_handle(node), &vep);
- csd->interface.csiphy_id = vep.base.port;
+ /* CSI2PHY port id */
+ isp->csiphy_id = vep.base.port;
+ pr_info("CSIPHY ID: %d\n", isp->csiphy_id);
mipi_csi2 = &vep.bus.mipi_csi2;
- lncfg->clk.pos = mipi_csi2->clock_lane;
- lncfg->clk.pol = mipi_csi2->lane_polarities[0];
- lncfg->num_data = mipi_csi2->num_data_lanes;
-
- lncfg->data = devm_kcalloc(dev,
- lncfg->num_data, sizeof(*lncfg->data),
- GFP_KERNEL);
- if (!lncfg->data)
- return -ENOMEM;
- for (i = 0; i < lncfg->num_data; i++) {
- lncfg->data[i].pos = mipi_csi2->data_lanes[i];
- lncfg->data[i].pol = mipi_csi2->lane_polarities[i + 1];
- }
+ /* CSI2PHY data lanes */
+ cfg->num_data = mipi_csi2->num_data_lanes;
return 0;
}
@@ -299,7 +295,7 @@ static int isp_of_parse_ports(struct device *dev,
notifier->subdevs[i++] = &csd->asd;
- ret = isp_of_parse_endpoint_node(dev, node, csd);
+ ret = isp_of_parse_endpoint_node(dev, node, csd, notifier);
if (ret < 0) {
of_node_put(node);
return ret;
@@ -453,10 +449,11 @@ static int isp_subdev_notifier_bound(struct v4l2_async_notifier *async,
struct isp *isp = container_of(async, struct isp, notifier);
struct isp_async_subdev *csd =
container_of(asd, struct isp_async_subdev, asd);
- u8 id = csd->interface.csiphy_id;
+ u8 id = isp->csiphy_id;
struct csiphy_device *csiphy = &isp->csiphy[id];
- csiphy->cfg.csi2 = &csd->interface.csi2;
+ pr_info("Notifier bound CSIPHY id: %d\n", id);
+ csiphy->cfg.num_data = csd->interface.cfg.num_data;
subdev->host_priv = csiphy;
return 0;
@@ -469,6 +466,7 @@ static int isp_subdev_notifier_complete(struct v4l2_async_notifier *async)
struct v4l2_subdev *sd;
int ret;
+ pr_info("Notifier complete\n");
list_for_each_entry(sd, &v4l2_dev->subdevs, list) {
if (sd->host_priv) {
struct media_entity *sensor = &sd->entity;
@@ -594,31 +592,26 @@ static int isp_probe(struct platform_device *pdev)
if (ret < 0)
goto err_cleanup;
- isp->virt_addr = dma_alloc_coherent(dev, isp->pool_size,
- &(isp->hw_addr), GFP_KERNEL);
- if (!isp->virt_addr) {
- pr_err("dma_alloc_coherent (ISP) alloc err!\n");
- ret = -ENOMEM;
- goto err_cleanup;
- }
-
- memset(isp->virt_addr, 0, isp->pool_size);
+ pr_info("%s: %d\n", __func__, __LINE__);
ret = isp_of_parse_ports(dev, &isp->notifier);
if (ret < 0) {
goto err_cleanup;
}
+ pr_info("%s: %d\n", __func__, __LINE__);
ret = isp_init_subdevices(isp);
if (ret < 0)
goto err_cleanup;
+ pr_info("%s: %d\n", __func__, __LINE__);
isp->media_dev.dev = isp->dev;
strlcpy(isp->media_dev.model, "HiSilicon ISP",
sizeof(isp->media_dev.model));
isp->media_dev.ops = &isp_media_ops;
media_device_init(&isp->media_dev);
+ pr_info("%s: %d\n", __func__, __LINE__);
/* FIXME: Get these from userspace */
isp->frame_size = 0x3F4800;
isp->frame_count = 4;
@@ -630,11 +623,15 @@ static int isp_probe(struct platform_device *pdev)
goto err_cleanup;
}
+ pr_info("%s: %d\n", __func__, __LINE__);
ret = isp_register_entities(isp);
if (ret < 0)
goto err_register_entities;
+ pr_info("%s: %d\n", __func__, __LINE__);
+
if (isp->notifier.num_subdevs) {
+ pr_info("%s: %d\n", __func__, __LINE__);
isp->notifier.ops = &isp_subdev_notifier_ops;
ret = v4l2_async_notifier_register(&isp->v4l2_dev,
@@ -646,6 +643,7 @@ static int isp_probe(struct platform_device *pdev)
goto err_register_subdevs;
}
} else {
+ pr_info("%s: %d\n", __func__, __LINE__);
ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev);
if (ret < 0) {
dev_err(dev, "Failed to register subdev nodes: %d\n",
@@ -661,6 +659,7 @@ static int isp_probe(struct platform_device *pdev)
}
}
+ pr_info("%s: %d\n", __func__, __LINE__);
return 0;
err_register_subdevs: