lkml.org 
[lkml]   [2012]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectHandling <Ctrl-c> like events in 's_power' implementation when we have a GPIO controlling the sensor CE
Hi Guennadi,

I don't know if you are the right person to ask this query (since
it is also related to GPIO stuff), but here goes:

Our board has a I2C controlled camera sensor whose Chip Enable (CE)
pin is driven via a GPIO. This GPIO is made available by a I2C-to-GPIO
expander chip (STMPE801, see user manual [1])

Now, when we implement the 's_power' routines as specified by the soc-camera
framework, a peculiar issue arises:

The 's_power' routine simply toggles the CE of the sensor as per the power-on/off
command received from the framework/bridge driver. And this works absolutely fine
in normal cases. As we have a GPIO on a external chip (STMPE801) we need to use
*_cansleep variants of the gpio_set/get routines (see [2] for reference) to toggle
the GPIO values to power-on/off the sensor chip.

Now, when we terminate a user application (a standard application like 'capture'
available as a reference v4l2 test application) which was capturing a large
number of frames from the sensor, using 'ctrl-c', I see that 's_power' is
correctly called with a power-off argument. However, the I2C controller driver
(we use the standard SYNOPSYS designware device driver present in mainline,
see [3]) returns -ERESTARTSYS in response to the write command we had requested
for putting the sensor to power-off state (as it has received the <ctrl-c> kill
signal).

But as the gpio_set_val_* variants are inherently 'void' implementations, we have
no mechanism to use and handle the -ERESTARTSYS value in the 's_power' implementation.
I also found that the standard 'soc_camera.c' does not check the return value in
'soc_camera_power_off' routines, but that is a easily fixable issue.

Now, I want your opinions on how to get out of this mess.
Perhaps changes in GPIO implementations? Or am I missing
something here.

References:
[1] http://www.st.com/internet/analog/product/154542.jsp
[2] http://lxr.linux.no/linux+v3.1.5/Documentation/gpio.txt#L195
[3] http://lxr.linux.no/linux+v3.1.5/drivers/i2c/busses/i2c-designware.c

Regards,
Bhupesh







\
 
 \ /
  Last update: 2012-02-01 06:03    [W:0.053 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site