From f49bbc79e52a252bca012dc3d2cae367090e0473 Mon Sep 17 00:00:00 2001 From: wang_yuanzhi Date: Wed, 9 Oct 2024 17:20:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3rk3568=20linux6.6=20camera?= =?UTF-8?q?=E9=A6=96=E5=B8=A7=E9=BB=91=E5=B1=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wang_yuanzhi --- linux-6.6/rk3568_patch/kernel.patch | 73 +++++++++++++++-------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/linux-6.6/rk3568_patch/kernel.patch b/linux-6.6/rk3568_patch/kernel.patch index aeb8edf..1ed6c60 100644 --- a/linux-6.6/rk3568_patch/kernel.patch +++ b/linux-6.6/rk3568_patch/kernel.patch @@ -83398,7 +83398,7 @@ index 000000000..2f7b7774c +#endif /* __ROCKCHIP_DMC_TIMING_H__ */ + diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig -index e4dc53a36..c43288c9a 100644 +index c86a4756a..82c7df8e4 100644 --- a/drivers/dma-buf/Kconfig +++ b/drivers/dma-buf/Kconfig @@ -1,6 +1,39 @@ @@ -83455,7 +83455,7 @@ index e4dc53a36..c43288c9a 100644 config UDMABUF bool "userspace dmabuf misc driver" default n -@@ -90,5 +130,6 @@ menuconfig DMABUF_SYSFS_STATS +@@ -103,5 +143,6 @@ menuconfig DMABUF_SYSFS_STATS in quite some performance problems. source "drivers/dma-buf/heaps/Kconfig" @@ -83463,7 +83463,7 @@ index e4dc53a36..c43288c9a 100644 endmenu diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile -index 70ec901ed..77ee691b5 100644 +index cdb3bb049..b1fffd5cf 100644 --- a/drivers/dma-buf/Makefile +++ b/drivers/dma-buf/Makefile @@ -3,10 +3,13 @@ obj-y := dma-buf.o dma-fence.o dma-fence-array.o dma-fence-chain.o \ @@ -83686,7 +83686,7 @@ index 000000000..5ec8896d3 +} +EXPORT_SYMBOL(dma_buf_cache_map_attachment); diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c -index 21916bba7..323dd3213 100644 +index b5ec6592e..c2f9f3edd 100644 --- a/drivers/dma-buf/dma-buf.c +++ b/drivers/dma-buf/dma-buf.c @@ -27,6 +27,7 @@ @@ -83697,7 +83697,7 @@ index 21916bba7..323dd3213 100644 #include #include -@@ -42,6 +43,76 @@ struct dma_buf_list { +@@ -43,6 +44,76 @@ struct dma_buf_list { static struct dma_buf_list db_list; @@ -83774,7 +83774,7 @@ index 21916bba7..323dd3213 100644 static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) { struct dma_buf *dmabuf; -@@ -61,6 +132,9 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) +@@ -62,6 +133,9 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen) static void dma_buf_release(struct dentry *dentry) { struct dma_buf *dmabuf; @@ -83784,7 +83784,7 @@ index 21916bba7..323dd3213 100644 dmabuf = dentry->d_fsdata; if (unlikely(!dmabuf)) -@@ -76,7 +150,13 @@ static void dma_buf_release(struct dentry *dentry) +@@ -77,7 +151,13 @@ static void dma_buf_release(struct dentry *dentry) BUG_ON(dmabuf->cb_in.active || dmabuf->cb_out.active); dma_buf_stats_teardown(dmabuf); @@ -83799,7 +83799,7 @@ index 21916bba7..323dd3213 100644 if (dmabuf->resv == (struct dma_resv *)&dmabuf[1]) dma_resv_fini(dmabuf->resv); -@@ -97,6 +177,9 @@ static int dma_buf_file_release(struct inode *inode, struct file *file) +@@ -98,6 +178,9 @@ static int dma_buf_file_release(struct inode *inode, struct file *file) dmabuf = file->private_data; if (dmabuf) { mutex_lock(&db_list.lock); @@ -83809,7 +83809,7 @@ index 21916bba7..323dd3213 100644 list_del(&dmabuf->list_node); mutex_unlock(&db_list.lock); } -@@ -304,6 +387,16 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) +@@ -305,6 +388,16 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) return events; } @@ -83826,7 +83826,7 @@ index 21916bba7..323dd3213 100644 /** * dma_buf_set_name - Set a name to a specific dma_buf to track the usage. * It could support changing the name of the dma-buf if the same -@@ -317,19 +410,35 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) +@@ -318,19 +411,35 @@ static __poll_t dma_buf_poll(struct file *file, poll_table *poll) * devices, return -EBUSY. * */ @@ -83868,7 +83868,7 @@ index 21916bba7..323dd3213 100644 } #if IS_ENABLED(CONFIG_SYNC_FILE) -@@ -478,7 +587,7 @@ static long dma_buf_ioctl(struct file *file, +@@ -479,7 +588,7 @@ static long dma_buf_ioctl(struct file *file, case DMA_BUF_SET_NAME_A: case DMA_BUF_SET_NAME_B: @@ -83877,7 +83877,7 @@ index 21916bba7..323dd3213 100644 #if IS_ENABLED(CONFIG_SYNC_FILE) case DMA_BUF_IOCTL_EXPORT_SYNC_FILE: -@@ -487,6 +596,49 @@ static long dma_buf_ioctl(struct file *file, +@@ -488,6 +597,49 @@ static long dma_buf_ioctl(struct file *file, return dma_buf_import_sync_file(dmabuf, (const void __user *)arg); #endif @@ -83927,7 +83927,7 @@ index 21916bba7..323dd3213 100644 default: return -ENOTTY; } -@@ -556,6 +708,17 @@ static struct file *dma_buf_getfile(size_t size, int flags) +@@ -557,6 +709,17 @@ static struct file *dma_buf_getfile(size_t size, int flags) return file; } @@ -83945,7 +83945,7 @@ index 21916bba7..323dd3213 100644 /** * DOC: dma buf device access * -@@ -652,9 +815,13 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) +@@ -653,9 +816,13 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) dmabuf->exp_name = exp_info->exp_name; dmabuf->owner = exp_info->owner; spin_lock_init(&dmabuf->name_lock); @@ -83959,7 +83959,7 @@ index 21916bba7..323dd3213 100644 INIT_LIST_HEAD(&dmabuf->attachments); if (!resv) { -@@ -674,8 +841,16 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) +@@ -675,8 +842,16 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info) mutex_lock(&db_list.lock); list_add(&dmabuf->list_node, &db_list.head); @@ -83976,7 +83976,7 @@ index 21916bba7..323dd3213 100644 return dmabuf; err_dmabuf: -@@ -927,8 +1102,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, +@@ -928,8 +1103,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, dma_buf_is_dynamic(dmabuf)) { struct sg_table *sgt; @@ -83986,7 +83986,7 @@ index 21916bba7..323dd3213 100644 ret = dmabuf->ops->pin(attach); if (ret) goto err_unlock; -@@ -941,7 +1116,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, +@@ -942,7 +1117,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, ret = PTR_ERR(sgt); goto err_unpin; } @@ -83996,7 +83996,7 @@ index 21916bba7..323dd3213 100644 attach->sgt = sgt; attach->dir = DMA_BIDIRECTIONAL; } -@@ -957,7 +1133,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, +@@ -958,7 +1134,8 @@ dma_buf_dynamic_attach(struct dma_buf *dmabuf, struct device *dev, dmabuf->ops->unpin(attach); err_unlock: @@ -84006,7 +84006,7 @@ index 21916bba7..323dd3213 100644 dma_buf_detach(dmabuf, attach); return ERR_PTR(ret); -@@ -1000,22 +1177,24 @@ static void __unmap_dma_buf(struct dma_buf_attachment *attach, +@@ -1001,22 +1178,24 @@ static void __unmap_dma_buf(struct dma_buf_attachment *attach, */ void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach) { @@ -84037,7 +84037,7 @@ index 21916bba7..323dd3213 100644 if (dmabuf->ops->detach) dmabuf->ops->detach(dmabuf, attach); -@@ -1106,7 +1285,8 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, +@@ -1107,7 +1286,8 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, if (WARN_ON(!attach || !attach->dmabuf)) return ERR_PTR(-EINVAL); @@ -84047,7 +84047,7 @@ index 21916bba7..323dd3213 100644 if (attach->sgt) { /* -@@ -1121,6 +1301,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, +@@ -1122,6 +1302,7 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach, } if (dma_buf_is_dynamic(attach->dmabuf)) { @@ -84055,7 +84055,7 @@ index 21916bba7..323dd3213 100644 if (!IS_ENABLED(CONFIG_DMABUF_MOVE_NOTIFY)) { r = attach->dmabuf->ops->pin(attach); if (r) -@@ -1209,11 +1390,15 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, +@@ -1210,11 +1391,15 @@ void dma_buf_unmap_attachment(struct dma_buf_attachment *attach, if (WARN_ON(!attach || !attach->dmabuf || !sg_table)) return; @@ -84072,7 +84072,7 @@ index 21916bba7..323dd3213 100644 __unmap_dma_buf(attach, sg_table, direction); if (dma_buf_is_dynamic(attach->dmabuf) && -@@ -1501,37 +1686,38 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, DMA_BUF); +@@ -1502,37 +1687,38 @@ EXPORT_SYMBOL_NS_GPL(dma_buf_mmap, DMA_BUF); int dma_buf_vmap(struct dma_buf *dmabuf, struct iosys_map *map) { struct iosys_map ptr; @@ -84117,7 +84117,7 @@ index 21916bba7..323dd3213 100644 } EXPORT_SYMBOL_NS_GPL(dma_buf_vmap, DMA_BUF); -@@ -1572,17 +1758,17 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map) +@@ -1573,17 +1759,17 @@ void dma_buf_vunmap(struct dma_buf *dmabuf, struct iosys_map *map) if (WARN_ON(!dmabuf)) return; @@ -636869,7 +636869,7 @@ index 000000000..d5191273f +} diff --git a/drivers/media/platform/rockchip/isp/capture.c b/drivers/media/platform/rockchip/isp/capture.c new file mode 100644 -index 000000000..a43e6e4f9 +index 000000000..9a7f49a10 --- /dev/null +++ b/drivers/media/platform/rockchip/isp/capture.c @@ -0,0 +1,1794 @@ @@ -637239,7 +637239,7 @@ index 000000000..a43e6e4f9 + if (!isp || + (isp && !(isp->isp_inp & INP_CSI))) + continue; -+ for (j = RKISP_STREAM_DMATX0; j < RKISP_MAX_STREAM; j++) { ++ for (j = RKISP_STREAM_DMATX0; j <= RKISP_STREAM_DMATX3; j++) { + stream = &isp->cap_dev.stream[j]; + if (!stream->linked || stream->curr_buf || stream->next_buf) + continue; @@ -695353,10 +695353,10 @@ index 000000000..5e4c85710 +#endif /* _RKISP_REGS_V3X_H */ diff --git a/drivers/media/platform/rockchip/isp/rkisp.c b/drivers/media/platform/rockchip/isp/rkisp.c new file mode 100644 -index 000000000..d1233cfc0 +index 000000000..f9d1cad8f --- /dev/null +++ b/drivers/media/platform/rockchip/isp/rkisp.c -@@ -0,0 +1,4338 @@ +@@ -0,0 +1,4343 @@ +/* + * Rockchip isp1 driver + * @@ -696418,8 +696418,10 @@ index 000000000..d1233cfc0 + +void rkisp_check_idle(struct rkisp_device *dev, u32 irq) +{ ++ unsigned long lock_flags = 0; + u32 val = 0; + ++ spin_lock_irqsave(&dev->hw_dev->rdbk_lock, lock_flags); + dev->irq_ends |= (irq & dev->irq_ends_mask); + v4l2_dbg(3, rkisp_debug, &dev->v4l2_dev, + "%s irq:0x%x ends:0x%x mask:0x%x\n", @@ -696431,8 +696433,11 @@ index 000000000..d1233cfc0 + complete(&dev->hw_dev->monitor.cmpl); + } + if ((dev->irq_ends & dev->irq_ends_mask) != dev->irq_ends_mask || -+ !IS_HDR_RDBK(dev->rd_mode)) ++ !IS_HDR_RDBK(dev->rd_mode)) { ++ spin_unlock_irqrestore(&dev->hw_dev->rdbk_lock, lock_flags); + return; ++ } ++ spin_unlock_irqrestore(&dev->hw_dev->rdbk_lock, lock_flags); + + if (dev->sw_rd_cnt) + goto end; @@ -1675430,10 +1675435,10 @@ index 000000000..39c497774 + +#endif diff --git a/include/linux/sched.h b/include/linux/sched.h -index d3198acc2..b522879c7 100644 +index 621115fb7..27973c7d1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h -@@ -744,6 +744,20 @@ struct kmap_ctrl { +@@ -840,6 +840,20 @@ struct kmap_ctrl { #endif }; @@ -1675454,7 +1675459,7 @@ index d3198acc2..b522879c7 100644 struct task_struct { #ifdef CONFIG_THREAD_INFO_IN_TASK /* -@@ -1548,6 +1562,10 @@ struct task_struct { +@@ -1659,6 +1673,10 @@ struct task_struct { u64 ftoken; #endif @@ -1699852,10 +1699857,10 @@ index 000000000..c217380d1 + +#endif diff --git a/init/Kconfig b/init/Kconfig -index 879f6dc1c..1f58de359 100644 +index f67b31dac..4002f8fdd 100644 --- a/init/Kconfig +++ b/init/Kconfig -@@ -1317,6 +1317,12 @@ if BLK_DEV_INITRD +@@ -1373,6 +1373,12 @@ if BLK_DEV_INITRD source "usr/Kconfig" -- Gitee