Searched +hist:3 +hist:c0538fb (Results 1 - 25 of 33) sorted by last modified time

12

/linux-master/drivers/staging/media/atomisp/pci/
H A Dsh_css_mipi.cdiff d21ce8c2 Sun Oct 17 10:19:45 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: fix inverted error check for ia_css_mipi_is_source_port_valid()

The function ia_css_mipi_is_source_port_valid() returns true if the port
is valid. So, we can't use the existing err variable as is.

To fix this issue while reusing that variable, invert the return value
when assigning it to the variable.

Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 9f6b4fa2 Sun Oct 17 10:19:44 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: do not use err var when checking port validity for ISP2400

Currently, the `port >= N_CSI_PORTS || err` checks for ISP2400 are always
evaluated as true because the err variable is set to `-EINVAL` on
declaration but the variable is never used until the evaluation.

Looking at the diff of commit 3c0538fbad9f ("media: atomisp: get rid of
most checks for ISP2401 version"), the `port >= N_CSI_PORTS` check is
for ISP2400 and the err variable check is for ISP2401. Fix this issue
by adding ISP version test there accordingly.

Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 9f6b4fa2 Sun Oct 17 10:19:44 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: do not use err var when checking port validity for ISP2400

Currently, the `port >= N_CSI_PORTS || err` checks for ISP2400 are always
evaluated as true because the err variable is set to `-EINVAL` on
declaration but the variable is never used until the evaluation.

Looking at the diff of commit 3c0538fbad9f ("media: atomisp: get rid of
most checks for ISP2401 version"), the `port >= N_CSI_PORTS` check is
for ISP2400 and the err variable check is for ISP2401. Fix this issue
by adding ISP version test there accordingly.

Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff e1921cd1 Sun Oct 17 10:19:43 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: fix inverted logic in buffers_needed()

When config.mode is IA_CSS_INPUT_MODE_BUFFERED_SENSOR, it rather needs
buffers. Fix it by inverting the return value.

Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Dsh_css.cdiff 5a1b2725 Sun Oct 17 10:19:47 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: fix ifdefs in sh_css.c

## `if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) {` case

The intel-aero atomisp has `#if defined(IS_ISP_2400_SYSTEM)` [1]. It is
to be defined in the following two places [2]:

- css/hive_isp_css_common/system_global.h
- css/css_2401_csi2p_system/system_global.h

and the former file is to be included on ISP2400 devices, too. So, it
is to be defined for both ISP2400 and ISP2401 devices.

Because the upstreamed atomisp driver now supports only ISP2400 and
ISP2401, just remove the ISP version test again. This matches the other
upstream commits like 3c0538fbad9f ("media: atomisp: get rid of most
checks for ISP2401 version").

While here, moved the comment for define GP_ISEL_TPG_MODE to the
appropriate place.

[1] https://github.com/intel-aero/linux-kernel/blob/a1b673258feb915268377275130c5c5df0eafc82/drivers/media/pci/atomisp/css/sh_css.c#L552-L558
[2] https://github.com/intel-aero/linux-kernel/search?q=IS_ISP_2400_SYSTEM

## `isys_stream_descr->polling_mode` case

This does not exist on the intel-aero atomisp. This is because it is
based on css version irci_stable_candrpv_0415_20150521_0458.

On the other hand, the upstreamed atomisp is based on the following css
version depending on the ISP version using ifdefs:

- ISP2400: irci_stable_candrpv_0415_20150521_0458
- ISP2401: irci_master_20150911_0724

The `isys_stream_descr->polling_mode` usage was added on updating css
version to irci_master_20150701_0213 [3].

So, it is not a ISP version specific thing, but css version specific
thing. Because the upstreamed atomisp driver uses irci_master_20150911_0724
for ISP2401, re-add the ISP version check for now.

I say "for now" because ISP2401 should eventually use the same css
version with ISP2400 (i.e., irci_stable_candrpv_0415_20150521_0458)

[3] https://raw.githubusercontent.com/intel/ProductionKernelQuilts/cht-m1stable-2016_ww31/uefi/cht-m1stable/patches/cam-0439-atomisp2-css2401-and-2401_legacy-irci_master_2015070.patch
("atomisp2: css2401 and 2401_legacy-irci_master_20150701_0213")
Link to Intel's Android kernel patch.

## `coord = &me->config.internal_frame_origin_bqs_on_sctbl;` case

it was added on commit 4f744a573db3 ("media: atomisp: make
sh_css_sp_init_pipeline() ISP version independent") for ISP2401. Because
the upstreamed atomisp for the ISP2401 part is based on
irci_master_20150911_0724, hence the difference.

Because the upstreamed atomisp driver uses irci_master_20150911_0724
for ISP2401, revert the test back to `if (IS_ISP2401)`.

Fixes: 27333dadef57 ("media: atomisp: adjust some code at sh_css that could be broken")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 5a1b2725 Sun Oct 17 10:19:47 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: fix ifdefs in sh_css.c

## `if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) {` case

The intel-aero atomisp has `#if defined(IS_ISP_2400_SYSTEM)` [1]. It is
to be defined in the following two places [2]:

- css/hive_isp_css_common/system_global.h
- css/css_2401_csi2p_system/system_global.h

and the former file is to be included on ISP2400 devices, too. So, it
is to be defined for both ISP2400 and ISP2401 devices.

Because the upstreamed atomisp driver now supports only ISP2400 and
ISP2401, just remove the ISP version test again. This matches the other
upstream commits like 3c0538fbad9f ("media: atomisp: get rid of most
checks for ISP2401 version").

While here, moved the comment for define GP_ISEL_TPG_MODE to the
appropriate place.

[1] https://github.com/intel-aero/linux-kernel/blob/a1b673258feb915268377275130c5c5df0eafc82/drivers/media/pci/atomisp/css/sh_css.c#L552-L558
[2] https://github.com/intel-aero/linux-kernel/search?q=IS_ISP_2400_SYSTEM

## `isys_stream_descr->polling_mode` case

This does not exist on the intel-aero atomisp. This is because it is
based on css version irci_stable_candrpv_0415_20150521_0458.

On the other hand, the upstreamed atomisp is based on the following css
version depending on the ISP version using ifdefs:

- ISP2400: irci_stable_candrpv_0415_20150521_0458
- ISP2401: irci_master_20150911_0724

The `isys_stream_descr->polling_mode` usage was added on updating css
version to irci_master_20150701_0213 [3].

So, it is not a ISP version specific thing, but css version specific
thing. Because the upstreamed atomisp driver uses irci_master_20150911_0724
for ISP2401, re-add the ISP version check for now.

I say "for now" because ISP2401 should eventually use the same css
version with ISP2400 (i.e., irci_stable_candrpv_0415_20150521_0458)

[3] https://raw.githubusercontent.com/intel/ProductionKernelQuilts/cht-m1stable-2016_ww31/uefi/cht-m1stable/patches/cam-0439-atomisp2-css2401-and-2401_legacy-irci_master_2015070.patch
("atomisp2: css2401 and 2401_legacy-irci_master_20150701_0213")
Link to Intel's Android kernel patch.

## `coord = &me->config.internal_frame_origin_bqs_on_sctbl;` case

it was added on commit 4f744a573db3 ("media: atomisp: make
sh_css_sp_init_pipeline() ISP version independent") for ISP2401. Because
the upstreamed atomisp for the ISP2401 part is based on
irci_master_20150911_0724, hence the difference.

Because the upstreamed atomisp driver uses irci_master_20150911_0724
for ISP2401, revert the test back to `if (IS_ISP2401)`.

Fixes: 27333dadef57 ("media: atomisp: adjust some code at sh_css that could be broken")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 5a1b2725 Sun Oct 17 10:19:47 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: fix ifdefs in sh_css.c

## `if (pipe->stream->config.mode == IA_CSS_INPUT_MODE_TPG) {` case

The intel-aero atomisp has `#if defined(IS_ISP_2400_SYSTEM)` [1]. It is
to be defined in the following two places [2]:

- css/hive_isp_css_common/system_global.h
- css/css_2401_csi2p_system/system_global.h

and the former file is to be included on ISP2400 devices, too. So, it
is to be defined for both ISP2400 and ISP2401 devices.

Because the upstreamed atomisp driver now supports only ISP2400 and
ISP2401, just remove the ISP version test again. This matches the other
upstream commits like 3c0538fbad9f ("media: atomisp: get rid of most
checks for ISP2401 version").

While here, moved the comment for define GP_ISEL_TPG_MODE to the
appropriate place.

[1] https://github.com/intel-aero/linux-kernel/blob/a1b673258feb915268377275130c5c5df0eafc82/drivers/media/pci/atomisp/css/sh_css.c#L552-L558
[2] https://github.com/intel-aero/linux-kernel/search?q=IS_ISP_2400_SYSTEM

## `isys_stream_descr->polling_mode` case

This does not exist on the intel-aero atomisp. This is because it is
based on css version irci_stable_candrpv_0415_20150521_0458.

On the other hand, the upstreamed atomisp is based on the following css
version depending on the ISP version using ifdefs:

- ISP2400: irci_stable_candrpv_0415_20150521_0458
- ISP2401: irci_master_20150911_0724

The `isys_stream_descr->polling_mode` usage was added on updating css
version to irci_master_20150701_0213 [3].

So, it is not a ISP version specific thing, but css version specific
thing. Because the upstreamed atomisp driver uses irci_master_20150911_0724
for ISP2401, re-add the ISP version check for now.

I say "for now" because ISP2401 should eventually use the same css
version with ISP2400 (i.e., irci_stable_candrpv_0415_20150521_0458)

[3] https://raw.githubusercontent.com/intel/ProductionKernelQuilts/cht-m1stable-2016_ww31/uefi/cht-m1stable/patches/cam-0439-atomisp2-css2401-and-2401_legacy-irci_master_2015070.patch
("atomisp2: css2401 and 2401_legacy-irci_master_20150701_0213")
Link to Intel's Android kernel patch.

## `coord = &me->config.internal_frame_origin_bqs_on_sctbl;` case

it was added on commit 4f744a573db3 ("media: atomisp: make
sh_css_sp_init_pipeline() ISP version independent") for ISP2401. Because
the upstreamed atomisp for the ISP2401 part is based on
irci_master_20150911_0724, hence the difference.

Because the upstreamed atomisp driver uses irci_master_20150911_0724
for ISP2401, revert the test back to `if (IS_ISP2401)`.

Fixes: 27333dadef57 ("media: atomisp: adjust some code at sh_css that could be broken")
Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 69aa1dee Sun Jul 11 08:51:01 MDT 2021 Kees Cook <keescook@chromium.org> media: atomisp: Perform a single memset() for union

There is no need to memset() both dvs_grid_info and dvs_stat_grid_info
separately: they are part of the same union. Instead, just zero the
union itself. This additionally avoids a false positive (due to a
gcc optimization bug[1]) when building with the coming FORTIFY_SOURCE
improvements:

In function 'fortify_memset_chk',
inlined from 'sh_css_pipe_get_grid_info' at drivers/staging/media/atomisp/pci/sh_css.c:5186:3,
inlined from 'ia_css_stream_create' at drivers/staging/media/atomisp/pci/sh_css.c:9442:10:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
199 | __write_overflow_field();
| ^~~~~~~~~~~~~~~~~~~~~~~~

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419

Link: https://lore.kernel.org/linux-media/20210711145101.1434065-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff a93cf5a5 Sat May 08 17:56:20 MDT 2021 Martiros Shakhzadyan <vrzh@vrzh.net> media: atomisp: Remove unnecessary parens in sh_css.c

Remove unnecessary parenthesis.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-3-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 1d74a91d Sun Jul 11 08:51:01 MDT 2021 Kees Cook <keescook@chromium.org> media: atomisp: Perform a single memset() for union

There is no need to memset() both dvs_grid_info and dvs_stat_grid_info
separately: they are part of the same union. Instead, just zero the
union itself. This additionally avoids a false positive (due to a
gcc optimization bug[1]) when building with the coming FORTIFY_SOURCE
improvements:

In function 'fortify_memset_chk',
inlined from 'sh_css_pipe_get_grid_info' at drivers/staging/media/atomisp/pci/sh_css.c:5186:3,
inlined from 'ia_css_stream_create' at drivers/staging/media/atomisp/pci/sh_css.c:9442:10:
./include/linux/fortify-string.h:199:4: warning: call to '__write_overflow_field' declared with attribute warning: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning]
199 | __write_overflow_field();
| ^~~~~~~~~~~~~~~~~~~~~~~~

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101419

Link: https://lore.kernel.org/linux-media/20210711145101.1434065-1-keescook@chromium.org
Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff f6e2a76d Sat May 08 17:56:20 MDT 2021 Martiros Shakhzadyan <vrzh@vrzh.net> media: atomisp: Remove unnecessary parens in sh_css.c

Remove unnecessary parenthesis.

Link: https://lore.kernel.org/linux-media/20210508235622.300394-3-vrzh@vrzh.net
Signed-off-by: Martiros Shakhzadyan <vrzh@vrzh.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 7b53e162 Tue May 19 23:28:50 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: fix pipeline initialization code

The code under load_primary_binaries() is complex and
were hard to understand, because it used to have lots
of ifdefs and broken identation.

The patch which cleaned it and removed the version-specific
ifdefs added a regression.

Solve it.

Fixes: 3c0538fbad9f ("media: atomisp: get rid of most checks for ISP2401 version")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Datomisp_cmd.cdiff 26b53392 Fri Dec 29 08:41:55 MST 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Refactor sensor crop + fmt setting

There are 3 code-paths all of 3 which need to do:

1. Get try or active state
2. lock state
3. Call atomisp_set_crop()
4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt)
5. unlock state

Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of
this and change the 3 code-paths which need this to use the new
atomisp_set_crop_and_fmt() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 26b53392 Fri Dec 29 08:41:55 MST 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Refactor sensor crop + fmt setting

There are 3 code-paths all of 3 which need to do:

1. Get try or active state
2. lock state
3. Call atomisp_set_crop()
4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt)
5. unlock state

Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of
this and change the 3 code-paths which need this to use the new
atomisp_set_crop_and_fmt() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 26b53392 Fri Dec 29 08:41:55 MST 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Refactor sensor crop + fmt setting

There are 3 code-paths all of 3 which need to do:

1. Get try or active state
2. lock state
3. Call atomisp_set_crop()
4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt)
5. unlock state

Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of
this and change the 3 code-paths which need this to use the new
atomisp_set_crop_and_fmt() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 26b53392 Fri Dec 29 08:41:55 MST 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Refactor sensor crop + fmt setting

There are 3 code-paths all of 3 which need to do:

1. Get try or active state
2. lock state
3. Call atomisp_set_crop()
4. Call v4l2_subdev_call(input->camera, pad, set_fmt, state, fmt)
5. unlock state

Change atomisp_set_crop into atomisp_set_crop_and_fmt() which does all of
this and change the 3 code-paths which need this to use the new
atomisp_set_crop_and_fmt() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff d86c33af Sun Jun 18 16:52:08 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Clamp width to max 1920 pixels when in ATOMISP_RUN_MODE_PREVIEW

The pipeline firmware-binaries used in previed mode have
ia_css_binary_xinfo.output.max_width set to 1920.

This causes ia_css_binary_find() to fail when trying to set a higher
resolution resulting in the dump_stack() call in ia_css_binary_find()
triggering and resulting in the try_fmt() or set_fmt() IOCTL failing.

Fix this by clamping the width to max 1920 when in preview mode.

Link: https://lore.kernel.org/r/20230619105212.303653-3-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 0f417dc1 Thu Jun 01 08:58:57 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Make atomisp_enum_framesizes_crop() check resolution fits with padding

Now that atomisp_get_padding() takes minimum padding requirements
on BYT/ISP2400 into account, it is possible for a resolution which
fits in the active area of the sensor to not fit in the native area
once padding is added.

For example on the ov2680 which has a native resolution of 1616x1216
the max active resolution of 1600x1200 leaves 16x16 for padding which
meets the worst-case minimum padding requirement of 14x14 on BYT.

But after binning we are left with an native area of 808x608 and
an active area of 800x600. This leaves 8x8 for padding which is not
enough. So on BYT 800x600 is not a valid resolution (it could be
made by lots of cropping without binning but then the remaining
field of view is no good).

Modify atomisp_enum_framesizes_crop() to check the resolution +
padding fits in the native rectangle, removing 800x600 from
the list of valid modes on BYT.

Link: https://lore.kernel.org/r/20230601145858.59652-3-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3e399cf2 Mon May 29 04:37:38 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Use selection API info to determine sensor padding

Using the selection / crop info to determine the padding values
to use with a specific resolution on specific sensor.

This allows e.g. automatically halving the padding when using
the max binned resolution and also ensures the right amount
of padding is used on models with 2 sensors with different
padding requirements.

Link: https://lore.kernel.org/r/20230529103741.11904-19-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 929eee2f Mon May 29 04:37:34 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Refactor atomisp_try_fmt() / atomisp_set_fmt()

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/20230529103741.11904-15-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 929eee2f Mon May 29 04:37:34 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Refactor atomisp_try_fmt() / atomisp_set_fmt()

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/20230529103741.11904-15-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 7caa6570 Mon May 29 04:37:29 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Simplify atomisp_subdev_set_selection() calls in 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/20230529103741.11904-10-hdegoede@redhat.com

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
H A Dsh_css_params.cdiff 0301a15a Tue Sep 26 03:27:09 MDT 2023 Hans Verkuil <hverkuil-cisco@xs4all.nl> media: atomisp: fix 'read beyond size of field'

If CONFIG_FORTIFY_SOURCE=y, then this warning is produced:

In file included from ./include/linux/string.h:254,
from ./include/linux/bitmap.h:11,
from ./include/linux/cpumask.h:12,
from ./arch/x86/include/asm/cpumask.h:5,
from ./arch/x86/include/asm/msr.h:11,
from ./arch/x86/include/asm/processor.h:23,
from ./arch/x86/include/asm/cpufeature.h:5,
from ./arch/x86/include/asm/thread_info.h:53,
from ./include/linux/thread_info.h:60,
from ./arch/x86/include/asm/preempt.h:9,
from ./include/linux/preempt.h:79,
from ./include/linux/spinlock.h:56,
from ./include/linux/mmzone.h:8,
from ./include/linux/gfp.h:7,
from ./include/linux/slab.h:16,
from ./drivers/staging/media/atomisp//include/hmm/hmm.h:26,
from drivers/staging/media/atomisp/pci/sh_css_params.c:26:
In function ‘fortify_memcpy_chk’,
inlined from ‘sh_css_store_sp_group_to_ddr’ at drivers/staging/media/atomisp/pci/sh_css_params.c:3736:3:
./include/linux/fortify-string.h:592:25: warning: call to ‘__read_overflow2_field’ declared with attribute warning: detected read beyond size of field (2nd parameter); maybe use struct_group()?
[-Wattribute-warning]
592 | __read_overflow2_field(q_size_field, size);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The reason is that the memcpy copies two fields (each a u8), when the source
pointer points to the first field. It's a bit unexpected, so just make this
explicit.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
diff 3ad29019 Wed Aug 31 23:20:09 MDT 2022 Dan Carpenter <error27@gmail.com> media: atomisp: prevent integer overflow in sh_css_set_black_frame()

The "height" and "width" values come from the user so the "height * width"
multiplication can overflow.

Link: https://lore.kernel.org/r/YxBBCRnm3mmvaiuR@kili

Fixes: a49d25364dfb ("staging/atomisp: Add support for the Intel IPU v2")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Dsh_css_firmware.cdiff bb4924c2 Sun Oct 17 10:19:53 MDT 2021 Tsuchiya Yuto <kitakar@gmail.com> media: atomisp: pci: release_version is now irci_stable_candrpv_0415_20150521_0458

Now that we made atomisp work with firmware version
irci_stable_candrpv_0415_20150521_0458 also for ISP2401, the
release_version for ISP2401 is not irci_ecr-master_20150911_0724
anymore.

So, use the same release_version for both ISP2400 and ISP2401 (i.e.,
irci_stable_candrpv_0415_20150521_0458).

Referred to the following diff to make this patch:
- https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/drivers/staging/media/atomisp/pci/sh_css_firmware.c?id=3c0538fbad9f1d07d588f631e380256d941e3d3a
("media: atomisp: get rid of most checks for ISP2401 version")
changes for file sh_css_firmware.c

Signed-off-by: Tsuchiya Yuto <kitakar@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 454a6232 Fri Jun 04 20:08:55 MDT 2021 Fabio M. De Francesco <fmdefrancesco@gmail.com> media: atomisp: pci: Remove unnecessary (void *) cast

Removed an unnecessary (void *) cast for an argument passed to kfree().

Link: https://lore.kernel.org/linux-media/20210605020855.1065-3-fmdefrancesco@gmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 655ace3c Fri Jun 04 20:08:55 MDT 2021 Fabio M. De Francesco <fmdefrancesco@gmail.com> media: atomisp: pci: Remove unnecessary (void *) cast

Removed an unnecessary (void *) cast for an argument passed to kfree().

Link: https://lore.kernel.org/linux-media/20210605020855.1065-3-fmdefrancesco@gmail.com
Suggested-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/pipeline/src/
H A Dpipeline.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/binary/src/
H A Dbinary.cdiff 3b63b7db Sat Dec 23 02:15:21 MST 2023 Dipendra Khadka <kdipendra88@gmail.com> media: atomisp: Fix spelling mistake in binary.c

codespell reported following spelling mistake
in runtime/binary/src as below:

'''
./runtime/binary/src/binary.c:537: spcification ==> specification
'''
This patch fixes thisspelling mistake.

Link: https://lore.kernel.org/r/20231223091521.85467-1-kdipendra88@gmail.com

Signed-off-by: Dipendra Khadka <kdipendra88@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 2b5d1e14 Wed Aug 02 03:55:56 MDT 2023 Kate Hsuan <hpa@redhat.com> media: atomisp: binary: Removed #ifdef ISP2401 to make driver generic

Removed #ifdef ISP2401 to make the driver generic. The driver flow is
determined in runtime.

Link: https://lore.kernel.org/r/20230802095606.1298152-3-hpa@redhat.com

Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/isys/src/
H A Dvirtual_isys.cdiff 8fc67b18 Wed Jul 12 16:02:22 MDT 2023 Kate Hsuan <hpa@redhat.com> media: atomisp: Make two individual enum to define the MIPI format

The original mipi_format_t represents the MIPI format settings for both
atomisp with the same name and the enum member was controlled by #if
defined(ISP2401). However, if we want to make this driver generic, this
enum should be individually defined for them.

Since the format type is redefined, the format setting function
ia_css_isys_set_fmt_type() should be reworked for ISP2400 and ISP2401
called ia_css_isys_2400_set_fmt_type() and ia_css_isys_2401_set_fmt_type()
.

Additionally, the function called is_mipi_format_yuv420() isn't used by any
functions so it can be removed.

Link: https://lore.kernel.org/r/20230713100231.308923-3-hpa@redhat.com

Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Drx.cdiff 8fc67b18 Wed Jul 12 16:02:22 MDT 2023 Kate Hsuan <hpa@redhat.com> media: atomisp: Make two individual enum to define the MIPI format

The original mipi_format_t represents the MIPI format settings for both
atomisp with the same name and the enum member was controlled by #if
defined(ISP2401). However, if we want to make this driver generic, this
enum should be individually defined for them.

Since the format type is redefined, the format setting function
ia_css_isys_set_fmt_type() should be reworked for ISP2400 and ISP2401
called ia_css_isys_2400_set_fmt_type() and ia_css_isys_2401_set_fmt_type()
.

Additionally, the function called is_mipi_format_yuv420() isn't used by any
functions so it can be removed.

Link: https://lore.kernel.org/r/20230713100231.308923-3-hpa@redhat.com

Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Disys_init.cdiff b6e59783 Sat Jul 15 11:09:06 MDT 2023 Hans de Goede <hdegoede@redhat.com> media: atomisp: Mark ia_css_isys_240?_init() static

ia_css_isys_240?_init() are only used inside the C file where they are
declared, mark them as static fixing:

drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c:24:20:
warning: no previous prototype for 'ia_css_isys_2400_init'
24 | input_system_err_t ia_css_isys_2400_init(void)
| ^~~~~~~~~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/isys/src/isys_init.c:87:20:
warning: no previous prototype for 'ia_css_isys_2401_init'
87 | input_system_err_t ia_css_isys_2401_init(void)
| ^~~~~~~~~~~~~~~~~~~~~

Closes: https://lore.kernel.org/oe-kbuild-all/202307152046.rvhFGrbz-lkp@intel.com/
Link: https://lore.kernel.org/r/20230715170906.3627-3-hdegoede@redhat.com

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Disys_stream2mmio_rmgr.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Dcsi_rx_rmgr.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
H A Disys_dma_rmgr.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/ifmtr/src/
H A Difmtr.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/debug/src/
H A Dia_css_debug.cdiff f55254c9 Sat Sep 23 09:20:47 MDT 2023 Hans Verkuil <hverkuil-cisco@xs4all.nl> media: atomisp: ia_ccs_debug.c: increase enable_info buffer

Fixes these compiler warnings:

drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c: In function 'ia_css_debug_pipe_graph_dump_stage':
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2786:66: warning: '\n' directive output may be truncated writing 2 bytes into a region of size between 0 and 198 [-Wformat-truncation=]
2786 | "%s\\n%s\\n%s",
| ^~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2785:49: note: 'snprintf' output between 5 and 302 bytes into a destination of size 200
2785 | snprintf(enable_info, sizeof(enable_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2786 | "%s\\n%s\\n%s",
| ~~~~~~~~~~~~~~~
2787 | enable_info1, enable_info2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2788 | enable_info3);
| ~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2772:66: warning: '\n' directive output may be truncated writing 2 bytes into a region of size between 0 and 198 [-Wformat-truncation=]
2772 | "%s\\n%s\\n%s",
| ^~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2771:49: note: 'snprintf' output between 5 and 302 bytes into a destination of size 200
2771 | snprintf(enable_info, sizeof(enable_info),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2772 | "%s\\n%s\\n%s",
| ~~~~~~~~~~~~~~~
2773 | enable_info1, enable_info2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2774 | enable_info3);
| ~~~~~~~~~~~~~
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2749:92: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
2749 | snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
| ^
drivers/staging/media/atomisp/pci/runtime/debug/src/ia_css_debug.c:2749:41: note: 'snprintf' output between 3 and 201 bytes into a destination of size 200
2749 | snprintf(enable_info, sizeof(enable_info), "%s\\n%s",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2750 | enable_info1, enable_info2);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
diff 55c3407c Sun Jun 18 23:24:52 MDT 2023 Kate Hsuan <hpa@redhat.com> media: atomisp: Removed unused HAS_WATCHDOG_SP_THREAD_DEBUG debug

Since the debug codes around #ifdef HAS_WATCHDOG_SP_THREAD_DEBUG are
no longer used, the debug implementation of this can be removed.

Link: https://lore.kernel.org/r/20230619052453.48598-3-hpa@redhat.com

Signed-off-by: Kate Hsuan <hpa@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff bdfdd9e7 Sat May 23 08:59:14 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: make it use dbg_level to control debug level

This driver has 3 different types of debug messages:

- dev_dbg()
- dbg_level
- ia_css_debug_trace_level

Which is crazy. Ideally, it shold just use dev_dbg()
everywhere, but for now let's unify the last two machanisms.

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/frame/src/
H A Dframe.cdiff 7c6b6a5b Wed Jun 15 14:49:59 MDT 2022 Hans de Goede <hdegoede@redhat.com> media: atomisp: remove unused ia_css_frame_allocate_contiguous*() functions

ia_css_frame_allocate_contiguous() and
ia_css_frame_allocate_contiguous_from_info() are not used anywhere,
remove them.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-3-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/isp/kernels/ipu2_io_ls/yuv444_io_ls/
H A Dia_css_yuv444_io.host.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/camera/pipe/src/
H A Dpipe_binarydesc.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/spctrl/src/
H A Dspctrl.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/isp_param/src/
H A Disp_param.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/isp/kernels/sc/sc_1.0/
H A Dia_css_sc.host.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/isp/kernels/dvs/dvs_1.0/
H A Dia_css_dvs.host.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/timer/src/
H A Dtimer.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/queue/src/
H A Dqueue_access.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
/linux-master/drivers/staging/media/atomisp/pci/runtime/inputfifo/src/
H A Dinputfifo.cdiff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
diff 3c0538fb Thu Apr 30 05:56:47 MDT 2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org> media: atomisp: get rid of most checks for ISP2401 version

There are lots of places inside this driver checking for
ISP2400/ISP2401 verison. Get rid of most of those, while
keep building for both.

Most of stuff in this patch is trivial to solve.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

Completed in 558 milliseconds

12