v4l: vsp1: Setup control handler automatically at stream on time
authorLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Sat, 31 May 2014 13:40:51 +0000 (10:40 -0300)
committerStephane Desneux <stephane.desneux@open.eurogiciel.org>
Wed, 4 Feb 2015 10:15:39 +0000 (11:15 +0100)
commit6a87a0c6c62bf2541312627de1ac34e68c29561c
tree7e1e72155d4345edfeef52a5fdc4cd8b9530aa3b
parent9a4305231b84ddce3cc9f07b169e860921b85948
v4l: vsp1: Setup control handler automatically at stream on time

When setting a control directly on a subdev node the VSP1 driver doesn't
guarantee that the device is powered on. This leads to crashes when the
control handlers writes to hardware registers. One easy way to fix this
is to ensure that the device gets powered on when a subdev node is
opened. However, this consumes power unnecessarily, as there's no need
to power the device on when setting formats on the pipeline.
Furthermore, control handler setup at entity init time suffers from the
same problem as the device isn't powered on easier.

Fix this by extend the entity base object to setup the control handler
automatically when starting the stream. Entities must then skip writing
to registers in the set control handler when not streaming, which can be
tested with the new vsp1_entity_is_streaming() helper function.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
(cherry picked from commit 960de2cff49a4e5f45e6a60175f4298cc34dc526)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
drivers/media/platform/vsp1/vsp1_entity.c
drivers/media/platform/vsp1/vsp1_entity.h