]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
4 years agomedia: atomisp: fix a slab error due to a wrong free
Mauro Carvalho Chehab [Wed, 13 May 2020 09:31:20 +0000 (11:31 +0200)]
media: atomisp: fix a slab error due to a wrong free

The mmu mapping logic uses a different logic depending on the
RAM size: if it is lower than 2GB, it uses kmem_cache_zalloc(),
but if memory is bigger than that, it uses its own way to
allocate memory.

Yet, when freeing, it uses kmem_cache_free() for any cases.

On recent Kernels, slab tracks the memory allocated on it,
with causes those warnings:

 virt_to_cache: Object is not a Slab page!
 WARNING: CPU: 0 PID: 758 at mm/slab.h:475 cache_from_obj+0xab/0xf0
 Modules linked in: snd_soc_sst_cht_bsw_rt5645(E) mei_hdcp(E) gpio_keys(E) intel_rapl_msr(E) intel_powerclamp(E) coretemp(E) kvm_intel(E) kvm(E) irqbypass(E) crct10dif_pclmul(E) crc32_pclmul(E) ghash_clmulni_intel(E) atomisp_ov2680(CE) intel_cstate(E) asus_nb_wmi(E) wdat_wdt(E) pcspkr(E) ath10k_pci(E) ath10k_core(E) intel_chtdc_ti_pwrbtn(E) ath(E) mac80211(E) btusb(E) joydev(E) btrtl(E) btbcm(E) btintel(E) bluetooth(E) libarc4(E) ecdh_generic(E) cfg80211(E) ecc(E) hid_sensor_gyro_3d(E) hid_sensor_accel_3d(E) hid_sensor_trigger(E) hid_sensor_iio_common(E) industrialio_triggered_buffer(E) kfifo_buf(E) industrialio(E) atomisp(CE) videobuf_vmalloc(E) videobuf_core(E) videodev(E) mc(E) snd_soc_rt5645(E) snd_soc_rl6231(E) snd_intel_sst_acpi(E) snd_intel_sst_core(E) snd_soc_sst_atom_hifi2_platform(E) snd_soc_acpi_intel_match(E) intel_hid(E) spi_pxa2xx_platform(E) snd_soc_acpi(E) snd_soc_core(E) snd_compress(E) dw_dmac(E) intel_xhci_usb_role_switch(E) int3406_thermal(E)
  snd_hdmi_lpe_audio(E) int3403_thermal(E) int3400_thermal(E) acpi_thermal_rel(E) snd_seq(E) intel_int0002_vgpio(E) soc_button_array(E) snd_seq_device(E) acpi_pad(E) snd_pcm(E) snd_timer(E) snd(E) soundcore(E) lpc_ich(E) mei_txe(E) mei(E) processor_thermal_device(E) intel_soc_dts_iosf(E) intel_rapl_common(E) int340x_thermal_zone(E) ip_tables(E) hid_sensor_hub(E) intel_ishtp_loader(E) intel_ishtp_hid(E) mmc_block(E) hid_multitouch(E) crc32c_intel(E) i915(E) i2c_algo_bit(E) drm_kms_helper(E) hid_asus(E) asus_wmi(E) sparse_keymap(E) rfkill(E) drm(E) intel_ish_ipc(E) intel_ishtp(E) wmi(E) video(E) i2c_hid(E) sdhci_acpi(E) sdhci(E) mmc_core(E) pwm_lpss_platform(E) pwm_lpss(E) fuse(E)
 CPU: 0 PID: 758 Comm: v4l_id Tainted: G         C  E     5.7.0-rc2+ #40
 Hardware name: ASUSTeK COMPUTER INC. T101HA/T101HA, BIOS T101HA.306 04/23/2019
 RIP: 0010:cache_from_obj+0xab/0xf0
 Code: c3 31 c0 80 3d 1c 38 72 01 00 75 f0 48 c7 c6 20 12 06 b5 48 c7 c7 10 f3 37 b5 48 89 04 24 c6 05 01 38 72 01 01 e8 2c 99 e0 ff <0f> 0b 48 8b 04 24 eb ca 48 8b 57 58 48 8b 48 58 48 c7 c6 30 12 06
 RSP: 0018:ffffb0a4c07cfb10 EFLAGS: 00010282
 RAX: 0000000000000029 RBX: 0000000000000048 RCX: 0000000000000000
 RDX: ffffa004fbca5b80 RSI: ffffa004fbc19cc8 RDI: ffffa004fbc19cc8
 RBP: 0000000000c49000 R08: 00000000000004f7 R09: 0000000000000001
 R10: 0000000000aaaaaa R11: ffffffffb50e0600 R12: ffffffffc0be0a00
 R13: ffffa003f2448000 R14: 0000000000c49000 R15: ffffa003f2448000
 FS:  00007f9060c9cb80(0000) GS:ffffa004fbc00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 0000559fc55b8000 CR3: 0000000165b02000 CR4: 00000000001006f0
 Call Trace:
  kmem_cache_free+0x19/0x180
  mmu_l2_unmap+0xd1/0x100 [atomisp]
  mmu_unmap+0xd0/0xf0 [atomisp]
  hmm_bo_unbind+0x62/0xb0 [atomisp]
  hmm_free+0x44/0x60 [atomisp]
  ia_css_spctrl_unload_fw+0x30/0x50 [atomisp]
  ia_css_uninit+0x3a/0x90 [atomisp]
  atomisp_open+0x50b/0x5c0 [atomisp]
  v4l2_open+0x85/0xf0 [videodev]
  chrdev_open+0xdd/0x210
  ? cdev_device_add+0xc0/0xc0
  do_dentry_open+0x13a/0x380
  path_openat+0xa9a/0xfe0
  do_filp_open+0x75/0x100
  ? __check_object_size+0x12e/0x13c
  ? __alloc_fd+0x44/0x150
  do_sys_openat2+0x8a/0x130
  __x64_sys_openat+0x46/0x70
  do_syscall_64+0x5b/0xf0
  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Solve it by calling free_page() directly

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of __bo_alloc() macro
Mauro Carvalho Chehab [Wed, 13 May 2020 09:29:21 +0000 (11:29 +0200)]
media: atomisp: get rid of __bo_alloc() macro

Simplify the hmm_bo a little bit by removing this
macro. This will avoid printing twice errors when
allocations happen.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: get rid of spmem_dump.c
Mauro Carvalho Chehab [Tue, 12 May 2020 21:02:58 +0000 (23:02 +0200)]
media: atomisp: get rid of spmem_dump.c

Those files seem to be firmware-dependent, probably being used
by some debug interface.

Well, their contents are not really used by atomisp, so let's
just send them to the trash can, as it shouldn't have any
usage upstream.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: fix an inverted logic
Mauro Carvalho Chehab [Tue, 12 May 2020 18:32:51 +0000 (20:32 +0200)]
media: atomisp: fix an inverted logic

When changing the IFs to select isp2401 at runtime, one of
the conditions ended by being written wrong.

Code double-checked on both Yocto Aero's driver version and
against the previous code.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove a misplaced #endif
Mauro Carvalho Chehab [Wed, 13 May 2020 06:04:18 +0000 (08:04 +0200)]
media: atomisp: remove a misplaced #endif

There is an endif in the middle of a comment at
ia_css_xnr3.host.c. Remove it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: simplify the power down/up code
Mauro Carvalho Chehab [Tue, 12 May 2020 13:13:50 +0000 (15:13 +0200)]
media: atomisp: simplify the power down/up code

Use the version from intel_atomisp2_pm.c for power up/down,
removing some code duplication and using just one kAPI call
for modifying the ISPSSPM0 register.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: use pcim_enable_device() again
Mauro Carvalho Chehab [Tue, 12 May 2020 12:07:19 +0000 (14:07 +0200)]
media: atomisp: use pcim_enable_device() again

Changing to pci_enable_device() didn't produce the expected
result. It could also eventually led to problems when driver
is removed, due to object lifetime issues. So, let's just
return to the previous behavior.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: spctrl: be sure to zero .code_addr after free
Mauro Carvalho Chehab [Tue, 12 May 2020 10:45:40 +0000 (12:45 +0200)]
media: atomisp: spctrl: be sure to zero .code_addr after free

We need that to avoid trying to double-free the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: add support for different PMIC configurations
Mauro Carvalho Chehab [Mon, 11 May 2020 12:07:26 +0000 (14:07 +0200)]
media: atomisp: add support for different PMIC configurations

This patch required lots of research and work. The existing
atomisp driver at staging assumed that all Intel PMIC would
be using regulators, but upstream didn't follow it. Instead,
the intel_pmic.c driver added a hack, instead of using i2c_transfer,
it writes I2C values directly via regmapped registers.

Oh, well... At least, it provided a common API for doing that.

The PMIC settings used here came from the driver at the
yocto Aero distribution:

https://download.01.org/aero/deb/pool/main/l/linux-4.4.76-aero-1.3/

The logic itself was re-written, in order to use the I2C address
detected by the probing part.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: move atomisp_gmin_platform.c to pci/ dir
Mauro Carvalho Chehab [Mon, 11 May 2020 09:47:25 +0000 (11:47 +0200)]
media: atomisp: move atomisp_gmin_platform.c to pci/ dir

The atomisp_gmin_platform.c is not a platform driver anymore,
but it is, instead, part of the atomisp driver.

Move it to be together with the driver. As a bonus, as the
atomisp i2c drivers depends on its contents, probing them
should load automatically the atomisp core. This should
likely avoid some possible race conditions.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: detect the PMIC type
Mauro Carvalho Chehab [Sun, 10 May 2020 20:04:37 +0000 (22:04 +0200)]
media: atomisp: detect the PMIC type

Sub-device's power management can be provided via different ways.

Instead of hardcoding it, add a code that would be detecting it.

This uses a code similar to what's found at the atomisp driver
inside the Intel Aero repository:

https://github.com/intel-aero/meta-intel-aero.git

(driver was removed on some commit, but it can be found on
git history).

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: warn if unsupported subdevs are found
Mauro Carvalho Chehab [Sun, 10 May 2020 15:23:03 +0000 (17:23 +0200)]
media: atomisp: warn if unsupported subdevs are found

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>
4 years agomedia: atomisp: reduce the risk of a race condition
Mauro Carvalho Chehab [Sun, 10 May 2020 14:06:53 +0000 (16:06 +0200)]
media: atomisp: reduce the risk of a race condition

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>
4 years agomedia: atomisp: print the type of PMIC that will be used
Mauro Carvalho Chehab [Sun, 10 May 2020 13:49:41 +0000 (15:49 +0200)]
media: atomisp: print the type of PMIC that will be used

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>
4 years agomedia: atomisp: better display DMI and EFI found entries
Mauro Carvalho Chehab [Sun, 10 May 2020 11:39:18 +0000 (13:39 +0200)]
media: atomisp: better display DMI and EFI found entries

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>
4 years agomedia: atomisp: Add some ACPI detection info
Mauro Carvalho Chehab [Sun, 10 May 2020 08:29:57 +0000 (10:29 +0200)]
media: atomisp: Add some ACPI detection info

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>
4 years agomedia: atomisp: add -dDEBUG when building this driver
Mauro Carvalho Chehab [Sat, 9 May 2020 07:59:54 +0000 (09:59 +0200)]
media: atomisp: add -dDEBUG when building this driver

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>
4 years agomedia: atomisp: make dfs_config_merr_117a struct const
Mauro Carvalho Chehab [Sat, 9 May 2020 07:48:37 +0000 (09:48 +0200)]
media: atomisp: make dfs_config_merr_117a struct const

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>
4 years agomedia: atomisp: free PCI resources when probing fail
Mauro Carvalho Chehab [Fri, 8 May 2020 09:27:39 +0000 (11:27 +0200)]
media: atomisp: free PCI resources when probing fail

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>
4 years agomedia: atomisp: relax firmware version detection criteria
Mauro Carvalho Chehab [Fri, 8 May 2020 10:38:37 +0000 (12:38 +0200)]
media: atomisp: relax firmware version detection criteria

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>
4 years agomedia: atomisp: improve device detection code
Mauro Carvalho Chehab [Fri, 8 May 2020 09:27:02 +0000 (11:27 +0200)]
media: atomisp: improve device detection code

- 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>
4 years agomedia: atomisp: fix clock rate frequency setting
Mauro Carvalho Chehab [Fri, 8 May 2020 06:55:19 +0000 (08:55 +0200)]
media: atomisp: fix clock rate frequency setting

changeset d5426f4c2eba ("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: d5426f4c2eba ("media: staging: atomisp: use clock framework for camera clocks")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: limit the name of the firmware file
Mauro Carvalho Chehab [Thu, 7 May 2020 18:05:38 +0000 (20:05 +0200)]
media: atomisp: limit the name of the firmware file

The firmware header has 64 bytes. Properly limit it to such
size.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: print a better message when fw version is wrong
Mauro Carvalho Chehab [Thu, 7 May 2020 16:33:29 +0000 (18:33 +0200)]
media: atomisp: print a better message when fw version is wrong

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>
4 years agomedia: atomisp: disable the dummy PM driver is atomisp driver is built
Mauro Carvalho Chehab [Thu, 7 May 2020 14:19:59 +0000 (10:19 -0400)]
media: atomisp: disable the dummy PM driver is atomisp driver is built

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>
4 years agomedia: atomisp: move ia_css_configure_sc() implementation
Mauro Carvalho Chehab [Sun, 3 May 2020 15:02:51 +0000 (17:02 +0200)]
media: atomisp: move ia_css_configure_sc() implementation

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>
4 years agomedia: atomisp: fix querycap initialization logic
Mauro Carvalho Chehab [Sat, 2 May 2020 16:15:48 +0000 (18:15 +0200)]
media: atomisp: fix querycap initialization logic

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 3c1350501c21db8e3b1a38d9e97db29694305c3b
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>
4 years agomedia: atomisp: use add_qos_request instead of update
Mauro Carvalho Chehab [Fri, 1 May 2020 20:50:36 +0000 (22:50 +0200)]
media: atomisp: use add_qos_request instead of update

It doesn't make senst to update a request that was not
created. So, instead of using cpu_latency_qos_update_request(),
let's use, instead cpu_latency_qos_add_request() at device
probing code.

This should fix this issue:

[    9.691775] cpu_latency_qos_update_request called for unknown object
[    9.695279] WARNING: CPU: 3 PID: 523 at kernel/power/qos.c:296 cpu_latency_qos_update_request+0x3a/0xb0
[    9.698826] Modules linked in: snd_soc_acpi_intel_match snd_rawmidi snd_soc_acpi snd_soc_rl6231 snd_soc_core ath mac80211 snd_compress snd_hdmi_lpe_audio ac97_bus hid_sensor_accel_3d snd_pcm_dmaengine hid_sensor_gyro_3d hid_sensor_trigger industrialio_triggered_buffer kfifo_buf hid_sensor_iio_common processor_thermal_device industrialio cfg80211 snd_pcm snd_seq intel_rapl_common atomisp(C+) libarc4 intel_soc_dts_iosf cros_ec_ishtp intel_xhci_usb_role_switch mei_txe cros_ec videobuf_vmalloc mei roles atomisp_ov2680(C) videobuf_core snd_seq_device snd_timer spi_pxa2xx_platform videodev snd mc dw_dmac intel_hid dw_dmac_core 8250_dw soundcore int3406_thermal int3400_thermal intel_int0002_vgpio acpi_pad acpi_thermal_rel soc_button_array int3403_thermal int340x_thermal_zone mac_hid sch_fq_codel parport_pc ppdev lp parport ip_tables x_tables autofs4 hid_sensor_custom hid_sensor_hub intel_ishtp_loader intel_ishtp_hid crct10dif_pclmul crc32_pclmul ghash_clmulni_intel i915 mmc_block i2c_algo_bit
[    9.698885]  aesni_intel crypto_simd drm_kms_helper cryptd syscopyarea sysfillrect glue_helper sysimgblt fb_sys_fops cec intel_ish_ipc drm lpc_ich intel_ishtp hid_asus intel_soc_pmic_chtdc_ti asus_wmi i2c_hid sparse_keymap sdhci_acpi wmi video sdhci hid_generic usbhid hid
[    9.736699] CPU: 3 PID: 523 Comm: systemd-udevd Tainted: G         C        5.7.0-rc1+ #2
[    9.741309] Hardware name: ASUSTeK COMPUTER INC. T101HA/T101HA, BIOS T101HA.305 01/24/2018
[    9.745962] RIP: 0010:cpu_latency_qos_update_request+0x3a/0xb0
[    9.750615] Code: 89 e5 41 55 41 54 41 89 f4 53 48 89 fb 48 81 7f 28 e0 7f c6 9e 74 1c 48 c7 c6 60 f3 65 9e 48 c7 c7 e8 a9 99 9e e8 b2 a6 f9 ff <0f> 0b 5b 41 5c 41 5d 5d c3 0f 1f 44 00 00 44 3b 23 74 ef 44 89 e2
[    9.760065] RSP: 0018:ffffa865404f39c0 EFLAGS: 00010282
[    9.764734] RAX: 0000000000000000 RBX: ffff9d2aefc84350 RCX: 0000000000000000
[    9.769435] RDX: ffff9d2afbfa97c0 RSI: ffff9d2afbf99808 RDI: ffff9d2afbf99808
[    9.774125] RBP: ffffa865404f39d8 R08: 0000000000000304 R09: 0000000000aaaaaa
[    9.778804] R10: 0000000000000000 R11: 0000000000000001 R12: 00000000ffffffff
[    9.783491] R13: ffff9d2afb4640b0 R14: ffffffffc07ecf20 R15: 0000000091000000
[    9.788187] FS:  00007efe67ff8880(0000) GS:ffff9d2afbf80000(0000) knlGS:0000000000000000
[    9.792864] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    9.797482] CR2: 00007ffc6424bdc8 CR3: 0000000178998000 CR4: 00000000001006e0
[    9.802126] Call Trace:
[    9.806775]  atomisp_pci_probe.cold.19+0x15f/0x116f [atomisp]
[    9.811441]  local_pci_probe+0x47/0x80
[    9.816085]  pci_device_probe+0xff/0x1b0
[    9.820706]  really_probe+0x1c8/0x3e0
[    9.825247]  driver_probe_device+0xd9/0x120
[    9.829769]  device_driver_attach+0x58/0x60
[    9.834294]  __driver_attach+0x8f/0x150
[    9.838782]  ? device_driver_attach+0x60/0x60
[    9.843205]  ? device_driver_attach+0x60/0x60
[    9.847634]  bus_for_each_dev+0x79/0xc0
[    9.852033]  ? kmem_cache_alloc_trace+0x167/0x230
[    9.856462]  driver_attach+0x1e/0x20

Reported-by: Patrik Gfeller <patrik.gfeller@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
4 years agomedia: atomisp: remove some file duplication and do more dir renames
Mauro Carvalho Chehab [Fri, 1 May 2020 12:17:21 +0000 (14:17 +0200)]
media: atomisp: remove some file duplication and do more dir renames

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>
4 years agomedia: atomisp: add firmware load code for ISP2401 rev B0
Mauro Carvalho Chehab [Fri, 1 May 2020 09:17:06 +0000 (11:17 +0200)]
media: atomisp: add firmware load code for ISP2401 rev B0

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>
4 years agomedia: atomisp: get rid of most checks for ISP2401 version
Mauro Carvalho Chehab [Thu, 30 Apr 2020 11:56:47 +0000 (13:56 +0200)]
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>
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>