Skip to content

Commit

Permalink
Merge pull request #328 from hao-yao/master
Browse files Browse the repository at this point in the history
Update based on build 20250212_1315_368 for development
  • Loading branch information
hao-yao authored Feb 19, 2025
2 parents b4ba63d + 1f64d8c commit 7af0714
Show file tree
Hide file tree
Showing 29 changed files with 414 additions and 406 deletions.
10 changes: 5 additions & 5 deletions drivers/media/i2c/hm11b1.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020-2022 Intel Corporation.

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/i2c/hm2170.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/nvmem-provider.h>
#include <linux/regmap.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/i2c/hm2172.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/nvmem-provider.h>
#include <linux/regmap.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
10 changes: 5 additions & 5 deletions drivers/media/i2c/ov01a1s.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2020-2022 Intel Corporation.

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/i2c/ov02c10.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022 Intel Corporation.

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/i2c/ov02e10.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2023 Intel Corporation.

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/i2c/ov05c10.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2024 Intel Corporation.

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
Expand All @@ -15,6 +9,12 @@
#include <linux/pm_runtime.h>
#include <linux/units.h>
#include <linux/regmap.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <media/v4l2-cci.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
Expand Down
12 changes: 6 additions & 6 deletions drivers/media/i2c/ov08a10.c
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2022-2023 Intel Corporation.

#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
10 changes: 5 additions & 5 deletions drivers/media/i2c/ov8856.c
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2021-2022 Intel Corporation.

#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/version.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0)
#include <asm/unaligned.h>
#else
#include <linux/unaligned.h>
#endif
#include <linux/acpi.h>
#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fwnode.h>
Expand Down
8 changes: 1 addition & 7 deletions drivers/media/pci/intel/ipu-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include "ipu-platform.h"
#include "ipu-dma.h"

#ifdef CONFIG_PM
static struct bus_type ipu_bus;

static int bus_pm_runtime_suspend(struct device *dev)
Expand Down Expand Up @@ -70,11 +69,6 @@ static const struct dev_pm_ops ipu_bus_pm_ops = {
.runtime_resume = bus_pm_runtime_resume,
};

#define IPU_BUS_PM_OPS (&ipu_bus_pm_ops)
#else
#define IPU_BUS_PM_OPS NULL
#endif

static int ipu_bus_match(struct device *dev, struct device_driver *drv)
{
struct ipu_bus_driver *adrv = to_ipu_bus_driver(drv);
Expand Down Expand Up @@ -145,7 +139,7 @@ static struct bus_type ipu_bus = {
.match = ipu_bus_match,
.probe = ipu_bus_probe,
.remove = ipu_bus_remove,
.pm = IPU_BUS_PM_OPS,
.pm = &ipu_bus_pm_ops,
};

static struct mutex ipu_bus_mutex;
Expand Down
8 changes: 6 additions & 2 deletions drivers/media/pci/intel/ipu-fw-com.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,12 +443,16 @@ void *ipu_send_get_token(struct ipu_fw_com_context *ctx, int q_nbr)
rd = readl(q_dmem + FW_COM_RD_REG);

/* Catch indexes in dmem */
if (!is_index_valid(q, wr) || !is_index_valid(q, rd))
if (!is_index_valid(q, wr) || !is_index_valid(q, rd)) {
dev_err(&ctx->adev->dev, "invalid index\n");
return NULL;
}

packets = num_free(wr + 1, rd, q->size);
if (!packets)
if (!packets) {
dev_err(&ctx->adev->dev, "no packets available\n");
return NULL;
}

index = curr_index(q_dmem, DIR_SEND);

Expand Down
3 changes: 2 additions & 1 deletion drivers/media/pci/intel/ipu-isys-csi2.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ static int set_stream(struct v4l2_subdev *sd, int enable)
unsigned int nlanes;
int rval;

dev_dbg(&csi2->isys->adev->dev, "csi2 s_stream %d\n", enable);
dev_dbg(&csi2->isys->adev->dev, "csi2 s_stream %d for entity %s\n",
enable, sd->entity.name);

if (!ip->external->entity) {
WARN_ON(1);
Expand Down
31 changes: 12 additions & 19 deletions drivers/media/pci/intel/ipu-isys-queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,6 @@ static int ipu_isys_stream_start(struct ipu_isys_pipeline *ip,

mutex_lock(&pipe_av->isys->stream_mutex);

rval = ipu_isys_video_set_streaming(pipe_av, 1, bl);
if (rval) {
mutex_unlock(&pipe_av->isys->stream_mutex);
goto out_requeue;
}

ip->streaming = 1;

mutex_unlock(&pipe_av->isys->stream_mutex);

bl = &__bl;
Expand Down Expand Up @@ -699,7 +691,6 @@ static void return_buffers(struct ipu_isys_queue *aq,
enum vb2_buffer_state state)
{
struct ipu_isys_video *av = ipu_isys_queue_to_video(aq);
int reset_needed = 0;
unsigned long flags;

spin_lock_irqsave(&aq->lock, flags);
Expand Down Expand Up @@ -755,16 +746,9 @@ static void return_buffers(struct ipu_isys_queue *aq,
#endif

spin_lock_irqsave(&aq->lock, flags);
reset_needed = 1;
}

spin_unlock_irqrestore(&aq->lock, flags);

if (reset_needed) {
mutex_lock(&av->isys->mutex);
av->isys->reset_needed = true;
mutex_unlock(&av->isys->mutex);
}
}

static int start_streaming(struct vb2_queue *q, unsigned int count)
Expand Down Expand Up @@ -792,8 +776,6 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
goto out_return_buffers;
}

mutex_unlock(&av->isys->stream_mutex);

rval = aq->link_fmt_validate(aq);
if (rval) {
dev_dbg(&av->isys->adev->dev,
Expand Down Expand Up @@ -826,6 +808,15 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
}
}

rval = ipu_isys_video_set_streaming(pipe_av, 1, bl);
if (rval) {
mutex_unlock(&pipe_av->isys->stream_mutex);
goto out_stream_start;
}

ip->streaming = 1;
mutex_unlock(&av->isys->stream_mutex);

rval = ipu_isys_stream_start(ip, bl, false);
if (rval)
goto out_stream_start;
Expand Down Expand Up @@ -887,6 +878,8 @@ static void stop_streaming(struct vb2_queue *q)
return_buffers(aq, VB2_BUF_STATE_ERROR);
}

/* Invalid timestamp defined by FW */
#define INVALID_TSC (2 | BIT_ULL(32))
static unsigned int
get_sof_sequence_by_timestamp(struct ipu_isys_pipeline *ip,
struct ipu_fw_isys_resp_info_abi *info)
Expand All @@ -900,7 +893,7 @@ get_sof_sequence_by_timestamp(struct ipu_isys_pipeline *ip,
* The timestamp is invalid as no TSC in some FPGA platform,
* so get the sequence from pipeline directly in this case.
*/
if (time == 0)
if (time == 0 || time == INVALID_TSC)
return atomic_read(&ip->sequence) - 1;

for (i = 0; i < IPU_ISYS_MAX_PARALLEL_SOF; i++)
Expand Down
Loading

0 comments on commit 7af0714

Please sign in to comment.