drivers/media/platform/ti/omap3isp/ispcsiphy.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/omap3isp/ispcsiphy.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/ti/omap3isp/ispcsiphy.c
Extension
.c
Size
9854 bytes
Lines
366
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (rval) {
			regulator_disable(phy->vdd);
			goto done;
		}

		csiphy_power_autoswitch_enable(phy, true);
	}
done:
	if (rval < 0)
		phy->entity = NULL;

	mutex_unlock(&phy->mutex);
	return rval;
}

void omap3isp_csiphy_release(struct isp_csiphy *phy)
{
	mutex_lock(&phy->mutex);
	if (phy->entity) {
		struct isp_pipeline *pipe = to_isp_pipeline(phy->entity);
		struct isp_bus_cfg *buscfg;

		buscfg = v4l2_subdev_to_bus_cfg(pipe->external);
		if (WARN_ON(!buscfg)) {
			mutex_unlock(&phy->mutex);
			return;
		}

		csiphy_routing_cfg(phy, buscfg->interface, false,
				   buscfg->bus.ccp2.phy_layer);
		if (phy->isp->revision == ISP_REVISION_15_0) {
			csiphy_power_autoswitch_enable(phy, false);
			csiphy_set_power(phy, ISPCSI2_PHY_CFG_PWR_CMD_OFF);
		}
		regulator_disable(phy->vdd);
		phy->entity = NULL;
	}
	mutex_unlock(&phy->mutex);
}

/*
 * omap3isp_csiphy_init - Initialize the CSI PHY frontends
 */
int omap3isp_csiphy_init(struct isp_device *isp)
{
	struct isp_csiphy *phy1 = &isp->isp_csiphy1;
	struct isp_csiphy *phy2 = &isp->isp_csiphy2;

	phy2->isp = isp;
	phy2->csi2 = &isp->isp_csi2a;
	phy2->num_data_lanes = ISP_CSIPHY2_NUM_DATA_LANES;
	phy2->cfg_regs = OMAP3_ISP_IOMEM_CSI2A_REGS1;
	phy2->phy_regs = OMAP3_ISP_IOMEM_CSIPHY2;
	mutex_init(&phy2->mutex);

	phy1->isp = isp;
	mutex_init(&phy1->mutex);

	if (isp->revision == ISP_REVISION_15_0) {
		phy1->csi2 = &isp->isp_csi2c;
		phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES;
		phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1;
		phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1;
	}

	return 0;
}

void omap3isp_csiphy_cleanup(struct isp_device *isp)
{
	mutex_destroy(&isp->isp_csiphy1.mutex);
	mutex_destroy(&isp->isp_csiphy2.mutex);
}

Annotation

Implementation Notes