Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A15 porting other patches #12

Merged
merged 7 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions drivers/bluetooth/btintel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2206,8 +2206,12 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev,
if (err < 0) {
if (err == -EALREADY) {
/* Firmware has already been loaded */
btintel_set_flag(hdev, INTEL_FIRMWARE_LOADED);
err = 0;
bt_dev_info(hdev, "Firmware already loaded");
//btintel_set_flag(hdev, INTEL_FIRMWARE_LOADED);
btintel_reset_to_bootloader(hdev);
/*even this error report, the BT still working ,
so 150ms delay is still needed */
msleep(150);
goto done;
}

Expand Down
38 changes: 33 additions & 5 deletions drivers/media/common/videobuf2/videobuf2-dma-sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-memops.h>
#include <media/videobuf2-dma-sg.h>
#include "linux/virtio_shm.h"

static int debug;
module_param(debug, int, 0644);
Expand Down Expand Up @@ -105,6 +106,8 @@ static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev,
struct sg_table *sgt;
int ret;
int num_pages;
int i;
struct scatterlist *sg;

if (WARN_ON(!dev) || WARN_ON(!size))
return ERR_PTR(-EINVAL);
Expand All @@ -130,9 +133,25 @@ static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev,
if (!buf->pages)
goto fail_pages_array_alloc;

ret = vb2_dma_sg_alloc_compacted(buf, vb->vb2_queue->gfp_flags);
if (ret)
goto fail_pages_alloc;
if (strcmp(dev->driver->name, "virtio-ivshmem") == 0 ||
strcmp(dev->driver->name, "virtio-guest-shm") == 0) {
pr_err("%s: alloc memory from ivshmem begin\n", __func__);
for(i = 0; i < buf->num_pages; i++) {
buf->pages[i] = virtio_shmem_allocate_page(dev);
if (!buf->pages[i]) {
while(i > 0) {
virtio_shmem_free_page(dev, buf->pages[i-1]);
i--;
};
goto fail_pages_array_alloc;
}
}
pr_err("%s: alloc memory from ivshmem end\n", __func__);
} else {
ret = vb2_dma_sg_alloc_compacted(buf, vb->vb2_queue->gfp_flags);
if (ret)
goto fail_pages_alloc;
}

ret = sg_alloc_table_from_pages(buf->dma_sgt, buf->pages,
buf->num_pages, 0, size, GFP_KERNEL);
Expand Down Expand Up @@ -190,8 +209,17 @@ static void vb2_dma_sg_put(void *buf_priv)
if (buf->vaddr)
vm_unmap_ram(buf->vaddr, buf->num_pages);
sg_free_table(buf->dma_sgt);
while (--i >= 0)
__free_page(buf->pages[i]);

if (strcmp(buf->dev->driver->name, "virtio-ivshmem") == 0 ||
strcmp(buf->dev->driver->name, "virtio-guest-shm") == 0) {
while (--i >= 0) {
virtio_shmem_free_page(buf->dev, buf->pages[i]);
};
} else {
while (--i >= 0)
__free_page(buf->pages[i]);
}

kvfree(buf->pages);
put_device(buf->dev);
kfree(buf);
Expand Down
1 change: 1 addition & 0 deletions drivers/media/platform/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,6 @@ source "drivers/media/platform/ti/Kconfig"
source "drivers/media/platform/verisilicon/Kconfig"
source "drivers/media/platform/via/Kconfig"
source "drivers/media/platform/xilinx/Kconfig"
source "drivers/media/platform/virtio/Kconfig"

endif # MEDIA_PLATFORM_DRIVERS
1 change: 1 addition & 0 deletions drivers/media/platform/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ obj-y += ti/
obj-y += verisilicon/
obj-y += via/
obj-y += xilinx/
obj-y += virtio/

# Please place here only ancillary drivers that aren't SoC-specific
# Please keep it alphabetically sorted by Kconfig name
Expand Down
14 changes: 14 additions & 0 deletions drivers/media/platform/virtio/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: GPL-2.0-only

comment "VirtIO media platform drivers"

config VIDEO_VIRTIO_CAMERA
tristate "VirtIO camera driver"
depends on V4L_PLATFORM_DRIVERS
depends on VIDEO_DEV
depends on VIRTIO
select VIDEOBUF2_DMA_SG
select VIRTIO_DMA_SHARED_BUFFER
help
This driver provides support for VirtIO camera device. If you
choose 'M' here, this module will be called virtio_camera.
2 changes: 2 additions & 0 deletions drivers/media/platform/virtio/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_VIDEO_VIRTIO_CAMERA) += virtio-camera.o
Loading
Loading