Re: [PATCH v5.1 35/35] smiapp: Add driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 8 mars 2012 14:57, Sakari Ailus <sakari.ailus@xxxxxx> a écrit :
> Add driver for SMIA++/SMIA image sensors. The driver exposes the sensor as
> three subdevs, pixel array, binner and scaler --- in case the device has a
> scaler.
>
> Currently it relies on the board code for external clock handling. There is
> no fast way out of this dependency before the ISP drivers (omap3isp) among
> others will be able to export that clock through the clock framework
> instead.
>
> +       case V4L2_CID_EXPOSURE:
> +               return smiapp_write(
> +                       client,
> +                       SMIAPP_REG_U16_COARSE_INTEGRATION_TIME, ctrl->val);
> +
At this point, knowing pixel clock and line length, it is possible
to get / set the exposure in useconds or millisecond value.

>From userspace, if for example you change the format and crop,
you can just set the expo to a value in msec or usec, and get the
same exposure after your format change.

The driver is IMO the place where we have all the info. Here is some
example code with usec. (The 522 constant is the fine integration register...)

static int  mt9j_expo_to_shutter(struct usb_ovfx2 * ov, u32 expo)
{
	int rc = 0;
	u32 expo_pix; // exposition in pixclk unit
	u16 coarse_expo;
	u16 row_time;
	expo_pix = expo * 96;   /// pixel clock in MHz
	MT9J_RREAD(ov, LINE_LENGTH_PCK, &row_time);
	expo_pix = expo_pix - 522;
	coarse_expo = (expo_pix + row_time/2)/ row_time;
	MT9J_RWRITE(ov, COARSE_EXPO_REG, coarse_expo);
	return rc;
}

static int  mt9j_shutter_to_expo(struct usb_ovfx2 * ov, u32  * expo)
{
	int rc = 0;
	u32 expo_pix; // exposition in pixclk unit
	u16 coarse_expo;
	u16 row_time;
	MT9J_RREAD(ov, LINE_LENGTH_PCK, &row_time);
	MT9J_RREAD(ov, COARSE_EXPO_REG, &coarse_expo);
	expo_pix = row_time * coarse_expo + 522;
	*expo = expo_pix / (96);
	return rc;
}

Maybe you have enough on your plate for now, and this can
wait after inclusion, but it is a nice abstraction to have  from
userspace point of view.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux