From 3a6b48013eeba99a874c978d9e94c27614e36101 Mon Sep 17 00:00:00 2001 From: Rudi Heitbaum Date: Sat, 23 Apr 2022 13:38:20 +0000 Subject: [PATCH] linux (Allwinner): upstreamed patches in 5.18 --- .../linux/0033-WIP-I2S-multi-channel.patch | 11 -- ...ower-reset-via-gpio-in-h5-btrtl-open.patch | 28 ---- ...drus-Add-watchdog-for-job-completion.patch | 123 ------------------ 3 files changed, 162 deletions(-) delete mode 100644 projects/Allwinner/patches/linux/0059-bluetooth-hci-h5-add-power-reset-via-gpio-in-h5-btrtl-open.patch delete mode 100644 projects/Allwinner/patches/linux/0089-media-cedrus-Add-watchdog-for-job-completion.patch diff --git a/projects/Allwinner/patches/linux/0033-WIP-I2S-multi-channel.patch b/projects/Allwinner/patches/linux/0033-WIP-I2S-multi-channel.patch index 10954bfc1f..c74a2a654e 100644 --- a/projects/Allwinner/patches/linux/0033-WIP-I2S-multi-channel.patch +++ b/projects/Allwinner/patches/linux/0033-WIP-I2S-multi-channel.patch @@ -30,17 +30,6 @@ Signed-off-by: Jernej Skrabec #define SUN8I_I2S_TX_CHAN_OFFSET_MASK GENMASK(13, 12) #define SUN8I_I2S_TX_CHAN_OFFSET(offset) ((offset) << 12) #define SUN8I_I2S_TX_CHAN_EN_MASK GENMASK(11, 4) -@@ -138,8 +138,8 @@ - #define SUN50I_H6_I2S_TX_CHAN_EN_MASK GENMASK(15, 0) - #define SUN50I_H6_I2S_TX_CHAN_EN(num_chan) (((1 << (num_chan)) - 1)) - --#define SUN50I_H6_I2S_TX_CHAN_MAP0_REG 0x44 --#define SUN50I_H6_I2S_TX_CHAN_MAP1_REG 0x48 -+#define SUN50I_H6_I2S_TX_CHAN_MAP0_REG(i) (0x44 + 8 * (i)) -+#define SUN50I_H6_I2S_TX_CHAN_MAP1_REG(i) (0x48 + 8 * (i)) - - #define SUN50I_H6_I2S_RX_CHAN_SEL_REG 0x64 - #define SUN50I_H6_I2S_RX_CHAN_MAP0_REG 0x68 @@ -189,7 +189,7 @@ struct sun4i_i2s_quirks { * @slots: channels per frame + padding slots, regardless of format * @slot_width: bits per sample + padding bits, regardless of format diff --git a/projects/Allwinner/patches/linux/0059-bluetooth-hci-h5-add-power-reset-via-gpio-in-h5-btrtl-open.patch b/projects/Allwinner/patches/linux/0059-bluetooth-hci-h5-add-power-reset-via-gpio-in-h5-btrtl-open.patch deleted file mode 100644 index daf6a2caac..0000000000 --- a/projects/Allwinner/patches/linux/0059-bluetooth-hci-h5-add-power-reset-via-gpio-in-h5-btrtl-open.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Vyacheslav Bocharov -Subject: [PATCH v3 2/2] Bluetooth: hci_h5: Add power reset via gpio in h5_btrtl_open -Date: Wed, 27 Oct 2021 12:14:16 +0300 - -Add power reset via enable-gpios in h5_btrtl_open function. - -Signed-off-by: Vyacheslav Bocharov ---- - drivers/bluetooth/hci_h5.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c -index 34286ffe0568..fdf504b0d265 100644 ---- a/drivers/bluetooth/hci_h5.c -+++ b/drivers/bluetooth/hci_h5.c -@@ -966,6 +966,11 @@ static void h5_btrtl_open(struct h5 *h5) - pm_runtime_enable(&h5->hu->serdev->dev); - } - -+ /* The controller needs reset to startup */ -+ gpiod_set_value_cansleep(h5->enable_gpio, 0); -+ gpiod_set_value_cansleep(h5->device_wake_gpio, 0); -+ msleep(100); -+ - /* The controller needs up to 500ms to wakeup */ - gpiod_set_value_cansleep(h5->enable_gpio, 1); - gpiod_set_value_cansleep(h5->device_wake_gpio, 1); diff --git a/projects/Allwinner/patches/linux/0089-media-cedrus-Add-watchdog-for-job-completion.patch b/projects/Allwinner/patches/linux/0089-media-cedrus-Add-watchdog-for-job-completion.patch deleted file mode 100644 index 7dcb3025c5..0000000000 --- a/projects/Allwinner/patches/linux/0089-media-cedrus-Add-watchdog-for-job-completion.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jernej Skrabec -Date: Tue, 1 Feb 2022 19:14:18 +0100 -Subject: [PATCH] media: cedrus: Add watchdog for job completion - -Currently, if job is not completed for whatever reason, userspace -application can hang on ioctl and thus become unkillable. - -In order to prevent that, implement watchdog, which will complete job -after 2 seconds with error state. - -Concept is borrowed from hantro driver. - -Signed-off-by: Jernej Skrabec ---- - drivers/staging/media/sunxi/cedrus/cedrus.c | 2 ++ - drivers/staging/media/sunxi/cedrus/cedrus.h | 3 +++ - .../staging/media/sunxi/cedrus/cedrus_dec.c | 4 +++ - .../staging/media/sunxi/cedrus/cedrus_hw.c | 25 +++++++++++++++++++ - .../staging/media/sunxi/cedrus/cedrus_hw.h | 2 ++ - 5 files changed, 36 insertions(+) - -diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c -index 4a4b714b0f26..68b3dcdb5df3 100644 ---- a/drivers/staging/media/sunxi/cedrus/cedrus.c -+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c -@@ -439,6 +439,8 @@ static int cedrus_probe(struct platform_device *pdev) - - mutex_init(&dev->dev_mutex); - -+ INIT_DELAYED_WORK(&dev->watchdog_work, cedrus_watchdog); -+ - ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); - if (ret) { - dev_err(&pdev->dev, "Failed to register V4L2 device\n"); -diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h -index c345f2984041..3bc094eb497f 100644 ---- a/drivers/staging/media/sunxi/cedrus/cedrus.h -+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h -@@ -24,6 +24,7 @@ - - #include - #include -+#include - - #define CEDRUS_NAME "cedrus" - -@@ -194,6 +195,8 @@ struct cedrus_dev { - struct reset_control *rstc; - - unsigned int capabilities; -+ -+ struct delayed_work watchdog_work; - }; - - extern struct cedrus_dec_ops cedrus_dec_ops_mpeg2; -diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c -index a16c1422558f..9c7200299465 100644 ---- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c -+++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c -@@ -97,4 +97,8 @@ void cedrus_device_run(void *priv) - v4l2_ctrl_request_complete(src_req, &ctx->hdl); - - dev->dec_ops[ctx->current_codec]->trigger(ctx); -+ -+ /* Start the watchdog timer. */ -+ schedule_delayed_work(&dev->watchdog_work, -+ msecs_to_jiffies(2000)); - } -diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c -index 2d7663726467..a6470a89851e 100644 ---- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c -+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c -@@ -118,6 +118,13 @@ static irqreturn_t cedrus_irq(int irq, void *data) - enum vb2_buffer_state state; - enum cedrus_irq_status status; - -+ /* -+ * If cancel_delayed_work returns false it means watchdog already -+ * executed and finished the job. -+ */ -+ if (!cancel_delayed_work(&dev->watchdog_work)) -+ return IRQ_HANDLED; -+ - ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev); - if (!ctx) { - v4l2_err(&dev->v4l2_dev, -@@ -143,6 +150,24 @@ static irqreturn_t cedrus_irq(int irq, void *data) - return IRQ_HANDLED; - } - -+void cedrus_watchdog(struct work_struct *work) -+{ -+ struct cedrus_dev *dev; -+ struct cedrus_ctx *ctx; -+ -+ dev = container_of(to_delayed_work(work), -+ struct cedrus_dev, watchdog_work); -+ -+ ctx = v4l2_m2m_get_curr_priv(dev->m2m_dev); -+ if (!ctx) -+ return; -+ -+ v4l2_err(&dev->v4l2_dev, "frame processing timed out!\n"); -+ reset_control_reset(dev->rstc); -+ v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx, -+ VB2_BUF_STATE_ERROR); -+} -+ - int cedrus_hw_suspend(struct device *device) - { - struct cedrus_dev *dev = dev_get_drvdata(device); -diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h -index 45f641f0bfa2..7c92f00e36da 100644 ---- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h -+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h -@@ -28,4 +28,6 @@ int cedrus_hw_resume(struct device *device); - int cedrus_hw_probe(struct cedrus_dev *dev); - void cedrus_hw_remove(struct cedrus_dev *dev); - -+void cedrus_watchdog(struct work_struct *work); -+ - #endif