Age | Commit message (Collapse) | Author | Files | Lines |
|
There are a number of bugs in atomisp_try_fmt_cap() and atomisp_set_fmt():
1. atomisp_try_fmt_cap() uses atomisp_adjust_fmt() which adds the sensor
padding to the width passed to atomisp_adjust_fmt() to calculate
bytesperline. This is buggy for 2 reasons:
a) The width passed to atomisp_adjust_fmt() already contains
the sensor padding.
b) The fmt returned by atomisp_try_fmt_cap() is the fmt outputted by
the ISP and the sensor padding applies to the input side of the ISP
not the output side. The output side of the ISP has its own padding /
pitch requirements which have nothing to do with the sensor.
Both these issues are fixed in this refactor by switching to
ia_css_frame_pad_width() to calculate the padding.
2. atomisp_set_fmt() takes the passed in bytesperline value without
doing any validation on it and then passes this unchecked value to
the configure_output() callback.
If bytesperline converted to pixels is > 1920 ia_css_binary_find()
will fail to find a valid binary for the preview pipeline triggering
a dump_stack_lvl() call inside ia_css_binary_find() and causing
atomisp_set_fmt() to fail.
This is fixed by making atomisp_set_fmt() call atomisp_try_fmt()
first which we override the userspace specified bytesperline with
the correct value.
Besides this bug there is also a bunch of weirdness and a lot of
duplication in the code:
1. atomisp_try_fmt_cap() adds the sensor padding itself but then
it gets substracted again in atomisp_adjust_fmt() not doing
the addition + substraction in the same place makes the code hard
to follow (weirdness).
2. atomisp_set_fmt() starts with basically an atomisp_try_fmt() call,
except that the only atomisp_try_fmt() caller: atomisp_try_fmt_cap()
adds the sensor padding itself rather than letting atomisp_try_fmt()
do this (duplication).
3. Both atomisp_try_fmt_cap() and atomisp_set_fmt() contain code to
lookup the bridge-format matching the requested pixelformat and
both will fallback to YUV420 if this is not set (duplication).
4. Both atomisp_try_fmt_cap() and atomisp_set_fmt() contain code to
fill in the passed in v4l2_pix_format struct (duplication).
Cleanup all of this (and fix the bugs mentioned above) by:
1. Adding a new atomisp_fill_pix_format() helper which properly uses
ia_css_frame_pad_width() to calculate bytesperline.
2. Move all sensor padding handling to atomisp_try_fmt() and
make atomisp_try_fmt() fill the passed in v4l2_pix_format struct.
3. This reduces atomisp_try_fmt_cap() to just a small wrapper around
atomisp_try_fmt().
4. Replace the DIY try_fmt code at the beginning of atomisp_set_fmt()
with atomisp_try_fmt(), this will also override/fix the bytersperline
passed by userspace.
5. Replace the DIY v4l2_pix_format filling at the end of atomisp_set_fmt()
with atomisp_fill_pix_format().
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Factor the code to go from width to a properly aligned pitch out of
ia_css_frame_info_set_width().
This is a preparation patch to fix try_fmt() calls returning a bogus
bytesperline value.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Passing 'isp->asd->inputs[asd->input_curr].foo' as argument to
various function calls is rather long.
Add a local input helper variable for this, so that the function
calls will fit on one line.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_set_fmt*() use a local v4l2_subdev_fh declared on the stack,
specifically they use fh.state which is never initialized so when
passing fh.state to atomisp_subdev_set_ffmt() / to
atomisp_subdev_set_selection() these functions are passing random
stack contents as a pointer.
The reason this works is because when the which parameter is
V4L2_SUBDEV_FORMAT_ACTIVE the passed in state is not used.
Remove the bogus fh usage and just pass NULL as state.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
As the 2 comments in the function already say both the sink and the source
pads only support setting the selection for 1 target:
/* Only crop target supported on sink pad. */
/* Only compose target is supported on source pads. */
Validate that the passed in target actually matches these expectations.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_set_fmt()
With the atomisp_subdev_set_selection(sink-pad, V4L2_SEL_TGT_CROP, rect)
calls dropped. The first and last compount code blocks of the 3 code blocks
in the if (...) {} else if (...) {} else {} code setting the source-pad
V4L2_SEL_TGT_COMPOSE selection are the same.
The both set V4L2_SEL_TGT_COMPOSE to a rectangle with the same dimensions
as f->fmt.pix.height.
Remove the else {} block at the end, drop the second if and prepend
the first if condition with "!second-if-condition ||" to remove
the code duplication.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_set_fmt()
atomisp_subdev_set_selection(sink-pad, V4L2_SEL_TGT_CROP, rect)
ignores the passed in rect, using the width and height from the last
atomisp_subdev_set_ffmt(ATOMISP_SUBDEV_PAD_SINK, ffmt) call instead.
The atomisp_subdev_set_ffmt() call done by atomisp_set_fmt_to_snr()
already propagates the sink ffmt changes to V4L2_SEL_TGT_CROP
(this is what allows atomisp_set_fmt() to get the isp_sink_crop in
the first place).
Remove the redundant atomisp_subdev_set_selection(sink-pad, ...)
calls.
Note the removed aspect ratio correction in the last else block is
is already done by atomisp_subdev_set_selection() itself when
setting V4L2_SEL_TGT_COMPOSE on the source-pad.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Remove a bunch of sensor related custom IOCTLs because:
1. They are custom IOCTLs and all custom IOCTLs should be removed
2. Userspace should directly talk to the sensor v4l2-subdev, rather
then relying on ioctl-s on the output /dev/video# node to pass
through ioctl-s to the senor
3. Some of these rely on the atomisp specific camera_mipi_info struct
which is going away as we are switching to using standard v4l2
sensor drivers
4. In the case of ATOMISP_IOC_S_EXPOSURE_WINDOW this was using the
v4l2-subdev set_selection API in an undocumented atomisp custom way
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Implement selection support. Modelled after ov5693 selection support,
but allow setting sizes smaller than crop-size through set_fmt since
that was already allowed.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Having an init_cfg to initialize the passed in subdev-state is
important to make which == V4L2_SUBDEV_FORMAT_TRY ops work when
userspace is talking to a /dev/v4l2-subdev# node.
Copy the ov2680_init_cfg() from the standard drivers/media/i2c/ov2680.c
driver.
This is esp. relevant once support for cropping is added where
the v4l2_subdev_state.pads[pad].try_crop rectangle needs to be set
correctly for set_fmt which == V4L2_SUBDEV_FORMAT_TRY calls to work.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Call ov2680_calc_mode() from probe() instead of relying on userspace
to make at least one s_fmt call to fill the mode parameters.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
s/input_lock/lock/ lock is used by the generic drivers/media/i2c/ov2680.c
driver. Bring the atomisp ov2680 code inline to make it easier to port
changes between the two, with the end goal of getting rid of
the atomisp specific version.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
s/ov2680_device/ov2680_dev/ ov2680_dev is used by the generic
drivers/media/i2c/ov2680.c driver. Bring the atomisp ov2680 code
inline to make it easier to port changes between the two,
with the end goal of getting rid of the atomisp specific version.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
A lot of work has been done on the atomisp driver lately.
Rewrite the TODO file to drop all the already fixed items:
* Moved to videobuf2 + fixed mmap support
* Whole bunch of v4l2 API fixes making more apps work
* v4l2-async sensor probing support
* pm-runtime support (for some sensor drivers at least)
* buffer MM code was cleaned up / replaced when moving the videobuf2
And add a new TODO list (retaining some of the old items) split
into items which absolutely must be fixed before the driver can
be moved out of staging:
1. Conflicting hw-ids with regular sensor drivers
2. Private userspace API stuff
As well as a list of items which also definitely needs to be fixed
but which could also be fixed after moving the driver out of staging.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans de Goede <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Not all functions used in gmin_get_var_int() update len to the actual
length of the returned string. So len may still have its initial value
of the length of val[] when "val[len] = 0;" is run to ensure 0 termination.
If this happens we end up writing one beyond the bounds of val[], fix this.
Note this is a quick fix for this since the entirety of
atomisp_gmin_platform.c will be removed once all atomisp sensor
drivers have been moved over to runtime-pm + v4l2-async device
registration.
Closes: https://lore.kernel.org/linux-media/[email protected]/
Reported-by: Dan Carpenter <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Ideally, strlen(cur->string.pointer) and strlen(out) would be the same.
But this code is using strscpy() to avoid a potential buffer overflow.
So in the same way we should take the strlen() of the smaller string to
avoid a buffer overflow in the caller, gmin_get_var_int().
Link: https://lore.kernel.org/r/[email protected]
Fixes: 387041cda44e ("media: atomisp: improve sensor detection code to use _DSM table")
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Drop v4l2_get_acpi_sensor_info() the 2 sensor drivers which were
using this have both been converted to v4l2-async probing, relying
on the atomisp_csi2_bridge.c code to add the GPIO mappings instead.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Switch the atomisp-gc0310 driver to v4l2 async device registration.
After this change this driver no longer depends on
atomisp_gmin_platform and all atomisp-isms are gone.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Turn the atomisp-ov2680 driver into a standard v4l2 sensor driver:
1. Stop filling camera_mipi_info
2. Stop calling v4l2_get_acpi_sensor_info() this will be done by
atomisp_csi2_bridge_parse_firmware() now
3. Switch to v4l2 async device registration
After this change this driver no longer depends on
atomisp_gmin_platform and all atomisp-isms are gone.
While at it, also add missing mutex_destroy() to ov2680_remove().
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Add support for using v4l2-async sensor registration.
This has been tested with both the gc0310 and the ov2680 sensor drivers.
Drivers must add the ACPI HIDs they match on to the supported_sensors[]
array in the same commit as that they are converted to
v4l2_async_register_subdev_sensor().
Sensor drivers also must check they have a fwnode graph endpoint and return
-EPROBE_DEFER from probe() if there is no endpoint yet. This guarantees
that the GPIO mappings are in place before the driver tries to get GPIOs.
For now it also is still possible to use the old atomisp_gmin_platform
based sensor drivers. This is mainly intended for testing while moving
other sensor drivers over to runtime-pm + v4l2-async.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
The sanity checks were done too late, so move them up.
This fixes this smatch warning:
drivers/staging/media/atomisp/pci/sh_css_firmware.c:247 sh_css_load_firmware() warn: variable dereferenced before check 'fw_data' (see line 237)
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Fix a compiler warning:
drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c:1525:13: warning: 'settings' may be used uninitialized [-Wmaybe-uninitialized]
The 'settings' variable is actually always initialized, but the
compiler isn't quite able to figure that out. Just initialize it
to 0 to avoid this warning.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Uwe Kleine-König <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
camera_mipi_info is an atomisp / atomisp_gmin_platform specific struct,
allow mipi_info pointers to be NULL.
This is a preparation patch for making atomisp work with
standard v4l2 sensor drivers.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_register_device_nodes() already iterates over the ports/sensors
in a loop and that loop already does not include the TPG input.
So we can simply setup the CSI2-port <-> ISP and sensor <-> CSI2-port
mediactl-pad links there instead of repeating the loop in
atomisp_create_pads_links(), which atomisp_register_device_nodes()
used to call later on.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_register_device_nodes()
Delay mapping sensors to inputs till atomisp_register_device_nodes()
time. There are 2 reasons for this:
1. This guarantees a stable input order independent of the sensor
probe order.
2. This is a preparation patch for v4l2-async sensor probing support.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Store number of sensor lanes per port in struct atomisp_device.
This is a preparation patch for adding v4l2-async sensor probing support.
With async probing the inputs will get registered later, but we can
already fill the sensor_lanes array when parsing the fwnodes.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Rename __get_mipi_port() to atomisp_port_to_mipi_port(), this is not a
private (not static) function so its name should be properly prefixed.
While at is also cleanup the weird handling of ATOMISP_CAMERA_PORT_TERTIARY
this seems to be a left over from when the driver also supported CSI
receivers with only 2 ports, but those are not supported by the current
code base, so this can be cleaned up now.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Now that we only have a single /dev/video# node it is no longer
necessary for atomisp_video_init() to be parametrized.
Remove its parameters and while at it also change the name
from the single /dev/video# node from "ATOMISP ISP PREVIEW output"
to "ATOMISP video output".
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Remove unused fields from struct atomisp_input_subdev:
1. frame_size is never used at all
2. sensor_index is always 0, just directly pass 0 in the single user.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
The info in the MRFLD_PORT_NUM define is duplicate with
the ATOMISP_CAMERA_NR_PORTS and N_MIPI_PORT_ID enum values.
Drop the MRFLD_PORT_NUM define and switch to N_MIPI_PORT_ID
since the [sensor_]lanes arrays are in enum mipi_port_id order.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Remove the gc0310.h header file, moving most of its content
into atomisp-gc0310.c and dropping some unused parts.
This brings the gc0310 sensor driver inline with other sensor
regular / non atomisp sensor drivers which usually only are
one single .c file.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
gc0310_s_config() used to call camera_sensor_platform_data.csi_cfg() back
when the gc0310 driver was still using the atomisp_gmin_platform code
for power-management.
Now it is just a weirdly named wrapper around gc0310_detect(), drop
gc0310_s_config() and make probe() call gc0310_detect() directly.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Remove a bunch of unused includes and sort the remainging
includes alphabetically.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
gc0310_remove() must not call kfree(dev) since the gc0310_device struct
is devm managed so explicitly freeing it causes a double free.
While at it add a missing mutex_destroy() call for the input_lock.
Link: https://lore.kernel.org/r/[email protected]
Fixes: 340b4dd6c183 ("media: atomisp: gc0310: Use devm_kzalloc() for data struct")
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
The XXGC0310 ACPI hardware-id does not appear to be used in
the DSDTs of any hardware out there, so drop it.
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Now that we have only one /dev/video# node we can set asd.subdev.devnode
once from isp_subdev_init_entities(), replacing the hack to set it the
last opened/closed /dev/video# node from atomisp_open() /
atomisp_release().
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
The in_reset argument to atomisp_css_start() is only ever true
in atomisp_assert_recovery_work(), drop the argument and move
the special reset handlig to atomisp_assert_recovery_work().
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Remove no longer user atomisp_get_css_pipe_id() function.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_css_[start|stop]()
The css_pipe_id argument pass to atomisp_css_[start|stop]() is
not used, drop it.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
The atomisp_[sub]dev_users() functions are not used anymore,
remove them.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Just having a /dev/video# node open is not a reason to block system
suspend. At least when userspace is not streaming.
In that case the worst case scenario is that streams have been created,
but we can just destroy those before powering off the ISP and
recreate the streams on resume.
Fixing suspend when streaming is left as a FIXME item for later.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_destroy_pipes_stream()
There now no longer is a non force version of
atomisp_destroy_pipes_stream_force() so having the _force postfix
no longer makes sense rename it to atomisp_destroy_pipes_stream().
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Both atomisp_isr() and recovery_work() now have a combination of:
1. "if (!isp->asd.streaming) goto out;" code at the top
2. "if (sp->asd.streaming) {}" blocks in the body which are jumped over
by the goto out.
This means that the "if (sp->asd.streaming) {}" blocks are always
executed if they are not jumped over by the goto.
Remove the unnecessary "if (sp->asd.streaming)" checks and
re-indent the code.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
atomisp_streaming_count() is just an alias for isp->asd.streaming now,
replace it with directly checking that and remove the helper.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Remove the no longer used atomisp_css_flush() function and merge
atomisp_assert_recovery_work() and __atomisp_css_recover() into
a single function.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
The ATOMISP_DEVICE_STREAMING_STOPPING pipe state comes from when we still
had continuous mode. This would be set when streaming from both capture +
preview devnodes when 1 of the 2 streams has been stopped and the driver
was waiting for the other stream to get stopped too.
With continuous mode gone the stopping state is no longer necessary and
asd->streaming can be changed to a bool.
Note that atomisp_assert_recovery_work() would still temporarily
set streaming to stopping, but it does so with the isp->mutex held and
changes streaming to either enabled or disabled before releasing
the mutex, so none of the consumers which care about the difference
ever see the stopping state.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
All switch (pipe->asd->streaming) cases in atomisp_pipe_check()
are either no-ops or never happen:
1. ATOMISP_DEVICE_STREAMING_DISABLED already is a no-op
2. The videobuf2 core guarantees that when we are streaming
vb2_is_busy() returns true. So the ATOMISP_DEVICE_STREAMING_ENABLED case
is already handled by the if above the switch (pipe->asd->streaming).
3. After recent changes pipe->asd->streaming is only ever set to
ATOMISP_DEVICE_STREAMING_STOPPING in atomisp_assert_recovery_work() and
that function holds isp->mutex and always transitions the streaming state
to ATOMISP_DEVICE_STREAMING_DISABLED or ATOMISP_DEVICE_STREAMING_ENABLED
before releasing the mutex. So atomisp_pipe_check() never sees
ATOMISP_DEVICE_STREAMING_STOPPING.
Remove the entire switch-case.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Now that continuous mode is gone and we only have 1 /dev/video# node,
combined with only allowing 1 open of that /dev/video# node for now,
there is no need to check for other (sub)dev / pipe users.
Remove the unnecessary checks for a nice cleanup.
Note we also don't need to set asd->streaming to disabled since
the vb2_fop_release() call done by atomisp_release() will have called
atomisp_stop_streaming() already at this point (if necessary) and
that will have already done this.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
|
Now that continuous mode is gone and we only have 1 /dev/video# node,
the videobuf2 core guarantees that atomisp_css_[start|stop]() will
only be called one at a time.
So there is no need for atomisp_streaming_count() counts.
When reqbufs has been done then the streams are guaranteed to be created,
and streaming cannot be started without reqbufs so there is no need for
atomisp_css_start() to check if it needs to create the streams.
Use this to clean-up atomisp_css_[start|stop]().
While at it also fix atomisp_css_start() not re-creating the streams
on an error, breaking the guarantee that the streams are always there
after a succesfull reqbufs call.
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|