mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 02:34:01 +08:00
[media] Add support for M-5MOLS 8 Mega Pixel camera ISP
Add I2C/V4L2 subdev driver for M-5MOLS integrated image signal processor with 8 Mega Pixel sensor. Signed-off-by: HeungJun, Kim <riverful.kim@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
cf25220677
commit
bc125106f8
@ -757,6 +757,8 @@ config VIDEO_NOON010PC30
|
||||
---help---
|
||||
This driver supports NOON010PC30 CIF camera from Siliconfile
|
||||
|
||||
source "drivers/media/video/m5mols/Kconfig"
|
||||
|
||||
config VIDEO_OMAP3
|
||||
tristate "OMAP 3 Camera support (EXPERIMENTAL)"
|
||||
select OMAP_IOMMU
|
||||
|
@ -69,6 +69,7 @@ obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
|
||||
obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
|
||||
obj-$(CONFIG_VIDEO_SR030PC30) += sr030pc30.o
|
||||
obj-$(CONFIG_VIDEO_NOON010PC30) += noon010pc30.o
|
||||
obj-$(CONFIG_VIDEO_M5MOLS) += m5mols/
|
||||
|
||||
obj-$(CONFIG_SOC_CAMERA_IMX074) += imx074.o
|
||||
obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
|
||||
|
5
drivers/media/video/m5mols/Kconfig
Normal file
5
drivers/media/video/m5mols/Kconfig
Normal file
@ -0,0 +1,5 @@
|
||||
config VIDEO_M5MOLS
|
||||
tristate "Fujitsu M-5MOLS 8MP sensor support"
|
||||
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
|
||||
---help---
|
||||
This driver supports Fujitsu M-5MOLS camera sensor with ISP
|
3
drivers/media/video/m5mols/Makefile
Normal file
3
drivers/media/video/m5mols/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
m5mols-objs := m5mols_core.o m5mols_controls.o m5mols_capture.o
|
||||
|
||||
obj-$(CONFIG_VIDEO_M5MOLS) += m5mols.o
|
296
drivers/media/video/m5mols/m5mols.h
Normal file
296
drivers/media/video/m5mols/m5mols.h
Normal file
@ -0,0 +1,296 @@
|
||||
/*
|
||||
* Header for M-5MOLS 8M Pixel camera sensor with ISP
|
||||
*
|
||||
* Copyright (C) 2011 Samsung Electronics Co., Ltd.
|
||||
* Author: HeungJun Kim, riverful.kim@samsung.com
|
||||
*
|
||||
* Copyright (C) 2009 Samsung Electronics Co., Ltd.
|
||||
* Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef M5MOLS_H
|
||||
#define M5MOLS_H
|
||||
|
||||
#include <media/v4l2-subdev.h>
|
||||
#include "m5mols_reg.h"
|
||||
|
||||
extern int m5mols_debug;
|
||||
|
||||
#define to_m5mols(__sd) container_of(__sd, struct m5mols_info, sd)
|
||||
|
||||
#define to_sd(__ctrl) \
|
||||
(&container_of(__ctrl->handler, struct m5mols_info, handle)->sd)
|
||||
|
||||
enum m5mols_restype {
|
||||
M5MOLS_RESTYPE_MONITOR,
|
||||
M5MOLS_RESTYPE_CAPTURE,
|
||||
M5MOLS_RESTYPE_MAX,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct m5mols_resolution - structure for the resolution
|
||||
* @type: resolution type according to the pixel code
|
||||
* @width: width of the resolution
|
||||
* @height: height of the resolution
|
||||
* @reg: resolution preset register value
|
||||
*/
|
||||
struct m5mols_resolution {
|
||||
u8 reg;
|
||||
enum m5mols_restype type;
|
||||
u16 width;
|
||||
u16 height;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct m5mols_exif - structure for the EXIF information of M-5MOLS
|
||||
* @exposure_time: exposure time register value
|
||||
* @shutter_speed: speed of the shutter register value
|
||||
* @aperture: aperture register value
|
||||
* @exposure_bias: it calls also EV bias
|
||||
* @iso_speed: ISO register value
|
||||
* @flash: status register value of the flash
|
||||
* @sdr: status register value of the Subject Distance Range
|
||||
* @qval: not written exact meaning in document
|
||||
*/
|
||||
struct m5mols_exif {
|
||||
u32 exposure_time;
|
||||
u32 shutter_speed;
|
||||
u32 aperture;
|
||||
u32 brightness;
|
||||
u32 exposure_bias;
|
||||
u16 iso_speed;
|
||||
u16 flash;
|
||||
u16 sdr;
|
||||
u16 qval;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct m5mols_capture - Structure for the capture capability
|
||||
* @exif: EXIF information
|
||||
* @main: size in bytes of the main image
|
||||
* @thumb: size in bytes of the thumb image, if it was accompanied
|
||||
* @total: total size in bytes of the produced image
|
||||
*/
|
||||
struct m5mols_capture {
|
||||
struct m5mols_exif exif;
|
||||
u32 main;
|
||||
u32 thumb;
|
||||
u32 total;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct m5mols_scenemode - structure for the scenemode capability
|
||||
* @metering: metering light register value
|
||||
* @ev_bias: EV bias register value
|
||||
* @wb_mode: mode which means the WhiteBalance is Auto or Manual
|
||||
* @wb_preset: whitebalance preset register value in the Manual mode
|
||||
* @chroma_en: register value whether the Chroma capability is enabled or not
|
||||
* @chroma_lvl: chroma's level register value
|
||||
* @edge_en: register value Whether the Edge capability is enabled or not
|
||||
* @edge_lvl: edge's level register value
|
||||
* @af_range: Auto Focus's range
|
||||
* @fd_mode: Face Detection mode
|
||||
* @mcc: Multi-axis Color Conversion which means emotion color
|
||||
* @light: status of the Light
|
||||
* @flash: status of the Flash
|
||||
* @tone: Tone color which means Contrast
|
||||
* @iso: ISO register value
|
||||
* @capt_mode: Mode of the Image Stabilization while the camera capturing
|
||||
* @wdr: Wide Dynamic Range register value
|
||||
*
|
||||
* The each value according to each scenemode is recommended in the documents.
|
||||
*/
|
||||
struct m5mols_scenemode {
|
||||
u32 metering;
|
||||
u32 ev_bias;
|
||||
u32 wb_mode;
|
||||
u32 wb_preset;
|
||||
u32 chroma_en;
|
||||
u32 chroma_lvl;
|
||||
u32 edge_en;
|
||||
u32 edge_lvl;
|
||||
u32 af_range;
|
||||
u32 fd_mode;
|
||||
u32 mcc;
|
||||
u32 light;
|
||||
u32 flash;
|
||||
u32 tone;
|
||||
u32 iso;
|
||||
u32 capt_mode;
|
||||
u32 wdr;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct m5mols_version - firmware version information
|
||||
* @customer: customer information
|
||||
* @project: version of project information according to customer
|
||||
* @fw: firmware revision
|
||||
* @hw: hardware revision
|
||||
* @param: version of the parameter
|
||||
* @awb: Auto WhiteBalance algorithm version
|
||||
* @str: information about manufacturer and packaging vendor
|
||||
* @af: Auto Focus version
|
||||
*
|
||||
* The register offset starts the customer version at 0x0, and it ends
|
||||
* the awb version at 0x09. The customer, project information occupies 1 bytes
|
||||
* each. And also the fw, hw, param, awb each requires 2 bytes. The str is
|
||||
* unique string associated with firmware's version. It includes information
|
||||
* about manufacturer and the vendor of the sensor's packaging. The least
|
||||
* significant 2 bytes of the string indicate packaging manufacturer.
|
||||
*/
|
||||
#define VERSION_STRING_SIZE 22
|
||||
struct m5mols_version {
|
||||
u8 customer;
|
||||
u8 project;
|
||||
u16 fw;
|
||||
u16 hw;
|
||||
u16 param;
|
||||
u16 awb;
|
||||
u8 str[VERSION_STRING_SIZE];
|
||||
u8 af;
|
||||
};
|
||||
#define VERSION_SIZE sizeof(struct m5mols_version)
|
||||
|
||||
/**
|
||||
* struct m5mols_info - M-5MOLS driver data structure
|
||||
* @pdata: platform data
|
||||
* @sd: v4l-subdev instance
|
||||
* @pad: media pad
|
||||
* @ffmt: current fmt according to resolution type
|
||||
* @res_type: current resolution type
|
||||
* @code: current code
|
||||
* @irq_waitq: waitqueue for the capture
|
||||
* @work_irq: workqueue for the IRQ
|
||||
* @flags: state variable for the interrupt handler
|
||||
* @handle: control handler
|
||||
* @autoexposure: Auto Exposure control
|
||||
* @exposure: Exposure control
|
||||
* @autowb: Auto White Balance control
|
||||
* @colorfx: Color effect control
|
||||
* @saturation: Saturation control
|
||||
* @zoom: Zoom control
|
||||
* @ver: information of the version
|
||||
* @cap: the capture mode attributes
|
||||
* @power: current sensor's power status
|
||||
* @ctrl_sync: true means all controls of the sensor are initialized
|
||||
* @int_capture: true means the capture interrupt is issued once
|
||||
* @lock_ae: true means the Auto Exposure is locked
|
||||
* @lock_awb: true means the Aut WhiteBalance is locked
|
||||
* @resolution: register value for current resolution
|
||||
* @interrupt: register value for current interrupt status
|
||||
* @mode: register value for current operation mode
|
||||
* @mode_save: register value for current operation mode for saving
|
||||
* @set_power: optional power callback to the board code
|
||||
*/
|
||||
struct m5mols_info {
|
||||
const struct m5mols_platform_data *pdata;
|
||||
struct v4l2_subdev sd;
|
||||
struct media_pad pad;
|
||||
struct v4l2_mbus_framefmt ffmt[M5MOLS_RESTYPE_MAX];
|
||||
int res_type;
|
||||
enum v4l2_mbus_pixelcode code;
|
||||
wait_queue_head_t irq_waitq;
|
||||
struct work_struct work_irq;
|
||||
unsigned long flags;
|
||||
|
||||
struct v4l2_ctrl_handler handle;
|
||||
/* Autoexposure/exposure control cluster */
|
||||
struct {
|
||||
struct v4l2_ctrl *autoexposure;
|
||||
struct v4l2_ctrl *exposure;
|
||||
};
|
||||
struct v4l2_ctrl *autowb;
|
||||
struct v4l2_ctrl *colorfx;
|
||||
struct v4l2_ctrl *saturation;
|
||||
struct v4l2_ctrl *zoom;
|
||||
|
||||
struct m5mols_version ver;
|
||||
struct m5mols_capture cap;
|
||||
bool power;
|
||||
bool ctrl_sync;
|
||||
bool lock_ae;
|
||||
bool lock_awb;
|
||||
u8 resolution;
|
||||
u32 interrupt;
|
||||
u32 mode;
|
||||
u32 mode_save;
|
||||
int (*set_power)(struct device *dev, int on);
|
||||
};
|
||||
|
||||
#define ST_CAPT_IRQ 0
|
||||
|
||||
#define is_powered(__info) (__info->power)
|
||||
#define is_ctrl_synced(__info) (__info->ctrl_sync)
|
||||
#define is_available_af(__info) (__info->ver.af)
|
||||
#define is_code(__code, __type) (__code == m5mols_default_ffmt[__type].code)
|
||||
#define is_manufacturer(__info, __manufacturer) \
|
||||
(__info->ver.str[0] == __manufacturer[0] && \
|
||||
__info->ver.str[1] == __manufacturer[1])
|
||||
/*
|
||||
* I2C operation of the M-5MOLS
|
||||
*
|
||||
* The I2C read operation of the M-5MOLS requires 2 messages. The first
|
||||
* message sends the information about the command, command category, and total
|
||||
* message size. The second message is used to retrieve the data specifed in
|
||||
* the first message
|
||||
*
|
||||
* 1st message 2nd message
|
||||
* +-------+---+----------+-----+-------+ +------+------+------+------+
|
||||
* | size1 | R | category | cmd | size2 | | d[0] | d[1] | d[2] | d[3] |
|
||||
* +-------+---+----------+-----+-------+ +------+------+------+------+
|
||||
* - size1: message data size(5 in this case)
|
||||
* - size2: desired buffer size of the 2nd message
|
||||
* - d[0..3]: according to size2
|
||||
*
|
||||
* The I2C write operation needs just one message. The message includes
|
||||
* category, command, total size, and desired data.
|
||||
*
|
||||
* 1st message
|
||||
* +-------+---+----------+-----+------+------+------+------+
|
||||
* | size1 | W | category | cmd | d[0] | d[1] | d[2] | d[3] |
|
||||
* +-------+---+----------+-----+------+------+------+------+
|
||||
* - d[0..3]: according to size1
|
||||
*/
|
||||
int m5mols_read(struct v4l2_subdev *sd, u32 reg_comb, u32 *val);
|
||||
int m5mols_write(struct v4l2_subdev *sd, u32 reg_comb, u32 val);
|
||||
int m5mols_busy(struct v4l2_subdev *sd, u8 category, u8 cmd, u32 value);
|
||||
|
||||
/*
|
||||
* Mode operation of the M-5MOLS
|
||||
*
|
||||
* Changing the mode of the M-5MOLS is needed right executing order.
|
||||
* There are three modes(PARAMETER, MONITOR, CAPTURE) which can be changed
|
||||
* by user. There are various categories associated with each mode.
|
||||
*
|
||||
* +============================================================+
|
||||
* | mode | category |
|
||||
* +============================================================+
|
||||
* | FLASH | FLASH(only after Stand-by or Power-on) |
|
||||
* | SYSTEM | SYSTEM(only after sensor arm-booting) |
|
||||
* | PARAMETER | PARAMETER |
|
||||
* | MONITOR | MONITOR(preview), Auto Focus, Face Detection |
|
||||
* | CAPTURE | Single CAPTURE, Preview(recording) |
|
||||
* +============================================================+
|
||||
*
|
||||
* The available executing order between each modes are as follows:
|
||||
* PARAMETER <---> MONITOR <---> CAPTURE
|
||||
*/
|
||||
int m5mols_mode(struct m5mols_info *info, u32 mode);
|
||||
|
||||
int m5mols_enable_interrupt(struct v4l2_subdev *sd, u32 reg);
|
||||
int m5mols_sync_controls(struct m5mols_info *info);
|
||||
int m5mols_start_capture(struct m5mols_info *info);
|
||||
int m5mols_do_scenemode(struct m5mols_info *info, u32 mode);
|
||||
int m5mols_lock_3a(struct m5mols_info *info, bool lock);
|
||||
int m5mols_set_ctrl(struct v4l2_ctrl *ctrl);
|
||||
|
||||
/* The firmware function */
|
||||
int m5mols_update_fw(struct v4l2_subdev *sd,
|
||||
int (*set_power)(struct m5mols_info *, bool));
|
||||
|
||||
#endif /* M5MOLS_H */
|
191
drivers/media/video/m5mols/m5mols_capture.c
Normal file
191
drivers/media/video/m5mols/m5mols_capture.c
Normal file
@ -0,0 +1,191 @@
|
||||
/*
|
||||
* The Capture code for Fujitsu M-5MOLS ISP
|
||||
*
|
||||
* Copyright (C) 2011 Samsung Electronics Co., Ltd.
|
||||
* Author: HeungJun Kim, riverful.kim@samsung.com
|
||||
*
|
||||
* Copyright (C) 2009 Samsung Electronics Co., Ltd.
|
||||
* Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <linux/version.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
#include <media/v4l2-device.h>
|
||||
#include <media/v4l2-subdev.h>
|
||||
#include <media/m5mols.h>
|
||||
|
||||
#include "m5mols.h"
|
||||
#include "m5mols_reg.h"
|
||||
|
||||
static int m5mols_capture_error_handler(struct m5mols_info *info,
|
||||
int timeout)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Disable all interrupts and clear relevant interrupt staus bits */
|
||||
ret = m5mols_write(&info->sd, SYSTEM_INT_ENABLE,
|
||||
info->interrupt & ~(REG_INT_CAPTURE));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (timeout == 0)
|
||||
return -ETIMEDOUT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* m5mols_read_rational - I2C read of a rational number
|
||||
*
|
||||
* Read numerator and denominator from registers @addr_num and @addr_den
|
||||
* respectively and return the division result in @val.
|
||||
*/
|
||||
static int m5mols_read_rational(struct v4l2_subdev *sd, u32 addr_num,
|
||||
u32 addr_den, u32 *val)
|
||||
{
|
||||
u32 num, den;
|
||||
|
||||
int ret = m5mols_read(sd, addr_num, &num);
|
||||
if (!ret)
|
||||
ret = m5mols_read(sd, addr_den, &den);
|
||||
if (ret)
|
||||
return ret;
|
||||
*val = den == 0 ? 0 : num / den;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* m5mols_capture_info - Gather captured image information
|
||||
*
|
||||
* For now it gathers only EXIF information and file size.
|
||||
*/
|
||||
static int m5mols_capture_info(struct m5mols_info *info)
|
||||
{
|
||||
struct m5mols_exif *exif = &info->cap.exif;
|
||||
struct v4l2_subdev *sd = &info->sd;
|
||||
int ret;
|
||||
|
||||
ret = m5mols_read_rational(sd, EXIF_INFO_EXPTIME_NU,
|
||||
EXIF_INFO_EXPTIME_DE, &exif->exposure_time);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = m5mols_read_rational(sd, EXIF_INFO_TV_NU, EXIF_INFO_TV_DE,
|
||||
&exif->shutter_speed);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = m5mols_read_rational(sd, EXIF_INFO_AV_NU, EXIF_INFO_AV_DE,
|
||||
&exif->aperture);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = m5mols_read_rational(sd, EXIF_INFO_BV_NU, EXIF_INFO_BV_DE,
|
||||
&exif->brightness);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = m5mols_read_rational(sd, EXIF_INFO_EBV_NU, EXIF_INFO_EBV_DE,
|
||||
&exif->exposure_bias);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = m5mols_read(sd, EXIF_INFO_ISO, (u32 *)&exif->iso_speed);
|
||||
if (!ret)
|
||||
ret = m5mols_read(sd, EXIF_INFO_FLASH, (u32 *)&exif->flash);
|
||||
if (!ret)
|
||||
ret = m5mols_read(sd, EXIF_INFO_SDR, (u32 *)&exif->sdr);
|
||||
if (!ret)
|
||||
ret = m5mols_read(sd, EXIF_INFO_QVAL, (u32 *)&exif->qval);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (!ret)
|
||||
ret = m5mols_read(sd, CAPC_IMAGE_SIZE, &info->cap.main);
|
||||
if (!ret)
|
||||
ret = m5mols_read(sd, CAPC_THUMB_SIZE, &info->cap.thumb);
|
||||
if (!ret)
|
||||
info->cap.total = info->cap.main + info->cap.thumb;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int m5mols_start_capture(struct m5mols_info *info)
|
||||
{
|
||||
struct v4l2_subdev *sd = &info->sd;
|
||||
u32 resolution = info->resolution;
|
||||
int timeout;
|
||||
int ret;
|
||||
|
||||
/*
|
||||
* Preparing capture. Setting control & interrupt before entering
|
||||
* capture mode
|
||||
*
|
||||
* 1) change to MONITOR mode for operating control & interrupt
|
||||
* 2) set controls (considering v4l2_control value & lock 3A)
|
||||
* 3) set interrupt
|
||||
* 4) change to CAPTURE mode
|
||||
*/
|
||||
ret = m5mols_mode(info, REG_MONITOR);
|
||||
if (!ret)
|
||||
ret = m5mols_sync_controls(info);
|
||||
if (!ret)
|
||||
ret = m5mols_lock_3a(info, true);
|
||||
if (!ret)
|
||||
ret = m5mols_enable_interrupt(sd, REG_INT_CAPTURE);
|
||||
if (!ret)
|
||||
ret = m5mols_mode(info, REG_CAPTURE);
|
||||
if (!ret) {
|
||||
/* Wait for capture interrupt, after changing capture mode */
|
||||
timeout = wait_event_interruptible_timeout(info->irq_waitq,
|
||||
test_bit(ST_CAPT_IRQ, &info->flags),
|
||||
msecs_to_jiffies(2000));
|
||||
if (test_and_clear_bit(ST_CAPT_IRQ, &info->flags))
|
||||
ret = m5mols_capture_error_handler(info, timeout);
|
||||
}
|
||||
if (!ret)
|
||||
ret = m5mols_lock_3a(info, false);
|
||||
if (ret)
|
||||
return ret;
|
||||
/*
|
||||
* Starting capture. Setting capture frame count and resolution and
|
||||
* the format(available format: JPEG, Bayer RAW, YUV).
|
||||
*
|
||||
* 1) select single or multi(enable to 25), format, size
|
||||
* 2) set interrupt
|
||||
* 3) start capture(for main image, now)
|
||||
* 4) get information
|
||||
* 5) notify file size to v4l2 device(e.g, to s5p-fimc v4l2 device)
|
||||
*/
|
||||
ret = m5mols_write(sd, CAPC_SEL_FRAME, 1);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPP_YUVOUT_MAIN, REG_JPEG);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPP_MAIN_IMAGE_SIZE, resolution);
|
||||
if (!ret)
|
||||
ret = m5mols_enable_interrupt(sd, REG_INT_CAPTURE);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPC_START, REG_CAP_START_MAIN);
|
||||
if (!ret) {
|
||||
/* Wait for the capture completion interrupt */
|
||||
timeout = wait_event_interruptible_timeout(info->irq_waitq,
|
||||
test_bit(ST_CAPT_IRQ, &info->flags),
|
||||
msecs_to_jiffies(2000));
|
||||
if (test_and_clear_bit(ST_CAPT_IRQ, &info->flags)) {
|
||||
ret = m5mols_capture_info(info);
|
||||
if (!ret)
|
||||
v4l2_subdev_notify(sd, 0, &info->cap.total);
|
||||
}
|
||||
}
|
||||
|
||||
return m5mols_capture_error_handler(info, timeout);
|
||||
}
|
299
drivers/media/video/m5mols/m5mols_controls.c
Normal file
299
drivers/media/video/m5mols/m5mols_controls.c
Normal file
@ -0,0 +1,299 @@
|
||||
/*
|
||||
* Controls for M-5MOLS 8M Pixel camera sensor with ISP
|
||||
*
|
||||
* Copyright (C) 2011 Samsung Electronics Co., Ltd.
|
||||
* Author: HeungJun Kim, riverful.kim@samsung.com
|
||||
*
|
||||
* Copyright (C) 2009 Samsung Electronics Co., Ltd.
|
||||
* Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/videodev2.h>
|
||||
#include <media/v4l2-ctrls.h>
|
||||
|
||||
#include "m5mols.h"
|
||||
#include "m5mols_reg.h"
|
||||
|
||||
static struct m5mols_scenemode m5mols_default_scenemode[] = {
|
||||
[REG_SCENE_NORMAL] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_NORMAL, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
5, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_PORTRAIT] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 4,
|
||||
REG_AF_NORMAL, BIT_FD_EN | BIT_FD_DRAW_FACE_FRAME,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_LANDSCAPE] = {
|
||||
REG_AE_ALL, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 4, REG_EDGE_ON, 6,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_SPORTS] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_PARTY_INDOOR] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 4, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_200, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_BEACH_SNOW] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_10_POS, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 4, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_50, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_SUNSET] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_PRESET,
|
||||
REG_AWB_DAYLIGHT,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_DAWN_DUSK] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_PRESET,
|
||||
REG_AWB_FLUORESCENT_1,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_FALL] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 5, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_NIGHT] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_AGAINST_LIGHT] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_FIRE] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_50, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
[REG_SCENE_TEXT] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 7,
|
||||
REG_AF_MACRO, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_ANTI_SHAKE, REG_WDR_ON,
|
||||
},
|
||||
[REG_SCENE_CANDLE] = {
|
||||
REG_AE_CENTER, REG_AE_INDEX_00, REG_AWB_AUTO, 0,
|
||||
REG_CHROMA_ON, 3, REG_EDGE_ON, 5,
|
||||
REG_AF_NORMAL, REG_FD_OFF,
|
||||
REG_MCC_OFF, REG_LIGHT_OFF, REG_FLASH_OFF,
|
||||
6, REG_ISO_AUTO, REG_CAP_NONE, REG_WDR_OFF,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* m5mols_do_scenemode() - Change current scenemode
|
||||
* @mode: Desired mode of the scenemode
|
||||
*
|
||||
* WARNING: The execution order is important. Do not change the order.
|
||||
*/
|
||||
int m5mols_do_scenemode(struct m5mols_info *info, u32 mode)
|
||||
{
|
||||
struct v4l2_subdev *sd = &info->sd;
|
||||
struct m5mols_scenemode scenemode = m5mols_default_scenemode[mode];
|
||||
int ret;
|
||||
|
||||
if (mode > REG_SCENE_CANDLE)
|
||||
return -EINVAL;
|
||||
|
||||
ret = m5mols_lock_3a(info, false);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_EV_PRESET_MONITOR, mode);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_EV_PRESET_CAPTURE, mode);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_MODE, scenemode.metering);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_INDEX, scenemode.ev_bias);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AWB_MODE, scenemode.wb_mode);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AWB_MANUAL, scenemode.wb_preset);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_CHROMA_EN, scenemode.chroma_en);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_CHROMA_LVL, scenemode.chroma_lvl);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_EDGE_EN, scenemode.edge_en);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_EDGE_LVL, scenemode.edge_lvl);
|
||||
if (!ret && is_available_af(info))
|
||||
ret = m5mols_write(sd, AF_MODE, scenemode.af_range);
|
||||
if (!ret && is_available_af(info))
|
||||
ret = m5mols_write(sd, FD_CTL, scenemode.fd_mode);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_TONE_CTL, scenemode.tone);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_ISO, scenemode.iso);
|
||||
if (!ret)
|
||||
ret = m5mols_mode(info, REG_CAPTURE);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPP_WDR_EN, scenemode.wdr);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPP_MCC_MODE, scenemode.mcc);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPP_LIGHT_CTRL, scenemode.light);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPP_FLASH_CTRL, scenemode.flash);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, CAPC_MODE, scenemode.capt_mode);
|
||||
if (!ret)
|
||||
ret = m5mols_mode(info, REG_MONITOR);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int m5mols_lock_ae(struct m5mols_info *info, bool lock)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (info->lock_ae != lock)
|
||||
ret = m5mols_write(&info->sd, AE_LOCK,
|
||||
lock ? REG_AE_LOCK : REG_AE_UNLOCK);
|
||||
if (!ret)
|
||||
info->lock_ae = lock;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int m5mols_lock_awb(struct m5mols_info *info, bool lock)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (info->lock_awb != lock)
|
||||
ret = m5mols_write(&info->sd, AWB_LOCK,
|
||||
lock ? REG_AWB_LOCK : REG_AWB_UNLOCK);
|
||||
if (!ret)
|
||||
info->lock_awb = lock;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* m5mols_lock_3a() - Lock 3A(Auto Exposure, Auto Whitebalance, Auto Focus) */
|
||||
int m5mols_lock_3a(struct m5mols_info *info, bool lock)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = m5mols_lock_ae(info, lock);
|
||||
if (!ret)
|
||||
ret = m5mols_lock_awb(info, lock);
|
||||
/* Don't need to handle unlocking AF */
|
||||
if (!ret && is_available_af(info) && lock)
|
||||
ret = m5mols_write(&info->sd, AF_EXECUTE, REG_AF_STOP);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* m5mols_set_ctrl() - The main s_ctrl function called by m5mols_set_ctrl() */
|
||||
int m5mols_set_ctrl(struct v4l2_ctrl *ctrl)
|
||||
{
|
||||
struct v4l2_subdev *sd = to_sd(ctrl);
|
||||
struct m5mols_info *info = to_m5mols(sd);
|
||||
int ret;
|
||||
|
||||
switch (ctrl->id) {
|
||||
case V4L2_CID_ZOOM_ABSOLUTE:
|
||||
return m5mols_write(sd, MON_ZOOM, ctrl->val);
|
||||
|
||||
case V4L2_CID_EXPOSURE_AUTO:
|
||||
ret = m5mols_lock_ae(info,
|
||||
ctrl->val == V4L2_EXPOSURE_AUTO ? false : true);
|
||||
if (!ret && ctrl->val == V4L2_EXPOSURE_AUTO)
|
||||
ret = m5mols_write(sd, AE_MODE, REG_AE_ALL);
|
||||
if (!ret && ctrl->val == V4L2_EXPOSURE_MANUAL) {
|
||||
int val = info->exposure->val;
|
||||
ret = m5mols_write(sd, AE_MODE, REG_AE_OFF);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_MAN_GAIN_MON, val);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AE_MAN_GAIN_CAP, val);
|
||||
}
|
||||
return ret;
|
||||
|
||||
case V4L2_CID_AUTO_WHITE_BALANCE:
|
||||
ret = m5mols_lock_awb(info, ctrl->val ? false : true);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, AWB_MODE, ctrl->val ?
|
||||
REG_AWB_AUTO : REG_AWB_PRESET);
|
||||
return ret;
|
||||
|
||||
case V4L2_CID_SATURATION:
|
||||
ret = m5mols_write(sd, MON_CHROMA_LVL, ctrl->val);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_CHROMA_EN, REG_CHROMA_ON);
|
||||
return ret;
|
||||
|
||||
case V4L2_CID_COLORFX:
|
||||
/*
|
||||
* This control uses two kinds of registers: normal & color.
|
||||
* The normal effect belongs to category 1, while the color
|
||||
* one belongs to category 2.
|
||||
*
|
||||
* The normal effect uses one register: CAT1_EFFECT.
|
||||
* The color effect uses three registers:
|
||||
* CAT2_COLOR_EFFECT, CAT2_CFIXR, CAT2_CFIXB.
|
||||
*/
|
||||
ret = m5mols_write(sd, PARM_EFFECT,
|
||||
ctrl->val == V4L2_COLORFX_NEGATIVE ? REG_EFFECT_NEGA :
|
||||
ctrl->val == V4L2_COLORFX_EMBOSS ? REG_EFFECT_EMBOSS :
|
||||
REG_EFFECT_OFF);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_EFFECT,
|
||||
ctrl->val == V4L2_COLORFX_SEPIA ?
|
||||
REG_COLOR_EFFECT_ON : REG_COLOR_EFFECT_OFF);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_CFIXR,
|
||||
ctrl->val == V4L2_COLORFX_SEPIA ?
|
||||
REG_CFIXR_SEPIA : 0);
|
||||
if (!ret)
|
||||
ret = m5mols_write(sd, MON_CFIXB,
|
||||
ctrl->val == V4L2_COLORFX_SEPIA ?
|
||||
REG_CFIXB_SEPIA : 0);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return -EINVAL;
|
||||
}
|
1004
drivers/media/video/m5mols/m5mols_core.c
Normal file
1004
drivers/media/video/m5mols/m5mols_core.c
Normal file
File diff suppressed because it is too large
Load Diff
399
drivers/media/video/m5mols/m5mols_reg.h
Normal file
399
drivers/media/video/m5mols/m5mols_reg.h
Normal file
@ -0,0 +1,399 @@
|
||||
/*
|
||||
* Register map for M-5MOLS 8M Pixel camera sensor with ISP
|
||||
*
|
||||
* Copyright (C) 2011 Samsung Electronics Co., Ltd.
|
||||
* Author: HeungJun Kim, riverful.kim@samsung.com
|
||||
*
|
||||
* Copyright (C) 2009 Samsung Electronics Co., Ltd.
|
||||
* Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef M5MOLS_REG_H
|
||||
#define M5MOLS_REG_H
|
||||
|
||||
#define M5MOLS_I2C_MAX_SIZE 4
|
||||
#define M5MOLS_BYTE_READ 0x01
|
||||
#define M5MOLS_BYTE_WRITE 0x02
|
||||
|
||||
#define I2C_CATEGORY(__cat) ((__cat >> 16) & 0xff)
|
||||
#define I2C_COMMAND(__comm) ((__comm >> 8) & 0xff)
|
||||
#define I2C_SIZE(__reg_s) ((__reg_s) & 0xff)
|
||||
#define I2C_REG(__cat, __cmd, __reg_s) ((__cat << 16) | (__cmd << 8) | __reg_s)
|
||||
|
||||
/*
|
||||
* Category section register
|
||||
*
|
||||
* The category means set including relevant command of M-5MOLS.
|
||||
*/
|
||||
#define CAT_SYSTEM 0x00
|
||||
#define CAT_PARAM 0x01
|
||||
#define CAT_MONITOR 0x02
|
||||
#define CAT_AE 0x03
|
||||
#define CAT_WB 0x06
|
||||
#define CAT_EXIF 0x07
|
||||
#define CAT_FD 0x09
|
||||
#define CAT_LENS 0x0a
|
||||
#define CAT_CAPT_PARM 0x0b
|
||||
#define CAT_CAPT_CTRL 0x0c
|
||||
#define CAT_FLASH 0x0f /* related to FW, revisions, booting */
|
||||
|
||||
/*
|
||||
* Category 0 - SYSTEM mode
|
||||
*
|
||||
* The SYSTEM mode in the M-5MOLS means area available to handle with the whole
|
||||
* & all-round system of sensor. It deals with version/interrupt/setting mode &
|
||||
* even sensor's status. Especially, the M-5MOLS sensor with ISP varies by
|
||||
* packaging & manufacturer, even the customer and project code. And the
|
||||
* function details may vary among them. The version information helps to
|
||||
* determine what methods shall be used in the driver.
|
||||
*
|
||||
* There is many registers between customer version address and awb one. For
|
||||
* more specific contents, see definition if file m5mols.h.
|
||||
*/
|
||||
#define CAT0_VER_CUSTOMER 0x00 /* customer version */
|
||||
#define CAT0_VER_AWB 0x09 /* Auto WB version */
|
||||
#define CAT0_VER_STRING 0x0a /* string including M-5MOLS */
|
||||
#define CAT0_SYSMODE 0x0b /* SYSTEM mode register */
|
||||
#define CAT0_STATUS 0x0c /* SYSTEM mode status register */
|
||||
#define CAT0_INT_FACTOR 0x10 /* interrupt pending register */
|
||||
#define CAT0_INT_ENABLE 0x11 /* interrupt enable register */
|
||||
|
||||
#define SYSTEM_SYSMODE I2C_REG(CAT_SYSTEM, CAT0_SYSMODE, 1)
|
||||
#define REG_SYSINIT 0x00 /* SYSTEM mode */
|
||||
#define REG_PARAMETER 0x01 /* PARAMETER mode */
|
||||
#define REG_MONITOR 0x02 /* MONITOR mode */
|
||||
#define REG_CAPTURE 0x03 /* CAPTURE mode */
|
||||
|
||||
#define SYSTEM_CMD(__cmd) I2C_REG(CAT_SYSTEM, cmd, 1)
|
||||
#define SYSTEM_VER_STRING I2C_REG(CAT_SYSTEM, CAT0_VER_STRING, 1)
|
||||
#define REG_SAMSUNG_ELECTRO "SE" /* Samsung Electro-Mechanics */
|
||||
#define REG_SAMSUNG_OPTICS "OP" /* Samsung Fiber-Optics */
|
||||
#define REG_SAMSUNG_TECHWIN "TB" /* Samsung Techwin */
|
||||
|
||||
#define SYSTEM_INT_FACTOR I2C_REG(CAT_SYSTEM, CAT0_INT_FACTOR, 1)
|
||||
#define SYSTEM_INT_ENABLE I2C_REG(CAT_SYSTEM, CAT0_INT_ENABLE, 1)
|
||||
#define REG_INT_MODE (1 << 0)
|
||||
#define REG_INT_AF (1 << 1)
|
||||
#define REG_INT_ZOOM (1 << 2)
|
||||
#define REG_INT_CAPTURE (1 << 3)
|
||||
#define REG_INT_FRAMESYNC (1 << 4)
|
||||
#define REG_INT_FD (1 << 5)
|
||||
#define REG_INT_LENS_INIT (1 << 6)
|
||||
#define REG_INT_SOUND (1 << 7)
|
||||
#define REG_INT_MASK 0x0f
|
||||
|
||||
/*
|
||||
* category 1 - PARAMETER mode
|
||||
*
|
||||
* This category supports function of camera features of M-5MOLS. It means we
|
||||
* can handle with preview(MONITOR) resolution size/frame per second/interface
|
||||
* between the sensor and the Application Processor/even the image effect.
|
||||
*/
|
||||
#define CAT1_DATA_INTERFACE 0x00 /* interface between sensor and AP */
|
||||
#define CAT1_MONITOR_SIZE 0x01 /* resolution at the MONITOR mode */
|
||||
#define CAT1_MONITOR_FPS 0x02 /* frame per second at this mode */
|
||||
#define CAT1_EFFECT 0x0b /* image effects */
|
||||
|
||||
#define PARM_MON_SIZE I2C_REG(CAT_PARAM, CAT1_MONITOR_SIZE, 1)
|
||||
|
||||
#define PARM_MON_FPS I2C_REG(CAT_PARAM, CAT1_MONITOR_FPS, 1)
|
||||
#define REG_FPS_30 0x02
|
||||
|
||||
#define PARM_INTERFACE I2C_REG(CAT_PARAM, CAT1_DATA_INTERFACE, 1)
|
||||
#define REG_INTERFACE_MIPI 0x02
|
||||
|
||||
#define PARM_EFFECT I2C_REG(CAT_PARAM, CAT1_EFFECT, 1)
|
||||
#define REG_EFFECT_OFF 0x00
|
||||
#define REG_EFFECT_NEGA 0x01
|
||||
#define REG_EFFECT_EMBOSS 0x06
|
||||
#define REG_EFFECT_OUTLINE 0x07
|
||||
#define REG_EFFECT_WATERCOLOR 0x08
|
||||
|
||||
/*
|
||||
* Category 2 - MONITOR mode
|
||||
*
|
||||
* The MONITOR mode is same as preview mode as we said. The M-5MOLS has another
|
||||
* mode named "Preview", but this preview mode is used at the case specific
|
||||
* vider-recording mode. This mmode supports only YUYV format. On the other
|
||||
* hand, the JPEG & RAW formats is supports by CAPTURE mode. And, there are
|
||||
* another options like zoom/color effect(different with effect in PARAMETER
|
||||
* mode)/anti hand shaking algorithm.
|
||||
*/
|
||||
#define CAT2_ZOOM 0x01 /* set the zoom position & execute */
|
||||
#define CAT2_ZOOM_STEP 0x03 /* set the zoom step */
|
||||
#define CAT2_CFIXB 0x09 /* CB value for color effect */
|
||||
#define CAT2_CFIXR 0x0a /* CR value for color effect */
|
||||
#define CAT2_COLOR_EFFECT 0x0b /* set on/off of color effect */
|
||||
#define CAT2_CHROMA_LVL 0x0f /* set chroma level */
|
||||
#define CAT2_CHROMA_EN 0x10 /* set on/off of choroma */
|
||||
#define CAT2_EDGE_LVL 0x11 /* set sharpness level */
|
||||
#define CAT2_EDGE_EN 0x12 /* set on/off sharpness */
|
||||
#define CAT2_TONE_CTL 0x25 /* set tone color(contrast) */
|
||||
|
||||
#define MON_ZOOM I2C_REG(CAT_MONITOR, CAT2_ZOOM, 1)
|
||||
|
||||
#define MON_CFIXR I2C_REG(CAT_MONITOR, CAT2_CFIXR, 1)
|
||||
#define MON_CFIXB I2C_REG(CAT_MONITOR, CAT2_CFIXB, 1)
|
||||
#define REG_CFIXB_SEPIA 0xd8
|
||||
#define REG_CFIXR_SEPIA 0x18
|
||||
|
||||
#define MON_EFFECT I2C_REG(CAT_MONITOR, CAT2_COLOR_EFFECT, 1)
|
||||
#define REG_COLOR_EFFECT_OFF 0x00
|
||||
#define REG_COLOR_EFFECT_ON 0x01
|
||||
|
||||
#define MON_CHROMA_EN I2C_REG(CAT_MONITOR, CAT2_CHROMA_EN, 1)
|
||||
#define MON_CHROMA_LVL I2C_REG(CAT_MONITOR, CAT2_CHROMA_LVL, 1)
|
||||
#define REG_CHROMA_OFF 0x00
|
||||
#define REG_CHROMA_ON 0x01
|
||||
|
||||
#define MON_EDGE_EN I2C_REG(CAT_MONITOR, CAT2_EDGE_EN, 1)
|
||||
#define MON_EDGE_LVL I2C_REG(CAT_MONITOR, CAT2_EDGE_LVL, 1)
|
||||
#define REG_EDGE_OFF 0x00
|
||||
#define REG_EDGE_ON 0x01
|
||||
|
||||
#define MON_TONE_CTL I2C_REG(CAT_MONITOR, CAT2_TONE_CTL, 1)
|
||||
|
||||
/*
|
||||
* Category 3 - Auto Exposure
|
||||
*
|
||||
* The M-5MOLS exposure capbility is detailed as which is similar to digital
|
||||
* camera. This category supports AE locking/various AE mode(range of exposure)
|
||||
* /ISO/flickering/EV bias/shutter/meteoring, and anything else. And the
|
||||
* maximum/minimum exposure gain value depending on M-5MOLS firmware, may be
|
||||
* different. So, this category also provide getting the max/min values. And,
|
||||
* each MONITOR and CAPTURE mode has each gain/shutter/max exposure values.
|
||||
*/
|
||||
#define CAT3_AE_LOCK 0x00 /* locking Auto exposure */
|
||||
#define CAT3_AE_MODE 0x01 /* set AE mode, mode means range */
|
||||
#define CAT3_ISO 0x05 /* set ISO */
|
||||
#define CAT3_EV_PRESET_MONITOR 0x0a /* EV(scenemode) preset for MONITOR */
|
||||
#define CAT3_EV_PRESET_CAPTURE 0x0b /* EV(scenemode) preset for CAPTURE */
|
||||
#define CAT3_MANUAL_GAIN_MON 0x12 /* meteoring value for the MONITOR */
|
||||
#define CAT3_MAX_GAIN_MON 0x1a /* max gain value for the MONITOR */
|
||||
#define CAT3_MANUAL_GAIN_CAP 0x26 /* meteoring value for the CAPTURE */
|
||||
#define CAT3_AE_INDEX 0x38 /* AE index */
|
||||
|
||||
#define AE_LOCK I2C_REG(CAT_AE, CAT3_AE_LOCK, 1)
|
||||
#define REG_AE_UNLOCK 0x00
|
||||
#define REG_AE_LOCK 0x01
|
||||
|
||||
#define AE_MODE I2C_REG(CAT_AE, CAT3_AE_MODE, 1)
|
||||
#define REG_AE_OFF 0x00 /* AE off */
|
||||
#define REG_AE_ALL 0x01 /* calc AE in all block integral */
|
||||
#define REG_AE_CENTER 0x03 /* calc AE in center weighted */
|
||||
#define REG_AE_SPOT 0x06 /* calc AE in specific spot */
|
||||
|
||||
#define AE_ISO I2C_REG(CAT_AE, CAT3_ISO, 1)
|
||||
#define REG_ISO_AUTO 0x00
|
||||
#define REG_ISO_50 0x01
|
||||
#define REG_ISO_100 0x02
|
||||
#define REG_ISO_200 0x03
|
||||
#define REG_ISO_400 0x04
|
||||
#define REG_ISO_800 0x05
|
||||
|
||||
#define AE_EV_PRESET_MONITOR I2C_REG(CAT_AE, CAT3_EV_PRESET_MONITOR, 1)
|
||||
#define AE_EV_PRESET_CAPTURE I2C_REG(CAT_AE, CAT3_EV_PRESET_CAPTURE, 1)
|
||||
#define REG_SCENE_NORMAL 0x00
|
||||
#define REG_SCENE_PORTRAIT 0x01
|
||||
#define REG_SCENE_LANDSCAPE 0x02
|
||||
#define REG_SCENE_SPORTS 0x03
|
||||
#define REG_SCENE_PARTY_INDOOR 0x04
|
||||
#define REG_SCENE_BEACH_SNOW 0x05
|
||||
#define REG_SCENE_SUNSET 0x06
|
||||
#define REG_SCENE_DAWN_DUSK 0x07
|
||||
#define REG_SCENE_FALL 0x08
|
||||
#define REG_SCENE_NIGHT 0x09
|
||||
#define REG_SCENE_AGAINST_LIGHT 0x0a
|
||||
#define REG_SCENE_FIRE 0x0b
|
||||
#define REG_SCENE_TEXT 0x0c
|
||||
#define REG_SCENE_CANDLE 0x0d
|
||||
|
||||
#define AE_MAN_GAIN_MON I2C_REG(CAT_AE, CAT3_MANUAL_GAIN_MON, 2)
|
||||
#define AE_MAX_GAIN_MON I2C_REG(CAT_AE, CAT3_MAX_GAIN_MON, 2)
|
||||
#define AE_MAN_GAIN_CAP I2C_REG(CAT_AE, CAT3_MANUAL_GAIN_CAP, 2)
|
||||
|
||||
#define AE_INDEX I2C_REG(CAT_AE, CAT3_AE_INDEX, 1)
|
||||
#define REG_AE_INDEX_20_NEG 0x00
|
||||
#define REG_AE_INDEX_15_NEG 0x01
|
||||
#define REG_AE_INDEX_10_NEG 0x02
|
||||
#define REG_AE_INDEX_05_NEG 0x03
|
||||
#define REG_AE_INDEX_00 0x04
|
||||
#define REG_AE_INDEX_05_POS 0x05
|
||||
#define REG_AE_INDEX_10_POS 0x06
|
||||
#define REG_AE_INDEX_15_POS 0x07
|
||||
#define REG_AE_INDEX_20_POS 0x08
|
||||
|
||||
/*
|
||||
* Category 6 - White Balance
|
||||
*
|
||||
* This category provide AWB locking/mode/preset/speed/gain bias, etc.
|
||||
*/
|
||||
#define CAT6_AWB_LOCK 0x00 /* locking Auto Whitebalance */
|
||||
#define CAT6_AWB_MODE 0x02 /* set Auto or Manual */
|
||||
#define CAT6_AWB_MANUAL 0x03 /* set Manual(preset) value */
|
||||
|
||||
#define AWB_LOCK I2C_REG(CAT_WB, CAT6_AWB_LOCK, 1)
|
||||
#define REG_AWB_UNLOCK 0x00
|
||||
#define REG_AWB_LOCK 0x01
|
||||
|
||||
#define AWB_MODE I2C_REG(CAT_WB, CAT6_AWB_MODE, 1)
|
||||
#define REG_AWB_AUTO 0x01 /* AWB off */
|
||||
#define REG_AWB_PRESET 0x02 /* AWB preset */
|
||||
|
||||
#define AWB_MANUAL I2C_REG(CAT_WB, CAT6_AWB_MANUAL, 1)
|
||||
#define REG_AWB_INCANDESCENT 0x01
|
||||
#define REG_AWB_FLUORESCENT_1 0x02
|
||||
#define REG_AWB_FLUORESCENT_2 0x03
|
||||
#define REG_AWB_DAYLIGHT 0x04
|
||||
#define REG_AWB_CLOUDY 0x05
|
||||
#define REG_AWB_SHADE 0x06
|
||||
#define REG_AWB_HORIZON 0x07
|
||||
#define REG_AWB_LEDLIGHT 0x09
|
||||
|
||||
/*
|
||||
* Category 7 - EXIF information
|
||||
*/
|
||||
#define CAT7_INFO_EXPTIME_NU 0x00
|
||||
#define CAT7_INFO_EXPTIME_DE 0x04
|
||||
#define CAT7_INFO_TV_NU 0x08
|
||||
#define CAT7_INFO_TV_DE 0x0c
|
||||
#define CAT7_INFO_AV_NU 0x10
|
||||
#define CAT7_INFO_AV_DE 0x14
|
||||
#define CAT7_INFO_BV_NU 0x18
|
||||
#define CAT7_INFO_BV_DE 0x1c
|
||||
#define CAT7_INFO_EBV_NU 0x20
|
||||
#define CAT7_INFO_EBV_DE 0x24
|
||||
#define CAT7_INFO_ISO 0x28
|
||||
#define CAT7_INFO_FLASH 0x2a
|
||||
#define CAT7_INFO_SDR 0x2c
|
||||
#define CAT7_INFO_QVAL 0x2e
|
||||
|
||||
#define EXIF_INFO_EXPTIME_NU I2C_REG(CAT_EXIF, CAT7_INFO_EXPTIME_NU, 4)
|
||||
#define EXIF_INFO_EXPTIME_DE I2C_REG(CAT_EXIF, CAT7_INFO_EXPTIME_DE, 4)
|
||||
#define EXIF_INFO_TV_NU I2C_REG(CAT_EXIF, CAT7_INFO_TV_NU, 4)
|
||||
#define EXIF_INFO_TV_DE I2C_REG(CAT_EXIF, CAT7_INFO_TV_DE, 4)
|
||||
#define EXIF_INFO_AV_NU I2C_REG(CAT_EXIF, CAT7_INFO_AV_NU, 4)
|
||||
#define EXIF_INFO_AV_DE I2C_REG(CAT_EXIF, CAT7_INFO_AV_DE, 4)
|
||||
#define EXIF_INFO_BV_NU I2C_REG(CAT_EXIF, CAT7_INFO_BV_NU, 4)
|
||||
#define EXIF_INFO_BV_DE I2C_REG(CAT_EXIF, CAT7_INFO_BV_DE, 4)
|
||||
#define EXIF_INFO_EBV_NU I2C_REG(CAT_EXIF, CAT7_INFO_EBV_NU, 4)
|
||||
#define EXIF_INFO_EBV_DE I2C_REG(CAT_EXIF, CAT7_INFO_EBV_DE, 4)
|
||||
#define EXIF_INFO_ISO I2C_REG(CAT_EXIF, CAT7_INFO_ISO, 2)
|
||||
#define EXIF_INFO_FLASH I2C_REG(CAT_EXIF, CAT7_INFO_FLASH, 2)
|
||||
#define EXIF_INFO_SDR I2C_REG(CAT_EXIF, CAT7_INFO_SDR, 2)
|
||||
#define EXIF_INFO_QVAL I2C_REG(CAT_EXIF, CAT7_INFO_QVAL, 2)
|
||||
|
||||
/*
|
||||
* Category 9 - Face Detection
|
||||
*/
|
||||
#define CAT9_FD_CTL 0x00
|
||||
|
||||
#define FD_CTL I2C_REG(CAT_FD, CAT9_FD_CTL, 1)
|
||||
#define BIT_FD_EN 0
|
||||
#define BIT_FD_DRAW_FACE_FRAME 4
|
||||
#define BIT_FD_DRAW_SMILE_LVL 6
|
||||
#define REG_FD(shift) (1 << shift)
|
||||
#define REG_FD_OFF 0x0
|
||||
|
||||
/*
|
||||
* Category A - Lens Parameter
|
||||
*/
|
||||
#define CATA_AF_MODE 0x01
|
||||
#define CATA_AF_EXECUTE 0x02
|
||||
#define CATA_AF_STATUS 0x03
|
||||
#define CATA_AF_VERSION 0x0a
|
||||
|
||||
#define AF_MODE I2C_REG(CAT_LENS, CATA_AF_MODE, 1)
|
||||
#define REG_AF_NORMAL 0x00 /* Normal AF, one time */
|
||||
#define REG_AF_MACRO 0x01 /* Macro AF, one time */
|
||||
#define REG_AF_POWEROFF 0x07
|
||||
|
||||
#define AF_EXECUTE I2C_REG(CAT_LENS, CATA_AF_EXECUTE, 1)
|
||||
#define REG_AF_STOP 0x00
|
||||
#define REG_AF_EXE_AUTO 0x01
|
||||
#define REG_AF_EXE_CAF 0x02
|
||||
|
||||
#define AF_STATUS I2C_REG(CAT_LENS, CATA_AF_STATUS, 1)
|
||||
#define REG_AF_FAIL 0x00
|
||||
#define REG_AF_SUCCESS 0x02
|
||||
#define REG_AF_IDLE 0x04
|
||||
#define REG_AF_BUSY 0x05
|
||||
|
||||
#define AF_VERSION I2C_REG(CAT_LENS, CATA_AF_VERSION, 1)
|
||||
|
||||
/*
|
||||
* Category B - CAPTURE Parameter
|
||||
*/
|
||||
#define CATB_YUVOUT_MAIN 0x00
|
||||
#define CATB_MAIN_IMAGE_SIZE 0x01
|
||||
#define CATB_MCC_MODE 0x1d
|
||||
#define CATB_WDR_EN 0x2c
|
||||
#define CATB_LIGHT_CTRL 0x40
|
||||
#define CATB_FLASH_CTRL 0x41
|
||||
|
||||
#define CAPP_YUVOUT_MAIN I2C_REG(CAT_CAPT_PARM, CATB_YUVOUT_MAIN, 1)
|
||||
#define REG_YUV422 0x00
|
||||
#define REG_BAYER10 0x05
|
||||
#define REG_BAYER8 0x06
|
||||
#define REG_JPEG 0x10
|
||||
|
||||
#define CAPP_MAIN_IMAGE_SIZE I2C_REG(CAT_CAPT_PARM, CATB_MAIN_IMAGE_SIZE, 1)
|
||||
|
||||
#define CAPP_MCC_MODE I2C_REG(CAT_CAPT_PARM, CATB_MCC_MODE, 1)
|
||||
#define REG_MCC_OFF 0x00
|
||||
#define REG_MCC_NORMAL 0x01
|
||||
|
||||
#define CAPP_WDR_EN I2C_REG(CAT_CAPT_PARM, CATB_WDR_EN, 1)
|
||||
#define REG_WDR_OFF 0x00
|
||||
#define REG_WDR_ON 0x01
|
||||
#define REG_WDR_AUTO 0x02
|
||||
|
||||
#define CAPP_LIGHT_CTRL I2C_REG(CAT_CAPT_PARM, CATB_LIGHT_CTRL, 1)
|
||||
#define REG_LIGHT_OFF 0x00
|
||||
#define REG_LIGHT_ON 0x01
|
||||
#define REG_LIGHT_AUTO 0x02
|
||||
|
||||
#define CAPP_FLASH_CTRL I2C_REG(CAT_CAPT_PARM, CATB_FLASH_CTRL, 1)
|
||||
#define REG_FLASH_OFF 0x00
|
||||
#define REG_FLASH_ON 0x01
|
||||
#define REG_FLASH_AUTO 0x02
|
||||
|
||||
/*
|
||||
* Category C - CAPTURE Control
|
||||
*/
|
||||
#define CATC_CAP_MODE 0x00
|
||||
#define CATC_CAP_SEL_FRAME 0x06 /* It determines Single or Multi */
|
||||
#define CATC_CAP_START 0x09
|
||||
#define CATC_CAP_IMAGE_SIZE 0x0d
|
||||
#define CATC_CAP_THUMB_SIZE 0x11
|
||||
|
||||
#define CAPC_MODE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_MODE, 1)
|
||||
#define REG_CAP_NONE 0x00
|
||||
#define REG_CAP_ANTI_SHAKE 0x02
|
||||
|
||||
#define CAPC_SEL_FRAME I2C_REG(CAT_CAPT_CTRL, CATC_CAP_SEL_FRAME, 1)
|
||||
|
||||
#define CAPC_START I2C_REG(CAT_CAPT_CTRL, CATC_CAP_START, 1)
|
||||
#define REG_CAP_START_MAIN 0x01
|
||||
#define REG_CAP_START_THUMB 0x03
|
||||
|
||||
#define CAPC_IMAGE_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_IMAGE_SIZE, 1)
|
||||
#define CAPC_THUMB_SIZE I2C_REG(CAT_CAPT_CTRL, CATC_CAP_THUMB_SIZE, 1)
|
||||
|
||||
/*
|
||||
* Category F - Flash
|
||||
*
|
||||
* This mode provides functions about internal flash stuff and system startup.
|
||||
*/
|
||||
#define CATF_CAM_START 0x12 /* It starts internal ARM core booting
|
||||
* after power-up */
|
||||
|
||||
#define FLASH_CAM_START I2C_REG(CAT_FLASH, CATF_CAM_START, 1)
|
||||
#define REG_START_ARM_BOOT 0x01
|
||||
|
||||
#endif /* M5MOLS_REG_H */
|
35
include/media/m5mols.h
Normal file
35
include/media/m5mols.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Driver header for M-5MOLS 8M Pixel camera sensor with ISP
|
||||
*
|
||||
* Copyright (C) 2011 Samsung Electronics Co., Ltd.
|
||||
* Author: HeungJun Kim, riverful.kim@samsung.com
|
||||
*
|
||||
* Copyright (C) 2009 Samsung Electronics Co., Ltd.
|
||||
* Author: Dongsoo Nathaniel Kim, dongsoo45.kim@samsung.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MEDIA_M5MOLS_H
|
||||
#define MEDIA_M5MOLS_H
|
||||
|
||||
/**
|
||||
* struct m5mols_platform_data - platform data for M-5MOLS driver
|
||||
* @irq: GPIO getting the irq pin of M-5MOLS
|
||||
* @gpio_reset: GPIO driving the reset pin of M-5MOLS
|
||||
* @reset_polarity: active state for gpio_rst pin, 0 or 1
|
||||
* @set_power: an additional callback to the board setup code
|
||||
* to be called after enabling and before disabling
|
||||
* the sensor's supply regulators
|
||||
*/
|
||||
struct m5mols_platform_data {
|
||||
int irq;
|
||||
int gpio_reset;
|
||||
u8 reset_polarity;
|
||||
int (*set_power)(struct device *dev, int on);
|
||||
};
|
||||
|
||||
#endif /* MEDIA_M5MOLS_H */
|
Loading…
Reference in New Issue
Block a user