Exemplo n.º 1
0
/* Claim parport for ourself */
static void w9966_pdev_claim(struct w9966 *cam)
{
	if (w9966_get_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED))
		return;
	parport_claim_or_block(cam->pdev);
	w9966_set_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED);
}
Exemplo n.º 2
0
/* Release parport for others to use */
static void w9966_pdev_release(struct w9966 *cam)
{
	if (w9966_get_state(cam, W9966_STATE_CLAIMED, 0))
		return;
	parport_release(cam->pdev);
	w9966_set_state(cam, W9966_STATE_CLAIMED, 0);
}
Exemplo n.º 3
0
/* Terminate everything gracefully */
static void w9966_term(struct w9966 *cam)
{
	/* Unregister from v4l */
	if (w9966_get_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
		video_unregister_device(&cam->vdev);
		w9966_set_state(cam, W9966_STATE_VDEV, 0);
	}

	/* Terminate from IEEE1284 mode and release pdev block */
	if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
		w9966_pdev_claim(cam);
		parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT);
		w9966_pdev_release(cam);
	}

	/* Unregister from parport */
	if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
		parport_unregister_device(cam->pdev);
		w9966_set_state(cam, W9966_STATE_PDEV, 0);
	}
}