Commit f468ff16 authored by Hans de Goede's avatar Hans de Goede Committed by Mauro Carvalho Chehab

media: atomisp: Drop custom flash support

Remove the custom flash handling from the atomisp driver. There are
only few Bay Trail / Cherry Trail devices with flash and if those will
ever get supported then this should be done through the new standard
include/linux/led-class-flash.h APIs instead of with atomisp specific
custom APIs.
Reviewed-by: default avatarAndy Shevchenko <andy@kernel.org>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent f1aa35ab
...@@ -614,26 +614,6 @@ enum atomisp_camera_port { ...@@ -614,26 +614,6 @@ enum atomisp_camera_port {
ATOMISP_CAMERA_NR_PORTS ATOMISP_CAMERA_NR_PORTS
}; };
/* Flash modes. Default is off.
* Setting a flash to TORCH or INDICATOR mode will automatically
* turn it on. Setting it to FLASH mode will not turn on the flash
* until the FLASH_STROBE command is sent. */
enum atomisp_flash_mode {
ATOMISP_FLASH_MODE_OFF,
ATOMISP_FLASH_MODE_FLASH,
ATOMISP_FLASH_MODE_TORCH,
ATOMISP_FLASH_MODE_INDICATOR,
};
/* Flash statuses, used by atomisp driver to check before starting
* flash and after having started flash. */
enum atomisp_flash_status {
ATOMISP_FLASH_STATUS_OK,
ATOMISP_FLASH_STATUS_HW_ERROR,
ATOMISP_FLASH_STATUS_INTERRUPTED,
ATOMISP_FLASH_STATUS_TIMEOUT,
};
/* Frame status. This is used to detect corrupted frames and flash /* Frame status. This is used to detect corrupted frames and flash
* exposed frames. Usually, the first 2 frames coming out of the sensor * exposed frames. Usually, the first 2 frames coming out of the sensor
* are corrupted. When using flash, the frame before and the frame after * are corrupted. When using flash, the frame before and the frame after
...@@ -661,7 +641,6 @@ enum atomisp_ext_isp_id { ...@@ -661,7 +641,6 @@ enum atomisp_ext_isp_id {
EXT_ISP_CID_AF_STATUS, EXT_ISP_CID_AF_STATUS,
EXT_ISP_CID_GET_AF_MODE, EXT_ISP_CID_GET_AF_MODE,
EXT_ISP_CID_CAPTURE_BURST, EXT_ISP_CID_CAPTURE_BURST,
EXT_ISP_CID_FLASH_MODE,
EXT_ISP_CID_ZOOM, EXT_ISP_CID_ZOOM,
EXT_ISP_CID_SHOT_MODE EXT_ISP_CID_SHOT_MODE
}; };
...@@ -694,12 +673,6 @@ enum atomisp_burst_capture_options { ...@@ -694,12 +673,6 @@ enum atomisp_burst_capture_options {
EXT_ISP_BURST_CAPTURE_CTRL_STOP EXT_ISP_BURST_CAPTURE_CTRL_STOP
}; };
#define EXT_ISP_FLASH_MODE_OFF 0
#define EXT_ISP_FLASH_MODE_ON 1
#define EXT_ISP_FLASH_MODE_AUTO 2
#define EXT_ISP_LED_TORCH_OFF 3
#define EXT_ISP_LED_TORCH_ON 4
#define EXT_ISP_SHOT_MODE_AUTO 0 #define EXT_ISP_SHOT_MODE_AUTO 0
#define EXT_ISP_SHOT_MODE_BEAUTY_FACE 1 #define EXT_ISP_SHOT_MODE_BEAUTY_FACE 1
#define EXT_ISP_SHOT_MODE_BEST_PHOTO 2 #define EXT_ISP_SHOT_MODE_BEST_PHOTO 2
...@@ -894,18 +867,6 @@ enum atomisp_burst_capture_options { ...@@ -894,18 +867,6 @@ enum atomisp_burst_capture_options {
* Exposure, Flash and privacy (indicator) light controls, to be upstreamed */ * Exposure, Flash and privacy (indicator) light controls, to be upstreamed */
#define V4L2_CID_CAMERA_LASTP1 (V4L2_CID_CAMERA_CLASS_BASE + 1024) #define V4L2_CID_CAMERA_LASTP1 (V4L2_CID_CAMERA_CLASS_BASE + 1024)
/* Flash related CIDs, see also:
* http://linuxtv.org/downloads/v4l-dvb-apis/extended-controls.html\
* #flash-controls */
/* Request a number of flash-exposed frames. The frame status can be
* found in the reserved field in the v4l2_buffer struct. */
#define V4L2_CID_REQUEST_FLASH (V4L2_CID_CAMERA_LASTP1 + 3)
/* Query flash driver status. See enum atomisp_flash_status above. */
#define V4L2_CID_FLASH_STATUS (V4L2_CID_CAMERA_LASTP1 + 5)
/* Set the flash mode (see enum atomisp_flash_mode) */
#define V4L2_CID_FLASH_MODE (V4L2_CID_CAMERA_LASTP1 + 10)
#define V4L2_CID_RUN_MODE (V4L2_CID_CAMERA_LASTP1 + 20) #define V4L2_CID_RUN_MODE (V4L2_CID_CAMERA_LASTP1 + 20)
#define ATOMISP_RUN_MODE_VIDEO 1 #define ATOMISP_RUN_MODE_VIDEO 1
#define ATOMISP_RUN_MODE_STILL_CAPTURE 2 #define ATOMISP_RUN_MODE_STILL_CAPTURE 2
...@@ -925,9 +886,6 @@ enum atomisp_burst_capture_options { ...@@ -925,9 +886,6 @@ enum atomisp_burst_capture_options {
#define ATOMISP_VFPP_DISABLE_SCALER 1 #define ATOMISP_VFPP_DISABLE_SCALER 1
#define ATOMISP_VFPP_DISABLE_LOWLAT 2 #define ATOMISP_VFPP_DISABLE_LOWLAT 2
/* Query real flash status register value */
#define V4L2_CID_FLASH_STATUS_REGISTER (V4L2_CID_CAMERA_LASTP1 + 26)
#define V4L2_CID_START_ZSL_CAPTURE (V4L2_CID_CAMERA_LASTP1 + 28) #define V4L2_CID_START_ZSL_CAPTURE (V4L2_CID_CAMERA_LASTP1 + 28)
/* Lock and unlock raw buffer */ /* Lock and unlock raw buffer */
#define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29) #define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29)
......
...@@ -111,7 +111,6 @@ enum atomisp_input_format { ...@@ -111,7 +111,6 @@ enum atomisp_input_format {
enum intel_v4l2_subdev_type { enum intel_v4l2_subdev_type {
RAW_CAMERA = 1, RAW_CAMERA = 1,
LED_FLASH = 2,
}; };
struct intel_v4l2_subdev_id { struct intel_v4l2_subdev_id {
......
...@@ -61,14 +61,6 @@ ...@@ -61,14 +61,6 @@
#include "ia_css_debug.h" #include "ia_css_debug.h"
#include "bits.h" #include "bits.h"
/* We should never need to run the flash for more than 2 frames.
* At 15fps this means 133ms. We set the timeout a bit longer.
* Each flash driver is supposed to set its own timeout, but
* just in case someone else changed the timeout, we set it
* here to make sure we don't damage the flash hardware.
*/
#define FLASH_TIMEOUT 800 /* ms */
union host { union host {
struct { struct {
void *kernel_ptr; void *kernel_ptr;
...@@ -677,7 +669,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, ...@@ -677,7 +669,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
struct atomisp_metadata_buf *md_buf = NULL, *_md_buf_tmp, *md_iter; struct atomisp_metadata_buf *md_buf = NULL, *_md_buf_tmp, *md_iter;
enum atomisp_metadata_type md_type; enum atomisp_metadata_type md_type;
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
struct v4l2_control ctrl;
int i, err; int i, err;
lockdep_assert_held(&isp->mutex); lockdep_assert_held(&isp->mutex);
...@@ -792,19 +783,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, ...@@ -792,19 +783,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
dev_dbg(isp->dev, "%s: vf frame with exp_id %d is ready\n", dev_dbg(isp->dev, "%s: vf frame with exp_id %d is ready\n",
__func__, frame->exp_id); __func__, frame->exp_id);
if (asd->params.flash_state == ATOMISP_FLASH_ONGOING) {
if (frame->flash_state
== IA_CSS_FRAME_FLASH_STATE_PARTIAL)
dev_dbg(isp->dev, "%s thumb partially flashed\n",
__func__);
else if (frame->flash_state
== IA_CSS_FRAME_FLASH_STATE_FULL)
dev_dbg(isp->dev, "%s thumb completely flashed\n",
__func__);
else
dev_dbg(isp->dev, "%s thumb no flash in this frame\n",
__func__);
}
pipe->frame_config_id[frame->vb.vb2_buf.index] = frame->isp_config_id; pipe->frame_config_id[frame->vb.vb2_buf.index] = frame->isp_config_id;
break; break;
case IA_CSS_BUFFER_TYPE_OUTPUT_FRAME: case IA_CSS_BUFFER_TYPE_OUTPUT_FRAME:
...@@ -835,40 +813,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, ...@@ -835,40 +813,7 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error,
} }
pipe->frame_config_id[i] = frame->isp_config_id; pipe->frame_config_id[i] = frame->isp_config_id;
ctrl.id = V4L2_CID_FLASH_MODE;
if (asd->params.flash_state == ATOMISP_FLASH_ONGOING) {
if (frame->flash_state == IA_CSS_FRAME_FLASH_STATE_PARTIAL) {
asd->frame_status[i] = ATOMISP_FRAME_STATUS_FLASH_PARTIAL;
dev_dbg(isp->dev, "%s partially flashed\n", __func__);
} else if (frame->flash_state == IA_CSS_FRAME_FLASH_STATE_FULL) {
asd->frame_status[i] = ATOMISP_FRAME_STATUS_FLASH_EXPOSED;
asd->params.num_flash_frames--;
dev_dbg(isp->dev, "%s completely flashed\n", __func__);
} else {
asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK;
dev_dbg(isp->dev, "%s no flash in this frame\n", __func__);
}
/* Check if flashing sequence is done */
if (asd->frame_status[i] == ATOMISP_FRAME_STATUS_FLASH_EXPOSED)
asd->params.flash_state = ATOMISP_FLASH_DONE;
} else if (isp->flash) {
if (v4l2_g_ctrl(isp->flash->ctrl_handler, &ctrl) == 0 &&
ctrl.value == ATOMISP_FLASH_MODE_TORCH) {
ctrl.id = V4L2_CID_FLASH_TORCH_INTENSITY;
if (v4l2_g_ctrl(isp->flash->ctrl_handler, &ctrl) == 0 &&
ctrl.value > 0)
asd->frame_status[i] = ATOMISP_FRAME_STATUS_FLASH_EXPOSED;
else
asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK;
} else {
asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK;
}
} else {
asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK; asd->frame_status[i] = ATOMISP_FRAME_STATUS_OK;
}
asd->params.last_frame_status = asd->frame_status[i];
if (asd->params.css_update_params_needed) { if (asd->params.css_update_params_needed) {
atomisp_apply_css_parameters(asd, atomisp_apply_css_parameters(asd,
...@@ -1011,36 +956,6 @@ void atomisp_assert_recovery_work(struct work_struct *work) ...@@ -1011,36 +956,6 @@ void atomisp_assert_recovery_work(struct work_struct *work)
mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
} }
void atomisp_setup_flash(struct atomisp_sub_device *asd)
{
struct atomisp_device *isp = asd->isp;
struct v4l2_control ctrl;
if (!isp->flash)
return;
if (asd->params.flash_state != ATOMISP_FLASH_REQUESTED &&
asd->params.flash_state != ATOMISP_FLASH_DONE)
return;
if (asd->params.num_flash_frames) {
/* make sure the timeout is set before setting flash mode */
ctrl.id = V4L2_CID_FLASH_TIMEOUT;
ctrl.value = FLASH_TIMEOUT;
if (v4l2_s_ctrl(NULL, isp->flash->ctrl_handler, &ctrl)) {
dev_err(isp->dev, "flash timeout configure failed\n");
return;
}
ia_css_stream_request_flash(asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL].stream);
asd->params.flash_state = ATOMISP_FLASH_ONGOING;
} else {
asd->params.flash_state = ATOMISP_FLASH_IDLE;
}
}
irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr)
{ {
struct atomisp_device *isp = isp_ptr; struct atomisp_device *isp = isp_ptr;
...@@ -1083,14 +998,8 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) ...@@ -1083,14 +998,8 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr)
* time, instead, dequue one and process one, then another * time, instead, dequue one and process one, then another
*/ */
mutex_lock(&isp->mutex); mutex_lock(&isp->mutex);
if (atomisp_css_isr_thread(isp)) atomisp_css_isr_thread(isp);
goto out;
if (isp->asd.streaming)
atomisp_setup_flash(&isp->asd);
out:
mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
dev_dbg(isp->dev, "<%s\n", __func__);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -4581,28 +4490,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, ...@@ -4581,28 +4490,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
return ret; return ret;
} }
int atomisp_flash_enable(struct atomisp_sub_device *asd, int num_frames)
{
struct atomisp_device *isp = asd->isp;
if (num_frames < 0) {
dev_dbg(isp->dev, "%s ERROR: num_frames: %d\n", __func__,
num_frames);
return -EINVAL;
}
/* a requested flash is still in progress. */
if (num_frames && asd->params.flash_state != ATOMISP_FLASH_IDLE) {
dev_dbg(isp->dev, "%s flash busy: %d frames left: %d\n",
__func__, asd->params.flash_state,
asd->params.num_flash_frames);
return -EBUSY;
}
asd->params.num_flash_frames = num_frames;
asd->params.flash_state = ATOMISP_FLASH_REQUESTED;
return 0;
}
static int __checking_exp_id(struct atomisp_sub_device *asd, int exp_id) static int __checking_exp_id(struct atomisp_sub_device *asd, int exp_id)
{ {
struct atomisp_device *isp = asd->isp; struct atomisp_device *isp = asd->isp;
......
...@@ -58,7 +58,6 @@ void atomisp_clear_css_buffer_counters(struct atomisp_sub_device *asd); ...@@ -58,7 +58,6 @@ void atomisp_clear_css_buffer_counters(struct atomisp_sub_device *asd);
void atomisp_msi_irq_init(struct atomisp_device *isp); void atomisp_msi_irq_init(struct atomisp_device *isp);
void atomisp_msi_irq_uninit(struct atomisp_device *isp); void atomisp_msi_irq_uninit(struct atomisp_device *isp);
void atomisp_assert_recovery_work(struct work_struct *work); void atomisp_assert_recovery_work(struct work_struct *work);
void atomisp_setup_flash(struct atomisp_sub_device *asd);
irqreturn_t atomisp_isr(int irq, void *dev); irqreturn_t atomisp_isr(int irq, void *dev);
irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr); irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr);
const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mbus( const struct atomisp_format_bridge *get_atomisp_format_bridge_from_mbus(
...@@ -262,9 +261,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd, ...@@ -262,9 +261,6 @@ int atomisp_set_shading_table(struct atomisp_sub_device *asd,
void atomisp_free_internal_buffers(struct atomisp_sub_device *asd); void atomisp_free_internal_buffers(struct atomisp_sub_device *asd);
int atomisp_flash_enable(struct atomisp_sub_device *asd,
int num_frames);
int atomisp_freq_scaling(struct atomisp_device *vdev, int atomisp_freq_scaling(struct atomisp_device *vdev,
enum atomisp_dfs_mode mode, enum atomisp_dfs_mode mode,
bool force); bool force);
......
...@@ -520,21 +520,12 @@ static int atomisp_open(struct file *file) ...@@ -520,21 +520,12 @@ static int atomisp_open(struct file *file)
} }
atomisp_dev_init_struct(isp); atomisp_dev_init_struct(isp);
ret = v4l2_subdev_call(isp->flash, core, s_power, 1);
if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD) {
dev_err(isp->dev, "Failed to power-on flash\n");
goto css_error;
}
atomisp_subdev_init_struct(asd); atomisp_subdev_init_struct(asd);
pipe->users++; pipe->users++;
mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
return 0; return 0;
css_error:
pm_runtime_put(vdev->v4l2_dev->dev);
error: error:
mutex_unlock(&isp->mutex); mutex_unlock(&isp->mutex);
v4l2_fh_release(file); v4l2_fh_release(file);
...@@ -549,7 +540,6 @@ static int atomisp_release(struct file *file) ...@@ -549,7 +540,6 @@ static int atomisp_release(struct file *file)
struct atomisp_sub_device *asd = pipe->asd; struct atomisp_sub_device *asd = pipe->asd;
struct v4l2_subdev_fh fh; struct v4l2_subdev_fh fh;
struct v4l2_rect clear_compose = {0}; struct v4l2_rect clear_compose = {0};
int ret;
v4l2_fh_init(&fh.vfh, vdev); v4l2_fh_init(&fh.vfh, vdev);
...@@ -584,10 +574,6 @@ static int atomisp_release(struct file *file) ...@@ -584,10 +574,6 @@ static int atomisp_release(struct file *file)
atomisp_destroy_pipes_stream(asd); atomisp_destroy_pipes_stream(asd);
ret = v4l2_subdev_call(isp->flash, core, s_power, 0);
if (ret < 0 && ret != -ENODEV && ret != -ENOIOCTLCMD)
dev_warn(isp->dev, "Failed to power-off flash\n");
if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0) if (pm_runtime_put_sync(vdev->v4l2_dev->dev) < 0)
dev_err(isp->dev, "Failed to power off device\n"); dev_err(isp->dev, "Failed to power off device\n");
......
...@@ -200,7 +200,6 @@ struct atomisp_device { ...@@ -200,7 +200,6 @@ struct atomisp_device {
struct v4l2_subdev *sensor_subdevs[ATOMISP_CAMERA_NR_PORTS]; struct v4l2_subdev *sensor_subdevs[ATOMISP_CAMERA_NR_PORTS];
unsigned int input_cnt; unsigned int input_cnt;
struct atomisp_input_subdev inputs[ATOM_ISP_MAX_INPUTS]; struct atomisp_input_subdev inputs[ATOM_ISP_MAX_INPUTS];
struct v4l2_subdev *flash;
struct atomisp_regs saved_regs; struct atomisp_regs saved_regs;
struct atomisp_css_env css_env; struct atomisp_css_env css_env;
......
...@@ -136,15 +136,6 @@ static struct v4l2_queryctrl ci_v4l2_controls[] = { ...@@ -136,15 +136,6 @@ static struct v4l2_queryctrl ci_v4l2_controls[] = {
.step = 1, .step = 1,
.default_value = 0, .default_value = 0,
}, },
{
.id = V4L2_CID_REQUEST_FLASH,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Request flash frames",
.minimum = 0,
.maximum = 10,
.step = 1,
.default_value = 1,
},
{ {
.id = V4L2_CID_ATOMISP_LOW_LIGHT, .id = V4L2_CID_ATOMISP_LOW_LIGHT,
.type = V4L2_CTRL_TYPE_BOOLEAN, .type = V4L2_CTRL_TYPE_BOOLEAN,
...@@ -956,12 +947,6 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count) ...@@ -956,12 +947,6 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count)
atomisp_qbuffers_to_css(asd); atomisp_qbuffers_to_css(asd);
if (isp->flash) {
asd->params.num_flash_frames = 0;
asd->params.flash_state = ATOMISP_FLASH_IDLE;
atomisp_setup_flash(asd);
}
atomisp_css_irq_enable(isp, IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF, atomisp_css_irq_enable(isp, IA_CSS_IRQ_INFO_CSS_RECEIVER_SOF,
atomisp_css_valid_sof(isp)); atomisp_css_valid_sof(isp));
atomisp_csi2_configure(asd); atomisp_csi2_configure(asd);
...@@ -1039,11 +1024,6 @@ void atomisp_stop_streaming(struct vb2_queue *vq) ...@@ -1039,11 +1024,6 @@ void atomisp_stop_streaming(struct vb2_queue *vq)
if (ret) if (ret)
dev_warn(isp->dev, "Stopping sensor stream failed: %d\n", ret); dev_warn(isp->dev, "Stopping sensor stream failed: %d\n", ret);
if (isp->flash) {
asd->params.num_flash_frames = 0;
asd->params.flash_state = ATOMISP_FLASH_IDLE;
}
/* Disable the CSI interface on ANN B0/K0 */ /* Disable the CSI interface on ANN B0/K0 */
if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 << if (isp->media_dev.hw_revision >= ((ATOMISP_HW_REVISION_ISP2401 <<
ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) { ATOMISP_HW_REVISION_SHIFT) | ATOMISP_HW_STEPPING_B0)) {
...@@ -1165,9 +1145,6 @@ static int atomisp_s_ctrl(struct file *file, void *fh, ...@@ -1165,9 +1145,6 @@ static int atomisp_s_ctrl(struct file *file, void *fh,
case V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION: case V4L2_CID_ATOMISP_FALSE_COLOR_CORRECTION:
ret = atomisp_false_color(asd, 1, &control->value); ret = atomisp_false_color(asd, 1, &control->value);
break; break;
case V4L2_CID_REQUEST_FLASH:
ret = atomisp_flash_enable(asd, control->value);
break;
case V4L2_CID_ATOMISP_LOW_LIGHT: case V4L2_CID_ATOMISP_LOW_LIGHT:
ret = atomisp_low_light(asd, 1, &control->value); ret = atomisp_low_light(asd, 1, &control->value);
break; break;
...@@ -1212,7 +1189,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, ...@@ -1212,7 +1189,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh,
{ {
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
struct atomisp_device *isp = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
int i; int i;
int ret = 0; int ret = 0;
...@@ -1221,19 +1197,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh, ...@@ -1221,19 +1197,6 @@ static int atomisp_camera_g_ext_ctrls(struct file *file, void *fh,
ctrl.id = c->controls[i].id; ctrl.id = c->controls[i].id;
ctrl.value = c->controls[i].value; ctrl.value = c->controls[i].value;
switch (ctrl.id) { switch (ctrl.id) {
case V4L2_CID_FLASH_STATUS:
case V4L2_CID_FLASH_INTENSITY:
case V4L2_CID_FLASH_TORCH_INTENSITY:
case V4L2_CID_FLASH_INDICATOR_INTENSITY:
case V4L2_CID_FLASH_TIMEOUT:
case V4L2_CID_FLASH_STROBE:
case V4L2_CID_FLASH_MODE:
case V4L2_CID_FLASH_STATUS_REGISTER:
if (isp->flash)
ret =
v4l2_g_ctrl(isp->flash->ctrl_handler,
&ctrl);
break;
case V4L2_CID_ZOOM_ABSOLUTE: case V4L2_CID_ZOOM_ABSOLUTE:
ret = atomisp_digital_zoom(asd, 0, &ctrl.value); ret = atomisp_digital_zoom(asd, 0, &ctrl.value);
break; break;
...@@ -1283,7 +1246,6 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, ...@@ -1283,7 +1246,6 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh,
{ {
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd;
struct atomisp_device *isp = video_get_drvdata(vdev);
struct v4l2_control ctrl; struct v4l2_control ctrl;
int i; int i;
int ret = 0; int ret = 0;
...@@ -1294,29 +1256,6 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh, ...@@ -1294,29 +1256,6 @@ static int atomisp_camera_s_ext_ctrls(struct file *file, void *fh,
ctrl.id = c->controls[i].id; ctrl.id = c->controls[i].id;
ctrl.value = c->controls[i].value; ctrl.value = c->controls[i].value;
switch (ctrl.id) { switch (ctrl.id) {
case V4L2_CID_FLASH_STATUS:
case V4L2_CID_FLASH_INTENSITY:
case V4L2_CID_FLASH_TORCH_INTENSITY:
case V4L2_CID_FLASH_INDICATOR_INTENSITY:
case V4L2_CID_FLASH_TIMEOUT:
case V4L2_CID_FLASH_STROBE:
case V4L2_CID_FLASH_MODE:
case V4L2_CID_FLASH_STATUS_REGISTER:
if (isp->flash) {
ret =
v4l2_s_ctrl(NULL, isp->flash->ctrl_handler,
&ctrl);
/*
* When flash mode is changed we need to reset
* flash state
*/
if (ctrl.id == V4L2_CID_FLASH_MODE) {
asd->params.flash_state =
ATOMISP_FLASH_IDLE;
asd->params.num_flash_frames = 0;
}
}
break;
case V4L2_CID_ZOOM_ABSOLUTE: case V4L2_CID_ZOOM_ABSOLUTE:
ret = atomisp_digital_zoom(asd, 1, &ctrl.value); ret = atomisp_digital_zoom(asd, 1, &ctrl.value);
break; break;
......
...@@ -108,14 +108,6 @@ struct atomisp_pad_format { ...@@ -108,14 +108,6 @@ struct atomisp_pad_format {
struct v4l2_rect compose; struct v4l2_rect compose;
}; };
/* Internal states for flash process */
enum atomisp_flash_state {
ATOMISP_FLASH_IDLE,
ATOMISP_FLASH_REQUESTED,
ATOMISP_FLASH_ONGOING,
ATOMISP_FLASH_DONE
};
/* /*
* This structure is used to cache the CSS parameters, it aligns to * This structure is used to cache the CSS parameters, it aligns to
* struct ia_css_isp_config but without un-supported and deprecated parts. * struct ia_css_isp_config but without un-supported and deprecated parts.
...@@ -221,11 +213,6 @@ struct atomisp_subdev_params { ...@@ -221,11 +213,6 @@ struct atomisp_subdev_params {
int dvs_ver_proj_bytes; int dvs_ver_proj_bytes;
int dvs_hor_proj_bytes; int dvs_hor_proj_bytes;
/* Flash */
int num_flash_frames;
enum atomisp_flash_state flash_state;
enum atomisp_frame_status last_frame_status;
/* Flag to check if driver needs to update params to css */ /* Flag to check if driver needs to update params to css */
bool css_update_params_needed; bool css_update_params_needed;
}; };
......
...@@ -825,13 +825,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) ...@@ -825,13 +825,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)
isp->sensor_lanes[mipi_port] = subdevs->lanes; isp->sensor_lanes[mipi_port] = subdevs->lanes;
isp->sensor_subdevs[subdevs->port] = subdevs->subdev; isp->sensor_subdevs[subdevs->port] = subdevs->subdev;
break; break;
case LED_FLASH:
if (isp->flash) {
dev_warn(isp->dev, "too many atomisp flash devices\n");
continue;
}
isp->flash = subdevs->subdev;
break;
default: default:
dev_dbg(isp->dev, "unknown subdev probed\n"); dev_dbg(isp->dev, "unknown subdev probed\n");
break; break;
......
...@@ -137,12 +137,6 @@ enum ia_css_frame_delay { ...@@ -137,12 +137,6 @@ enum ia_css_frame_delay {
IA_CSS_FRAME_DELAY_2 /** Frame delay = 2 */ IA_CSS_FRAME_DELAY_2 /** Frame delay = 2 */
}; };
enum ia_css_frame_flash_state {
IA_CSS_FRAME_FLASH_STATE_NONE,
IA_CSS_FRAME_FLASH_STATE_PARTIAL,
IA_CSS_FRAME_FLASH_STATE_FULL
};
/* Frame structure. This structure describes an image buffer or frame. /* Frame structure. This structure describes an image buffer or frame.
* This is the main structure used for all input and output images. * This is the main structure used for all input and output images.
*/ */
...@@ -176,7 +170,6 @@ struct ia_css_frame { ...@@ -176,7 +170,6 @@ struct ia_css_frame {
* binary, we use output port, but we expect VF_OUTPUT_DONE event * binary, we use output port, but we expect VF_OUTPUT_DONE event
*/ */
enum ia_css_buffer_type buf_type; enum ia_css_buffer_type buf_type;
enum ia_css_frame_flash_state flash_state;
unsigned int exp_id; unsigned int exp_id;
/** exposure id, see ia_css_event_public.h for more detail */ /** exposure id, see ia_css_event_public.h for more detail */
u32 isp_config_id; /** Unique ID to track which config was actually applied to a particular frame */ u32 isp_config_id; /** Unique ID to track which config was actually applied to a particular frame */
...@@ -202,7 +195,6 @@ struct ia_css_frame { ...@@ -202,7 +195,6 @@ struct ia_css_frame {
.frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
.dynamic_queue_id = SH_CSS_INVALID_QUEUE_ID, \ .dynamic_queue_id = SH_CSS_INVALID_QUEUE_ID, \
.buf_type = IA_CSS_BUFFER_TYPE_INVALID, \ .buf_type = IA_CSS_BUFFER_TYPE_INVALID, \
.flash_state = IA_CSS_FRAME_FLASH_STATE_NONE, \
} }
/* @brief Allocate a CSS frame structure /* @brief Allocate a CSS frame structure
......
...@@ -457,20 +457,6 @@ ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream, ...@@ -457,20 +457,6 @@ ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream,
void void
ia_css_stream_end_input_frame(const struct ia_css_stream *stream); ia_css_stream_end_input_frame(const struct ia_css_stream *stream);
/* @brief send a request flash command to SP
*
* @param[in] stream The stream.
* @return None
*
* Driver needs to call this function to send a flash request command
* to SP, SP will be responsible for switching on/off the flash at proper
* time. Due to the SP multi-threading environment, this request may have
* one-frame delay, the driver needs to check the flashed flag in frame info
* to determine which frame is being flashed.
*/
void
ia_css_stream_request_flash(struct ia_css_stream *stream);
/* @brief Configure a stream with filter coefficients. /* @brief Configure a stream with filter coefficients.
* @deprecated {Replaced by * @deprecated {Replaced by
* ia_css_pipe_set_isp_config_on_pipe()} * ia_css_pipe_set_isp_config_on_pipe()}
......
...@@ -2834,7 +2834,6 @@ init_vf_frameinfo_defaults(struct ia_css_pipe *pipe, ...@@ -2834,7 +2834,6 @@ init_vf_frameinfo_defaults(struct ia_css_pipe *pipe,
assert(vf_frame); assert(vf_frame);
sh_css_pipe_get_viewfinder_frame_info(pipe, &vf_frame->frame_info, idx); sh_css_pipe_get_viewfinder_frame_info(pipe, &vf_frame->frame_info, idx);
vf_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE;
ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id);
ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME + idx, thread_id, &queue_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME + idx, thread_id, &queue_id);
vf_frame->dynamic_queue_id = queue_id; vf_frame->dynamic_queue_id = queue_id;
...@@ -3012,7 +3011,6 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe, ...@@ -3012,7 +3011,6 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe,
in_frame->frame_info.raw_bit_depth = ia_css_pipe_util_pipe_input_format_bpp(pipe); in_frame->frame_info.raw_bit_depth = ia_css_pipe_util_pipe_input_format_bpp(pipe);
ia_css_frame_info_set_width(&in_frame->frame_info, ia_css_frame_info_set_width(&in_frame->frame_info,
pipe->stream->config.input_config.input_res.width, 0); pipe->stream->config.input_config.input_res.width, 0);
in_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE;
ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id);
ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_INPUT_FRAME, thread_id, &queue_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_INPUT_FRAME, thread_id, &queue_id);
in_frame->dynamic_queue_id = queue_id; in_frame->dynamic_queue_id = queue_id;
...@@ -3040,7 +3038,6 @@ init_out_frameinfo_defaults(struct ia_css_pipe *pipe, ...@@ -3040,7 +3038,6 @@ init_out_frameinfo_defaults(struct ia_css_pipe *pipe,
assert(out_frame); assert(out_frame);
sh_css_pipe_get_output_frame_info(pipe, &out_frame->frame_info, idx); sh_css_pipe_get_output_frame_info(pipe, &out_frame->frame_info, idx);
out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE;
ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id);
ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_OUTPUT_FRAME + idx, thread_id, &queue_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_OUTPUT_FRAME + idx, thread_id, &queue_id);
out_frame->dynamic_queue_id = queue_id; out_frame->dynamic_queue_id = queue_id;
...@@ -3821,12 +3818,6 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ...@@ -3821,12 +3818,6 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,
buffer->exp_id = ddr_buffer.payload.frame.exp_id; buffer->exp_id = ddr_buffer.payload.frame.exp_id;
frame->exp_id = ddr_buffer.payload.frame.exp_id; frame->exp_id = ddr_buffer.payload.frame.exp_id;
frame->isp_config_id = ddr_buffer.payload.frame.isp_parameters_id; frame->isp_config_id = ddr_buffer.payload.frame.isp_parameters_id;
if (ddr_buffer.payload.frame.flashed == 1)
frame->flash_state =
IA_CSS_FRAME_FLASH_STATE_PARTIAL;
if (ddr_buffer.payload.frame.flashed == 2)
frame->flash_state =
IA_CSS_FRAME_FLASH_STATE_FULL;
frame->valid = pipe->num_invalid_frames == 0; frame->valid = pipe->num_invalid_frames == 0;
if (!frame->valid) if (!frame->valid)
pipe->num_invalid_frames--; pipe->num_invalid_frames--;
...@@ -6788,8 +6779,6 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe, ...@@ -6788,8 +6779,6 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe,
ia_css_pipeline_clean(me); ia_css_pipeline_clean(me);
/* Construct out_frame info */ /* Construct out_frame info */
out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE;
if (copy_on_sp(pipe) && if (copy_on_sp(pipe) &&
pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) { pipe->stream->config.input_config.format == ATOMISP_INPUT_FORMAT_BINARY_8) {
ia_css_frame_info_init(&out_frame->frame_info, JPEG_BYTES, 1, ia_css_frame_info_init(&out_frame->frame_info, JPEG_BYTES, 1,
...@@ -6837,7 +6826,6 @@ create_host_isyscopy_capture_pipeline(struct ia_css_pipe *pipe) ...@@ -6837,7 +6826,6 @@ create_host_isyscopy_capture_pipeline(struct ia_css_pipe *pipe)
err = sh_css_pipe_get_output_frame_info(pipe, &out_frame->frame_info, 0); err = sh_css_pipe_get_output_frame_info(pipe, &out_frame->frame_info, 0);
if (err) if (err)
return err; return err;
out_frame->flash_state = IA_CSS_FRAME_FLASH_STATE_NONE;
ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id); ia_css_pipeline_get_sp_thread_id(ia_css_pipe_get_pipe_num(pipe), &thread_id);
ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_OUTPUT_FRAME, thread_id, &queue_id); ia_css_query_internal_queue_id(IA_CSS_BUFFER_TYPE_OUTPUT_FRAME, thread_id, &queue_id);
out_frame->dynamic_queue_id = queue_id; out_frame->dynamic_queue_id = queue_id;
...@@ -7492,27 +7480,6 @@ int ia_css_stream_capture(struct ia_css_stream *stream, int num_captures, ...@@ -7492,27 +7480,6 @@ int ia_css_stream_capture(struct ia_css_stream *stream, int num_captures,
return return_err; return return_err;
} }
void ia_css_stream_request_flash(struct ia_css_stream *stream)
{
(void)stream;
assert(stream);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_stream_request_flash() enter: void\n");
if (!IS_ISP2401 || sh_css_sp_is_running()) {
if (!sh_css_write_host2sp_command(host2sp_cmd_start_flash) && IS_ISP2401) {
IA_CSS_ERROR("Call to 'sh-css_write_host2sp_command()' failed");
ia_css_debug_dump_sp_sw_debug_info();
}
} else {
IA_CSS_LOG("SP is not running!");
}
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_stream_request_flash() leave: return_void\n");
}
static void static void
sh_css_init_host_sp_control_vars(void) sh_css_init_host_sp_control_vars(void)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment