media: atomisp: Further media-controller related fixes + dead code removal
Subsystems (4)
cover media: atomisp: Further media-controller related fixes + dead code removal
Hi all,
This patch-set contains a couple of atomisp driver fixes for issues which I found while working on a libcamera pipeline handler for the atomisp (and thus controlling the atomisp driver in a more media-controller centric fashion).
Patches 1-8 are more or less prep work for fixing an ABBA deadlock in atomisp_link_setup() in patch 9.
Diving into the code for this made my hands itch to remove of bunch of atomisp custom internal APIs for things like flash support, so the rest of the series is just removing a whole bunch of dead / unwanted code.
This series is also available here:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomisp
I'll do a forced push there addressing any review-comments + adding tags before adding a signed-tag for a pull-request to Mauro for this.
Regards,
Hans
Hans de Goede (23):
media: atomisp: Add atomisp_s_sensor_power() helper
media: atomisp: Turn on sensor power from atomisp_set_fmt()
media: atomisp: Add atomisp_select_input() helper
media: atomisp: Simplify atomisp_s_input() input argument checking
media: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect
current sensor
media: atomisp: Propagate set_fmt on sensor results to CSI port
media: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink
pad
media: atomisp: Call media_pipeline_alloc_start() in stream start
media: atomisp: Drop atomisp_pipe_check() from atomisp_link_setup()
media: atomisp: ov2722: Remove power on sensor from set_fmt() callback
media: atomisp: Remove test pattern generator (TPG) support
media: atomisp: Remove input_port_ID_t
media: atomisp: Drop the atomisp custom lm3554 flash driver
media: atomisp: Drop custom flash support
media: atomisp: Drop unused frame_status tracking
media: atomisp: Drop intel_v4l2_subdev_type
media: atomisp: Remove gmin_platform VCM code.
media: atomisp: Remove struct atomisp_platform_data
media: atomisp: Remove clearing of ISP crop / compose rectangles on
file release
media: atomisp: Remove empty s_power() op from ISP subdev
media: atomisp: Remove empty s_stream() op from CSI subdev
media: atomisp: Cleanup atomisp_isr_thread() spinlock handling
media: atomisp: Remove setting of f->fmt.pix.priv from
atomisp_set_fmt()
drivers/staging/media/atomisp/Makefile | 1 - drivers/staging/media/atomisp/i2c/Kconfig | 15 - drivers/staging/media/atomisp/i2c/Makefile | 5 - .../media/atomisp/i2c/atomisp-gc2235.c | 2 +- .../media/atomisp/i2c/atomisp-lm3554.c | 955 ------------------ .../media/atomisp/i2c/atomisp-mt9m114.c | 2 +- .../media/atomisp/i2c/atomisp-ov2722.c | 14 +- drivers/staging/media/atomisp/i2c/ov2722.h | 1 - .../media/atomisp/include/linux/atomisp.h | 57 -- .../include/linux/atomisp_gmin_platform.h | 6 +- .../atomisp/include/linux/atomisp_platform.h | 40 +- .../media/atomisp/include/media/lm3554.h | 132 --- .../staging/media/atomisp/pci/atomisp_cmd.c | 255 ++--- .../staging/media/atomisp/pci/atomisp_cmd.h | 13 +- .../media/atomisp/pci/atomisp_compat_css20.c | 31 +- .../staging/media/atomisp/pci/atomisp_csi2.c | 26 +- .../staging/media/atomisp/pci/atomisp_fops.c | 49 +- .../media/atomisp/pci/atomisp_gmin_platform.c | 95 +- .../media/atomisp/pci/atomisp_internal.h | 12 +- .../staging/media/atomisp/pci/atomisp_ioctl.c | 135 +-- .../media/atomisp/pci/atomisp_subdev.c | 46 +- .../media/atomisp/pci/atomisp_subdev.h | 17 +- .../staging/media/atomisp/pci/atomisp_tpg.c | 164 --- .../staging/media/atomisp/pci/atomisp_tpg.h | 39 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 87 +- .../hive_isp_css_common/host/input_system.c | 38 - drivers/staging/media/atomisp/pci/ia_css.h | 1 - .../media/atomisp/pci/ia_css_frame_public.h | 8 - .../media/atomisp/pci/ia_css_stream_public.h | 17 - .../staging/media/atomisp/pci/ia_css_tpg.h | 79 -- .../atomisp/pci/isp2400_input_system_global.h | 1 - .../atomisp/pci/isp2400_input_system_public.h | 15 - .../atomisp/pci/isp2401_input_system_global.h | 1 - .../pci/runtime/debug/src/ia_css_debug.c | 17 - .../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 11 - .../pci/runtime/isys/src/virtual_isys.c | 28 +- drivers/staging/media/atomisp/pci/sh_css.c | 121 +-- .../media/atomisp/pci/sh_css_internal.h | 1 - .../staging/media/atomisp/pci/sh_css_mipi.c | 2 +- drivers/staging/media/atomisp/pci/sh_css_sp.c | 14 - drivers/staging/media/atomisp/pci/sh_css_sp.h | 7 - .../staging/media/atomisp/pci/system_global.h | 12 - 42 files changed, 211 insertions(+), 2361 deletions(-) delete mode 100644 drivers/staging/media/atomisp/i2c/atomisp-lm3554.c delete mode 100644 drivers/staging/media/atomisp/include/media/lm3554.h delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_tpg.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_tpg.h delete mode 100644 drivers/staging/media/atomisp/pci/ia_css_tpg.h
Signature · 1 line
2.44.0
PATCH 1/23 media: atomisp: Add atomisp_s_sensor_power() helper
Since the atomisp driver only supports 1 stream / only has 1 asd now, there is no longer a need to track which stream owns the sensor.
So the asd owner-pointer of struct atomisp_input_subdev can be dropped, replace this with a simple camera_on boolean and add a new atomisp_s_sensor_power() helper which takes care of avoiding unbalanced s_power() subdev calls as well as takes care of handling the special -ENOIOCTLCMD return for subdevs which don't implement s_power().
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 17 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_cmd.h | 3 +++ .../staging/media/atomisp/pci/atomisp_fops.c | 14 +------------ .../media/atomisp/pci/atomisp_internal.h | 6 +----- .../staging/media/atomisp/pci/atomisp_ioctl.c | 21 ++++--------------- 5 files changed, 26 insertions(+), 35 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +17 -0
@@ -3722,6 +3722,23 @@ void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height, *padding_h =max_t (u32, *padding_h, min_pad_h); } +int atomisp_s_sensor_power (struct atomisp_device *isp,unsigned int input,bool on) +{ +int ret; + +if (isp->inputs[input].camera_on == on) +return 0 ; + + ret =v4l2_subdev_call (isp->inputs[input].camera, core, s_power, on); +if (ret && ret != -ENOIOCTLCMD ) { +dev_err (isp->dev,"Error setting sensor power %d: %d\n" , on, ret); +return ret; + } + + isp->inputs[input].camera_on = on; +return 0 ; +} +static int atomisp_set_sensor_crop_and_fmt (struct atomisp_device *isp,struct v4l2_mbus_framefmt *ffmt,int which)
drivers/staging/media/atomisp/pci/atomisp_cmd.h +3 -0
@@ -241,6 +241,9 @@ int atomisp_compare_grid(struct atomisp_sub_device *asd,void atomisp_get_padding (struct atomisp_device *isp,u32 width,u32 height,u32 *padding_w,u32 *padding_h); +/* Set sensor power (no-op if already on/off) */ +int atomisp_s_sensor_power (struct atomisp_device *isp,unsigned int input,bool on); +/* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret,
drivers/staging/media/atomisp/pci/atomisp_fops.c +1 -13
@@ -445,12 +445,8 @@ const struct vb2_ops atomisp_vb2_ops = {static void atomisp_dev_init_struct (struct atomisp_device *isp) { -unsigned int i; - isp->isp_fatal_error = false; -for (i =0 ; i < isp->input_cnt; i++) - isp->inputs[i].asd =NULL ;/* * For Merrifield, frequency is scalable. * After boot-up, the default frequency is 200MHz.
@@ -584,15 +580,7 @@ static int atomisp_release(struct file *file)atomisp_css_free_stat_buffers (asd);atomisp_free_internal_buffers (asd); -if (isp->inputs[asd->input_curr].asd == asd) { - ret =v4l2_subdev_call (isp->inputs[asd->input_curr].camera, - core, s_power,0 ); -if (ret && ret != -ENOIOCTLCMD ) -dev_warn (isp->dev,"Failed to power-off sensor\n" ); - -/* clear the asd field to show this camera is not used */ - isp->inputs[asd->input_curr].asd =NULL ; - } +atomisp_s_sensor_power (isp, asd->input_curr,0 );atomisp_destroy_pipes_stream (asd);
drivers/staging/media/atomisp/pci/atomisp_internal.h +1 -5
@@ -127,17 +127,13 @@ struct atomisp_input_subdev {u32 code;/* MEDIA_BUS_FMT_* */ bool binning_support;bool crop_support; +bool camera_on;struct v4l2_subdev *camera;/* Sensor rects for sensors which support crop */ struct v4l2_rect native_rect;struct v4l2_rect active_rect;/* Sensor state for which == V4L2_SUBDEV_FORMAT_TRY calls */ struct v4l2_subdev_state *try_sd_state; -/* -* To show this resource is used by -* which stream, in ISP multiple stream mode -*/ -struct atomisp_sub_device *asd; };enum atomisp_dfs_mode {
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +4 -17
@@ -469,28 +469,15 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input) }/* power off the current owned sensor, as it is not used this time */ -if (isp->inputs[asd->input_curr].asd == asd && - asd->input_curr != input) { - ret =v4l2_subdev_call (isp->inputs[asd->input_curr].camera, - core, s_power,0 ); -if (ret && ret != -ENOIOCTLCMD ) -dev_warn (isp->dev, -"Failed to power-off sensor\n" ); -/* clear the asd field to show this camera is not used */ - isp->inputs[asd->input_curr].asd =NULL ; - } +if (input != isp->asd.input_curr) +atomisp_s_sensor_power (isp, isp->asd.input_curr,0 );/* powe on the new sensor */ - ret =v4l2_subdev_call (isp->inputs[input].camera, core, s_power,1 ); -if (ret && ret != -ENOIOCTLCMD ) { -dev_err (isp->dev,"Failed to power-on sensor\n" ); + ret =atomisp_s_sensor_power (isp, input,1 ); +if (ret)return ret; - } asd->input_curr = input; -/* mark this camera is used by the current stream */ - isp->inputs[input].asd = asd; -return 0 ; }
Signature · 1 line
2.44.0
PATCH 2/23 media: atomisp: Turn on sensor power from atomisp_set_fmt()
In reply to Hans de GoedeATM the atomisp driver does not call s_power() at all when no s_input ioctl() is done by the application. This breaks older sensor drivers which rely on s_power() for power-management.
Some drivers have worked around this, e.g. commit c5fafbadaeae ("media:
atomisp: gc0310: Power on sensor from set_fmt() callback") and commit b3118a942c82 ("media: atomisp: ov2722: Power on sensor from set_fmt() callback"), but this really should be fixed in the atomisp driver itself, so that all old drivers can work.
A logical place to call s_power() would be from atomisp_start_streaming() / atomisp_stop_streaming(). But some older drivers, e.g. the atomisp-ov2722 driver already write mode related registers on set_fmt() instead of waiting on stream on. So the s_power(1) needs to happen at the first set_fmt().
Add an atomisp_s_sensor_power(..., 1) call just before calling set_fmt() for this. If the power was already enabled through e.g. a s_input ioctl atomisp_s_sensor_power() will skip calling the s_power() v4l2-subdev-op a second time.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +11 -0
@@ -3760,6 +3760,17 @@ static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp,if (!input->camera)return -EINVAL ; +/* +* Some old sensor drivers already write the registers on set_fmt +* instead of on stream on, power on the sensor now (on newer +* sensor drivers the s_power op is a no-op). +*/ +if (which ==V4L2_SUBDEV_FORMAT_ACTIVE ) { + ret =atomisp_s_sensor_power (isp, isp->asd.input_curr,1 ); +if (ret) +return ret; + } + sd_state = (which ==V4L2_SUBDEV_FORMAT_TRY ) ? input->try_sd_state : input->camera->active_state;if (sd_state)
Signature · 1 line
2.44.0
PATCH 3/23 media: atomisp: Add atomisp_select_input() helper
In reply to Hans de GoedeWhen switching input/sensor the s_power() callback must be called for old sensor drivers to power on the new sensor and power off the previous sensor.
atomisp_s_input() already does this but atomisp_link_setup() did not do this.
Add a new atomisp_select_input() helper which does this and use this in both atomisp_s_input() and atomisp_link_setup() for consistent behavior.
Also make atomisp_link_setup() turn the sensor back off when a link gets disabled.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 19 +++++++++++++++++++ .../staging/media/atomisp/pci/atomisp_cmd.h | 3 +++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 13 +------------ .../media/atomisp/pci/atomisp_subdev.c | 15 +++++++++------ 4 files changed, 32 insertions(+), 18 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +19 -0
@@ -3739,6 +3739,25 @@ int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, boolreturn 0 ; } +int atomisp_select_input (struct atomisp_device *isp,unsigned int input) +{ +unsigned int input_orig = isp->asd.input_curr; +int ret; + +/* Power on new sensor */ + ret =atomisp_s_sensor_power (isp, input,1 ); +if (ret) +return ret; + + isp->asd.input_curr = input; + +/* Power off previous sensor */ +if (input != input_orig) +atomisp_s_sensor_power (isp, input_orig,0 ); + +return 0 ; +} +static int atomisp_set_sensor_crop_and_fmt (struct atomisp_device *isp,struct v4l2_mbus_framefmt *ffmt,int which)
drivers/staging/media/atomisp/pci/atomisp_cmd.h +3 -0
@@ -244,6 +244,9 @@ void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height,/* Set sensor power (no-op if already on/off) */ int atomisp_s_sensor_power (struct atomisp_device *isp,unsigned int input,bool on); +/* Select which sensor to use, must be called with a valid input */ +int atomisp_select_input (struct atomisp_device *isp,unsigned int input); +/* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret,
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +1 -12
@@ -449,7 +449,6 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)struct video_device *vdev =video_devdata (file);struct atomisp_device *isp =video_get_drvdata (vdev);struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev); -struct atomisp_sub_device *asd = pipe->asd;struct v4l2_subdev *camera =NULL ;int ret;
@@ -468,17 +467,7 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)return -EINVAL ; } -/* power off the current owned sensor, as it is not used this time */ -if (input != isp->asd.input_curr) -atomisp_s_sensor_power (isp, isp->asd.input_curr,0 ); - -/* powe on the new sensor */ - ret =atomisp_s_sensor_power (isp, input,1 ); -if (ret) -return ret; - - asd->input_curr = input; -return 0 ; +return atomisp_select_input (isp, input); }/*
drivers/staging/media/atomisp/pci/atomisp_subdev.c +9 -6
@@ -663,9 +663,6 @@ static int atomisp_link_setup(struct media_entity *entity,return -EINVAL ; } -/* Ignore disables, input_curr should only be updated on enables */ -if (!(flags &MEDIA_LNK_FL_ENABLED )) -return 0 ;for (i =0 ; i < isp->input_cnt; i++) {if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx])
@@ -679,11 +676,17 @@ static int atomisp_link_setup(struct media_entity *entity,mutex_lock (&isp->mutex); ret =atomisp_pipe_check (&asd->video_out, true); -if (ret ==0 ) - asd->input_curr = i;mutex_unlock (&isp->mutex); +if (ret) +return ret; -return ret; +/* Turn off the sensor on link disable */ +if (!(flags &MEDIA_LNK_FL_ENABLED )) { +atomisp_s_sensor_power (isp, i,0 ); +return 0 ; + } + +return atomisp_select_input (isp, i); }static const struct media_entity_operations isp_subdev_media_ops = {
Signature · 1 line
2.44.0
PATCH 4/23 media: atomisp: Simplify atomisp_s_input() input argument checking
In reply to Hans de GoedeSimplify the checking of the input argument to atomisp_s_input():
- Remove the check for input >= ATOM_ISP_MAX_INPUTS, input_cnt never is > ATOM_ISP_MAX_INPUTS so checking only that is sufficient
- Remove the unnecessary camera local variable
- Move the 2 invalid argument checks to above the atomisp_pipe_check() which checks if the pipe is busy or not
--- .../staging/media/atomisp/pci/atomisp_ioctl.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +6 -12
@@ -449,24 +449,18 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)struct video_device *vdev =video_devdata (file);struct atomisp_device *isp =video_get_drvdata (vdev);struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev); -struct v4l2_subdev *camera =NULL ;int ret; +if (input >= isp->input_cnt) +return -EINVAL ; + +if (!isp->inputs[input].camera) +return -EINVAL ; + ret =atomisp_pipe_check (pipe, true);if (ret)return ret; -if (input >=ATOM_ISP_MAX_INPUTS || input >= isp->input_cnt) { -dev_dbg (isp->dev,"input_cnt: %d\n" , isp->input_cnt); -return -EINVAL ; - } - - camera = isp->inputs[input].camera; -if (!camera) { -dev_err (isp->dev,"%s, no camera\n" , __func__); -return -EINVAL ; - } -return atomisp_select_input (isp, input); }
Signature · 1 line
2.44.0
PATCH 5/23 media: atomisp: Ensure CSI-receiver[x] -> ISP links correctly reflect current sensor
In reply to Hans de GoedeAdd a new atomisp_setup_input_links() helper which ensures that the CSI-receiver -> ISP link for input_curr is marked as enabled and the other CSI-receiver -> ISP links are disabled.
And call this helper from atomisp_register_device_nodes() for the initial setup and from atomisp_select_input() for runtime input_curr changes.
--- .../staging/media/atomisp/pci/atomisp_cmd.c | 34 +++++++++++++++++++ .../staging/media/atomisp/pci/atomisp_cmd.h | 3 ++ .../staging/media/atomisp/pci/atomisp_ioctl.c | 6 +++- .../staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++ 4 files changed, 46 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +34 -0
@@ -3755,9 +3755,43 @@ int atomisp_select_input(struct atomisp_device *isp, unsigned int input)if (input != input_orig)atomisp_s_sensor_power (isp, input_orig,0 ); +atomisp_setup_input_links (isp);return 0 ; } +/* +* Ensure the CSI-receiver -> ISP link for input_curr is marked as enabled and +* the other CSI-receiver -> ISP links are disabled. +*/ +void atomisp_setup_input_links (struct atomisp_device *isp) +{ +struct media_link *link; + +lockdep_assert_held (&isp->media_dev.graph_mutex); + +for (int i =0 ; i <ATOMISP_CAMERA_NR_PORTS ; i++) { + link =media_entity_find_link ( + &isp->csi2_port[i].subdev.entity.pads[CSI2_PAD_SOURCE ], + &isp->asd.subdev.entity.pads[ATOMISP_SUBDEV_PAD_SINK ]); +if (!link) { +dev_err (isp->dev,"Error cannot find CSI2-port[%d] -> ISP link\n" , i); +continue ;/* Should never happen */ + } + +/* +* Modify the flags directly, calling media_entity_setup_link() +* will end up calling atomisp_link_setup() which calls this +* function again leading to endless recursion. +*/ +if (isp->sensor_subdevs[i] == isp->inputs[isp->asd.input_curr].camera) + link->flags |=MEDIA_LNK_FL_ENABLED ; +else + link->flags &= ~MEDIA_LNK_FL_ENABLED ; + + link->reverse->flags = link->flags; + } +} +static int atomisp_set_sensor_crop_and_fmt (struct atomisp_device *isp,struct v4l2_mbus_framefmt *ffmt,int which)
drivers/staging/media/atomisp/pci/atomisp_cmd.h +3 -0
@@ -247,6 +247,9 @@ int atomisp_s_sensor_power(struct atomisp_device *isp, unsigned int input, bool/* Select which sensor to use, must be called with a valid input */ int atomisp_select_input (struct atomisp_device *isp,unsigned int input); +/* Setup media-controller links to reflect input_curr setting */ +void atomisp_setup_input_links (struct atomisp_device *isp); +/* This function looks up the closest available resolution. */ int atomisp_try_fmt(struct atomisp_device *isp, struct v4l2_pix_format *f, const struct atomisp_format_bridge **fmt_ret,
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +5 -1
@@ -461,7 +461,11 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)if (ret)return ret; -return atomisp_select_input (isp, input); +mutex_lock (&isp->media_dev.graph_mutex); + ret =atomisp_select_input (isp, input); +mutex_unlock (&isp->media_dev.graph_mutex); + +return ret; }/*
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +4 -0
@@ -1085,6 +1085,10 @@ int atomisp_register_device_nodes(struct atomisp_device *isp)dev_warn (isp->dev,"too many atomisp inputs, TPG ignored.\n" ); } +mutex_lock (&isp->media_dev.graph_mutex); +atomisp_setup_input_links (isp); +mutex_unlock (&isp->media_dev.graph_mutex); + isp->asd.video_out.vdev.v4l2_dev = &isp->v4l2_dev; isp->asd.video_out.vdev.device_caps =V4L2_CAP_VIDEO_CAPTURE |V4L2_CAP_STREAMING ; err =video_register_device (&isp->asd.video_out.vdev,VFL_TYPE_VIDEO ,-1 );
Signature · 1 line
2.44.0
PATCH 6/23 media: atomisp: Propagate set_fmt on sensor results to CSI port
In reply to Hans de GoedeSo far the CSI port sink and source pads have not had their fmt set at all, leaving things at the default of SBGGR8_1X8/0x0.
This means that pipeline validation such as e.g. done when calling media_pipeline_start() will fail since the links to / from the CSI ports have different fmts on each end.
Store a pointer to the CSI port v4l2-subdev in struct atomisp_input_subdev, and use this in atomisp_set_sensor_crop_and_fmt() to propagate the sensors new fmt after a successful set_fmt to the CSI port it is connected too.
The input->csi_port pointer also allows simplifying atomisp_link_setup().
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 7 +++++++ .../media/atomisp/pci/atomisp_internal.h | 1 + .../staging/media/atomisp/pci/atomisp_subdev.c | 17 +++-------------- .../staging/media/atomisp/pci/atomisp_v4l2.c | 1 + 4 files changed, 12 insertions(+), 14 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +7 -0
@@ -3858,6 +3858,13 @@ static int atomisp_set_sensor_crop_and_fmt(struct atomisp_device *isp,if (sd_state)v4l2_subdev_unlock_state (sd_state); +/* Propagate new fmt to CSI port */ +if (which ==V4L2_SUBDEV_FORMAT_ACTIVE ) { + ret =v4l2_subdev_call (input->csi_port, pad, set_fmt,NULL , &format); +if (ret) +return ret; + } + *ffmt = format.format;return ret; }
drivers/staging/media/atomisp/pci/atomisp_internal.h +1 -0
@@ -129,6 +129,7 @@ struct atomisp_input_subdev {bool crop_support;bool camera_on;struct v4l2_subdev *camera; +struct v4l2_subdev *csi_port;/* Sensor rects for sensors which support crop */ struct v4l2_rect native_rect;struct v4l2_rect active_rect;
drivers/staging/media/atomisp/pci/atomisp_subdev.c +3 -14
@@ -644,7 +644,7 @@ static int atomisp_link_setup(struct media_entity *entity, entity);struct atomisp_sub_device *asd =v4l2_get_subdevdata (sd);struct atomisp_device *isp = asd->isp; -int i, csi_idx, ret; +int i, ret;/* ISP's source is immutable */ if (local != &asd->pads[ATOMISP_SUBDEV_PAD_SINK ]) {
@@ -653,24 +653,13 @@ static int atomisp_link_setup(struct media_entity *entity,return -EINVAL ; } -for (csi_idx =0 ; csi_idx <ATOMISP_CAMERA_NR_PORTS ; csi_idx++) { -if (&isp->csi2_port[csi_idx].pads[CSI2_PAD_SOURCE ] == remote) -break ; - } - -if (csi_idx ==ATOMISP_CAMERA_NR_PORTS ) { -v4l2_err (sd,"Error cannot find CSI receiver for remote pad\n" ); -return -EINVAL ; - } - -for (i =0 ; i < isp->input_cnt; i++) { -if (isp->inputs[i].camera == isp->sensor_subdevs[csi_idx]) +if (&isp->inputs[i].csi_port->entity.pads[CSI2_PAD_SOURCE ] == remote)break ; }if (i == isp->input_cnt) { -v4l2_err (sd,"Error no sensor for CSI receiver %d\n" , csi_idx); +v4l2_err (sd,"Error no sensor for selected CSI receiver\n" );return -EINVAL ; }
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1 -0
@@ -1058,6 +1058,7 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) input->type =RAW_CAMERA ; input->port = i; input->camera = isp->sensor_subdevs[i]; + input->csi_port = &isp->csi2_port[i].subdev;atomisp_init_sensor (input);
Signature · 1 line
2.44.0
PATCH 7/23 media: atomisp: Propagate v4l2_mbus_framefmt.field to CSI port sink pad
In reply to Hans de GoedeMost sensor drivers report V4L2_FIELD_NONE as v4l2_mbus_framefmt.field value. Propagate this to the v4l2_mbus_framefmt for the CSI port to pass the link validation done by media_pipeline_start().
Keep the v4l2_mbus_framefmt.field for the source pad of the CSI port as V4L2_FIELD_ANY to match the ISP sink pad.
--- drivers/staging/media/atomisp/pci/atomisp_csi2.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +3 -0
@@ -107,9 +107,12 @@ int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, actual_ffmt->height =clamp_t (u32, ffmt->height,ATOM_ISP_MIN_HEIGHT ,ATOM_ISP_MAX_HEIGHT ); + actual_ffmt->field = ffmt->field; tmp_ffmt = *ffmt = *actual_ffmt; +/* Always use V4L2_FIELD_ANY to match the ISP sink pad */ + tmp_ffmt.field =V4L2_FIELD_ANY ;return atomisp_csi2_set_ffmt (sd, sd_state, which,CSI2_PAD_SOURCE , &tmp_ffmt);
Signature · 1 line
2.44.0
PATCH 8/23 media: atomisp: Call media_pipeline_alloc_start() in stream start
In reply to Hans de GoedeCall media_pipeline_alloc_start() from atomisp_start_streaming() to mark all involved subdevs as busy so that the links cannot be changed through the media-controller APIs while streaming.
--- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 15 +++++++++++++++ .../staging/media/atomisp/pci/atomisp_subdev.h | 1 + 2 files changed, 16 insertions(+)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +15 -0
@@ -902,6 +902,20 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count)if (ret) goto out_unlock; +/* +* When running a classic v4l2 app after a media-controller aware +* app, the CSI-receiver -> ISP link for the current sensor may be +* disabled. Fix this up before marking the pipeline as started. +*/ +mutex_lock (&isp->media_dev.graph_mutex); +atomisp_setup_input_links (isp); + ret =__media_pipeline_start (&asd->video_out.vdev.entity.pads[0 ], &asd->video_out.pipe); +mutex_unlock (&isp->media_dev.graph_mutex); +if (ret) { +dev_err (isp->dev,"Error starting mc pipline: %d\n" , ret); + goto out_unlock; + } +/* Input system HW workaround */ atomisp_dma_burst_len_cfg (asd);
@@ -1054,6 +1068,7 @@ void atomisp_stop_streaming(struct vb2_queue *vq)if (ret)dev_warn (isp->dev,"Recreating streams failed: %d\n" , ret); +media_pipeline_stop (&asd->video_out.vdev.entity.pads[0 ]);mutex_unlock (&isp->mutex); }
drivers/staging/media/atomisp/pci/atomisp_subdev.h +1 -0
@@ -49,6 +49,7 @@ struct atomisp_video_pipe {struct video_device vdev;enum v4l2_buf_type type;struct media_pad pad; +struct media_pipeline pipe;struct vb2_queue vb_queue;/* Lock for vb_queue, when also taking isp->mutex this must be taken first! */ struct mutex vb_queue_mutex;
Signature · 1 line
2.44.0
PATCH 9/23 media: atomisp: Drop atomisp_pipe_check() from atomisp_link_setup()
In reply to Hans de GoedeThe media-controller core (__media_entity_setup_link()) already checks that the pads of the link are not streaming before calling the setup_link() pad-op so calling atomisp_pipe_check() is not necessary;
and taking isp->mutex inside the setup_link() pad-op leads to a possible ABBA deadlock vs the media-device graph_mutex which in the case of the setup_link() pad-op is taken before calling the op, while in other scenarios the graph_mutex is taken after the isp->mutex.
--- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +1 -7
@@ -644,7 +644,7 @@ static int atomisp_link_setup(struct media_entity *entity, entity);struct atomisp_sub_device *asd =v4l2_get_subdevdata (sd);struct atomisp_device *isp = asd->isp; -int i, ret; +int i;/* ISP's source is immutable */ if (local != &asd->pads[ATOMISP_SUBDEV_PAD_SINK ]) {
@@ -663,12 +663,6 @@ static int atomisp_link_setup(struct media_entity *entity,return -EINVAL ; } -mutex_lock (&isp->mutex); - ret =atomisp_pipe_check (&asd->video_out, true); -mutex_unlock (&isp->mutex); -if (ret) -return ret; -/* Turn off the sensor on link disable */ if (!(flags &MEDIA_LNK_FL_ENABLED )) {atomisp_s_sensor_power (isp, i,0 );
Signature · 1 line
2.44.0
PATCH 10/23 media: atomisp: ov2722: Remove power on sensor from set_fmt() callback
In reply to Hans de GoedeThe atomisp driver now properly ensures s_power(1) is called before calling the set_fmt() callback, so this workaround is no longer necessary.
--- drivers/staging/media/atomisp/i2c/atomisp-ov2722.c | 12 ------------ drivers/staging/media/atomisp/i2c/ov2722.h | 1 - 2 files changed, 13 deletions(-)
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +0 -12
@@ -528,9 +528,6 @@ static int power_up(struct v4l2_subdev *sd)return -ENODEV ; } -if (dev->power_on ==1 ) -return 0 ;/* Already on */ -/* power control */ ret =power_ctrl (sd,1 );if (ret)
@@ -555,7 +552,6 @@ static int power_up(struct v4l2_subdev *sd)/* according to DS, 20ms is needed between PWDN and i2c access */ msleep (20 ); - dev->power_on =1 ;return 0 ; fail_clk:
@@ -579,9 +575,6 @@ static int power_down(struct v4l2_subdev *sd)return -ENODEV ; } -if (dev->power_on ==0 ) -return 0 ;/* Already off */ - ret = dev->platform_data->flisclk_ctrl (sd,0 );if (ret)dev_err (&client->dev,"flisclk failed\n" );
@@ -599,7 +592,6 @@ static int power_down(struct v4l2_subdev *sd)if (ret)dev_err (&client->dev,"vprog failed.\n" ); - dev->power_on =0 ;return ret; }
@@ -677,9 +669,6 @@ static int ov2722_set_fmt(struct v4l2_subdev *sd,mutex_lock (&dev->input_lock); -/* s_power has not been called yet for std v4l2 clients (camorama) */ -power_up (sd); - dev->pixels_per_line = dev->res->pixels_per_line; dev->lines_per_frame = dev->res->lines_per_frame;
@@ -978,7 +967,6 @@ static int ov2722_probe(struct i2c_client *client)return -ENOMEM ;mutex_init (&dev->input_lock); - dev->power_on =-1 ; dev->res = &ov2722_res_preview[0 ];v4l2_i2c_subdev_init (&dev->sd, client, &ov2722_ops);
drivers/staging/media/atomisp/i2c/ov2722.h +0 -1
@@ -198,7 +198,6 @@ struct ov2722_device {struct ov2722_resolution *res;struct camera_sensor_platform_data *platform_data; -int power_on;u16 pixels_per_line;u16 lines_per_frame;u8 type;
Signature · 1 line
2.44.0
PATCH 11/23 media: atomisp: Remove test pattern generator (TPG) support
In reply to Hans de GoedeThe TPG support registers a v4l2-subdev for this, but this is not part of the media-controller graph in any way. After manually selecting the TPG as input using the s_input ioctl it does not work.
Several supported sensors have their own working TPG and using the sensor's TPG means that the same data-flow is used as with actual sensors rather then the quite different data-flow from the ISP's builtin TPG.
Remove the broken TPG support, when a test-pattern is needed for testing a sensor's TPG can be used. Using a sensor's TPG is actually better for testing since then the actual normal data-flow is being tested.
--- drivers/staging/media/atomisp/Makefile | 1 - .../atomisp/include/linux/atomisp_platform.h | 1 - .../staging/media/atomisp/pci/atomisp_cmd.c | 36 ++-- .../media/atomisp/pci/atomisp_compat_css20.c | 31 +--- .../media/atomisp/pci/atomisp_internal.h | 2 - .../staging/media/atomisp/pci/atomisp_tpg.c | 164 ------------------ .../staging/media/atomisp/pci/atomisp_tpg.h | 39 ----- .../staging/media/atomisp/pci/atomisp_v4l2.c | 27 --- .../hive_isp_css_common/host/input_system.c | 38 ---- drivers/staging/media/atomisp/pci/ia_css.h | 1 - .../media/atomisp/pci/ia_css_stream_public.h | 3 - .../staging/media/atomisp/pci/ia_css_tpg.h | 79 --------- .../atomisp/pci/isp2400_input_system_global.h | 1 - .../atomisp/pci/isp2400_input_system_public.h | 15 -- .../atomisp/pci/isp2401_input_system_global.h | 1 - .../pci/runtime/debug/src/ia_css_debug.c | 17 -- .../atomisp/pci/runtime/ifmtr/src/ifmtr.c | 11 -- .../pci/runtime/isys/src/virtual_isys.c | 28 +-- drivers/staging/media/atomisp/pci/sh_css.c | 88 +--------- .../media/atomisp/pci/sh_css_internal.h | 1 - drivers/staging/media/atomisp/pci/sh_css_sp.c | 14 -- drivers/staging/media/atomisp/pci/sh_css_sp.h | 7 - 22 files changed, 20 insertions(+), 585 deletions(-) delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_tpg.c delete mode 100644 drivers/staging/media/atomisp/pci/atomisp_tpg.h delete mode 100644 drivers/staging/media/atomisp/pci/ia_css_tpg.h
drivers/staging/media/atomisp/Makefile +0 -1
@@ -21,7 +21,6 @@ atomisp-objs += \ pci/atomisp_fops.o \ pci/atomisp_ioctl.o \ pci/atomisp_subdev.o \ - pci/atomisp_tpg.o \ pci/atomisp_v4l2.o \ pci/sh_css_firmware.o \ pci/sh_css_host_data.o \
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +0 -1
@@ -112,7 +112,6 @@ enum atomisp_input_format {enum intel_v4l2_subdev_type {RAW_CAMERA =1 ,LED_FLASH =2 , -TEST_PATTERN =3 , };struct intel_v4l2_subdev_id {
drivers/staging/media/atomisp/pci/atomisp_cmd.c +17 -19
@@ -4143,28 +4143,26 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,if (!format)return -EINVAL ; -if (input->type !=TEST_PATTERN ) { - mipi_info =atomisp_to_sensor_mipi_info (input->camera); + mipi_info =atomisp_to_sensor_mipi_info (input->camera); -if (atomisp_set_sensor_mipi_to_isp (asd,ATOMISP_INPUT_STREAM_GENERAL , - mipi_info)) -return -EINVAL ; +if (atomisp_set_sensor_mipi_to_isp (asd,ATOMISP_INPUT_STREAM_GENERAL , + mipi_info)) +return -EINVAL ; -if (mipi_info) - fc =atomisp_find_in_fmt_conv_by_atomisp_in_fmt (mipi_info->input_format); +if (mipi_info) + fc =atomisp_find_in_fmt_conv_by_atomisp_in_fmt (mipi_info->input_format); -if (!fc) - fc =atomisp_find_in_fmt_conv ( -atomisp_subdev_get_ffmt (&asd->subdev, -NULL ,V4L2_SUBDEV_FORMAT_ACTIVE , -ATOMISP_SUBDEV_PAD_SINK )->code); -if (!fc) -return -EINVAL ; -if (format->sh_fmt ==IA_CSS_FRAME_FORMAT_RAW && -raw_output_format_match_input (fc->atomisp_in_fmt, - pix->pixelformat)) -return -EINVAL ; - } +if (!fc) + fc =atomisp_find_in_fmt_conv ( +atomisp_subdev_get_ffmt (&asd->subdev, +NULL ,V4L2_SUBDEV_FORMAT_ACTIVE , +ATOMISP_SUBDEV_PAD_SINK )->code); +if (!fc) +return -EINVAL ; +if (format->sh_fmt ==IA_CSS_FRAME_FORMAT_RAW && +raw_output_format_match_input (fc->atomisp_in_fmt, + pix->pixelformat)) +return -EINVAL ;/* * Configure viewfinder also when vfpp is disabled: the
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +1 -30
@@ -302,21 +302,6 @@ static void __dump_stream_config(struct atomisp_sub_device *asd,"stream_config.source.port.compression.uncompressed_bits_per_pixel=%d.\n" , s_config->source.port.compression. uncompressed_bits_per_pixel); - }else if (s_config->mode ==IA_CSS_INPUT_MODE_TPG ) { -dev_dbg (isp->dev,"stream_config.source.tpg.id=%d.\n" , - s_config->source.tpg.id); -dev_dbg (isp->dev,"stream_config.source.tpg.mode=%d.\n" , - s_config->source.tpg.mode); -dev_dbg (isp->dev,"stream_config.source.tpg.x_mask=%d.\n" , - s_config->source.tpg.x_mask); -dev_dbg (isp->dev,"stream_config.source.tpg.x_delta=%d.\n" , - s_config->source.tpg.x_delta); -dev_dbg (isp->dev,"stream_config.source.tpg.y_mask=%d.\n" , - s_config->source.tpg.y_mask); -dev_dbg (isp->dev,"stream_config.source.tpg.y_delta=%d.\n" , - s_config->source.tpg.y_delta); -dev_dbg (isp->dev,"stream_config.source.tpg.xy_mask=%d.\n" , - s_config->source.tpg.xy_mask); }else if (s_config->mode ==IA_CSS_INPUT_MODE_PRBS ) {dev_dbg (isp->dev,"stream_config.source.prbs.id=%d.\n" , s_config->source.prbs.id);
@@ -1672,26 +1657,12 @@ void atomisp_css_capture_set_mode(struct atomisp_sub_device *asd,void atomisp_css_input_set_mode (struct atomisp_sub_device *asd,enum ia_css_input_mode mode) { -int i; -struct atomisp_device *isp = asd->isp;unsigned int size_mem_words; +int i;for (i =0 ; i <ATOMISP_INPUT_STREAM_NUM ; i++) asd->stream_env[i].stream_config.mode = mode; -if (isp->inputs[asd->input_curr].type ==TEST_PATTERN ) { -struct ia_css_stream_config *s_config = - &asd->stream_env[ATOMISP_INPUT_STREAM_GENERAL ].stream_config; - s_config->mode =IA_CSS_INPUT_MODE_TPG ; - s_config->source.tpg.mode =IA_CSS_TPG_MODE_CHECKERBOARD ; - s_config->source.tpg.x_mask = (1 <<4 ) -1 ; - s_config->source.tpg.x_delta =-2 ; - s_config->source.tpg.y_mask = (1 <<4 ) -1 ; - s_config->source.tpg.y_delta =3 ; - s_config->source.tpg.xy_mask = (1 <<8 ) -1 ; -return ; - } -if (mode !=IA_CSS_INPUT_MODE_BUFFERED_SENSOR )return ;
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -2
@@ -36,7 +36,6 @@#include "atomisp_csi2.h" #include "atomisp_subdev.h" -#include "atomisp_tpg.h" #include "atomisp_compat.h" #include "gp_device.h"
@@ -188,7 +187,6 @@ struct atomisp_device {bool pm_only;struct atomisp_mipi_csi2_device csi2_port[ATOMISP_CAMERA_NR_PORTS ]; -struct atomisp_tpg_device tpg;/* Purpose of mutex is to protect and serialize use of isp data * structures and css API calls. */
drivers/staging/media/atomisp/pci/atomisp_tpg.c deleted +0 -164
164 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_tpg.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* -* Support for Medifield PNW Camera Imaging ISP subsystem. -* -* Copyright (c) 2010 Intel Corporation. All Rights Reserved. -* -* Copyright (c) 2010 Silicon Hive www.siliconhive.com. -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License version -* 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* -*/ - -#ifndef __ATOMISP_TPG_H__ -#define __ATOMISP_TPG_H__ - -#include <media/media-entity.h> -#include <media/v4l2-subdev.h> - -struct atomisp_tpg_device { -struct v4l2_subdev sd; -struct atomisp_device *isp; -struct media_pad pads[1 ]; -}; - -void atomisp_tpg_cleanup (struct atomisp_device *isp); -int atomisp_tpg_init (struct atomisp_device *isp); -void atomisp_tpg_unregister_entities (struct atomisp_tpg_device *tpg); -int atomisp_tpg_register_entities (struct atomisp_tpg_device *tpg, -struct v4l2_device *vdev); - -#endif /* __ATOMISP_TPG_H__ */
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0 -27
@@ -847,7 +847,6 @@ static void atomisp_unregister_entities(struct atomisp_device *isp)struct v4l2_subdev *sd, *next;atomisp_subdev_unregister_entities (&isp->asd); -atomisp_tpg_unregister_entities (&isp->tpg);for (i =0 ; i <ATOMISP_CAMERA_NR_PORTS ; i++)atomisp_mipi_csi2_unregister_entities (&isp->csi2_port[i]);
@@ -902,12 +901,6 @@ static int atomisp_register_entities(struct atomisp_device *isp) goto csi_and_subdev_probe_failed; } - ret =atomisp_tpg_register_entities (&isp->tpg, &isp->v4l2_dev); -if (ret <0 ) { -dev_err (isp->dev,"atomisp_tpg_register_entities\n" ); - goto tpg_register_failed; - } - ret =atomisp_subdev_register_subdev (&isp->asd, &isp->v4l2_dev);if (ret <0 ) {dev_err (isp->dev,"atomisp_subdev_register_subdev fail\n" );
@@ -917,8 +910,6 @@ static int atomisp_register_entities(struct atomisp_device *isp)return 0 ; subdev_register_failed: -atomisp_tpg_unregister_entities (&isp->tpg); -tpg_register_failed:for (i =0 ; i <ATOMISP_CAMERA_NR_PORTS ; i++)atomisp_mipi_csi2_unregister_entities (&isp->csi2_port[i]); csi_and_subdev_probe_failed:
@@ -1077,15 +1068,6 @@ int atomisp_register_device_nodes(struct atomisp_device *isp)else dev_info (isp->dev,"detected %d camera sensors\n" , isp->input_cnt); -if (isp->input_cnt <ATOM_ISP_MAX_INPUTS ) { -dev_dbg (isp->dev,"TPG detected, camera_cnt: %d\n" , isp->input_cnt); - isp->inputs[isp->input_cnt].type =TEST_PATTERN ; - isp->inputs[isp->input_cnt].port =-1 ; - isp->inputs[isp->input_cnt++].camera = &isp->tpg.sd; - }else { -dev_warn (isp->dev,"too many atomisp inputs, TPG ignored.\n" ); - } -mutex_lock (&isp->media_dev.graph_mutex);atomisp_setup_input_links (isp);mutex_unlock (&isp->media_dev.graph_mutex);
@@ -1119,12 +1101,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp) goto error_mipi_csi2; } - ret =atomisp_tpg_init (isp); -if (ret <0 ) { -dev_err (isp->dev,"tpg initialization failed\n" ); - goto error_tpg; - } - ret =atomisp_subdev_init (isp);if (ret <0 ) {dev_err (isp->dev,"ISP subdev initialization failed\n" );
@@ -1134,8 +1110,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp)return 0 ; error_isp_subdev: -error_tpg: -atomisp_tpg_cleanup (isp); error_mipi_csi2:atomisp_mipi_csi2_cleanup (isp);return ret;
@@ -1143,7 +1117,6 @@ static int atomisp_initialize_modules(struct atomisp_device *isp)static void atomisp_uninitialize_modules (struct atomisp_device *isp) { -atomisp_tpg_cleanup (isp);atomisp_mipi_csi2_cleanup (isp); }
drivers/staging/media/atomisp/pci/hive_isp_css_common/host/input_system.c +0 -38
@@ -426,7 +426,6 @@ static input_system_err_t input_system_configure_channel(case INPUT_SYSTEM_SOURCE_SENSOR : error =input_system_configure_channel_sensor (channel);break ; -case INPUT_SYSTEM_SOURCE_TPG :case INPUT_SYSTEM_SOURCE_PRBS :case INPUT_SYSTEM_SOURCE_FIFO :default :
@@ -814,7 +813,6 @@ static input_system_err_t configuration_to_registers(void)//... break ; -case INPUT_SYSTEM_SOURCE_TPG :case INPUT_SYSTEM_SOURCE_PRBS :case INPUT_SYSTEM_SOURCE_FIFO :break ;
@@ -1065,42 +1063,6 @@ input_system_err_t input_system_prbs_channel_cfg(return input_system_configure_channel (channel); } -input_system_err_t input_system_tpg_channel_cfg ( -u32 ch_id, -u32 nof_frames,//not used yet -u32 x_mask, -u32 y_mask, -u32 x_delta, -u32 y_delta, -u32 xy_mask, -u32 sync_gen_width, -u32 sync_gen_height, -u32 sync_gen_hblank_cycles, -u32 sync_gen_vblank_cycles, -target_cfg2400_t target -) -{ -channel_cfg_t channel; - - (void )nof_frames; - - channel.ch_id = ch_id; - channel.source_type =INPUT_SYSTEM_SOURCE_TPG ; - - channel.source_cfg.tpg_cfg.x_mask = x_mask; - channel.source_cfg.tpg_cfg.y_mask = y_mask; - channel.source_cfg.tpg_cfg.x_delta = x_delta; - channel.source_cfg.tpg_cfg.y_delta = y_delta; - channel.source_cfg.tpg_cfg.xy_mask = xy_mask; - channel.source_cfg.tpg_cfg.sync_gen_cfg.width = sync_gen_width; - channel.source_cfg.tpg_cfg.sync_gen_cfg.height = sync_gen_height; - channel.source_cfg.tpg_cfg.sync_gen_cfg.hblank_cycles = sync_gen_hblank_cycles; - channel.source_cfg.tpg_cfg.sync_gen_cfg.vblank_cycles = sync_gen_vblank_cycles; - - channel.target_cfg = target; -return input_system_configure_channel (channel); -} -// MW: Don't use system specific names, (even in system specific files) "cfg2400" -> cfg input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id,
drivers/staging/media/atomisp/pci/ia_css.h +0 -1
@@ -42,7 +42,6 @@#include "ia_css_properties.h" #include "ia_css_stream_format.h" #include "ia_css_stream_public.h" -#include "ia_css_tpg.h" #include "ia_css_version.h" #include "ia_css_mmu.h" #include "ia_css_morph.h"
drivers/staging/media/atomisp/pci/ia_css_stream_public.h +0 -3
@@ -24,7 +24,6 @@#include "ia_css_types.h" #include "ia_css_pipe_public.h" #include "ia_css_metadata.h" -#include "ia_css_tpg.h" #include "ia_css_prbs.h" #include "ia_css_input_port.h"
@@ -34,7 +33,6 @@enum ia_css_input_mode {IA_CSS_INPUT_MODE_SENSOR ,/** data from sensor */ IA_CSS_INPUT_MODE_FIFO ,/** data from input-fifo */ -IA_CSS_INPUT_MODE_TPG ,/** data from test-pattern generator */ IA_CSS_INPUT_MODE_PRBS ,/** data from pseudo-random bit stream */ IA_CSS_INPUT_MODE_MEMORY ,/** data from a frame in memory */ IA_CSS_INPUT_MODE_BUFFERED_SENSOR /** data is sent through mipi buffer */
@@ -91,7 +89,6 @@ struct ia_css_stream_config {enum ia_css_input_mode mode;/** Input mode */ union {struct ia_css_input_port port;/** Port, for sensor only. */ -struct ia_css_tpg_config tpg;/** TPG configuration */ struct ia_css_prbs_config prbs;/** PRBS configuration */ } source;/** Source of input data */ unsigned int channel_id;/** Channel on which input data
drivers/staging/media/atomisp/pci/ia_css_tpg.h deleted +0 -79
79 lines not on this page · raw message
drivers/staging/media/atomisp/pci/isp2400_input_system_global.h +0 -1
@@ -35,7 +35,6 @@ typedef enum { typedef enum { INPUT_SYSTEM_SOURCE_SENSOR = 0, INPUT_SYSTEM_SOURCE_FIFO, - INPUT_SYSTEM_SOURCE_TPG, INPUT_SYSTEM_SOURCE_PRBS, INPUT_SYSTEM_SOURCE_MEMORY, N_INPUT_SYSTEM_SOURCE
drivers/staging/media/atomisp/pci/isp2400_input_system_public.h +0 -15
@@ -308,21 +308,6 @@ input_system_err_t input_system_prbs_channel_cfg(target_cfg2400_t target ); -input_system_err_t input_system_tpg_channel_cfg ( -u32 ch_id, -u32 nof_frames,//not used yet -u32 x_mask, -u32 y_mask, -u32 x_delta, -u32 y_delta, -u32 xy_mask, -u32 sync_gen_width, -u32 sync_gen_height, -u32 sync_gen_hblank_cycles, -u32 sync_gen_vblank_cycles, -target_cfg2400_t target -); - input_system_err_t input_system_gpfifo_channel_cfg( u32 ch_id, u32 nof_frames,
drivers/staging/media/atomisp/pci/isp2401_input_system_global.h +0 -1
@@ -39,7 +39,6 @@typedef enum {INPUT_SYSTEM_SOURCE_TYPE_UNDEFINED =0 ,INPUT_SYSTEM_SOURCE_TYPE_SENSOR , -INPUT_SYSTEM_SOURCE_TYPE_TPG ,INPUT_SYSTEM_SOURCE_TYPE_PRBS ,N_INPUT_SYSTEM_SOURCE_TYPE }input_system_source_type_t ;
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c +0 -17
@@ -1549,23 +1549,6 @@ ia_css_debug_dump_stream_config_source(ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"compression: %d\n" , config->source.port.compression.type);break ; -case IA_CSS_INPUT_MODE_TPG : -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"source.tpg\n" ); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"id: %d\n" , - config->source.tpg.id); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"mode: %d\n" , - config->source.tpg.mode); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"x_mask: 0x%x\n" , - config->source.tpg.x_mask); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"x_delta: %d\n" , - config->source.tpg.x_delta); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"y_mask: 0x%x\n" , - config->source.tpg.y_mask); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"y_delta: %d\n" , - config->source.tpg.y_delta); -ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"xy_mask: 0x%x\n" , - config->source.tpg.xy_mask); -break ;case IA_CSS_INPUT_MODE_PRBS :ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"source.prbs\n" ); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "id: %d\n",
drivers/staging/media/atomisp/pci/runtime/ifmtr/src/ifmtr.c +0 -11
@@ -382,17 +382,6 @@ int ia_css_ifmtr_configure(struct ia_css_stream_config *config, vectors_per_buffer = buffer_height * buffer_width /ISP_VEC_NELEMS ; -if (config->mode ==IA_CSS_INPUT_MODE_TPG && - ((binary && binary->info->sp.pipeline.mode ==IA_CSS_BINARY_MODE_VIDEO ) || - (!binary))) { -/* !binary -> sp raw copy pipe */ -/* workaround for TPG in video mode */ - start_line =0 ; - start_column =0 ; - cropped_height -= start_line; - width_a -= start_column; - } - if_a_config.start_line = start_line; if_a_config.start_column = start_column; if_a_config.left_padding = left_padding / deinterleaving;
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +1 -27
@@ -96,12 +96,6 @@ static void release_be_lut_entry(csi_mipi_packet_type_t packet_type, csi_rx_backend_lut_entry_t *entry); -static bool calculate_tpg_cfg ( -input_system_channel_t *channel, -input_system_input_port_t *input_port, -isp2401_input_system_cfg_t *isys_cfg, -pixelgen_tpg_cfg_t *cfg); - static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port,
@@ -517,13 +511,6 @@ static bool calculate_input_system_input_port_cfg( rc &=calculate_be_cfg (input_port, isys_cfg, true, &input_port_cfg->csi_rx_cfg.md_backend_cfg);break ; -case INPUT_SYSTEM_SOURCE_TYPE_TPG : - rc =calculate_tpg_cfg ( - channel, - input_port, - isys_cfg, - &input_port_cfg->pixelgen_cfg.tpg_cfg); -break ;case INPUT_SYSTEM_SOURCE_TYPE_PRBS : rc = calculate_prbs_cfg( channel,
@@ -633,17 +620,6 @@ static void release_be_lut_entry(ia_css_isys_csi_rx_lut_rmgr_release (backend, packet_type, entry); } -static bool calculate_tpg_cfg ( -input_system_channel_t *channel, -input_system_input_port_t *input_port, -isp2401_input_system_cfg_t *isys_cfg, -pixelgen_tpg_cfg_t *cfg) -{ -memcpy (cfg, &isys_cfg->tpg_port_attr,sizeof (pixelgen_tpg_cfg_t)); - -return true; -} - static bool calculate_prbs_cfg( input_system_channel_t *channel, input_system_input_port_t *input_port,
@@ -703,9 +679,7 @@ static bool calculate_stream2mmio_cfg( cfg->bits_per_pixel = metadata ? isys_cfg->metadata.bits_per_pixel : isys_cfg->input_port_resolution.bits_per_pixel; - cfg->enable_blocking = - ((isys_cfg->mode ==INPUT_SYSTEM_SOURCE_TYPE_TPG ) || - (isys_cfg->mode ==INPUT_SYSTEM_SOURCE_TYPE_PRBS )); + cfg->enable_blocking = isys_cfg->mode ==INPUT_SYSTEM_SOURCE_TYPE_PRBS ;return true; }
drivers/staging/media/atomisp/pci/sh_css.c +1 -87
130 lines not on this page · raw message
drivers/staging/media/atomisp/pci/sh_css_internal.h +0 -1
@@ -360,7 +360,6 @@ struct sh_css_sp_config { } input_formatter;sync_generator_cfg_t sync_gen; -tpg_cfg_t tpg;prbs_cfg_t prbs;input_system_cfg_t input_circuit;u8 input_circuit_cfg_changed;
drivers/staging/media/atomisp/pci/sh_css_sp.c +0 -14
@@ -669,20 +669,6 @@ sh_css_sp_configure_sync_gen(int width, int height, sh_css_sp_group.config.sync_gen.vblank_cycles = vblank_cycles; } -void -sh_css_sp_configure_tpg (int x_mask, -int y_mask, -int x_delta, -int y_delta, -int xy_mask) -{ - sh_css_sp_group.config.tpg.x_mask = x_mask; - sh_css_sp_group.config.tpg.y_mask = y_mask; - sh_css_sp_group.config.tpg.x_delta = x_delta; - sh_css_sp_group.config.tpg.y_delta = y_delta; - sh_css_sp_group.config.tpg.xy_mask = xy_mask; -} -void sh_css_sp_configure_prbs (int seed) {
drivers/staging/media/atomisp/pci/sh_css_sp.h +0 -7
@@ -164,13 +164,6 @@ sh_css_sp_configure_sync_gen(int width,int hblank_cycles, int vblank_cycles); -void -sh_css_sp_configure_tpg (int x_mask, -int y_mask, -int x_delta, -int y_delta, -int xy_mask); -void sh_css_sp_configure_prbs (int seed);
Signature · 1 line
2.44.0
Andy Shevchenko
maintainerRe: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Quoted 11 lines · Hans de Goede
The TPG support registers a v4l2-subdev for this, but this is not part of the media-controller graph in any way. After manually selecting the TPG as input using the
s_inputioctl it does not work.Several supported sensors have their own working TPG and using the sensor's TPG means that the same data-flow is used as with actual sensors rather then the quite different data-flow from the ISP's builtin TPG.
Remove the broken TPG support, when a test-pattern is needed for testing a sensor's TPG can be used. Using a sensor's TPG is actually better for testing since then the actual normal data-flow is being tested.
...
drivers/staging/media/atomisp/pci/atomisp_cmd.c static int atomisp_set_fmt_to_isp(struct video_device *vdev, · line 4159
Quoted 8 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c +7
-0+if (mipi_info) + fc =atomisp_find_in_fmt_conv_by_atomisp_in_fmt (mipi_info->input_format); +if (!fc) + fc =atomisp_find_in_fmt_conv ( +atomisp_subdev_get_ffmt (&asd->subdev, +NULL ,V4L2_SUBDEV_FORMAT_ACTIVE , +ATOMISP_SUBDEV_PAD_SINK )->code);
While it was in the original code, this is ugly. Can we split this to two assignments?
drivers/staging/media/atomisp/pci/atomisp_cmd.c static int atomisp_set_fmt_to_isp(struct video_device *vdev,
Quoted 6 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c +5
-0+if (!fc) +return -EINVAL ; +if (format->sh_fmt ==IA_CSS_FRAME_FORMAT_RAW && +raw_output_format_match_input (fc->atomisp_in_fmt, + pix->pixelformat))
Now a single line?
Quoted 1 line
(quoted diff) +1
-0+ return -EINVAL;
...
drivers/staging/media/atomisp/pci/sh_css.c sh_css_config_input_network_2400(struct ia_css_stream *stream) · line 503
Quoted 3 lines
drivers/staging/media/atomisp/pci/sh_css.c +0
-0unsigned int hblank_cycles =100 , vblank_lines =6 , width,
Urgh... These comma operators probably is subject to replace with separate definitions or being grouped on a single line (as it suppose to be in this case).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Hi Andy,
Thank you for all the reviews!
Quoted 18 lines · Andy Shevchenko
Quoted 11 lines · Hans de Goede
The TPG support registers a v4l2-subdev for this, but this is not part of the media-controller graph in any way. After manually selecting the TPG as input using the
s_inputioctl it does not work.Several supported sensors have their own working TPG and using the sensor's TPG means that the same data-flow is used as with actual sensors rather then the quite different data-flow from the ISP's builtin TPG.
Remove the broken TPG support, when a test-pattern is needed for testing a sensor's TPG can be used. Using a sensor's TPG is actually better for testing since then the actual normal data-flow is being tested.
...
Quoted 3 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c +2
-0+if (mipi_info) + fc =atomisp_find_in_fmt_conv_by_atomisp_in_fmt (mipi_info->input_format);
Quoted 8 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c static int atomisp_set_fmt_to_isp(struct video_device *vdev, · line 4159
Quoted 5 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c +5
-0+if (!fc) + fc =atomisp_find_in_fmt_conv ( +atomisp_subdev_get_ffmt (&asd->subdev, +NULL ,V4L2_SUBDEV_FORMAT_ACTIVE , +ATOMISP_SUBDEV_PAD_SINK )->code);While it was in the original code, this is ugly. Can we split this to two assignments?
Ack, fixed.
Quoted 9 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c static int atomisp_set_fmt_to_isp(struct video_device *vdev,
Quoted 7 lines
drivers/staging/media/atomisp/pci/atomisp_cmd.c +5
-0+if (!fc) +return -EINVAL ; +if (format->sh_fmt ==IA_CSS_FRAME_FORMAT_RAW && +raw_output_format_match_input (fc->atomisp_in_fmt, + pix->pixelformat))Now a single line?
Ack, fixed.
Quoted 5 lines
Quoted 2 lines
(quoted diff) +1
-0+ return -EINVAL;...
Quoted 7 lines
drivers/staging/media/atomisp/pci/sh_css.c sh_css_config_input_network_2400(struct ia_css_stream *stream) · line 503
Quoted 3 lines
drivers/staging/media/atomisp/pci/sh_css.c +0
-0unsigned int hblank_cycles =100 , vblank_lines =6 , width,Urgh... These comma operators probably is subject to replace with separate definitions or being grouped on a single line (as it suppose to be in this case).
That indeed is ugly, but fixing this is out of scope for this patch, so I've added an extra patch to the set to address this:
Regards,
Hans
Re: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Quoted 2 lines · Hans de Goede
Quoted 1 line · Andy Shevchenko
On Mon, Apr 15, 2024 at 02:02:08PM +0200, Hans de Goede wrote:
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
unsigned int
hblank_cycles= 100,
vblank_lines= 6,
width,
Quoted 8 lines
Quoted 3 lines
Urgh... These comma operators probably is subject to replace with separate definitions or being grouped on a single line (as it suppose to be in this case).
That indeed is ugly, but fixing this is out of scope for this patch, so I've added an extra patch to the set to address this:
WFM, thanks!
Btw (yes, I see you tagged that already, so just FYI then) (1 + (stream->config.pixels_per_clock == 2));
is an interesting way of using
(stream->config.pixels_per_clock == 2) ? 2 : 1);
which likely can produce slightly better code (due to use of constant 2 twice), although it is a pure speculation by me.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Quoting Andy Shevchenko (2024-04-16 14:34:45)
Quoted 33 lines · Hans de Goede
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Hans de Goede
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
unsigned int
hblank_cycles= 100,
vblank_lines= 6,
width,Quoted 8 lines
Quoted 3 lines
Urgh... These comma operators probably is subject to replace with separate definitions or being grouped on a single line (as it suppose to be in this case).
That indeed is ugly, but fixing this is out of scope for this patch, so I've added an extra patch to the set to address this:
WFM, thanks!
Btw (yes, I see you tagged that already, so just FYI then) (1 + (
stream->config.pixels_per_clock== 2));
is an interesting way of using(
stream->config.pixels_per_clock== 2) ? 2 : 1);which likely can produce slightly better code (due to use of constant 2 twice), although it is a pure speculation by me.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Quoting Kieran Bingham (2024-04-16 15:37:39)
Quoted 30 lines
Quoting Andy Shevchenko (2024-04-16 14:34:45)
Quoted 29 lines · Hans de Goede
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Hans de Goede
...
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
unsigned int
hblank_cycles= 100,
vblank_lines= 6,
width,Quoted 8 lines
Quoted 3 lines
Urgh... These comma operators probably is subject to replace with separate definitions or being grouped on a single line (as it suppose to be in this case).
That indeed is ugly, but fixing this is out of scope for this patch, so I've added an extra patch to the set to address this:
WFM, thanks!
Btw (yes, I see you tagged that already, so just FYI then) (1 + (
stream->config.pixels_per_clock== 2));
is an interesting way of using(
stream->config.pixels_per_clock== 2) ? 2 : 1);which likely can produce slightly better code (due to use of constant 2 twice), although it is a pure speculation by me.
Ooops, I didn't mean to send that. Well I wrote something but then closed it when I wasn't going to bother and instead some how sent an empty mail ..
So now I guess I should actually say what I wasn't going to end up saying? haha.
This was too intriguing (to me) so I threw it in godbolt, and for various levels of compiler optimsations, both options generate the same code, even with -O0. Of course the different optimsation levels produce different code, but the two options above always match at the given level.
Fun with godbolt ;-)
https://godbolt.org/z/hYjrvK6hn
Quoted 4 lines
Quoted 4 lines
Signature · 3 lines
-- With Best Regards, Andy Shevchenko
Re: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Quoted 5 lines · Kieran Bingham
Quoting Kieran Bingham (2024-04-16 15:37:39)
Quoted 4 lines
Quoting Andy Shevchenko (2024-04-16 14:34:45)
Quoted 3 lines · Hans de Goede
Quoted 2 lines · Andy Shevchenko
Quoted 1 line · Hans de Goede
...
Quoted 28 lines
Quoted 15 lines
Quoted 15 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
unsigned int
hblank_cycles= 100,
vblank_lines= 6,
width,Quoted 8 lines
Quoted 3 lines
Urgh... These comma operators probably is subject to replace with separate definitions or being grouped on a single line (as it suppose to be in this case).
That indeed is ugly, but fixing this is out of scope for this patch, so I've added an extra patch to the set to address this:
WFM, thanks!
Quoted 8 lines
Quoted 8 lines
Btw (yes, I see you tagged that already, so just FYI then) (1 + (
stream->config.pixels_per_clock== 2));
is an interesting way of using(
stream->config.pixels_per_clock== 2) ? 2 : 1);which likely can produce slightly better code (due to use of constant 2 twice), although it is a pure speculation by me.
Ooops, I didn't mean to send that. Well I wrote something but then closed it when I wasn't going to bother and instead some how sent an empty mail ..
Quoted 8 lines
So now I guess I should actually say what I wasn't going to end up saying? haha.
This was too intriguing (to me) so I threw it in godbolt, and for various levels of compiler optimsations, both options generate the same code, even with -O0. Of course the different optimsation levels produce different code, but the two options above always match at the given level.
Thanks for playing with this.
The issue with the original code is readability and potential oddity about boolean to integer conversion. That said, I prefer my variant for the sake of clarity.
Quoted 3 lines
Fun with godbolt ;-)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 11/23] media: atomisp: Remove test pattern generator (TPG) support
Quoted 1 line · Andy Shevchenko
On Tue, Apr 16, 2024 at 03:40:43PM +0100, Kieran Bingham wrote:
...
Quoted 5 lines
Thanks for playing with this.
The issue with the original code is readability and potential oddity about boolean to integer conversion. That said, I prefer my variant for the sake of clarity.
Hans, in case you are going to update your PR once again, I still think the LM3554 driver removal commit message may be improved by pointing out to the existing driver.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 12/23 media: atomisp: Remove input_port_ID_t
In reply to Hans de GoedeChange the single, unexpected user of CSI_PORT0_ID
for (port = CSI_PORT0_ID; port < N_CSI_PORTS; port++)
to
for (port = 0; port < N_CSI_PORTS; port++) {matching all the other for-loops iterating over the ports in the same file.
And remove the now fully unused input_port_ID_t enum type.
--- drivers/staging/media/atomisp/pci/sh_css_mipi.c | 2 +- drivers/staging/media/atomisp/pci/system_global.h | 12 ------------ 2 files changed, 1 insertion(+), 13 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_mipi.c +1 -1
@@ -489,7 +489,7 @@ free_mipi_frames(struct ia_css_pipe *pipe) } }else {/* pipe ==NULL */ /* AM TEMP: free-ing all mipi buffers just like a legacy code. */ -for (port =CSI_PORT0_ID ; port <N_CSI_PORTS ; port++) { +for (port =0 ; port <N_CSI_PORTS ; port++) {unsigned int i;for (i =0 ; i < my_css.num_mipi_frames[port]; i++) {
drivers/staging/media/atomisp/pci/system_global.h +0 -12
@@ -201,18 +201,6 @@ enum mipi_port_id {#define N_RX_CHANNEL_ID 4 -/* Generic port enumeration with an internal port type ID */ -typedef enum { -CSI_PORT0_ID =0 , -CSI_PORT1_ID , -CSI_PORT2_ID , -TPG_PORT0_ID , -PRBS_PORT0_ID , -FIFO_PORT0_ID , -MEMORY_PORT0_ID , -N_INPUT_PORT_ID -}input_port_ID_t ; - typedef enum { CAPTURE_UNIT0_ID = 0, CAPTURE_UNIT1_ID,
Signature · 1 line
2.44.0
PATCH 13/23 media: atomisp: Drop the atomisp custom lm3554 flash driver
In reply to Hans de GoedeDrop the atomisp custom lm3554 flash driver, support for flash drivers using the custom atomisp flash interface is going to be removed from the atomisp driver.
If flash supports for the lm3554 turns out to be necessary on some atomisp devices in the future then this should be re-implemented using the new include/linux/led-class-flash.h APIs.
The atomisp specific lm3554 driver could still be usable as a reference for how to use / driver the lm3554 for a future re-implementation using standardized APIs, but for that it can be retrieved from the git history.
--- drivers/staging/media/atomisp/i2c/Kconfig | 15 - drivers/staging/media/atomisp/i2c/Makefile | 5 - .../media/atomisp/i2c/atomisp-lm3554.c | 955 ------------------ .../media/atomisp/include/media/lm3554.h | 132 --- 4 files changed, 1107 deletions(-) delete mode 100644 drivers/staging/media/atomisp/i2c/atomisp-lm3554.c delete mode 100644 drivers/staging/media/atomisp/include/media/lm3554.h
drivers/staging/media/atomisp/i2c/Kconfig +0 -15
@@ -56,18 +56,3 @@ config VIDEO_ATOMISP_GC0310 help This is a Video4Linux2 sensor-level driver for the Galaxycore GC0310 0.3MP sensor. - -# -# Kconfig for flash drivers -# - -config VIDEO_ATOMISP_LM3554 - tristate "LM3554 flash light driver" - depends on ACPI - depends on VIDEO_DEV && I2C - help - This is a Video4Linux2 sub-dev driver for the LM3554 - flash light driver. - - To compile this driver as a module, choose M here: the - module will be called lm3554
drivers/staging/media/atomisp/i2c/Makefile +0 -5
@@ -9,8 +9,3 @@ obj-$(CONFIG_VIDEO_ATOMISP_OV2722) += atomisp-ov2722.o obj-$(CONFIG_VIDEO_ATOMISP_GC0310) += atomisp-gc0310.o obj-$(CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER) += atomisp-libmsrlisthelper.o - -# Makefile for flash drivers -# - -obj-$(CONFIG_VIDEO_ATOMISP_LM3554) += atomisp-lm3554.o
drivers/staging/media/atomisp/i2c/atomisp-lm3554.c deleted +0 -955
955 lines not on this page · raw message
drivers/staging/media/atomisp/include/media/lm3554.h deleted +0 -132
132 lines not on this page · raw message
Signature · 1 line
2.44.0
Andy Shevchenko
maintainerRe: [PATCH 13/23] media: atomisp: Drop the atomisp custom lm3554 flash driver
Quoted 4 lines · Hans de Goede
Drop the atomisp custom lm3554 flash driver, support for flash drivers using the custom atomisp flash interface is going to be removed from the atomisp driver.
Quoted 8 lines
If flash supports for the lm3554 turns out to be necessary on some atomisp devices in the future then this should be re-implemented using the new
include/linux/led-class-flash.hAPIs.The atomisp specific lm3554 driver could still be usable as a reference for how to use / driver the lm3554 for a future re-implementation using standardized APIs, but for that it can be retrieved from the git history.
FYI: The driver is already there as drivers/leds/leds-lm355x.c. It might still need the binding to v4l2 subsystem, but still...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Andy Shevchenko
maintainerRe: [PATCH 13/23] media: atomisp: Drop the atomisp custom lm3554 flash driver
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Hans de Goede
Drop the atomisp custom lm3554 flash driver, support for flash drivers using the custom atomisp flash interface is going to be removed from the atomisp driver.
If flash supports for the lm3554 turns out to be necessary on some atomisp devices in the future then this should be re-implemented using the new
include/linux/led-class-flash.hAPIs.
Quoted 7 lines
Quoted 4 lines
The atomisp specific lm3554 driver could still be usable as a reference for how to use / driver the lm3554 for a future re-implementation using standardized APIs, but for that it can be retrieved from the git history.
FYI: The driver is already there as
drivers/leds/leds-lm355x.c. It might still need the binding to v4l2 subsystem, but still...
Wow, it even *was* there when AtomISP has been added:
commit b98d13c725920e9ab7696e0d7d19c4db1bdf6737
Author: G.Shark Jeong <[email protected]>
Date: Wed Sep 5 15:05:58 2012 +0800
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 14/23 media: atomisp: Drop custom flash support
In reply to Hans de GoedeRemove the custom flash handling from the atomisp driver. There are only very 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.
--- .../media/atomisp/include/linux/atomisp.h | 42 ------- .../atomisp/include/linux/atomisp_platform.h | 1 - .../staging/media/atomisp/pci/atomisp_cmd.c | 117 +----------------- .../staging/media/atomisp/pci/atomisp_cmd.h | 4 - .../staging/media/atomisp/pci/atomisp_fops.c | 14 --- .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 61 --------- .../media/atomisp/pci/atomisp_subdev.h | 13 -- .../staging/media/atomisp/pci/atomisp_v4l2.c | 7 -- .../media/atomisp/pci/ia_css_frame_public.h | 8 -- .../media/atomisp/pci/ia_css_stream_public.h | 14 --- drivers/staging/media/atomisp/pci/sh_css.c | 33 ----- 12 files changed, 2 insertions(+), 313 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp.h +0 -42
@@ -614,26 +614,6 @@ enum atomisp_camera_port { 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 * exposed frames. Usually, the first 2 frames coming out of the sensor * are corrupted. When using flash, the frame before and the frame after
@@ -661,7 +641,6 @@ enum atomisp_ext_isp_id {EXT_ISP_CID_AF_STATUS ,EXT_ISP_CID_GET_AF_MODE ,EXT_ISP_CID_CAPTURE_BURST , -EXT_ISP_CID_FLASH_MODE ,EXT_ISP_CID_ZOOM , EXT_ISP_CID_SHOT_MODE };
@@ -694,12 +673,6 @@ enum atomisp_burst_capture_options { 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_BEAUTY_FACE 1#define EXT_ISP_SHOT_MODE_BEST_PHOTO 2
@@ -894,18 +867,6 @@ enum atomisp_burst_capture_options {* Exposure, Flash and privacy (indicator) light controls, to be upstreamed */ #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 ATOMISP_RUN_MODE_VIDEO 1#define ATOMISP_RUN_MODE_STILL_CAPTURE 2
@@ -925,9 +886,6 @@ enum atomisp_burst_capture_options {#define ATOMISP_VFPP_DISABLE_SCALER 1#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)/* Lock and unlock raw buffer */ #define V4L2_CID_ENABLE_RAW_BUFFER_LOCK (V4L2_CID_CAMERA_LASTP1 + 29)
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +0 -1
@@ -111,7 +111,6 @@ enum atomisp_input_format {enum intel_v4l2_subdev_type {RAW_CAMERA =1 , -LED_FLASH =2 , };struct intel_v4l2_subdev_id {
drivers/staging/media/atomisp/pci/atomisp_cmd.c +2 -115
160 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_cmd.h +0 -4
@@ -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_uninit (struct atomisp_device *isp);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_thread (int irq,void *isp_ptr); 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,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,enum atomisp_dfs_mode mode,bool force);
drivers/staging/media/atomisp/pci/atomisp_fops.c +0 -14
@@ -520,21 +520,12 @@ static int atomisp_open(struct file *file) }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); pipe->users++;mutex_unlock (&isp->mutex);return 0 ; -css_error: -pm_runtime_put (vdev->v4l2_dev->dev); error:mutex_unlock (&isp->mutex);v4l2_fh_release (file);
@@ -549,7 +540,6 @@ static int atomisp_release(struct file *file)struct atomisp_sub_device *asd = pipe->asd;struct v4l2_subdev_fh fh;struct v4l2_rect clear_compose = {0 }; -int ret;v4l2_fh_init (&fh.vfh, vdev);
@@ -584,10 +574,6 @@ static int atomisp_release(struct file *file)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 )dev_err (isp->dev,"Failed to power off device\n" );
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -1
@@ -200,7 +200,6 @@ struct atomisp_device {struct v4l2_subdev *sensor_subdevs[ATOMISP_CAMERA_NR_PORTS ];unsigned int input_cnt;struct atomisp_input_subdev inputs[ATOM_ISP_MAX_INPUTS ]; -struct v4l2_subdev *flash;struct atomisp_regs saved_regs;struct atomisp_css_env css_env;
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +0 -61
109 lines not on this page · raw message
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -13
@@ -108,14 +108,6 @@ struct atomisp_pad_format {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 * struct ia_css_isp_config but without un-supported and deprecated parts.
@@ -221,11 +213,6 @@ struct atomisp_subdev_params {int dvs_ver_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 */ bool css_update_params_needed; };
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +0 -7
@@ -825,13 +825,6 @@ static int atomisp_subdev_probe(struct atomisp_device *isp) isp->sensor_lanes[mipi_port] = subdevs->lanes; isp->sensor_subdevs[subdevs->port] = subdevs->subdev;break ; -case LED_FLASH : -if (isp->flash) { -dev_warn (isp->dev,"too many atomisp flash devices\n" ); -continue ; - } - isp->flash = subdevs->subdev; -break ;default :dev_dbg (isp->dev,"unknown subdev probed\n" );break ;
drivers/staging/media/atomisp/pci/ia_css_frame_public.h +0 -8
@@ -137,12 +137,6 @@ enum ia_css_frame_delay { 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. * This is the main structure used for all input and output images. */
@@ -176,7 +170,6 @@ struct ia_css_frame {* binary, we use output port, but we expect VF_OUTPUT_DONE event */ enum ia_css_buffer_type buf_type; -enum ia_css_frame_flash_state flash_state;unsigned int exp_id;/** 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 */
@@ -202,7 +195,6 @@ struct ia_css_frame { .frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .dynamic_queue_id = SH_CSS_INVALID_QUEUE_ID, \ .buf_type = IA_CSS_BUFFER_TYPE_INVALID, \ - .flash_state = IA_CSS_FRAME_FLASH_STATE_NONE, \ }/* @brief Allocate a CSS frame structure
drivers/staging/media/atomisp/pci/ia_css_stream_public.h +0 -14
@@ -457,20 +457,6 @@ ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream,void 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. * @deprecated {Replaced by * ia_css_pipe_set_isp_config_on_pipe()}
drivers/staging/media/atomisp/pci/sh_css.c +0 -33
@@ -2834,7 +2834,6 @@ init_vf_frameinfo_defaults(struct ia_css_pipe *pipe,assert (vf_frame);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_query_internal_queue_id (IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME + idx, thread_id, &queue_id); vf_frame->dynamic_queue_id = queue_id;
@@ -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);ia_css_frame_info_set_width (&in_frame->frame_info, 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_query_internal_queue_id (IA_CSS_BUFFER_TYPE_INPUT_FRAME , thread_id, &queue_id); in_frame->dynamic_queue_id = queue_id;
@@ -3040,7 +3038,6 @@ init_out_frameinfo_defaults(struct ia_css_pipe *pipe,assert (out_frame);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_query_internal_queue_id (IA_CSS_BUFFER_TYPE_OUTPUT_FRAME + idx, thread_id, &queue_id); out_frame->dynamic_queue_id = queue_id;
@@ -3821,12 +3818,6 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, buffer->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; -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 ;if (!frame->valid) pipe->num_invalid_frames--;
@@ -6788,8 +6779,6 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe,ia_css_pipeline_clean (me);/* Construct out_frame info */ - out_frame->flash_state =IA_CSS_FRAME_FLASH_STATE_NONE ; -if (copy_on_sp (pipe) && pipe->stream->config.input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 ) { 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) err =sh_css_pipe_get_output_frame_info (pipe, &out_frame->frame_info,0 );if (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_query_internal_queue_id (IA_CSS_BUFFER_TYPE_OUTPUT_FRAME , thread_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,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 sh_css_init_host_sp_control_vars (void ) {
Signature · 1 line
2.44.0
Andy Shevchenko
maintainerRe: [PATCH 14/23] media: atomisp: Drop custom flash support
Quoted 2 lines · Hans de Goede
Remove the custom flash handling from the atomisp driver. There are only very few Bay Trail / Cherry Trail devices with flash and if those will
"only very few" sounds to me as an oxymoron. "only few" or "very few" — I believe you meant the former.
Quoted 3 lines
ever get supported then this should be done through the new standard
include/linux/led-class-flash.hAPIs instead of with atomisp specific custom APIs.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 15/23 media: atomisp: Drop unused frame_status tracking
In reply to Hans de GoedeAfter removing the flash support frame_status now always is ATOMISP_FRAME_STATUS_OK aka 0. Drop frame_status tracking.
This also means one less atomisp custom use for the vb2_buffer->reserved* fields (all custom use of these fields should be removed).
While at it also remove the no longer used vf_frame pointer from struct atomisp_sub_device.
--- .../staging/media/atomisp/include/linux/atomisp.h | 15 --------------- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 1 - drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 12 ++---------- .../staging/media/atomisp/pci/atomisp_subdev.h | 3 --- 4 files changed, 2 insertions(+), 29 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp.h +0 -15
@@ -614,21 +614,6 @@ enum atomisp_camera_port {ATOMISP_CAMERA_NR_PORTS }; -/* Frame status. This is used to detect corrupted frames and flash -* exposed frames. Usually, the first 2 frames coming out of the sensor -* are corrupted. When using flash, the frame before and the frame after -* the flash exposed frame may be partially exposed by flash. The ISP -* statistics for these frames should not be used by the 3A library. -* The frame status value can be found in the "reserved" field in the -* v4l2_buffer struct. */ -enum atomisp_frame_status { -ATOMISP_FRAME_STATUS_OK , -ATOMISP_FRAME_STATUS_CORRUPTED , -ATOMISP_FRAME_STATUS_FLASH_EXPOSED , -ATOMISP_FRAME_STATUS_FLASH_PARTIAL , -ATOMISP_FRAME_STATUS_FLASH_FAILED , -}; -enum atomisp_ext_isp_id {EXT_ISP_CID_ISO =0 ,EXT_ISP_CID_CAPTURE_HDR ,
drivers/staging/media/atomisp/pci/atomisp_cmd.c +0 -1
@@ -813,7 +813,6 @@ void atomisp_buf_done(struct atomisp_sub_device *asd, int error, } pipe->frame_config_id[i] = frame->isp_config_id; - asd->frame_status[i] =ATOMISP_FRAME_STATUS_OK ;if (asd->params.css_update_params_needed) { atomisp_apply_css_parameters(asd,
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +2 -10
@@ -826,7 +826,6 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer {struct video_device *vdev =video_devdata (file);struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev); -struct atomisp_sub_device *asd = pipe->asd;struct atomisp_device *isp =video_get_drvdata (vdev);struct ia_css_frame *frame;struct vb2_buffer *vb;
@@ -839,15 +838,8 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer vb =vb2_get_buffer (&pipe->vb_queue, buf->index); frame =vb_to_frame (vb); - buf->reserved = asd->frame_status[buf->index]; - -/* -* Hack: -* Currently frame_status in the enum type which takes no more lower -* 8 bit. -* use bit[31:16] for exp_id as it is only in the range of 1~255 -*/ - buf->reserved &=0x0000ffff ; +/* reserved bit[31:16] is used for exp_id */ + buf->reserved =0 ;if (!(buf->flags &V4L2_BUF_FLAG_ERROR )) buf->reserved |= frame->exp_id; buf->reserved2 = pipe->frame_config_id[buf->index];
drivers/staging/media/atomisp/pci/atomisp_subdev.h +0 -3
@@ -274,9 +274,6 @@ struct atomisp_sub_device {struct list_head dis_stats_in_css;spinlock_t dis_stats_lock; -struct ia_css_frame *vf_frame;/* TODO: needed? */ -enum atomisp_frame_status frame_status[VIDEO_MAX_FRAME ]; -/* This field specifies which camera (v4l2 input) is selected. */ int input_curr;
Signature · 1 line
2.44.0
PATCH 16/23 media: atomisp: Drop intel_v4l2_subdev_type
In reply to Hans de Goedeintel_v4l2_subdev_type / atomisp_input_subdev.type now always is RAW_CAMERA, drop it.
--- .../media/atomisp/i2c/atomisp-gc2235.c | 2 +- .../media/atomisp/i2c/atomisp-mt9m114.c | 2 +- .../media/atomisp/i2c/atomisp-ov2722.c | 2 +- .../include/linux/atomisp_gmin_platform.h | 3 +- .../atomisp/include/linux/atomisp_platform.h | 11 ------ .../media/atomisp/pci/atomisp_gmin_platform.c | 16 +++------ .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_ioctl.c | 1 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 36 ++++++++----------- 9 files changed, 23 insertions(+), 51 deletions(-)
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +1 -1
@@ -852,7 +852,7 @@ static int gc2235_probe(struct i2c_client *client)if (ret)gc2235_remove (client); -return atomisp_register_i2c_module (&dev->sd, gcpdev,RAW_CAMERA ); +return atomisp_register_i2c_module (&dev->sd, gcpdev); out_free:v4l2_device_unregister_subdev (&dev->sd);
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c +1 -1
@@ -1552,7 +1552,7 @@ static int mt9m114_probe(struct i2c_client *client)return ret; } - ret =atomisp_register_i2c_module (&dev->sd, pdata,RAW_CAMERA ); + ret =atomisp_register_i2c_module (&dev->sd, pdata);if (ret) {v4l2_device_unregister_subdev (&dev->sd);kfree (dev);
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +1 -1
@@ -992,7 +992,7 @@ static int ov2722_probe(struct i2c_client *client)if (ret)ov2722_remove (client); -return atomisp_register_i2c_module (&dev->sd, ovpdev,RAW_CAMERA ); +return atomisp_register_i2c_module (&dev->sd, ovpdev); out_ctrl_handler_free:v4l2_ctrl_handler_free (&dev->ctrl_handler);
drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h +1 -2
@@ -19,8 +19,7 @@#include "atomisp_platform.h" int atomisp_register_i2c_module (struct v4l2_subdev *subdev, -struct camera_sensor_platform_data *plat_data, -enum intel_v4l2_subdev_type type); +struct camera_sensor_platform_data *plat_data);int atomisp_gmin_remove_subdev (struct v4l2_subdev *sd);int gmin_get_var_int (struct device *dev,bool is_gmin,const char *var,int def);
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +0 -11
@@ -109,18 +109,7 @@ enum atomisp_input_format {#define N_ATOMISP_INPUT_FORMAT (ATOMISP_INPUT_FORMAT_USER_DEF8 + 1) -enum intel_v4l2_subdev_type { -RAW_CAMERA =1 , -}; - -struct intel_v4l2_subdev_id { -char name[17 ]; -enum intel_v4l2_subdev_type type; -enum atomisp_camera_port port; -}; -struct intel_v4l2_subdev_table { -enum intel_v4l2_subdev_type type;enum atomisp_camera_port port;unsigned int lanes;struct v4l2_subdev *subdev;
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +5 -11
@@ -126,7 +126,7 @@ static DEFINE_MUTEX(gmin_regulator_mutex);static int gmin_v1p8_enable_count;static int gmin_v2p8_enable_count; -/* The atomisp uses type==0 for the end-of-list marker, so leave space. */ +/* The atomisp uses subdev==NULL for the end-of-list marker, so leave space. */ static struct intel_v4l2_subdev_table pdata_subdevs[MAX_SUBDEVS +1 ];static const struct atomisp_platform_data pdata = {
@@ -145,16 +145,13 @@ const struct atomisp_platform_data *atomisp_get_platform_data(void)EXPORT_SYMBOL_GPL (atomisp_get_platform_data);int atomisp_register_i2c_module (struct v4l2_subdev *subdev, -struct camera_sensor_platform_data *plat_data, -enum intel_v4l2_subdev_type type) +struct camera_sensor_platform_data *plat_data) {int i;struct gmin_subdev *gs;struct i2c_client *client =v4l2_get_subdevdata (subdev);struct acpi_device *adev =ACPI_COMPANION (&client->dev); -dev_info (&client->dev,"register atomisp i2c module type %d\n" , type); -/* The windows driver model (and thus most BIOSes by default) * uses ACPI runtime power management for camera devices, but * we don't. Disable it, or else the rails will be needlessly
@@ -172,10 +169,10 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, adev->power.flags.power_resources =0 ;for (i =0 ; i <MAX_SUBDEVS ; i++) -if (!pdata.subdevs[i].type) +if (!pdata.subdevs[i].subdev)break ; -if (pdata.subdevs[i].type) +if (i ==MAX_SUBDEVS )return -ENOMEM ;/* Note subtlety of initialization order: at the point where
@@ -187,7 +184,6 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,if (!gs)return -ENODEV ; - pdata.subdevs[i].type = type; pdata.subdevs[i].port = gs->csi_port; pdata.subdevs[i].lanes = gs->csi_lanes; pdata.subdevs[i].subdev = subdev;
@@ -1136,7 +1132,7 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, }for (i =0 ; i <MAX_SUBDEVS ; i++) -if (!pdata.subdevs[i].type) +if (!pdata.subdevs[i].subdev)break ;if (i >=MAX_SUBDEVS ) {
@@ -1148,7 +1144,6 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes,if (ret)return ret; - pdata.subdevs[i].type =RAW_CAMERA ; pdata.subdevs[i].port = port; pdata.subdevs[i].lanes = lanes; pdata.subdevs[i].subdev = subdev;
@@ -1166,7 +1161,6 @@ void atomisp_unregister_subdev(struct v4l2_subdev *subdev)camera_sensor_csi_free (subdev); pdata.subdevs[i].subdev =NULL ; - pdata.subdevs[i].type =0 ; pdata.subdevs[i].port =0 ;break ; }
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -1
@@ -121,7 +121,6 @@ round_down((2 * (n) + (d) * (step)) / (2 * (d)), (step))struct atomisp_input_subdev { -unsigned int type;enum atomisp_camera_port port;u32 code;/* MEDIA_BUS_FMT_* */ bool binning_support;
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +0 -1
@@ -406,7 +406,6 @@ static int atomisp_enum_input(struct file *file, void *fh, input->type =V4L2_INPUT_TYPE_CAMERA ; input->index = index; - input->reserved[0 ] = isp->inputs[index].type; input->reserved[1 ] = isp->inputs[index].port;return 0 ;
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +14 -22
@@ -803,32 +803,25 @@ static int atomisp_subdev_probe(struct atomisp_device *isp)* converting them to standard v4l2 sensor drivers using runtime-pm + * ACPI for pm and v4l2_async_register_subdev_sensor() registration. */ -for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) { +for (subdevs = pdata->subdevs; subdevs->subdev; ++subdevs) { ret =v4l2_device_register_subdev (&isp->v4l2_dev, subdevs->subdev);if (ret)continue ; -switch (subdevs->type) { -case RAW_CAMERA : -if (subdevs->port >=ATOMISP_CAMERA_NR_PORTS ) { -dev_err (isp->dev,"port %d not supported\n" , subdevs->port); -break ; - } - -if (isp->sensor_subdevs[subdevs->port]) { -dev_err (isp->dev,"port %d already has a sensor attached\n" , - subdevs->port); -break ; - } - - mipi_port =atomisp_port_to_mipi_port (isp, subdevs->port); - isp->sensor_lanes[mipi_port] = subdevs->lanes; - isp->sensor_subdevs[subdevs->port] = subdevs->subdev; -break ; -default : -dev_dbg (isp->dev,"unknown subdev probed\n" ); -break ; +if (subdevs->port >=ATOMISP_CAMERA_NR_PORTS ) { +dev_err (isp->dev,"port %d not supported\n" , subdevs->port); +continue ; } + +if (isp->sensor_subdevs[subdevs->port]) { +dev_err (isp->dev,"port %d already has a sensor attached\n" , + subdevs->port); +continue ; + } + + mipi_port =atomisp_port_to_mipi_port (isp, subdevs->port); + isp->sensor_lanes[mipi_port] = subdevs->lanes; + isp->sensor_subdevs[subdevs->port] = subdevs->subdev; }return atomisp_csi_lane_config (isp);
@@ -1039,7 +1032,6 @@ int atomisp_register_device_nodes(struct atomisp_device *isp) input = &isp->inputs[isp->input_cnt]; - input->type =RAW_CAMERA ; input->port = i; input->camera = isp->sensor_subdevs[i]; input->csi_port = &isp->csi2_port[i].subdev;
Signature · 1 line
2.44.0
Andy Shevchenko
maintainerRe: [PATCH 16/23] media: atomisp: Drop intel_v4l2_subdev_type
Quoted 2 lines · Hans de Goede
intel_v4l2_subdev_type/ atomisp_input_subdev.type now always isRAW_CAMERA, drop it.
...
drivers/staging/media/atomisp/pci/atomisp_v4l2.c static int atomisp_subdev_probe(struct atomisp_device *isp) · line 806
Quoted 2 lines
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +1
-1-for (subdevs = pdata->subdevs; subdevs->type; ++subdevs) { +for (subdevs = pdata->subdevs; subdevs->subdev; ++subdevs) {
While at it, use postincrement.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH 17/23 media: atomisp: Remove gmin_platform VCM code.
In reply to Hans de GoedeVCM support has already been removed from the main atomisp driver in commit 7473c97dd8d0 ("media: atomisp: Remove custom VCM handling") remove the left-over dead VCM handling from the gmin platform code.
--- .../include/linux/atomisp_gmin_platform.h | 3 -- .../atomisp/include/linux/atomisp_platform.h | 21 --------- .../media/atomisp/pci/atomisp_gmin_platform.c | 47 ------------------- 3 files changed, 71 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h +0 -3
@@ -28,7 +28,4 @@ gmin_camera_platform_data(struct v4l2_subdev *subdev, enum atomisp_input_format csi_format, enum atomisp_bayer_order csi_bayer); - -int atomisp_gmin_register_vcm_control (struct camera_vcm_control *); -#endif
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +0 -21
@@ -147,25 +147,6 @@ struct atomisp_input_stream_info {struct atomisp_isys_config_info isys_info[MAX_STREAMS_PER_CHANNEL ]; }; -struct camera_vcm_control ; -struct camera_vcm_ops { -int (*power_up)(struct v4l2_subdev *sd,struct camera_vcm_control *vcm); -int (*power_down)(struct v4l2_subdev *sd, -struct camera_vcm_control *vcm); -int (*queryctrl)(struct v4l2_subdev *sd,struct v4l2_queryctrl *qc, -struct camera_vcm_control *vcm); -int (*g_ctrl)(struct v4l2_subdev *sd,struct v4l2_control *ctrl, -struct camera_vcm_control *vcm); -int (*s_ctrl)(struct v4l2_subdev *sd,struct v4l2_control *ctrl, -struct camera_vcm_control *vcm); -}; - -struct camera_vcm_control { -char camera_module[CAMERA_MODULE_ID_LEN ]; -struct camera_vcm_ops *ops; -struct list_head list; -}; -struct camera_sensor_platform_data {int (*flisclk_ctrl)(struct v4l2_subdev *subdev,int flag);int (*csi_cfg)(struct v4l2_subdev *subdev,int flag);
@@ -179,8 +160,6 @@ struct camera_sensor_platform_data {int (*v1p8_ctrl)(struct v4l2_subdev *subdev,int on);int (*v2p8_ctrl)(struct v4l2_subdev *subdev,int on);int (*v1p2_ctrl)(struct v4l2_subdev *subdev,int on); -struct camera_vcm_control *(*get_vcm_ctrl)(struct v4l2_subdev *subdev, -char *module_id); };struct camera_mipi_info {
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +0 -47
101 lines not on this page · raw message
Signature · 1 line
2.44.0
PATCH 18/23 media: atomisp: Remove struct atomisp_platform_data
In reply to Hans de Goedestruct atomisp_platform_data only has a single subdevs member. Remove this struct and replace atomisp_get_platform_data() with atomisp_platform_get_subdevs().
Note atomisp_get_platform_data() and now atomisp_platform_get_subdevs() always succeed, so while at it also remove unnecessary error checking.
--- .../atomisp/include/linux/atomisp_platform.h | 6 +--- .../media/atomisp/pci/atomisp_gmin_platform.c | 36 +++++++++---------- .../media/atomisp/pci/atomisp_internal.h | 1 - .../staging/media/atomisp/pci/atomisp_v4l2.c | 16 ++------- 4 files changed, 19 insertions(+), 40 deletions(-)
drivers/staging/media/atomisp/include/linux/atomisp_platform.h +1 -5
@@ -115,10 +115,6 @@ struct intel_v4l2_subdev_table {struct v4l2_subdev *subdev; }; -struct atomisp_platform_data { -struct intel_v4l2_subdev_table *subdevs; -}; -/* * Sensor of external ISP can send multiple steams with different mipi data * type in the same virtual channel. This information needs to come from the
@@ -173,7 +169,7 @@ struct camera_mipi_info {const u32 *metadata_effective_width; }; -const struct atomisp_platform_data *atomisp_get_platform_data (void ); +const struct intel_v4l2_subdev_table *atomisp_platform_get_subdevs (void );int atomisp_register_sensor_no_gmin (struct v4l2_subdev *subdev,u32 lanes,enum atomisp_input_format format,enum atomisp_bayer_order bayer_order);
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c +16 -20
@@ -127,17 +127,13 @@ static int gmin_v2p8_enable_count;/* The atomisp uses subdev==NULL for the end-of-list marker, so leave space. */ static struct intel_v4l2_subdev_table pdata_subdevs[MAX_SUBDEVS +1 ]; -static const struct atomisp_platform_data pdata = { - .subdevs = pdata_subdevs, -}; -static struct gmin_subdev *find_gmin_subdev (struct v4l2_subdev *subdev); -const struct atomisp_platform_data *atomisp_get_platform_data (void ) +const struct intel_v4l2_subdev_table *atomisp_platform_get_subdevs (void ) { -return &pdata; +return pdata_subdevs; } -EXPORT_SYMBOL_GPL (atomisp_get_platform_data); +EXPORT_SYMBOL_GPL (atomisp_platform_get_subdevs);int atomisp_register_i2c_module (struct v4l2_subdev *subdev,struct camera_sensor_platform_data *plat_data)
@@ -164,7 +160,7 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, adev->power.flags.power_resources =0 ;for (i =0 ; i <MAX_SUBDEVS ; i++) -if (!pdata.subdevs[i].subdev) +if (!pdata_subdevs[i].subdev)break ;if (i ==MAX_SUBDEVS )
@@ -179,9 +175,9 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,if (!gs)return -ENODEV ; - pdata.subdevs[i].port = gs->csi_port; - pdata.subdevs[i].lanes = gs->csi_lanes; - pdata.subdevs[i].subdev = subdev; + pdata_subdevs[i].port = gs->csi_port; + pdata_subdevs[i].lanes = gs->csi_lanes; + pdata_subdevs[i].subdev = subdev;return 0 ; }EXPORT_SYMBOL_GPL (atomisp_register_i2c_module);
@@ -194,9 +190,9 @@ int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd)return 0 ;for (i =0 ; i <MAX_SUBDEVS ; i++) { -if (pdata.subdevs[i].subdev == sd) { +if (pdata_subdevs[i].subdev == sd) {for (j = i +1 ; j <=MAX_SUBDEVS ; j++) - pdata.subdevs[j -1 ] = pdata.subdevs[j]; + pdata_subdevs[j -1 ] = pdata_subdevs[j]; }if (gmin_subdevs[i].subdev == sd) {if (gmin_subdevs[i].gpio0)
@@ -1125,7 +1121,7 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes, }for (i =0 ; i <MAX_SUBDEVS ; i++) -if (!pdata.subdevs[i].subdev) +if (!pdata_subdevs[i].subdev)break ;if (i >=MAX_SUBDEVS ) {
@@ -1137,9 +1133,9 @@ int atomisp_register_sensor_no_gmin(struct v4l2_subdev *subdev, u32 lanes,if (ret)return ret; - pdata.subdevs[i].port = port; - pdata.subdevs[i].lanes = lanes; - pdata.subdevs[i].subdev = subdev; + pdata_subdevs[i].port = port; + pdata_subdevs[i].lanes = lanes; + pdata_subdevs[i].subdev = subdev;return 0 ; }EXPORT_SYMBOL_GPL (atomisp_register_sensor_no_gmin);
@@ -1149,12 +1145,12 @@ void atomisp_unregister_subdev(struct v4l2_subdev *subdev)int i;for (i =0 ; i <MAX_SUBDEVS ; i++) { -if (pdata.subdevs[i].subdev != subdev) +if (pdata_subdevs[i].subdev != subdev)continue ;camera_sensor_csi_free (subdev); - pdata.subdevs[i].subdev =NULL ; - pdata.subdevs[i].port =0 ; + pdata_subdevs[i].subdev =NULL ; + pdata_subdevs[i].port =0 ;break ; } }
drivers/staging/media/atomisp/pci/atomisp_internal.h +0 -1
@@ -175,7 +175,6 @@ struct atomisp_device {struct media_device media_dev;struct atomisp_sub_device asd;struct v4l2_async_notifier notifier; -struct atomisp_platform_data *pdata;void *mmu_l1_base;void __iomem *base;const struct firmware *firmware;
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +2 -14
@@ -783,27 +783,20 @@ int atomisp_csi_lane_config(struct atomisp_device *isp)static int atomisp_subdev_probe (struct atomisp_device *isp) { -const struct atomisp_platform_data *pdata; -struct intel_v4l2_subdev_table *subdevs; +const struct intel_v4l2_subdev_table *subdevs;int ret, mipi_port; ret =atomisp_csi2_bridge_parse_firmware (isp);if (ret)return ret; - pdata =atomisp_get_platform_data (); -if (!pdata) { -dev_err (isp->dev,"no platform data available\n" ); -return 0 ; - } -/* * TODO: this is left here for now to allow testing atomisp-sensor * drivers which are still using the atomisp_gmin_platform infra before * converting them to standard v4l2 sensor drivers using runtime-pm + * ACPI for pm and v4l2_async_register_subdev_sensor() registration. */ -for (subdevs = pdata->subdevs; subdevs->subdev; ++subdevs) { +for (subdevs =atomisp_platform_get_subdevs (); subdevs->subdev; ++subdevs) { ret =v4l2_device_register_subdev (&isp->v4l2_dev, subdevs->subdev);if (ret)continue ;
@@ -1186,7 +1179,6 @@ static void atomisp_pm_uninit(struct atomisp_device *isp)static int atomisp_pci_probe (struct pci_dev *pdev,const struct pci_device_id *id) { -const struct atomisp_platform_data *pdata;struct atomisp_device *isp;unsigned int start;u32 val;
@@ -1195,10 +1187,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i/* Pointer to struct device. */ atomisp_dev = &pdev->dev; - pdata =atomisp_get_platform_data (); -if (!pdata) -dev_warn (&pdev->dev,"no platform data available\n" ); - start =pci_resource_start (pdev,ATOM_ISP_PCI_BAR );dev_dbg (&pdev->dev,"start: 0x%x\n" , start);
Signature · 1 line
2.44.0
PATCH 19/23 media: atomisp: Remove clearing of ISP crop / compose rectangles on file release
In reply to Hans de GoedeThere is no need to clear the ISP sink-pad crop and source-pad compose rectangles on release of the /dev/video# file.
Both will be reset by atomisp_set_fmt() which is guaranteed to get called by atomisp_queue_setup() (if not called already) before another stream starts and thus before these selections are used again.
Also the file injection support the comment talks about has long been dropped from the driver.
--- .../staging/media/atomisp/pci/atomisp_fops.c | 21 ------------------- 1 file changed, 21 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_fops.c +0 -21
@@ -539,7 +539,6 @@ static int atomisp_release(struct file *file)struct atomisp_video_pipe *pipe =atomisp_to_video_pipe (vdev);struct atomisp_sub_device *asd = pipe->asd;struct v4l2_subdev_fh fh; -struct v4l2_rect clear_compose = {0 };v4l2_fh_init (&fh.vfh, vdev);
@@ -552,21 +551,6 @@ static int atomisp_release(struct file *file) pipe->users--; -/* -* A little trick here: -* file injection input resolution is recorded in the sink pad, -* therefore can not be cleared when releaseing one device node. -* The sink pad setting can only be cleared when all device nodes -* get released. -*/ - { -struct v4l2_mbus_framefmt isp_sink_fmt = {0 }; - -atomisp_subdev_set_ffmt (&asd->subdev, fh.state, -V4L2_SUBDEV_FORMAT_ACTIVE , -ATOMISP_SUBDEV_PAD_SINK , &isp_sink_fmt); - } -atomisp_css_free_stat_buffers (asd);atomisp_free_internal_buffers (asd);
@@ -577,11 +561,6 @@ static int atomisp_release(struct file *file)if (pm_runtime_put_sync (vdev->v4l2_dev->dev) <0 )dev_err (isp->dev,"Failed to power off device\n" ); -atomisp_subdev_set_selection (&asd->subdev, fh.state, -V4L2_SUBDEV_FORMAT_ACTIVE , -ATOMISP_SUBDEV_PAD_SOURCE , -V4L2_SEL_TGT_COMPOSE ,0 , - &clear_compose);mutex_unlock (&isp->mutex);return 0 ; }
Signature · 1 line
2.44.0
PATCH 20/23 media: atomisp: Remove empty s_power() op from ISP subdev
In reply to Hans de GoedeRemove the empty isp_subdev_set_power() callback.
--- drivers/staging/media/atomisp/pci/atomisp_subdev.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_subdev.c +1 -13
@@ -149,18 +149,6 @@ static long isp_subdev_ioctl(struct v4l2_subdev *sd,return 0 ; } -/* -* isp_subdev_set_power - Power on/off the CCDC module -* @sd: ISP V4L2 subdevice -* @on: power on/off -* -* Return 0 on success or a negative error code otherwise. -*/ -static int isp_subdev_set_power (struct v4l2_subdev *sd,int on) -{ -return 0 ; -} -static int isp_subdev_subscribe_event (struct v4l2_subdev *sd,struct v4l2_fh *fh,struct v4l2_event_subscription *sub)
@@ -596,7 +584,7 @@ static int isp_subdev_set_format(struct v4l2_subdev *sd,/* V4L2 subdev core operations */ static const struct v4l2_subdev_core_ops isp_subdev_v4l2_core_ops = { - .ioctl = isp_subdev_ioctl, .s_power = isp_subdev_set_power, + .ioctl = isp_subdev_ioctl, .subscribe_event = isp_subdev_subscribe_event, .unsubscribe_event = isp_subdev_unsubscribe_event, };
Signature · 1 line
2.44.0
PATCH 21/23 media: atomisp: Remove empty s_stream() op from CSI subdev
In reply to Hans de GoedeRemove the empty csi2_set_stream() callback and remove the now empty csi2_video_ops struct.
While at it also remove the empty csi2_core_ops struct.
--- .../staging/media/atomisp/pci/atomisp_csi2.c | 23 ------------------- 1 file changed, 23 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_csi2.c +0 -23
@@ -141,27 +141,6 @@ static int csi2_set_format(struct v4l2_subdev *sd, &fmt->format); } -/* -* csi2_set_stream - Enable/Disable streaming on the CSI2 module -* @sd: ISP CSI2 V4L2 subdevice -* @enable: Enable/disable stream (1/0) -* -* Return 0 on success or a negative error code otherwise. -*/ -static int csi2_set_stream (struct v4l2_subdev *sd,int enable) -{ -return 0 ; -} - -/* subdev core operations */ -static const struct v4l2_subdev_core_ops csi2_core_ops = { -}; - -/* subdev video operations */ -static const struct v4l2_subdev_video_ops csi2_video_ops = { - .s_stream = csi2_set_stream, -}; -/* subdev pad operations */ static const struct v4l2_subdev_pad_ops csi2_pad_ops = { .enum_mbus_code = csi2_enum_mbus_code,
@@ -172,8 +151,6 @@ static const struct v4l2_subdev_pad_ops csi2_pad_ops = {/* subdev operations */ static const struct v4l2_subdev_ops csi2_ops = { - .core = &csi2_core_ops, - .video = &csi2_video_ops, .pad = &csi2_pad_ops, };
Signature · 1 line
2.44.0
PATCH 22/23 media: atomisp: Cleanup atomisp_isr_thread() spinlock handling
In reply to Hans de GoedeRefactor the code a tiny bit to avoid the need to have 2 different paths with spin_unlock_irqrestore() in there.
While at it also remove the non helpful dev_dbg() message.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +5 -8
@@ -959,18 +959,15 @@ irqreturn_t atomisp_isr_thread(int irq, void *isp_ptr) {struct atomisp_device *isp = isp_ptr;unsigned long flags; - -dev_dbg (isp->dev,">%s\n" , __func__); +bool streaming;spin_lock_irqsave (&isp->lock, flags); - -if (!isp->asd.streaming) { -spin_unlock_irqrestore (&isp->lock, flags); -return IRQ_HANDLED ; - } - + streaming = isp->asd.streaming;spin_unlock_irqrestore (&isp->lock, flags); +if (!streaming) +return IRQ_HANDLED ; +/* * The standard CSS2.0 API tells the following calling sequence of * dequeue ready buffers:
Signature · 1 line
2.44.0
PATCH 23/23 media: atomisp: Remove setting of f->fmt.pix.priv from atomisp_set_fmt()
In reply to Hans de GoedeThis value is not used by the driver, only returned to userspace and userspace should not rely on / use the priv fields. Drop setting this.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +0 -2
@@ -4412,8 +4412,6 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)atomisp_fill_pix_format (&pipe->pix, f->fmt.pix.width, f->fmt.pix.height, format_bridge); f->fmt.pix = pipe->pix; - f->fmt.pix.priv =PAGE_ALIGN (pipe->pix.width * - pipe->pix.height *2 ); dev_dbg(isp->dev, "%s: %dx%d, image size: %d, %d bytes per line\n", __func__,
Signature · 1 line
2.44.0
Quoted 14 lines · Hans de Goede
Hi all,
This patch-set contains a couple of atomisp driver fixes for issues which I found while working on a libcamera pipeline handler for the atomisp (and thus controlling the atomisp driver in a more media-controller centric fashion).
Patches 1-8 are more or less prep work for fixing an ABBA deadlock in
atomisp_link_setup()in patch 9.Diving into the code for this made my hands itch to remove of bunch of atomisp custom internal APIs for things like flash support, so the rest of the series is just removing a whole bunch of dead / unwanted code.
Quoted 5 lines
This series is also available here:
https://git.kernel.org/pub/scm/linux/kernel/git/hansg/linux.git/log/?h=media-atomispI'll do a forced push there addressing any review-comments + adding tags before adding a signed-tag for a pull-request to Mauro for this.
Thank you for doing this nice cleanup!
For non-commented,
otherwise feel free to add it, if you agree on the suggested improvements.
Signature · 2 lines
With Best Regards, Andy Shevchenko