Skip to content

Commit ac911b3

Browse files
committed
Merge tag 'media/v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull more media updates from Mauro Carvalho Chehab: - a set of atomisp patches. They remove several abstraction layers, and fixes clang and gcc warnings (that were hidden via some macros that were disabling 4 or 5 types of warnings there). There are also some important fixes and sensor auto-detection on newer BIOSes via ACPI _DCM tables. - some fixes * tag 'media/v5.8-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (95 commits) media: rkvdec: Fix H264 scaling list order media: v4l2-ctrls: Unset correct HEVC loop filter flag media: videobuf2-dma-contig: fix bad kfree in vb2_dma_contig_clear_max_seg_size media: v4l2-subdev.rst: correct information about v4l2 events media: s5p-mfc: Properly handle dma_parms for the allocated devices media: medium: cec: Make MEDIA_CEC_SUPPORT default to n if !MEDIA_SUPPORT media: cedrus: Implement runtime PM media: cedrus: Program output format during each run media: atomisp: improve ACPI/DMI detection logs media: Revert "media: atomisp: add Asus Transform T101HA ACPI vars" media: Revert "media: atomisp: Add some ACPI detection info" media: atomisp: improve sensor detection code to use _DSM table media: atomisp: get rid of an iomem abstraction layer media: atomisp: get rid of a string_support.h abstraction layer media: atomisp: use strscpy() instead of less secure variants media: atomisp: set DFS to MAX if sensor doesn't report fps media: atomisp: use different dfs failed messages media: atomisp: change the detection of ISP2401 at runtime media: atomisp: use macros from intel-family.h media: atomisp: don't set hpll_freq twice with different values ...
2 parents d74b15d + 2630e1b commit ac911b3

File tree

680 files changed

+5144
-6804
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

680 files changed

+5144
-6804
lines changed

Documentation/driver-api/media/v4l2-subdev.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,7 @@ The device node handles a subset of the V4L2 API.
319319
events can also be reported by one (or several) V4L2 device nodes.
320320

321321
Sub-device drivers that want to use events need to set the
322-
``V4L2_SUBDEV_USES_EVENTS`` :c:type:`v4l2_subdev`.flags and initialize
323-
:c:type:`v4l2_subdev`.nevents to events queue depth before registering
322+
``V4L2_SUBDEV_FL_HAS_EVENTS`` :c:type:`v4l2_subdev`.flags before registering
324323
the sub-device. After registration events can be queued as usual on the
325324
:c:type:`v4l2_subdev`.devnode device node.
326325

drivers/media/cec/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ config CEC_PIN_ERROR_INJ
2424
menuconfig MEDIA_CEC_SUPPORT
2525
bool
2626
prompt "HDMI CEC drivers"
27-
default y if !MEDIA_SUPPORT_FILTER
27+
default y if MEDIA_SUPPORT && !MEDIA_SUPPORT_FILTER
2828
help
2929
Enable support for HDMI CEC (Consumer Electronics Control),
3030
which is an optional HDMI feature.

drivers/media/common/videobuf2/videobuf2-dma-contig.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -726,9 +726,8 @@ EXPORT_SYMBOL_GPL(vb2_dma_contig_memops);
726726
int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size)
727727
{
728728
if (!dev->dma_parms) {
729-
dev->dma_parms = kzalloc(sizeof(*dev->dma_parms), GFP_KERNEL);
730-
if (!dev->dma_parms)
731-
return -ENOMEM;
729+
dev_err(dev, "Failed to set max_seg_size: dma_parms is NULL\n");
730+
return -ENODEV;
732731
}
733732
if (dma_get_max_seg_size(dev) < size)
734733
return dma_set_max_seg_size(dev, size);
@@ -737,21 +736,6 @@ int vb2_dma_contig_set_max_seg_size(struct device *dev, unsigned int size)
737736
}
738737
EXPORT_SYMBOL_GPL(vb2_dma_contig_set_max_seg_size);
739738

740-
/*
741-
* vb2_dma_contig_clear_max_seg_size() - release resources for DMA parameters
742-
* @dev: device for configuring DMA parameters
743-
*
744-
* This function releases resources allocated to configure DMA parameters
745-
* (see vb2_dma_contig_set_max_seg_size() function). It should be called from
746-
* device drivers on driver remove.
747-
*/
748-
void vb2_dma_contig_clear_max_seg_size(struct device *dev)
749-
{
750-
kfree(dev->dma_parms);
751-
dev->dma_parms = NULL;
752-
}
753-
EXPORT_SYMBOL_GPL(vb2_dma_contig_clear_max_seg_size);
754-
755739
MODULE_DESCRIPTION("DMA-contig memory handling routines for videobuf2");
756740
MODULE_AUTHOR("Pawel Osciak <[email protected]>");
757741
MODULE_LICENSE("GPL");

drivers/media/platform/s5p-mfc/s5p_mfc.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,10 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev,
10891089
child->coherent_dma_mask = dev->coherent_dma_mask;
10901090
child->dma_mask = dev->dma_mask;
10911091
child->release = s5p_mfc_memdev_release;
1092+
child->dma_parms = devm_kzalloc(dev, sizeof(*child->dma_parms),
1093+
GFP_KERNEL);
1094+
if (!child->dma_parms)
1095+
goto err;
10921096

10931097
/*
10941098
* The memdevs are not proper OF platform devices, so in order for them
@@ -1104,7 +1108,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev,
11041108
return child;
11051109
device_del(child);
11061110
}
1107-
1111+
err:
11081112
put_device(child);
11091113
return NULL;
11101114
}

drivers/media/v4l2-core/v4l2-ctrls.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1844,7 +1844,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
18441844
sizeof(p_hevc_pps->row_height_minus1));
18451845

18461846
p_hevc_pps->flags &=
1847-
~V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED;
1847+
~V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED;
18481848
}
18491849

18501850
if (p_hevc_pps->flags &

drivers/staging/media/atomisp/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: GPL-2.0
12
menuconfig INTEL_ATOMISP
23
bool "Enable support to Intel Atom ISP camera drivers"
34
depends on X86 && EFI && PCI && ACPI
@@ -11,6 +12,7 @@ menuconfig INTEL_ATOMISP
1112
config VIDEO_ATOMISP
1213
tristate "Intel Atom Image Signal Processor Driver"
1314
depends on VIDEO_V4L2 && INTEL_ATOMISP
15+
depends on PMIC_OPREGION
1416
select IOSF_MBI
1517
select VIDEOBUF_VMALLOC
1618
---help---

drivers/staging/media/atomisp/Makefile

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: GPL-2.0
12
#
23
# Makefile for camera drivers.
34
#
@@ -36,7 +37,6 @@ atomisp-objs += \
3637
pci/sh_css_param_dvs.o \
3738
pci/sh_css_param_shading.o \
3839
pci/sh_css_params.o \
39-
pci/sh_css_pipe.o \
4040
pci/sh_css_properties.o \
4141
pci/sh_css_shading.o \
4242
pci/sh_css_sp.o \
@@ -53,10 +53,7 @@ atomisp-objs += \
5353
pci/hmm/hmm_dynamic_pool.o \
5454
pci/hmm/hmm.o \
5555
pci/hmm/hmm_reserved_pool.o \
56-
pci/hmm/hmm_vm.o \
57-
pci/hrt/hive_isp_css_mm_hrt.o \
5856
pci/ia_css_device_access.o \
59-
pci/ia_css_memory_access.o \
6057
pci/isp/kernels/aa/aa_2/ia_css_aa2.host.o \
6158
pci/isp/kernels/anr/anr_1.0/ia_css_anr.host.o \
6259
pci/isp/kernels/anr/anr_2/ia_css_anr2.host.o \
@@ -117,7 +114,6 @@ atomisp-objs += \
117114
pci/isp/kernels/xnr/xnr_3.0/ia_css_xnr3.host.o \
118115
pci/isp/kernels/ynr/ynr_1.0/ia_css_ynr.host.o \
119116
pci/isp/kernels/ynr/ynr_2/ia_css_ynr2.host.o \
120-
pci/memory_realloc.o \
121117
pci/mmu/isp_mmu.o \
122118
pci/mmu/sh_mmu_mrfld.o \
123119
pci/runtime/binary/src/binary.o \
@@ -328,11 +324,6 @@ INCLUDES_cht += \
328324
# -I$(atomisp)/pci/css_2401_system/hrt/ \
329325
# -I$(atomisp)/pci/css_2401_system/hive_isp_css_2401_system_generated/ \
330326
331-
332-
ifeq ($(CONFIG_ION),y)
333-
INCLUDES += -I$(srctree)/drivers/staging/android/ion
334-
endif
335-
336327
DEFINES := -DHRT_HW -DHRT_ISP_CSS_CUSTOM_HOST -DHRT_USE_VIR_ADDRS -D__HOST__
337328
#DEFINES += -DUSE_DYNAMIC_BIN
338329
#DEFINES += -DISP_POWER_GATING
@@ -352,12 +343,3 @@ DEFINES += -DISP2400 -DSYSTEM_hive_isp_css_2400_system
352343
endif
353344

354345
ccflags-y += $(INCLUDES) $(DEFINES) -fno-common
355-
356-
# HACK! While this driver is in bad shape, don't enable several warnings
357-
# that would be otherwise enabled with W=1
358-
ccflags-y += $(call cc-disable-warning, implicit-fallthrough)
359-
ccflags-y += $(call cc-disable-warning, missing-prototypes)
360-
ccflags-y += $(call cc-disable-warning, missing-declarations)
361-
ccflags-y += $(call cc-disable-warning, suggest-attribute=format)
362-
ccflags-y += $(call cc-disable-warning, unused-const-variable)
363-
ccflags-y += $(call cc-disable-warning, unused-but-set-variable)

drivers/staging/media/atomisp/TODO

Lines changed: 106 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,127 @@
1-
1. A single AtomISP driver needs to be implemented to support both
2-
Baytrail (BYT and Cherrytail (CHT) platforms at the same time.
1+
NOTE:
2+
=====
3+
4+
While the driver probes the hardware and reports itself as a
5+
V4L2 driver, there are still some issues preventing it to
6+
stream (at least it doesn't with the standard V4L2 applications.
7+
Didn't test yet with some custom-made app for this driver).
8+
Solving the related bugs and issues preventing it to work is
9+
needed (items 6 and 7 from the list below).
10+
11+
TODO
12+
====
13+
14+
1. The atomisp doesn't rely at the usual i2c stuff to discover the
15+
sensors. Instead, it calls a function from atomisp_gmin_platform.c.
16+
There are some hacks added there for it to wait for sensors to be
17+
probed (with a timeout of 2 seconds or so).
18+
This should be converted to the usual way, using V4L2 async subdev
19+
framework to wait for cameras to be probed;
20+
21+
2. Use ACPI _DSM table - DONE!
22+
23+
3. Switch the driver to use pm_runtime stuff. Right now, it probes the
24+
existing PMIC code and sensors call it directly.
25+
26+
4. There's a problem at the sensor drivers: when trying to set a video
27+
format, the atomisp main driver calls the sensor drivers with the
28+
sensor turned off. This causes them to fail.
29+
30+
The only exception is the atomisp-ov2880, which has a hack inside it
31+
to turn it on when VIDIOC_S_FMT is called.
32+
33+
The right fix seems to power on the sensor when a video device is
34+
opened (or at the first VIDIOC_ ioctl - except for VIDIOC_QUERYCAP),
35+
powering it down at close() syscall.
36+
37+
Such kind of control would need to be done inside the atomisp driver,
38+
not at the sensors code.
39+
40+
5. There are several issues related to memory management, causing
41+
crashes. The atomisp splits the memory management on three separate
42+
regions:
43+
44+
- dynamic pool;
45+
- reserved pool;
46+
- generic pool
47+
48+
The code implementing it is at:
49+
50+
drivers/staging/media/atomisp/pci/hmm/
51+
52+
It also has a separate code for managing DMA buffers at:
53+
54+
drivers/staging/media/atomisp/pci/mmu/
55+
56+
The code there is really dirty, ugly and probably wrong. I fixed
57+
one bug there already, but the best would be to just trash it and use
58+
something else. Maybe the code from the newer intel driver could
59+
serve as a model:
60+
61+
drivers/staging/media/ipu3/ipu3-mmu.c
62+
63+
But converting it to use something like that is painful and may
64+
cause some breakages.
65+
66+
6. There is some issues at the frame receive logic, causing the
67+
DQBUF ioctls to fail.
68+
69+
7. A single AtomISP driver needs to be implemented to support both
70+
Baytrail (BYT) and Cherrytail (CHT) platforms at the same time.
371
The current driver is a mechanical and hand combined merge of the
472
two using several runtime macros, plus some ifdef ISP2401 to select the
573
CHT version. Yet, there are some ISP-specific headers that change the
674
driver's behavior during compile time.
775

8-
2. The file structure needs to get tidied up to resemble a normal Linux
76+
8. The file structure needs to get tidied up to resemble a normal Linux
977
driver.
1078

11-
3. Lots of the midlayer glue. unused code and abstraction needs removing.
79+
9. Lots of the midlayer glue. unused code and abstraction needs removing.
1280

13-
3. The sensor drivers read MIPI settings from EFI variables or default to the
14-
settings hard-coded in the platform data file for different platforms.
15-
It should be possible to improve it, by adding support for _DSM tables.
81+
10. The AtomISP driver includes some special IOCTLS (ATOMISP_IOC_XXXX_XXXX)
82+
and controls that require some cleanup. Some of those code may have
83+
been removed during the cleanups. They could be needed in order to
84+
properly support 3A algorithms
1685

17-
4. The sensor drivers use PMIC and the regulator framework API. In the ideal
18-
world it would be using ACPI but that's not how the existing devices work.
86+
Such IOCTL interface needs more documentation. The better would
87+
be to use something close to the interface used by the IPU3 IMGU driver.
1988

20-
5. The AtomISP driver includes some special IOCTLS (ATOMISP_IOC_XXXX_XXXX)
21-
and controls that require some cleanup.
89+
11. The ISP code has some dependencies of the exact FW version.
90+
The version defined in pci/sh_css_firmware.c:
2291

23-
6. Correct Coding Style. Please don't send coding style patches for this
24-
driver until the other work is done.
92+
BYT (isp2400): "irci_stable_candrpv_0415_20150521_0458"
2593

26-
7. The ISP code has some dependencies of the exact FW version.
27-
The version defined in pci/sh_css_firmware.c:
28-
BYT:
29-
static const char *isp2400_release_version = STR(irci_stable_candrpv_0415_20150521_0458);
94+
CHT (isp2401): "irci_ecr - master_20150911_0724"
3095

31-
CHT:
32-
static const char *isp2401_release_version = STR(irci_ecr - master_20150911_0724);
96+
Those versions don't seem to be available anymore. On the tests we've
97+
done so far, this version also seems to work for CHT:
3398

34-
Those versions don't seem to be available anymore. On the tests we've
35-
done so far, this version also seems to work for isp2401:
99+
"irci_stable_candrpv_0415_20150521_0458"
36100

37-
irci_stable_candrpv_0415_20150521_0458
101+
Which can be obtainable from Yocto Atom ISP respository.
38102

39-
At some point we may need to round up a few driver versions and see if
40-
there are any specific things that can be done to fold in support for
41-
multiple firmware versions.
103+
but this was not thoroughly tested.
42104

43-
8. Switch to V4L2 async API to set up sensor, lens and flash devices.
44-
Control those devices using V4L2 sub-device API without custom
45-
extensions.
105+
At some point we may need to round up a few driver versions and see if
106+
there are any specific things that can be done to fold in support for
107+
multiple firmware versions.
46108

47-
9. Switch to standard V4L2 sub-device API for sensor and lens. In
48-
particular, the user space API needs to support V4L2 controls as
49-
defined in the V4L2 spec and references to atomisp must be removed from
50-
these drivers.
109+
12. Switch to standard V4L2 sub-device API for sensor and lens. In
110+
particular, the user space API needs to support V4L2 controls as
111+
defined in the V4L2 spec and references to atomisp must be removed from
112+
these drivers.
51113

52-
10. Use LED flash API for flash LED drivers such as LM3554 (which already
114+
13. Use LED flash API for flash LED drivers such as LM3554 (which already
53115
has a LED class driver).
54116

55-
11. Switch from videobuf1 to videobuf2. Videobuf1 is being removed!
56-
57-
12. There are some memory management code that seems to be
58-
forked from Kernel 3.10 inside hmm/ directory. Get rid of it,
59-
making the driver to use a more standard memory management module.
117+
14. Switch from videobuf1 to videobuf2. Videobuf1 is being removed!
60118

61-
13. While the driver probes the hardware and reports itself as a
62-
V4L2 driver, there are still some issues preventing it to
63-
stream (at least it doesn't with the standard V4L2 applications.
64-
Didn't test yet with some custom-made app for this driver).
65-
Solving the related bugs and issues preventing it to work is
66-
needed.
119+
15. Correct Coding Style. Please refrain sending coding style patches
120+
for this driver until the other work is done, as there will be a lot
121+
of code churn until this driver becomes functional again.
67122

68-
Limitations:
123+
Limitations
124+
===========
69125

70126
1. To test the patches, you also need the ISP firmware
71127

@@ -76,14 +132,16 @@ Limitations:
76132
device but can also be extracted from the upgrade kit if you've managed
77133
to lose them somehow.
78134

79-
2. Without a 3A libary the capture behaviour is not very good. To take a good
80-
picture, you need tune ISP parameters by IOCTL functions or use a 3A libary
135+
2. Without a 3A library the capture behaviour is not very good. To take a good
136+
picture, you need tune ISP parameters by IOCTL functions or use a 3A library
81137
such as libxcam.
82138

83139
3. The driver is intended to drive the PCI exposed versions of the device.
84140
It will not detect those devices enumerated via ACPI as a field of the
85141
i915 GPU driver.
86142

143+
There are some patches adding i915 GPU support floating at the Yocto's
144+
Aero repository (so far, untested upstream).
145+
87146
4. The driver supports only v2 of the IPU/Camera. It will not work with the
88147
versions of the hardware in other SoCs.
89-

drivers/staging/media/atomisp/i2c/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: GPL-2.0
12
#
23
# Kconfig for sensor drivers
34
#
@@ -57,7 +58,7 @@ config VIDEO_ATOMISP_GC0310
5758
---help---
5859
This is a Video4Linux2 sensor-level driver for the Galaxycore
5960
GC0310 0.3MP sensor.
60-
61+
6162
config VIDEO_ATOMISP_OV2680
6263
tristate "Omnivision OV2680 sensor support"
6364
depends on ACPI

drivers/staging/media/atomisp/i2c/atomisp-gc0310.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Support for GalaxyCore GC0310 VGA camera sensor.
34
*
@@ -1309,18 +1310,6 @@ static int gc0310_probe(struct i2c_client *client)
13091310
int ret;
13101311
void *pdata;
13111312
unsigned int i;
1312-
acpi_handle handle;
1313-
struct acpi_device *adev;
1314-
1315-
handle = ACPI_HANDLE(&client->dev);
1316-
if (!handle || acpi_bus_get_device(handle, &adev)) {
1317-
dev_err(&client->dev, "Error could not get ACPI device\n");
1318-
return -ENODEV;
1319-
}
1320-
pr_info("%s: ACPI detected it on bus ID=%s, HID=%s\n",
1321-
__func__, acpi_device_bid(adev), acpi_device_hid(adev));
1322-
// FIXME: may need to release resources allocated by acpi_bus_get_device()
1323-
13241313

13251314
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
13261315
if (!dev)

0 commit comments

Comments
 (0)