forked from Openwrt/openwrt
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.43 Removed upstreamed: generic/backport-6.12/612-07-v6.17-net-dsa-b53-prevent-SWITCH_CTRL-access-on-BCM5325.patch[1] generic-backport/612-08-v6.17-net-dsa-b53-fix-IP_MULTICAST_CTRL-on-BCM5325.patch[2] generic-backport/612-09-v6.17-net-dsa-b53-prevent-DIS_LEARNING-access-on-BCM5325.patch[3] generic-backport/612-11-v6.17-net-dsa-b53-prevent-GMII_PORT_OVERRIDE_CTRL-access-on-BCM5325.patch[4] generic-backport/612-14-v6.17-net-dsa-b53-ensure-BCM5325-PHYs-are-enabled.patch[5] generic-backport/830-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch[6] bcm27xx/patches-6.12/950-0100-media-tc358743-Increase-FIFO-level-to-374.patch[7] bcm27xx/patches-6.12/950-0102-media-tc358743-Check-I2C-succeeded-during-probe.patch[8] bcm27xx/patches-6.12/950-0107-media-tc358743-Return-an-appropriate-colorspace-from.patch[9] bcm27xx/patches-6.12/950-0341-Allow-RESET_BRCMSTB-on-ARCH_BCM2835.patch[10] lantiq/patches-6.12/102-11-v6.17-MIPS-lantiq-falcon-sysctrl-fix-request-memory-check-.patch[11] lantiq/patches-6.12/102-12-v6.17-MIPS-vpe-mt-add-missing-prototypes-for-vpe_-alloc-st.patch[12] qualcommax/patches-6.12/0170-clk-qcom-gcc-ipq8074-fix-broken-freq-table-for-nss_port6_tx_clk_src.patch[13] generic/backport-6.12/612-13-v6.17-net-dsa-b53-fix-b53_imp_vlan_setup-for-BCM5325.patch[14] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f16f96ccfe56ef2d627c20ba47f6d9d7dea40f5b 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=394bd12d1f93ed2fa0fa1d8f31ffd3c344681e85 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=9f45e4858f8096bb27f9a2c75fc24a538dffad67 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=15cf46cc6ecc7a54b397294675d11c379ddf69ef 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=0d250ad617a035904744cef74a5d5dc43d0199b9 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=cb9bb872366e10fa42e1e0200a0c2e5d05a27bec 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f25d566c5674decd0051a3e624805fc1524729bf 8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=3e03ee3b65baeac4c253b30650492ffffad9b608 9. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=b42b107293b52ac8d46238815b1071138a47a7e4 10. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=e285cdb9d2e4ba2e4515ae898f92e9f38be64eb3 11. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=1e9079ff83eac962bc3b1e2fbad73b2f7d5256f4 12. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=8520c843d9a2770012f23da08e4e2ccf1bb05ba6 13. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f1c5c55fb6cda312f5ed15505588caaf05a69043 14. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=757955c80663ac3df7053abaf6fcc75051ef7a7c Build system: x86/64 (Intel N150 based) Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64-glibc Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64-glibc Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/19618 Signed-off-by: Robert Marko <robimarko@gmail.com>
245 lines
6.1 KiB
Diff
245 lines
6.1 KiB
Diff
From 975e76214cd2516eb6cfff4c3eec581872645e88 Mon Sep 17 00:00:00 2001
|
|
From: John Crispin <blogic@openwrt.org>
|
|
Date: Thu, 19 Sep 2013 01:50:59 +0200
|
|
Subject: [PATCH 31/53] uvc: add iPassion iP2970 support
|
|
|
|
Signed-off-by: John Crispin <blogic@openwrt.org>
|
|
---
|
|
drivers/media/usb/uvc/uvc_driver.c | 12 +++
|
|
drivers/media/usb/uvc/uvc_status.c | 2 +
|
|
drivers/media/usb/uvc/uvc_video.c | 147 ++++++++++++++++++++++++++++++++++++
|
|
drivers/media/usb/uvc/uvcvideo.h | 5 +-
|
|
4 files changed, 165 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/media/usb/uvc/uvc_driver.c
|
|
+++ b/drivers/media/usb/uvc/uvc_driver.c
|
|
@@ -3197,6 +3197,18 @@ static const struct usb_device_id uvc_id
|
|
.bInterfaceSubClass = 1,
|
|
.bInterfaceProtocol = 0,
|
|
.driver_info = UVC_INFO_META(V4L2_META_FMT_D4XX) },
|
|
+ /* iPassion iP2970 */
|
|
+ { .match_flags = USB_DEVICE_ID_MATCH_DEVICE
|
|
+ | USB_DEVICE_ID_MATCH_INT_INFO,
|
|
+ .idVendor = 0x1B3B,
|
|
+ .idProduct = 0x2970,
|
|
+ .bInterfaceClass = USB_CLASS_VIDEO,
|
|
+ .bInterfaceSubClass = 1,
|
|
+ .bInterfaceProtocol = 0,
|
|
+ .driver_info = UVC_QUIRK_PROBE_MINMAX
|
|
+ | UVC_QUIRK_STREAM_NO_FID
|
|
+ | UVC_QUIRK_MOTION
|
|
+ | UVC_QUIRK_SINGLE_ISO },
|
|
/* Generic USB Video Class */
|
|
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_UNDEFINED) },
|
|
{ USB_INTERFACE_INFO(USB_CLASS_VIDEO, 1, UVC_PC_PROTOCOL_15) },
|
|
--- a/drivers/media/usb/uvc/uvc_status.c
|
|
+++ b/drivers/media/usb/uvc/uvc_status.c
|
|
@@ -228,6 +228,7 @@ static void uvc_status_complete(struct u
|
|
if (uvc_event_control(urb, dev->status, len))
|
|
/* The URB will be resubmitted in work context. */
|
|
return;
|
|
+ dev->motion = 1;
|
|
break;
|
|
}
|
|
|
|
@@ -274,6 +275,7 @@ int uvc_status_init(struct uvc_device *d
|
|
}
|
|
|
|
pipe = usb_rcvintpipe(dev->udev, ep->desc.bEndpointAddress);
|
|
+ dev->motion = 0;
|
|
|
|
/*
|
|
* For high-speed interrupt endpoints, the bInterval value is used as
|
|
--- a/drivers/media/usb/uvc/uvc_video.c
|
|
+++ b/drivers/media/usb/uvc/uvc_video.c
|
|
@@ -19,6 +19,11 @@
|
|
#include <linux/wait.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/unaligned.h>
|
|
+#include <linux/skbuff.h>
|
|
+#include <linux/kobject.h>
|
|
+#include <linux/netlink.h>
|
|
+#include <linux/kobject.h>
|
|
+#include <linux/workqueue.h>
|
|
|
|
#include <media/jpeg.h>
|
|
#include <media/v4l2-common.h>
|
|
@@ -1353,9 +1358,149 @@ static void uvc_video_decode_data(struct
|
|
uvc_urb->async_operations++;
|
|
}
|
|
|
|
+struct bh_priv {
|
|
+ unsigned long seen;
|
|
+};
|
|
+
|
|
+struct bh_event {
|
|
+ const char *name;
|
|
+ struct sk_buff *skb;
|
|
+ struct work_struct work;
|
|
+};
|
|
+
|
|
+#define BH_ERR(fmt, args...) printk(KERN_ERR "%s: " fmt, "webcam", ##args )
|
|
+#define BH_DBG(fmt, args...) do {} while (0)
|
|
+#define BH_SKB_SIZE 2048
|
|
+
|
|
+extern u64 uevent_next_seqnum(void);
|
|
+static int seen = 0;
|
|
+
|
|
+static int bh_event_add_var(struct bh_event *event, int argv,
|
|
+ const char *format, ...)
|
|
+{
|
|
+ static char buf[128];
|
|
+ char *s;
|
|
+ va_list args;
|
|
+ int len;
|
|
+
|
|
+ if (argv)
|
|
+ return 0;
|
|
+
|
|
+ va_start(args, format);
|
|
+ len = vsnprintf(buf, sizeof(buf), format, args);
|
|
+ va_end(args);
|
|
+
|
|
+ if (len >= sizeof(buf)) {
|
|
+ BH_ERR("buffer size too small\n");
|
|
+ WARN_ON(1);
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
+ s = skb_put(event->skb, len + 1);
|
|
+ strcpy(s, buf);
|
|
+
|
|
+ BH_DBG("added variable '%s'\n", s);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static int motion_hotplug_fill_event(struct bh_event *event)
|
|
+{
|
|
+ int s = jiffies;
|
|
+ int ret;
|
|
+
|
|
+ if (!seen)
|
|
+ seen = jiffies;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "HOME=%s", "/");
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "PATH=%s",
|
|
+ "/sbin:/bin:/usr/sbin:/usr/bin");
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "SUBSYSTEM=usb");
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "ACTION=motion");
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "SEEN=%d", s - seen);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+ seen = s;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "SEQNUM=%llu", uevent_next_seqnum());
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+static void motion_hotplug_work(struct work_struct *work)
|
|
+{
|
|
+ struct bh_event *event = container_of(work, struct bh_event, work);
|
|
+ int ret = 0;
|
|
+
|
|
+ event->skb = alloc_skb(BH_SKB_SIZE, GFP_KERNEL);
|
|
+ if (!event->skb)
|
|
+ goto out_free_event;
|
|
+
|
|
+ ret = bh_event_add_var(event, 0, "%s@", "add");
|
|
+ if (ret)
|
|
+ goto out_free_skb;
|
|
+
|
|
+ ret = motion_hotplug_fill_event(event);
|
|
+ if (ret)
|
|
+ goto out_free_skb;
|
|
+
|
|
+ NETLINK_CB(event->skb).dst_group = 1;
|
|
+ broadcast_uevent(event->skb, 0, 1, GFP_KERNEL);
|
|
+
|
|
+out_free_skb:
|
|
+ if (ret) {
|
|
+ BH_ERR("work error %d\n", ret);
|
|
+ kfree_skb(event->skb);
|
|
+ }
|
|
+out_free_event:
|
|
+ kfree(event);
|
|
+}
|
|
+
|
|
+static int motion_hotplug_create_event(void)
|
|
+{
|
|
+ struct bh_event *event;
|
|
+
|
|
+ event = kzalloc(sizeof(*event), GFP_KERNEL);
|
|
+ if (!event)
|
|
+ return -ENOMEM;
|
|
+
|
|
+ event->name = "motion";
|
|
+
|
|
+ INIT_WORK(&event->work, (void *)(void *)motion_hotplug_work);
|
|
+ schedule_work(&event->work);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+#define MOTION_FLAG_OFFSET 4
|
|
static void uvc_video_decode_end(struct uvc_streaming *stream,
|
|
struct uvc_buffer *buf, const u8 *data, int len)
|
|
{
|
|
+ if ((stream->dev->quirks & UVC_QUIRK_MOTION) &&
|
|
+ (data[len - 2] == 0xff) && (data[len - 1] == 0xd9)) {
|
|
+ u8 *mem;
|
|
+ buf->state = UVC_BUF_STATE_READY;
|
|
+ mem = (u8 *) (buf->mem + MOTION_FLAG_OFFSET);
|
|
+ if ( stream->dev->motion ) {
|
|
+ stream->dev->motion = 0;
|
|
+ motion_hotplug_create_event();
|
|
+ } else {
|
|
+ *mem &= 0x7f;
|
|
+ }
|
|
+ }
|
|
+
|
|
/* Mark the buffer as done if the EOF marker is set. */
|
|
if (data[1] & UVC_STREAM_EOF && buf->bytesused != 0) {
|
|
uvc_dbg(stream->dev, FRAME, "Frame complete (EOF found)\n");
|
|
@@ -1937,6 +2082,8 @@ static int uvc_init_video_isoc(struct uv
|
|
if (npackets == 0)
|
|
return -ENOMEM;
|
|
|
|
+ if (stream->dev->quirks & UVC_QUIRK_SINGLE_ISO)
|
|
+ npackets = 1;
|
|
size = npackets * psize;
|
|
|
|
for_each_uvc_urb(uvc_urb, stream) {
|
|
--- a/drivers/media/usb/uvc/uvcvideo.h
|
|
+++ b/drivers/media/usb/uvc/uvcvideo.h
|
|
@@ -77,6 +77,8 @@
|
|
#define UVC_QUIRK_DISABLE_AUTOSUSPEND 0x00008000
|
|
#define UVC_QUIRK_INVALID_DEVICE_SOF 0x00010000
|
|
#define UVC_QUIRK_MJPEG_NO_EOF 0x00020000
|
|
+#define UVC_QUIRK_MOTION 0x00040000
|
|
+#define UVC_QUIRK_SINGLE_ISO 0x00080000
|
|
|
|
/* Format flags */
|
|
#define UVC_FMT_FLAG_COMPRESSED 0x00000001
|
|
@@ -596,6 +598,7 @@ struct uvc_device {
|
|
|
|
struct input_dev *input;
|
|
char input_phys[64];
|
|
+ int motion;
|
|
|
|
struct uvc_ctrl_work {
|
|
struct work_struct work;
|