Right now, the driver supports just one VCM and just one
flash device. Warn if more than one such devices were
probed.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This driver is really on bad shape. One of the problems
is that, as soon as the I2C transfers start to happen, it
timeouts detecting a camera:
ov2680 i2c-OVTI2680:00: ov2680_probe: ACPI detected it on bus ID=CAM1, HID=OVTI2680
atomisp-isp2 0000:00:03.0: no camera attached or fail to detect
ov2680 i2c-OVTI2680:00: gmin: initializing atomisp module subdev data using PMIC regulator
...
The right fix here would be to use defer probe, but driver is
still on too bad shape.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
While the current code is hardcoded to just one specific
type of PMIC, it can support several types. Those should
be board-dependent. Instead of just printing a number,
change the message to display what type of PMIC control
is used at runtime.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
There are several device-specific data that are obtained
either via DMI or EFI, with changes the driver's behavior.
Display what has been detected, as such info may help
identifying troubles at the driver.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
When someone would report problems with a new device, we
need to know the DMI product ID and the ACPI name for the
detected sensor. So, print them at dmesg.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This driver still has lots of issues. Let's enable debug
there inconditionally, as we need more information in order
to address the pending issues.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This setting is used only for one of te Merryfield PCI IDs.
As this is an ISP2400, we can just get rid of a version
test, writing the right value directly inside the struct.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The atomisp probe error logic is incomplete. Add the missing
bits to return the PCI device to its original state.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As getting the exact version used by the driver is not easy,
let's relax the version detection and hope for the best,
producing just a warning.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
- Remove useless check if !dev at the probe function: if
such function is called, the device is defined.
- Cleanup the PCI ID table using macros.
- Use the same macros at the version-dependent part of the
atomisp_v4l2.c file;
- Add print messages to help understand what model the
driver detect;
- If device is not valid, better explain why.
Signed-off-by: Mauro Carvalho Chehehab <mchehab+huawei@kernel.org>
changeset d5426f4c2e ("media: staging: atomisp: use clock framework for camera clocks")
removed a platform-specific code to set the clock rate, in favor of
using the Kernel clock framework.
However, instead of passing the frequency for clk_set_rate(),
it is passing either 0 or 1.
Looking at the original patchset, it seems that there are two
possible configurations for the ISP:
0 - it will use a 25 MHz XTAL to provide the clock;
1 - it will use a PLL with is set to 19.2 MHz
(only for the CHT version?)
Eventually, different XTALs and/or PLL frequencies might
be possible some day, so, re-implent the logic for it to be
more generic.
Fixes: d5426f4c2e ("media: staging: atomisp: use clock framework for camera clocks")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The printed message when a firmware version is wrong says nothing
usefull:
atomisp-isp2 0000:00:03.0: Fw version check failed.
atomisp-isp2: probe of 0000:00:03.0 failed with error -22
Print the expected and the received firmware version instead.
In order to do that, the firmware functions will need at least
a struct device pointer, so pass it.
While writing this patch, it was noticed that some of the
abstraction layers of this driver have functions that are never
called, but use this interface. Get rid of them.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
As the atomisp driver should already be handling the ISP
PCI ID, there's no sense on keeping the dummy driver enabled
in tis case.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
With the changes, this function is now undefined if built
for ISP2400. So, move its implementation to the file which
calls it.
Reported-by: Francescodario Cuzzocrea <francescodario.cuzzocrea@mail.polimi.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Some recent changes at V4L2 core changed the way querycap is handled.
Due to that, this warning is generated:
WARNING: CPU: 1 PID: 503 at drivers/media/v4l2-core/v4l2-dev.c:885 __video_register_device+0x93e/0x1120 [videodev]
as introduced by this commit:
commit 3c1350501c
Author: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Date: Tue Jul 23 04:21:25 2019 -0400
media: v4l2-dev/ioctl: require non-zero device_caps, verify sane querycap results
Now that all V4L2 drivers set device_caps in struct video_device, we can add
a check for this to ensure all future drivers fill this in.
The fix is simple: we just need to initialize dev_caps before
registering the V4L2 dev.
While here, solve other problems at VIDIOC_QUERYCAP ioctl.
Reported-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
There are currently two identical copies of some files, one
at css_2401_csi2p_system/ and another one at css_2401_system/.
Get rid of one of them, moving the remaining files to the
directory with the shortest name.
While here, do more renames, in order to get smaller path
names.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
The Asus Transformer T101HA comes with a newer hardware
version. Add support to load firmware for it.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>