OSDN Git Service

tomoyo/tomoyo-test1.git
4 years agomedia: atomisp: cleanup contents of css_2401_system
Mauro Carvalho Chehab [Thu, 30 Apr 2020 12:21:15 +0000 (14:21 +0200)]
media: atomisp: cleanup contents of css_2401_system

Everything there is for ISP2401 only. So, we can trivially
solve all ifdefs at once.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: cleanup contents of css_2401_csi2p_system
Mauro Carvalho Chehab [Thu, 30 Apr 2020 12:19:44 +0000 (14:19 +0200)]
media: atomisp: cleanup contents of css_2401_csi2p_system

Everything there is for ISP2401 only. So, we can trivially
solve all ifdefs at once.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: cleanup contents of css_2400_system/
Mauro Carvalho Chehab [Thu, 30 Apr 2020 12:15:18 +0000 (14:15 +0200)]
media: atomisp: cleanup contents of css_2400_system/

Everything there is for ISP2400 only. So, we can trivially
solve all ifdefs at once

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: allow building for isp2401
Mauro Carvalho Chehab [Thu, 30 Apr 2020 09:32:18 +0000 (11:32 +0200)]
media: atomisp: allow building for isp2401

Now that everything needed to build for ISP2401 is solved,
we can setup atomisp to build either for ISP2400 or ISP2401.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: change function worders and fix include
Mauro Carvalho Chehab [Thu, 30 Apr 2020 10:30:07 +0000 (12:30 +0200)]
media: atomisp: change function worders and fix include

With the current way, it will produce lots of errors because
the public header contains wrong definitions and the private
one has functions defined at the wrong order.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of some broken code
Mauro Carvalho Chehab [Thu, 30 Apr 2020 10:12:25 +0000 (12:12 +0200)]
media: atomisp: get rid of some broken code

Probably due to some version conflicts while the atomisp code
were generated, some things don't build for ISP2401. So, use
the ISP2400 variant when available, or get rid of the
code that doesn't build.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: cleanup directory hierarchy
Mauro Carvalho Chehab [Thu, 30 Apr 2020 07:49:43 +0000 (09:49 +0200)]
media: atomisp: cleanup directory hierarchy

This driver has very long directories without a good
reason (IMHO). Let's drop two directories from such hierarchy,
in order to simplify things a little bit and make the dir
output a bit more readable.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: simplify makefiles
Mauro Carvalho Chehab [Thu, 30 Apr 2020 07:25:26 +0000 (09:25 +0200)]
media: atomisp: simplify makefiles

Remove an uneeded define and Makefile.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: make all file names unique at atomisp driver
Mauro Carvalho Chehab [Wed, 29 Apr 2020 19:55:48 +0000 (21:55 +0200)]
media: atomisp: make all file names unique at atomisp driver

The *system_*.h files contain ISP-specific definitions, and are
used everywhere.

While the best would be to get rid of those in favor of some
ISP-specific structs, a change like that would require lots
of changes.

So, instead, let's rename those files replacing them by new
ones with ISP ifdefs on it, in order to select between the
two different versions.

We shall later convert this to some abrstraction layer,
but this change should help to be able to build support for
either ISP2400 or ISP2401.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of __ISP define tests
Mauro Carvalho Chehab [Wed, 29 Apr 2020 12:24:48 +0000 (14:24 +0200)]
media: atomisp: get rid of __ISP define tests

This is not defined anywhere, so just get rid of the dead
source code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of ISP_VMEM_IS_BAMEM unused defines
Mauro Carvalho Chehab [Wed, 29 Apr 2020 12:12:27 +0000 (14:12 +0200)]
media: atomisp: get rid of ISP_VMEM_IS_BAMEM unused defines

There are several defines on ISP-specific definition sets
that are unused, related to VMEM_BAMEM. Get rid of those.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of ia_css_sc_param.h version dependency
Mauro Carvalho Chehab [Wed, 29 Apr 2020 09:50:52 +0000 (11:50 +0200)]
media: atomisp: get rid of ia_css_sc_param.h version dependency

That's the last header file which had ifdefs for ISP2401.

The problem is that the conflicting dependencies were on another
file (sh_css_defs.h). Move the conflicting code to it, adding
a prefix which would describe what version the macro applies.

Then, ensure that binary.c will use the right version,
according with the hardware version.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of trivial version checks at *.h
Mauro Carvalho Chehab [Wed, 29 Apr 2020 09:43:07 +0000 (11:43 +0200)]
media: atomisp: get rid of trivial version checks at *.h

Most of the remaining ifdefs check for ISP2401 are trivial.

Get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove unused duplicated files
Mauro Carvalho Chehab [Wed, 29 Apr 2020 09:06:27 +0000 (11:06 +0200)]
media: atomisp: remove unused duplicated files

Those files aren't used. So, just get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of io_ls/ subdir
Mauro Carvalho Chehab [Wed, 29 Apr 2020 09:15:59 +0000 (11:15 +0200)]
media: atomisp: get rid of io_ls/ subdir

The contents of this file is identical to ipu2_io_ls, except
for the bayer directory, with is only at ipu2_io_ls.

So, get rid of the duplicated code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: rename anr2 param header file
Mauro Carvalho Chehab [Wed, 29 Apr 2020 08:57:27 +0000 (10:57 +0200)]
media: atomisp: rename anr2 param header file

This file is different than the anr1 version. So, let's name
it differently.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove bayer_io_ls duplication
Mauro Carvalho Chehab [Wed, 29 Apr 2020 08:35:30 +0000 (10:35 +0200)]
media: atomisp: remove bayer_io_ls duplication

There are two instances of those, one for isp2401 and another
one for isp2400, both with identical contents, except for
comments and an ifdef.

Get rid of one of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: use regulator_get_optional() for first attempt
Mauro Carvalho Chehab [Tue, 28 Apr 2020 23:05:47 +0000 (01:05 +0200)]
media: atomisp: use regulator_get_optional() for first attempt

Some BIOSes seem to use different names for some regulators.

Use regulator_get_optional() for the first attempt, in order
to avoid using the dummy regulator and produce a warning, in
the case that the first attempt fails.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: add Asus Transform T101HA ACPI vars
Mauro Carvalho Chehab [Sat, 25 Apr 2020 11:47:56 +0000 (13:47 +0200)]
media: atomisp: add Asus Transform T101HA ACPI vars

Those were extracted from an ACPI dump:

 * Original Table Header:
 *     Signature        "DSDT"
 *     Length           0x0001A0BD (106685)
 *     Revision         0x02
 *     Checksum         0x76
 *     OEM ID           "_ASUS_"
 *     OEM Table ID     "Notebook"
 *     OEM Revision     0x01072009 (17244169)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20120913 (538052883)
 */
DefinitionBlock ("", "DSDT", 2, "_ASUS_", "Notebook", 0x01072009)
...
                    Local0 = Package (0x12)
                        {
                            "CamId",
                            "ov2680",
                            "CamType",
                            "1",
                            "CsiPort",
                            "0",
                            "CsiLanes",
                            "1",
                            "CsiFmt",
                            "15",
                            "CsiBayer",
                            "0",
                            "CamClk",
                            "1",
                            "Regulator1p8v",
                            "0",
                            "Regulator2p8v",
                            "0"
                        }

Note: the DMI_MATCH() line probably needs to be tweaked.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get finish de-duplication of hrt/hive*.h
Mauro Carvalho Chehab [Tue, 28 Apr 2020 21:48:32 +0000 (23:48 +0200)]
media: atomisp: get finish de-duplication of hrt/hive*.h

The last header (hive_isp_css_2401_irq_types_hrt.h) is also
almost identical, except by an if ISP2400 inside a comment
block.

Remove the duplication and keep just one file.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: hive_isp_css_defs.h: keep just one copy of it
Mauro Carvalho Chehab [Tue, 28 Apr 2020 21:25:12 +0000 (23:25 +0200)]
media: atomisp: hive_isp_css_defs.h: keep just one copy of it

While those headers are different, the different fields
aren't used at the driver. So, remove those different
unused fields, rename one define and use just one header
for all 3 different versions of the ISP.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove unused hive_isp_css_host_ids_hrt.h
Mauro Carvalho Chehab [Tue, 28 Apr 2020 20:53:28 +0000 (22:53 +0200)]
media: atomisp: remove unused hive_isp_css_host_ids_hrt.h

Nothing here is really used by the driver. So, let's just
get rid of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove several duplicated files
Mauro Carvalho Chehab [Tue, 28 Apr 2020 16:38:04 +0000 (18:38 +0200)]
media: atomisp: remove several duplicated files

Those files have identical contents, but are located at
different parts of the driver. As their contents are identical,
we can simply remove them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove unused definitions at */isp_capture_defs.h
Mauro Carvalho Chehab [Tue, 28 Apr 2020 20:25:02 +0000 (22:25 +0200)]
media: atomisp: remove unused definitions at */isp_capture_defs.h

The isp_capture_defs.h contain several unused defines.
Get rid of some of them, making all 3 instances identical.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of unused header files
Mauro Carvalho Chehab [Tue, 28 Apr 2020 16:31:31 +0000 (18:31 +0200)]
media: atomisp: get rid of unused header files

Those 4 header files aren't used anyware. So, send them to
the trash can.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of trivial ISP2401 dependencies on header files
Mauro Carvalho Chehab [Tue, 28 Apr 2020 12:06:20 +0000 (14:06 +0200)]
media: atomisp: get rid of trivial ISP2401 dependencies on header files

On several header files, the dependency for ISP2401 is
trivial: for example, it just adds new fields on structs or
declare new functions.

Get rid of those trivial cases.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of several typedef-style defines
Mauro Carvalho Chehab [Tue, 28 Apr 2020 16:26:45 +0000 (18:26 +0200)]
media: atomisp: get rid of several typedef-style defines

Those vars aren't used anymore at this driver. Get rid of
them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: isp_const.h: get rid of an unused big define list
Mauro Carvalho Chehab [Tue, 28 Apr 2020 16:08:28 +0000 (18:08 +0200)]
media: atomisp: isp_const.h: get rid of an unused big define list

None of those SH_CSS_BINARY_ID_* symbols are used by this driver
anymore. So, get rid of all of them.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: sh_css: detect ISP version at runtime
Mauro Carvalho Chehab [Tue, 28 Apr 2020 08:14:07 +0000 (10:14 +0200)]
media: atomisp: sh_css: detect ISP version at runtime

Get rid of all those ifdefs that were checking for ISP2401 inside
sh_css.c.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: make util.c work with ISP2401 runtime detection
Mauro Carvalho Chehab [Tue, 28 Apr 2020 07:30:26 +0000 (09:30 +0200)]
media: atomisp: make util.c work with ISP2401 runtime detection

Don't hide those small functions behind ifdefs.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of some non-existing functions for ISP2401
Mauro Carvalho Chehab [Tue, 28 Apr 2020 06:23:31 +0000 (08:23 +0200)]
media: atomisp: get rid of some non-existing functions for ISP2401

There are no ia_css_set_system_mode() nor
ia_css_is_system_mode_suspend_or_resume() functions at the driver.

So, get rid of the code that would try to call it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: ia_css_binary_get_shading_info(): don't test version
Mauro Carvalho Chehab [Sun, 26 Apr 2020 16:56:54 +0000 (18:56 +0200)]
media: atomisp: ia_css_binary_get_shading_info(): don't test version

It doesn't make any sense to change the number of parameters
for this function depending on the ISP version.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: css_trace.h: use the newest tracing code
Mauro Carvalho Chehab [Sun, 26 Apr 2020 10:06:20 +0000 (12:06 +0200)]
media: atomisp: css_trace.h: use the newest tracing code

The css_trace header for ISP2401 also builds on older versions, and
seems to be compatible with all versions. So, remove all ifdefs
in favor of the CSP2401 version.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: add support for possible new names
Mauro Carvalho Chehab [Sat, 25 Apr 2020 11:39:24 +0000 (13:39 +0200)]
media: atomisp: add support for possible new names

This patch addresses what it sounds to be a change at the
name of some ACPI registers on newer ACPI tables.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: print css_version in runtime
Mauro Carvalho Chehab [Thu, 23 Apr 2020 07:47:26 +0000 (09:47 +0200)]
media: atomisp: print css_version in runtime

The CSS version returned by ISP2400 is different than the one
returned by ISP2401.

While we could return just one version for both, as this sounds
like just an informative string, for now, let's keep returning
different versions, as we don't know if this would affect
userspace.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: sh_css_param_dvs.h remove ISP version macros
Mauro Carvalho Chehab [Thu, 23 Apr 2020 07:41:01 +0000 (09:41 +0200)]
media: atomisp: sh_css_param_dvs.h remove ISP version macros

As namespaces aren't duplicated here, just remove the ifdefs.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: unify sh_css_params_shading_id_table_generate()
Mauro Carvalho Chehab [Thu, 23 Apr 2020 07:37:27 +0000 (09:37 +0200)]
media: atomisp: unify sh_css_params_shading_id_table_generate()

Instead of packing parameters differently on ISP2400 and ISP2401,
use just one way of passing them for both.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove table duplication from dfs tables
Mauro Carvalho Chehab [Thu, 23 Apr 2020 07:29:54 +0000 (09:29 +0200)]
media: atomisp: remove table duplication from dfs tables

The way atomisp_dfs_tables.h is defined, it ends by duplicating
all data structs there on both atomisp_v4l2.c and atomisp_cmd.c.

Change the logic in order to place the definitions only on a single
place.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove ISP version macros from sh_css_legacy.h
Mauro Carvalho Chehab [Thu, 23 Apr 2020 07:29:45 +0000 (09:29 +0200)]
media: atomisp: remove ISP version macros from sh_css_legacy.h

This header is really version-independent. So, just get rid
of the macros from it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: make sh_css_sp_init_pipeline() ISP version independent
Mauro Carvalho Chehab [Thu, 23 Apr 2020 07:11:01 +0000 (09:11 +0200)]
media: atomisp: make sh_css_sp_init_pipeline() ISP version independent

This function call has two parameters that are used only with
ISP2401, enclosed on some ugly ifdefs. Make the function independent,
passing NULL values for ISP2400.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: make sh_css_struct.h independent of ISP version
Mauro Carvalho Chehab [Thu, 23 Apr 2020 06:38:49 +0000 (08:38 +0200)]
media: atomisp: make sh_css_struct.h independent of ISP version

Use the same struct for both ISP2400 and ISP2401.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: sh_css_defs.h: get rid of build time dependencies
Mauro Carvalho Chehab [Wed, 22 Apr 2020 13:17:30 +0000 (15:17 +0200)]
media: atomisp: sh_css_defs.h: get rid of build time dependencies

There are several #ifdefs checking for ISP version there. Some
of them are just two different ways to represent the same contants,
while 3 parameters are actually different, depending on the ISP
version.

Change the header in a way that it will be compatible with both
versions, and change dependent code to keep running, removing
ifdefs there only when possible.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_compat_ioctl32.c: be independent of ISP version
Mauro Carvalho Chehab [Wed, 22 Apr 2020 12:33:07 +0000 (14:33 +0200)]
media: atomisp: atomisp_compat_ioctl32.c: be independent of ISP version

There are two ioctls that are only available with ISP2401. Yet,
at the compat level, we don't really need to take care, as
the native ioctl handler will already return an error code if
the ioctl doesn't exist.

So, let's just remove the ifdefs here.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_compat_css20.c: detect ISP at runtime
Mauro Carvalho Chehab [Wed, 22 Apr 2020 12:28:47 +0000 (14:28 +0200)]
media: atomisp: atomisp_compat_css20.c: detect ISP at runtime

Remove ifdefs that check ISP version from the code, switching
to specific ISP-dependent code at runtime.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_csi2.c: remove useless ifdefs
Mauro Carvalho Chehab [Wed, 22 Apr 2020 12:20:14 +0000 (14:20 +0200)]
media: atomisp: atomisp_csi2.c: remove useless ifdefs

The ifdefs there are meaningless. Just remove them for good.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_subdev.c check ISP version on runtime
Mauro Carvalho Chehab [Wed, 22 Apr 2020 12:17:45 +0000 (14:17 +0200)]
media: atomisp: atomisp_subdev.c check ISP version on runtime

Remove ISP-version-dependent ifdefs.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_v4l2.c: set wdt timers according with ISP version
Mauro Carvalho Chehab [Wed, 22 Apr 2020 12:06:58 +0000 (14:06 +0200)]
media: atomisp: atomisp_v4l2.c: set wdt timers according with ISP version

Add a runtime check to use the proper wdt timer init at runtime,
depending on the chipset revision.

For now, we can't get rid of the remaining version checks, as
the rest of the code is not prepared yet to detect the ISP
version on runtime.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_ioctl.c: get rid of a ISP2400/ISP2401 dependency
Mauro Carvalho Chehab [Wed, 22 Apr 2020 11:49:34 +0000 (13:49 +0200)]
media: atomisp: atomisp_ioctl.c: get rid of a ISP2400/ISP2401 dependency

Replace #ifdef occurrences there with runtime checks.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: pci/atomisp2/*.h remove #ifdef ISP2401
Mauro Carvalho Chehab [Mon, 20 Apr 2020 10:33:51 +0000 (12:33 +0200)]
media: atomisp: pci/atomisp2/*.h remove #ifdef ISP2401

Those ifs can easily be removed without breaking the code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_dfs_tables.h: don't depend on ISP version
Mauro Carvalho Chehab [Mon, 20 Apr 2020 10:42:52 +0000 (12:42 +0200)]
media: atomisp: atomisp_dfs_tables.h: don't depend on ISP version

There's a dependency on this header for the ISP model. While
this sounds really weird (as just one resolution needs it),
as we don't know what's the right value, let's just keep it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: atomisp_cmd.c test ISP version in runtime
Mauro Carvalho Chehab [Mon, 20 Apr 2020 08:33:36 +0000 (10:33 +0200)]
media: atomisp: atomisp_cmd.c test ISP version in runtime

The logic there has lots of ifdef dependencies if the hardware
is either ISP2400 or ISP2041.

Replace them by runtime checks.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: add a way for the driver to know the chipset version
Mauro Carvalho Chehab [Mon, 20 Apr 2020 07:19:56 +0000 (09:19 +0200)]
media: atomisp: add a way for the driver to know the chipset version

The atomisp supports two different chipsets: ISP2400 and ISP2401.
Right now, this is controlled by ugly #defines inside the driver.

Add a global bolean to identify the type of hardware. While this
is hacky, it would be a quick way to start removing the ugly
ifdefs.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: simplify math_support.h
Mauro Carvalho Chehab [Sun, 19 Apr 2020 17:12:04 +0000 (19:12 +0200)]
media: atomisp: simplify math_support.h

There are some uneeded defines there. Simplify it, and make
it independent of defines.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove some dead code
Mauro Carvalho Chehab [Sun, 19 Apr 2020 16:27:51 +0000 (18:27 +0200)]
media: atomisp: remove some dead code

There are several parts of atomisp that are meant to be
built on different environments, tested using ifdefs.

Remove some of them, as this code should build only on
Linux.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: do lots of other coding style cleanups
Mauro Carvalho Chehab [Sun, 19 Apr 2020 15:51:29 +0000 (17:51 +0200)]
media: atomisp: do lots of other coding style cleanups

Use some auto-reformat tools to make the atomisp style
a little better. There are still lots of weird things there,
but this will hopefully reduce the number of pure coding
style patches submitted upstream.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: fix several coding style issues
Mauro Carvalho Chehab [Sun, 19 Apr 2020 14:06:45 +0000 (16:06 +0200)]
media: atomisp: fix several coding style issues

Use checkpatch.pl --fix-inplace --strict to solve several
coding style issues, manually reviewing the produced code and
fixing some troubles caused by checkpatch.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: fix several typos
Mauro Carvalho Chehab [Sun, 19 Apr 2020 12:38:57 +0000 (14:38 +0200)]
media: atomisp: fix several typos

Running checkpatch.pl codespell logic found several typos at atomisp
driver.

Fix them using --fix-inline.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: select IOSF_MBI dependency
Mauro Carvalho Chehab [Wed, 20 May 2020 10:30:23 +0000 (12:30 +0200)]
media: atomisp: select IOSF_MBI dependency

This driver needs IOSF_MBI in order to talk with some PM
registers. Select it at compile time.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: allow building the driver again
Mauro Carvalho Chehab [Sun, 19 Apr 2020 12:33:52 +0000 (14:33 +0200)]
media: atomisp: allow building the driver again

The atomisp driver builds again. So, remove depends on BROKEN.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: fix a broken compat32 code
Mauro Carvalho Chehab [Sun, 19 Apr 2020 12:02:03 +0000 (14:02 +0200)]
media: atomisp: fix a broken compat32 code

There's a typo at the compat32 code, with forgot to get the
pointer address, causing the driver to not build.

Not sure why this didn't produce an error back when the
driver got removed.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: use new ida API
Mauro Carvalho Chehab [Sun, 19 Apr 2020 12:28:10 +0000 (14:28 +0200)]
media: atomisp: use new ida API

The old ida API got replaced by a new one, with avoids
locking issues. As the old API was removed, start using the
new one, as defined by changeset b03f8e43c926 ("ida: Remove old API").

Fixes: b03f8e43c926 ("ida: Remove old API")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: use cpu_latency_qos_*() instead of pm_qos_update*()
Mauro Carvalho Chehab [Sun, 19 Apr 2020 11:17:14 +0000 (13:17 +0200)]
media: atomisp: use cpu_latency_qos_*() instead of pm_qos_update*()

Those functions got renamed. Update them on atomisp driver.

Fixes: 67b06ba01857 ("PM: QoS: Drop PM_QOS_CPU_DMA_LATENCY and rename related functions")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: Fix support for time 64 API
Mauro Carvalho Chehab [Sun, 19 Apr 2020 11:05:47 +0000 (13:05 +0200)]
media: atomisp: Fix support for time 64 API

The time 64 API patchset changed the ts stamp to u64.

Update this driver accordingly.

Fixes: 15a40b27beb0 ("media: videobuf: use u64 for the timestamp internally")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: replace VFL_TYPE_GRABBER by VFL_TYPE_VIDEO
Mauro Carvalho Chehab [Sun, 19 Apr 2020 10:49:32 +0000 (12:49 +0200)]
media: atomisp: replace VFL_TYPE_GRABBER by VFL_TYPE_VIDEO

This type was renamed in the past by a more meaningul
name. Change it on atomisp too.

Fixes: 238e4a5baa36 ("media: rename VFL_TYPE_GRABBER to _VIDEO")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: totalram_pages is now a function
Mauro Carvalho Chehab [Sun, 19 Apr 2020 10:46:57 +0000 (12:46 +0200)]
media: atomisp: totalram_pages is now a function

Fix the usage of totalram_pages, as this is now a function.

Fixes: ca79b0c211af ("mm: convert totalram_pages and totalhigh_pages variables to atomic")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: fix usage of access_ok() kAPI
Mauro Carvalho Chehab [Sun, 19 Apr 2020 10:43:55 +0000 (12:43 +0200)]
media: atomisp: fix usage of access_ok() kAPI

This macro had its first parameter lost. Remove it.

While on it, fix the alignments where this macro is used.

Fixes: 96d4f267e40f ("Remove 'type' argument from access_ok() function")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agoMAINTAINERS: adjust atomisp maintainership
Mauro Carvalho Chehab [Wed, 20 May 2020 09:26:17 +0000 (11:26 +0200)]
MAINTAINERS: adjust atomisp maintainership

From now on, I'll be maintaining the atomisp driver, and
Sakari will be reviewing it.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agoRevert "media: staging: atomisp: Remove driver"
Mauro Carvalho Chehab [Sun, 19 Apr 2020 10:18:13 +0000 (12:18 +0200)]
Revert "media: staging: atomisp: Remove driver"

There are some interest on having this driver back, and I
can probably dedicate some time to address its issue. So,
let's ressurect it.

For now, the driver causes a recursive error and doesn't
build, so, make it depend on BROKEN.

This reverts commit 51b8dc5163d2ff2bf04019f8bf7e3bd0e75bb654.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: imx219: Parse and register properties
Jacopo Mondi [Sat, 9 May 2020 09:04:55 +0000 (11:04 +0200)]
media: i2c: imx219: Parse and register properties

Parse device properties and register controls for them using the newly
introduced helpers.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov13858: Parse and register properties
Jacopo Mondi [Sat, 9 May 2020 09:04:54 +0000 (11:04 +0200)]
media: i2c: ov13858: Parse and register properties

Parse device properties and register controls for them using the newly
introduced helpers.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: i2c: ov5670: Parse and register properties
Jacopo Mondi [Sat, 9 May 2020 09:04:53 +0000 (11:04 +0200)]
media: i2c: ov5670: Parse and register properties

Parse device properties and register controls for them using the newly
introduced helpers.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrls: Add helper to register properties
Jacopo Mondi [Sat, 9 May 2020 09:04:52 +0000 (11:04 +0200)]
media: v4l2-ctrls: Add helper to register properties

Add an helper function to v4l2-ctrls to register controls associated
with a device property.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrls: Sort includes alphabetically
Jacopo Mondi [Sat, 9 May 2020 09:04:51 +0000 (11:04 +0200)]
media: v4l2-ctrls: Sort includes alphabetically

Before adding a new include directive, sort the existing ones in
alphabetical order.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: include: v4l2-ctrl: Sort forward declarations
Jacopo Mondi [Sat, 9 May 2020 09:04:50 +0000 (11:04 +0200)]
media: include: v4l2-ctrl: Sort forward declarations

Before adding a new forward declaration to the v4l2-ctrls.h header file,
sort the existing ones alphabetically.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-fwnode: Add helper to parse device properties
Jacopo Mondi [Sat, 9 May 2020 09:04:49 +0000 (11:04 +0200)]
media: v4l2-fwnode: Add helper to parse device properties

Add an helper function to parse common device properties in the same
way as v4l2_fwnode_endpoint_parse() parses common endpoint properties.

Parse the 'rotation' and 'orientation' properties from the firmware
interface.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrls: Add camera orientation and rotation
Jacopo Mondi [Sat, 9 May 2020 09:04:48 +0000 (11:04 +0200)]
media: v4l2-ctrls: Add camera orientation and rotation

Add support for the newly defined V4L2_CID_CAMERA_ORIENTATION
and V4L2_CID_CAMERA_SENSOR_ROTATION read-only controls used to report
the camera device mounting position and orientation respectively.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrl: Document V4L2_CID_CAMERA_SENSOR_ROTATION
Jacopo Mondi [Sat, 9 May 2020 09:04:47 +0000 (11:04 +0200)]
media: v4l2-ctrl: Document V4L2_CID_CAMERA_SENSOR_ROTATION

Add documentation for the V4L2_CID_CAMERA_SENSOR_ROTATION camera
control. The newly added read-only control reports the rotation
correction to be applied to images before displaying them to the user.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-ctrl: Document V4L2_CID_CAMERA_ORIENTATION
Jacopo Mondi [Sat, 9 May 2020 09:04:46 +0000 (11:04 +0200)]
media: v4l2-ctrl: Document V4L2_CID_CAMERA_ORIENTATION

Add documentation for the V4L2_CID_CAMERA_ORIENTATION camera
control. The newly added read-only control reports the camera device
orientation relative to the usage orientation of the system the camera
is installed on.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dt-bindings: video-interface: Replace 'rotation' description
Jacopo Mondi [Sat, 9 May 2020 09:04:45 +0000 (11:04 +0200)]
media: dt-bindings: video-interface: Replace 'rotation' description

Replace the 'rotation' property description by providing a definition
relative to the camera sensor pixel array coordinate system and the
captured scene.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: dt-bindings: video-interfaces: Document 'orientation' property
Jacopo Mondi [Sat, 9 May 2020 09:04:44 +0000 (11:04 +0200)]
media: dt-bindings: video-interfaces: Document 'orientation' property

Add the 'orientation' device property, used to specify the device mounting
position. The property is particularly meaningful for mobile devices
with a well defined usage orientation.

Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: TODO: Remove media link creation todos
Steve Longerbeam [Fri, 1 May 2020 17:15:56 +0000 (19:15 +0200)]
media: imx: TODO: Remove media link creation todos

Remove the TODO items regarding media link creation, these issues are
resolved by moving media link creation to individual entity bound
callbacks and the implementation of the get_fwnode_pad operation.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: silence a couple debug messages
Steve Longerbeam [Fri, 1 May 2020 17:15:55 +0000 (19:15 +0200)]
media: imx: silence a couple debug messages

Convert to dev_dbg the "subdev bound" and IPU-internal media-link
creation messages.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: Create missing links from CSI-2 receiver
Steve Longerbeam [Fri, 1 May 2020 17:15:54 +0000 (19:15 +0200)]
media: imx: Create missing links from CSI-2 receiver

The entities external to the i.MX6 IPU and i.MX7 now create the links
to their fwnode-endpoint connected entities in their notifier bound
callbacks. Which means imx_media_create_of_links() and
imx_media_create_csi_of_links() are no longer needed and are removed.

However there is still one case in which imx-media needs to create
fwnode-endpoint based links at probe completion. The v4l2-async framework
does not allow multiple subdevice notifiers to contain a duplicate
subdevice in their asd_list. Only the first subdev notifier that discovers
and adds that one subdevice to its asd_list will receive a bound callback
for it. Other subdevices that also have firmware endpoint connections to
this duplicate subdevice will not have it in their asd_list, and thus will
never receive a bound callback for it. In the case of imx-media, the one
duplicate subdevice in question is the i.MX6 MIPI CSI-2 receiver.

Until there is a solution to that problem, rewrite imx_media_create_links()
to add the missing links from the CSI-2 receiver to the CSIs and CSI muxes.
The function is renamed imx_media_create_csi2_links().

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: csi: Lookup upstream endpoint with imx_media_get_pad_fwnode
Steve Longerbeam [Fri, 1 May 2020 17:15:53 +0000 (19:15 +0200)]
media: imx: csi: Lookup upstream endpoint with imx_media_get_pad_fwnode

Fix the 1:1 port-id:pad-index assumption for the upstream subdevice, by
searching the upstream subdevice's endpoints for one that maps to the
pad's index. This is carried out by a new reverse mapping function
imx_media_get_pad_fwnode().

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx5/6/7: csi: Mark a bound video mux as a CSI mux
Steve Longerbeam [Fri, 1 May 2020 17:15:52 +0000 (19:15 +0200)]
media: imx5/6/7: csi: Mark a bound video mux as a CSI mux

For i.MX5/6, if the bound subdev is a video mux, it must be one of the
CSI muxes, and for i.MX7, the bound subdev must always be a CSI mux.

So if the bound subdev is a video mux, mark it as a CSI mux with a new
group id IMX_MEDIA_GRP_ID_CSI_MUX.

In the process use the new group id in csi_get_upstream_endpoint(), and
do some cleanup in that function for better readability.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx7: csi: Remove imx7_csi_get_upstream_endpoint()
Steve Longerbeam [Fri, 1 May 2020 17:15:51 +0000 (19:15 +0200)]
media: imx7: csi: Remove imx7_csi_get_upstream_endpoint()

The function imx7_csi_get_upstream_endpoint() is not necessary for
imx7. First, the imx7 CSI only receives from the CSI mux, so much of
the code in there is pointless. Second, it is only used to determine
whether the CSI mux has selected the CSI-2 input or the parallel input.
This can be accomplished much more simply by getting the function type
of selected input entity to the CSI mux.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: csi: Create media links in bound notifier
Steve Longerbeam [Fri, 1 May 2020 17:15:50 +0000 (19:15 +0200)]
media: imx: csi: Create media links in bound notifier

Implement a notifier bound op to register media links from the remote
sub-device's source pad(s) to the CSI sink pad.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx7: csi: Create media links in bound notifier
Steve Longerbeam [Fri, 1 May 2020 17:15:49 +0000 (19:15 +0200)]
media: imx7: csi: Create media links in bound notifier

Implement a notifier bound op to register media links from the remote
sub-device's source pad(s) to the CSI sink pad.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx7: mipi csis: Create media links in bound notifier
Steve Longerbeam [Fri, 1 May 2020 17:15:48 +0000 (19:15 +0200)]
media: imx7: mipi csis: Create media links in bound notifier

Implement a notifier bound op to register media links from the remote
sub-device's source pad(s) to the mipi csi-2 receiver sink pad.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: mipi csi-2: Create media links in bound notifier
Steve Longerbeam [Fri, 1 May 2020 17:15:47 +0000 (19:15 +0200)]
media: imx: mipi csi-2: Create media links in bound notifier

Implement a notifier bound op to register media links from the remote
sub-device's source pad(s) to the mipi csi-2 receiver sink pad.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: video-mux: Create media links in bound notifier
Steve Longerbeam [Fri, 1 May 2020 17:15:46 +0000 (19:15 +0200)]
media: video-mux: Create media links in bound notifier

Implement a notifier bound op to register media links from the remote
sub-device's source pad(s) to the video-mux sink pad(s).

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: imx7-media-csi: Implement get_fwnode_pad op
Steve Longerbeam [Fri, 1 May 2020 17:15:45 +0000 (19:15 +0200)]
media: imx: imx7-media-csi: Implement get_fwnode_pad op

Use v4l2_subdev_get_fwnode_pad_1_to_1() as the get_fwnode_pad operation.
The i.MX7 CSI maps port numbers and pad indexes 1:1.

Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: imx7-mipi-csis: Implement get_fwnode_pad op
Steve Longerbeam [Fri, 1 May 2020 17:15:44 +0000 (19:15 +0200)]
media: imx: imx7-mipi-csis: Implement get_fwnode_pad op

Use v4l2_subdev_get_fwnode_pad_1_to_1() as the get_fwnode_pad operation.
The imx7-mipi-csis maps port numbers and pad indexes 1:1.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Acked-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: mipi csi-2: Implement get_fwnode_pad op
Steve Longerbeam [Fri, 1 May 2020 17:15:43 +0000 (19:15 +0200)]
media: imx: mipi csi-2: Implement get_fwnode_pad op

Use v4l2_subdev_get_fwnode_pad_1_to_1() as the get_fwnode_pad operation.
The MIPI CSI-2 receiver maps port numbers and pad indexes 1:1.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: video-mux: Implement get_fwnode_pad op
Steve Longerbeam [Fri, 1 May 2020 17:15:42 +0000 (19:15 +0200)]
media: video-mux: Implement get_fwnode_pad op

Use v4l2_subdev_get_fwnode_pad_1_to_1() as the get_fwnode_pad operation.
The video mux maps fwnode port numbers and pad indexes 1:1.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: csi: Implement get_fwnode_pad op
Steve Longerbeam [Fri, 1 May 2020 17:15:41 +0000 (19:15 +0200)]
media: imx: csi: Implement get_fwnode_pad op

The CSI does not have a 1:1 relationship between fwnode port numbers and
pad indexes. In fact the CSI fwnode device is itself a port which is the
sink, containing only a single fwnode endpoint. Implement media_entity
operation get_fwnode_pad to first verify the given endpoint is the CSI's
sink endpoint, and if so return the CSI sink pad index.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: Revert "media: v4l2-fwnode: Add a convenience function for registering subdevs...
Steve Longerbeam [Fri, 1 May 2020 17:15:40 +0000 (19:15 +0200)]
media: Revert "media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers"

The users of v4l2_async_register_fwnode_subdev() have switched to
parsing their endpoints and setting up async sub-device lists in their
notifiers locally, without using the endpoint parsing callbacks. There
are no more users of v4l2_async_register_fwnode_subdev() so this
convenience function can be removed.

This reverts commit 1634f0eded87d1f150e823fa56cd782ea0775eb2.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: imx: Parse information from firmware without using callbacks
Steve Longerbeam [Fri, 1 May 2020 17:15:39 +0000 (19:15 +0200)]
media: imx: Parse information from firmware without using callbacks

Instead of using the convenience functions
v4l2_async_notifier_parse_fwnode_endpoints*() or
v4l2_async_register_fwnode_subdev(), parse the input endpoints
and set up the async sub-devices without using callbacks. The drivers
know which ports it must parse and how to handle unconnected remotes,
so it makes the code simpler to transfer control of endpoint parsing
to the driver.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: video-mux: Parse information from firmware without using callbacks
Steve Longerbeam [Fri, 1 May 2020 17:15:38 +0000 (19:15 +0200)]
media: video-mux: Parse information from firmware without using callbacks

Instead of using the convenience function
v4l2_async_register_fwnode_subdev(), parse the video-mux input endpoints
and set up the async sub-devices without using callbacks. The video-mux
knows which ports it must parse (the input ports) and how to handle
unconnected remotes, so it makes the code simpler to transfer control
of endpoint parsing to the driver.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: v4l2-mc: add v4l2_create_fwnode_links helpers
Steve Longerbeam [Fri, 1 May 2020 17:15:37 +0000 (19:15 +0200)]
media: v4l2-mc: add v4l2_create_fwnode_links helpers

Add functions to create media links between source and sink subdevices,
based on the fwnode endpoint connections between them:

v4l2_create_fwnode_links_to_pad() - create links from a source subdev to
                                    a single sink pad based on fwnode
                                    endpoint connections.

v4l2_create_fwnode_links() - create all links from a source to sink subdev
                             based on fwnode endpoint connections.

These functions can be used in a sink's v4l2-async notifier subdev
bound callback to make the links from the bound subdev.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>