public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: "Shuzhen Wang" <shuzhenw@codeaurora.org>
To: <linux-media@vger.kernel.org>
Cc: <hzhong@codeaurora.org>
Subject: RFC: V4L2 driver for Qualcomm MSM camera.
Date: Thu, 23 Dec 2010 11:38:04 -0800	[thread overview]
Message-ID: <000601cba2d8$eaedcdc0$c0c96940$@org> (raw)

Hello, 

This is the architecture overview we put together for Qualcomm MSM camera
support in linux-media tree. Your comments are very much appreciated!


Introduction
============

This is the video4linux driver for Qualcomm MSM (Mobile Station Modem)
camera.

The driver supports video and camera functionality on Qualcomm MSM SoC.
It supports camera sensors provided by OEMs with parallel/MIPI
interfaces, and operates in continuous streaming, snapshot, or video
recording modes.

Hardware description
====================

MSM camera hardware contains the following components:
1. One or more camera sensors controlled via I2C bus, and data outputs
on AXI or MIPI bus.
2. Video Front End (VFE) core is an image signal processing hardware
pipeline that takes the sensor output, does the necessary processing,
and outputs to a buffer for V4L2 application. VFE is clocked by PCLK
(pixel clock) from the sensor.

Software description
====================

The driver encapsulates the low-level hardware management and aligns
the interface to V4L2 driver framework. There is also a user space
camera service daemon which handles events from driver and changes
settings accordingly.

During boot-up, the sensor is probed for and if the probe succeeds
/dev/video0 and /dev/msm_camera/config0 device nodes are created. The
/dev/video0 node is used for video buffer allocation in the kernel and for
receiving V4L2 ioctls for controlling the camera hardware (VFE, sensors).
The /dev/msm_camera/config0 node is used for sending commands and other
statistics available from the hardware to the camera service daemon. Note
that if more than one camera sensor is detected, there will be /dev/video1
and /dev/msm_camera/config1 device nodes created as well.

Design
======

For MSM camera IC, significant portion of image processing and optimization
codes are proprietary, so they cannot sit in kernel space. This plays an
important role when making design decisions.

Our design is to have a light-weighted kernel driver, and put the
proprietary code in a user space daemon. The daemon polls on events
from /dev/msm_camera/config0 device in the form of v4l2_event. The events
could either be asynchronous (generated by the hardware), or synchronous
(control command from the application). Based on the events it receives,
the daemon will send appropriate control commands to the hardware.

   +-------------+        +----------------+
   | Application |        | Service Daemon |
   +-------------+        +----------------+     User Space
 ..........................................................
   +--------------------------------------+      Kernel Space
   |                V4L2                  |
   +--------------------------------------+
   +---------+     +--------+     +-------+
   | VFE/ISP |     | Sensor |     | Flash |
   +---------+     +--------+     +-------+

Power Management
================

None at this point.

SMP/multi-core
==============

Mutex is used for synchronization of threads accessing the driver
simultaneously. Between hardware interrupt handler and threads,
we use spinlock to make sure locking is done properly.

Security
========

None.

Interface
=========

The driver uses V4L2 API for user kernel interaction. Refer to
http://v4l2spec.bytesex.org/spec-single/v4l2.html.

Between camera service daemon and the driver, we have customized IOCTL
commands associated with /dev/msm_camera/config0 node, that controls MSM
camera hardware. The list of IOCTLs are (declarations can be found in
include/media/msm_camera.h):

MSM_CAM_IOCTL_GET_SENSOR_INFO
        Get the basic information such as name, flash support for the
        detected sensor.
MSM_CAM_IOCTL_SENSOR_IO_CFG
        Get or set sensor configurations: fps, line_pf, pixels_pl,
        exposure and gain, etc. The setting is stored in sensor_cfg_data
        structure.
MSM_CAM_IOCTL_CONFIG_VFE
        Change settings of different components of VFE hardware.
MSM_CAM_IOCTL_CTRL_CMD_DONE
        Notify the driver that the ctrl command is finished.
MSM_CAM_IOCTL_RELEASE_STATS_BUFFER
        Notify the driver that the service daemon has done processing the
        stats buffer, and is returning it to the driver.
MSM_CAM_IOCTL_AXI_CONFIG
        Configure AXI bus parameters (frame buffer addresses, offsets) to
        the VFE hardware.

Driver parameters
=================

None.

Config options
==============

MSM_CAMERA in drivers/media/video/msm/Kconfig file

Dependencies
============

PMIC, I2C, Clock, GPIO

User space utilities
====================

A daemon process in the user space called mm-qcamera-daemon is polling
on events from the driver. This daemon is required in order for the V4L2
client application to run, and it's started by the init script.

Other
=====

To do
=====

1. Eliminate creation of /dev/msm_camera/config0 by routing private
ioctls through /dev/video0.
2. Create sub devices for sensor and VFE.



--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--




             reply	other threads:[~2010-12-23 19:39 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-23 19:38 Shuzhen Wang [this message]
2010-12-24 11:19 ` RFC: V4L2 driver for Qualcomm MSM camera Hans Verkuil
2010-12-27  6:45   ` Shuzhen Wang
2010-12-27 12:11   ` Mauro Carvalho Chehab
2010-12-28 18:35     ` Shuzhen Wang
2010-12-28 20:23       ` Laurent Pinchart
2011-01-04  2:37         ` Shuzhen Wang
2011-01-04  6:14           ` Haibo Zhong
2011-01-04  8:46             ` Laurent Pinchart
2011-01-04 10:40               ` Hans Verkuil
2011-01-04 14:29                 ` Mauro Carvalho Chehab
2011-01-04 18:08                   ` Markus Rechberger
2011-01-04 19:37                     ` Yan, Yupeng
2011-01-05  0:15                       ` Laurent Pinchart
2011-01-07  0:03                         ` Yupeng Yan
2011-01-07 14:37                           ` Laurent Pinchart
2011-01-04  8:35           ` Laurent Pinchart
2011-01-04 11:30           ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='000601cba2d8$eaedcdc0$c0c96940$@org' \
    --to=shuzhenw@codeaurora.org \
    --cc=hzhong@codeaurora.org \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox