crazycat: remove AML hacks

This commit is contained in:
CvH 2018-08-26 17:25:32 +02:00
parent 01b97a80c2
commit 17cc22483a
16 changed files with 3 additions and 502 deletions

View File

@ -20,10 +20,8 @@ PKG_ADDON_NAME="DVB drivers for TBS (CrazyCat)"
PKG_ADDON_TYPE="xbmc.service"
PKG_ADDON_VERSION="${ADDON_VERSION}.${PKG_REV}"
if [ $LINUX = "amlogic-3.10" ]; then
PKG_PATCH_DIRS="amlogic-3.10"
elif [ $LINUX = "amlogic-3.14" ]; then
PKG_PATCH_DIRS="amlogic-3.14"
if [ $LINUX = "rockchip-4.4" ]; then
PKG_PATCH_DIRS="rockchip"
fi
pre_make_target() {
@ -46,13 +44,7 @@ make_target() {
fi
# hack to workaround media_build bug
if [ $LINUX = "amlogic-3.14" -o $LINUX = "amlogic-3.10" ]; then
sed -e 's/CONFIG_VIDEO_TVP5150=m/# CONFIG_VIDEO_TVP5150 is not set/g' -i v4l/.config
sed -e 's/CONFIG_DVB_LGDT3306A=m/# CONFIG_DVB_LGDT3306A is not set/g' -i v4l/.config
if [ $LINUX = "amlogic-3.10" ]; then
sed -e 's/CONFIG_IR_NUVOTON=m/# CONFIG_IR_NUVOTON is not set/g' -i v4l/.config
fi
elif [ "$PROJECT" = Rockchip ]; then
if [ "$PROJECT" = Rockchip ]; then
sed -e 's/CONFIG_DVB_CXD2820R=m/# CONFIG_DVB_CXD2820R is not set/g' -i v4l/.config
sed -e 's/CONFIG_DVB_LGDT3306A=m/# CONFIG_DVB_LGDT3306A is not set/g' -i v4l/.config
fi

View File

@ -1,13 +0,0 @@
diff -Naur a/backports/backports.txt b/backports/backports.txt
--- a/backports/backports.txt 2017-12-30 22:14:58.000000000 +0200
+++ b/backports/backports.txt 2018-02-23 13:50:01.327967293 +0200
@@ -21,6 +21,9 @@
# All supported versions need those patches
[9.255.255]
+add linux-301-AML-videobuf-resource.patch
+add linux-302-AML-amlogic-video-dev.patch
+add linux-303-AML-meson-ir.patch
add api_version.patch
add pr_fmt.patch
add debug.patch

View File

@ -1,11 +0,0 @@
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -1588,7 +1588,7 @@
#endif
#ifdef NEED_WRITEL_RELAXED
-#define writel_relaxed writel
+// #define writel_relaxed writel
#endif
#ifdef NEED_GET_USER_PAGES_UNLOCKED

View File

@ -1,12 +0,0 @@
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -92,9 +92,6 @@ ifneq ($(filter $(no-makefile-media-targets), $(MAKECMDGOALS)),)
endif
makefile-mm := 1
-ifeq ($(wildcard ../linux/mm/frame_vector.c),)
- makefile-mm := 0
-endif
# If version not yet detected, we can't create/have these files yet
ifeq ($(KERNELRELEASE),)

View File

@ -1,18 +0,0 @@
diff -Naur a/linux/Makefile b/linux/Makefile
--- a/linux/Makefile 2017-12-30 22:01:38.000000000 +0200
+++ b/linux/Makefile 2018-02-23 13:25:54.025763853 +0200
@@ -112,6 +112,14 @@
untar: linux-media.tar.bz2
tar xfj linux-media.tar.bz2
+ mkdir -p drivers/media/amlogic/
+ # Copy amlvideodri module
+ cp -a "$(SRCDIR)/drivers/amlogic/video_dev" "drivers/media/amlogic"
+ sed -i 's,common/,,g; s,"trace/,",g' `find drivers/media/amlogic/video_dev/ -type f`
+ # Copy videobuf-res module
+ cp -a "$(SRCDIR)/drivers/media/v4l2-core/videobuf-res.c" "drivers/media/v4l2-core/"
+ cp -a "$(SRCDIR)/include/media/videobuf-res.h" "include/media/"
+
-rm -f .patches_applied .linked_dir .git_log.md5
clean:

View File

@ -1,16 +0,0 @@
diff -Naur a/backports/backports.txt b/backports/backports.txt
--- a/backports/backports.txt 2017-12-30 22:14:58.000000000 +0200
+++ b/backports/backports.txt 2018-02-23 13:50:01.327967293 +0200
@@ -21,6 +21,12 @@
# All supported versions need those patches
[9.255.255]
+add linux-301-AML-videobuf-resource.patch
+add linux-302-AML-amlogic-video-dev.patch
+add linux-303-AML-meson-ir.patch
+add linux-304-AML-wetekplay.patch
+add linux-305-AML-dmx_h.patch
+add linux-306-AML-build-dvb-avl.patch
add api_version.patch
add pr_fmt.patch
add debug.patch

View File

@ -1,11 +0,0 @@
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -1588,7 +1588,7 @@
#endif
#ifdef NEED_WRITEL_RELAXED
-#define writel_relaxed writel
+// #define writel_relaxed writel
#endif
#ifdef NEED_GET_USER_PAGES_UNLOCKED

View File

@ -1,12 +0,0 @@
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -92,9 +92,6 @@ ifneq ($(filter $(no-makefile-media-targets), $(MAKECMDGOALS)),)
endif
makefile-mm := 1
-ifeq ($(wildcard ../linux/mm/frame_vector.c),)
- makefile-mm := 0
-endif
# If version not yet detected, we can't create/have these files yet
ifeq ($(KERNELRELEASE),)

View File

@ -1,25 +0,0 @@
diff -Naur a/linux/Makefile b/linux/Makefile
--- a/linux/Makefile 2017-12-30 22:01:38.000000000 +0200
+++ b/linux/Makefile 2018-02-23 13:25:54.025763853 +0200
@@ -112,6 +112,21 @@
untar: linux-media.tar.bz2
tar xfj linux-media.tar.bz2
+ mkdir -p drivers/media/amlogic/
+ # Copy amlvideodri module
+ cp -a "$(SRCDIR)/drivers/amlogic/video_dev" "drivers/media/amlogic"
+ sed -i 's,common/,,g; s,"trace/,",g' `find drivers/media/amlogic/video_dev/ -type f`
+ # Copy videobuf-res module
+ cp -a "$(SRCDIR)/drivers/media/v4l2-core/videobuf-res.c" "drivers/media/v4l2-core/"
+ cp -a "$(SRCDIR)/include/media/videobuf-res.h" "include/media/"
+
+ # Copy WeTek Play DVB driver
+ cp -a "$(SRCDIR)/drivers/amlogic/wetek" "drivers/media/amlogic"
+
+ # Copy dvb-avl driver
+ cp -a $(SRCDIR)/drivers/amlogic/dvb-avl "drivers/media"
+ echo "obj-y += dvb-avl/" >> "drivers/media/Makefile"
+
-rm -f .patches_applied .linked_dir .git_log.md5
clean:

View File

@ -1,11 +0,0 @@
--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -1456,7 +1456,6 @@
#endif
#ifdef NEED_SMP_MB_AFTER_ATOMIC
-#define smp_mb__after_atomic smp_mb__after_clear_bit
#endif
#ifdef NEED_DEVM_KMALLOC_ARRAY

View File

@ -1,23 +0,0 @@
--- a/drivers/media/v4l2-core/Kconfig
+++ b/drivers/media/v4l2-core/Kconfig
@@ -73,6 +73,10 @@
depends on HAS_DMA
select VIDEOBUF_GEN
+config VIDEOBUF_RESOURCE
+ select VIDEOBUF_GEN
+ tristate
+
config VIDEOBUF_DVB
tristate
select VIDEOBUF_GEN
--- a/drivers/media/v4l2-core/Makefile
+++ b/drivers/media/v4l2-core/Makefile
@@ -33,6 +33,7 @@
obj-$(CONFIG_VIDEOBUF_DMA_CONTIG) += videobuf-dma-contig.o
obj-$(CONFIG_VIDEOBUF_VMALLOC) += videobuf-vmalloc.o
obj-$(CONFIG_VIDEOBUF_DVB) += videobuf-dvb.o
+obj-$(CONFIG_VIDEOBUF_RESOURCE) += videobuf-res.o
obj-$(CONFIG_VIDEOBUF2_CORE) += videobuf2-core.o videobuf2-v4l2.o
obj-$(CONFIG_VIDEOBUF2_MEMOPS) += videobuf2-memops.o

View File

@ -1,39 +0,0 @@
--- a/drivers/media/Kconfig
+++ b/drivers/media/Kconfig
@@ -235,5 +235,6 @@ source "drivers/media/i2c/Kconfig"
source "drivers/media/spi/Kconfig"
source "drivers/media/tuners/Kconfig"
source "drivers/media/dvb-frontends/Kconfig"
+source "drivers/media/amlogic/Kconfig"
endif # MEDIA_SUPPORT
--- a/drivers/media/Makefile
+++ b/drivers/media/Makefile
@@ -25,7 +25,7 @@
obj-y += rc/
obj-$(CONFIG_CEC_CORE) += cec/
-
+obj-y += amlogic/
#
# Finally, merge the drivers that require the core
#
--- /dev/null
+++ b/drivers/media/amlogic/Kconfig
@@ -0,0 +1,8 @@
+#
+# Amlogic driver configuration
+#
+menu "Amlogic Device Drivers"
+
+source "drivers/media/amlogic/video_dev/Kconfig"
+
+endmenu
--- /dev/null
+++ b/drivers/media/amlogic/Makefile
@@ -0,0 +1,5 @@
+##########################################
+########## Amlogic Drivers ###############
+##########################################
+
+obj-$(CONFIG_V4L_AMLOGIC_VIDEO) += video_dev/

View File

@ -1,216 +0,0 @@
--- a/drivers/media/rc/meson-ir.c
+++ b/drivers/media/rc/meson-ir.c
@@ -20,6 +20,7 @@
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/bitfield.h>
+#include <linux/pinctrl/consumer.h>
#include <media/rc-core.h>
@@ -69,6 +70,7 @@
void __iomem *reg;
struct rc_dev *rc;
spinlock_t lock;
+ struct timer_list flush_timer;
};
static void meson_ir_set_mask(struct meson_ir *ir, unsigned int reg,
@@ -98,6 +100,10 @@
rawir.pulse = !!(status & STATUS_IR_DEC_IN);
ir_raw_event_store(ir->rc, &rawir);
+
+ mod_timer(&ir->flush_timer,
+ jiffies + nsecs_to_jiffies(ir->rc->timeout));
+
ir_raw_event_handle(ir->rc);
spin_unlock(&ir->lock);
@@ -105,6 +111,17 @@
return IRQ_HANDLED;
}
+static void flush_timer(unsigned long arg)
+{
+ struct meson_ir *ir = (struct meson_ir *)arg;
+ DEFINE_IR_RAW_EVENT(rawir);
+
+ rawir.timeout = true;
+ rawir.duration = ir->rc->timeout;
+ ir_raw_event_store(ir->rc, &rawir);
+ ir_raw_event_handle(ir->rc);
+}
+
static int meson_ir_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -113,6 +130,7 @@
const char *map_name;
struct meson_ir *ir;
int irq, ret;
+ struct pinctrl *pinctrl;
ir = devm_kzalloc(dev, sizeof(struct meson_ir), GFP_KERNEL);
if (!ir)
@@ -125,6 +143,14 @@
return PTR_ERR(ir->reg);
}
+ if (of_get_property(node, "pinctrl-names", NULL)) {
+ pinctrl = devm_pinctrl_get_select_default(dev);
+ if (IS_ERR(pinctrl)) {
+ dev_err(dev, "failed to get pinctrl\n");
+ ret = PTR_ERR(pinctrl);
+ }
+ }
+
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(dev, "no irq resource\n");
@@ -145,7 +171,9 @@
ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY;
ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
ir->rc->rx_resolution = US_TO_NS(MESON_TRATE);
+ ir->rc->min_timeout = 1;
ir->rc->timeout = MS_TO_NS(200);
+ ir->rc->max_timeout = MS_TO_NS(1000);
ir->rc->driver_name = DRIVER_NAME;
spin_lock_init(&ir->lock);
@@ -157,6 +185,8 @@
return ret;
}
+ setup_timer(&ir->flush_timer, flush_timer, (unsigned long) ir);
+
ret = devm_request_irq(dev, irq, meson_ir_irq, 0, NULL, ir);
if (ret) {
dev_err(dev, "failed to request irq\n");
@@ -197,6 +227,7 @@
spin_lock_irqsave(&ir->lock, flags);
meson_ir_set_mask(ir, IR_DEC_REG1, REG1_ENABLE, 0);
spin_unlock_irqrestore(&ir->lock, flags);
+ del_timer_sync(&ir->flush_timer);
return 0;
}
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -238,7 +238,6 @@
config IR_MESON
tristate "Amlogic Meson IR remote receiver"
depends on RC_CORE
- depends on ARCH_MESON || COMPILE_TEST
---help---
Say Y if you want to use the IR remote receiver available
on Amlogic Meson SoCs.
--- /dev/null
+++ b/include/linux/bitfield.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2014 Felix Fietkau <nbd@nbd.name>
+ * Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _LINUX_BITFIELD_H
+#define _LINUX_BITFIELD_H
+
+#include <linux/bug.h>
+
+/*
+ * Bitfield access macros
+ *
+ * FIELD_{GET,PREP} macros take as first parameter shifted mask
+ * from which they extract the base mask and shift amount.
+ * Mask must be a compilation time constant.
+ *
+ * Example:
+ *
+ * #define REG_FIELD_A GENMASK(6, 0)
+ * #define REG_FIELD_B BIT(7)
+ * #define REG_FIELD_C GENMASK(15, 8)
+ * #define REG_FIELD_D GENMASK(31, 16)
+ *
+ * Get:
+ * a = FIELD_GET(REG_FIELD_A, reg);
+ * b = FIELD_GET(REG_FIELD_B, reg);
+ *
+ * Set:
+ * reg = FIELD_PREP(REG_FIELD_A, 1) |
+ * FIELD_PREP(REG_FIELD_B, 0) |
+ * FIELD_PREP(REG_FIELD_C, c) |
+ * FIELD_PREP(REG_FIELD_D, 0x40);
+ *
+ * Modify:
+ * reg &= ~REG_FIELD_C;
+ * reg |= FIELD_PREP(REG_FIELD_C, c);
+ */
+
+#define __bf_shf(x) (__builtin_ffsll(x) - 1)
+
+#define __BF_FIELD_CHECK(_mask, _reg, _val, _pfx) \
+ ({ \
+ BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), \
+ _pfx "mask is not constant"); \
+ BUILD_BUG_ON_MSG(!(_mask), _pfx "mask is zero"); \
+ BUILD_BUG_ON_MSG(__builtin_constant_p(_val) ? \
+ ~((_mask) >> __bf_shf(_mask)) & (_val) : 0, \
+ _pfx "value too large for the field"); \
+ BUILD_BUG_ON_MSG((_mask) > (typeof(_reg))~0ull, \
+ _pfx "type of reg too small for mask"); \
+ __BUILD_BUG_ON_NOT_POWER_OF_2((_mask) + \
+ (1ULL << __bf_shf(_mask))); \
+ })
+
+/**
+ * FIELD_FIT() - check if value fits in the field
+ * @_mask: shifted mask defining the field's length and position
+ * @_val: value to test against the field
+ *
+ * Return: true if @_val can fit inside @_mask, false if @_val is too big.
+ */
+#define FIELD_FIT(_mask, _val) \
+ ({ \
+ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_FIT: "); \
+ !((((typeof(_mask))_val) << __bf_shf(_mask)) & ~(_mask)); \
+ })
+
+/**
+ * FIELD_PREP() - prepare a bitfield element
+ * @_mask: shifted mask defining the field's length and position
+ * @_val: value to put in the field
+ *
+ * FIELD_PREP() masks and shifts up the value. The result should
+ * be combined with other fields of the bitfield using logical OR.
+ */
+#define FIELD_PREP(_mask, _val) \
+ ({ \
+ __BF_FIELD_CHECK(_mask, 0ULL, _val, "FIELD_PREP: "); \
+ ((typeof(_mask))(_val) << __bf_shf(_mask)) & (_mask); \
+ })
+
+/**
+ * FIELD_GET() - extract a bitfield element
+ * @_mask: shifted mask defining the field's length and position
+ * @_reg: 32bit value of entire bitfield
+ *
+ * FIELD_GET() extracts the field specified by @_mask from the
+ * bitfield passed in as @_reg by masking and shifting it down.
+ */
+#define FIELD_GET(_mask, _reg) \
+ ({ \
+ __BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
+ (typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
+ })
+
+#endif

View File

@ -1,21 +0,0 @@
diff --git a/drivers/media/amlogic/Kconfig b/drivers/media/amlogic/Kconfig
index 5203702..7af18b7 100644
--- a/drivers/media/amlogic/Kconfig
+++ b/drivers/media/amlogic/Kconfig
@@ -5,4 +5,6 @@ menu "Amlogic Device Drivers"
source "drivers/media/amlogic/video_dev/Kconfig"
+source "drivers/media/amlogic/wetek/Kconfig"
+
endmenu
diff --git a/drivers/media/amlogic/Makefile b/drivers/media/amlogic/Makefile
index 049cb81..99bbb31 100644
--- a/drivers/media/amlogic/Makefile
+++ b/drivers/media/amlogic/Makefile
@@ -3,3 +3,5 @@
##########################################
obj-$(CONFIG_V4L_AMLOGIC_VIDEO) += video_dev/
+
+obj-$(CONFIG_WETEK) += wetek/

View File

@ -1,24 +0,0 @@
--- a/include/uapi/linux/dvb/dmx.h 2017-01-23 18:15:29.000000000 +0100
+++ b/include/uapi/linux/dvb/dmx.h 2017-02-08 14:12:07.802477417 +0100
@@ -197,6 +197,20 @@
__u32 flags;
};
+typedef enum dmx_source {
+ DMX_SOURCE_FRONT0 = 0,
+ DMX_SOURCE_FRONT1,
+ DMX_SOURCE_FRONT2,
+ DMX_SOURCE_FRONT3,
+ DMX_SOURCE_DVR0 = 16,
+ DMX_SOURCE_DVR1,
+ DMX_SOURCE_DVR2,
+ DMX_SOURCE_DVR3,
+ DMX_SOURCE_FRONT0_OFFSET = 100,
+ DMX_SOURCE_FRONT1_OFFSET,
+ DMX_SOURCE_FRONT2_OFFSET
+} dmx_source_t;
+
/**
* struct dmx_stc - Stores System Time Counter (STC) information.
*
--

View File

@ -1,39 +0,0 @@
--- a/drivers/media/dvb-avl/aml_dmx.c 2017-12-10 19:34:57.000000000 +0100
+++ b/drivers/media/dvb-avl/aml_dmx.c 2017-12-12 12:55:21.255063140 +0100
@@ -547,7 +547,7 @@
struct dvb_demux_feed *feed = dmx->channel[f->chan_id].feed;
if (feed && feed->cb.sec)
- feed->cb.sec(p, sec_len, NULL, 0, f->filter, DMX_OK);
+ feed->cb.sec(p, sec_len, NULL, 0, f->filter);
}
static void hardware_match_section(struct aml_dmx *dmx,
@@ -968,7 +968,7 @@
if (dmx->channel[2].feed && dmx->channel[2].feed->cb.ts) {
dmx->channel[2].feed->cb.ts(buffer1_virt, len1,
buffer2_virt, len2,
- &dmx->channel[2].feed->feed.ts, DMX_OK);
+ &dmx->channel[2].feed->feed.ts);
}
}
WRITE_MPEG_REG(PARSER_SUB_RP, rd_ptr);
@@ -1167,7 +1167,7 @@
channel->dvr_feed->cb.ts(
(u8 *)afifo->pages+afifo->buf_read*size,
cnt*size, NULL, 0,
- &channel->dvr_feed->feed.ts, DMX_OK);
+ &channel->dvr_feed->feed.ts);
afifo->buf_read = 0;
}
@@ -1186,7 +1186,7 @@
channel->dvr_feed->cb.ts(
(u8 *)afifo->pages+afifo->buf_read*size,
cnt*size, NULL, 0,
- &channel->dvr_feed->feed.ts, DMX_OK);
+ &channel->dvr_feed->feed.ts);
afifo->buf_read = afifo->buf_toggle;
}
--