mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
linux (Allwinner): update patches for 5.13
This commit is contained in:
@@ -37,10 +37,6 @@ esac
|
||||
|
||||
PKG_KERNEL_CFG_FILE=$(kernel_config_path) || die
|
||||
|
||||
if listcontains "${UBOOT_FIRMWARE}" "crust"; then
|
||||
PKG_PATCH_DIRS+=" crust"
|
||||
fi
|
||||
|
||||
if [ -n "${KERNEL_TOOLCHAIN}" ]; then
|
||||
PKG_DEPENDS_HOST+=" gcc-arm-${KERNEL_TOOLCHAIN}:host"
|
||||
PKG_DEPENDS_TARGET+=" gcc-arm-${KERNEL_TOOLCHAIN}:host"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
From 4cc652f2c660bd01bd0d8cefde272400cbe82fbe Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 16 Jan 2021 11:32:04 +0100
|
||||
Subject: [PATCH 1/2] ARM: dts: sun8i: h2-plus: bananapi-m2-zero: Increase BT
|
||||
UART speed
|
||||
|
||||
Bluetooth module on BananaPi M2 Zero can also be used for streaming
|
||||
audio. However, for that case higher UART speed is required.
|
||||
|
||||
Add a max-speed property.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
|
||||
@@ -125,6 +125,7 @@
|
||||
|
||||
bluetooth {
|
||||
compatible = "brcm,bcm43438-bt";
|
||||
+ max-speed = <1500000>;
|
||||
clocks = <&rtc 1>;
|
||||
clock-names = "lpo";
|
||||
vbat-supply = <®_vcc3v3>;
|
||||
@@ -1,51 +0,0 @@
|
||||
From aa47c3b292cb0ffcf2c00b2a12c477ec3027a729 Mon Sep 17 00:00:00 2001
|
||||
From: PJBrs <pjbrs@floorenpj.xs4all.nl>
|
||||
Date: Sat, 16 Jan 2021 11:39:45 +0100
|
||||
Subject: [PATCH 2/2] ARM: dts: sunxi: h2-plus-bananapi-m2-zero: Add HDMI out
|
||||
|
||||
Add HDMI out, including the display engine, to the BananaPi M2 Zero.
|
||||
---
|
||||
.../dts/sun8i-h2-plus-bananapi-m2-zero.dts | 25 +++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-h2-plus-bananapi-m2-zero.dts
|
||||
@@ -26,6 +26,17 @@
|
||||
stdout-path = "serial0:115200n8";
|
||||
};
|
||||
|
||||
+ connector {
|
||||
+ compatible = "hdmi-connector";
|
||||
+ type = "a";
|
||||
+
|
||||
+ port {
|
||||
+ hdmi_con_in: endpoint {
|
||||
+ remote-endpoint = <&hdmi_out_con>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
|
||||
@@ -107,6 +118,20 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&de {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi_out {
|
||||
+ hdmi_out_con: endpoint {
|
||||
+ remote-endpoint = <&hdmi_con_in>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&ohci0 {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
From 54b5c2cb4fc87ca72daa662423d4d969f3b5edb8 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 16 Jan 2021 11:49:57 +0100
|
||||
Subject: [PATCH] ARM: dts: sunxi: bananapi-m2-plus: Increase BT UART speed
|
||||
|
||||
Bluetooth module on BananaPi M2 Plus can also be used for streaming
|
||||
audio. However, for that case higher UART speed is required.
|
||||
|
||||
Add a max-speed property.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi
|
||||
+++ b/arch/arm/boot/dts/sunxi-bananapi-m2-plus.dtsi
|
||||
@@ -219,6 +219,7 @@
|
||||
|
||||
bluetooth {
|
||||
compatible = "brcm,bcm43438-bt";
|
||||
+ max-speed = <1500000>;
|
||||
clocks = <&rtc 1>;
|
||||
clock-names = "lpo";
|
||||
vbat-supply = <®_vcc3v3>;
|
||||
@@ -35,7 +35,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
soc {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <1>;
|
||||
@@ -652,7 +670,6 @@
|
||||
@@ -655,7 +673,6 @@
|
||||
dmas = <&dma 4>, <&dma 4>;
|
||||
resets = <&ccu RST_BUS_I2S1>;
|
||||
dma-names = "rx", "tx";
|
||||
@@ -43,7 +43,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
};
|
||||
|
||||
spdif: spdif@5093000 {
|
||||
@@ -785,6 +802,7 @@
|
||||
@@ -792,6 +809,7 @@
|
||||
};
|
||||
|
||||
hdmi: hdmi@6000000 {
|
||||
|
||||
@@ -22,7 +22,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||
@@ -549,12 +549,10 @@ static int sun8i_dwmac_init(struct platf
|
||||
@@ -571,12 +571,10 @@ static int sun8i_dwmac_init(struct platf
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
int ret;
|
||||
|
||||
@@ -39,7 +39,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(gmac->tx_clk);
|
||||
@@ -1021,8 +1019,7 @@ static void sun8i_dwmac_exit(struct plat
|
||||
@@ -1045,8 +1043,7 @@ static void sun8i_dwmac_exit(struct plat
|
||||
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
|
||||
@@ -49,7 +49,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
}
|
||||
|
||||
static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
|
||||
@@ -1150,12 +1147,12 @@ static int sun8i_dwmac_probe(struct plat
|
||||
@@ -1174,12 +1171,12 @@ static int sun8i_dwmac_probe(struct plat
|
||||
}
|
||||
|
||||
/* Optional regulator for PHY */
|
||||
|
||||
@@ -47,7 +47,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
struct reset_control *rst_ephy;
|
||||
const struct emac_variant *variant;
|
||||
struct regmap_field *regmap_field;
|
||||
@@ -549,9 +551,9 @@ static int sun8i_dwmac_init(struct platf
|
||||
@@ -571,9 +573,9 @@ static int sun8i_dwmac_init(struct platf
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
int ret;
|
||||
|
||||
@@ -59,7 +59,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -572,8 +574,7 @@ static int sun8i_dwmac_init(struct platf
|
||||
@@ -594,8 +596,7 @@ static int sun8i_dwmac_init(struct platf
|
||||
err_disable_clk:
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
err_disable_regulator:
|
||||
@@ -69,7 +69,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1019,7 +1020,7 @@ static void sun8i_dwmac_exit(struct plat
|
||||
@@ -1043,7 +1044,7 @@ static void sun8i_dwmac_exit(struct plat
|
||||
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
|
||||
@@ -78,7 +78,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
}
|
||||
|
||||
static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
|
||||
@@ -1147,11 +1148,9 @@ static int sun8i_dwmac_probe(struct plat
|
||||
@@ -1171,11 +1172,9 @@ static int sun8i_dwmac_probe(struct plat
|
||||
}
|
||||
|
||||
/* Optional regulator for PHY */
|
||||
|
||||
@@ -34,7 +34,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
struct reset_control *rst_ephy;
|
||||
const struct emac_variant *variant;
|
||||
struct regmap_field *regmap_field;
|
||||
@@ -551,10 +554,16 @@ static int sun8i_dwmac_init(struct platf
|
||||
@@ -573,10 +576,16 @@ static int sun8i_dwmac_init(struct platf
|
||||
struct sunxi_priv_data *gmac = priv;
|
||||
int ret;
|
||||
|
||||
@@ -52,7 +52,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(gmac->tx_clk);
|
||||
@@ -575,6 +584,8 @@ err_disable_clk:
|
||||
@@ -597,6 +606,8 @@ err_disable_clk:
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
err_disable_regulator:
|
||||
regulator_disable(gmac->regulator_phy);
|
||||
@@ -61,7 +61,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -1021,6 +1032,7 @@ static void sun8i_dwmac_exit(struct plat
|
||||
@@ -1045,6 +1056,7 @@ static void sun8i_dwmac_exit(struct plat
|
||||
clk_disable_unprepare(gmac->tx_clk);
|
||||
|
||||
regulator_disable(gmac->regulator_phy);
|
||||
@@ -69,7 +69,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
}
|
||||
|
||||
static void sun8i_dwmac_set_mac_loopback(void __iomem *ioaddr, bool enable)
|
||||
@@ -1154,6 +1166,15 @@ static int sun8i_dwmac_probe(struct plat
|
||||
@@ -1178,6 +1190,15 @@ static int sun8i_dwmac_probe(struct plat
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||
&mmc0 {
|
||||
vmmc-supply = <®_cldo1>;
|
||||
cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||
@@ -207,6 +246,7 @@
|
||||
@@ -211,6 +250,7 @@
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-name = "vcc33-audio-tv-ephy-mac";
|
||||
|
||||
@@ -28,7 +28,7 @@ Reviewed-by: Chen-Yu Tsai <wens@csie.org>
|
||||
&emac {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&ext_rgmii_pins>;
|
||||
@@ -331,3 +335,8 @@
|
||||
@@ -332,3 +336,8 @@
|
||||
usb3_vbus-supply = <®_usb_vbus>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -76,7 +76,7 @@ Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
/omit-if-no-ref/
|
||||
spi0_pins: spi0-pins {
|
||||
pins = "PC0", "PC2", "PC3";
|
||||
@@ -640,6 +671,31 @@
|
||||
@@ -643,6 +674,31 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ Signed-off-by: Alejandro González <alejandro.gonzalez.correo@gmail.com>
|
||||
|
||||
--- a/drivers/mmc/host/sunxi-mmc.c
|
||||
+++ b/drivers/mmc/host/sunxi-mmc.c
|
||||
@@ -1398,14 +1398,17 @@ static int sunxi_mmc_probe(struct platfo
|
||||
@@ -1421,14 +1421,17 @@ static int sunxi_mmc_probe(struct platfo
|
||||
|
||||
/*
|
||||
* Some H5 devices do not have signal traces precise enough to
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Thu, 29 Oct 2020 21:04:24 +0100
|
||||
Subject: [PATCH] pineh64 model b - bluetooth wip
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../dts/allwinner/sun50i-h6-pine-h64-model-b.dts | 16 ++++++++++++++++
|
||||
drivers/bluetooth/hci_h5.c | 3 +++
|
||||
2 files changed, 19 insertions(+)
|
||||
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64-model-b.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-pine-h64-model-b.dts
|
||||
@@ -34,3 +34,19 @@
|
||||
non-removable;
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+&uart1 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||
+ uart-has-rtscts;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ bluetooth {
|
||||
+ compatible = "realtek,rtl8723bs-bt";
|
||||
+ device-wakeup-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */
|
||||
+ host-wakeup-gpios = <&r_pio 1 1 GPIO_ACTIVE_HIGH>; /* PM1 */
|
||||
+ enable-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */
|
||||
+ firmware-postfix = "OBDA8723";
|
||||
+ max-speed = <1500000>;
|
||||
+ };
|
||||
+};
|
||||
--- a/drivers/bluetooth/hci_h5.c
|
||||
+++ b/drivers/bluetooth/hci_h5.c
|
||||
@@ -820,6 +820,9 @@ static int h5_serdev_probe(struct serdev
|
||||
if (!data)
|
||||
return -ENODEV;
|
||||
|
||||
+ of_property_read_string(dev->of_node,
|
||||
+ "firmware-postfix", &h5->id);
|
||||
+
|
||||
h5->vnd = (const struct h5_vnd *)data;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,9 @@ Bluetooth: hci0: RTL: loading rtl_bt/rtl8822cs_config.bin
|
||||
.../dts/allwinner/sun50i-h6-tanix-tx6.dts | 32 +++++++++++++++++++
|
||||
1 file changed, 48 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts
|
||||
index 5233ad1488..06e7820fd9 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts
|
||||
@@ -47,12 +47,29 @@ reg_vcc3v3: vcc3v3 {
|
||||
@@ -47,12 +47,29 @@
|
||||
regulator-max-microvolt = <3300000>;
|
||||
};
|
||||
|
||||
@@ -63,7 +61,7 @@ index 5233ad1488..06e7820fd9 100644
|
||||
};
|
||||
|
||||
&ac200_pwm_clk {
|
||||
@@ -122,6 +139,22 @@ &mmc0 {
|
||||
@@ -122,6 +139,22 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -86,7 +84,7 @@ index 5233ad1488..06e7820fd9 100644
|
||||
&mmc2 {
|
||||
vmmc-supply = <®_vcc3v3>;
|
||||
vqmmc-supply = <®_vcc1v8>;
|
||||
@@ -158,6 +191,21 @@ &uart0 {
|
||||
@@ -158,6 +191,21 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -108,6 +106,3 @@ index 5233ad1488..06e7820fd9 100644
|
||||
&usb2otg {
|
||||
dr_mode = "host";
|
||||
status = "okay";
|
||||
--
|
||||
2.29.2
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,40 +0,0 @@
|
||||
From 9a7e6c2d8a18a24b013c1ad165ed04bb7d2c7716 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Tue, 25 Aug 2020 19:35:22 +0200
|
||||
Subject: [PATCH 01/44] media: cedrus: Add support for R40
|
||||
|
||||
Video engine in R40 is very similar to that in A33 but it runs on lower
|
||||
speed, at least according to OS images released by board designer.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
Link: https://lore.kernel.org/r/20200825173523.1289379-5-jernej.skrabec@siol.net
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.c | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
@@ -508,6 +508,11 @@ static const struct cedrus_variant sun8i
|
||||
.mod_rate = 402000000,
|
||||
};
|
||||
|
||||
+static const struct cedrus_variant sun8i_r40_cedrus_variant = {
|
||||
+ .capabilities = CEDRUS_CAPABILITY_UNTILED,
|
||||
+ .mod_rate = 297000000,
|
||||
+};
|
||||
+
|
||||
static const struct cedrus_variant sun50i_a64_cedrus_variant = {
|
||||
.capabilities = CEDRUS_CAPABILITY_UNTILED |
|
||||
CEDRUS_CAPABILITY_H265_DEC,
|
||||
@@ -549,6 +554,10 @@ static const struct of_device_id cedrus_
|
||||
.data = &sun8i_h3_cedrus_variant,
|
||||
},
|
||||
{
|
||||
+ .compatible = "allwinner,sun8i-r40-video-engine",
|
||||
+ .data = &sun8i_r40_cedrus_variant,
|
||||
+ },
|
||||
+ {
|
||||
.compatible = "allwinner,sun50i-a64-video-engine",
|
||||
.data = &sun50i_a64_cedrus_variant,
|
||||
},
|
||||
@@ -139,8 +139,8 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
return rc;
|
||||
--- a/drivers/clk/clk.c
|
||||
+++ b/drivers/clk/clk.c
|
||||
@@ -4188,6 +4188,37 @@ void devm_clk_hw_unregister(struct devic
|
||||
EXPORT_SYMBOL_GPL(devm_clk_hw_unregister);
|
||||
@@ -4271,6 +4271,37 @@ struct clk *devm_clk_hw_get_clk(struct d
|
||||
EXPORT_SYMBOL_GPL(devm_clk_hw_get_clk);
|
||||
|
||||
/*
|
||||
+ * clk-conf helpers
|
||||
@@ -1,99 +0,0 @@
|
||||
From f710d6403b7716d7a5319e51c4cb3c217ec85b73 Mon Sep 17 00:00:00 2001
|
||||
From: Sean Young <sean@mess.org>
|
||||
Date: Tue, 10 Nov 2020 09:30:38 +0100
|
||||
Subject: [PATCH 02/44] media: sunxi-cir: allow timeout to be set at runtime
|
||||
|
||||
This allows the timeout to be set with the LIRC_SET_REC_TIMEOUT ioctl.
|
||||
|
||||
The timeout was hardcoded at just over 20ms, but returned 120ms when
|
||||
queried with the LIRC_GET_REC_TIMEOUT ioctl.
|
||||
|
||||
This also ensures the idle threshold is set correctly with a base clock
|
||||
other than 8Mhz.
|
||||
|
||||
Acked-by: Maxime Ripard <mripard@kernel.org>
|
||||
Signed-off-by: Sean Young <sean@mess.org>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
|
||||
---
|
||||
drivers/media/rc/sunxi-cir.c | 48 ++++++++++++++++++++++++++++++------
|
||||
1 file changed, 40 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/drivers/media/rc/sunxi-cir.c
|
||||
+++ b/drivers/media/rc/sunxi-cir.c
|
||||
@@ -73,10 +73,6 @@
|
||||
#define SUNXI_IR_BASE_CLK 8000000
|
||||
/* Noise threshold in samples */
|
||||
#define SUNXI_IR_RXNOISE 1
|
||||
-/* Idle Threshold in samples */
|
||||
-#define SUNXI_IR_RXIDLE 20
|
||||
-/* Time after which device stops sending data in ms */
|
||||
-#define SUNXI_IR_TIMEOUT 120
|
||||
|
||||
/**
|
||||
* struct sunxi_ir_quirks - Differences between SoC variants.
|
||||
@@ -146,6 +142,41 @@ static irqreturn_t sunxi_ir_irq(int irqn
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
+/* Convert idle threshold to usec */
|
||||
+static unsigned int sunxi_ithr_to_usec(unsigned int base_clk, unsigned int ithr)
|
||||
+{
|
||||
+ return DIV_ROUND_CLOSEST(USEC_PER_SEC * (ithr + 1),
|
||||
+ base_clk / (128 * 64));
|
||||
+}
|
||||
+
|
||||
+/* Convert usec to idle threshold */
|
||||
+static unsigned int sunxi_usec_to_ithr(unsigned int base_clk, unsigned int usec)
|
||||
+{
|
||||
+ /* make sure we don't end up with a timeout less than requested */
|
||||
+ return DIV_ROUND_UP((base_clk / (128 * 64)) * usec, USEC_PER_SEC) - 1;
|
||||
+}
|
||||
+
|
||||
+static int sunxi_ir_set_timeout(struct rc_dev *rc_dev, unsigned int timeout)
|
||||
+{
|
||||
+ struct sunxi_ir *ir = rc_dev->priv;
|
||||
+ unsigned int base_clk = clk_get_rate(ir->clk);
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ unsigned int ithr = sunxi_usec_to_ithr(base_clk, timeout);
|
||||
+
|
||||
+ dev_dbg(rc_dev->dev.parent, "setting idle threshold to %u\n", ithr);
|
||||
+
|
||||
+ spin_lock_irqsave(&ir->ir_lock, flags);
|
||||
+ /* Set noise threshold and idle threshold */
|
||||
+ writel(REG_CIR_NTHR(SUNXI_IR_RXNOISE) | REG_CIR_ITHR(ithr),
|
||||
+ ir->base + SUNXI_IR_CIR_REG);
|
||||
+ spin_unlock_irqrestore(&ir->ir_lock, flags);
|
||||
+
|
||||
+ rc_dev->timeout = sunxi_ithr_to_usec(base_clk, ithr);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static int sunxi_ir_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -242,9 +273,11 @@ static int sunxi_ir_probe(struct platfor
|
||||
ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
|
||||
ir->rc->dev.parent = dev;
|
||||
ir->rc->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
|
||||
- /* Frequency after IR internal divider with sample period in ns */
|
||||
+ /* Frequency after IR internal divider with sample period in us */
|
||||
ir->rc->rx_resolution = (USEC_PER_SEC / (b_clk_freq / 64));
|
||||
- ir->rc->timeout = MS_TO_US(SUNXI_IR_TIMEOUT);
|
||||
+ ir->rc->min_timeout = sunxi_ithr_to_usec(b_clk_freq, 0);
|
||||
+ ir->rc->max_timeout = sunxi_ithr_to_usec(b_clk_freq, 255);
|
||||
+ ir->rc->s_timeout = sunxi_ir_set_timeout;
|
||||
ir->rc->driver_name = SUNXI_IR_DEV;
|
||||
|
||||
ret = rc_register_device(ir->rc);
|
||||
@@ -272,8 +305,7 @@ static int sunxi_ir_probe(struct platfor
|
||||
writel(REG_CTL_MD, ir->base+SUNXI_IR_CTL_REG);
|
||||
|
||||
/* Set noise threshold and idle threshold */
|
||||
- writel(REG_CIR_NTHR(SUNXI_IR_RXNOISE)|REG_CIR_ITHR(SUNXI_IR_RXIDLE),
|
||||
- ir->base + SUNXI_IR_CIR_REG);
|
||||
+ sunxi_ir_set_timeout(ir->rc, IR_DEFAULT_TIMEOUT);
|
||||
|
||||
/* Invert Input Signal */
|
||||
writel(REG_RXCTL_RPPI, ir->base + SUNXI_IR_RXCTL_REG);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user