mirror of
https://github.com/Fishwaldo/build.git
synced 2025-07-07 21:48:53 +00:00
switch to 5.4.y
This commit is contained in:
parent
1a4c152fc6
commit
aafb70a9a3
189 changed files with 1212088 additions and 222 deletions
|
@ -14,13 +14,22 @@ case $BRANCH in
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dev|current)
|
current)
|
||||||
|
|
||||||
KERNELSOURCE="https://github.com/megous/linux"
|
KERNELSOURCE="https://github.com/megous/linux"
|
||||||
KERNELBRANCH="branch:orange-pi-5.3"
|
KERNELBRANCH="branch:orange-pi-5.3"
|
||||||
KERNELPATCHDIR='sunxi-'$BRANCH
|
KERNELPATCHDIR='sunxi-'$BRANCH
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
dev)
|
||||||
|
|
||||||
|
BOOTBRANCH='tag:v2019.10'
|
||||||
|
KERNELSOURCE="https://github.com/megous/linux"
|
||||||
|
KERNELBRANCH="branch:orange-pi-5.4"
|
||||||
|
KERNELPATCHDIR='sunxi-'$BRANCH
|
||||||
|
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
family_tweaks()
|
family_tweaks()
|
||||||
|
|
|
@ -16,13 +16,22 @@ case $BRANCH in
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
dev|current)
|
current)
|
||||||
|
|
||||||
KERNELSOURCE="https://github.com/megous/linux"
|
KERNELSOURCE="https://github.com/megous/linux"
|
||||||
KERNELBRANCH="branch:orange-pi-5.3"
|
KERNELBRANCH="branch:orange-pi-5.3"
|
||||||
KERNELPATCHDIR='sunxi-dev'
|
KERNELPATCHDIR='sunxi-dev'
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
dev)
|
||||||
|
|
||||||
|
BOOTBRANCH='tag:v2019.10'
|
||||||
|
KERNELSOURCE="https://github.com/megous/linux"
|
||||||
|
KERNELBRANCH="branch:orange-pi-5.4"
|
||||||
|
KERNELPATCHDIR='sunxi-dev'
|
||||||
|
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
family_tweaks()
|
family_tweaks()
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
sunxi-current
|
|
229
patch/kernel/sunxi-dev/0000-axp-adjustements.patch.disabled
Normal file
229
patch/kernel/sunxi-dev/0000-axp-adjustements.patch.disabled
Normal file
|
@ -0,0 +1,229 @@
|
||||||
|
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
|
||||||
|
index 44097a3e0..a0cbdbb2c 100644
|
||||||
|
--- a/drivers/leds/Kconfig
|
||||||
|
+++ b/drivers/leds/Kconfig
|
||||||
|
@@ -756,6 +756,14 @@ config LEDS_NIC78BX
|
||||||
|
To compile this driver as a module, choose M here: the module
|
||||||
|
will be called leds-nic78bx.
|
||||||
|
|
||||||
|
+config LEDS_AXP20X
|
||||||
|
+ tristate "LED support for AXP20X-like PMICs (AXP813, ...)"
|
||||||
|
+ depends on LEDS_CLASS && MFD_AXP20X
|
||||||
|
+ help
|
||||||
|
+ This option enables support for on-chip LED drivers on
|
||||||
|
+ AXP20X-like PMICs.
|
||||||
|
+
|
||||||
|
+
|
||||||
|
comment "LED Triggers"
|
||||||
|
source "drivers/leds/trigger/Kconfig"
|
||||||
|
|
||||||
|
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
|
||||||
|
index 420b5d2cf..a8149fb6e 100644
|
||||||
|
--- a/drivers/leds/Makefile
|
||||||
|
+++ b/drivers/leds/Makefile
|
||||||
|
@@ -78,6 +78,7 @@ obj-$(CONFIG_LEDS_MT6323) += leds-mt6323.o
|
||||||
|
obj-$(CONFIG_LEDS_LM3692X) += leds-lm3692x.o
|
||||||
|
obj-$(CONFIG_LEDS_SC27XX_BLTC) += leds-sc27xx-bltc.o
|
||||||
|
obj-$(CONFIG_LEDS_LM3601X) += leds-lm3601x.o
|
||||||
|
+obj-$(CONFIG_LEDS_AXP20X) += leds-axp20x.o
|
||||||
|
|
||||||
|
# LED SPI Drivers
|
||||||
|
obj-$(CONFIG_LEDS_CR0014114) += leds-cr0014114.o
|
||||||
|
diff --git a/drivers/leds/leds-axp20x.c b/drivers/leds/leds-axp20x.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..de33c1d83
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/leds/leds-axp20x.c
|
||||||
|
@@ -0,0 +1,138 @@
|
||||||
|
+/*
|
||||||
|
+ * LED Driver for X-Powers AXP813 PMIC.
|
||||||
|
+ *
|
||||||
|
+ * Copyright(c) 2017 Ondrej Jirman <megous@megous.com>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify it
|
||||||
|
+ * under the terms of the GNU General Public License as published by the
|
||||||
|
+ * Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
+ * option) any later version.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/platform_device.h>
|
||||||
|
+#include <linux/leds.h>
|
||||||
|
+#include <linux/slab.h>
|
||||||
|
+#include <linux/of.h>
|
||||||
|
+#include <linux/of_device.h>
|
||||||
|
+#include <linux/mfd/axp20x.h>
|
||||||
|
+
|
||||||
|
+#define AXP813_CHGLED_CTRL_MASK BIT(3)
|
||||||
|
+#define AXP813_CHGLED_CTRL_CHARGER BIT(3)
|
||||||
|
+#define AXP813_CHGLED_CTRL_USER 0
|
||||||
|
+
|
||||||
|
+#define AXP813_CHGLED_USER_STATE_MASK GENMASK(5, 4)
|
||||||
|
+#define AXP813_CHGLED_USER_STATE_OFFSET 4
|
||||||
|
+#define AXP813_CHGLED_USER_STATE_OFF 0
|
||||||
|
+#define AXP813_CHGLED_USER_STATE_BLINK_SLOW 1
|
||||||
|
+#define AXP813_CHGLED_USER_STATE_BLINK_FAST 2
|
||||||
|
+#define AXP813_CHGLED_USER_STATE_ON 3
|
||||||
|
+
|
||||||
|
+struct axp20x_led {
|
||||||
|
+ struct led_classdev cdev;
|
||||||
|
+ struct regmap *regmap;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int axp20x_led_set(struct led_classdev *led_cdev,
|
||||||
|
+ enum led_brightness value)
|
||||||
|
+{
|
||||||
|
+ struct axp20x_led *led =
|
||||||
|
+ container_of(led_cdev, struct axp20x_led, cdev);
|
||||||
|
+ unsigned int val;
|
||||||
|
+
|
||||||
|
+ val = value == LED_OFF ? AXP813_CHGLED_USER_STATE_OFF :
|
||||||
|
+ AXP813_CHGLED_USER_STATE_ON;
|
||||||
|
+
|
||||||
|
+ return regmap_update_bits(led->regmap, AXP20X_OFF_CTRL,
|
||||||
|
+ AXP813_CHGLED_USER_STATE_MASK,
|
||||||
|
+ val << AXP813_CHGLED_USER_STATE_OFFSET);
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int axp20x_led_probe(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct axp20x_dev *axp20x;
|
||||||
|
+ struct axp20x_led *led;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ if (!of_device_is_available(pdev->dev.of_node))
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
+ axp20x = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
+ if (!axp20x)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ led = devm_kzalloc(&pdev->dev,
|
||||||
|
+ sizeof(struct axp20x_led),
|
||||||
|
+ GFP_KERNEL);
|
||||||
|
+ if (!led)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ led->regmap = axp20x->regmap;
|
||||||
|
+
|
||||||
|
+ led->cdev.name = "chgled";
|
||||||
|
+ led->cdev.brightness_set_blocking = axp20x_led_set;
|
||||||
|
+ led->cdev.brightness = LED_OFF;
|
||||||
|
+ led->cdev.max_brightness = 1;
|
||||||
|
+
|
||||||
|
+ ret = led_classdev_register(pdev->dev.parent, &led->cdev);
|
||||||
|
+ if (ret) {
|
||||||
|
+ dev_err(&pdev->dev, "Failed to register led %s\n",
|
||||||
|
+ led->cdev.name);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = regmap_update_bits(led->regmap, AXP20X_OFF_CTRL,
|
||||||
|
+ AXP813_CHGLED_CTRL_MASK,
|
||||||
|
+ AXP813_CHGLED_CTRL_USER);
|
||||||
|
+ if (ret) {
|
||||||
|
+ dev_err(&pdev->dev, "Failed to enable user cnotrol\n");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = axp20x_led_set(&led->cdev, led->cdev.brightness);
|
||||||
|
+ if (ret) {
|
||||||
|
+ dev_err(&pdev->dev, "Failed to init led %s\n",
|
||||||
|
+ led->cdev.name);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ platform_set_drvdata(pdev, led);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int axp20x_led_remove(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct axp20x_led *led = platform_get_drvdata(pdev);
|
||||||
|
+
|
||||||
|
+ axp20x_led_set(&led->cdev, LED_OFF);
|
||||||
|
+
|
||||||
|
+ regmap_update_bits(led->regmap, AXP20X_OFF_CTRL,
|
||||||
|
+ AXP813_CHGLED_CTRL_MASK,
|
||||||
|
+ AXP813_CHGLED_CTRL_CHARGER);
|
||||||
|
+
|
||||||
|
+ led_classdev_unregister(&led->cdev);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct of_device_id axp20x_leds_of_match[] = {
|
||||||
|
+ { .compatible = "x-powers,axp813-leds", },
|
||||||
|
+ { },
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(of, axp20x_leds_of_match);
|
||||||
|
+
|
||||||
|
+static struct platform_driver axp20x_led_driver = {
|
||||||
|
+ .driver = {
|
||||||
|
+ .name = "axp20x-leds",
|
||||||
|
+ .of_match_table = axp20x_leds_of_match,
|
||||||
|
+ },
|
||||||
|
+ .probe = axp20x_led_probe,
|
||||||
|
+ .remove = axp20x_led_remove,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+module_platform_driver(axp20x_led_driver);
|
||||||
|
+
|
||||||
|
+MODULE_AUTHOR("Ondrej Jirman <megous@megous.com>");
|
||||||
|
+MODULE_DESCRIPTION("LED driver for AXP813 PMIC");
|
||||||
|
+MODULE_LICENSE("GPL");
|
||||||
|
+MODULE_ALIAS("platform:leds-axp20x");
|
||||||
|
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
|
||||||
|
index 0be511dd9..a9bdf3cdd 100644
|
||||||
|
--- a/drivers/mfd/axp20x.c
|
||||||
|
+++ b/drivers/mfd/axp20x.c
|
||||||
|
@@ -24,6 +24,7 @@
|
||||||
|
#include <linux/pm_runtime.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
#include <linux/regulator/consumer.h>
|
||||||
|
+#include <linux/regulator/userspace-consumer.h>
|
||||||
|
#include <linux/mfd/axp20x.h>
|
||||||
|
#include <linux/mfd/core.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
|
@@ -130,6 +131,7 @@ static const struct regmap_range axp288_volatile_ranges[] = {
|
||||||
|
regmap_reg_range(AXP288_BC_GLOBAL, AXP288_BC_GLOBAL),
|
||||||
|
regmap_reg_range(AXP288_BC_DET_STAT, AXP288_BC_DET_STAT),
|
||||||
|
regmap_reg_range(AXP20X_CHRG_BAK_CTRL, AXP20X_CHRG_BAK_CTRL),
|
||||||
|
+ regmap_reg_range(AXP22X_CHRG_CTRL3, AXP22X_CHRG_CTRL3),
|
||||||
|
regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L),
|
||||||
|
regmap_reg_range(AXP20X_TIMER_CTRL, AXP20X_TIMER_CTRL),
|
||||||
|
regmap_reg_range(AXP22X_GPIO_STATE, AXP22X_GPIO_STATE),
|
||||||
|
@@ -762,6 +764,16 @@ static const struct mfd_cell axp809_cells[] = {
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
+static struct regulator_bulk_data vcc_vb = {
|
||||||
|
+ .supply = "vcc-vb",
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct regulator_userspace_consumer_data vcc_vb_data = {
|
||||||
|
+ .name = "vcc-vb",
|
||||||
|
+ .num_supplies = 1,
|
||||||
|
+ .supplies = &vcc_vb,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static const struct mfd_cell axp813_cells[] = {
|
||||||
|
{
|
||||||
|
.name = "axp221-pek",
|
||||||
|
@@ -778,6 +790,16 @@ static const struct mfd_cell axp813_cells[] = {
|
||||||
|
}, {
|
||||||
|
.name = "axp20x-battery-power-supply",
|
||||||
|
.of_compatible = "x-powers,axp813-battery-power-supply",
|
||||||
|
+ }, {
|
||||||
|
+ .name = "axp20x-usb-power-supply",
|
||||||
|
+ .of_compatible = "x-powers,axp813-usb-power-supply",
|
||||||
|
+ }, {
|
||||||
|
+ .name = "axp20x-leds",
|
||||||
|
+ .of_compatible = "x-powers,axp813-leds",
|
||||||
|
+ }, {
|
||||||
|
+ .name = "reg-userspace-consumer",
|
||||||
|
+ .platform_data = &vcc_vb_data,
|
||||||
|
+ .pdata_size = sizeof(vcc_vb_data),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,346 @@
|
||||||
|
From 6eb4890e1b83490864f18d3926182069e54a4dfb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ondrej Jirman <megous@megous.com>
|
||||||
|
Date: Sun, 12 Nov 2017 23:09:14 +0100
|
||||||
|
Subject: [PATCH] sound: soc: ac100-codec: Initial implementation
|
||||||
|
|
||||||
|
This driver provides AC100 codec controls.
|
||||||
|
|
||||||
|
Note: This does not yet provide anything, it's just a skeleton
|
||||||
|
for a future driver.
|
||||||
|
|
||||||
|
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||||
|
---
|
||||||
|
sound/soc/sunxi/Kconfig | 11 ++
|
||||||
|
sound/soc/sunxi/Makefile | 1 +
|
||||||
|
sound/soc/sunxi/ac100-codec.c | 291 ++++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 303 insertions(+)
|
||||||
|
create mode 100644 sound/soc/sunxi/ac100-codec.c
|
||||||
|
|
||||||
|
diff --git a/sound/soc/sunxi/Kconfig b/sound/soc/sunxi/Kconfig
|
||||||
|
index 22408bc2d6ec6..e276cc94a8c5e 100644
|
||||||
|
--- a/sound/soc/sunxi/Kconfig
|
||||||
|
+++ b/sound/soc/sunxi/Kconfig
|
||||||
|
@@ -20,6 +20,17 @@ config SND_SUN8I_CODEC
|
||||||
|
|
||||||
|
Say Y or M if you want to add sun8i digital audio codec support.
|
||||||
|
|
||||||
|
+config SND_AC100_CODEC
|
||||||
|
+ tristate "Allwinner (X-Powers) AC100 audio codec"
|
||||||
|
+ depends on OF
|
||||||
|
+ depends on MACH_SUN8I || COMPILE_TEST
|
||||||
|
+ select REGMAP_MMIO
|
||||||
|
+ help
|
||||||
|
+ This option enables the audio codec support for Allwinner (X-Powers)
|
||||||
|
+ AC100 chip.
|
||||||
|
+
|
||||||
|
+ Say Y or M if you want to add AC100 audio codec support.
|
||||||
|
+
|
||||||
|
config SND_SUN8I_CODEC_ANALOG
|
||||||
|
tristate "Allwinner sun8i Codec Analog Controls Support"
|
||||||
|
depends on MACH_SUN8I || (ARM64 && ARCH_SUNXI) || COMPILE_TEST
|
||||||
|
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
|
||||||
|
index 4a9ef67386caf..83461fdbfaa2a 100644
|
||||||
|
--- a/sound/soc/sunxi/Makefile
|
||||||
|
+++ b/sound/soc/sunxi/Makefile
|
||||||
|
@@ -4,3 +4,4 @@ obj-$(CONFIG_SND_SUN4I_I2S) += sun4i-i2s.o
|
||||||
|
obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
|
||||||
|
obj-$(CONFIG_SND_SUN8I_CODEC_ANALOG) += sun8i-codec-analog.o
|
||||||
|
obj-$(CONFIG_SND_SUN8I_CODEC) += sun8i-codec.o
|
||||||
|
+obj-$(CONFIG_SND_AC100_CODEC) += ac100-codec.o
|
||||||
|
diff --git a/sound/soc/sunxi/ac100-codec.c b/sound/soc/sunxi/ac100-codec.c
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000..d5438815be754
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sound/soc/sunxi/ac100-codec.c
|
||||||
|
@@ -0,0 +1,291 @@
|
||||||
|
+/*
|
||||||
|
+ * This driver supports the controls for X-Powers (Allwinner)
|
||||||
|
+ * AC100 audio codec. This codec is co-packaged with AXP81x PMICs.
|
||||||
|
+ *
|
||||||
|
+ * (C) Copyright 2017 Ondrej Jirman <megous@megous.com>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or modify
|
||||||
|
+ * it under the terms of the GNU General Public License as published by
|
||||||
|
+ * the Free Software Foundation; either version 2 of the License, or
|
||||||
|
+ * (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/delay.h>
|
||||||
|
+#include <linux/clk.h>
|
||||||
|
+#include <linux/io.h>
|
||||||
|
+#include <linux/pm_runtime.h>
|
||||||
|
+#include <linux/regmap.h>
|
||||||
|
+#include <linux/mfd/ac100.h>
|
||||||
|
+
|
||||||
|
+#include <sound/pcm_params.h>
|
||||||
|
+#include <sound/soc.h>
|
||||||
|
+#include <sound/soc-dapm.h>
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Reasearch
|
||||||
|
+ * ---------
|
||||||
|
+ *
|
||||||
|
+ * Features:
|
||||||
|
+ * 2 A/D
|
||||||
|
+ * 2 D/A
|
||||||
|
+ * 2 I2S/PCM #1 and #2
|
||||||
|
+ * 1 PCM mono #3 muxable with I2S #2
|
||||||
|
+ * 3 mic inputs (mic #2 and #3 exclusively muxable at input)
|
||||||
|
+ * 1 line in (directly or through amp)
|
||||||
|
+ * 1 aux input
|
||||||
|
+ * all input signals mixable directly into output (bypass AD/DA)
|
||||||
|
+ *
|
||||||
|
+ * outputs:
|
||||||
|
+ * HPOUTL - headphone left
|
||||||
|
+ * HPOUTR - headphone right
|
||||||
|
+ * LINEOUT - line out differential
|
||||||
|
+ * EAROUT - earpeiece differential
|
||||||
|
+ * SPKOUT1 - SPOL left speaker differnetial
|
||||||
|
+ * SPKOUT2 - SPOR right speaker differnetial
|
||||||
|
+ *
|
||||||
|
+ * Power up:
|
||||||
|
+ * LDOIN - 1.5-3.3V external power
|
||||||
|
+ * AVCC - analog power 3V
|
||||||
|
+ * CPVDD - 1.8V
|
||||||
|
+ * VDD-IO1 - power for I2S #1 and #2 1.8/3V
|
||||||
|
+ * VDD-IO2 - power for I2S #3 1.8/3V
|
||||||
|
+ * VCC-RTC - power for RTC 1.8/3V
|
||||||
|
+ *
|
||||||
|
+ * Clocks: page 28
|
||||||
|
+ * SYSCLK must be 24576000 Hz (48kHz) or 22579200 Hz (44.1kHz)
|
||||||
|
+ * - Source I2S1CLK/MCLK1
|
||||||
|
+ * - If SRC# module is used SYSCLK must be generated by PLL
|
||||||
|
+ *
|
||||||
|
+ * A/D:
|
||||||
|
+ * ADC_APC_CTRL B15 B11 enable/disable A/D to save power
|
||||||
|
+ * ADC_APC_CTRL B14-12 B10-8 volume control for A/D
|
||||||
|
+ * ADC_DIG_CTRL B15 enable/disable digital A/D to save power
|
||||||
|
+ * ADDA_FS_I2S1 ADDA_FS_I2S2 - select sample rate
|
||||||
|
+ *
|
||||||
|
+ * D/A:
|
||||||
|
+ * OMIXER_DACA_CTRL B15-14 enable/disable D/A channels
|
||||||
|
+ * DAC_DIG_CTRL B15 enable/disable digital D/A
|
||||||
|
+ *
|
||||||
|
+ * Mixer:
|
||||||
|
+ * - 2 channels DAC Output mixers
|
||||||
|
+ * - inputs:
|
||||||
|
+ * - LINEINL/R
|
||||||
|
+ * - AXIL/R
|
||||||
|
+ * - MIC1P/N,MIC2P/N
|
||||||
|
+ * - Stereo DAC output
|
||||||
|
+ * - 2 channels ADC Record mixers
|
||||||
|
+ * - inputs:
|
||||||
|
+ * - LINEINL/R
|
||||||
|
+ * - AXIL/R
|
||||||
|
+ * - MIC1P/N,MIC2P/N
|
||||||
|
+ * - Stereo DAC output
|
||||||
|
+ * - Digital mixers
|
||||||
|
+ * - avaliable on:
|
||||||
|
+ * - before stereo DAC - DAC_MXR_SRC
|
||||||
|
+ * - I2S1 output - I2S1_MXR_SRC
|
||||||
|
+ * - I2S2 output - I2S2_MXR_SRC
|
||||||
|
+ * - Analogue inputs
|
||||||
|
+ * - LINEINL/R - 1 ch. mono
|
||||||
|
+ * - can be mixed into ADC record mixer or DAC output mixer
|
||||||
|
+ * - -9dB to 12dB in 1.5dB step by LINEIN_DIFF_PREG
|
||||||
|
+ * - AXIL/R - 2 ch. stereo
|
||||||
|
+ * - can be mixed into ADC record mixer or DAC output mixer
|
||||||
|
+ * - programmable volume level adj. and mute
|
||||||
|
+ * - -9dB to 12dB in 1.5dB steps by AXI_PREG
|
||||||
|
+ * - MIC1P/N - has preamp
|
||||||
|
+ * - MIC2P/N - has preamp
|
||||||
|
+ * - MIC3P/N - has preamp muxed with MIC2 (sel by ADC_SRCBST_CTRL B7)
|
||||||
|
+ * - can be mixed into ADC record mixer or DAC output mixer
|
||||||
|
+ * - preamps enable at ADC_SRCBST_CTRL B15 and B11
|
||||||
|
+ * - preamp gain at MIC1BOOST MIC2BOOST
|
||||||
|
+ * - Analogue outputs:
|
||||||
|
+ * - HPOUTL/R, HPOUTFB - 2ch. headphones
|
||||||
|
+ * - sources output mixer or directly from DAC
|
||||||
|
+ * - sel HPOUT_CTRL B15 B14
|
||||||
|
+ * - mute HPOUT_CTRL B13 B12
|
||||||
|
+ * - power amp
|
||||||
|
+ * - powerdown/up HPOUT_CTRL B11
|
||||||
|
+ * - volume HP_VOL[5:0] - 64dB range in 1dB step from 0dB to -62dB
|
||||||
|
+ * - mute by using 0 for HP_VOL[5:0]
|
||||||
|
+ * - DC offset cancellation (POP noise) HP_DCRM_EN
|
||||||
|
+ * - This bit must be set 0xf before headphone PA enabled, and this bit
|
||||||
|
+ * must be set 0x0 before headphone PA disabled.
|
||||||
|
+ * - zero cross to prevent noise/clicsk on volume change ZCROSS_EN
|
||||||
|
+ * - SPOLP/N, SPORP/N 2 ch. speakers (mono/stereo)
|
||||||
|
+ * - source for SPOLP
|
||||||
|
+ * - left output mixer or (left+right) output mixer
|
||||||
|
+ * - source for SPORP
|
||||||
|
+ * - right output mixer or (left+right) output mixer
|
||||||
|
+ * - volume 43.5dB rang in 1.5dB step from -43.5dB to 0dB
|
||||||
|
+ * - amp enable SPKOUT_CTRL B11 B7
|
||||||
|
+ * - EAROUTP/N - 1 ch earpeice
|
||||||
|
+ * - source left DAC, right DAC, left output mixer or right output mixer
|
||||||
|
+ * - volume ERPOUT_CTRL[4:0] 43.5dB range in 1.5dB step from -43.5dB to 0dB
|
||||||
|
+ * - power amp enable ERPOUT_CTRL B5
|
||||||
|
+ * - LINEOUTP/N - 1ch line out
|
||||||
|
+ * - source MIC1 preamp, MIC2 preamp, left output mix or right output mix
|
||||||
|
+ * - volume 10.5dB range in 1.5dB step from -4.5dB to 6dB
|
||||||
|
+ * - out buffer power up/down LOUT_CTRL B4
|
||||||
|
+ *
|
||||||
|
+ * Jack insert detection:
|
||||||
|
+ * - HBIAS current detection
|
||||||
|
+ * - 5bit ADC sample rate 16/32/64/128Hz
|
||||||
|
+ * - HMIC_STATUS[12:8] - ADC value
|
||||||
|
+ * - 2 thresholds TH1 for plug connection, TH2 for key press
|
||||||
|
+ * - can periodically trigger interrupts during key press (HBIAS above TH2)
|
||||||
|
+ *
|
||||||
|
+ * Interrupts:
|
||||||
|
+ * - FALLING_EDGE
|
||||||
|
+ * - for:
|
||||||
|
+ * - KEYDOWN
|
||||||
|
+ * - KEYUP
|
||||||
|
+ * - PLUG_IN
|
||||||
|
+ * - PLUG_OUT
|
||||||
|
+ * - HMIC_DATA
|
||||||
|
+ *
|
||||||
|
+ * High Pass Filter:
|
||||||
|
+ * - remove DC offset, can be disabled
|
||||||
|
+ *
|
||||||
|
+ * AGC:
|
||||||
|
+ * - automatic gain control before ADC input channels
|
||||||
|
+ * - params:
|
||||||
|
+ * - attack, decay time - 32/fs to 2^15*32/fs
|
||||||
|
+ * - target gain - –1dB to –30dB relative to a full-scale signal
|
||||||
|
+ * - noise threshold - –30dB to –90dB of full-scale (mute if input below this level)
|
||||||
|
+ * - max gain 0dB to 40dB in steps of 0.5dB
|
||||||
|
+ * - hysteresis - for noise detection in terms of signal level
|
||||||
|
+ * - debounce time - hysteresis for noise det in terms of time
|
||||||
|
+ * - also provides some output flags:
|
||||||
|
+ * - noise threshold reached
|
||||||
|
+ * - current gain
|
||||||
|
+ * - agc saturated (gain could get higher for the given input, but limited by
|
||||||
|
+ * params)
|
||||||
|
+ * - adc saturated - clipping at ADC input stage
|
||||||
|
+ *
|
||||||
|
+ * DRC:
|
||||||
|
+ * - dynamic range control for digital playback path
|
||||||
|
+ * - energy filter
|
||||||
|
+ * - compressor
|
||||||
|
+ * - smooth filter
|
||||||
|
+ * - can be disabled
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#define AC100_HMIC_DATA_MASK GENMASK(12, 8)
|
||||||
|
+#define AC100_HMIC_DATA_OFF 8
|
||||||
|
+#define AC100_HMIC_PULLOUT_PENDING BIT(4)
|
||||||
|
+#define AC100_HMIC_PLUGIN_PENDING BIT(3)
|
||||||
|
+#define AC100_HMIC_KEYUP_PENDING BIT(2)
|
||||||
|
+#define AC100_HMIC_KEYDOWN_PENDING BIT(1)
|
||||||
|
+#define AC100_HMIC_DATA_PENDING BIT(0)
|
||||||
|
+
|
||||||
|
+struct ac100_codec {
|
||||||
|
+ struct device *dev;
|
||||||
|
+ struct regmap *regmap;
|
||||||
|
+ int irq;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static irqreturn_t ac100_codec_irq(int irq, void *data)
|
||||||
|
+{
|
||||||
|
+ struct ac100_codec *codec = data;
|
||||||
|
+ unsigned int val = 0;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ /* read status */
|
||||||
|
+ ret = regmap_read(codec->regmap, AC100_HMIC_STATUS, &val);
|
||||||
|
+ if (ret)
|
||||||
|
+ return IRQ_HANDLED;
|
||||||
|
+
|
||||||
|
+ if (val & AC100_HMIC_PULLOUT_PENDING) {
|
||||||
|
+ dev_info(codec->dev, "IRQ: Pull out");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (val & AC100_HMIC_PLUGIN_PENDING) {
|
||||||
|
+ dev_info(codec->dev, "IRQ: Plug in");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (val & AC100_HMIC_KEYUP_PENDING) {
|
||||||
|
+ dev_info(codec->dev, "IRQ: Key up");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (val & AC100_HMIC_KEYDOWN_PENDING) {
|
||||||
|
+ dev_info(codec->dev, "IRQ: Key down");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (val & AC100_HMIC_DATA_PENDING) {
|
||||||
|
+ dev_info(codec->dev, "IRQ: Data");
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* clear status */
|
||||||
|
+ ret = regmap_write(codec->regmap, AC100_HMIC_STATUS, 0);
|
||||||
|
+ if (ret)
|
||||||
|
+ return IRQ_HANDLED;
|
||||||
|
+
|
||||||
|
+ return IRQ_HANDLED;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int ac100_codec_probe(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct ac100_dev *ac100 = dev_get_drvdata(pdev->dev.parent);
|
||||||
|
+ struct ac100_codec *codec;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ codec = devm_kzalloc(&pdev->dev, sizeof(*codec), GFP_KERNEL);
|
||||||
|
+ if (!codec)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ platform_set_drvdata(pdev, codec);
|
||||||
|
+ codec->dev = &pdev->dev;
|
||||||
|
+ codec->regmap = ac100->regmap;
|
||||||
|
+
|
||||||
|
+ codec->irq = platform_get_irq(pdev, 0);
|
||||||
|
+ if (codec->irq < 0) {
|
||||||
|
+ dev_err(&pdev->dev, "No IRQ resource\n");
|
||||||
|
+ return codec->irq;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = devm_request_threaded_irq(&pdev->dev, codec->irq, NULL,
|
||||||
|
+ ac100_codec_irq,
|
||||||
|
+ IRQF_SHARED | IRQF_ONESHOT,
|
||||||
|
+ dev_name(&pdev->dev), codec);
|
||||||
|
+ if (ret) {
|
||||||
|
+ dev_err(&pdev->dev, "Could not request IRQ\n");
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int ac100_codec_remove(struct platform_device *pdev)
|
||||||
|
+{
|
||||||
|
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
|
||||||
|
+ struct ac100_codec *codec = snd_soc_card_get_drvdata(card);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct of_device_id ac100_codec_of_match[] = {
|
||||||
|
+ { .compatible = "x-powers,ac100-codec" },
|
||||||
|
+ {}
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(of, ac100_codec_of_match);
|
||||||
|
+
|
||||||
|
+static struct platform_driver ac100_codec_driver = {
|
||||||
|
+ .driver = {
|
||||||
|
+ .name = "ac100-codec",
|
||||||
|
+ .of_match_table = ac100_codec_of_match,
|
||||||
|
+ },
|
||||||
|
+ .probe = ac100_codec_probe,
|
||||||
|
+ .remove = ac100_codec_remove,
|
||||||
|
+};
|
||||||
|
+module_platform_driver(ac100_codec_driver);
|
||||||
|
+
|
||||||
|
+MODULE_DESCRIPTION("X-Powers AC100 codec driver");
|
||||||
|
+MODULE_AUTHOR("Ondrej Jirman <megous@megous.com>");
|
||||||
|
+MODULE_LICENSE("GPL");
|
||||||
|
+MODULE_ALIAS("platform:ac100-codec");
|
|
@ -0,0 +1,52 @@
|
||||||
|
From a5b709a81ad9a5e2e6e4be6a696711ad7f35ad57 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 9 Feb 2017 00:18:56 +0800
|
||||||
|
Subject: [PATCH 001/146] arm64: allwinner: a64: enable Wi-Fi for Pine64
|
||||||
|
|
||||||
|
The Wi-Fi modules of Pine64 is powered via DLDO4 and ELDO1 (the latter
|
||||||
|
one provides I/O voltage).
|
||||||
|
|
||||||
|
Add device node for it.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
.../boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
|
||||||
|
1 file changed, 16 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
index 1b9b92e541d2..d06b5b88f60e 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
@@ -62,6 +62,11 @@
|
||||||
|
chosen {
|
||||||
|
stdout-path = "serial0:115200n8";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
&ehci0 {
|
||||||
|
@@ -109,6 +114,17 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&mmc1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc1_pins>;
|
||||||
|
+ vmmc-supply = <®_dldo4>;
|
||||||
|
+ vqmmc-supply = <®_eldo1>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ non-removable;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ohci0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
From bb0516f4d03ffe9bcc06f840e477ea665af94e9d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||||
|
Date: Sun, 25 Aug 2019 14:40:10 +0200
|
||||||
|
Subject: [PATCH] arm64: dts: allwinner: a64: pine64-plus: Add PHY regulator
|
||||||
|
delay
|
||||||
|
|
||||||
|
Depending on kernel and bootloader configuration, it's possible that
|
||||||
|
Realtek ethernet PHY isn't powered on properly. It needs some time
|
||||||
|
before it can be used.
|
||||||
|
|
||||||
|
Fix that by adding 100ms ramp delay to regulator responsible for
|
||||||
|
powering PHY.
|
||||||
|
|
||||||
|
Fixes: 94dcfdc77fc5 ("arm64: allwinner: pine64-plus: Enable dwmac-sun8i")
|
||||||
|
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
||||||
|
index 24f1aac366d6..9612a34c1762 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
||||||
|
@@ -63,3 +63,7 @@
|
||||||
|
reg = <1>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+®_dc1sw {
|
||||||
|
+ regulator-enable-ramp-delay = <100000>;
|
||||||
|
+};
|
||||||
|
--
|
||||||
|
2.23.0
|
13055
patch/kernel/sunxi-dev/0001-general-armbian-boot-logo.patch
Normal file
13055
patch/kernel/sunxi-dev/0001-general-armbian-boot-logo.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,30 @@
|
||||||
|
From 4aa7894de903660f5c8d5155f2590d00022ca95e Mon Sep 17 00:00:00 2001
|
||||||
|
From: WaterByWind <WaterByWind@users.noreply.github.com>
|
||||||
|
Date: Sun, 14 Apr 2019 16:16:09 -0400
|
||||||
|
Subject: [PATCH] pinctrl: sunxi: Disable strict mode for A64 pinctrl driver
|
||||||
|
|
||||||
|
With kernel 4.15.y (and later):
|
||||||
|
* Strict mode was enabled by default via commit 1396007286b1e2fd5dd10ae6a5ccaaaed51ab762 which can/will cause breakage with existing implementations.
|
||||||
|
* The ability to configure strict mode was added via commit aae842a3ff3385f27f1df8a9ee1494a416ec032d to allow older drivers to maintain existing behavior and avoid breakage.
|
||||||
|
* Commit cd70387f892205bcd7b8093b0837269b0739cbe0 had then explicitly disabled strict mode for most other existing SoCs but did not include A64.
|
||||||
|
|
||||||
|
This change is to update the A64 pinctrl driver similar to the other pre-existing SoC pinctrl drivers.
|
||||||
|
---
|
||||||
|
drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c b/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
|
||||||
|
index 7b83d3755a0e..bea52c5a9afa 100644
|
||||||
|
--- a/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
|
||||||
|
+++ b/drivers/pinctrl/sunxi/pinctrl-sun50i-a64.c
|
||||||
|
@@ -578,6 +578,7 @@ static const struct sunxi_pinctrl_desc a64_pinctrl_data = {
|
||||||
|
.pins = a64_pins,
|
||||||
|
.npins = ARRAY_SIZE(a64_pins),
|
||||||
|
.irq_banks = 3,
|
||||||
|
+ .disable_strict_mode = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
static int a64_pinctrl_probe(struct platform_device *pdev)
|
||||||
|
--
|
||||||
|
2.20.1 (Apple Git-117)
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
From fa666ec858630bad5d3bf2952c96460302065102 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Sat, 6 May 2017 19:29:44 +0800
|
||||||
|
Subject: [PATCH 002/146] arm64: allwinner: a64: add Mali device node
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 41 +++++++++++++++++++
|
||||||
|
1 file changed, 41 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
index d3daf90a8715..0f69f3593975 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
@@ -157,6 +157,20 @@
|
||||||
|
compatible = "linux,spdif-dit";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ reserved-memory {
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+ ranges;
|
||||||
|
+
|
||||||
|
+ cma: linux,cma {
|
||||||
|
+ compatible = "shared-dma-pool";
|
||||||
|
+ reusable;
|
||||||
|
+ size = <0x4000000>;
|
||||||
|
+ alignment = <0x2000>;
|
||||||
|
+ linux,cma-default;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
timer {
|
||||||
|
compatible = "arm,armv8-timer";
|
||||||
|
interrupts = <GIC_PPI 13
|
||||||
|
@@ -664,6 +678,33 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ mali: gpu@1c40000 {
|
||||||
|
+ compatible = "allwinner,sun50i-a64-mali",
|
||||||
|
+ "allwinner,sun7i-a20-mali", "arm,mali-400";
|
||||||
|
+ reg = <0x01c40000 0x10000>;
|
||||||
|
+ interrupts = <GIC_SPI 97 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 98 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 99 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ interrupt-names = "gp",
|
||||||
|
+ "gpmmu",
|
||||||
|
+ "pp0",
|
||||||
|
+ "ppmmu0",
|
||||||
|
+ "pp1",
|
||||||
|
+ "ppmmu1",
|
||||||
|
+ "pmu";
|
||||||
|
+ clocks = <&ccu CLK_BUS_GPU>, <&ccu CLK_GPU>;
|
||||||
|
+ clock-names = "bus", "core";
|
||||||
|
+ resets = <&ccu RST_BUS_GPU>;
|
||||||
|
+ memory-region = <&cma>;
|
||||||
|
+
|
||||||
|
+ assigned-clocks = <&ccu CLK_GPU>;
|
||||||
|
+ assigned-clock-rates = <384000000>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
gic: interrupt-controller@1c81000 {
|
||||||
|
compatible = "arm,gic-400";
|
||||||
|
reg = <0x01c81000 0x1000>,
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
From 98800eeb2244387e821f4af8d21ccf2deaf18da0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Mon, 21 Aug 2017 23:02:32 +0800
|
||||||
|
Subject: [PATCH 003/146] net: stmmac: dwmac-sun8i: support RGMII modes with
|
||||||
|
PHY internal delay
|
||||||
|
|
||||||
|
Some boards uses a PHY with internal delay with an Allwinner SoC.
|
||||||
|
|
||||||
|
Support these PHY modes in the driver.
|
||||||
|
|
||||||
|
As the driver has no configuration registers for these modes, just treat
|
||||||
|
them as ordinary RGMII.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 3 +++
|
||||||
|
1 file changed, 3 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||||
|
index f9a61f90cfbc..3c18f4a9dd6c 100644
|
||||||
|
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||||
|
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
||||||
|
@@ -933,6 +933,9 @@ static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
||||||
|
/* default */
|
||||||
|
break;
|
||||||
|
case PHY_INTERFACE_MODE_RGMII:
|
||||||
|
+ case PHY_INTERFACE_MODE_RGMII_ID:
|
||||||
|
+ case PHY_INTERFACE_MODE_RGMII_RXID:
|
||||||
|
+ case PHY_INTERFACE_MODE_RGMII_TXID:
|
||||||
|
reg |= SYSCON_EPIT | SYSCON_ETCS_INT_GMII;
|
||||||
|
break;
|
||||||
|
case PHY_INTERFACE_MODE_RMII:
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
From e89cb84d23d2537cd1b256afdd0fe880648ee1a9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Mon, 21 Aug 2017 23:08:08 +0800
|
||||||
|
Subject: [PATCH 004/146] arm64: allwinner: a64: disable the RTL8211E internal
|
||||||
|
RX delay on Pine64+
|
||||||
|
|
||||||
|
Some Pine64+ boards have a broken RTL8211E PHY, which cannot work
|
||||||
|
reliably in 1000Base-T mode with default configuration.
|
||||||
|
|
||||||
|
A solution is passed to Pine64, which is said to be disabling the
|
||||||
|
internal RX delay of the PHY.
|
||||||
|
|
||||||
|
Enable the hack by set the PHY mode to RGMII-TXID.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
||||||
|
index 24f1aac366d6..ed715426fffc 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
||||||
|
@@ -52,7 +52,7 @@
|
||||||
|
&emac {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&rgmii_pins>;
|
||||||
|
- phy-mode = "rgmii";
|
||||||
|
+ phy-mode = "rgmii-txid";
|
||||||
|
phy-handle = <&ext_rgmii_phy>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
From ea69ff188dd5d9ac7162f05a22bf299b83a7536e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||||
|
Date: Mon, 7 Dec 2015 09:33:28 +0100
|
||||||
|
Subject: [PATCH 005/146] drm: gem: cma: Export with handle allocator
|
||||||
|
|
||||||
|
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/drm_gem_cma_helper.c | 3 ++-
|
||||||
|
include/drm/drm_gem_cma_helper.h | 4 ++++
|
||||||
|
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
|
||||||
|
index 80a5115c3846..077c61f065d9 100644
|
||||||
|
--- a/drivers/gpu/drm/drm_gem_cma_helper.c
|
||||||
|
+++ b/drivers/gpu/drm/drm_gem_cma_helper.c
|
||||||
|
@@ -142,7 +142,7 @@ EXPORT_SYMBOL_GPL(drm_gem_cma_create);
|
||||||
|
* A struct drm_gem_cma_object * on success or an ERR_PTR()-encoded negative
|
||||||
|
* error code on failure.
|
||||||
|
*/
|
||||||
|
-static struct drm_gem_cma_object *
|
||||||
|
+struct drm_gem_cma_object *
|
||||||
|
drm_gem_cma_create_with_handle(struct drm_file *file_priv,
|
||||||
|
struct drm_device *drm, size_t size,
|
||||||
|
uint32_t *handle)
|
||||||
|
@@ -169,6 +169,7 @@ drm_gem_cma_create_with_handle(struct drm_file *file_priv,
|
||||||
|
|
||||||
|
return cma_obj;
|
||||||
|
}
|
||||||
|
+EXPORT_SYMBOL_GPL(drm_gem_cma_create_with_handle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* drm_gem_cma_free_object - free resources associated with a CMA GEM object
|
||||||
|
diff --git a/include/drm/drm_gem_cma_helper.h b/include/drm/drm_gem_cma_helper.h
|
||||||
|
index 19777145cf8e..79f397c91517 100644
|
||||||
|
--- a/include/drm/drm_gem_cma_helper.h
|
||||||
|
+++ b/include/drm/drm_gem_cma_helper.h
|
||||||
|
@@ -79,6 +79,10 @@ int drm_gem_cma_mmap(struct file *filp, struct vm_area_struct *vma);
|
||||||
|
/* allocate physical memory */
|
||||||
|
struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
|
||||||
|
size_t size);
|
||||||
|
+struct drm_gem_cma_object *
|
||||||
|
+drm_gem_cma_create_with_handle(struct drm_file *file_priv,
|
||||||
|
+ struct drm_device *drm, size_t size,
|
||||||
|
+ uint32_t *handle);
|
||||||
|
|
||||||
|
extern const struct vm_operations_struct drm_gem_cma_vm_ops;
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
102
patch/kernel/sunxi-dev/0006-drm-sun4i-Add-GEM-allocator.patch
Normal file
102
patch/kernel/sunxi-dev/0006-drm-sun4i-Add-GEM-allocator.patch
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
From b143de6aef8be007256082e0f89606b7f5e3c757 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||||
|
Date: Mon, 7 Dec 2015 09:47:34 +0100
|
||||||
|
Subject: [PATCH 006/146] drm/sun4i: Add GEM allocator
|
||||||
|
|
||||||
|
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/sun4i/sun4i_drv.c | 27 +++++++++++++++++++++++++++
|
||||||
|
include/uapi/drm/sun4i_drm.h | 29 +++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 56 insertions(+)
|
||||||
|
create mode 100644 include/uapi/drm/sun4i_drm.h
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
|
||||||
|
index 8b0cd08034e0..9f5de14fb2fe 100644
|
||||||
|
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
|
||||||
|
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
|
||||||
|
@@ -22,6 +22,8 @@
|
||||||
|
#include <drm/drm_fb_helper.h>
|
||||||
|
#include <drm/drm_of.h>
|
||||||
|
|
||||||
|
+#include <uapi/drm/sun4i_drm.h>
|
||||||
|
+
|
||||||
|
#include "sun4i_drv.h"
|
||||||
|
#include "sun4i_frontend.h"
|
||||||
|
#include "sun4i_framebuffer.h"
|
||||||
|
@@ -30,6 +32,27 @@
|
||||||
|
|
||||||
|
DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
|
||||||
|
|
||||||
|
+static int sun4i_gem_create_ioctl(struct drm_device *drm, void *data,
|
||||||
|
+ struct drm_file *file_priv)
|
||||||
|
+{
|
||||||
|
+ struct drm_sun4i_gem_create *args = data;
|
||||||
|
+ struct drm_gem_cma_object *cma_obj;
|
||||||
|
+ size_t size;
|
||||||
|
+
|
||||||
|
+ /* The Mali requires a 64 bytes alignment */
|
||||||
|
+ size = ALIGN(args->size, 64);
|
||||||
|
+
|
||||||
|
+ cma_obj = drm_gem_cma_create_with_handle(file_priv, drm, size,
|
||||||
|
+ &args->handle);
|
||||||
|
+
|
||||||
|
+ return PTR_ERR_OR_ZERO(cma_obj);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct drm_ioctl_desc sun4i_drv_ioctls[] = {
|
||||||
|
+ DRM_IOCTL_DEF_DRV(SUN4I_GEM_CREATE, sun4i_gem_create_ioctl,
|
||||||
|
+ DRM_UNLOCKED | DRM_AUTH),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static struct drm_driver sun4i_drv_driver = {
|
||||||
|
.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_PRIME | DRIVER_ATOMIC,
|
||||||
|
|
||||||
|
@@ -42,6 +65,10 @@ static struct drm_driver sun4i_drv_driver = {
|
||||||
|
.major = 1,
|
||||||
|
.minor = 0,
|
||||||
|
|
||||||
|
+ /* Custom ioctls */
|
||||||
|
+ .ioctls = sun4i_drv_ioctls,
|
||||||
|
+ .num_ioctls = ARRAY_SIZE(sun4i_drv_ioctls),
|
||||||
|
+
|
||||||
|
/* GEM Operations */
|
||||||
|
.dumb_create = drm_gem_cma_dumb_create,
|
||||||
|
.gem_free_object_unlocked = drm_gem_cma_free_object,
|
||||||
|
diff --git a/include/uapi/drm/sun4i_drm.h b/include/uapi/drm/sun4i_drm.h
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..67b9dd4ee594
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/include/uapi/drm/sun4i_drm.h
|
||||||
|
@@ -0,0 +1,29 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2015 Free Electrons
|
||||||
|
+ * Copyright (C) 2015 NextThing Co
|
||||||
|
+ *
|
||||||
|
+ * Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||||
|
+ *
|
||||||
|
+ * This program is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of
|
||||||
|
+ * the License, or (at your option) any later version.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef _UAPI_SUN4I_DRM_H_
|
||||||
|
+#define _UAPI_SUN4I_DRM_H_
|
||||||
|
+
|
||||||
|
+#include <drm/drm.h>
|
||||||
|
+
|
||||||
|
+struct drm_sun4i_gem_create {
|
||||||
|
+ __u64 size;
|
||||||
|
+ __u32 flags;
|
||||||
|
+ __u32 handle;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define DRM_SUN4I_GEM_CREATE 0x00
|
||||||
|
+
|
||||||
|
+#define DRM_IOCTL_SUN4I_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_SUN4I_GEM_CREATE, \
|
||||||
|
+ struct drm_sun4i_gem_create)
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,96 @@
|
||||||
|
From 87020e638ad511e0ebe9c72208d2f0192c905812 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Sun, 3 Dec 2017 11:43:08 -0800
|
||||||
|
Subject: [PATCH 007/146] Add sopine HDMI sound and WiFi support
|
||||||
|
|
||||||
|
---
|
||||||
|
.../allwinner/sun50i-a64-sopine-baseboard.dts | 18 ++++++++++++
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 29 +++++++++++++++++++
|
||||||
|
2 files changed, 47 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
index c21f2331add6..8161895dde52 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
@@ -86,6 +86,10 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&i2s2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mdio {
|
||||||
|
ext_rgmii_phy: ethernet-phy@1 {
|
||||||
|
compatible = "ethernet-phy-ieee802.3-c22";
|
||||||
|
@@ -93,6 +97,16 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&mmc1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc1_pins>;
|
||||||
|
+ vmmc-supply = <®_dldo4>;
|
||||||
|
+ vqmmc-supply = <®_eldo1>;
|
||||||
|
+ non-removable;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mmc2 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&mmc2_pins>;
|
||||||
|
@@ -138,6 +152,10 @@
|
||||||
|
vcc-hdmi-supply = <®_dldo1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+&sound_hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&uart0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart0_pins_a>;
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
index 0f69f3593975..0b44018361cb 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
@@ -727,6 +727,35 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ i2s2: i2s@1c22800 {
|
||||||
|
+ #sound-dai-cells = <0>;
|
||||||
|
+ compatible = "allwinner,sun8i-h3-i2s";
|
||||||
|
+ reg = <0x01c22800 0x400>;
|
||||||
|
+ interrupts = <GIC_SPI 15 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_I2S2>, <&ccu CLK_I2S2>;
|
||||||
|
+ clock-names = "apb", "mod";
|
||||||
|
+ dmas = <&dma 27>;
|
||||||
|
+ resets = <&ccu RST_BUS_I2S2>;
|
||||||
|
+ dma-names = "tx";
|
||||||
|
+ status = "disabled";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ sound_hdmi: sound_hdmi {
|
||||||
|
+ compatible = "simple-audio-card";
|
||||||
|
+ simple-audio-card,format = "i2s";
|
||||||
|
+ simple-audio-card,name = "allwinner,hdmi";
|
||||||
|
+ simple-audio-card,mclk-fs = <256>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+
|
||||||
|
+ simple-audio-card,codec {
|
||||||
|
+ sound-dai = <&hdmi>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ simple-audio-card,cpu {
|
||||||
|
+ sound-dai = <&i2s2>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
rtc: rtc@1f00000 {
|
||||||
|
compatible = "allwinner,sun6i-a31-rtc";
|
||||||
|
reg = <0x01f00000 0x54>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
From 887b96d878bb0e261bc19062dc73d193c75bc56a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Tue, 26 Dec 2017 15:53:53 -0800
|
||||||
|
Subject: [PATCH 008/146] arm64: dts: sun50i-a64-pine64: add HDMI audio nodes
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
index d06b5b88f60e..8c5dd99cc9ac 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
@@ -97,6 +97,10 @@
|
||||||
|
bias-pull-up;
|
||||||
|
};
|
||||||
|
|
||||||
|
+&i2s2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mdio {
|
||||||
|
ext_rmii_phy1: ethernet-phy@1 {
|
||||||
|
compatible = "ethernet-phy-ieee802.3-c22";
|
||||||
|
@@ -254,6 +258,10 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&sound_hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
/* On Exp and Euler connectors */
|
||||||
|
&uart0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
From 92e5c7876cef2b53ed3d1701169fcd93b73e0e33 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sat, 20 Jan 2018 13:25:21 +0100
|
||||||
|
Subject: [PATCH 009/146] dt-bindings: update the Allwinner GPADC device tree
|
||||||
|
binding for H3 & A83T
|
||||||
|
|
||||||
|
Allwinner H3 features a thermal sensor like the one in A33, but has its
|
||||||
|
register re-arranged, the clock divider moved to CCU (originally the
|
||||||
|
clock divider is in ADC) and added a pair of bus clock and reset.
|
||||||
|
|
||||||
|
Allwinner A83T features a thermal sensor similar to the H3, the ths clock,
|
||||||
|
the bus clock and the reset was removed from the CCU. The THS in A83T
|
||||||
|
has a clock that is directly connected and runs with 24 MHz.
|
||||||
|
|
||||||
|
Update the binding document to cover H3 and A83T.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
.../devicetree/bindings/mfd/sun4i-gpadc.txt | 50 +++++++++++++++++--
|
||||||
|
1 file changed, 47 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/mfd/sun4i-gpadc.txt b/Documentation/devicetree/bindings/mfd/sun4i-gpadc.txt
|
||||||
|
index 86dd8191b04c..f6b939617a6d 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/mfd/sun4i-gpadc.txt
|
||||||
|
+++ b/Documentation/devicetree/bindings/mfd/sun4i-gpadc.txt
|
||||||
|
@@ -4,12 +4,35 @@ The Allwinner SoCs all have an ADC that can also act as a thermal sensor
|
||||||
|
and sometimes as a touchscreen controller.
|
||||||
|
|
||||||
|
Required properties:
|
||||||
|
- - compatible: "allwinner,sun8i-a33-ths",
|
||||||
|
+ - compatible: must contain one of the following compatibles:
|
||||||
|
+ - "allwinner,sun8i-a33-ths"
|
||||||
|
+ - "allwinner,sun8i-h3-ths"
|
||||||
|
+ - "allwinner,sun8i-a83t-ths"
|
||||||
|
- reg: mmio address range of the chip,
|
||||||
|
- - #thermal-sensor-cells: shall be 0,
|
||||||
|
+ - #thermal-sensor-cells: shall be 0 or 1,
|
||||||
|
- #io-channel-cells: shall be 0,
|
||||||
|
|
||||||
|
-Example:
|
||||||
|
+Required properties for the following compatibles:
|
||||||
|
+ - "allwinner,sun8i-h3-ths"
|
||||||
|
+ - "allwinner,sun8i-a83t-ths"
|
||||||
|
+ - interrupts: the sampling interrupt of the ADC,
|
||||||
|
+
|
||||||
|
+Required properties for the following compatibles:
|
||||||
|
+ - "allwinner,sun8i-h3-ths"
|
||||||
|
+ - clocks: the bus clock and the input clock of the ADC,
|
||||||
|
+ - clock-names: should be "bus" and "mod",
|
||||||
|
+ - resets: the bus reset of the ADC,
|
||||||
|
+
|
||||||
|
+Optional properties for the following compatibles:
|
||||||
|
+ - "allwinner,sun8i-h3-ths"
|
||||||
|
+ - nvmem-cells: A phandle to the calibration data provided by a nvmem device.
|
||||||
|
+ If unspecified default values shall be used. The size should
|
||||||
|
+ be 0x4 or 0x8, depending on the amount of CDATA registers.
|
||||||
|
+ - nvmem-cell-names: Should be "calibration".
|
||||||
|
+
|
||||||
|
+Details see: bindings/nvmem/nvmem.txt
|
||||||
|
+
|
||||||
|
+Example for A33:
|
||||||
|
ths: ths@1c25000 {
|
||||||
|
compatible = "allwinner,sun8i-a33-ths";
|
||||||
|
reg = <0x01c25000 0x100>;
|
||||||
|
@@ -17,6 +40,27 @@ Example:
|
||||||
|
#io-channel-cells = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+Example for H3:
|
||||||
|
+ ths: thermal-sensor@1c25000 {
|
||||||
|
+ compatible = "allwinner,sun8i-h3-ths";
|
||||||
|
+ reg = <0x01c25000 0x400>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>;
|
||||||
|
+ clock-names = "bus", "mod";
|
||||||
|
+ resets = <&ccu RST_BUS_THS>;
|
||||||
|
+ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ #thermal-sensor-cells = <0>;
|
||||||
|
+ #io-channel-cells = <0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+Example for A83T:
|
||||||
|
+ ths: thermal-sensor@1f04000 {
|
||||||
|
+ compatible = "allwinner,sun8i-a83t-ths";
|
||||||
|
+ reg = <0x01f04000 0x100>;
|
||||||
|
+ interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ #thermal-sensor-cells = <1>;
|
||||||
|
+ #io-channel-cells = <0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
sun4i, sun5i and sun6i SoCs are also supported via the older binding:
|
||||||
|
|
||||||
|
sun4i resistive touchscreen controller
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,174 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||||
|
index dc785da9c..141fd186b 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||||
|
@@ -113,6 +113,12 @@
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
+ opp@1640000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <1640000000>;
|
||||||
|
+ opp-microvolt = <1160000 1160000 1160000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
opp@1800000000 {
|
||||||
|
opp-hz = /bits/ 64 <1800000000>;
|
||||||
|
opp-microvolt = <1160000 1160000 1160000>;
|
||||||
|
@@ -374,6 +381,17 @@
|
||||||
|
#dma-cells = <1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ gic: interrupt-controller@3021000 {
|
||||||
|
+ compatible = "arm,gic-400";
|
||||||
|
+ reg = <0x03021000 0x1000>,
|
||||||
|
+ <0x03022000 0x2000>,
|
||||||
|
+ <0x03024000 0x2000>,
|
||||||
|
+ <0x03026000 0x2000>;
|
||||||
|
+ interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
|
||||||
|
+ interrupt-controller;
|
||||||
|
+ #interrupt-cells = <3>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
sid: efuse@3006000 {
|
||||||
|
compatible = "allwinner,sun50i-h6-sid";
|
||||||
|
reg = <0x03006000 0x400>;
|
||||||
|
@@ -279,6 +305,7 @@
|
||||||
|
interrupt-controller;
|
||||||
|
#interrupt-cells = <3>;
|
||||||
|
|
||||||
|
+ /omit-if-no-ref/
|
||||||
|
ext_rgmii_pins: rgmii-pins {
|
||||||
|
pins = "PD0", "PD1", "PD2", "PD3", "PD4",
|
||||||
|
"PD5", "PD7", "PD8", "PD9", "PD10",
|
||||||
|
@@ -309,6 +354,7 @@
|
||||||
|
bias-pull-up;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ /omit-if-no-ref/
|
||||||
|
mmc2_pins: mmc2-pins {
|
||||||
|
pins = "PC1", "PC4", "PC5", "PC6",
|
||||||
|
"PC7", "PC8", "PC9", "PC10",
|
||||||
|
@@ -318,6 +364,16 @@
|
||||||
|
bias-pull-up;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ spi0_pins: spi0-pins {
|
||||||
|
+ pins = "PC2", "PC3", "PC0", "PC5";
|
||||||
|
+ function = "spi0";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ spi1_pins: spi1-pins {
|
||||||
|
+ pins = "PH5", "PH6", "PH4", "PH3";
|
||||||
|
+ function = "spi1";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
uart0_ph_pins: uart0-ph-pins {
|
||||||
|
pins = "PH0", "PH1";
|
||||||
|
function = "uart0";
|
||||||
|
@@ -511,17 +540,26 @@
|
||||||
|
pins = "PG8", "PG9";
|
||||||
|
function = "uart1";
|
||||||
|
};
|
||||||
|
- };
|
||||||
|
|
||||||
|
- gic: interrupt-controller@3021000 {
|
||||||
|
- compatible = "arm,gic-400";
|
||||||
|
- reg = <0x03021000 0x1000>,
|
||||||
|
- <0x03022000 0x2000>,
|
||||||
|
- <0x03024000 0x2000>,
|
||||||
|
- <0x03026000 0x2000>;
|
||||||
|
- interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
|
||||||
|
- interrupt-controller;
|
||||||
|
- #interrupt-cells = <3>;
|
||||||
|
+ uart2_pins: uart2-pins {
|
||||||
|
+ pins = "PD19", "PD20";
|
||||||
|
+ function = "uart2";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ uart2_rts_cts_pins: uart2-rts-cts-pins {
|
||||||
|
+ pins = "PD21", "PD22";
|
||||||
|
+ function = "uart2";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ uart3_pins: uart3-pins {
|
||||||
|
+ pins = "PD23", "PD24";
|
||||||
|
+ function = "uart3";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ uart3_rts_cts_pins: uart3-rts-cts-pins {
|
||||||
|
+ pins = "PD25", "PD26";
|
||||||
|
+ function = "uart3";
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
mmc0: mmc@4020000 {
|
||||||
|
@@ -391,6 +495,38 @@
|
||||||
|
#size-cells = <0>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ spi0: spi@5010000 {
|
||||||
|
+ compatible = "allwinner,sun8i-h3-spi";
|
||||||
|
+ reg = <0x05010000 0x1000>;
|
||||||
|
+ interrupts = <GIC_SPI 10 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_SPI0>, <&ccu CLK_SPI0>;
|
||||||
|
+ clock-names = "ahb", "mod";
|
||||||
|
+ dmas = <&dma 22>, <&dma 22>;
|
||||||
|
+ dma-names = "rx", "tx";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&spi0_pins>;
|
||||||
|
+ resets = <&ccu RST_BUS_SPI0>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ spi1: spi@5011000 {
|
||||||
|
+ compatible = "allwinner,sun8i-h3-spi";
|
||||||
|
+ reg = <0x05011000 0x1000>;
|
||||||
|
+ interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_SPI1>, <&ccu CLK_SPI1>;
|
||||||
|
+ clock-names = "ahb", "mod";
|
||||||
|
+ dmas = <&dma 23>, <&dma 23>;
|
||||||
|
+ dma-names = "rx", "tx";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&spi1_pins>;
|
||||||
|
+ resets = <&ccu RST_BUS_SPI1>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
uart0: serial@5000000 {
|
||||||
|
compatible = "snps,dw-apb-uart";
|
||||||
|
reg = <0x05000000 0x400>;
|
||||||
|
@@ -768,6 +904,29 @@
|
||||||
|
pins = "PL0", "PL1";
|
||||||
|
function = "s_i2c";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ r_ir_rx_pins: r-ir-rx-pins {
|
||||||
|
+ pins = "PL9";
|
||||||
|
+ function = "s_cir_rx";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ r_uart_pins: r-uart-pins {
|
||||||
|
+ pins = "PL2", "PL3";
|
||||||
|
+ function = "s_uart";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ r_uart: serial@7080000 {
|
||||||
|
+ compatible = "snps,dw-apb-uart";
|
||||||
|
+ reg = <0x07080000 0x400>;
|
||||||
|
+ interrupts = <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ reg-shift = <2>;
|
||||||
|
+ reg-io-width = <4>;
|
||||||
|
+ clocks = <&r_ccu CLK_R_APB2_UART>;
|
||||||
|
+ resets = <&r_ccu RST_R_APB2_UART>;
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&r_uart_pins>;
|
||||||
|
+ status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
r_i2c: i2c@7081400 {
|
|
@ -0,0 +1,56 @@
|
||||||
|
From ef6a8862ab9440c5d6a73da32be83edc46e2fe94 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 14 Sep 2017 22:52:47 +0800
|
||||||
|
Subject: [PATCH 011/146] iio: adc: sun4i-gpadc-iio: rename A33-specified
|
||||||
|
registers to contain A33
|
||||||
|
|
||||||
|
As the H3 SoC, which is also in sun8i line, has totally different
|
||||||
|
register map for the thermal sensor (a cut down version of GPADC), we
|
||||||
|
should rename A23/A33-specified registers to contain A33, in order to
|
||||||
|
prevent obfuscation with H3 registers. Currently these registers are
|
||||||
|
only prefixed "SUN8I", not "SUN8I_A33".
|
||||||
|
|
||||||
|
Add "_A33" after "SUN8I" on the register names.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
|
||||||
|
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
|
||||||
|
Acked-by: Lee Jones <lee.jones@linaro.org>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 2 +-
|
||||||
|
include/linux/mfd/sun4i-gpadc.h | 6 +++---
|
||||||
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 04d7147e0110..03804ff9c006 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -88,7 +88,7 @@ static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
.temp_offset = -1662,
|
||||||
|
.temp_scale = 162,
|
||||||
|
- .tp_mode_en = SUN8I_GPADC_CTRL1_CHOP_TEMP_EN,
|
||||||
|
+ .tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
index 139872c2e0fe..78d31984a222 100644
|
||||||
|
--- a/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
+++ b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
@@ -38,9 +38,9 @@
|
||||||
|
#define SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(x) (GENMASK(3, 0) & BIT(x))
|
||||||
|
#define SUN6I_GPADC_CTRL1_ADC_CHAN_MASK GENMASK(3, 0)
|
||||||
|
|
||||||
|
-/* TP_CTRL1 bits for sun8i SoCs */
|
||||||
|
-#define SUN8I_GPADC_CTRL1_CHOP_TEMP_EN BIT(8)
|
||||||
|
-#define SUN8I_GPADC_CTRL1_GPADC_CALI_EN BIT(7)
|
||||||
|
+/* TP_CTRL1 bits for A33 */
|
||||||
|
+#define SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN BIT(8)
|
||||||
|
+#define SUN8I_A33_GPADC_CTRL1_GPADC_CALI_EN BIT(7)
|
||||||
|
|
||||||
|
#define SUN4I_GPADC_CTRL2 0x08
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
72
patch/kernel/sunxi-dev/0012-general-h6-new-opp-table.patch
Normal file
72
patch/kernel/sunxi-dev/0012-general-h6-new-opp-table.patch
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||||
|
index 141fd186b..4d4dcf8eb 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||||
|
@@ -67,61 +67,62 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ /* axp80,DCDC-A: 0.6~1.1V, 10mV/Step, 51 steps; 1.12~1.52V, 20mV/Step, 21 Steps */
|
||||||
|
cpu_opp_table: opp_table {
|
||||||
|
compatible = "operating-points-v2";
|
||||||
|
opp-shared;
|
||||||
|
|
||||||
|
opp@480000000 {
|
||||||
|
opp-hz = /bits/ 64 <480000000>;
|
||||||
|
opp-microvolt = <880000 880000 880000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@720000000 {
|
||||||
|
opp-hz = /bits/ 64 <720000000>;
|
||||||
|
opp-microvolt = <880000 880000 880000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@816000000 {
|
||||||
|
opp-hz = /bits/ 64 <816000000>;
|
||||||
|
opp-microvolt = <880000 880000 880000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@888000000 {
|
||||||
|
opp-hz = /bits/ 64 <888000000>;
|
||||||
|
opp-microvolt = <880000 880000 880000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@1080000000 {
|
||||||
|
opp-hz = /bits/ 64 <1080000000>;
|
||||||
|
- opp-microvolt = <940000 940000 940000>;
|
||||||
|
+ opp-microvolt = <880000 880000 940000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@1320000000 {
|
||||||
|
opp-hz = /bits/ 64 <1320000000>;
|
||||||
|
- opp-microvolt = <1000000 1000000 1000000>;
|
||||||
|
+ opp-microvolt = <880000 880000 1000000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@1488000000 {
|
||||||
|
opp-hz = /bits/ 64 <1488000000>;
|
||||||
|
- opp-microvolt = <1060000 1060000 1060000>;
|
||||||
|
+ opp-microvolt = <940000 940000 1060000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@1640000000 {
|
||||||
|
opp-hz = /bits/ 64 <1640000000>;
|
||||||
|
- opp-microvolt = <1160000 1160000 1160000>;
|
||||||
|
+ opp-microvolt = <990000 990000 1160000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
|
||||||
|
opp@1800000000 {
|
||||||
|
opp-hz = /bits/ 64 <1800000000>;
|
||||||
|
- opp-microvolt = <1160000 1160000 1160000>;
|
||||||
|
+ opp-microvolt = <1050000 1050000 1160000>;
|
||||||
|
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
};
|
||||||
|
};
|
|
@ -0,0 +1,237 @@
|
||||||
|
From 3de3b1512ed5905e9522a4966d238f571825ee70 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sat, 20 Jan 2018 14:03:10 +0100
|
||||||
|
Subject: [PATCH 012/146] iio: adc: sun4i-gpadc-iio: rework: sampling start/end
|
||||||
|
code readout reg
|
||||||
|
|
||||||
|
For adding newer sensor some basic rework of the code is necessary.
|
||||||
|
|
||||||
|
This commit reworks the code and allows the sampling start/end code and
|
||||||
|
the position of value readout register to be altered. Later the start/end
|
||||||
|
functions will be used to configure the ths and start/stop the
|
||||||
|
sampling.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 87 ++++++++++++++++++++++++++++---
|
||||||
|
include/linux/mfd/sun4i-gpadc.h | 19 +++++--
|
||||||
|
2 files changed, 94 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 03804ff9c006..363936b37c5a 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -49,6 +49,18 @@ static unsigned int sun6i_gpadc_chan_select(unsigned int chan)
|
||||||
|
return SUN6I_GPADC_CTRL1_ADC_CHAN_SELECT(chan);
|
||||||
|
}
|
||||||
|
|
||||||
|
+struct sun4i_gpadc_iio;
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Prototypes for these functions, which enable these functions to be
|
||||||
|
+ * referenced in gpadc_data structures.
|
||||||
|
+ */
|
||||||
|
+static int sun4i_gpadc_sample_start(struct sun4i_gpadc_iio *info);
|
||||||
|
+static int sun4i_gpadc_sample_end(struct sun4i_gpadc_iio *info);
|
||||||
|
+
|
||||||
|
+static int sunxi_ths_sample_start(struct sun4i_gpadc_iio *info);
|
||||||
|
+static int sunxi_ths_sample_end(struct sun4i_gpadc_iio *info);
|
||||||
|
+
|
||||||
|
struct gpadc_data {
|
||||||
|
int temp_offset;
|
||||||
|
int temp_scale;
|
||||||
|
@@ -56,6 +68,13 @@ struct gpadc_data {
|
||||||
|
unsigned int tp_adc_select;
|
||||||
|
unsigned int (*adc_chan_select)(unsigned int chan);
|
||||||
|
unsigned int adc_chan_mask;
|
||||||
|
+ unsigned int temp_data;
|
||||||
|
+ int (*sample_start)(struct sun4i_gpadc_iio *info);
|
||||||
|
+ int (*sample_end)(struct sun4i_gpadc_iio *info);
|
||||||
|
+ u32 ctrl0_map;
|
||||||
|
+ u32 ctrl2_map;
|
||||||
|
+ u32 sensor_en_map;
|
||||||
|
+ u32 filter_map;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
@@ -65,6 +84,9 @@ static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
.tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
|
||||||
|
.adc_chan_select = &sun4i_gpadc_chan_select,
|
||||||
|
.adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
|
||||||
|
+ .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .sample_start = sun4i_gpadc_sample_start,
|
||||||
|
+ .sample_end = sun4i_gpadc_sample_end,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
@@ -74,6 +96,9 @@ static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
.tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
|
||||||
|
.adc_chan_select = &sun4i_gpadc_chan_select,
|
||||||
|
.adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
|
||||||
|
+ .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .sample_start = sun4i_gpadc_sample_start,
|
||||||
|
+ .sample_end = sun4i_gpadc_sample_end,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
@@ -83,12 +108,18 @@ static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
.tp_adc_select = SUN6I_GPADC_CTRL1_TP_ADC_SELECT,
|
||||||
|
.adc_chan_select = &sun6i_gpadc_chan_select,
|
||||||
|
.adc_chan_mask = SUN6I_GPADC_CTRL1_ADC_CHAN_MASK,
|
||||||
|
+ .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .sample_start = sun4i_gpadc_sample_start,
|
||||||
|
+ .sample_end = sun4i_gpadc_sample_end,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
.temp_offset = -1662,
|
||||||
|
.temp_scale = 162,
|
||||||
|
.tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN,
|
||||||
|
+ .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .sample_start = sun4i_gpadc_sample_start,
|
||||||
|
+ .sample_end = sun4i_gpadc_sample_end,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
@@ -277,7 +308,7 @@ static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val)
|
||||||
|
if (info->no_irq) {
|
||||||
|
pm_runtime_get_sync(indio_dev->dev.parent);
|
||||||
|
|
||||||
|
- regmap_read(info->regmap, SUN4I_GPADC_TEMP_DATA, val);
|
||||||
|
+ regmap_read(info->regmap, info->data->temp_data, val);
|
||||||
|
|
||||||
|
pm_runtime_mark_last_busy(indio_dev->dev.parent);
|
||||||
|
pm_runtime_put_autosuspend(indio_dev->dev.parent);
|
||||||
|
@@ -382,10 +413,8 @@ static irqreturn_t sun4i_gpadc_fifo_data_irq_handler(int irq, void *dev_id)
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int sun4i_gpadc_runtime_suspend(struct device *dev)
|
||||||
|
+static int sun4i_gpadc_sample_end(struct sun4i_gpadc_iio *info)
|
||||||
|
{
|
||||||
|
- struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
|
||||||
|
-
|
||||||
|
/* Disable the ADC on IP */
|
||||||
|
regmap_write(info->regmap, SUN4I_GPADC_CTRL1, 0);
|
||||||
|
/* Disable temperature sensor on IP */
|
||||||
|
@@ -394,19 +423,32 @@ static int sun4i_gpadc_runtime_suspend(struct device *dev)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int sun4i_gpadc_runtime_resume(struct device *dev)
|
||||||
|
+static int sunxi_ths_sample_end(struct sun4i_gpadc_iio *info)
|
||||||
|
+{
|
||||||
|
+ /* Disable temperature sensor */
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_CTRL2, 0x0);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int sun4i_gpadc_runtime_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
|
||||||
|
|
||||||
|
+ return info->data->sample_end(info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int sun4i_gpadc_sample_start(struct sun4i_gpadc_iio *info)
|
||||||
|
+{
|
||||||
|
/* clkin = 6MHz */
|
||||||
|
regmap_write(info->regmap, SUN4I_GPADC_CTRL0,
|
||||||
|
SUN4I_GPADC_CTRL0_ADC_CLK_DIVIDER(2) |
|
||||||
|
SUN4I_GPADC_CTRL0_FS_DIV(7) |
|
||||||
|
- SUN4I_GPADC_CTRL0_T_ACQ(63));
|
||||||
|
+ SUNXI_THS_ACQ0(63));
|
||||||
|
regmap_write(info->regmap, SUN4I_GPADC_CTRL1, info->data->tp_mode_en);
|
||||||
|
regmap_write(info->regmap, SUN4I_GPADC_CTRL3,
|
||||||
|
- SUN4I_GPADC_CTRL3_FILTER_EN |
|
||||||
|
- SUN4I_GPADC_CTRL3_FILTER_TYPE(1));
|
||||||
|
+ SUNXI_THS_FILTER_EN |
|
||||||
|
+ SUNXI_THS_FILTER_TYPE(1));
|
||||||
|
/* period = SUN4I_GPADC_TPR_TEMP_PERIOD * 256 * 16 / clkin; ~0.6s */
|
||||||
|
regmap_write(info->regmap, SUN4I_GPADC_TPR,
|
||||||
|
SUN4I_GPADC_TPR_TEMP_ENABLE |
|
||||||
|
@@ -415,6 +457,35 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static int sunxi_ths_sample_start(struct sun4i_gpadc_iio *info)
|
||||||
|
+{
|
||||||
|
+ u32 value;
|
||||||
|
+
|
||||||
|
+ if (info->data->ctrl0_map)
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_CTRL0,
|
||||||
|
+ info->data->ctrl0_map);
|
||||||
|
+
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_CTRL2,
|
||||||
|
+ info->data->ctrl2_map);
|
||||||
|
+
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_FILTER,
|
||||||
|
+ info->data->filter_map);
|
||||||
|
+
|
||||||
|
+ regmap_read(info->regmap, SUNXI_THS_CTRL2, &value);
|
||||||
|
+
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_CTRL2,
|
||||||
|
+ info->data->sensor_en_map | value);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int sun4i_gpadc_runtime_resume(struct device *dev)
|
||||||
|
+{
|
||||||
|
+ struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
|
||||||
|
+
|
||||||
|
+ return info->data->sample_start(info);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int sun4i_gpadc_get_temp(void *data, int *temp)
|
||||||
|
{
|
||||||
|
struct sun4i_gpadc_iio *info = data;
|
||||||
|
diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
index 78d31984a222..39e096c3ddac 100644
|
||||||
|
--- a/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
+++ b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
@@ -17,7 +17,6 @@
|
||||||
|
#define SUN4I_GPADC_CTRL0_ADC_CLK_SELECT BIT(22)
|
||||||
|
#define SUN4I_GPADC_CTRL0_ADC_CLK_DIVIDER(x) ((GENMASK(1, 0) & (x)) << 20)
|
||||||
|
#define SUN4I_GPADC_CTRL0_FS_DIV(x) ((GENMASK(3, 0) & (x)) << 16)
|
||||||
|
-#define SUN4I_GPADC_CTRL0_T_ACQ(x) (GENMASK(15, 0) & (x))
|
||||||
|
|
||||||
|
#define SUN4I_GPADC_CTRL1 0x04
|
||||||
|
|
||||||
|
@@ -51,9 +50,6 @@
|
||||||
|
|
||||||
|
#define SUN4I_GPADC_CTRL3 0x0c
|
||||||
|
|
||||||
|
-#define SUN4I_GPADC_CTRL3_FILTER_EN BIT(2)
|
||||||
|
-#define SUN4I_GPADC_CTRL3_FILTER_TYPE(x) (GENMASK(1, 0) & (x))
|
||||||
|
-
|
||||||
|
#define SUN4I_GPADC_TPR 0x18
|
||||||
|
|
||||||
|
#define SUN4I_GPADC_TPR_TEMP_ENABLE BIT(16)
|
||||||
|
@@ -90,6 +86,21 @@
|
||||||
|
/* 10s delay before suspending the IP */
|
||||||
|
#define SUN4I_GPADC_AUTOSUSPEND_DELAY 10000
|
||||||
|
|
||||||
|
+/* SUNXI_THS COMMON REGISTERS + DEFINES */
|
||||||
|
+#define SUNXI_THS_CTRL0 0x00
|
||||||
|
+#define SUNXI_THS_CTRL2 0x40
|
||||||
|
+#define SUNXI_THS_FILTER 0x70
|
||||||
|
+
|
||||||
|
+#define SUNXI_THS_FILTER_EN BIT(2)
|
||||||
|
+#define SUNXI_THS_FILTER_TYPE(x) (GENMASK(1, 0) & (x))
|
||||||
|
+#define SUNXI_THS_ACQ0(x) (GENMASK(15, 0) & (x))
|
||||||
|
+#define SUNXI_THS_ACQ1(x) (GENMASK(31, 16) & ((x) << 16))
|
||||||
|
+
|
||||||
|
+#define SUNXI_THS_TEMP_SENSE_EN0 BIT(0)
|
||||||
|
+#define SUNXI_THS_TEMP_SENSE_EN1 BIT(1)
|
||||||
|
+#define SUNXI_THS_TEMP_SENSE_EN2 BIT(2)
|
||||||
|
+#define SUNXI_THS_TEMP_SENSE_EN3 BIT(3)
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_dev {
|
||||||
|
struct device *dev;
|
||||||
|
struct regmap *regmap;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,168 @@
|
||||||
|
From c2d19fecbff6a21b3ab351c7843ae27de0d10b5b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sun, 21 Jan 2018 22:23:00 +0100
|
||||||
|
Subject: [PATCH 013/146] iio: adc: sun4i-gpadc-iio: rework: support clocks and
|
||||||
|
reset
|
||||||
|
|
||||||
|
For adding newer sensor some basic rework of the code is necessary.
|
||||||
|
|
||||||
|
The SoCs after H3 has newer thermal sensor ADCs, which have two clock
|
||||||
|
inputs (bus clock and sampling clock) and a reset. The registers are
|
||||||
|
also re-arranged.
|
||||||
|
|
||||||
|
This commit reworks the code, adds the process of the clocks and
|
||||||
|
resets.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 80 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 80 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 363936b37c5a..1a80744bd472 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -22,6 +22,7 @@
|
||||||
|
* shutdown for not being used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <linux/clk.h>
|
||||||
|
#include <linux/completion.h>
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/io.h>
|
||||||
|
@@ -31,6 +32,7 @@
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/pm_runtime.h>
|
||||||
|
#include <linux/regmap.h>
|
||||||
|
+#include <linux/reset.h>
|
||||||
|
#include <linux/thermal.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
|
||||||
|
@@ -75,6 +77,9 @@ struct gpadc_data {
|
||||||
|
u32 ctrl2_map;
|
||||||
|
u32 sensor_en_map;
|
||||||
|
u32 filter_map;
|
||||||
|
+ bool has_bus_clk;
|
||||||
|
+ bool has_bus_rst;
|
||||||
|
+ bool has_mod_clk;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
@@ -134,6 +139,9 @@ struct sun4i_gpadc_iio {
|
||||||
|
atomic_t ignore_temp_data_irq;
|
||||||
|
const struct gpadc_data *data;
|
||||||
|
bool no_irq;
|
||||||
|
+ struct clk *bus_clk;
|
||||||
|
+ struct clk *mod_clk;
|
||||||
|
+ struct reset_control *reset;
|
||||||
|
/* prevents concurrent reads of temperature and ADC */
|
||||||
|
struct mutex mutex;
|
||||||
|
struct thermal_zone_device *tzd;
|
||||||
|
@@ -435,6 +443,12 @@ static int sun4i_gpadc_runtime_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
|
||||||
|
|
||||||
|
+ if (info->data->has_mod_clk)
|
||||||
|
+ clk_disable(info->mod_clk);
|
||||||
|
+
|
||||||
|
+ if (info->data->has_bus_clk)
|
||||||
|
+ clk_disable(info->bus_clk);
|
||||||
|
+
|
||||||
|
return info->data->sample_end(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -483,6 +497,12 @@ static int sun4i_gpadc_runtime_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
struct sun4i_gpadc_iio *info = iio_priv(dev_get_drvdata(dev));
|
||||||
|
|
||||||
|
+ if (info->data->has_mod_clk)
|
||||||
|
+ clk_enable(info->mod_clk);
|
||||||
|
+
|
||||||
|
+ if (info->data->has_bus_clk)
|
||||||
|
+ clk_enable(info->bus_clk);
|
||||||
|
+
|
||||||
|
return info->data->sample_start(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -597,10 +617,61 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (info->data->has_bus_rst) {
|
||||||
|
+ info->reset = devm_reset_control_get(&pdev->dev, NULL);
|
||||||
|
+ if (IS_ERR(info->reset)) {
|
||||||
|
+ ret = PTR_ERR(info->reset);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = reset_control_deassert(info->reset);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (info->data->has_bus_clk) {
|
||||||
|
+ info->bus_clk = devm_clk_get(&pdev->dev, "bus");
|
||||||
|
+ if (IS_ERR(info->bus_clk)) {
|
||||||
|
+ ret = PTR_ERR(info->bus_clk);
|
||||||
|
+ goto assert_reset;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = clk_prepare_enable(info->bus_clk);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto assert_reset;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (info->data->has_mod_clk) {
|
||||||
|
+ info->mod_clk = devm_clk_get(&pdev->dev, "mod");
|
||||||
|
+ if (IS_ERR(info->mod_clk)) {
|
||||||
|
+ ret = PTR_ERR(info->mod_clk);
|
||||||
|
+ goto disable_bus_clk;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Running at 6MHz */
|
||||||
|
+ ret = clk_set_rate(info->mod_clk, 4000000);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto disable_bus_clk;
|
||||||
|
+
|
||||||
|
+ ret = clk_prepare_enable(info->mod_clk);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto disable_bus_clk;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
if (IS_ENABLED(CONFIG_THERMAL_OF))
|
||||||
|
info->sensor_device = &pdev->dev;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
+
|
||||||
|
+disable_bus_clk:
|
||||||
|
+ if (info->data->has_bus_clk)
|
||||||
|
+ clk_disable_unprepare(info->bus_clk);
|
||||||
|
+
|
||||||
|
+assert_reset:
|
||||||
|
+ if (info->data->has_bus_rst)
|
||||||
|
+ reset_control_assert(info->reset);
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int sun4i_gpadc_probe_mfd(struct platform_device *pdev,
|
||||||
|
@@ -766,6 +837,15 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
|
||||||
|
if (!info->no_irq)
|
||||||
|
iio_map_array_unregister(indio_dev);
|
||||||
|
|
||||||
|
+ if (info->data->has_mod_clk)
|
||||||
|
+ clk_disable_unprepare(info->mod_clk);
|
||||||
|
+
|
||||||
|
+ if (info->data->has_bus_clk)
|
||||||
|
+ clk_disable_unprepare(info->bus_clk);
|
||||||
|
+
|
||||||
|
+ if (info->data->has_bus_rst)
|
||||||
|
+ reset_control_assert(info->reset);
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
From e684b6faf4b5509f852867cac4830a0274f89211 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sun, 21 Jan 2018 22:26:50 +0100
|
||||||
|
Subject: [PATCH 014/146] iio: adc: sun4i-gpadc-iio: rework: support multible
|
||||||
|
sensors
|
||||||
|
|
||||||
|
For adding newer sensor some basic rework of the code is necessary.
|
||||||
|
|
||||||
|
This patch reworks the driver to be able to handle more than one
|
||||||
|
thermal sensor. Newer SoC like the A80 have 4 thermal sensors.
|
||||||
|
Because of this the maximal sensor count value was set to 4.
|
||||||
|
|
||||||
|
The sensor_id value is set during sensor registration and is for each
|
||||||
|
registered sensor indiviual. This makes it able to differntiate the
|
||||||
|
sensors when the value is read from the register.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 36 ++++++++++++++++++++-----------
|
||||||
|
include/linux/mfd/sun4i-gpadc.h | 6 ++++++
|
||||||
|
2 files changed, 29 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 1a80744bd472..bff06f2798e8 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -70,7 +70,7 @@ struct gpadc_data {
|
||||||
|
unsigned int tp_adc_select;
|
||||||
|
unsigned int (*adc_chan_select)(unsigned int chan);
|
||||||
|
unsigned int adc_chan_mask;
|
||||||
|
- unsigned int temp_data;
|
||||||
|
+ unsigned int temp_data[MAX_SENSOR_COUNT];
|
||||||
|
int (*sample_start)(struct sun4i_gpadc_iio *info);
|
||||||
|
int (*sample_end)(struct sun4i_gpadc_iio *info);
|
||||||
|
u32 ctrl0_map;
|
||||||
|
@@ -80,6 +80,7 @@ struct gpadc_data {
|
||||||
|
bool has_bus_clk;
|
||||||
|
bool has_bus_rst;
|
||||||
|
bool has_mod_clk;
|
||||||
|
+ int sensor_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
@@ -89,9 +90,10 @@ static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
.tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
|
||||||
|
.adc_chan_select = &sun4i_gpadc_chan_select,
|
||||||
|
.adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
|
||||||
|
- .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .temp_data = {SUN4I_GPADC_TEMP_DATA, 0, 0, 0},
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
+ .sensor_count = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
@@ -101,9 +103,10 @@ static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
.tp_adc_select = SUN4I_GPADC_CTRL1_TP_ADC_SELECT,
|
||||||
|
.adc_chan_select = &sun4i_gpadc_chan_select,
|
||||||
|
.adc_chan_mask = SUN4I_GPADC_CTRL1_ADC_CHAN_MASK,
|
||||||
|
- .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .temp_data = {SUN4I_GPADC_TEMP_DATA, 0, 0, 0},
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
+ .sensor_count = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
@@ -113,18 +116,20 @@ static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
.tp_adc_select = SUN6I_GPADC_CTRL1_TP_ADC_SELECT,
|
||||||
|
.adc_chan_select = &sun6i_gpadc_chan_select,
|
||||||
|
.adc_chan_mask = SUN6I_GPADC_CTRL1_ADC_CHAN_MASK,
|
||||||
|
- .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .temp_data = {SUN4I_GPADC_TEMP_DATA, 0, 0, 0},
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
+ .sensor_count = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
.temp_offset = -1662,
|
||||||
|
.temp_scale = 162,
|
||||||
|
.tp_mode_en = SUN8I_A33_GPADC_CTRL1_CHOP_TEMP_EN,
|
||||||
|
- .temp_data = SUN4I_GPADC_TEMP_DATA,
|
||||||
|
+ .temp_data = {SUN4I_GPADC_TEMP_DATA, 0, 0, 0},
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
+ .sensor_count = 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
@@ -142,6 +147,7 @@ struct sun4i_gpadc_iio {
|
||||||
|
struct clk *bus_clk;
|
||||||
|
struct clk *mod_clk;
|
||||||
|
struct reset_control *reset;
|
||||||
|
+ int sensor_id;
|
||||||
|
/* prevents concurrent reads of temperature and ADC */
|
||||||
|
struct mutex mutex;
|
||||||
|
struct thermal_zone_device *tzd;
|
||||||
|
@@ -309,14 +315,15 @@ static int sun4i_gpadc_adc_read(struct iio_dev *indio_dev, int channel,
|
||||||
|
return sun4i_gpadc_read(indio_dev, channel, val, info->fifo_data_irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val)
|
||||||
|
+static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val,
|
||||||
|
+ int sensor)
|
||||||
|
{
|
||||||
|
struct sun4i_gpadc_iio *info = iio_priv(indio_dev);
|
||||||
|
|
||||||
|
if (info->no_irq) {
|
||||||
|
pm_runtime_get_sync(indio_dev->dev.parent);
|
||||||
|
|
||||||
|
- regmap_read(info->regmap, info->data->temp_data, val);
|
||||||
|
+ regmap_read(info->regmap, info->data->temp_data[sensor], val);
|
||||||
|
|
||||||
|
pm_runtime_mark_last_busy(indio_dev->dev.parent);
|
||||||
|
pm_runtime_put_autosuspend(indio_dev->dev.parent);
|
||||||
|
@@ -363,7 +370,7 @@ static int sun4i_gpadc_read_raw(struct iio_dev *indio_dev,
|
||||||
|
ret = sun4i_gpadc_adc_read(indio_dev, chan->channel,
|
||||||
|
val);
|
||||||
|
else
|
||||||
|
- ret = sun4i_gpadc_temp_read(indio_dev, val);
|
||||||
|
+ ret = sun4i_gpadc_temp_read(indio_dev, val, 0);
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
@@ -511,7 +518,7 @@ static int sun4i_gpadc_get_temp(void *data, int *temp)
|
||||||
|
struct sun4i_gpadc_iio *info = data;
|
||||||
|
int val, scale, offset;
|
||||||
|
|
||||||
|
- if (sun4i_gpadc_temp_read(info->indio_dev, &val))
|
||||||
|
+ if (sun4i_gpadc_temp_read(info->indio_dev, &val, info->sensor_id))
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
|
||||||
|
sun4i_gpadc_temp_scale(info->indio_dev, &scale);
|
||||||
|
@@ -755,7 +762,7 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct sun4i_gpadc_iio *info;
|
||||||
|
struct iio_dev *indio_dev;
|
||||||
|
- int ret;
|
||||||
|
+ int ret, i;
|
||||||
|
|
||||||
|
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info));
|
||||||
|
if (!indio_dev)
|
||||||
|
@@ -788,9 +795,12 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
|
||||||
|
pm_runtime_enable(&pdev->dev);
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_THERMAL_OF)) {
|
||||||
|
- info->tzd = thermal_zone_of_sensor_register(info->sensor_device,
|
||||||
|
- 0, info,
|
||||||
|
- &sun4i_ts_tz_ops);
|
||||||
|
+ for (i = 0; i < info->data->sensor_count; i++) {
|
||||||
|
+ info->sensor_id = i;
|
||||||
|
+ info->tzd = thermal_zone_of_sensor_register(
|
||||||
|
+ info->sensor_device,
|
||||||
|
+ i, info, &sun4i_ts_tz_ops);
|
||||||
|
+ }
|
||||||
|
/*
|
||||||
|
* Do not fail driver probing when failing to register in
|
||||||
|
* thermal because no thermal DT node is found.
|
||||||
|
diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
index 39e096c3ddac..40b4dd9d2405 100644
|
||||||
|
--- a/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
+++ b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
@@ -90,6 +90,10 @@
|
||||||
|
#define SUNXI_THS_CTRL0 0x00
|
||||||
|
#define SUNXI_THS_CTRL2 0x40
|
||||||
|
#define SUNXI_THS_FILTER 0x70
|
||||||
|
+#define SUNXI_THS_TDATA0 0x80
|
||||||
|
+#define SUNXI_THS_TDATA1 0x84
|
||||||
|
+#define SUNXI_THS_TDATA2 0x88
|
||||||
|
+#define SUNXI_THS_TDATA3 0x8c
|
||||||
|
|
||||||
|
#define SUNXI_THS_FILTER_EN BIT(2)
|
||||||
|
#define SUNXI_THS_FILTER_TYPE(x) (GENMASK(1, 0) & (x))
|
||||||
|
@@ -101,6 +105,8 @@
|
||||||
|
#define SUNXI_THS_TEMP_SENSE_EN2 BIT(2)
|
||||||
|
#define SUNXI_THS_TEMP_SENSE_EN3 BIT(3)
|
||||||
|
|
||||||
|
+#define MAX_SENSOR_COUNT 4
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_dev {
|
||||||
|
struct device *dev;
|
||||||
|
struct regmap *regmap;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
From 9bb64076c49cf41aaa252ce7b5aa24b93c322bd5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sun, 21 Jan 2018 22:29:55 +0100
|
||||||
|
Subject: [PATCH 015/146] iio: adc: sun4i-gpadc-iio: rework: support nvmem
|
||||||
|
calibration data
|
||||||
|
|
||||||
|
This patch reworks the driver to support nvmem calibration cells.
|
||||||
|
The driver checks if the nvmem calibration is supported and reads out
|
||||||
|
the nvmem. At the beginning of the startup process the calibration data
|
||||||
|
is written to the related registers.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 52 +++++++++++++++++++++++++++++++
|
||||||
|
include/linux/mfd/sun4i-gpadc.h | 2 ++
|
||||||
|
2 files changed, 54 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index bff06f2798e8..7b12666cdd9e 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -27,6 +27,7 @@
|
||||||
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/io.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
+#include <linux/nvmem-consumer.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_device.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
|
@@ -81,6 +82,7 @@ struct gpadc_data {
|
||||||
|
bool has_bus_rst;
|
||||||
|
bool has_mod_clk;
|
||||||
|
int sensor_count;
|
||||||
|
+ bool supports_nvmem;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
@@ -94,6 +96,7 @@ static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
@@ -107,6 +110,7 @@ static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
@@ -120,6 +124,7 @@ static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
@@ -130,6 +135,7 @@ static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
.sample_start = sun4i_gpadc_sample_start,
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
@@ -148,6 +154,8 @@ struct sun4i_gpadc_iio {
|
||||||
|
struct clk *mod_clk;
|
||||||
|
struct reset_control *reset;
|
||||||
|
int sensor_id;
|
||||||
|
+ u32 calibration_data[2];
|
||||||
|
+ bool has_calibration_data[2];
|
||||||
|
/* prevents concurrent reads of temperature and ADC */
|
||||||
|
struct mutex mutex;
|
||||||
|
struct thermal_zone_device *tzd;
|
||||||
|
@@ -459,6 +467,17 @@ static int sun4i_gpadc_runtime_suspend(struct device *dev)
|
||||||
|
return info->data->sample_end(info);
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void sunxi_calibrate(struct sun4i_gpadc_iio *info)
|
||||||
|
+{
|
||||||
|
+ if (info->has_calibration_data[0])
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_CDATA_0_1,
|
||||||
|
+ info->calibration_data[0]);
|
||||||
|
+
|
||||||
|
+ if (info->has_calibration_data[1])
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_CDATA_2_3,
|
||||||
|
+ info->calibration_data[1]);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int sun4i_gpadc_sample_start(struct sun4i_gpadc_iio *info)
|
||||||
|
{
|
||||||
|
/* clkin = 6MHz */
|
||||||
|
@@ -481,6 +500,7 @@ static int sun4i_gpadc_sample_start(struct sun4i_gpadc_iio *info)
|
||||||
|
static int sunxi_ths_sample_start(struct sun4i_gpadc_iio *info)
|
||||||
|
{
|
||||||
|
u32 value;
|
||||||
|
+ sunxi_calibrate(info);
|
||||||
|
|
||||||
|
if (info->data->ctrl0_map)
|
||||||
|
regmap_write(info->regmap, SUNXI_THS_CTRL0,
|
||||||
|
@@ -602,6 +622,9 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
||||||
|
struct resource *mem;
|
||||||
|
void __iomem *base;
|
||||||
|
int ret;
|
||||||
|
+ struct nvmem_cell *cell;
|
||||||
|
+ ssize_t cell_size;
|
||||||
|
+ u64 *cell_data;
|
||||||
|
|
||||||
|
info->data = of_device_get_match_data(&pdev->dev);
|
||||||
|
if (!info->data)
|
||||||
|
@@ -616,6 +639,35 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
||||||
|
if (IS_ERR(base))
|
||||||
|
return PTR_ERR(base);
|
||||||
|
|
||||||
|
+ info->has_calibration_data[0] = false;
|
||||||
|
+ info->has_calibration_data[1] = false;
|
||||||
|
+
|
||||||
|
+ if (!info->data->supports_nvmem)
|
||||||
|
+ goto no_nvmem;
|
||||||
|
+
|
||||||
|
+ cell = devm_nvmem_cell_get(&pdev->dev, "calibration");
|
||||||
|
+ if (IS_ERR(cell)) {
|
||||||
|
+ if (PTR_ERR(cell) == -EPROBE_DEFER)
|
||||||
|
+ return PTR_ERR(cell);
|
||||||
|
+ } else {
|
||||||
|
+ cell_data = (u64 *)nvmem_cell_read(cell, &cell_size);
|
||||||
|
+ devm_nvmem_cell_put(&pdev->dev, cell);
|
||||||
|
+ if (cell_size <= 4) {
|
||||||
|
+ info->has_calibration_data[0] = true;
|
||||||
|
+ info->calibration_data[0] = be32_to_cpu(cell_data[0] &
|
||||||
|
+ GENMASK(31, 0));
|
||||||
|
+ } else if (cell_size <= 8) {
|
||||||
|
+ info->has_calibration_data[0] = true;
|
||||||
|
+ info->calibration_data[0] = be32_to_cpu(cell_data[0] &
|
||||||
|
+ GENMASK(31, 0));
|
||||||
|
+ info->has_calibration_data[1] = true;
|
||||||
|
+ info->calibration_data[1] = be32_to_cpu(
|
||||||
|
+ (cell_data[0] >> 32) & GENMASK(31, 0));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+no_nvmem:
|
||||||
|
+
|
||||||
|
info->regmap = devm_regmap_init_mmio(&pdev->dev, base,
|
||||||
|
&sun4i_gpadc_regmap_config);
|
||||||
|
if (IS_ERR(info->regmap)) {
|
||||||
|
diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
index 40b4dd9d2405..c251002431bd 100644
|
||||||
|
--- a/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
+++ b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
@@ -90,6 +90,8 @@
|
||||||
|
#define SUNXI_THS_CTRL0 0x00
|
||||||
|
#define SUNXI_THS_CTRL2 0x40
|
||||||
|
#define SUNXI_THS_FILTER 0x70
|
||||||
|
+#define SUNXI_THS_CDATA_0_1 0x74
|
||||||
|
+#define SUNXI_THS_CDATA_2_3 0x78
|
||||||
|
#define SUNXI_THS_TDATA0 0x80
|
||||||
|
#define SUNXI_THS_TDATA1 0x84
|
||||||
|
#define SUNXI_THS_TDATA2 0x88
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,253 @@
|
||||||
|
From 153c005037601e2ba02f7fb36d8864194d8c98c8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sun, 21 Jan 2018 11:20:55 +0100
|
||||||
|
Subject: [PATCH 016/146] iio: adc: sun4i-gpadc-iio: rework: add interrupt
|
||||||
|
support
|
||||||
|
|
||||||
|
This patch rewors the driver to support interrupts for the thermal part
|
||||||
|
of the sensor.
|
||||||
|
|
||||||
|
This is only available for the newer sensor (currently H3 and A83T).
|
||||||
|
The interrupt will be trigerd on data available and triggers the update
|
||||||
|
for the thermal sensors. All newer sensors have different amount of
|
||||||
|
sensors and different interrupts for each device the reset of the
|
||||||
|
interrupts need to be done different
|
||||||
|
|
||||||
|
For the newer sensors is the autosuspend disabled.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 68 ++++++++++++++++++++++++++++---
|
||||||
|
include/linux/mfd/sun4i-gpadc.h | 33 +++++++++++++++
|
||||||
|
2 files changed, 95 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 7b12666cdd9e..77e07f042730 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -78,11 +78,14 @@ struct gpadc_data {
|
||||||
|
u32 ctrl2_map;
|
||||||
|
u32 sensor_en_map;
|
||||||
|
u32 filter_map;
|
||||||
|
+ u32 irq_clear_map;
|
||||||
|
+ u32 irq_control_map;
|
||||||
|
bool has_bus_clk;
|
||||||
|
bool has_bus_rst;
|
||||||
|
bool has_mod_clk;
|
||||||
|
int sensor_count;
|
||||||
|
bool supports_nvmem;
|
||||||
|
+ bool support_irq;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
@@ -97,6 +100,7 @@ static const struct gpadc_data sun4i_gpadc_data = {
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
.supports_nvmem = false,
|
||||||
|
+ .support_irq = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
@@ -111,6 +115,7 @@ static const struct gpadc_data sun5i_gpadc_data = {
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
.supports_nvmem = false,
|
||||||
|
+ .support_irq = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
@@ -125,6 +130,7 @@ static const struct gpadc_data sun6i_gpadc_data = {
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
.supports_nvmem = false,
|
||||||
|
+ .support_irq = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
@@ -136,6 +142,7 @@ static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
.sample_end = sun4i_gpadc_sample_end,
|
||||||
|
.sensor_count = 1,
|
||||||
|
.supports_nvmem = false,
|
||||||
|
+ .support_irq = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
@@ -339,6 +346,11 @@ static int sun4i_gpadc_temp_read(struct iio_dev *indio_dev, int *val,
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (info->data->support_irq) {
|
||||||
|
+ regmap_read(info->regmap, info->data->temp_data[sensor], val);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
return sun4i_gpadc_read(indio_dev, 0, val, info->temp_data_irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -436,6 +448,17 @@ static irqreturn_t sun4i_gpadc_fifo_data_irq_handler(int irq, void *dev_id)
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static irqreturn_t sunxi_irq_thread(int irq, void *data)
|
||||||
|
+{
|
||||||
|
+ struct sun4i_gpadc_iio *info = data;
|
||||||
|
+
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_STAT, info->data->irq_clear_map);
|
||||||
|
+
|
||||||
|
+ thermal_zone_device_update(info->tzd, THERMAL_EVENT_TEMP_SAMPLE);
|
||||||
|
+
|
||||||
|
+ return IRQ_HANDLED;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int sun4i_gpadc_sample_end(struct sun4i_gpadc_iio *info)
|
||||||
|
{
|
||||||
|
/* Disable the ADC on IP */
|
||||||
|
@@ -448,6 +471,8 @@ static int sun4i_gpadc_sample_end(struct sun4i_gpadc_iio *info)
|
||||||
|
|
||||||
|
static int sunxi_ths_sample_end(struct sun4i_gpadc_iio *info)
|
||||||
|
{
|
||||||
|
+ /* Disable ths interrupt*/
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_INTC, 0x0);
|
||||||
|
/* Disable temperature sensor */
|
||||||
|
regmap_write(info->regmap, SUNXI_THS_CTRL2, 0x0);
|
||||||
|
|
||||||
|
@@ -509,9 +534,15 @@ static int sunxi_ths_sample_start(struct sun4i_gpadc_iio *info)
|
||||||
|
regmap_write(info->regmap, SUNXI_THS_CTRL2,
|
||||||
|
info->data->ctrl2_map);
|
||||||
|
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_STAT,
|
||||||
|
+ info->data->irq_clear_map);
|
||||||
|
+
|
||||||
|
regmap_write(info->regmap, SUNXI_THS_FILTER,
|
||||||
|
info->data->filter_map);
|
||||||
|
|
||||||
|
+ regmap_write(info->regmap, SUNXI_THS_INTC,
|
||||||
|
+ info->data->irq_control_map);
|
||||||
|
+
|
||||||
|
regmap_read(info->regmap, SUNXI_THS_CTRL2, &value);
|
||||||
|
|
||||||
|
regmap_write(info->regmap, SUNXI_THS_CTRL2,
|
||||||
|
@@ -625,12 +656,29 @@ static int sun4i_gpadc_probe_dt(struct platform_device *pdev,
|
||||||
|
struct nvmem_cell *cell;
|
||||||
|
ssize_t cell_size;
|
||||||
|
u64 *cell_data;
|
||||||
|
+ int irq;
|
||||||
|
|
||||||
|
info->data = of_device_get_match_data(&pdev->dev);
|
||||||
|
if (!info->data)
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
- info->no_irq = true;
|
||||||
|
+ if (info->data->support_irq) {
|
||||||
|
+ /* only the new versions of ths support right now irqs */
|
||||||
|
+ irq = platform_get_irq(pdev, 0);
|
||||||
|
+ if (irq < 0) {
|
||||||
|
+ dev_err(&pdev->dev, "failed to get IRQ: %d\n", irq);
|
||||||
|
+ return irq;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
|
||||||
|
+ sunxi_irq_thread, IRQF_ONESHOT,
|
||||||
|
+ dev_name(&pdev->dev), info);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ } else
|
||||||
|
+ info->no_irq = true;
|
||||||
|
+
|
||||||
|
indio_dev->num_channels = ARRAY_SIZE(sun8i_a33_gpadc_channels);
|
||||||
|
indio_dev->channels = sun8i_a33_gpadc_channels;
|
||||||
|
|
||||||
|
@@ -840,11 +888,13 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
- pm_runtime_set_autosuspend_delay(&pdev->dev,
|
||||||
|
- SUN4I_GPADC_AUTOSUSPEND_DELAY);
|
||||||
|
- pm_runtime_use_autosuspend(&pdev->dev);
|
||||||
|
- pm_runtime_set_suspended(&pdev->dev);
|
||||||
|
- pm_runtime_enable(&pdev->dev);
|
||||||
|
+ if (!info->data->support_irq) {
|
||||||
|
+ pm_runtime_set_autosuspend_delay(&pdev->dev,
|
||||||
|
+ SUN4I_GPADC_AUTOSUSPEND_DELAY);
|
||||||
|
+ pm_runtime_use_autosuspend(&pdev->dev);
|
||||||
|
+ pm_runtime_set_suspended(&pdev->dev);
|
||||||
|
+ pm_runtime_enable(&pdev->dev);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
if (IS_ENABLED(CONFIG_THERMAL_OF)) {
|
||||||
|
for (i = 0; i < info->data->sensor_count; i++) {
|
||||||
|
@@ -865,6 +915,9 @@ static int sun4i_gpadc_probe(struct platform_device *pdev)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ if (info->data->support_irq)
|
||||||
|
+ info->data->sample_start(info);
|
||||||
|
+
|
||||||
|
ret = devm_iio_device_register(&pdev->dev, indio_dev);
|
||||||
|
if (ret < 0) {
|
||||||
|
dev_err(&pdev->dev, "could not register the device\n");
|
||||||
|
@@ -894,6 +947,9 @@ static int sun4i_gpadc_remove(struct platform_device *pdev)
|
||||||
|
if (!IS_ENABLED(CONFIG_THERMAL_OF))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
+ if (info->data->support_irq)
|
||||||
|
+ info->data->sample_end(info);
|
||||||
|
+
|
||||||
|
thermal_zone_of_sensor_unregister(info->sensor_device, info->tzd);
|
||||||
|
|
||||||
|
if (!info->no_irq)
|
||||||
|
diff --git a/include/linux/mfd/sun4i-gpadc.h b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
index c251002431bd..ab34a96a7ff3 100644
|
||||||
|
--- a/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
+++ b/include/linux/mfd/sun4i-gpadc.h
|
||||||
|
@@ -89,6 +89,8 @@
|
||||||
|
/* SUNXI_THS COMMON REGISTERS + DEFINES */
|
||||||
|
#define SUNXI_THS_CTRL0 0x00
|
||||||
|
#define SUNXI_THS_CTRL2 0x40
|
||||||
|
+#define SUNXI_THS_INTC 0x44
|
||||||
|
+#define SUNXI_THS_STAT 0x48
|
||||||
|
#define SUNXI_THS_FILTER 0x70
|
||||||
|
#define SUNXI_THS_CDATA_0_1 0x74
|
||||||
|
#define SUNXI_THS_CDATA_2_3 0x78
|
||||||
|
@@ -107,6 +109,37 @@
|
||||||
|
#define SUNXI_THS_TEMP_SENSE_EN2 BIT(2)
|
||||||
|
#define SUNXI_THS_TEMP_SENSE_EN3 BIT(3)
|
||||||
|
|
||||||
|
+#define SUNXI_THS_TEMP_PERIOD(x) (GENMASK(31, 12) & ((x) << 12))
|
||||||
|
+
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_OFF_2 BIT(14)
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_OFF_1 BIT(13)
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_OFF_0 BIT(12)
|
||||||
|
+#define SUNXI_THS_INTS_TDATA_IRQ_3 BIT(11)
|
||||||
|
+#define SUNXI_THS_INTS_TDATA_IRQ_2 BIT(10)
|
||||||
|
+#define SUNXI_THS_INTS_TDATA_IRQ_1 BIT(9)
|
||||||
|
+#define SUNXI_THS_INTS_TDATA_IRQ_0 BIT(8)
|
||||||
|
+#define SUNXI_THS_INTS_SHUT_INT_3 BIT(7)
|
||||||
|
+#define SUNXI_THS_INTS_SHUT_INT_2 BIT(6)
|
||||||
|
+#define SUNXI_THS_INTS_SHUT_INT_1 BIT(5)
|
||||||
|
+#define SUNXI_THS_INTS_SHUT_INT_0 BIT(4)
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_INT_3 BIT(3)
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_INT_2 BIT(2)
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_INT_1 BIT(1)
|
||||||
|
+#define SUNXI_THS_INTS_ALARM_INT_0 BIT(0)
|
||||||
|
+
|
||||||
|
+#define SUNXI_THS_INTC_TDATA_IRQ_EN3 BIT(11)
|
||||||
|
+#define SUNXI_THS_INTC_TDATA_IRQ_EN2 BIT(10)
|
||||||
|
+#define SUNXI_THS_INTC_TDATA_IRQ_EN1 BIT(9)
|
||||||
|
+#define SUNXI_THS_INTC_TDATA_IRQ_EN0 BIT(8)
|
||||||
|
+#define SUNXI_THS_INTC_SHUT_INT_EN3 BIT(7)
|
||||||
|
+#define SUNXI_THS_INTC_SHUT_INT_EN2 BIT(6)
|
||||||
|
+#define SUNXI_THS_INTC_SHUT_INT_EN1 BIT(5)
|
||||||
|
+#define SUNXI_THS_INTC_SHUT_INT_EN0 BIT(4)
|
||||||
|
+#define SUNXI_THS_INTC_ALARM_INT_EN3 BIT(3)
|
||||||
|
+#define SUNXI_THS_INTC_ALARM_INT_EN2 BIT(2)
|
||||||
|
+#define SUNXI_THS_INTC_ALARM_INT_EN1 BIT(1)
|
||||||
|
+#define SUNXI_THS_INTC_ALARM_INT_EN0 BIT(0)
|
||||||
|
+
|
||||||
|
#define MAX_SENSOR_COUNT 4
|
||||||
|
|
||||||
|
struct sun4i_gpadc_dev {
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
From 1968a84bd7cfdf60b29a154e682c4239bdfe6cb7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sun, 21 Jan 2018 23:14:09 +0100
|
||||||
|
Subject: [PATCH 017/146] iio: adc: sun4i-gpadc-iio: add support for H3 thermal
|
||||||
|
sensor
|
||||||
|
|
||||||
|
This patch adds support for the H3 ths sensor.
|
||||||
|
|
||||||
|
The H3 supports interrupts. The interrupt is configured to update the
|
||||||
|
the sensor values every second. The calibration data is writen at the
|
||||||
|
begin of the init process.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 29 +++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 29 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 77e07f042730..f2e0ec65c53e 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -145,6 +145,31 @@ static const struct gpadc_data sun8i_a33_gpadc_data = {
|
||||||
|
.support_irq = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct gpadc_data sun8i_h3_ths_data = {
|
||||||
|
+ .temp_offset = -1791,
|
||||||
|
+ .temp_scale = -121,
|
||||||
|
+ .temp_data = {SUNXI_THS_TDATA0, 0, 0, 0},
|
||||||
|
+ .sample_start = sunxi_ths_sample_start,
|
||||||
|
+ .sample_end = sunxi_ths_sample_end,
|
||||||
|
+ .has_bus_clk = true,
|
||||||
|
+ .has_bus_rst = true,
|
||||||
|
+ .has_mod_clk = true,
|
||||||
|
+ .sensor_count = 1,
|
||||||
|
+ .supports_nvmem = true,
|
||||||
|
+ .support_irq = true,
|
||||||
|
+ .ctrl0_map = SUNXI_THS_ACQ0(0xff),
|
||||||
|
+ .ctrl2_map = SUNXI_THS_ACQ1(0x3f),
|
||||||
|
+ .sensor_en_map = SUNXI_THS_TEMP_SENSE_EN0,
|
||||||
|
+ .filter_map = SUNXI_THS_FILTER_EN |
|
||||||
|
+ SUNXI_THS_FILTER_TYPE(0x2),
|
||||||
|
+ .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_OFF_0,
|
||||||
|
+ .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 |
|
||||||
|
+ SUNXI_THS_TEMP_PERIOD(0x7),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
struct iio_dev *indio_dev;
|
||||||
|
struct completion completion;
|
||||||
|
@@ -643,6 +668,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = {
|
||||||
|
.compatible = "allwinner,sun8i-a33-ths",
|
||||||
|
.data = &sun8i_a33_gpadc_data,
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .compatible = "allwinner,sun8i-h3-ths",
|
||||||
|
+ .data = &sun8i_h3_ths_data,
|
||||||
|
+ },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,75 @@
|
||||||
|
From 20484f59a26747db157563c9ba13767c21b48efb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sun, 21 Jan 2018 18:50:11 +0100
|
||||||
|
Subject: [PATCH 018/146] iio: adc: sun4i-gpadc-iio: add support for A83T
|
||||||
|
thermal sensor
|
||||||
|
|
||||||
|
This patch adds support for the A83T ths sensor.
|
||||||
|
|
||||||
|
The A83T does not support interrupts. This seems to be broken.
|
||||||
|
The calibration data is writen at the begin of the init process.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 38 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 38 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index f2e0ec65c53e..b8693afcdbea 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -170,6 +170,40 @@ static const struct gpadc_data sun8i_h3_ths_data = {
|
||||||
|
SUNXI_THS_TEMP_PERIOD(0x7),
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct gpadc_data sun8i_a83t_ths_data = {
|
||||||
|
+ .temp_offset = -2724,
|
||||||
|
+ .temp_scale = -70,
|
||||||
|
+ .temp_data = {SUNXI_THS_TDATA0,
|
||||||
|
+ SUNXI_THS_TDATA1,
|
||||||
|
+ SUNXI_THS_TDATA2,
|
||||||
|
+ 0},
|
||||||
|
+ .sample_start = sunxi_ths_sample_start,
|
||||||
|
+ .sample_end = sunxi_ths_sample_end,
|
||||||
|
+ .sensor_count = 3,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
+ .support_irq = true,
|
||||||
|
+ .ctrl0_map = SUNXI_THS_ACQ0(0x1f3),
|
||||||
|
+ .ctrl2_map = SUNXI_THS_ACQ1(0x1f3),
|
||||||
|
+ .sensor_en_map = SUNXI_THS_TEMP_SENSE_EN0 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN1 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN2,
|
||||||
|
+ .filter_map = SUNXI_THS_FILTER_EN |
|
||||||
|
+ SUNXI_THS_FILTER_TYPE(0x2),
|
||||||
|
+ .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_2 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_2 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_0 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_1 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_2,
|
||||||
|
+ .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN1 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN2 |
|
||||||
|
+ SUNXI_THS_TEMP_PERIOD(0x257),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
struct iio_dev *indio_dev;
|
||||||
|
struct completion completion;
|
||||||
|
@@ -672,6 +706,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = {
|
||||||
|
.compatible = "allwinner,sun8i-h3-ths",
|
||||||
|
.data = &sun8i_h3_ths_data,
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .compatible = "allwinner,sun8i-a83t-ths",
|
||||||
|
+ .data = &sun8i_a83t_ths_data,
|
||||||
|
+ },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
From e475b475fbab608b805a57c8cc083e7b3da77954 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Fri, 26 Jan 2018 01:07:15 +0100
|
||||||
|
Subject: [PATCH 020/146] arm: dts: sun8i: h3: add support for the thermal
|
||||||
|
sensor in H3
|
||||||
|
|
||||||
|
This patch adds the missing compatible and the thermal sensor cells.
|
||||||
|
The H3 has one sensor.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun8i-h3.dtsi | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
index f0096074a467..5907b54b6e1d 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
@@ -216,3 +216,8 @@
|
||||||
|
&pio {
|
||||||
|
compatible = "allwinner,sun8i-h3-pinctrl";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+&ths {
|
||||||
|
+ compatible = "allwinner,sun8i-h3-ths";
|
||||||
|
+ #thermal-sensor-cells = <0>;
|
||||||
|
+};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
From 16346f511d19e20e12041076f402606b87de0b56 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Fri, 26 Jan 2018 01:10:12 +0100
|
||||||
|
Subject: [PATCH 021/146] arm: dts: sun8i: h3: add thermal zone to H3
|
||||||
|
|
||||||
|
This patch adds the thermal zones to the H3. We have only one sensor and
|
||||||
|
that is placed in the cpu.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun8i-h3.dtsi | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
index 5907b54b6e1d..d2c85be8a2d0 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
@@ -111,6 +111,15 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ thermal-zones {
|
||||||
|
+ cpu-thermal {
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 0>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
timer {
|
||||||
|
compatible = "arm,armv7-timer";
|
||||||
|
interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_LOW)>,
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
From 328b1316b4a89f2bf9e451f3cfa41d591962c44e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Tue, 23 Jan 2018 10:57:37 +0100
|
||||||
|
Subject: [PATCH 022/146] arm: dts: sun8i: h3: enable H3 sid controller
|
||||||
|
|
||||||
|
This patch enables the the sid controller in the H3. It can be used
|
||||||
|
for thermal calibration data.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun8i-h3.dtsi | 7 +++++++
|
||||||
|
1 file changed, 7 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h3.dtsi b/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
index d2c85be8a2d0..791a9406c671 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h3.dtsi
|
||||||
|
@@ -111,6 +111,13 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ soc {
|
||||||
|
+ sid: eeprom@1c14000 {
|
||||||
|
+ compatible = "allwinner,sun8i-h3-sid";
|
||||||
|
+ reg = <0x01c14000 0x400>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
thermal-zones {
|
||||||
|
cpu-thermal {
|
||||||
|
/* milliseconds */
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
From 4d9df1fab6b1601612b7b4380f83d3c4560c671e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Fri, 26 Jan 2018 01:15:17 +0100
|
||||||
|
Subject: [PATCH 023/146] arm: dts: sun8i: a83t: add support for the thermal
|
||||||
|
sensor in A83T
|
||||||
|
|
||||||
|
As we have gained the support for the thermal sensor in A83T,
|
||||||
|
we can now add its device nodes to the device tree.
|
||||||
|
|
||||||
|
The A83T seems to have a broken IRQ 31, thus we use here IRQ 41.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun8i-a83t.dtsi | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||||
|
index 00a02b037320..6bdfcc7a1ac3 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||||
|
@@ -757,6 +757,14 @@
|
||||||
|
clocks = <&osc24M>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ ths: thermal-sensor@1f04000 {
|
||||||
|
+ compatible = "allwinner,sun8i-a83t-ths";
|
||||||
|
+ reg = <0x01f04000 0x100>;
|
||||||
|
+ interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ #thermal-sensor-cells = <1>;
|
||||||
|
+ #io-channel-cells = <0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
watchdog@1c20ca0 {
|
||||||
|
compatible = "allwinner,sun6i-a31-wdt";
|
||||||
|
reg = <0x01c20ca0 0x20>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
From 5bcffafbbcc98a66101d02d37ba6beca3f52068e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Fri, 26 Jan 2018 01:17:14 +0100
|
||||||
|
Subject: [PATCH 024/146] arm: dts: sun8i: a83t: add thermal zone to A83T
|
||||||
|
|
||||||
|
This patch adds the thermal zones to the A83T. Sensor 0 is located in the
|
||||||
|
cpu cluster 0. Sensor 1 is located in cluster 1 and Sensor 3 is located
|
||||||
|
in the gpu.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun8i-a83t.dtsi | 20 ++++++++++++++++++++
|
||||||
|
1 file changed, 20 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||||
|
index 6bdfcc7a1ac3..ec22157419b6 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||||
|
@@ -1033,4 +1033,24 @@
|
||||||
|
#size-cells = <0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ thermal-zones {
|
||||||
|
+ cpu0_thermal: cpu0-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ cpu1_thermal: cpu1-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 1>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ gpu_thermal: gpu-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 2>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
From f79548364ea767853c5a95f1db2407219f06572a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Wed, 24 Jan 2018 22:35:13 +0100
|
||||||
|
Subject: [PATCH 026/146] iio: adc: Kconfig: enable A80, A64 and H5 for THS
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/Kconfig | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
|
||||||
|
index 4a754921fb6f..c77aec60a364 100644
|
||||||
|
--- a/drivers/iio/adc/Kconfig
|
||||||
|
+++ b/drivers/iio/adc/Kconfig
|
||||||
|
@@ -723,7 +723,7 @@ config STX104
|
||||||
|
config SUN4I_GPADC
|
||||||
|
tristate "Support for the Allwinner SoCs GPADC"
|
||||||
|
depends on IIO
|
||||||
|
- depends on MFD_SUN4I_GPADC || MACH_SUN8I
|
||||||
|
+ depends on MFD_SUN4I_GPADC || MACH_SUN8I || MACH_SUN50I || MACH_SUN9I
|
||||||
|
depends on THERMAL || !THERMAL_OF
|
||||||
|
select REGMAP_IRQ
|
||||||
|
help
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
From 46f1130b5286457e519c296a4b683747deb983cb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Wed, 24 Jan 2018 16:58:30 +0100
|
||||||
|
Subject: [PATCH 027/146] iio: adc: sun4i-gpadc-iio: add support for H5 thermal
|
||||||
|
sensor
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
This patch adds support for the H5 ths sensor.
|
||||||
|
|
||||||
|
The H5 supports interrupts. The interrupt is configured to update
|
||||||
|
the sensor values every second. The sensor is except the scale/offset
|
||||||
|
values and an additional sensor for the gpu the same. A temperatur higer
|
||||||
|
than 70°C needs an other formula. Since the operating temperatures maximum
|
||||||
|
is 70°C this case was neglegted.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 36 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 36 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index b8693afcdbea..40529a197335 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -204,6 +204,38 @@ static const struct gpadc_data sun8i_a83t_ths_data = {
|
||||||
|
SUNXI_THS_TEMP_PERIOD(0x257),
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct gpadc_data sun50i_h5_ths_data = {
|
||||||
|
+ .temp_offset = -1872,
|
||||||
|
+ .temp_scale = -119,
|
||||||
|
+ .temp_data = {SUNXI_THS_TDATA0,
|
||||||
|
+ SUNXI_THS_TDATA1, 0, 0},
|
||||||
|
+ .sample_start = sunxi_ths_sample_start,
|
||||||
|
+ .sample_end = sunxi_ths_sample_end,
|
||||||
|
+ .has_bus_clk = true,
|
||||||
|
+ .has_bus_rst = true,
|
||||||
|
+ .has_mod_clk = true,
|
||||||
|
+ .sensor_count = 2,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
+ .support_irq = true,
|
||||||
|
+ .ctrl0_map = SUNXI_THS_ACQ0(0x1f3),
|
||||||
|
+ .ctrl2_map = SUNXI_THS_ACQ1(0x1f3),
|
||||||
|
+ .sensor_en_map = SUNXI_THS_TEMP_SENSE_EN0 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN1,
|
||||||
|
+ .filter_map = SUNXI_THS_FILTER_EN |
|
||||||
|
+ SUNXI_THS_FILTER_TYPE(0x2),
|
||||||
|
+ .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_0 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_1 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_OFF_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_OFF_1,
|
||||||
|
+ .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN1 |
|
||||||
|
+ SUNXI_THS_TEMP_PERIOD(0x3a),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
struct iio_dev *indio_dev;
|
||||||
|
struct completion completion;
|
||||||
|
@@ -710,6 +742,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = {
|
||||||
|
.compatible = "allwinner,sun8i-a83t-ths",
|
||||||
|
.data = &sun8i_a83t_ths_data,
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .compatible = "allwinner,sun50i-h5-ths",
|
||||||
|
+ .data = &sun50i_h5_ths_data,
|
||||||
|
+ },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,86 @@
|
||||||
|
From 413a3bde03c061d4b5affe25ad75f4dfe6e3282b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Wed, 24 Jan 2018 17:28:02 +0100
|
||||||
|
Subject: [PATCH 028/146] iio: adc: sun4i-gpadc-iio: add support for A80
|
||||||
|
thermal sensor
|
||||||
|
|
||||||
|
This patch adds support for the A80 ths sensor.
|
||||||
|
|
||||||
|
The A80 has 4 sensors and supports interrupts. The interrupt is configured to update
|
||||||
|
the sensor values every second. The A80 shares some registers with the
|
||||||
|
integrated GPADC. ACQ0 must be set in the GPADC register with the offset
|
||||||
|
0x00. In fact the GPADC and the THS use the same register base and also
|
||||||
|
the same clocks and resets.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 46 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 46 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 40529a197335..7ab175f0bd40 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -236,6 +236,48 @@ static const struct gpadc_data sun50i_h5_ths_data = {
|
||||||
|
SUNXI_THS_TEMP_PERIOD(0x3a),
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct gpadc_data sun9i_a80_ths_data = {
|
||||||
|
+ .temp_offset = -2794,
|
||||||
|
+ .temp_scale = -67,
|
||||||
|
+ .temp_data = {SUNXI_THS_TDATA0,
|
||||||
|
+ SUNXI_THS_TDATA1,
|
||||||
|
+ SUNXI_THS_TDATA2,
|
||||||
|
+ SUNXI_THS_TDATA3},
|
||||||
|
+ .sample_start = sunxi_ths_sample_start,
|
||||||
|
+ .sample_end = sunxi_ths_sample_end,
|
||||||
|
+ .has_bus_clk = true,
|
||||||
|
+ .has_bus_rst = true,
|
||||||
|
+ .has_mod_clk = true,
|
||||||
|
+ .sensor_count = 4,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
+ .support_irq = true,
|
||||||
|
+ .ctrl0_map = SUNXI_THS_ACQ0(0x1f3),
|
||||||
|
+ .ctrl2_map = SUNXI_THS_TEMP_SENSE_EN0 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN1 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN2 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN3 |
|
||||||
|
+ SUNXI_THS_ACQ1(0x1f3),
|
||||||
|
+ .filter_map = SUNXI_THS_FILTER_EN |
|
||||||
|
+ SUNXI_THS_FILTER_TYPE(0x2),
|
||||||
|
+ .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_2 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_3 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_2 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_3 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_0 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_1 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_2 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_3,
|
||||||
|
+ .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN1 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN2 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN3 |
|
||||||
|
+ SUNXI_THS_TEMP_PERIOD(0x3a),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
struct iio_dev *indio_dev;
|
||||||
|
struct completion completion;
|
||||||
|
@@ -746,6 +788,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = {
|
||||||
|
.compatible = "allwinner,sun50i-h5-ths",
|
||||||
|
.data = &sun50i_h5_ths_data,
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .compatible = "allwinner,sun9i-a80-ths",
|
||||||
|
+ .data = &sun9i_a80_ths_data,
|
||||||
|
+ },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
From 5a1eb96e482c276f8bc81c18696748ecb20b3656 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Wed, 24 Jan 2018 17:41:45 +0100
|
||||||
|
Subject: [PATCH 029/146] iio: adc: sun4i-gpadc-iio: add support for A64
|
||||||
|
thermal sensor
|
||||||
|
|
||||||
|
This patch adds support for the A64 ths sensor.
|
||||||
|
|
||||||
|
The A64 supports interrupts. The interrupt is configured to update
|
||||||
|
the sensor values every second.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 50 +++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 50 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index 7ab175f0bd40..fdfa01bad325 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -278,6 +278,52 @@ static const struct gpadc_data sun9i_a80_ths_data = {
|
||||||
|
SUNXI_THS_TEMP_PERIOD(0x3a),
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct gpadc_data sun50i_a64_ths_data = {
|
||||||
|
+ .temp_offset = -2170,
|
||||||
|
+ .temp_scale = -117,
|
||||||
|
+ .temp_data = {SUNXI_THS_TDATA0,
|
||||||
|
+ SUNXI_THS_TDATA1,
|
||||||
|
+ SUNXI_THS_TDATA2,
|
||||||
|
+ 0},
|
||||||
|
+ .sample_start = sunxi_ths_sample_start,
|
||||||
|
+ .sample_end = sunxi_ths_sample_end,
|
||||||
|
+ .has_bus_clk = true,
|
||||||
|
+ .has_bus_rst = true,
|
||||||
|
+ .has_mod_clk = true,
|
||||||
|
+ .sensor_count = 3,
|
||||||
|
+ .supports_nvmem = false,
|
||||||
|
+ .support_irq = true,
|
||||||
|
+
|
||||||
|
+ /* The final sample period is calculated as follows:
|
||||||
|
+ * (THERMAL_PER + 1) * 4096 / 24MHz * 2^(FILTER_TYPE + 1)
|
||||||
|
+ *
|
||||||
|
+ * This results to about 1Hz with these settings.
|
||||||
|
+ */
|
||||||
|
+ .ctrl0_map = SUNXI_THS_ACQ0(0xff),
|
||||||
|
+ .ctrl2_map = SUNXI_THS_TEMP_SENSE_EN0 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN1 |
|
||||||
|
+ SUNXI_THS_TEMP_SENSE_EN2 |
|
||||||
|
+ SUNXI_THS_ACQ1(0x3f),
|
||||||
|
+ .filter_map = SUNXI_THS_FILTER_EN |
|
||||||
|
+ SUNXI_THS_FILTER_TYPE(0x1),
|
||||||
|
+ .irq_clear_map = SUNXI_THS_INTS_ALARM_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_INT_2 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_0 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_1 |
|
||||||
|
+ SUNXI_THS_INTS_SHUT_INT_2 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_0 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_1 |
|
||||||
|
+ SUNXI_THS_INTS_TDATA_IRQ_2 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_OFF_0 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_OFF_1 |
|
||||||
|
+ SUNXI_THS_INTS_ALARM_OFF_2,
|
||||||
|
+ .irq_control_map = SUNXI_THS_INTC_TDATA_IRQ_EN0 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN1 |
|
||||||
|
+ SUNXI_THS_INTC_TDATA_IRQ_EN2 |
|
||||||
|
+ SUNXI_THS_TEMP_PERIOD(0x7),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
struct sun4i_gpadc_iio {
|
||||||
|
struct iio_dev *indio_dev;
|
||||||
|
struct completion completion;
|
||||||
|
@@ -792,6 +838,10 @@ static const struct of_device_id sun4i_gpadc_of_id[] = {
|
||||||
|
.compatible = "allwinner,sun9i-a80-ths",
|
||||||
|
.data = &sun9i_a80_ths_data,
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .compatible = "allwinner,sun50i-a64-ths",
|
||||||
|
+ .data = &sun50i_a64_ths_data,
|
||||||
|
+ },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
From e6e2d489bd4776f62a962ad8f511d862a1864f80 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Fri, 26 Jan 2018 01:40:38 +0100
|
||||||
|
Subject: [PATCH 030/146] arm64: dts: allwinner: h5: add support for the
|
||||||
|
thermal sensor in H5
|
||||||
|
|
||||||
|
This patch adds the missing compatible and the thermal sensor cells.
|
||||||
|
The H5 has two sensors.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
|
||||||
|
index 62d646baac3c..ee12490203b8 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
|
||||||
|
@@ -129,3 +129,8 @@
|
||||||
|
<GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
compatible = "allwinner,sun50i-h5-pinctrl";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+&ths {
|
||||||
|
+ compatible = "allwinner,sun50i-h5-ths";
|
||||||
|
+ #thermal-sensor-cells = <1>;
|
||||||
|
+};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
From b3ec6c1e145347ad88b14fcab39080c5af9410ef Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Fri, 26 Jan 2018 01:42:16 +0100
|
||||||
|
Subject: [PATCH 031/146] arm64: dts: allwinner: h5: add termal zone to H5
|
||||||
|
|
||||||
|
This patch adds the termal zones to the H5. Sensor 0 is located in the
|
||||||
|
cpu. Sensor 1 is located in the gpu.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi | 16 ++++++++++++++++
|
||||||
|
1 file changed, 16 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
|
||||||
|
index ee12490203b8..849c3d8a50bb 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5.dtsi
|
||||||
|
@@ -81,6 +81,22 @@
|
||||||
|
method = "smc";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ thermal-zones {
|
||||||
|
+ cpu-thermal {
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ gpu-thermal {
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 1>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
timer {
|
||||||
|
compatible = "arm,armv8-timer";
|
||||||
|
interrupts = <GIC_PPI 13
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
From 4990f2559d012df5c225df7cda3c29d60d3263b7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sat, 27 Jan 2018 21:30:16 +0100
|
||||||
|
Subject: [PATCH 032/146] arm: dts: sun9i: a80: add support for the thermal
|
||||||
|
sensor in A80
|
||||||
|
|
||||||
|
As we have gained the support for the thermal sensor in A80,
|
||||||
|
we can now add its device nodes to the device tree.
|
||||||
|
|
||||||
|
The clocks and the resets are shared between the GPADC and the THS
|
||||||
|
sensor.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun9i-a80.dtsi | 11 +++++++++++
|
||||||
|
1 file changed, 11 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi
|
||||||
|
index 25591d6883ef..9411831d04aa 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun9i-a80.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun9i-a80.dtsi
|
||||||
|
@@ -913,6 +913,17 @@
|
||||||
|
#reset-cells = <1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ ths: thermal-sensor@6004C00 {
|
||||||
|
+ compatible = "allwinner,sun9i-a80-ths";
|
||||||
|
+ reg = <0x06004C00 0x100>;
|
||||||
|
+ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_GPADC>, <&ccu CLK_GPADC>;
|
||||||
|
+ clock-names = "bus", "mod";
|
||||||
|
+ resets = <&ccu RST_BUS_GPADC>;
|
||||||
|
+ #thermal-sensor-cells = <1>;
|
||||||
|
+ #io-channel-cells = <0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
timer@6000c00 {
|
||||||
|
compatible = "allwinner,sun4i-a10-timer";
|
||||||
|
reg = <0x06000c00 0xa0>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
From 559d5cc47ffd71a47da77424e251a8d21250cabb Mon Sep 17 00:00:00 2001
|
||||||
|
From: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
Date: Sat, 27 Jan 2018 21:39:09 +0100
|
||||||
|
Subject: [PATCH 033/146] arm: dts: sun9i: a80: add thermal zone to A80
|
||||||
|
|
||||||
|
This patch adds the thermal zones to the A80.
|
||||||
|
|
||||||
|
Sensor 0 is located besides the big CPU, sensor 1 is located besides the
|
||||||
|
DRAM, sensor 2 is located besides the GPU and sensor 3 is located besides
|
||||||
|
the small CPU.
|
||||||
|
|
||||||
|
Signed-off-by: Philipp Rossak <embed3d@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun9i-a80.dtsi | 26 ++++++++++++++++++++++++++
|
||||||
|
1 file changed, 26 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun9i-a80.dtsi b/arch/arm/boot/dts/sun9i-a80.dtsi
|
||||||
|
index 9411831d04aa..6c52b33dad84 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun9i-a80.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun9i-a80.dtsi
|
||||||
|
@@ -1221,4 +1221,30 @@
|
||||||
|
#size-cells = <0>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ thermal-zones {
|
||||||
|
+ cpu0_thermal: cpu0-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 0>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ dram_thermal: dram-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 1>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ gpu_thermal: gpu-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 2>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ cpu2_thermal: cpu2-thermal {
|
||||||
|
+ polling-delay-passive = <1000>;
|
||||||
|
+ polling-delay = <5000>;
|
||||||
|
+ thermal-sensors = <&ths 3>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
62
patch/kernel/sunxi-dev/0034-dts-a64-ths.patch
Normal file
62
patch/kernel/sunxi-dev/0034-dts-a64-ths.patch
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
From ff4436bd3de240a1d0796d4c6f8bd676ff0925e1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Mon, 23 Apr 2018 23:24:41 -0700
|
||||||
|
Subject: [PATCH 034/146] dts: a64 ths
|
||||||
|
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 32 +++++++++++++++++++
|
||||||
|
1 file changed, 32 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
index 0b44018361cb..0eb482eb58b7 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
@@ -171,6 +171,27 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ thermal-zones {
|
||||||
|
+ cpu_thermal: cpu0-thermal {
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 0>;
|
||||||
|
+ };
|
||||||
|
+ gpu0_thermal: gpu0-thermal {
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 1>;
|
||||||
|
+ };
|
||||||
|
+ gpu1_thermal: gpu1-thermal {
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 2>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
timer {
|
||||||
|
compatible = "arm,armv8-timer";
|
||||||
|
interrupts = <GIC_PPI 13
|
||||||
|
@@ -536,6 +557,17 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ ths: thermal-sensor@1c25000 {
|
||||||
|
+ compatible = "allwinner,sun50i-a64-ths";
|
||||||
|
+ reg = <0x01c25000 0x100>;
|
||||||
|
+ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>;
|
||||||
|
+ clock-names = "bus", "mod";
|
||||||
|
+ resets = <&ccu RST_BUS_THS>;
|
||||||
|
+ #io-channel-cells = <0>;
|
||||||
|
+ #thermal-sensor-cells = <1>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
uart0: serial@1c28000 {
|
||||||
|
compatible = "snps,dw-apb-uart";
|
||||||
|
reg = <0x01c28000 0x400>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
From 5afd98f6db25b34a96bfc7544681dbf40896c1fd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Sat, 23 Sep 2017 08:15:29 +0800
|
||||||
|
Subject: [PATCH 035/146] clk: sunxi-ng: add mux and pll notifiers for A64 CPU
|
||||||
|
clock
|
||||||
|
|
||||||
|
The A64 PLL_CPU clock has the same instability if some factor changed
|
||||||
|
without the PLL gated like other SoCs with sun6i-style CCU, e.g. A33,
|
||||||
|
H3.
|
||||||
|
|
||||||
|
Add the mux and pll notifiers for A64 CPU clock to workaround the
|
||||||
|
problem.
|
||||||
|
|
||||||
|
Fixes: c6a0637460c2 ("clk: sunxi-ng: Add A64 clocks")
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 28 ++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 27 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
|
||||||
|
index ee9c12cf3f08..1fe3c3fbc9bc 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
|
||||||
|
@@ -896,11 +896,26 @@ static const struct sunxi_ccu_desc sun50i_a64_ccu_desc = {
|
||||||
|
.num_resets = ARRAY_SIZE(sun50i_a64_ccu_resets),
|
||||||
|
};
|
||||||
|
|
||||||
|
+static struct ccu_pll_nb sun50i_a64_pll_cpu_nb = {
|
||||||
|
+ .common = &pll_cpux_clk.common,
|
||||||
|
+ /* copy from pll_cpux_clk */
|
||||||
|
+ .enable = BIT(31),
|
||||||
|
+ .lock = BIT(28),
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static struct ccu_mux_nb sun50i_a64_cpu_nb = {
|
||||||
|
+ .common = &cpux_clk.common,
|
||||||
|
+ .cm = &cpux_clk.mux,
|
||||||
|
+ .delay_us = 1, /* > 8 clock cycles at 24 MHz */
|
||||||
|
+ .bypass_index = 1, /* index of 24 MHz oscillator */
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static int sun50i_a64_ccu_probe(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct resource *res;
|
||||||
|
void __iomem *reg;
|
||||||
|
u32 val;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
|
reg = devm_ioremap_resource(&pdev->dev, res);
|
||||||
|
@@ -914,7 +929,18 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
|
writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG);
|
||||||
|
|
||||||
|
- return sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc);
|
||||||
|
+ ret = sunxi_ccu_probe(pdev->dev.of_node, reg, &sun50i_a64_ccu_desc);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ /* Gate then ungate PLL CPU after any rate changes */
|
||||||
|
+ ccu_pll_notifier_register(&sun50i_a64_pll_cpu_nb);
|
||||||
|
+
|
||||||
|
+ /* Reparent CPU during PLL CPU rate changes */
|
||||||
|
+ ccu_mux_notifier_register(pll_cpux_clk.common.hw.clk,
|
||||||
|
+ &sun50i_a64_cpu_nb);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct of_device_id sun50i_a64_ccu_ids[] = {
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
From a6b5eb09bddbd0c331f41fefa2fd2f71a2cf9455 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Tue, 24 Apr 2018 22:21:10 -0700
|
||||||
|
Subject: [PATCH 036/146] sun4i-gpadc-iio: ignore zero samples to avoid force
|
||||||
|
poweroff when reading first sample
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/iio/adc/sun4i-gpadc-iio.c | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/iio/adc/sun4i-gpadc-iio.c b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
index fdfa01bad325..68256e73a4d2 100644
|
||||||
|
--- a/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
+++ b/drivers/iio/adc/sun4i-gpadc-iio.c
|
||||||
|
@@ -751,6 +751,12 @@ static int sun4i_gpadc_get_temp(void *data, int *temp)
|
||||||
|
if (sun4i_gpadc_temp_read(info->indio_dev, &val, info->sensor_id))
|
||||||
|
return -ETIMEDOUT;
|
||||||
|
|
||||||
|
+ /* Ignore first sample which is always zero. 0 is either too
|
||||||
|
+ * cold or too hot, so we can safely ignore it
|
||||||
|
+ */
|
||||||
|
+ if (val == 0)
|
||||||
|
+ return -ETIMEDOUT;
|
||||||
|
+
|
||||||
|
sun4i_gpadc_temp_scale(info->indio_dev, &scale);
|
||||||
|
sun4i_gpadc_temp_offset(info->indio_dev, &offset);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
260
patch/kernel/sunxi-dev/0037-a64-dvfs-wip.patch
Normal file
260
patch/kernel/sunxi-dev/0037-a64-dvfs-wip.patch
Normal file
|
@ -0,0 +1,260 @@
|
||||||
|
From b07dd371b1a1203a013f91da750259f7a2467fce Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Tue, 24 Apr 2018 22:21:27 -0700
|
||||||
|
Subject: [PATCH 037/146] a64 dvfs wip
|
||||||
|
|
||||||
|
Changed: Igor
|
||||||
|
|
||||||
|
---
|
||||||
|
.../boot/dts/allwinner/sun50i-a64-pine64.dts | 4 +
|
||||||
|
.../dts/allwinner/sun50i-a64-pinebook.dts | 4 +
|
||||||
|
.../allwinner/sun50i-a64-sopine-baseboard.dts | 4 +
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 111 ++++++++++++++++--
|
||||||
|
drivers/clk/sunxi-ng/ccu-sun50i-a64.h | 1 -
|
||||||
|
include/dt-bindings/clock/sun50i-a64-ccu.h | 1 +
|
||||||
|
6 files changed, 112 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
index 8c5dd99cc9ac..cdf5169f2a1a 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
@@ -69,6 +69,10 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&cpu0 {
|
||||||
|
+ cpu-supply = <®_dcdc2>;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
index 897e60cbe38d..b3698a8bb1d3 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
@@ -66,6 +66,10 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&cpu0 {
|
||||||
|
+ cpu-supply = <®_dcdc2>;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci0 {
|
||||||
|
phys = <&usbphy 0>;
|
||||||
|
phy-names = "usb";
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
index 8161895dde52..dc728b3b5556 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
@@ -69,6 +69,10 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&cpu0 {
|
||||||
|
+ cpu-supply = <®_dcdc2>;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
index 0eb482eb58b7..62b880f68d6a 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
@@ -49,6 +49,7 @@
|
||||||
|
#include <dt-bindings/reset/sun50i-a64-ccu.h>
|
||||||
|
#include <dt-bindings/reset/sun8i-de2.h>
|
||||||
|
#include <dt-bindings/reset/sun8i-r-ccu.h>
|
||||||
|
+#include <dt-bindings/thermal/thermal.h>
|
||||||
|
|
||||||
|
/ {
|
||||||
|
interrupt-parent = <&gic>;
|
||||||
|
@@ -79,6 +80,52 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ cpu0_opp_table: opp_table0 {
|
||||||
|
+ compatible = "operating-points-v2";
|
||||||
|
+ opp-shared;
|
||||||
|
+
|
||||||
|
+ opp-120000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <120000000>;
|
||||||
|
+ opp-microvolt = <1040000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-648000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <648000000>;
|
||||||
|
+ opp-microvolt = <1040000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-816000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <816000000>;
|
||||||
|
+ opp-microvolt = <1100000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-912000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <912000000>;
|
||||||
|
+ opp-microvolt = <1120000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-960000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <960000000>;
|
||||||
|
+ opp-microvolt = <1160000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-1008000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <1008000000>;
|
||||||
|
+ opp-microvolt = <1200000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-1056000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <1056000000>;
|
||||||
|
+ opp-microvolt = <1240000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ opp-1104000000 {
|
||||||
|
+ opp-hz = /bits/ 64 <1104000000>;
|
||||||
|
+ opp-microvolt = <1300000>;
|
||||||
|
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
cpus {
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
@@ -88,7 +135,11 @@
|
||||||
|
device_type = "cpu";
|
||||||
|
reg = <0>;
|
||||||
|
enable-method = "psci";
|
||||||
|
+ clocks = <&ccu CLK_CPUX>;
|
||||||
|
+ clock-names = "cpu";
|
||||||
|
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||||
|
+ #cooling-cells = <2>;
|
||||||
|
next-level-cache = <&L2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
cpu1: cpu@1 {
|
||||||
|
@@ -95,7 +146,8 @@
|
||||||
|
device_type = "cpu";
|
||||||
|
reg = <1>;
|
||||||
|
enable-method = "psci";
|
||||||
|
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||||
|
next-level-cache = <&L2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
cpu2: cpu@2 {
|
||||||
|
@@ -102,7 +154,8 @@
|
||||||
|
device_type = "cpu";
|
||||||
|
reg = <2>;
|
||||||
|
enable-method = "psci";
|
||||||
|
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||||
|
next-level-cache = <&L2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
cpu3: cpu@3 {
|
||||||
|
@@ -109,7 +162,8 @@
|
||||||
|
device_type = "cpu";
|
||||||
|
reg = <3>;
|
||||||
|
enable-method = "psci";
|
||||||
|
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||||
|
next-level-cache = <&L2>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
@@ -173,22 +227,55 @@
|
||||||
|
|
||||||
|
thermal-zones {
|
||||||
|
cpu_thermal: cpu0-thermal {
|
||||||
|
- /* milliseconds */
|
||||||
|
- polling-delay-passive = <250>;
|
||||||
|
- polling-delay = <1000>;
|
||||||
|
- thermal-sensors = <&ths 0>;
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 0>;
|
||||||
|
+
|
||||||
|
+ cooling-maps {
|
||||||
|
+ map0 {
|
||||||
|
+ trip = <&cpu_alert0>;
|
||||||
|
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||||
|
+ };
|
||||||
|
+ map1 {
|
||||||
|
+ trip = <&cpu_alert1>;
|
||||||
|
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ trips {
|
||||||
|
+ cpu_alert0: cpu_alert0 {
|
||||||
|
+ /* milliCelsius */
|
||||||
|
+ temperature = <75000>;
|
||||||
|
+ hysteresis = <2000>;
|
||||||
|
+ type = "passive";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ cpu_alert1: cpu_alert1 {
|
||||||
|
+ /* milliCelsius */
|
||||||
|
+ temperature = <90000>;
|
||||||
|
+ hysteresis = <2000>;
|
||||||
|
+ type = "hot";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ cpu_crit: cpu_crit {
|
||||||
|
+ /* milliCelsius */
|
||||||
|
+ temperature = <110000>;
|
||||||
|
+ hysteresis = <2000>;
|
||||||
|
+ type = "critical";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
gpu0_thermal: gpu0-thermal {
|
||||||
|
- /* milliseconds */
|
||||||
|
- polling-delay-passive = <250>;
|
||||||
|
- polling-delay = <1000>;
|
||||||
|
- thermal-sensors = <&ths 1>;
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 1>;
|
||||||
|
};
|
||||||
|
gpu1_thermal: gpu1-thermal {
|
||||||
|
- /* milliseconds */
|
||||||
|
- polling-delay-passive = <250>;
|
||||||
|
- polling-delay = <1000>;
|
||||||
|
- thermal-sensors = <&ths 2>;
|
||||||
|
+ /* milliseconds */
|
||||||
|
+ polling-delay-passive = <250>;
|
||||||
|
+ polling-delay = <1000>;
|
||||||
|
+ thermal-sensors = <&ths 2>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h b/drivers/clk/sunxi-ng/ccu-sun50i-a64.h
|
||||||
|
index 061b6fbb4f95..91f79512cee4 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.h
|
||||||
|
@@ -43,7 +43,6 @@
|
||||||
|
#define CLK_PLL_HSIC 18
|
||||||
|
#define CLK_PLL_DE 19
|
||||||
|
#define CLK_PLL_DDR1 20
|
||||||
|
-#define CLK_CPUX 21
|
||||||
|
#define CLK_AXI 22
|
||||||
|
#define CLK_APB 23
|
||||||
|
#define CLK_AHB1 24
|
||||||
|
diff --git a/include/dt-bindings/clock/sun50i-a64-ccu.h b/include/dt-bindings/clock/sun50i-a64-ccu.h
|
||||||
|
index d66432c6e675..d7f42dd22663 100644
|
||||||
|
--- a/include/dt-bindings/clock/sun50i-a64-ccu.h
|
||||||
|
+++ b/include/dt-bindings/clock/sun50i-a64-ccu.h
|
||||||
|
@@ -45,6 +45,7 @@
|
||||||
|
|
||||||
|
#define CLK_PLL_PERIPH0 11
|
||||||
|
|
||||||
|
+#define CLK_CPUX 21
|
||||||
|
#define CLK_BUS_MIPI_DSI 28
|
||||||
|
#define CLK_BUS_CE 29
|
||||||
|
#define CLK_BUS_DMA 30
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
From eca91d4d36d78c3176480742532b247fd3d72fe0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Simon Shields <simon@lineageos.org>
|
||||||
|
Date: Sat, 13 Jan 2018 14:17:26 +1100
|
||||||
|
Subject: [PATCH 038/146] ARM: dts: add gpu node to exynos4
|
||||||
|
|
||||||
|
v2 (Qiang Yu):
|
||||||
|
add vender string to exynos4 mali gpu
|
||||||
|
|
||||||
|
Based off a similar commit for the Samsung Mali driver by
|
||||||
|
Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
|
||||||
|
|
||||||
|
Signed-off-by: Simon Shields <simon@lineageos.org>
|
||||||
|
Signed-off-by: Qiang Yu <yuq825@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/exynos4.dtsi | 33 +++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 33 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/exynos4.dtsi b/arch/arm/boot/dts/exynos4.dtsi
|
||||||
|
index 6085e92ac2d7..362461657136 100644
|
||||||
|
--- a/arch/arm/boot/dts/exynos4.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/exynos4.dtsi
|
||||||
|
@@ -730,6 +730,39 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ gpu: gpu@13000000 {
|
||||||
|
+ compatible = "samsung,exynos4-mali", "arm,mali-400";
|
||||||
|
+ reg = <0x13000000 0x30000>;
|
||||||
|
+ power-domains = <&pd_g3d>;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Propagate VPLL output clock to SCLK_G3D and
|
||||||
|
+ * ensure that the DIV_G3D divider is 1.
|
||||||
|
+ */
|
||||||
|
+ assigned-clocks = <&clock CLK_MOUT_G3D1>, <&clock CLK_MOUT_G3D>,
|
||||||
|
+ <&clock CLK_FOUT_VPLL>, <&clock CLK_SCLK_G3D>;
|
||||||
|
+ assigned-clock-parents = <&clock CLK_SCLK_VPLL>,
|
||||||
|
+ <&clock CLK_MOUT_G3D1>;
|
||||||
|
+ assigned-clock-rates = <0>, <0>, <160000000>, <160000000>;
|
||||||
|
+
|
||||||
|
+ clocks = <&clock CLK_SCLK_G3D>, <&clock CLK_G3D>;
|
||||||
|
+ clock-names = "bus", "core";
|
||||||
|
+
|
||||||
|
+ interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 119 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 120 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 121 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 124 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>,
|
||||||
|
+ <GIC_SPI 127 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ interrupt-names = "ppmmu0", "ppmmu1", "ppmmu2", "ppmmu3",
|
||||||
|
+ "gpmmu", "pp0", "pp1", "pp2", "pp3", "gp";
|
||||||
|
+ status = "disabled";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
tmu: tmu@100c0000 {
|
||||||
|
interrupt-parent = <&combiner>;
|
||||||
|
reg = <0x100C0000 0x100>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
From 93a9dff30ace06dceba2a84eb709433d5e08c7bc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Qiang Yu <yuq825@gmail.com>
|
||||||
|
Date: Wed, 21 Mar 2018 14:58:02 +0800
|
||||||
|
Subject: [PATCH 039/146] dt-bindings: add switch-delay property for
|
||||||
|
mali-utgard
|
||||||
|
|
||||||
|
Signed-off-by: Qiang Yu <yuq825@gmail.com>
|
||||||
|
---
|
||||||
|
Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
|
||||||
|
index 63cd91176a68..3e2590162d4f 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
|
||||||
|
+++ b/Documentation/devicetree/bindings/gpu/arm,mali-utgard.txt
|
||||||
|
@@ -58,6 +58,10 @@ Optional properties:
|
||||||
|
A power domain consumer specifier as defined in
|
||||||
|
Documentation/devicetree/bindings/power/power_domain.txt
|
||||||
|
|
||||||
|
+ - switch-delay:
|
||||||
|
+ This value is the number of Mali clock cycles it takes to
|
||||||
|
+ enable the power gates and turn on the power mesh.
|
||||||
|
+
|
||||||
|
Vendor-specific bindings
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
From c578aadd5ccfe5c64f628ef3aa8c7ff88600e421 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Qiang Yu <yuq825@gmail.com>
|
||||||
|
Date: Tue, 19 Jun 2018 13:51:17 +0800
|
||||||
|
Subject: [PATCH 072/146] drm/fourcc: add ARM tiled format modifier
|
||||||
|
|
||||||
|
Signed-off-by: Qiang Yu <yuq825@gmail.com>
|
||||||
|
---
|
||||||
|
include/uapi/drm/drm_fourcc.h | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/include/uapi/drm/drm_fourcc.h b/include/uapi/drm/drm_fourcc.h
|
||||||
|
index 721ab7e54d96..097d9faca608 100644
|
||||||
|
--- a/include/uapi/drm/drm_fourcc.h
|
||||||
|
+++ b/include/uapi/drm/drm_fourcc.h
|
||||||
|
@@ -581,6 +581,15 @@ extern "C" {
|
||||||
|
*/
|
||||||
|
#define AFBC_FORMAT_MOD_SC (1ULL << 9)
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * ARM tiled format
|
||||||
|
+ *
|
||||||
|
+ * This is used by ARM Mali Utgard/Midgard GPU. It divides buffer into
|
||||||
|
+ * 16x16 pixel blocks. Blocks are stored linearly in order, but pixels
|
||||||
|
+ * in the block are reordered.
|
||||||
|
+ */
|
||||||
|
+#define DRM_FORMAT_MOD_ARM_TILED fourcc_mod_code(ARM, 1)
|
||||||
|
+
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
From 9c4d2eb582078788a3f115fef91824d9213e237d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Tue, 24 Jul 2018 10:17:55 -0700
|
||||||
|
Subject: [PATCH 074/146] a64: ccu: enable LDOs for pll-mipi and add min/max
|
||||||
|
rate for it
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 2 ++
|
||||||
|
drivers/clk/sunxi-ng/ccu_nkm.c | 5 +++++
|
||||||
|
drivers/clk/sunxi-ng/ccu_nkm.h | 3 +++
|
||||||
|
3 files changed, 10 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
|
||||||
|
index 1fe3c3fbc9bc..7c645f2c017a 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c
|
||||||
|
@@ -163,6 +163,8 @@ static struct ccu_nkm pll_mipi_clk = {
|
||||||
|
.n = _SUNXI_CCU_MULT(8, 4),
|
||||||
|
.k = _SUNXI_CCU_MULT_MIN(4, 2, 2),
|
||||||
|
.m = _SUNXI_CCU_DIV(0, 4),
|
||||||
|
+ .min_rate = 300000000,
|
||||||
|
+ .max_rate = 1400000000,
|
||||||
|
.common = {
|
||||||
|
.reg = 0x040,
|
||||||
|
.hw.init = CLK_HW_INIT("pll-mipi", "pll-video0",
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c
|
||||||
|
index 841840e35e61..01e6df4c1232 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu_nkm.c
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu_nkm.c
|
||||||
|
@@ -122,6 +122,11 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux,
|
||||||
|
_nkm.min_m = 1;
|
||||||
|
_nkm.max_m = nkm->m.max ?: 1 << nkm->m.width;
|
||||||
|
|
||||||
|
+ if (rate < nkm->min_rate)
|
||||||
|
+ rate = nkm->min_rate;
|
||||||
|
+ if (nkm->max_rate && (rate > nkm->max_rate))
|
||||||
|
+ rate = nkm->max_rate;
|
||||||
|
+
|
||||||
|
if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV)
|
||||||
|
rate *= nkm->fixed_post_div;
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h
|
||||||
|
index cc6efb70a102..6e01836ef122 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu_nkm.h
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu_nkm.h
|
||||||
|
@@ -36,6 +36,9 @@ struct ccu_nkm {
|
||||||
|
|
||||||
|
unsigned int fixed_post_div;
|
||||||
|
|
||||||
|
+ unsigned int min_rate;
|
||||||
|
+ unsigned int max_rate;
|
||||||
|
+
|
||||||
|
struct ccu_common common;
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
From 1d3ae34846fcee5e4d4ec54476c85992d03d204e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Mon, 10 Sep 2018 16:09:30 -0700
|
||||||
|
Subject: [PATCH 075/146] sopine: baseboard: enable HS200 for eMMC
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
index dc728b3b5556..abad307b414a 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
@@ -119,6 +119,7 @@
|
||||||
|
bus-width = <8>;
|
||||||
|
non-removable;
|
||||||
|
cap-mmc-hw-reset;
|
||||||
|
+ mmc-hs200-1_8v;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
From 87c27a1c822a43d8f6d7bc2bb889be2d3d80a100 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||||
|
Date: Sun, 3 Sep 2017 11:32:34 +0200
|
||||||
|
Subject: [PATCH 079/146] drm: bridge: Add audio workaround for dw_hdmi v1.32a
|
||||||
|
|
||||||
|
Allwinner SoCs with dw hdmi v1.32a seems to have an issue with manual
|
||||||
|
setting CTS value. BSP driver sets it to auto mode and that works
|
||||||
|
here too.
|
||||||
|
|
||||||
|
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 30 +++++++++++++++--------
|
||||||
|
1 file changed, 20 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||||
|
index 5971976284bf..4b08840749bd 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||||
|
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
|
||||||
|
@@ -424,16 +424,26 @@ static struct i2c_adapter *dw_hdmi_i2c_adapter(struct dw_hdmi *hdmi)
|
||||||
|
static void hdmi_set_cts_n(struct dw_hdmi *hdmi, unsigned int cts,
|
||||||
|
unsigned int n)
|
||||||
|
{
|
||||||
|
- /* Must be set/cleared first */
|
||||||
|
- hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
|
||||||
|
-
|
||||||
|
- /* nshift factor = 0 */
|
||||||
|
- hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3);
|
||||||
|
-
|
||||||
|
- hdmi_writeb(hdmi, ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
|
||||||
|
- HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
|
||||||
|
- hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2);
|
||||||
|
- hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1);
|
||||||
|
+ /*
|
||||||
|
+ * Manual CTS setting doesn't work correctly on Allwinner SoCs with
|
||||||
|
+ * dw hdmi v1.32a.
|
||||||
|
+ */
|
||||||
|
+ if (hdmi->version != 0x132a) {
|
||||||
|
+ /* Must be set/cleared first */
|
||||||
|
+ hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
|
||||||
|
+
|
||||||
|
+ /* nshift factor = 0 */
|
||||||
|
+ hdmi_modb(hdmi, 0, HDMI_AUD_CTS3_N_SHIFT_MASK, HDMI_AUD_CTS3);
|
||||||
|
+
|
||||||
|
+ hdmi_writeb(hdmi,
|
||||||
|
+ ((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
|
||||||
|
+ HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
|
||||||
|
+ hdmi_writeb(hdmi, (cts >> 8) & 0xff, HDMI_AUD_CTS2);
|
||||||
|
+ hdmi_writeb(hdmi, cts & 0xff, HDMI_AUD_CTS1);
|
||||||
|
+ } else {
|
||||||
|
+ /* set automatic CTS calculation */
|
||||||
|
+ hdmi_writeb(hdmi, 0x00, HDMI_AUD_CTS3);
|
||||||
|
+ }
|
||||||
|
|
||||||
|
hdmi_writeb(hdmi, (n >> 16) & 0x0f, HDMI_AUD_N3);
|
||||||
|
hdmi_writeb(hdmi, (n >> 8) & 0xff, HDMI_AUD_N2);
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
From 02d04263581ac956a4822b02ee7ccd15aa5600af Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Mon, 10 Sep 2018 20:32:51 -0700
|
||||||
|
Subject: [PATCH 080/146] rtl8723bs: disable error message about failure to
|
||||||
|
alloc recvbuf
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/staging/rtl8723bs/hal/sdio_ops.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/staging/rtl8723bs/hal/sdio_ops.c b/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||||
|
index d6b93e1f78d8..ecc4d1db9bbe 100644
|
||||||
|
--- a/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||||
|
+++ b/drivers/staging/rtl8723bs/hal/sdio_ops.c
|
||||||
|
@@ -947,7 +947,7 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
|
||||||
|
recv_priv = &adapter->recvpriv;
|
||||||
|
recvbuf = rtw_dequeue_recvbuf(&recv_priv->free_recv_buf_queue);
|
||||||
|
if (!recvbuf) {
|
||||||
|
- DBG_871X_LEVEL(_drv_err_, "%s: alloc recvbuf FAIL!\n", __func__);
|
||||||
|
+ //DBG_871X_LEVEL(_drv_err_, "%s: alloc recvbuf FAIL!\n", __func__);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
From e7623ac862573d231eea2ec77d393adbf2db3392 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jagan Teki <jagan@amarulasolutions.com>
|
||||||
|
Date: Tue, 4 Sep 2018 12:40:53 +0800
|
||||||
|
Subject: [PATCH 101/146] arm64: dts: allwinner: a64: Enable HDMI output on A64
|
||||||
|
boards w/ HDMI
|
||||||
|
|
||||||
|
Enable all necessary device tree nodes and add connector node to device
|
||||||
|
trees for all supported A64 boards with HDMI.
|
||||||
|
|
||||||
|
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
|
||||||
|
[Icenowy: squash all board patches altogether and change supply name]
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Tested-by: Jagan Teki <jagan@amarulasolutions.com> # BPI-M64, OPI-Win,
|
||||||
|
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
.../dts/allwinner/sun50i-a64-bananapi-m64.dts | 26 ++++++++++++++++++
|
||||||
|
.../dts/allwinner/sun50i-a64-nanopi-a64.dts | 27 +++++++++++++++++++
|
||||||
|
.../dts/allwinner/sun50i-a64-olinuxino.dts | 26 ++++++++++++++++++
|
||||||
|
.../dts/allwinner/sun50i-a64-orangepi-win.dts | 27 +++++++++++++++++++
|
||||||
|
.../boot/dts/allwinner/sun50i-a64-pine64.dts | 27 +++++++++++++++++++
|
||||||
|
.../dts/allwinner/sun50i-a64-pinebook.dts | 26 ++++++++++++++++++
|
||||||
|
.../allwinner/sun50i-a64-sopine-baseboard.dts | 26 ++++++++++++++++++
|
||||||
|
7 files changed, 185 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
index b3698a8bb1d3..52cbb3052588 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
@@ -53,6 +53,17 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+ hdmi-connector {
|
||||||
|
+ compatible = "hdmi-connector";
|
||||||
|
+ type = "a";
|
||||||
|
+
|
||||||
|
+ port {
|
||||||
|
+ hdmi_con_in: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_out_con>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
reg_vcc3v3: vcc3v3 {
|
||||||
|
compatible = "regulator-fixed";
|
||||||
|
regulator-name = "vcc3v3";
|
||||||
|
@@ -70,6 +81,10 @@
|
||||||
|
cpu-supply = <®_dcdc2>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+&de {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci0 {
|
||||||
|
phys = <&usbphy 0>;
|
||||||
|
phy-names = "usb";
|
||||||
|
@@ -80,6 +95,17 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&hdmi {
|
||||||
|
+ hvcc-supply = <®_dldo1>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi_out {
|
||||||
|
+ hdmi_out_con: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_con_in>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mmc0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&mmc0_pins>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
From 5b0f15a9da1cb6110bc2eded53bf18626626179c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Date: Tue, 23 Oct 2018 21:53:21 +0300
|
||||||
|
Subject: [PATCH 103/146] dt-bindings: power: supply: axp20x: add AXP803 power
|
||||||
|
bindings
|
||||||
|
|
||||||
|
The AXP803 power supplies are compatible with AXP813, but
|
||||||
|
add specific compatibles for them.
|
||||||
|
|
||||||
|
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||||
|
---
|
||||||
|
.../devicetree/bindings/power/supply/axp20x_ac_power.txt | 1 +
|
||||||
|
.../devicetree/bindings/power/supply/axp20x_battery.txt | 1 +
|
||||||
|
2 files changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt b/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt
|
||||||
|
index 7a1fb532abe5..acdeb4b8f4cc 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt
|
||||||
|
+++ b/Documentation/devicetree/bindings/power/supply/axp20x_ac_power.txt
|
||||||
|
@@ -4,6 +4,7 @@ Required Properties:
|
||||||
|
- compatible: One of:
|
||||||
|
"x-powers,axp202-ac-power-supply"
|
||||||
|
"x-powers,axp221-ac-power-supply"
|
||||||
|
+ "x-powers,axp803-ac-power-supply"
|
||||||
|
"x-powers,axp813-ac-power-supply"
|
||||||
|
|
||||||
|
This node is a subnode of the axp20x PMIC.
|
||||||
|
diff --git a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt
|
||||||
|
index 41916f69902c..780ebd7e3b84 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt
|
||||||
|
+++ b/Documentation/devicetree/bindings/power/supply/axp20x_battery.txt
|
||||||
|
@@ -4,6 +4,7 @@ Required Properties:
|
||||||
|
- compatible, one of:
|
||||||
|
"x-powers,axp209-battery-power-supply"
|
||||||
|
"x-powers,axp221-battery-power-supply"
|
||||||
|
+ "x-powers,axp803-battery-power-supply"
|
||||||
|
"x-powers,axp813-battery-power-supply"
|
||||||
|
|
||||||
|
This node is a subnode of its respective PMIC DT node.
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
From 80694d54812c5fc49dd738e17a9cf5a91f343cae Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Date: Tue, 23 Oct 2018 21:53:22 +0300
|
||||||
|
Subject: [PATCH 104/146] dt-bindings: gpio: gpio-axp209: add AXP803 GPIO
|
||||||
|
bindings
|
||||||
|
|
||||||
|
The AXP803 GPIO is compatible with AXP813 GPIO, but add
|
||||||
|
specific compatible for it.
|
||||||
|
|
||||||
|
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||||
|
---
|
||||||
|
Documentation/devicetree/bindings/gpio/gpio-axp209.txt | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
|
||||||
|
index fc42b2caa06d..5337a21d7bcf 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
|
||||||
|
+++ b/Documentation/devicetree/bindings/gpio/gpio-axp209.txt
|
||||||
|
@@ -11,6 +11,7 @@ This driver employs the per-pin muxing pattern.
|
||||||
|
Required properties:
|
||||||
|
- compatible: Should be one of:
|
||||||
|
- "x-powers,axp209-gpio"
|
||||||
|
+ - "x-powers,axp803-gpio"
|
||||||
|
- "x-powers,axp813-gpio"
|
||||||
|
- #gpio-cells: Should be two. The first cell is the pin number and the
|
||||||
|
second is the GPIO flags.
|
||||||
|
@@ -67,6 +68,7 @@ GPIO0 | gpio_in, gpio_out, ldo, adc
|
||||||
|
GPIO1 | gpio_in, gpio_out, ldo, adc
|
||||||
|
GPIO2 | gpio_in, gpio_out
|
||||||
|
|
||||||
|
+axp803
|
||||||
|
axp813
|
||||||
|
------
|
||||||
|
GPIO | Functions
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
From fd2f21f1e63f52476bbbb0ce17fb6288a623f2ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Date: Tue, 23 Oct 2018 21:53:23 +0300
|
||||||
|
Subject: [PATCH 105/146] dt-bindings: iio: adc: add AXP803 ADC bindings
|
||||||
|
|
||||||
|
The AXP803 ADC is compatible with AXP813 ADC, but add
|
||||||
|
specific compatible for it.
|
||||||
|
|
||||||
|
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||||
|
---
|
||||||
|
Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt
|
||||||
|
index 7a6313913923..1dbd5e480acd 100644
|
||||||
|
--- a/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt
|
||||||
|
+++ b/Documentation/devicetree/bindings/iio/adc/axp20x_adc.txt
|
||||||
|
@@ -4,6 +4,7 @@ Required properties:
|
||||||
|
- compatible: should be one of:
|
||||||
|
- "x-powers,axp209-adc",
|
||||||
|
- "x-powers,axp221-adc",
|
||||||
|
+ - "x-powers,axp803-adc",
|
||||||
|
- "x-powers,axp813-adc",
|
||||||
|
- #io-channel-cells: should be 1,
|
||||||
|
|
||||||
|
@@ -39,6 +40,7 @@ AXP22x
|
||||||
|
2 | batt_chrg_i
|
||||||
|
3 | batt_dischrg_i
|
||||||
|
|
||||||
|
+AXP803
|
||||||
|
AXP813
|
||||||
|
------
|
||||||
|
0 | pmic_temp
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
From f16f4cbdb0deb70c03731fbccb4f52eb4d1d096a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Date: Tue, 23 Oct 2018 21:53:26 +0300
|
||||||
|
Subject: [PATCH 108/146] arm64: dts: allwinner: a64: sopine-baseboard: enable
|
||||||
|
power supplies
|
||||||
|
|
||||||
|
AXP803 ACIN pins are routed from SOM to the DC jack on the baseboard.
|
||||||
|
AXP803 charger pins BATSENSE, LOADSENSE, N_BATDRV, LX_CHG, VIN_CHG
|
||||||
|
and IPSOUT are connected via PMOS driver to SOM VBAT pins. VBAT and
|
||||||
|
AXP803 TS pins are routed to the baseboard 3-pin battery connector.
|
||||||
|
|
||||||
|
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
|
||||||
|
---
|
||||||
|
.../boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
index 8e9191f489a6..df7aa8c5f751 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
@@ -80,6 +80,14 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&ac_power_supply {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&battery_power_supply {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&cpu0 {
|
||||||
|
cpu-supply = <®_dcdc2>;
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
From ea6865e1bfc1a1ac72fe95be42abb88b47413363 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Date: Tue, 23 Oct 2018 21:53:29 +0300
|
||||||
|
Subject: [PATCH 111/146] mfd: axp20x: Add AC power supply cell for AXP813
|
||||||
|
|
||||||
|
As axp20x-ac-power-supply now supports AXP813, add a cell for it.
|
||||||
|
|
||||||
|
Signed-off-by: Oskari Lemmela <oskari@lemmela.net>
|
||||||
|
Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com>
|
||||||
|
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
|
||||||
|
Tested-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
|
||||||
|
Changed-by: Igor@armbian
|
||||||
|
---
|
||||||
|
drivers/mfd/axp20x.c | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
|
||||||
|
index 0be511dd93d0..dfc3cff1d08b 100644
|
||||||
|
--- a/drivers/mfd/axp20x.c
|
||||||
|
+++ b/drivers/mfd/axp20x.c
|
||||||
|
@@ -805,8 +805,13 @@ static const struct mfd_cell axp813_cells[] = {
|
||||||
|
.name = "axp813-adc",
|
||||||
|
.of_compatible = "x-powers,axp813-adc",
|
||||||
|
}, {
|
||||||
|
- .name = "axp20x-battery-power-supply",
|
||||||
|
- .of_compatible = "x-powers,axp813-battery-power-supply",
|
||||||
|
+ .name = "axp20x-battery-power-supply",
|
||||||
|
+ .of_compatible = "x-powers,axp813-battery-power-supply",
|
||||||
|
+ }, {
|
||||||
|
+ .name = "axp20x-ac-power-supply",
|
||||||
|
+ .of_compatible = "x-powers,axp813-ac-power-supply",
|
||||||
|
+ .num_resources = ARRAY_SIZE(axp20x_ac_power_supply_resources),
|
||||||
|
+ .resources = axp20x_ac_power_supply_resources,
|
||||||
|
}, {
|
||||||
|
.name = "axp20x-usb-power-supply",
|
||||||
|
.of_compatible = "x-powers,axp813-usb-power-supply",
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
From 8cbc3090d64e850f1dc5a93e929deaed10d841f8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Sun, 3 Dec 2017 11:35:48 -0800
|
||||||
|
Subject: [PATCH 120/146] arm64: dts: allwinner: a64: add nodes necessary for
|
||||||
|
analog sound support
|
||||||
|
|
||||||
|
Add nodes for i2s, digital and analog parts of audiocodec on A64
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 58 +++++++++++++++++++
|
||||||
|
1 file changed, 58 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
index 132da408aa52..cb7d4a96e789 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
@@ -200,6 +200,34 @@
|
||||||
|
method = "smc";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ sound: sound {
|
||||||
|
+ compatible = "simple-audio-card";
|
||||||
|
+ simple-audio-card,name = "sun50i-a64-audio";
|
||||||
|
+ simple-audio-card,format = "i2s";
|
||||||
|
+ simple-audio-card,frame-master = <&cpudai>;
|
||||||
|
+ simple-audio-card,bitclock-master = <&cpudai>;
|
||||||
|
+ simple-audio-card,mclk-fs = <512>;
|
||||||
|
+ simple-audio-card,aux-devs = <&codec_analog>;
|
||||||
|
+ simple-audio-card,routing =
|
||||||
|
+ "Left DAC", "AIF1 Slot 0 Left",
|
||||||
|
+ "Right DAC", "AIF1 Slot 0 Right",
|
||||||
|
+ "AIF1 Slot 0 Left ADC", "Left ADC",
|
||||||
|
+ "AIF1 Slot 0 Right ADC", "Right ADC",
|
||||||
|
+ "Left ADC", "ADC",
|
||||||
|
+ "Right ADC", "ADC",
|
||||||
|
+ "MIC1", "Mic",
|
||||||
|
+ "MIC2", "Headset Mic";
|
||||||
|
+ status = "disabled";
|
||||||
|
+
|
||||||
|
+ cpudai: simple-audio-card,cpu {
|
||||||
|
+ sound-dai = <&dai>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ link_codec: simple-audio-card,codec {
|
||||||
|
+ sound-dai = <&codec>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
sound_spdif {
|
||||||
|
compatible = "simple-audio-card";
|
||||||
|
simple-audio-card,name = "On-board SPDIF";
|
||||||
|
@@ -767,6 +795,30 @@
|
||||||
|
status = "disabled";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ dai: dai@1c22c00 {
|
||||||
|
+ #sound-dai-cells = <0>;
|
||||||
|
+ compatible = "allwinner,sun50i-a64-codec-i2s";
|
||||||
|
+ reg = <0x01c22c00 0x200>;
|
||||||
|
+ interrupts = <GIC_SPI 29 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
|
||||||
|
+ clock-names = "apb", "mod";
|
||||||
|
+ resets = <&ccu RST_BUS_CODEC>;
|
||||||
|
+ reset-names = "rst";
|
||||||
|
+ dmas = <&dma 15>, <&dma 15>;
|
||||||
|
+ dma-names = "rx", "tx";
|
||||||
|
+ status = "disabled";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ codec: codec@1c22e00 {
|
||||||
|
+ #sound-dai-cells = <0>;
|
||||||
|
+ compatible = "allwinner,sun8i-a33-codec";
|
||||||
|
+ reg = <0x01c22e00 0x600>;
|
||||||
|
+ interrupts = <GIC_SPI 28 IRQ_TYPE_LEVEL_HIGH>;
|
||||||
|
+ clocks = <&ccu CLK_BUS_CODEC>, <&ccu CLK_AC_DIG>;
|
||||||
|
+ clock-names = "bus", "mod";
|
||||||
|
+ status = "disabled";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
ths: thermal-sensor@1c25000 {
|
||||||
|
compatible = "allwinner,sun50i-a64-ths";
|
||||||
|
reg = <0x01c25000 0x100>;
|
||||||
|
@@ -1071,6 +1123,12 @@
|
||||||
|
#reset-cells = <1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ codec_analog: codec-analog@1f015c0 {
|
||||||
|
+ compatible = "allwinner,sun50i-a64-codec-analog";
|
||||||
|
+ reg = <0x01f015c0 0x4>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
r_i2c: i2c@1f02400 {
|
||||||
|
compatible = "allwinner,sun50i-a64-i2c",
|
||||||
|
"allwinner,sun6i-a31-i2c";
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
From 4690963a2d219abac912ebe2f0b22529c028db06 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Sun, 28 Oct 2018 15:32:38 -0700
|
||||||
|
Subject: [PATCH 123/146] drm/sun4i: tcon: enable dithering on tcon0 is there's
|
||||||
|
bridge connected
|
||||||
|
|
||||||
|
RGB on A64 is 6bpc, so if bridge is connected we need to enable dithering
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/sun4i/sun4i_tcon.c | 14 ++++++++------
|
||||||
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c
|
||||||
|
index 1b28fd9c2908..891ba4dbbf10 100644
|
||||||
|
--- a/drivers/gpu/drm/sun4i/sun4i_tcon.c
|
||||||
|
+++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c
|
||||||
|
@@ -283,10 +283,6 @@ static void sun4i_tcon0_mode_set_dithering(struct sun4i_tcon *tcon,
|
||||||
|
u32 bus_format = 0;
|
||||||
|
u32 val = 0;
|
||||||
|
|
||||||
|
- /* XXX Would this ever happen? */
|
||||||
|
- if (!connector)
|
||||||
|
- return;
|
||||||
|
-
|
||||||
|
/*
|
||||||
|
* FIXME: Undocumented bits
|
||||||
|
*
|
||||||
|
@@ -304,11 +300,15 @@ static void sun4i_tcon0_mode_set_dithering(struct sun4i_tcon *tcon,
|
||||||
|
regmap_write(tcon->regs, SUN4I_TCON0_FRM_TBL2_REG, 0x57575555);
|
||||||
|
regmap_write(tcon->regs, SUN4I_TCON0_FRM_TBL3_REG, 0x7f7f7777);
|
||||||
|
|
||||||
|
+ /* Do dithering if there's bridge connected */
|
||||||
|
+ if (!connector)
|
||||||
|
+ val |= SUN4I_TCON0_FRM_CTL_EN;
|
||||||
|
+
|
||||||
|
/* Do dithering if panel only supports 6 bits per color */
|
||||||
|
- if (connector->display_info.bpc == 6)
|
||||||
|
+ if (connector && connector->display_info.bpc == 6)
|
||||||
|
val |= SUN4I_TCON0_FRM_CTL_EN;
|
||||||
|
|
||||||
|
- if (connector->display_info.num_bus_formats == 1)
|
||||||
|
+ if (connector && connector->display_info.num_bus_formats == 1)
|
||||||
|
bus_format = connector->display_info.bus_formats[0];
|
||||||
|
|
||||||
|
/* Check the connection format */
|
||||||
|
@@ -492,6 +492,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon,
|
||||||
|
/* Set dithering if needed */
|
||||||
|
if (tcon->panel)
|
||||||
|
sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector);
|
||||||
|
+ else
|
||||||
|
+ sun4i_tcon0_mode_set_dithering(tcon, NULL);
|
||||||
|
|
||||||
|
/* Adjust clock delay */
|
||||||
|
clk_delay = sun4i_tcon_get_clk_delay(mode, 0);
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,97 @@
|
||||||
|
From c66953710d4c7205c380bf9c5a7e296bef3d4948 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 18 Oct 2018 15:33:19 +0800
|
||||||
|
Subject: [PATCH 126/146] drm/bridge: move ANA78xx driver to analogix
|
||||||
|
subdirectory
|
||||||
|
|
||||||
|
As ANA78xx chips are designed and produced by Analogix Semiconductor,
|
||||||
|
Inc, move their driver codes into analogix subdirectory.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/bridge/Kconfig | 10 ----------
|
||||||
|
drivers/gpu/drm/bridge/Makefile | 4 ++--
|
||||||
|
drivers/gpu/drm/bridge/analogix/Kconfig | 10 ++++++++++
|
||||||
|
drivers/gpu/drm/bridge/analogix/Makefile | 1 +
|
||||||
|
.../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c | 0
|
||||||
|
.../gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h | 0
|
||||||
|
6 files changed, 13 insertions(+), 12 deletions(-)
|
||||||
|
rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.c (100%)
|
||||||
|
rename drivers/gpu/drm/bridge/{ => analogix}/analogix-anx78xx.h (100%)
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig
|
||||||
|
index bf6cad6c9178..43f3c8ff54a4 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/Kconfig
|
||||||
|
+++ b/drivers/gpu/drm/bridge/Kconfig
|
||||||
|
@@ -15,16 +15,6 @@ config DRM_PANEL_BRIDGE
|
||||||
|
menu "Display Interface Bridges"
|
||||||
|
depends on DRM && DRM_BRIDGE
|
||||||
|
|
||||||
|
-config DRM_ANALOGIX_ANX78XX
|
||||||
|
- tristate "Analogix ANX78XX bridge"
|
||||||
|
- select DRM_KMS_HELPER
|
||||||
|
- select REGMAP_I2C
|
||||||
|
- ---help---
|
||||||
|
- ANX78XX is an ultra-low Full-HD SlimPort transmitter
|
||||||
|
- designed for portable devices. The ANX78XX transforms
|
||||||
|
- the HDMI output of an application processor to MyDP
|
||||||
|
- or DisplayPort.
|
||||||
|
-
|
||||||
|
config DRM_CDNS_DSI
|
||||||
|
tristate "Cadence DPI/DSI bridge"
|
||||||
|
select DRM_KMS_HELPER
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/Makefile b/drivers/gpu/drm/bridge/Makefile
|
||||||
|
index 4934fcf..729a806 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/Makefile
|
||||||
|
+++ b/drivers/gpu/drm/bridge/Makefile
|
||||||
|
@@ -1,5 +1,4 @@
|
||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
-obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||||
|
obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o
|
||||||
|
obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o
|
||||||
|
obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o
|
||||||
|
@@ -16,4 +15,6 @@ obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix/
|
||||||
|
obj-$(CONFIG_DRM_I2C_ADV7511) += adv7511/
|
||||||
|
obj-$(CONFIG_DRM_TI_SN65DSI86) += ti-sn65dsi86.o
|
||||||
|
obj-$(CONFIG_DRM_TI_TFP410) += ti-tfp410.o
|
||||||
|
+
|
||||||
|
+obj-y += analogix/
|
||||||
|
obj-y += synopsys/
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
index 80f286fa3a69..27b37aa2ea77 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
@@ -1,3 +1,13 @@
|
||||||
|
config DRM_ANALOGIX_DP
|
||||||
|
tristate
|
||||||
|
depends on DRM
|
||||||
|
+
|
||||||
|
+config DRM_ANALOGIX_ANX78XX
|
||||||
|
+ tristate "Analogix ANX78XX bridge"
|
||||||
|
+ select DRM_KMS_HELPER
|
||||||
|
+ select REGMAP_I2C
|
||||||
|
+ ---help---
|
||||||
|
+ ANX78XX is an ultra-low Full-HD SlimPort transmitter
|
||||||
|
+ designed for portable devices. The ANX78XX transforms
|
||||||
|
+ the HDMI output of an application processor to MyDP
|
||||||
|
+ or DisplayPort.
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
index cd4010ba6890..eb41be845055 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
@@ -1,2 +1,3 @@
|
||||||
|
analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
|
||||||
|
obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
|
||||||
|
+obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||||
|
similarity index 100%
|
||||||
|
rename from drivers/gpu/drm/bridge/analogix-anx78xx.c
|
||||||
|
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.h b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
|
||||||
|
similarity index 100%
|
||||||
|
rename from drivers/gpu/drm/bridge/analogix-anx78xx.h
|
||||||
|
rename to drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,403 @@
|
||||||
|
From d1f75332d44f26e734985493c134a727c79cb1f1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 18 Oct 2018 15:33:21 +0800
|
||||||
|
Subject: [PATCH 128/146] drm/bridge: extract some Analogix I2C DP common code
|
||||||
|
|
||||||
|
Some code can be shared within different DP bridges by Analogix.
|
||||||
|
|
||||||
|
Extract them to a new module.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/bridge/analogix/Kconfig | 4 +
|
||||||
|
drivers/gpu/drm/bridge/analogix/Makefile | 2 +
|
||||||
|
.../drm/bridge/analogix/analogix-anx78xx.c | 146 +--------------
|
||||||
|
.../drm/bridge/analogix/analogix-i2c-dptx.c | 169 ++++++++++++++++++
|
||||||
|
.../drm/bridge/analogix/analogix-i2c-dptx.h | 2 +
|
||||||
|
5 files changed, 178 insertions(+), 145 deletions(-)
|
||||||
|
create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
index 27b37aa2ea77..eb893b465dd8 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
@@ -2,8 +2,12 @@ config DRM_ANALOGIX_DP
|
||||||
|
tristate
|
||||||
|
depends on DRM
|
||||||
|
|
||||||
|
+config DRM_ANALOGIX_DP_I2C
|
||||||
|
+ tristate
|
||||||
|
+
|
||||||
|
config DRM_ANALOGIX_ANX78XX
|
||||||
|
tristate "Analogix ANX78XX bridge"
|
||||||
|
+ select DRM_ANALOGIX_DP_I2C
|
||||||
|
select DRM_KMS_HELPER
|
||||||
|
select REGMAP_I2C
|
||||||
|
---help---
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
index eb41be845055..c37e2ded8ce3 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
@@ -1,3 +1,5 @@
|
||||||
|
analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
|
||||||
|
+analogix_dp_i2c-objs := analogix-i2c-dptx.o
|
||||||
|
obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
|
||||||
|
+obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
|
||||||
|
obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||||
|
index f8433c93f463..bf8291d0ddd0 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||||
|
@@ -45,8 +45,6 @@
|
||||||
|
#define I2C_IDX_RX_P1 4
|
||||||
|
|
||||||
|
#define XTAL_CLK 270 /* 27M */
|
||||||
|
-#define AUX_CH_BUFFER_SIZE 16
|
||||||
|
-#define AUX_WAIT_TIMEOUT_MS 15
|
||||||
|
|
||||||
|
static const u8 anx78xx_i2c_addresses[] = {
|
||||||
|
[I2C_IDX_TX_P0] = TX_P0,
|
||||||
|
@@ -109,153 +107,11 @@ static int anx78xx_clear_bits(struct regmap *map, u8 reg, u8 mask)
|
||||||
|
return regmap_update_bits(map, reg, mask, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
-static bool anx78xx_aux_op_finished(struct anx78xx *anx78xx)
|
||||||
|
-{
|
||||||
|
- unsigned int value;
|
||||||
|
- int err;
|
||||||
|
-
|
||||||
|
- err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_DP_AUX_CH_CTRL2_REG,
|
||||||
|
- &value);
|
||||||
|
- if (err < 0)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- return (value & SP_AUX_EN) == 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static int anx78xx_aux_wait(struct anx78xx *anx78xx)
|
||||||
|
-{
|
||||||
|
- unsigned long timeout;
|
||||||
|
- unsigned int status;
|
||||||
|
- int err;
|
||||||
|
-
|
||||||
|
- timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
|
||||||
|
-
|
||||||
|
- while (!anx78xx_aux_op_finished(anx78xx)) {
|
||||||
|
- if (time_after(jiffies, timeout)) {
|
||||||
|
- if (!anx78xx_aux_op_finished(anx78xx)) {
|
||||||
|
- DRM_ERROR("Timed out waiting AUX to finish\n");
|
||||||
|
- return -ETIMEDOUT;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- break;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- usleep_range(1000, 2000);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* Read the AUX channel access status */
|
||||||
|
- err = regmap_read(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_CH_STATUS_REG,
|
||||||
|
- &status);
|
||||||
|
- if (err < 0) {
|
||||||
|
- DRM_ERROR("Failed to read from AUX channel: %d\n", err);
|
||||||
|
- return err;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (status & SP_AUX_STATUS) {
|
||||||
|
- DRM_ERROR("Failed to wait for AUX channel (status: %02x)\n",
|
||||||
|
- status);
|
||||||
|
- return -ETIMEDOUT;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-static int anx78xx_aux_address(struct anx78xx *anx78xx, unsigned int addr)
|
||||||
|
-{
|
||||||
|
- int err;
|
||||||
|
-
|
||||||
|
- err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_7_0_REG,
|
||||||
|
- addr & 0xff);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_AUX_ADDR_15_8_REG,
|
||||||
|
- (addr & 0xff00) >> 8);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- /*
|
||||||
|
- * DP AUX CH Address Register #2, only update bits[3:0]
|
||||||
|
- * [7:4] RESERVED
|
||||||
|
- * [3:0] AUX_ADDR[19:16], Register control AUX CH address.
|
||||||
|
- */
|
||||||
|
- err = regmap_update_bits(anx78xx->map[I2C_IDX_TX_P0],
|
||||||
|
- SP_AUX_ADDR_19_16_REG,
|
||||||
|
- SP_AUX_ADDR_19_16_MASK,
|
||||||
|
- (addr & 0xf0000) >> 16);
|
||||||
|
-
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- return 0;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
static ssize_t anx78xx_aux_transfer(struct drm_dp_aux *aux,
|
||||||
|
struct drm_dp_aux_msg *msg)
|
||||||
|
{
|
||||||
|
struct anx78xx *anx78xx = container_of(aux, struct anx78xx, aux);
|
||||||
|
- u8 ctrl1 = msg->request;
|
||||||
|
- u8 ctrl2 = SP_AUX_EN;
|
||||||
|
- u8 *buffer = msg->buffer;
|
||||||
|
- int err;
|
||||||
|
-
|
||||||
|
- /* The DP AUX transmit and receive buffer has 16 bytes. */
|
||||||
|
- if (WARN_ON(msg->size > AUX_CH_BUFFER_SIZE))
|
||||||
|
- return -E2BIG;
|
||||||
|
-
|
||||||
|
- /* Zero-sized messages specify address-only transactions. */
|
||||||
|
- if (msg->size < 1)
|
||||||
|
- ctrl2 |= SP_ADDR_ONLY;
|
||||||
|
- else /* For non-zero-sized set the length field. */
|
||||||
|
- ctrl1 |= (msg->size - 1) << SP_AUX_LENGTH_SHIFT;
|
||||||
|
-
|
||||||
|
- if ((msg->request & DP_AUX_I2C_READ) == 0) {
|
||||||
|
- /* When WRITE | MOT write values to data buffer */
|
||||||
|
- err = regmap_bulk_write(anx78xx->map[I2C_IDX_TX_P0],
|
||||||
|
- SP_DP_BUF_DATA0_REG, buffer,
|
||||||
|
- msg->size);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /* Write address and request */
|
||||||
|
- err = anx78xx_aux_address(anx78xx, msg->address);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], SP_DP_AUX_CH_CTRL1_REG,
|
||||||
|
- ctrl1);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- /* Start transaction */
|
||||||
|
- err = regmap_update_bits(anx78xx->map[I2C_IDX_TX_P0],
|
||||||
|
- SP_DP_AUX_CH_CTRL2_REG, SP_ADDR_ONLY |
|
||||||
|
- SP_AUX_EN, ctrl2);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- err = anx78xx_aux_wait(anx78xx);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- msg->reply = DP_AUX_I2C_REPLY_ACK;
|
||||||
|
-
|
||||||
|
- if ((msg->size > 0) && (msg->request & DP_AUX_I2C_READ)) {
|
||||||
|
- /* Read values from data buffer */
|
||||||
|
- err = regmap_bulk_read(anx78xx->map[I2C_IDX_TX_P0],
|
||||||
|
- SP_DP_BUF_DATA0_REG, buffer,
|
||||||
|
- msg->size);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- err = anx78xx_clear_bits(anx78xx->map[I2C_IDX_TX_P0],
|
||||||
|
- SP_DP_AUX_CH_CTRL2_REG, SP_ADDR_ONLY);
|
||||||
|
- if (err)
|
||||||
|
- return err;
|
||||||
|
-
|
||||||
|
- return msg->size;
|
||||||
|
+ return anx_aux_transfer(anx78xx->map[I2C_IDX_TX_P0], msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int anx78xx_set_hpd(struct anx78xx *anx78xx)
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..9cb30962032e
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||||
|
@@ -0,0 +1,169 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0
|
||||||
|
+/*
|
||||||
|
+ * Copyright(c) 2017 Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
+ *
|
||||||
|
+ * Based on analogix-anx78xx.c, which is:
|
||||||
|
+ * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/regmap.h>
|
||||||
|
+
|
||||||
|
+#include <drm/drm.h>
|
||||||
|
+#include <drm/drmP.h>
|
||||||
|
+#include <drm/drm_dp_helper.h>
|
||||||
|
+
|
||||||
|
+#include "analogix-i2c-dptx.h"
|
||||||
|
+
|
||||||
|
+#define AUX_WAIT_TIMEOUT_MS 15
|
||||||
|
+#define AUX_CH_BUFFER_SIZE 16
|
||||||
|
+
|
||||||
|
+static int anx_clear_bits(struct regmap *map, u8 reg, u8 mask)
|
||||||
|
+{
|
||||||
|
+ return regmap_update_bits(map, reg, mask, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static bool anx_aux_op_finished(struct regmap *map_dptx)
|
||||||
|
+{
|
||||||
|
+ unsigned int value;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ err = regmap_read(map_dptx, SP_DP_AUX_CH_CTRL2_REG, &value);
|
||||||
|
+ if (err < 0)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ return (value & SP_AUX_EN) == 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx_aux_wait(struct regmap *map_dptx)
|
||||||
|
+{
|
||||||
|
+ unsigned long timeout;
|
||||||
|
+ unsigned int status;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
|
||||||
|
+
|
||||||
|
+ while (!anx_aux_op_finished(map_dptx)) {
|
||||||
|
+ if (time_after(jiffies, timeout)) {
|
||||||
|
+ if (!anx_aux_op_finished(map_dptx)) {
|
||||||
|
+ DRM_ERROR("Timed out waiting AUX to finish\n");
|
||||||
|
+ return -ETIMEDOUT;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ usleep_range(1000, 2000);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Read the AUX channel access status */
|
||||||
|
+ err = regmap_read(map_dptx, SP_AUX_CH_STATUS_REG, &status);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Failed to read from AUX channel: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (status & SP_AUX_STATUS) {
|
||||||
|
+ DRM_ERROR("Failed to wait for AUX channel (status: %02x)\n",
|
||||||
|
+ status);
|
||||||
|
+ return -ETIMEDOUT;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx_aux_address(struct regmap *map_dptx, unsigned int addr)
|
||||||
|
+{
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(map_dptx, SP_AUX_ADDR_7_0_REG, addr & 0xff);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(map_dptx, SP_AUX_ADDR_15_8_REG,
|
||||||
|
+ (addr & 0xff00) >> 8);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * DP AUX CH Address Register #2, only update bits[3:0]
|
||||||
|
+ * [7:4] RESERVED
|
||||||
|
+ * [3:0] AUX_ADDR[19:16], Register control AUX CH address.
|
||||||
|
+ */
|
||||||
|
+ err = regmap_update_bits(map_dptx, SP_AUX_ADDR_19_16_REG,
|
||||||
|
+ SP_AUX_ADDR_19_16_MASK,
|
||||||
|
+ (addr & 0xf0000) >> 16);
|
||||||
|
+
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+ssize_t anx_aux_transfer(struct regmap *map_dptx, struct drm_dp_aux_msg *msg)
|
||||||
|
+{
|
||||||
|
+ u8 ctrl1 = msg->request;
|
||||||
|
+ u8 ctrl2 = SP_AUX_EN;
|
||||||
|
+ u8 *buffer = msg->buffer;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ /* The DP AUX transmit and receive buffer has 16 bytes. */
|
||||||
|
+ if (WARN_ON(msg->size > AUX_CH_BUFFER_SIZE))
|
||||||
|
+ return -E2BIG;
|
||||||
|
+
|
||||||
|
+ /* Zero-sized messages specify address-only transactions. */
|
||||||
|
+ if (msg->size < 1)
|
||||||
|
+ ctrl2 |= SP_ADDR_ONLY;
|
||||||
|
+ else /* For non-zero-sized set the length field. */
|
||||||
|
+ ctrl1 |= (msg->size - 1) << SP_AUX_LENGTH_SHIFT;
|
||||||
|
+
|
||||||
|
+ if ((msg->request & DP_AUX_I2C_READ) == 0) {
|
||||||
|
+ /* When WRITE | MOT write values to data buffer */
|
||||||
|
+ err = regmap_bulk_write(map_dptx,
|
||||||
|
+ SP_DP_BUF_DATA0_REG, buffer,
|
||||||
|
+ msg->size);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Write address and request */
|
||||||
|
+ err = anx_aux_address(map_dptx, msg->address);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(map_dptx, SP_DP_AUX_CH_CTRL1_REG, ctrl1);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /* Start transaction */
|
||||||
|
+ err = regmap_update_bits(map_dptx, SP_DP_AUX_CH_CTRL2_REG,
|
||||||
|
+ SP_ADDR_ONLY | SP_AUX_EN, ctrl2);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = anx_aux_wait(map_dptx);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ msg->reply = DP_AUX_I2C_REPLY_ACK;
|
||||||
|
+
|
||||||
|
+ if ((msg->size > 0) && (msg->request & DP_AUX_I2C_READ)) {
|
||||||
|
+ /* Read values from data buffer */
|
||||||
|
+ err = regmap_bulk_read(map_dptx,
|
||||||
|
+ SP_DP_BUF_DATA0_REG, buffer,
|
||||||
|
+ msg->size);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ err = anx_clear_bits(map_dptx, SP_DP_AUX_CH_CTRL2_REG, SP_ADDR_ONLY);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ return msg->size;
|
||||||
|
+}
|
||||||
|
+EXPORT_SYMBOL(anx_aux_transfer);
|
||||||
|
+
|
||||||
|
+MODULE_DESCRIPTION("Analogix DisplayPort Transmitter common code");
|
||||||
|
+MODULE_AUTHOR("Icenowy Zheng <icenowy@aosc.io>");
|
||||||
|
+MODULE_LICENSE("GPL v2");
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||||
|
index bc0831b127bf..c2ca854613a0 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||||
|
@@ -245,4 +245,6 @@
|
||||||
|
/* DP AUX Buffer Data Registers */
|
||||||
|
#define SP_DP_BUF_DATA0_REG 0xf0
|
||||||
|
|
||||||
|
+ssize_t anx_aux_transfer(struct regmap *map_dptx, struct drm_dp_aux_msg *msg);
|
||||||
|
+
|
||||||
|
#endif
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
From db3c5b3983ab2395794ea3ebd5c73ab7b39d2caa Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 18 Oct 2018 15:33:22 +0800
|
||||||
|
Subject: [PATCH 129/146] dt-bindings: Add ANX6345 DP/eDP transmitter binding
|
||||||
|
|
||||||
|
The ANX6345 is an ultra-low power DisplayPort/eDP transmitter designed
|
||||||
|
for portable devices.
|
||||||
|
|
||||||
|
Add a binding document for it.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
.../bindings/display/bridge/anx6345.txt | 39 +++++++++++++++++++
|
||||||
|
1 file changed, 39 insertions(+)
|
||||||
|
create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.txt
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/display/bridge/anx6345.txt b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..0689d4eb5f65
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Documentation/devicetree/bindings/display/bridge/anx6345.txt
|
||||||
|
@@ -0,0 +1,39 @@
|
||||||
|
+Analogix ANX6345 eDP Transmitter
|
||||||
|
+--------------------------------
|
||||||
|
+
|
||||||
|
+The ANX6345 is an ultra-low power Full-HD eDP transmitter designed for
|
||||||
|
+portable devices.
|
||||||
|
+
|
||||||
|
+Required properties:
|
||||||
|
+
|
||||||
|
+ - compatible : "analogix,anx6345"
|
||||||
|
+ - reg : I2C address of the device
|
||||||
|
+ - reset-gpios : Which GPIO to use for reset
|
||||||
|
+
|
||||||
|
+Optional properties:
|
||||||
|
+
|
||||||
|
+ - dvdd12-supply : Regulator for 1.2V digital core power.
|
||||||
|
+ - dvdd25-supply : Regulator for 2.5V digital core power.
|
||||||
|
+ - panel-supply : Regulator for the power of the panel.
|
||||||
|
+ - edid : verbatim EDID data block describing attached
|
||||||
|
+ panel, only used when the panel has no EDID info.
|
||||||
|
+ - Video port for RGB input, using the DT bindings defined in [1].
|
||||||
|
+
|
||||||
|
+[1]: Documentation/devicetree/bindings/media/video-interfaces.txt
|
||||||
|
+
|
||||||
|
+Example:
|
||||||
|
+
|
||||||
|
+anx6345: anx6345@38 {
|
||||||
|
+ compatible = "analogix,anx6345";
|
||||||
|
+ reg = <0x38>;
|
||||||
|
+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
|
||||||
|
+ panel-supply = <®_dc1sw>;
|
||||||
|
+ dvdd25-supply = <®_dldo2>;
|
||||||
|
+ dvdd12-supply = <®_fldo1>;
|
||||||
|
+
|
||||||
|
+ port {
|
||||||
|
+ anx6345_in: endpoint {
|
||||||
|
+ remote-endpoint = <&tcon0_out_anx6345>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,982 @@
|
||||||
|
From 2da065ab8aa3f562a02dfd3df4ad971d1229b136 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 18 Oct 2018 15:33:23 +0800
|
||||||
|
Subject: [PATCH 130/146] drm/bridge: Add Analogix anx6345 support
|
||||||
|
|
||||||
|
The ANX6345 is an ultra-low power DisplayPower/eDP transmitter designed
|
||||||
|
for portable devices. This driver adds initial support for RGB to eDP
|
||||||
|
mode, without HPD and interrupts, but with possibility to inject EDID.
|
||||||
|
This is a configuration usually seen in eDP applications.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
drivers/gpu/drm/bridge/analogix/Kconfig | 11 +
|
||||||
|
drivers/gpu/drm/bridge/analogix/Makefile | 1 +
|
||||||
|
.../drm/bridge/analogix/analogix-anx6345.c | 862 ++++++++++++++++++
|
||||||
|
.../drm/bridge/analogix/analogix-i2c-dptx.c | 2 +-
|
||||||
|
.../drm/bridge/analogix/analogix-i2c-dptx.h | 8 +
|
||||||
|
.../bridge/analogix/analogix-i2c-txcommon.h | 3 +
|
||||||
|
6 files changed, 886 insertions(+), 1 deletion(-)
|
||||||
|
create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||||
|
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
index eb893b465dd8..784ddca83b47 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||||
|
@@ -15,3 +15,14 @@ config DRM_ANALOGIX_ANX78XX
|
||||||
|
designed for portable devices. The ANX78XX transforms
|
||||||
|
the HDMI output of an application processor to MyDP
|
||||||
|
or DisplayPort.
|
||||||
|
+
|
||||||
|
+config DRM_ANALOGIX_ANX6345
|
||||||
|
+ tristate "Analogix ANX6345 bridge"
|
||||||
|
+ select DRM_ANALOGIX_DP_I2C
|
||||||
|
+ select DRM_KMS_HELPER
|
||||||
|
+ select REGMAP_I2C
|
||||||
|
+ help
|
||||||
|
+ ANX6345 is an ultra-low Full-HD DisplayPort/eDP
|
||||||
|
+ transmitter designed for portable devices. The
|
||||||
|
+ ANX6345 transforms the LVTTL RGB output of an
|
||||||
|
+ application processor to eDP or DisplayPort.
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/Makefile b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
index c37e2ded8ce3..3af9feab6e17 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||||
|
@@ -3,3 +3,4 @@ analogix_dp_i2c-objs := analogix-i2c-dptx.o
|
||||||
|
obj-$(CONFIG_DRM_ANALOGIX_DP) += analogix_dp.o
|
||||||
|
obj-$(CONFIG_DRM_ANALOGIX_DP_I2C) += analogix_dp_i2c.o
|
||||||
|
obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||||
|
+obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..81676407aa6d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||||
|
@@ -0,0 +1,863 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0
|
||||||
|
+/*
|
||||||
|
+ * Copyright(c) Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
+ * Based on analogix-anx6345.c, which is:
|
||||||
|
+ * Copyright(c) 2016, Analogix Semiconductor.
|
||||||
|
+ */
|
||||||
|
+#include <linux/delay.h>
|
||||||
|
+#include <linux/err.h>
|
||||||
|
+#include <linux/interrupt.h>
|
||||||
|
+#include <linux/i2c.h>
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/module.h>
|
||||||
|
+#include <linux/of_gpio.h>
|
||||||
|
+#include <linux/of_platform.h>
|
||||||
|
+#include <linux/regmap.h>
|
||||||
|
+#include <linux/types.h>
|
||||||
|
+#include <linux/gpio/consumer.h>
|
||||||
|
+#include <linux/regulator/consumer.h>
|
||||||
|
+
|
||||||
|
+#include <drm/drmP.h>
|
||||||
|
+#include <drm/drm_atomic_helper.h>
|
||||||
|
+#include <drm/drm_crtc.h>
|
||||||
|
+#include <drm/drm_crtc_helper.h>
|
||||||
|
+#include <drm/drm_probe_helper.h>
|
||||||
|
+#include <drm/drm_dp_helper.h>
|
||||||
|
+#include <drm/drm_edid.h>
|
||||||
|
+
|
||||||
|
+#include "analogix-i2c-dptx.h"
|
||||||
|
+#include "analogix-i2c-txcommon.h"
|
||||||
|
+
|
||||||
|
+#define I2C_NUM_ADDRESSES 2
|
||||||
|
+#define I2C_IDX_DPTX 0
|
||||||
|
+#define I2C_IDX_TXCOM 1
|
||||||
|
+
|
||||||
|
+#define XTAL_CLK 270 /* 27M */
|
||||||
|
+
|
||||||
|
+#define POLL_DELAY 50000 /* us */
|
||||||
|
+#define POLL_TIMEOUT 5000000 /* us */
|
||||||
|
+
|
||||||
|
+static const u8 anx6345_i2c_addresses[] = {
|
||||||
|
+ [I2C_IDX_DPTX] = ANALOGIX_I2C_DPTX,
|
||||||
|
+ [I2C_IDX_TXCOM] = ANALOGIX_I2C_TXCOMMON,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct anx6345_platform_data {
|
||||||
|
+ struct regulator *dvdd12;
|
||||||
|
+ struct regulator *dvdd25;
|
||||||
|
+ struct regulator *vcc_panel;
|
||||||
|
+ struct gpio_desc *gpiod_reset;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct anx6345 {
|
||||||
|
+ struct drm_dp_aux aux;
|
||||||
|
+ struct drm_bridge bridge;
|
||||||
|
+ struct i2c_client *client;
|
||||||
|
+ struct edid *edid;
|
||||||
|
+ struct drm_connector connector;
|
||||||
|
+ struct drm_dp_link link;
|
||||||
|
+ struct anx6345_platform_data pdata;
|
||||||
|
+ struct mutex lock;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * I2C Slave addresses of ANX6345 are mapped as DPTX and SYS
|
||||||
|
+ */
|
||||||
|
+ struct i2c_client *i2c_clients[I2C_NUM_ADDRESSES];
|
||||||
|
+ struct regmap *map[I2C_NUM_ADDRESSES];
|
||||||
|
+
|
||||||
|
+ u16 chipid;
|
||||||
|
+ u8 dpcd[DP_RECEIVER_CAP_SIZE];
|
||||||
|
+
|
||||||
|
+ bool powered;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static inline struct anx6345 *connector_to_anx6345(struct drm_connector *c)
|
||||||
|
+{
|
||||||
|
+ return container_of(c, struct anx6345, connector);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static inline struct anx6345 *bridge_to_anx6345(struct drm_bridge *bridge)
|
||||||
|
+{
|
||||||
|
+ return container_of(bridge, struct anx6345, bridge);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_set_bits(struct regmap *map, u8 reg, u8 mask)
|
||||||
|
+{
|
||||||
|
+ return regmap_update_bits(map, reg, mask, mask);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_clear_bits(struct regmap *map, u8 reg, u8 mask)
|
||||||
|
+{
|
||||||
|
+ return regmap_update_bits(map, reg, mask, 0);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static ssize_t anx6345_aux_transfer(struct drm_dp_aux *aux,
|
||||||
|
+ struct drm_dp_aux_msg *msg)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = container_of(aux, struct anx6345, aux);
|
||||||
|
+
|
||||||
|
+ return anx_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_dp_link_training(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ unsigned int value;
|
||||||
|
+ u8 dp_bw;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||||
|
+ SP_POWERDOWN_CTRL_REG,
|
||||||
|
+ SP_TOTAL_PD);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = drm_dp_dpcd_readb(&anx6345->aux, DP_MAX_LINK_RATE, &dp_bw);
|
||||||
|
+ if (err < 0)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ switch (dp_bw) {
|
||||||
|
+ case DP_LINK_BW_1_62:
|
||||||
|
+ case DP_LINK_BW_2_7:
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ default:
|
||||||
|
+ DRM_DEBUG_KMS("DP bandwidth (%#02x) not supported\n", dp_bw);
|
||||||
|
+ return -EINVAL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ err = anx6345_set_bits(anx6345->map[I2C_IDX_TXCOM], SP_VID_CTRL1_REG,
|
||||||
|
+ SP_VIDEO_MUTE);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||||
|
+ SP_VID_CTRL1_REG, SP_VIDEO_EN);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /* Get DPCD info */
|
||||||
|
+ err = drm_dp_dpcd_read(&anx6345->aux, DP_DPCD_REV,
|
||||||
|
+ &anx6345->dpcd, DP_RECEIVER_CAP_SIZE);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Failed to read DPCD: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Clear channel x SERDES power down */
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_ANALOG_POWER_DOWN_REG, SP_CH0_PD);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /* Check link capabilities */
|
||||||
|
+ err = drm_dp_link_probe(&anx6345->aux, &anx6345->link);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Failed to probe link capabilities: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Power up the sink */
|
||||||
|
+ err = drm_dp_link_power_up(&anx6345->aux, &anx6345->link);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Failed to power up DisplayPort link: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Possibly enable downspread on the sink */
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_DOWNSPREAD_CTRL1_REG, 0);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ if (anx6345->dpcd[DP_MAX_DOWNSPREAD] & DP_MAX_DOWNSPREAD_0_5) {
|
||||||
|
+ DRM_DEBUG("Enable downspread on the sink\n");
|
||||||
|
+ /* 4000PPM */
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_DOWNSPREAD_CTRL1_REG, 8);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = drm_dp_dpcd_writeb(&anx6345->aux, DP_DOWNSPREAD_CTRL,
|
||||||
|
+ DP_SPREAD_AMP_0_5);
|
||||||
|
+ if (err < 0)
|
||||||
|
+ return err;
|
||||||
|
+ } else {
|
||||||
|
+ err = drm_dp_dpcd_writeb(&anx6345->aux, DP_DOWNSPREAD_CTRL, 0);
|
||||||
|
+ if (err < 0)
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Set the lane count and the link rate on the sink */
|
||||||
|
+ if (drm_dp_enhanced_frame_cap(anx6345->dpcd))
|
||||||
|
+ err = anx6345_set_bits(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_SYSTEM_CTRL_BASE + 4,
|
||||||
|
+ SP_ENHANCED_MODE);
|
||||||
|
+ else
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_SYSTEM_CTRL_BASE + 4,
|
||||||
|
+ SP_ENHANCED_MODE);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ value = drm_dp_link_rate_to_bw_code(anx6345->link.rate);
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_MAIN_LINK_BW_SET_REG, value);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_LANE_COUNT_SET_REG, anx6345->link.num_lanes);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = drm_dp_link_configure(&anx6345->aux, &anx6345->link);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Failed to configure DisplayPort link: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Start training on the source */
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX], SP_DP_LT_CTRL_REG,
|
||||||
|
+ SP_LT_EN);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_read_poll_timeout(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_LT_CTRL_REG,
|
||||||
|
+ value, !(value & SP_DP_LT_INPROGRESS),
|
||||||
|
+ POLL_DELAY, POLL_TIMEOUT);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_tx_initialization(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ int err, i;
|
||||||
|
+
|
||||||
|
+ /* FIXME: hardcode color depth now */
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_TXCOM], SP_VID_CTRL2_REG,
|
||||||
|
+ SP_IN_BPC_6BIT << SP_IN_BPC_SHIFT);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX], SP_DP_PLL_CTRL_REG, 0);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_TXCOM],
|
||||||
|
+ SP_ANALOG_DEBUG1_REG, 0);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_LINK_DEBUG_CTRL_REG,
|
||||||
|
+ SP_NEW_PRBS7 | SP_M_VID_DEBUG);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_ANALOG_POWER_DOWN_REG, 0);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /* Force HPD */
|
||||||
|
+ err = anx6345_set_bits(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_SYSTEM_CTRL_BASE + 3,
|
||||||
|
+ SP_HPD_FORCE | SP_HPD_CTRL);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < 4; i++) {
|
||||||
|
+ /* 4 lanes */
|
||||||
|
+ err = regmap_write(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_LANE0_LT_CTRL_REG + i, 0);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Reset AUX */
|
||||||
|
+ err = anx6345_set_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||||
|
+ SP_RESET_CTRL2_REG, SP_AUX_RST);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||||
|
+ SP_RESET_CTRL2_REG, SP_AUX_RST);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ err = anx6345_dp_link_training(anx6345);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void anx6345_poweron(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ struct anx6345_platform_data *pdata = &anx6345->pdata;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ if (WARN_ON(anx6345->powered))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ if (pdata->dvdd12) {
|
||||||
|
+ err = regulator_enable(pdata->dvdd12);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to enable DVDD12 regulator: %d\n",
|
||||||
|
+ err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ usleep_range(1000, 2000);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (pdata->dvdd25) {
|
||||||
|
+ err = regulator_enable(pdata->dvdd25);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to enable DVDD25 regulator: %d\n",
|
||||||
|
+ err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ usleep_range(5000, 10000);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (pdata->vcc_panel) {
|
||||||
|
+ err = regulator_enable(pdata->vcc_panel);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to enable panel regulator: %d\n",
|
||||||
|
+ err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ gpiod_set_value_cansleep(pdata->gpiod_reset, 0);
|
||||||
|
+ usleep_range(1000, 2000);
|
||||||
|
+
|
||||||
|
+ gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
|
||||||
|
+
|
||||||
|
+ /* Power on registers module */
|
||||||
|
+ anx6345_set_bits(anx6345->map[I2C_IDX_TXCOM], SP_POWERDOWN_CTRL_REG,
|
||||||
|
+ SP_HDCP_PD | SP_AUDIO_PD | SP_VIDEO_PD | SP_LINK_PD);
|
||||||
|
+ anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM], SP_POWERDOWN_CTRL_REG,
|
||||||
|
+ SP_REGISTER_PD | SP_TOTAL_PD);
|
||||||
|
+
|
||||||
|
+ anx6345->powered = true;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void anx6345_poweroff(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ struct anx6345_platform_data *pdata = &anx6345->pdata;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ if (WARN_ON(!anx6345->powered))
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
|
||||||
|
+ usleep_range(1000, 2000);
|
||||||
|
+
|
||||||
|
+ if (pdata->vcc_panel) {
|
||||||
|
+ err = regulator_disable(pdata->vcc_panel);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to disable panel regulator: %d\n",
|
||||||
|
+ err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (pdata->dvdd25) {
|
||||||
|
+ err = regulator_disable(pdata->dvdd25);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to disable DVDD25 regulator: %d\n",
|
||||||
|
+ err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ usleep_range(5000, 10000);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (pdata->dvdd12) {
|
||||||
|
+ err = regulator_disable(pdata->dvdd12);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to disable DVDD12 regulator: %d\n",
|
||||||
|
+ err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ usleep_range(1000, 2000);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ anx6345->powered = false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_start(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ if (!anx6345->powered)
|
||||||
|
+ anx6345_poweron(anx6345);
|
||||||
|
+
|
||||||
|
+ /* Power on needed modules */
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||||
|
+ SP_POWERDOWN_CTRL_REG,
|
||||||
|
+ SP_VIDEO_PD | SP_LINK_PD);
|
||||||
|
+
|
||||||
|
+ err = anx6345_tx_initialization(anx6345);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed transmitter initialization: %d\n", err);
|
||||||
|
+ goto err_poweroff;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * This delay seems to help keep the hardware in a good state. Without
|
||||||
|
+ * it, there are times where it fails silently.
|
||||||
|
+ */
|
||||||
|
+ usleep_range(10000, 15000);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+err_poweroff:
|
||||||
|
+ DRM_ERROR("Failed DisplayPort transmitter initialization: %d\n", err);
|
||||||
|
+ anx6345_poweroff(anx6345);
|
||||||
|
+
|
||||||
|
+ return err;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_init_pdata(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ struct anx6345_platform_data *pdata = &anx6345->pdata;
|
||||||
|
+ struct device *dev = &anx6345->client->dev;
|
||||||
|
+
|
||||||
|
+ /* 1.2V digital core power regulator */
|
||||||
|
+ pdata->dvdd12 = devm_regulator_get(dev, "dvdd12");
|
||||||
|
+ if (IS_ERR(pdata->dvdd12)) {
|
||||||
|
+ DRM_ERROR("DVDD12 regulator not found\n");
|
||||||
|
+ return PTR_ERR(pdata->dvdd12);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* 2.5V digital core power regulator */
|
||||||
|
+ pdata->dvdd25 = devm_regulator_get(dev, "dvdd25");
|
||||||
|
+ if (IS_ERR(pdata->dvdd25)) {
|
||||||
|
+ DRM_ERROR("DVDD25 regulator not found\n");
|
||||||
|
+ return PTR_ERR(pdata->dvdd25);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* panel power regulator */
|
||||||
|
+ pdata->vcc_panel = devm_regulator_get(dev, "panel");
|
||||||
|
+ if (IS_ERR(pdata->vcc_panel)) {
|
||||||
|
+ DRM_ERROR("panel regulator not found\n");
|
||||||
|
+ return PTR_ERR(pdata->vcc_panel);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* GPIO for chip reset */
|
||||||
|
+ pdata->gpiod_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
|
||||||
|
+
|
||||||
|
+ return PTR_ERR_OR_ZERO(pdata->gpiod_reset);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_config_dp_output(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM], SP_VID_CTRL1_REG,
|
||||||
|
+ SP_VIDEO_MUTE);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /* Enable DP output */
|
||||||
|
+ err = anx6345_set_bits(anx6345->map[I2C_IDX_TXCOM], SP_VID_CTRL1_REG,
|
||||||
|
+ SP_VIDEO_EN);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ /* Force stream valid */
|
||||||
|
+ err = anx6345_set_bits(anx6345->map[I2C_IDX_DPTX],
|
||||||
|
+ SP_DP_SYSTEM_CTRL_BASE + 3,
|
||||||
|
+ SP_STRM_FORCE | SP_STRM_CTRL);
|
||||||
|
+ if (err)
|
||||||
|
+ return err;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_get_downstream_info(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ u8 value;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ err = drm_dp_dpcd_readb(&anx6345->aux, DP_SINK_COUNT, &value);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Get sink count failed %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!DP_GET_SINK_COUNT(value)) {
|
||||||
|
+ DRM_ERROR("Downstream disconnected\n");
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_probe_edid_from_of(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ const u8 *edidp;
|
||||||
|
+ int len;
|
||||||
|
+
|
||||||
|
+ if (!anx6345->bridge.of_node)
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
+ edidp = of_get_property(anx6345->bridge.of_node, "edid", &len);
|
||||||
|
+ if (!edidp || len != EDID_LENGTH)
|
||||||
|
+ return -EINVAL;
|
||||||
|
+
|
||||||
|
+ anx6345->edid = devm_kmemdup(&anx6345->client->dev, edidp,
|
||||||
|
+ len, GFP_KERNEL);
|
||||||
|
+
|
||||||
|
+ if (!anx6345->edid)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_get_modes(struct drm_connector *connector)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = connector_to_anx6345(connector);
|
||||||
|
+ int err, num_modes = 0;
|
||||||
|
+
|
||||||
|
+ if (WARN_ON(!anx6345->powered))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ if (anx6345->edid)
|
||||||
|
+ return drm_add_edid_modes(connector, anx6345->edid);
|
||||||
|
+
|
||||||
|
+ mutex_lock(&anx6345->lock);
|
||||||
|
+
|
||||||
|
+ err = anx6345_get_downstream_info(anx6345);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to get downstream info: %d\n", err);
|
||||||
|
+ goto unlock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ anx6345->edid = drm_get_edid(connector, &anx6345->aux.ddc);
|
||||||
|
+ if (!anx6345->edid)
|
||||||
|
+ DRM_ERROR("Failed to read EDID from panel\n");
|
||||||
|
+
|
||||||
|
+ if (!anx6345->edid) {
|
||||||
|
+ err = anx6345_probe_edid_from_of(anx6345);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to probe EDID from device tree\n");
|
||||||
|
+ goto unlock;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ err = drm_connector_update_edid_property(connector,
|
||||||
|
+ anx6345->edid);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to update EDID property: %d\n", err);
|
||||||
|
+ goto unlock;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ num_modes = drm_add_edid_modes(connector, anx6345->edid);
|
||||||
|
+
|
||||||
|
+unlock:
|
||||||
|
+ mutex_unlock(&anx6345->lock);
|
||||||
|
+
|
||||||
|
+ return num_modes;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct drm_connector_helper_funcs anx6345_connector_helper_funcs = {
|
||||||
|
+ .get_modes = anx6345_get_modes,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static enum drm_connector_status anx6345_detect(struct drm_connector *connector,
|
||||||
|
+ bool force)
|
||||||
|
+{
|
||||||
|
+ return connector_status_connected;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct drm_connector_funcs anx6345_connector_funcs = {
|
||||||
|
+ .fill_modes = drm_helper_probe_single_connector_modes,
|
||||||
|
+ .detect = anx6345_detect,
|
||||||
|
+ .destroy = drm_connector_cleanup,
|
||||||
|
+ .reset = drm_atomic_helper_connector_reset,
|
||||||
|
+ .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
|
||||||
|
+ .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int anx6345_bridge_attach(struct drm_bridge *bridge)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ if (!bridge->encoder) {
|
||||||
|
+ DRM_ERROR("Parent encoder object not found");
|
||||||
|
+ return -ENODEV;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Register aux channel */
|
||||||
|
+ anx6345->aux.name = "DP-AUX";
|
||||||
|
+ anx6345->aux.dev = &anx6345->client->dev;
|
||||||
|
+ anx6345->aux.transfer = anx6345_aux_transfer;
|
||||||
|
+
|
||||||
|
+ err = drm_dp_aux_register(&anx6345->aux);
|
||||||
|
+ if (err < 0) {
|
||||||
|
+ DRM_ERROR("Failed to register aux channel: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ err = drm_connector_init(bridge->dev, &anx6345->connector,
|
||||||
|
+ &anx6345_connector_funcs,
|
||||||
|
+ DRM_MODE_CONNECTOR_eDP);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to initialize connector: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ drm_connector_helper_add(&anx6345->connector,
|
||||||
|
+ &anx6345_connector_helper_funcs);
|
||||||
|
+
|
||||||
|
+ err = drm_connector_register(&anx6345->connector);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to register connector: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ anx6345->connector.polled = DRM_CONNECTOR_POLL_HPD;
|
||||||
|
+
|
||||||
|
+ err = drm_connector_attach_encoder(&anx6345->connector,
|
||||||
|
+ bridge->encoder);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to link up connector to encoder: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static bool anx6345_bridge_mode_fixup(struct drm_bridge *bridge,
|
||||||
|
+ const struct drm_display_mode *mode,
|
||||||
|
+ struct drm_display_mode *adjusted_mode)
|
||||||
|
+{
|
||||||
|
+ if (mode->flags & DRM_MODE_FLAG_INTERLACE)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ /* Max 1200p at 5.4 Ghz, one lane */
|
||||||
|
+ if (mode->clock > 154000)
|
||||||
|
+ return false;
|
||||||
|
+
|
||||||
|
+ return true;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void anx6345_bridge_disable(struct drm_bridge *bridge)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
|
||||||
|
+
|
||||||
|
+ /* Power off all modules except configuration registers access */
|
||||||
|
+ anx6345_set_bits(anx6345->map[I2C_IDX_TXCOM], SP_POWERDOWN_CTRL_REG,
|
||||||
|
+ SP_HDCP_PD | SP_AUDIO_PD | SP_VIDEO_PD | SP_LINK_PD);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void anx6345_bridge_mode_set(struct drm_bridge *bridge,
|
||||||
|
+ const struct drm_display_mode *mode,
|
||||||
|
+ const struct drm_display_mode *adjusted_mode)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
|
||||||
|
+
|
||||||
|
+ if (WARN_ON(!anx6345->powered))
|
||||||
|
+ return;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void anx6345_bridge_enable(struct drm_bridge *bridge)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ err = anx6345_start(anx6345);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to initialize: %d\n", err);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ err = anx6345_config_dp_output(anx6345);
|
||||||
|
+ if (err)
|
||||||
|
+ DRM_ERROR("Failed to enable DP output: %d\n", err);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct drm_bridge_funcs anx6345_bridge_funcs = {
|
||||||
|
+ .attach = anx6345_bridge_attach,
|
||||||
|
+ .mode_fixup = anx6345_bridge_mode_fixup,
|
||||||
|
+ .disable = anx6345_bridge_disable,
|
||||||
|
+ .mode_set = anx6345_bridge_mode_set,
|
||||||
|
+ .enable = anx6345_bridge_enable,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static void unregister_i2c_dummy_clients(struct anx6345 *anx6345)
|
||||||
|
+{
|
||||||
|
+ unsigned int i;
|
||||||
|
+
|
||||||
|
+ for (i = 1; i < ARRAY_SIZE(anx6345->i2c_clients); i++)
|
||||||
|
+ if (anx6345->i2c_clients[i] &&
|
||||||
|
+ anx6345->i2c_clients[i]->addr != anx6345->client->addr)
|
||||||
|
+ i2c_unregister_device(anx6345->i2c_clients[i]);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct regmap_config anx6345_regmap_config = {
|
||||||
|
+ .reg_bits = 8,
|
||||||
|
+ .val_bits = 8,
|
||||||
|
+ .max_register = 0xff,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const u16 anx6345_chipid_list[] = {
|
||||||
|
+ 0x6345,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int anx6345_i2c_probe(struct i2c_client *client,
|
||||||
|
+ const struct i2c_device_id *id)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345;
|
||||||
|
+ struct anx6345_platform_data *pdata;
|
||||||
|
+ unsigned int i, idl, idh, version;
|
||||||
|
+ bool found = false;
|
||||||
|
+ int err;
|
||||||
|
+
|
||||||
|
+ anx6345 = devm_kzalloc(&client->dev, sizeof(*anx6345), GFP_KERNEL);
|
||||||
|
+ if (!anx6345)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ pdata = &anx6345->pdata;
|
||||||
|
+
|
||||||
|
+ mutex_init(&anx6345->lock);
|
||||||
|
+
|
||||||
|
+#if IS_ENABLED(CONFIG_OF)
|
||||||
|
+ anx6345->bridge.of_node = client->dev.of_node;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+ anx6345->client = client;
|
||||||
|
+ i2c_set_clientdata(client, anx6345);
|
||||||
|
+
|
||||||
|
+ err = anx6345_init_pdata(anx6345);
|
||||||
|
+ if (err) {
|
||||||
|
+ DRM_ERROR("Failed to initialize pdata: %d\n", err);
|
||||||
|
+ return err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Map slave addresses of ANX6345 */
|
||||||
|
+ for (i = 0; i < I2C_NUM_ADDRESSES; i++) {
|
||||||
|
+ if (anx6345_i2c_addresses[i] >> 1 != client->addr)
|
||||||
|
+ anx6345->i2c_clients[i] = i2c_new_dummy(client->adapter,
|
||||||
|
+ anx6345_i2c_addresses[i] >> 1);
|
||||||
|
+ else
|
||||||
|
+ anx6345->i2c_clients[i] = client;
|
||||||
|
+
|
||||||
|
+ if (!anx6345->i2c_clients[i]) {
|
||||||
|
+ err = -ENOMEM;
|
||||||
|
+ DRM_ERROR("Failed to reserve I2C bus %02x\n",
|
||||||
|
+ anx6345_i2c_addresses[i]);
|
||||||
|
+ goto err_unregister_i2c;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ anx6345->map[i] = devm_regmap_init_i2c(anx6345->i2c_clients[i],
|
||||||
|
+ &anx6345_regmap_config);
|
||||||
|
+ if (IS_ERR(anx6345->map[i])) {
|
||||||
|
+ err = PTR_ERR(anx6345->map[i]);
|
||||||
|
+ DRM_ERROR("Failed regmap initialization %02x\n",
|
||||||
|
+ anx6345_i2c_addresses[i]);
|
||||||
|
+ goto err_unregister_i2c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Look for supported chip ID */
|
||||||
|
+ anx6345_poweron(anx6345);
|
||||||
|
+
|
||||||
|
+ err = regmap_read(anx6345->map[I2C_IDX_TXCOM], SP_DEVICE_IDL_REG,
|
||||||
|
+ &idl);
|
||||||
|
+ if (err)
|
||||||
|
+ goto err_poweroff;
|
||||||
|
+
|
||||||
|
+ err = regmap_read(anx6345->map[I2C_IDX_TXCOM], SP_DEVICE_IDH_REG,
|
||||||
|
+ &idh);
|
||||||
|
+ if (err)
|
||||||
|
+ goto err_poweroff;
|
||||||
|
+
|
||||||
|
+ anx6345->chipid = (u8)idl | ((u8)idh << 8);
|
||||||
|
+
|
||||||
|
+ err = regmap_read(anx6345->map[I2C_IDX_TXCOM], SP_DEVICE_VERSION_REG,
|
||||||
|
+ &version);
|
||||||
|
+ if (err)
|
||||||
|
+ goto err_poweroff;
|
||||||
|
+
|
||||||
|
+ for (i = 0; i < ARRAY_SIZE(anx6345_chipid_list); i++) {
|
||||||
|
+ if (anx6345->chipid == anx6345_chipid_list[i]) {
|
||||||
|
+ DRM_INFO("Found ANX%x (ver. %d) eDP Transmitter\n",
|
||||||
|
+ anx6345->chipid, version);
|
||||||
|
+ found = true;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (!found) {
|
||||||
|
+ DRM_ERROR("ANX%x (ver. %d) not supported by this driver\n",
|
||||||
|
+ anx6345->chipid, version);
|
||||||
|
+ err = -ENODEV;
|
||||||
|
+ goto err_poweroff;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ anx6345->bridge.funcs = &anx6345_bridge_funcs;
|
||||||
|
+
|
||||||
|
+ drm_bridge_add(&anx6345->bridge);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+err_poweroff:
|
||||||
|
+ anx6345_poweroff(anx6345);
|
||||||
|
+
|
||||||
|
+err_unregister_i2c:
|
||||||
|
+ unregister_i2c_dummy_clients(anx6345);
|
||||||
|
+ return err;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int anx6345_i2c_remove(struct i2c_client *client)
|
||||||
|
+{
|
||||||
|
+ struct anx6345 *anx6345 = i2c_get_clientdata(client);
|
||||||
|
+
|
||||||
|
+ drm_bridge_remove(&anx6345->bridge);
|
||||||
|
+
|
||||||
|
+ unregister_i2c_dummy_clients(anx6345);
|
||||||
|
+
|
||||||
|
+ kfree(anx6345->edid);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct i2c_device_id anx6345_id[] = {
|
||||||
|
+ { "anx6345", 0 },
|
||||||
|
+ { /* sentinel */ }
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(i2c, anx6345_id);
|
||||||
|
+
|
||||||
|
+#if IS_ENABLED(CONFIG_OF)
|
||||||
|
+static const struct of_device_id anx6345_match_table[] = {
|
||||||
|
+ { .compatible = "analogix,anx6345", },
|
||||||
|
+ { /* sentinel */ },
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(of, anx6345_match_table);
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+static struct i2c_driver anx6345_driver = {
|
||||||
|
+ .driver = {
|
||||||
|
+ .name = "anx6345",
|
||||||
|
+ .of_match_table = of_match_ptr(anx6345_match_table),
|
||||||
|
+ },
|
||||||
|
+ .probe = anx6345_i2c_probe,
|
||||||
|
+ .remove = anx6345_i2c_remove,
|
||||||
|
+ .id_table = anx6345_id,
|
||||||
|
+};
|
||||||
|
+module_i2c_driver(anx6345_driver);
|
||||||
|
+
|
||||||
|
+MODULE_DESCRIPTION("ANX6345 eDP Transmitter driver");
|
||||||
|
+MODULE_AUTHOR("Icenowy Zheng <icenowy@aosc.io>");
|
||||||
|
+MODULE_LICENSE("GPL v2");
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||||
|
index 9cb30962032e..53b0e73d6a24 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||||
|
@@ -117,7 +117,7 @@ ssize_t anx_aux_transfer(struct regmap *map_dptx, struct drm_dp_aux_msg *msg)
|
||||||
|
else /* For non-zero-sized set the length field. */
|
||||||
|
ctrl1 |= (msg->size - 1) << SP_AUX_LENGTH_SHIFT;
|
||||||
|
|
||||||
|
- if ((msg->request & DP_AUX_I2C_READ) == 0) {
|
||||||
|
+ if ((msg->size > 0) && ((msg->request & DP_AUX_I2C_READ) == 0)) {
|
||||||
|
/* When WRITE | MOT write values to data buffer */
|
||||||
|
err = regmap_bulk_write(map_dptx,
|
||||||
|
SP_DP_BUF_DATA0_REG, buffer,
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||||
|
index c2ca854613a0..b29a0b3bc23c 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||||
|
@@ -75,7 +75,11 @@
|
||||||
|
#define SP_CHA_STA BIT(2)
|
||||||
|
/* Bits for DP System Control Register 3 */
|
||||||
|
#define SP_HPD_STATUS BIT(6)
|
||||||
|
+#define SP_HPD_FORCE BIT(5)
|
||||||
|
+#define SP_HPD_CTRL BIT(4)
|
||||||
|
#define SP_STRM_VALID BIT(2)
|
||||||
|
+#define SP_STRM_FORCE BIT(1)
|
||||||
|
+#define SP_STRM_CTRL BIT(0)
|
||||||
|
/* Bits for DP System Control Register 4 */
|
||||||
|
#define SP_ENHANCED_MODE BIT(3)
|
||||||
|
|
||||||
|
@@ -120,6 +124,9 @@
|
||||||
|
#define SP_LINK_BW_SET_MASK 0x1f
|
||||||
|
#define SP_INITIAL_SLIM_M_AUD_SEL BIT(5)
|
||||||
|
|
||||||
|
+/* DP Lane Count Setting Register */
|
||||||
|
+#define SP_DP_LANE_COUNT_SET_REG 0xa1
|
||||||
|
+
|
||||||
|
/* DP Training Pattern Set Register */
|
||||||
|
#define SP_DP_TRAINING_PATTERN_SET_REG 0xa2
|
||||||
|
|
||||||
|
@@ -133,6 +140,7 @@
|
||||||
|
|
||||||
|
/* DP Link Training Control Register */
|
||||||
|
#define SP_DP_LT_CTRL_REG 0xa8
|
||||||
|
+#define SP_DP_LT_INPROGRESS 0x80
|
||||||
|
#define SP_LT_ERROR_TYPE_MASK 0x70
|
||||||
|
# define SP_LT_NO_ERROR 0x00
|
||||||
|
# define SP_LT_AUX_WRITE_ERROR 0x01
|
||||||
|
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||||
|
index 7d683573e970..480c98a225b1 100644
|
||||||
|
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||||
|
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||||
|
@@ -183,6 +183,9 @@
|
||||||
|
#define SP_VBIT BIT(1)
|
||||||
|
#define SP_AUDIO_LAYOUT BIT(0)
|
||||||
|
|
||||||
|
+/* Analog Debug Register 1 */
|
||||||
|
+#define SP_ANALOG_DEBUG1_REG 0xdc
|
||||||
|
+
|
||||||
|
/* Analog Debug Register 2 */
|
||||||
|
#define SP_ANALOG_DEBUG2_REG 0xdd
|
||||||
|
#define SP_FORCE_SW_OFF_BYPASS 0x20
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
From 82fe5562e8d5cb289e97ff8d259b21889e72b03b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 18 Oct 2018 15:33:25 +0800
|
||||||
|
Subject: [PATCH 132/146] arm64: allwinner: a64: enable ANX6345 bridge on
|
||||||
|
Pinebook
|
||||||
|
|
||||||
|
Pinebook has an ANX6345 bridge connected to the RGB666 LCD output, and
|
||||||
|
the I2C controlling signals are connected to R_I2C bus.
|
||||||
|
|
||||||
|
Enable it in the device tree, and add a usable EDID from the panel's
|
||||||
|
datasheet (at least 14" Pinebook used a panel without EDID).
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
.../dts/allwinner/sun50i-a64-pinebook.dts | 39 +++++++++++++++++++
|
||||||
|
1 file changed, 39 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
index b55ac4e1df37..8c9bd4dfbbba 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
@@ -123,6 +123,10 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&mixer0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mmc0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&mmc0_pins>;
|
||||||
|
@@ -175,6 +179,27 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&r_i2c {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&r_i2c_pins_a>;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ anx6345: anx6345@38 {
|
||||||
|
+ compatible = "analogix,anx6345";
|
||||||
|
+ reg = <0x38>;
|
||||||
|
+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
|
||||||
|
+ panel-supply = <®_dc1sw>;
|
||||||
|
+ dvdd25-supply = <®_dldo2>;
|
||||||
|
+ dvdd12-supply = <®_fldo1>;
|
||||||
|
+
|
||||||
|
+ port {
|
||||||
|
+ anx6345_in: endpoint {
|
||||||
|
+ remote-endpoint = <&tcon0_out_anx6345>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&r_rsb {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
@@ -348,6 +373,20 @@
|
||||||
|
"MIC2", "Internal Microphone Right";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&tcon0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&lcd_rgb666_pins>;
|
||||||
|
+
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&tcon0_out {
|
||||||
|
+ tcon0_out_anx6345: endpoint@0 {
|
||||||
|
+ reg = <0>;
|
||||||
|
+ remote-endpoint = <&anx6345_in>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&uart0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart0_pins_a>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
From 955974c9ba484fc2b7e4396b5fdc6687a9a530a0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
Date: Thu, 18 Oct 2018 15:33:26 +0800
|
||||||
|
Subject: [PATCH 133/146] arm64: allwinner: a64: enable ANX6345 bridge on
|
||||||
|
TERES-I
|
||||||
|
|
||||||
|
TERES-I has an ANX6345 bridge connected to the RGB666 LCD output, and
|
||||||
|
the I2C controlling signals are connected to I2C0 bus.
|
||||||
|
|
||||||
|
Enable it in the device tree.
|
||||||
|
|
||||||
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
---
|
||||||
|
.../boot/dts/allwinner/sun50i-a64-teres-i.dts | 40 +++++++++++++++++--
|
||||||
|
1 file changed, 36 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||||
|
index 81f8e0098699..6c3318b3c648 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||||
|
@@ -72,20 +72,38 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&de {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci1 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
-/* The ANX6345 eDP-bridge is on i2c0. There is no linux (mainline)
|
||||||
|
- * driver for this chip at the moment, the bootloader initializes it.
|
||||||
|
- * However it can be accessed with the i2c-dev driver from user space.
|
||||||
|
- */
|
||||||
|
&i2c0 {
|
||||||
|
clock-frequency = <100000>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&i2c0_pins>;
|
||||||
|
status = "okay";
|
||||||
|
+
|
||||||
|
+ anx6345: anx6345@38 {
|
||||||
|
+ compatible = "analogix,anx6345";
|
||||||
|
+ reg = <0x38>;
|
||||||
|
+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
|
||||||
|
+ dvdd25-supply = <®_dldo2>;
|
||||||
|
+ dvdd12-supply = <®_dldo3>;
|
||||||
|
+
|
||||||
|
+ port {
|
||||||
|
+ anx6345_in: endpoint {
|
||||||
|
+ remote-endpoint = <&tcon0_out_anx6345>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mixer0 {
|
||||||
|
+ status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
&mmc0 {
|
||||||
|
@@ -258,6 +276,20 @@
|
||||||
|
vcc-hdmi-supply = <®_dldo1>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+&tcon0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&lcd_rgb666_pins>;
|
||||||
|
+
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&tcon0_out {
|
||||||
|
+ tcon0_out_anx6345: endpoint@0 {
|
||||||
|
+ reg = <0>;
|
||||||
|
+ remote-endpoint = <&anx6345_in>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&uart0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart0_pins_a>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
24
patch/kernel/sunxi-dev/0136-hdmi-audio-fixup.patch
Normal file
24
patch/kernel/sunxi-dev/0136-hdmi-audio-fixup.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
From 2c38da8ed7cc1f7dabe72c4d455ba25e0ba18fe7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Sun, 28 Oct 2018 19:06:28 -0700
|
||||||
|
Subject: [PATCH 136/146] hdmi audio fixup
|
||||||
|
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
index 0f5b412cfc81..f507bb1d8c3d 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||||
|
@@ -1044,6 +1044,7 @@
|
||||||
|
};
|
||||||
|
|
||||||
|
hdmi: hdmi@1ee0000 {
|
||||||
|
+ #sound-dai-cells = <0>;
|
||||||
|
compatible = "allwinner,sun50i-a64-dw-hdmi",
|
||||||
|
"allwinner,sun8i-a83t-dw-hdmi";
|
||||||
|
reg = <0x01ee0000 0x10000>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
39
patch/kernel/sunxi-dev/0137-Pinebook-HDMI-audio.patch
Normal file
39
patch/kernel/sunxi-dev/0137-Pinebook-HDMI-audio.patch
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
From 59197ec5632d29d173aae2fbe6c92402fc2f0a58 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Sun, 28 Oct 2018 19:07:23 -0700
|
||||||
|
Subject: [PATCH 137/146] Pinebook HDMI audio
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
index 8c9bd4dfbbba..0f788400ece0 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
@@ -123,6 +123,10 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&i2s2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mixer0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
@@ -373,6 +377,10 @@
|
||||||
|
"MIC2", "Internal Microphone Right";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&sound_hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&tcon0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&lcd_rgb666_pins>;
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
From e4a72ee5f7717daaa2928b3d18a5327739c8b180 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 19:40:18 -0700
|
||||||
|
Subject: [PATCH 139/146] Bluetooth: Add new quirk for broken local ext
|
||||||
|
features max_page
|
||||||
|
|
||||||
|
Some adapters (e.g. RTL8723CS) advertise that they have more than
|
||||||
|
2 pages for local ext features, but they don't support any features
|
||||||
|
declared in these pages. RTL8723CS reports max_page = 2 and declares
|
||||||
|
support for sync train and secure connection, but it responds with
|
||||||
|
either garbage or with error in status on corresponding commands.
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
include/net/bluetooth/hci.h | 7 +++++++
|
||||||
|
net/bluetooth/hci_event.c | 4 +++-
|
||||||
|
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
|
||||||
|
index cdd9f1fe7cfa..32b9195f6fca 100644
|
||||||
|
--- a/include/net/bluetooth/hci.h
|
||||||
|
+++ b/include/net/bluetooth/hci.h
|
||||||
|
@@ -192,6 +192,13 @@ enum {
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
HCI_QUIRK_NON_PERSISTENT_SETUP,
|
||||||
|
+
|
||||||
|
+ /* When this quirk is set, max_page for local extended features
|
||||||
|
+ * is set to 1, even if controller reports higher number. Some
|
||||||
|
+ * controllers (e.g. RTL8723CS) report more pages, but they
|
||||||
|
+ * don't actually support features declared there.
|
||||||
|
+ */
|
||||||
|
+ HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* HCI device flags */
|
||||||
|
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
|
||||||
|
index f12555f23a49..3eb289711dea 100644
|
||||||
|
--- a/net/bluetooth/hci_event.c
|
||||||
|
+++ b/net/bluetooth/hci_event.c
|
||||||
|
@@ -639,7 +639,9 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
|
||||||
|
if (rp->status)
|
||||||
|
return;
|
||||||
|
|
||||||
|
- if (hdev->max_page < rp->max_page)
|
||||||
|
+ if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
|
||||||
|
+ &hdev->quirks) &&
|
||||||
|
+ hdev->max_page < rp->max_page)
|
||||||
|
hdev->max_page = rp->max_page;
|
||||||
|
|
||||||
|
if (rp->page < HCI_MAX_PAGES)
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
From e8a404daea8d869304fdf810ac502cda8fbb4999 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 19:48:25 -0700
|
||||||
|
Subject: [PATCH 140/146] Bluetooth: hci_h5: Add support for reset GPIO
|
||||||
|
|
||||||
|
Some boards (e.g. Pine64 and Pinebook) wire a GPIO to reset pin of
|
||||||
|
RTL8723BS
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/bluetooth/hci_h5.c | 9 +++++++++
|
||||||
|
1 file changed, 9 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
|
||||||
|
index 8eede1197cd2..6e047df4f475 100644
|
||||||
|
--- a/drivers/bluetooth/hci_h5.c
|
||||||
|
+++ b/drivers/bluetooth/hci_h5.c
|
||||||
|
@@ -107,6 +107,7 @@ struct h5 {
|
||||||
|
const struct h5_vnd *vnd;
|
||||||
|
const char *id;
|
||||||
|
|
||||||
|
+ struct gpio_desc *reset_gpio;
|
||||||
|
struct gpio_desc *enable_gpio;
|
||||||
|
struct gpio_desc *device_wake_gpio;
|
||||||
|
};
|
||||||
|
@@ -831,6 +832,10 @@ static int h5_serdev_probe(struct serdev_device *serdev)
|
||||||
|
if (IS_ERR(h5->device_wake_gpio))
|
||||||
|
return PTR_ERR(h5->device_wake_gpio);
|
||||||
|
|
||||||
|
+ h5->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
|
||||||
|
+ if (IS_ERR(h5->reset_gpio))
|
||||||
|
+ return PTR_ERR(h5->reset_gpio);
|
||||||
|
+
|
||||||
|
return hci_uart_register_device(&h5->serdev_hu, &h5p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -897,6 +902,9 @@ static void h5_btrtl_open(struct h5 *h5)
|
||||||
|
|
||||||
|
/* The controller needs up to 500ms to wakeup */
|
||||||
|
gpiod_set_value_cansleep(h5->enable_gpio, 1);
|
||||||
|
+ /* Take it out of reset */
|
||||||
|
+ gpiod_set_value_cansleep(h5->reset_gpio, 0);
|
||||||
|
+ msleep(100);
|
||||||
|
gpiod_set_value_cansleep(h5->device_wake_gpio, 1);
|
||||||
|
msleep(500);
|
||||||
|
}
|
||||||
|
@@ -904,6 +912,7 @@ static void h5_btrtl_open(struct h5 *h5)
|
||||||
|
static void h5_btrtl_close(struct h5 *h5)
|
||||||
|
{
|
||||||
|
gpiod_set_value_cansleep(h5->device_wake_gpio, 0);
|
||||||
|
+ gpiod_set_value_cansleep(h5->reset_gpio, 1);
|
||||||
|
gpiod_set_value_cansleep(h5->enable_gpio, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
From d063238f64a1f0a4e8baf11e55d9cc1989816ee6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 20:05:14 -0700
|
||||||
|
Subject: [PATCH 141/146] dt-bindings: net: bluetooth: Add rtl8723bs-bluetooth
|
||||||
|
|
||||||
|
Add binding document for bluetooth part of RTL8723BS/RTL8723CS
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
.../bindings/net/rtl8723bs-bluetooth.txt | 35 +++++++++++++++++++
|
||||||
|
1 file changed, 35 insertions(+)
|
||||||
|
create mode 100644 Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt
|
||||||
|
|
||||||
|
diff --git a/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt b/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..8357f242ae4c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt
|
||||||
|
@@ -0,0 +1,35 @@
|
||||||
|
+RTL8723BS/RTL8723CS Bluetooth
|
||||||
|
+---------------------
|
||||||
|
+
|
||||||
|
+RTL8723CS/RTL8723CS is WiFi + BT chip. WiFi part is connected over SDIO, while
|
||||||
|
+BT is connected over serial. It speaks H5 protocol with few extra commands
|
||||||
|
+to upload firmware and change module speed.
|
||||||
|
+
|
||||||
|
+Required properties:
|
||||||
|
+
|
||||||
|
+ - compatible: should be one of the following:
|
||||||
|
+ * "realtek,rtl8723bs-bt"
|
||||||
|
+ * "realtek,rtl8723cs-bt"
|
||||||
|
+Optional properties:
|
||||||
|
+
|
||||||
|
+ - device-wake-gpios: GPIO specifier, used to wakeup the BT module (active high)
|
||||||
|
+ - enable-gpios: GPIO specifier, used to enable the BT module (active high)
|
||||||
|
+ - host-wake-gpios: GPIO specifier, used to wakeup the host processor (active high)
|
||||||
|
+ - firmware-postfix: firmware postfix to be used for firmware config
|
||||||
|
+ - reset-gpios: GPIO specifier, used to reset the BT module (active high)
|
||||||
|
+
|
||||||
|
+Example:
|
||||||
|
+
|
||||||
|
+&uart1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ bluetooth {
|
||||||
|
+ compatible = "realtek,rtl8723bs-bt";
|
||||||
|
+ reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */
|
||||||
|
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
|
||||||
|
+ host-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
|
||||||
|
+ firmware-postfix="pine64";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
From 38caa52f547c63c9cd7aa19259bb6806cff7d50d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 20:07:41 -0700
|
||||||
|
Subject: [PATCH 142/146] Bluetooth: hci_h5: Add support for binding RTL8723BS
|
||||||
|
with device tree
|
||||||
|
|
||||||
|
RTL8723BS is often used in ARM boards, so add ability to bind it
|
||||||
|
using device tree.
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/bluetooth/hci_h5.c | 20 ++++++++++++++++++++
|
||||||
|
1 file changed, 20 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
|
||||||
|
index 6e047df4f475..9cc10e299fa8 100644
|
||||||
|
--- a/drivers/bluetooth/hci_h5.c
|
||||||
|
+++ b/drivers/bluetooth/hci_h5.c
|
||||||
|
@@ -26,6 +26,7 @@
|
||||||
|
#include <linux/gpio/consumer.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
|
+#include <linux/of_device.h>
|
||||||
|
#include <linux/serdev.h>
|
||||||
|
#include <linux/skbuff.h>
|
||||||
|
|
||||||
|
@@ -821,6 +822,11 @@ static int h5_serdev_probe(struct serdev_device *serdev)
|
||||||
|
if (h5->vnd->acpi_gpio_map)
|
||||||
|
devm_acpi_dev_add_driver_gpios(dev,
|
||||||
|
h5->vnd->acpi_gpio_map);
|
||||||
|
+ } else {
|
||||||
|
+ h5->vnd = (const struct h5_vnd *)
|
||||||
|
+ of_device_get_match_data(&serdev->dev);
|
||||||
|
+ of_property_read_string(serdev->dev.of_node,
|
||||||
|
+ "firmware-postfix", &h5->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
h5->enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_LOW);
|
||||||
|
@@ -944,13 +950,27 @@ static const struct acpi_device_id h5_acpi_match[] = {
|
||||||
|
MODULE_DEVICE_TABLE(acpi, h5_acpi_match);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+static struct h5_vnd rtl8723_of_vnd = {
|
||||||
|
+ .setup = h5_btrtl_setup,
|
||||||
|
+ .open = h5_btrtl_open,
|
||||||
|
+ .close = h5_btrtl_close,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct of_device_id h5_of_match[] = {
|
||||||
|
+ { .compatible = "realtek,rtl8723bs-bt", .data = &rtl8723_of_vnd },
|
||||||
|
+ { .compatible = "realtek,rtl8723cs-bt", .data = &rtl8723_of_vnd },
|
||||||
|
+ { /* sentinel */ },
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(of, h5_of_match);
|
||||||
|
+
|
||||||
|
static struct serdev_device_driver h5_serdev_driver = {
|
||||||
|
.probe = h5_serdev_probe,
|
||||||
|
.remove = h5_serdev_remove,
|
||||||
|
.driver = {
|
||||||
|
.name = "hci_uart_h5",
|
||||||
|
.acpi_match_table = ACPI_PTR(h5_acpi_match),
|
||||||
|
.pm = &h5_serdev_pm_ops,
|
||||||
|
+ .of_match_table = of_match_ptr(h5_of_match),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,311 @@
|
||||||
|
From 08c47cbb508e40e5e404055f77653474d5793e27 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 20:33:22 -0700
|
||||||
|
Subject: [PATCH 143/146] Bluetooth: btrtl: add support for the RTL8723CS
|
||||||
|
|
||||||
|
The Realtek RTL8723CS is SDIO WiFi chip. It also contains a Bluetooth
|
||||||
|
module which is connected via UART to the host.
|
||||||
|
|
||||||
|
It shares lmp subversion with 8703B, so Realtek's userspace
|
||||||
|
initialization tool (rtk_hciattach) differentiates varieties of RTL8723CS
|
||||||
|
(CG, VF, XX) with RTL8703B using vendor's command to read chip type.
|
||||||
|
|
||||||
|
Also this chip declares support for some features it doesn't support
|
||||||
|
so add a quirk to indicate that these features are broken.
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
drivers/bluetooth/btrtl.c | 128 ++++++++++++++++++++++++++++++++++++-
|
||||||
|
drivers/bluetooth/btrtl.h | 12 ++++
|
||||||
|
drivers/bluetooth/hci_h5.c | 4 ++
|
||||||
|
3 files changed, 141 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
|
||||||
|
index 7f9ea8e4c1b2..f9474e78bcfa 100644
|
||||||
|
--- a/drivers/bluetooth/btrtl.c
|
||||||
|
+++ b/drivers/bluetooth/btrtl.c
|
||||||
|
@@ -27,8 +27,12 @@
|
||||||
|
|
||||||
|
#define VERSION "0.1"
|
||||||
|
|
||||||
|
+#define RTL_CHIP_8723CS_CG 3
|
||||||
|
+#define RTL_CHIP_8723CS_VF 4
|
||||||
|
+#define RTL_CHIP_8723CS_XX 5
|
||||||
|
#define RTL_EPATCH_SIGNATURE "Realtech"
|
||||||
|
#define RTL_ROM_LMP_3499 0x3499
|
||||||
|
+#define RTL_ROM_LMP_8703B 0x8703
|
||||||
|
#define RTL_ROM_LMP_8723A 0x1200
|
||||||
|
#define RTL_ROM_LMP_8723B 0x8723
|
||||||
|
#define RTL_ROM_LMP_8821A 0x8821
|
||||||
|
@@ -40,6 +44,7 @@
|
||||||
|
#define IC_MATCH_FL_HCIREV (1 << 1)
|
||||||
|
#define IC_MATCH_FL_HCIVER (1 << 2)
|
||||||
|
#define IC_MATCH_FL_HCIBUS (1 << 3)
|
||||||
|
+#define IC_MATCH_FL_CHIP_TYPE (1 << 4)
|
||||||
|
#define IC_INFO(lmps, hcir) \
|
||||||
|
.match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV, \
|
||||||
|
.lmp_subver = (lmps), \
|
||||||
|
@@ -51,6 +56,7 @@ struct id_table {
|
||||||
|
__u16 hci_rev;
|
||||||
|
__u8 hci_ver;
|
||||||
|
__u8 hci_bus;
|
||||||
|
+ __u8 chip_type;
|
||||||
|
bool config_needed;
|
||||||
|
bool has_rom_version;
|
||||||
|
char *fw_name;
|
||||||
|
@@ -98,6 +104,39 @@ static const struct id_table ic_id_table[] = {
|
||||||
|
.fw_name = "rtl_bt/rtl8723b_fw.bin",
|
||||||
|
.cfg_name = "rtl_bt/rtl8723b_config" },
|
||||||
|
|
||||||
|
+ /* 8723CS-CG */
|
||||||
|
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
|
||||||
|
+ IC_MATCH_FL_HCIBUS,
|
||||||
|
+ .lmp_subver = RTL_ROM_LMP_8703B,
|
||||||
|
+ .chip_type = RTL_CHIP_8723CS_CG,
|
||||||
|
+ .hci_bus = HCI_UART,
|
||||||
|
+ .config_needed = true,
|
||||||
|
+ .has_rom_version = true,
|
||||||
|
+ .fw_name = "rtl_bt/rtl8723cs_cg_fw.bin",
|
||||||
|
+ .cfg_name = "rtl_bt/rtl8723cs_cg_config" },
|
||||||
|
+
|
||||||
|
+ /* 8723CS-VF */
|
||||||
|
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
|
||||||
|
+ IC_MATCH_FL_HCIBUS,
|
||||||
|
+ .lmp_subver = RTL_ROM_LMP_8703B,
|
||||||
|
+ .chip_type = RTL_CHIP_8723CS_VF,
|
||||||
|
+ .hci_bus = HCI_UART,
|
||||||
|
+ .config_needed = true,
|
||||||
|
+ .has_rom_version = true,
|
||||||
|
+ .fw_name = "rtl_bt/rtl8723cs_vf_fw.bin",
|
||||||
|
+ .cfg_name = "rtl_bt/rtl8723cs_vf_config" },
|
||||||
|
+
|
||||||
|
+ /* 8723CS-XX */
|
||||||
|
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
|
||||||
|
+ IC_MATCH_FL_HCIBUS,
|
||||||
|
+ .lmp_subver = RTL_ROM_LMP_8703B,
|
||||||
|
+ .chip_type = RTL_CHIP_8723CS_XX,
|
||||||
|
+ .hci_bus = HCI_UART,
|
||||||
|
+ .config_needed = true,
|
||||||
|
+ .has_rom_version = true,
|
||||||
|
+ .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
|
||||||
|
+ .cfg_name = "rtl_bt/rtl8723cs_xx_config" },
|
||||||
|
+
|
||||||
|
/* 8723D */
|
||||||
|
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd),
|
||||||
|
.config_needed = true,
|
||||||
|
@@ -147,7 +186,8 @@ static const struct id_table ic_id_table[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
|
||||||
|
- u8 hci_ver, u8 hci_bus)
|
||||||
|
+ u8 hci_ver, u8 hci_bus,
|
||||||
|
+ u8 chip_type)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
@@ -164,6 +204,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
|
||||||
|
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) &&
|
||||||
|
(ic_id_table[i].hci_bus != hci_bus))
|
||||||
|
continue;
|
||||||
|
+ if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) &&
|
||||||
|
+ (ic_id_table[i].chip_type != chip_type))
|
||||||
|
+ continue;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -225,6 +268,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
|
||||||
|
{ RTL_ROM_LMP_8723B, 1 },
|
||||||
|
{ RTL_ROM_LMP_8821A, 2 },
|
||||||
|
{ RTL_ROM_LMP_8761A, 3 },
|
||||||
|
+ { RTL_ROM_LMP_8703B, 7 },
|
||||||
|
{ RTL_ROM_LMP_8822B, 8 },
|
||||||
|
{ RTL_ROM_LMP_8723B, 9 }, /* 8723D */
|
||||||
|
{ RTL_ROM_LMP_8821A, 10 }, /* 8821C */
|
||||||
|
@@ -499,6 +543,48 @@ static struct sk_buff *btrtl_read_local_version(struct hci_dev *hdev)
|
||||||
|
return skb;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool rtl_has_chip_type(u16 lmp_subver)
|
||||||
|
+{
|
||||||
|
+ switch (lmp_subver) {
|
||||||
|
+ case RTL_ROM_LMP_8703B:
|
||||||
|
+ return true;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type)
|
||||||
|
+{
|
||||||
|
+ struct rtl_chip_type_evt *chip_type;
|
||||||
|
+ struct sk_buff *skb;
|
||||||
|
+ const unsigned char cmd_buf[] = {0x00, 0x94, 0xa0, 0x00, 0xb0};
|
||||||
|
+
|
||||||
|
+ /* Read RTL chip type command */
|
||||||
|
+ skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT);
|
||||||
|
+ if (IS_ERR(skb)) {
|
||||||
|
+ rtl_dev_err(hdev, "Read chip type failed (%ld)",
|
||||||
|
+ PTR_ERR(skb));
|
||||||
|
+ return PTR_ERR(skb);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (skb->len != sizeof(*chip_type)) {
|
||||||
|
+ rtl_dev_err(hdev, "RTL chip type event length mismatch");
|
||||||
|
+ kfree_skb(skb);
|
||||||
|
+ return -EIO;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ chip_type = (struct rtl_chip_type_evt *)skb->data;
|
||||||
|
+ rtl_dev_info(hdev, "chip_type status=%x type=%x",
|
||||||
|
+ chip_type->status, chip_type->type);
|
||||||
|
+
|
||||||
|
+ *type = chip_type->type & 0x0f;
|
||||||
|
+
|
||||||
|
+ kfree_skb(skb);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void btrtl_free(struct btrtl_device_info *btrtl_dev)
|
||||||
|
{
|
||||||
|
kfree(btrtl_dev->fw_data);
|
||||||
|
@@ -515,7 +601,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||||
|
struct hci_rp_read_local_version *resp;
|
||||||
|
char cfg_name[40];
|
||||||
|
u16 hci_rev, lmp_subver;
|
||||||
|
- u8 hci_ver;
|
||||||
|
+ u8 hci_ver, chip_type = 0;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
btrtl_dev = kzalloc(sizeof(*btrtl_dev), GFP_KERNEL);
|
||||||
|
@@ -540,8 +626,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
|
||||||
|
lmp_subver = le16_to_cpu(resp->lmp_subver);
|
||||||
|
kfree_skb(skb);
|
||||||
|
|
||||||
|
+ if (rtl_has_chip_type(lmp_subver)) {
|
||||||
|
+ ret = rtl_read_chip_type(hdev, &chip_type);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto err_free;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
|
||||||
|
- hdev->bus);
|
||||||
|
+ hdev->bus, chip_type);
|
||||||
|
|
||||||
|
if (!btrtl_dev->ic_info) {
|
||||||
|
rtl_dev_err(hdev, "rtl: unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
|
||||||
|
@@ -610,6 +702,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,
|
||||||
|
case RTL_ROM_LMP_8821A:
|
||||||
|
case RTL_ROM_LMP_8761A:
|
||||||
|
case RTL_ROM_LMP_8822B:
|
||||||
|
+ case RTL_ROM_LMP_8703B:
|
||||||
|
return btrtl_setup_rtl8723b(hdev, btrtl_dev);
|
||||||
|
default:
|
||||||
|
rtl_dev_info(hdev, "rtl: assuming no firmware upload needed\n");
|
||||||
|
@@ -628,7 +721,12 @@ int btrtl_setup_realtek(struct hci_dev *hdev)
|
||||||
|
return PTR_ERR(btrtl_dev);
|
||||||
|
|
||||||
|
ret = btrtl_download_firmware(hdev, btrtl_dev);
|
||||||
|
+ if (ret)
|
||||||
|
+ goto out_free;
|
||||||
|
|
||||||
|
+ btrtl_apply_quirks(hdev, btrtl_dev);
|
||||||
|
+
|
||||||
|
+out_free:
|
||||||
|
btrtl_free(btrtl_dev);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
@@ -743,6 +841,24 @@ int btrtl_get_uart_settings(struct hci_dev *hdev,
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(btrtl_get_uart_settings);
|
||||||
|
|
||||||
|
+void btrtl_apply_quirks(struct hci_dev *hdev,
|
||||||
|
+ struct btrtl_device_info *btrtl_dev)
|
||||||
|
+{
|
||||||
|
+ switch (btrtl_dev->ic_info->lmp_subver) {
|
||||||
|
+ case RTL_ROM_LMP_8703B:
|
||||||
|
+ /* 8723CS reports two pages for local ext features,
|
||||||
|
+ * but it doesn't support any features from page 2 -
|
||||||
|
+ * it either responds with garbage or with error status
|
||||||
|
+ */
|
||||||
|
+ set_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
|
||||||
|
+ &hdev->quirks);
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+EXPORT_SYMBOL_GPL(btrtl_apply_quirks);
|
||||||
|
+
|
||||||
|
MODULE_AUTHOR("Daniel Drake <drake@endlessm.com>");
|
||||||
|
MODULE_DESCRIPTION("Bluetooth support for Realtek devices ver " VERSION);
|
||||||
|
MODULE_VERSION(VERSION);
|
||||||
|
@@ -752,6 +868,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
|
||||||
|
MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin");
|
||||||
|
MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin");
|
||||||
|
MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin");
|
||||||
|
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_fw.bin");
|
||||||
|
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_config.bin");
|
||||||
|
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_fw.bin");
|
||||||
|
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin");
|
||||||
|
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin");
|
||||||
|
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin");
|
||||||
|
MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin");
|
||||||
|
MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin");
|
||||||
|
MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin");
|
||||||
|
diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h
|
||||||
|
index f5e36f3993a8..db4e4a1542b7 100644
|
||||||
|
--- a/drivers/bluetooth/btrtl.h
|
||||||
|
+++ b/drivers/bluetooth/btrtl.h
|
||||||
|
@@ -24,6 +24,11 @@
|
||||||
|
|
||||||
|
struct btrtl_device_info;
|
||||||
|
|
||||||
|
+struct rtl_chip_type_evt {
|
||||||
|
+ __u8 status;
|
||||||
|
+ __u8 type;
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
struct rtl_download_cmd {
|
||||||
|
__u8 index;
|
||||||
|
__u8 data[RTL_FRAG_LEN];
|
||||||
|
@@ -69,6 +74,8 @@ int btrtl_get_uart_settings(struct hci_dev *hdev,
|
||||||
|
struct btrtl_device_info *btrtl_dev,
|
||||||
|
unsigned int *controller_baudrate,
|
||||||
|
u32 *device_baudrate, bool *flow_control);
|
||||||
|
+void btrtl_apply_quirks(struct hci_dev *hdev,
|
||||||
|
+ struct btrtl_device_info *btrtl_dev);
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
@@ -100,6 +107,11 @@ static inline int btrtl_get_uart_settings(struct hci_dev *hdev,
|
||||||
|
bool *flow_control)
|
||||||
|
{
|
||||||
|
return -ENOENT;
|
||||||
|
+
|
||||||
|
+static inline void btrtl_apply_quirks(struct hci_dev *hdev,
|
||||||
|
+ struct btrtl_device_info *btrtl_dev)
|
||||||
|
+{
|
||||||
|
+}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
|
||||||
|
index 9cc10e299fa8..7d72e092ce9d 100644
|
||||||
|
--- a/drivers/bluetooth/hci_h5.c
|
||||||
|
+++ b/drivers/bluetooth/hci_h5.c
|
||||||
|
@@ -892,6 +892,10 @@ static int h5_btrtl_setup(struct h5 *h5)
|
||||||
|
err = btrtl_download_firmware(h5->hu->hdev, btrtl_dev);
|
||||||
|
/* Give the device some time before the hci-core sends it a reset */
|
||||||
|
usleep_range(10000, 20000);
|
||||||
|
+ if (err)
|
||||||
|
+ goto out_free;
|
||||||
|
+
|
||||||
|
+ btrtl_apply_quirks(h5->hu->hdev, btrtl_dev);
|
||||||
|
|
||||||
|
out_free:
|
||||||
|
btrtl_free(btrtl_dev);
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
From 26b3d6f8ffa77cb05066c11967a498d6dacbdc42 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 20:43:26 -0700
|
||||||
|
Subject: [PATCH 144/146] arm64: allwinner: a64: enable Bluetooth On Pinebook
|
||||||
|
|
||||||
|
Pinebook has an RTL8723CS WiFi + BT chip, BT is connected to UART1
|
||||||
|
and uses PL4 as BT reset, PL5 as device wake GPIO, PL6 as host wake GPIO
|
||||||
|
the I2C controlling signals are connected to R_I2C bus.
|
||||||
|
|
||||||
|
Enable it in the device tree.
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
.../boot/dts/allwinner/sun50i-a64-pinebook.dts | 14 ++++++++++++++
|
||||||
|
1 file changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
index 0f788400ece0..c1e57597f76a 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||||
|
@@ -401,6 +401,20 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&uart1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ bluetooth {
|
||||||
|
+ compatible = "realtek,rtl8723cs-bt";
|
||||||
|
+ reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */
|
||||||
|
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_LOW>; /* PL5 */
|
||||||
|
+ host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
|
||||||
|
+ firmware-postfix = "pinebook";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&usb_otg {
|
||||||
|
dr_mode = "host";
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
From 7f24fdacc41a34b5d1a39ae81f4f39660a5b72ca Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 20:45:16 -0700
|
||||||
|
Subject: [PATCH 145/146] arm64: allwinner: a64: enable Bluetooth On Pine64
|
||||||
|
|
||||||
|
Pine64 has optional RTL8723BS WiFi + BT module, BT is connected to UART1
|
||||||
|
and uses PL4 as BT reset, PL5 as device wake GPIO, PL6 as host wake GPIO
|
||||||
|
the I2C controlling signals are connected to R_I2C bus.
|
||||||
|
|
||||||
|
Enable it in the device tree.
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 10 +++++++++-
|
||||||
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
index f6fc0ed2f4ec..8e55e81c3236 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||||
|
@@ -333,7 +333,15 @@
|
||||||
|
&uart1 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||||
|
- status = "disabled";
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ bluetooth {
|
||||||
|
+ compatible = "realtek,rtl8723bs-bt";
|
||||||
|
+ reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */
|
||||||
|
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
|
||||||
|
+ host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
|
||||||
|
+ firmware-postfix = "pine64";
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
/* On Pi-2 connector */
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
From b325cd227f2426f938a08168b5c1b40111562e9e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
Date: Wed, 31 Oct 2018 20:50:09 -0700
|
||||||
|
Subject: [PATCH 146/146] arm64: allwinner: a64: enable Bluetooth On SoPine
|
||||||
|
baseboard
|
||||||
|
|
||||||
|
SoPine has optional RTL8723BS WiFi + BT module, BT is connected to UART1
|
||||||
|
and uses PL4 as BT reset, PL5 as device wake GPIO, PL6 as host wake GPIO
|
||||||
|
the I2C controlling signals are connected to R_I2C bus.
|
||||||
|
|
||||||
|
Enable it in the device tree.
|
||||||
|
|
||||||
|
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||||
|
---
|
||||||
|
.../dts/allwinner/sun50i-a64-sopine-baseboard.dts | 14 ++++++++++++++
|
||||||
|
1 file changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
index 9010bd58af1b..590a77769cde 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine-baseboard.dts
|
||||||
|
@@ -230,6 +230,20 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&uart1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ bluetooth {
|
||||||
|
+ compatible = "realtek,rtl8723bs-bt";
|
||||||
|
+ reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */
|
||||||
|
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
|
||||||
|
+ host-wake-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
|
||||||
|
+ firmware-postfix = "pine64";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&usb_otg {
|
||||||
|
dr_mode = "host";
|
||||||
|
status = "okay";
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
28
patch/kernel/sunxi-dev/0147-si2168-fix-cmd-timeout.patch
Normal file
28
patch/kernel/sunxi-dev/0147-si2168-fix-cmd-timeout.patch
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
From 2e01cc074cc426da4b390af025a736eda9aef80c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Koumes <koumes@centrum.cz>
|
||||||
|
Date: Sat, 1 Jun 2019 21:20:26 +0000
|
||||||
|
Subject: [PATCH] si2168: fix cmd timeout
|
||||||
|
|
||||||
|
Some demuxer si2168 commands may take 130-140 ms.
|
||||||
|
(DVB-T/T2 tuner MyGica T230C v2).
|
||||||
|
Details: https://github.com/CoreELEC/CoreELEC/pull/208
|
||||||
|
---
|
||||||
|
drivers/media/dvb-frontends/si2168.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c
|
||||||
|
index b05e6772c..ffaba6f81 100644
|
||||||
|
--- a/drivers/media/dvb-frontends/si2168.c
|
||||||
|
+++ b/drivers/media/dvb-frontends/si2168.c
|
||||||
|
@@ -42,7 +42,7 @@ static int si2168_cmd_execute(struct i2c_client *client, struct si2168_cmd *cmd)
|
||||||
|
|
||||||
|
if (cmd->rlen) {
|
||||||
|
/* wait cmd execution terminate */
|
||||||
|
- #define TIMEOUT 70
|
||||||
|
+ #define TIMEOUT 200
|
||||||
|
timeout = jiffies + msecs_to_jiffies(TIMEOUT);
|
||||||
|
while (!time_after(jiffies, timeout)) {
|
||||||
|
ret = i2c_master_recv(client, cmd->args, cmd->rlen);
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
5005
patch/kernel/sunxi-dev/5000-patch-4.19.9-10.patch.disabled
Normal file
5005
patch/kernel/sunxi-dev/5000-patch-4.19.9-10.patch.disabled
Normal file
File diff suppressed because it is too large
Load diff
1600
patch/kernel/sunxi-dev/5001-patch-4.19.10-11.patch.disabled
Normal file
1600
patch/kernel/sunxi-dev/5001-patch-4.19.10-11.patch.disabled
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,90 @@
|
||||||
|
While doing some brcmfmac driver work I needed to test this also on some
|
||||||
|
devicetree based boards. So I fired up the good old Cubietruck and when
|
||||||
|
that would not work a Banana Pro.
|
||||||
|
|
||||||
|
With an unmodified 4.17 kernel both boards intermittently would come up
|
||||||
|
with non working wifi with the following errors:
|
||||||
|
|
||||||
|
brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
|
||||||
|
brcmfmac: brcmf_bus_started: failed: -110
|
||||||
|
brcmfmac: brcmf_attach: dongle is not responding: err=-110
|
||||||
|
brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
|
||||||
|
|
||||||
|
They would come up this way more often then with actual working wifi,
|
||||||
|
once this problem happens it seems to require a power-cycle to fix.
|
||||||
|
Once things work one can safely reboot without hitting the issue.
|
||||||
|
|
||||||
|
I've found that disabling OOB interrupts fixes this. This really is more
|
||||||
|
of a workaround then a proper fix, but it makes the wifi reliable again
|
||||||
|
and it does not have much of a downside.
|
||||||
|
|
||||||
|
Using an OOB IRQ instead of the sdio-IRQ mechanism is mostly important to
|
||||||
|
allow the MMC controller to go into runtime-suspend which is not really an
|
||||||
|
issue on these boards since they are (usually) not battery powered.
|
||||||
|
|
||||||
|
I've looked at recent brcmfmac and mmc-core changes which may explain this
|
||||||
|
and I've not found anything. So the most likely culprit is the A20 external
|
||||||
|
interrupt handling e.g. perhaps it is set to edge instead of level? Either
|
||||||
|
way I do not have time to further investigate this.
|
||||||
|
|
||||||
|
BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908438
|
||||||
|
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
||||||
|
---
|
||||||
|
arch/arm/boot/dts/sun7i-a20-bananapro.dts | 16 +++++++++++++---
|
||||||
|
arch/arm/boot/dts/sun7i-a20-cubietruck.dts | 16 +++++++++++++---
|
||||||
|
2 files changed, 26 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun7i-a20-bananapro.dts b/arch/arm/boot/dts/sun7i-a20-bananapro.dts
|
||||||
|
index 0898eb6162f5..0e1ddd998b20 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun7i-a20-bananapro.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun7i-a20-bananapro.dts
|
||||||
|
@@ -174,9 +174,19 @@
|
||||||
|
brcmf: wifi@1 {
|
||||||
|
reg = <1>;
|
||||||
|
compatible = "brcm,bcm4329-fmac";
|
||||||
|
- interrupt-parent = <&pio>;
|
||||||
|
- interrupts = <7 15 IRQ_TYPE_LEVEL_LOW>;
|
||||||
|
- interrupt-names = "host-wake";
|
||||||
|
+ /*
|
||||||
|
+ * OOB interrupt support is broken ATM, often the first irq
|
||||||
|
+ * does not get seen resulting in the drv probe failing with:
|
||||||
|
+ *
|
||||||
|
+ * brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
|
||||||
|
+ * brcmfmac: brcmf_bus_started: failed: -110
|
||||||
|
+ * brcmfmac: brcmf_attach: dongle is not responding: err=-110
|
||||||
|
+ * brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
|
||||||
|
+ *
|
||||||
|
+ * interrupt-parent = <&pio>;
|
||||||
|
+ * interrupts = <7 15 IRQ_TYPE_LEVEL_LOW>;
|
||||||
|
+ * interrupt-names = "host-wake";
|
||||||
|
+ */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
index 5649161de1d7..a837516db6f9 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
@@ -222,9 +222,19 @@
|
||||||
|
brcmf: wifi@1 {
|
||||||
|
reg = <1>;
|
||||||
|
compatible = "brcm,bcm4329-fmac";
|
||||||
|
- interrupt-parent = <&pio>;
|
||||||
|
- interrupts = <7 10 IRQ_TYPE_LEVEL_LOW>; /* PH10 / EINT10 */
|
||||||
|
- interrupt-names = "host-wake";
|
||||||
|
+ /*
|
||||||
|
+ * OOB interrupt support is broken ATM, often the first irq
|
||||||
|
+ * does not get seen resulting in the drv probe failing with:
|
||||||
|
+ *
|
||||||
|
+ * brcmfmac: brcmf_sdio_bus_rxctl: resumed on timeout
|
||||||
|
+ * brcmfmac: brcmf_bus_started: failed: -110
|
||||||
|
+ * brcmfmac: brcmf_attach: dongle is not responding: err=-110
|
||||||
|
+ * brcmfmac: brcmf_sdio_firmware_callback: brcmf_attach failed
|
||||||
|
+ *
|
||||||
|
+ * interrupt-parent = <&pio>;
|
||||||
|
+ * interrupts = <7 10 IRQ_TYPE_LEVEL_LOW>;
|
||||||
|
+ * interrupt-names = "host-wake";
|
||||||
|
+ */
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
Reverts Bluetooth: Make BT_HCIUART_RTL configuration option depend on ACPI
|
||||||
|
|
||||||
|
https://github.com/anarsoul/linux-2.6/commit/51474eff2bc2777061ab3658e014a37dc9d7a775
|
||||||
|
|
||||||
|
otherwise it breaks the compilation
|
||||||
|
|
||||||
|
diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig
|
||||||
|
index 845b0314c..2df11cc08 100644
|
||||||
|
--- a/drivers/bluetooth/Kconfig
|
||||||
|
+++ b/drivers/bluetooth/Kconfig
|
||||||
|
@@ -200,7 +200,6 @@ config BT_HCIUART_RTL
|
||||||
|
depends on BT_HCIUART
|
||||||
|
depends on BT_HCIUART_SERDEV
|
||||||
|
depends on GPIOLIB
|
||||||
|
- depends on ACPI
|
||||||
|
select BT_HCIUART_3WIRE
|
||||||
|
select BT_RTL
|
||||||
|
help
|
18
patch/kernel/sunxi-dev/add-BergMicro-SPI-flashes.patch
Normal file
18
patch/kernel/sunxi-dev/add-BergMicro-SPI-flashes.patch
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
|
||||||
|
index 1413828..efc9bfd 100644
|
||||||
|
--- a/drivers/mtd/spi-nor/spi-nor.c
|
||||||
|
+++ b/drivers/mtd/spi-nor/spi-nor.c
|
||||||
|
@@ -935,6 +935,13 @@ static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
|
||||||
|
|
||||||
|
{ "at45db081d", INFO(0x1f2500, 0, 64 * 1024, 16, SECT_4K) },
|
||||||
|
|
||||||
|
+ /* BergMicro Flashes */
|
||||||
|
+ { "bg25q80", INFO(0xe04014, 0, 64 * 1024, 16, SECT_4K) },
|
||||||
|
+ { "bg25q16", INFO(0xe04015, 0, 64 * 1024, 32, SECT_4K) },
|
||||||
|
+ { "bg25q32", INFO(0xe04016, 0, 64 * 1024, 64, SECT_4K) },
|
||||||
|
+ { "bg25q64", INFO(0xe04017, 0, 64 * 1024, 128, SECT_4K) },
|
||||||
|
+ { "bg25q128", INFO(0xe04018, 0, 64 * 1024, 256, SECT_4K) },
|
||||||
|
+
|
||||||
|
/* EON -- en25xxx */
|
||||||
|
{ "en25f32", INFO(0x1c3116, 0, 64 * 1024, 64, SECT_4K) },
|
||||||
|
{ "en25p32", INFO(0x1c2016, 0, 64 * 1024, 64, 0) },
|
26
patch/kernel/sunxi-dev/add-h5-emmc-compatible.patch
Normal file
26
patch/kernel/sunxi-dev/add-h5-emmc-compatible.patch
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
|
||||||
|
index bba98d8..6087fdb 100644
|
||||||
|
--- a/drivers/mmc/host/sunxi-mmc.c
|
||||||
|
+++ b/drivers/mmc/host/sunxi-mmc.c
|
||||||
|
@@ -1180,6 +1180,13 @@ static const struct sunxi_mmc_cfg sun50i_a64_emmc_cfg = {
|
||||||
|
.needs_new_timings = true,
|
||||||
|
};
|
||||||
|
|
||||||
|
+static const struct sunxi_mmc_cfg sun50i_h5_emmc_cfg = {
|
||||||
|
+ .idma_des_size_bits = 13,
|
||||||
|
+ .clk_delays = NULL,
|
||||||
|
+ .can_calibrate = true,
|
||||||
|
+ .needs_new_timings = false,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static const struct of_device_id sunxi_mmc_of_match[] = {
|
||||||
|
{ .compatible = "allwinner,sun4i-a10-mmc", .data = &sun4i_a10_cfg },
|
||||||
|
{ .compatible = "allwinner,sun5i-a13-mmc", .data = &sun5i_a13_cfg },
|
||||||
|
@@ -1188,6 +1195,7 @@ static const struct of_device_id sunxi_mmc_of_match[] = {
|
||||||
|
{ .compatible = "allwinner,sun9i-a80-mmc", .data = &sun9i_a80_cfg },
|
||||||
|
{ .compatible = "allwinner,sun50i-a64-mmc", .data = &sun50i_a64_cfg },
|
||||||
|
{ .compatible = "allwinner,sun50i-a64-emmc", .data = &sun50i_a64_emmc_cfg },
|
||||||
|
+ { .compatible = "allwinner,sun50i-h5-emmc", .data = &sun50i_h5_emmc_cfg },
|
||||||
|
{ /* sentinel */ }
|
||||||
|
};
|
||||||
|
MODULE_DEVICE_TABLE(of, sunxi_mmc_of_match);
|
48
patch/kernel/sunxi-dev/add-nanopi-npi-stuff.patch
Normal file
48
patch/kernel/sunxi-dev/add-nanopi-npi-stuff.patch
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi b/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi
|
||||||
|
index 4df29a6..cf59d3f 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi
|
||||||
|
@@ -59,6 +63,8 @@
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&leds_npi>, <&leds_r_npi>;
|
||||||
|
|
||||||
|
status {
|
||||||
|
label = "nanopi:blue:status";
|
||||||
|
@@ -76,6 +82,8 @@
|
||||||
|
r_gpio_keys {
|
||||||
|
compatible = "gpio-keys";
|
||||||
|
input-name = "k1";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&sw_r_npi>;
|
||||||
|
|
||||||
|
k1 {
|
||||||
|
label = "k1";
|
||||||
|
@@ -100,6 +136,25 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&pio {
|
||||||
|
+ leds_npi: led_pins {
|
||||||
|
+ pins = "PA10";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&r_pio {
|
||||||
|
+ leds_r_npi: led_pins {
|
||||||
|
+ pins = "PL10";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ sw_r_npi: key_pins {
|
||||||
|
+ pins = "PL3";
|
||||||
|
+ function = "gpio_in";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&uart0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart0_pa_pins>;
|
123
patch/kernel/sunxi-dev/add-orangepi-zeroplus2.patch
Normal file
123
patch/kernel/sunxi-dev/add-orangepi-zeroplus2.patch
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
|
||||||
|
index b8f46e2..24cb8b9 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-zero-plus2.dts
|
||||||
|
@@ -53,12 +53,29 @@
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
serial0 = &uart0;
|
||||||
|
+ ethernet1 = &brcmf;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
stdout-path = "serial0:115200n8";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ pwr_led {
|
||||||
|
+ label = "orangepi:green:pwr";
|
||||||
|
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ default-state = "on";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ status_led {
|
||||||
|
+ label = "orangepi:red:status";
|
||||||
|
+ gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ linux,default-trigger = "heartbeat";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
connector {
|
||||||
|
compatible = "hdmi-connector";
|
||||||
|
type = "a";
|
||||||
|
@@ -88,6 +105,11 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
&hdmi {
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
@@ -98,6 +120,22 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&sound_hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&i2s2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mixer0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&tcon0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mmc0 {
|
||||||
|
vmmc-supply = <®_vcc3v3>;
|
||||||
|
bus-width = <4>;
|
||||||
|
@@ -132,8 +170,53 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&pio {
|
||||||
|
+ bt_pwr_pin: bt_pwr_pin@0 {
|
||||||
|
+ pins = "PA10";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&spi0 {
|
||||||
|
+ /* Disable SPI NOR by default: it optional on Orange Pi Zero boards */
|
||||||
|
+ status = "disabled";
|
||||||
|
+
|
||||||
|
+ flash@0 {
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+ compatible = "mxicy,mx25l1606e", "winbond,w25q128";
|
||||||
|
+ reg = <0>;
|
||||||
|
+ spi-max-frequency = <40000000>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&uart0 {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&uart0_pa_pins>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+&uart1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "peripheral";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /*
|
||||||
|
+ * USB Type-A port VBUS is always on. However, MicroUSB VBUS can only
|
||||||
|
+ * power up the board; when it's used as OTG port, this VBUS is
|
||||||
|
+ * always off even if the board is powered via GPIO pins.
|
||||||
|
+ */
|
||||||
|
+ status = "okay";
|
||||||
|
+ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
|
||||||
|
+};
|
|
@ -0,0 +1,80 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
|
||||||
|
index 26075b9a76e3..a1c2f06ed474 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
|
||||||
|
@@ -77,6 +77,17 @@
|
||||||
|
regulator-max-microvolt = <3300000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
+ reg_usb1_vbus: usb1-vbus {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "usb1-vbus";
|
||||||
|
+ regulator-min-microvolt = <5000000>;
|
||||||
|
+ regulator-max-microvolt = <5000000>;
|
||||||
|
+ regulator-boot-on;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&pio 6 9 GPIO_ACTIVE_HIGH>; /* PG9 */
|
||||||
|
+ status = "okay";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
wifi_pwrseq: wifi_pwrseq {
|
||||||
|
compatible = "mmc-pwrseq-simple";
|
||||||
|
reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
|
||||||
|
@@ -98,6 +109,14 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&emac {
|
||||||
|
pinctrl-names = "default";
|
||||||
|
pinctrl-0 = <&rgmii_pins>;
|
||||||
|
@@ -109,6 +128,14 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&r_rsb {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
@@ -201,6 +229,11 @@
|
||||||
|
regulator-name = "vcc-wifi-io";
|
||||||
|
};
|
||||||
|
|
||||||
|
+®_drivevbus {
|
||||||
|
+ regulator-name = "usb0-vbus";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
®_eldo1 {
|
||||||
|
regulator-min-microvolt = <1800000>;
|
||||||
|
regulator-max-microvolt = <1800000>;
|
||||||
|
@@ -244,3 +277,15 @@
|
||||||
|
pinctrl-0 = <&uart0_pins_a>;
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "otg";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ status = "okay";
|
||||||
|
+ usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
|
||||||
|
+ usb0_vbus-supply = <®_drivevbus>;
|
||||||
|
+ usb1_vbus-supply = <®_usb1_vbus>;
|
||||||
|
+};
|
|
@ -0,0 +1,41 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||||
|
index 1eba1324e5b9..5e3dc2666d0f 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||||
|
@@ -58,6 +58,11 @@
|
||||||
|
chosen {
|
||||||
|
stdout-path = "serial0:115200n8";
|
||||||
|
};
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
|
||||||
|
+ };
|
||||||
|
};
|
||||||
|
|
||||||
|
&ehci0 {
|
||||||
|
@@ -105,6 +110,24 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&mmc1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc1_pins>;
|
||||||
|
+ vmmc-supply = <®_dcdc1>;
|
||||||
|
+ vqmmc-supply = <®_dldo4>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ non-removable;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ rtl8189etv: wifi@1 {
|
||||||
|
+ reg = <1>;
|
||||||
|
+ interrupt-parent = <&r_pio>;
|
||||||
|
+ interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
|
||||||
|
+ interrupt-names = "host-wake";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ohci0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
|
@ -0,0 +1,20 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||||
|
index 5e3dc2666d0f..feb8c7e51623 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||||
|
@@ -59,6 +59,15 @@
|
||||||
|
stdout-path = "serial0:115200n8";
|
||||||
|
};
|
||||||
|
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ blue {
|
||||||
|
+ label = "nanopi-a64:blue:status";
|
||||||
|
+ gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
wifi_pwrseq: wifi_pwrseq {
|
||||||
|
compatible = "mmc-pwrseq-simple";
|
||||||
|
reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
|
|
@ -0,0 +1,16 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
|
||||||
|
index 3b579d7567c8..ea23ff821166 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-a83t-bananapi-m3.dts
|
||||||
|
@@ -183,6 +183,11 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&r_cir {
|
||||||
|
+ clock-frequency = <3000000>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&r_rsb {
|
||||||
|
status = "okay";
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
|
||||||
|
index 710e2ef..ffe7625 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts
|
||||||
|
@@ -73,7 +73,7 @@
|
||||||
|
green {
|
||||||
|
label = "cubieboard:green:usr";
|
||||||
|
gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>; /* LED2 */
|
||||||
|
- linux,default-trigger = "heartbeat";
|
||||||
|
+ linux,default-trigger = "mmc0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
index 8da939a..934655f 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
@@ -85,6 +85,7 @@
|
||||||
|
green {
|
||||||
|
label = "cubietruck:green:usr";
|
||||||
|
gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ linux,default-trigger = "mmc0";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
25
patch/kernel/sunxi-dev/board-cubietruck-enable-uart2.patch
Normal file
25
patch/kernel/sunxi-dev/board-cubietruck-enable-uart2.patch
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
index 8da939a..42fd205 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun7i-a20-cubietruck.dts
|
||||||
|
@@ -56,6 +56,7 @@
|
||||||
|
|
||||||
|
aliases {
|
||||||
|
serial0 = &uart0;
|
||||||
|
+ serial2 = &uart2;
|
||||||
|
};
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
@@ -307,6 +308,12 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&uart2 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart2_cts_rts_pi_pins>, <&uart2_pi_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&usb_otg {
|
||||||
|
dr_mode = "otg";
|
||||||
|
status = "okay";
|
|
@ -0,0 +1,50 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
|
||||||
|
index 88decb07..e3292916 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts
|
||||||
|
@@ -60,6 +60,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";
|
||||||
|
|
||||||
|
@@ -145,6 +155,10 @@
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
+&de {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci0 {
|
||||||
|
/* GL830 USB-to-SATA bridge here */
|
||||||
|
status = "okay";
|
||||||
|
@@ -164,6 +178,16 @@
|
||||||
|
status = "okay";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi_out {
|
||||||
|
+ hdmi_out_con: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_con_in>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&mdio {
|
||||||
|
rgmii_phy: ethernet-phy@1 {
|
||||||
|
compatible = "ethernet-phy-ieee802.3-c22";
|
182
patch/kernel/sunxi-dev/board-h2plus-nanopi-duo-add-device.patch
Normal file
182
patch/kernel/sunxi-dev/board-h2plus-nanopi-duo-add-device.patch
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||||
|
index 99cf49a..977b6ff 100644
|
||||||
|
--- a/arch/arm/boot/dts/Makefile
|
||||||
|
+++ b/arch/arm/boot/dts/Makefile
|
||||||
|
@@ -1030,6 +1030,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
|
||||||
|
sun8i-a83t-tbs-a711.dtb \
|
||||||
|
sun8i-h2-plus-bananapi-m2-zero.dtb \
|
||||||
|
sun8i-h2-plus-libretech-all-h3-cc.dtb \
|
||||||
|
+ sun8i-h2-plus-nanopi-duo.dtb \
|
||||||
|
sun8i-h2-plus-orangepi-r1.dtb \
|
||||||
|
sun8i-h2-plus-orangepi-zero.dtb \
|
||||||
|
sun8i-h2-plus-sunvell-r69.dtb \
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h2-plus-nanopi-duo.dts b/arch/arm/boot/dts/sun8i-h2-plus-nanopi-duo.dts
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..2b31b8f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h2-plus-nanopi-duo.dts
|
||||||
|
@@ -0,0 +1,164 @@
|
||||||
|
+/*
|
||||||
|
+ * adapted by karabek, 2018 , based on
|
||||||
|
+ * Copyright (C) 2016 James Pettigrew <james@innovum.com.au>
|
||||||
|
+ * Copyright (C) 2016 Milo Kim <woogyom.kim@gmail.com>
|
||||||
|
+ *
|
||||||
|
+ *
|
||||||
|
+ * This file is dual-licensed: you can use it either under the terms
|
||||||
|
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||||
|
+ * licensing only applies to this file, and not this project as a
|
||||||
|
+ * whole.
|
||||||
|
+ *
|
||||||
|
+ * a) This file is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This file 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.
|
||||||
|
+ *
|
||||||
|
+ * Or, alternatively,
|
||||||
|
+ *
|
||||||
|
+ * b) Permission is hereby granted, free of charge, to any person
|
||||||
|
+ * obtaining a copy of this software and associated documentation
|
||||||
|
+ * files (the "Software"), to deal in the Software without
|
||||||
|
+ * restriction, including without limitation the rights to use,
|
||||||
|
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
+ * sell copies of the Software, and to permit persons to whom the
|
||||||
|
+ * Software is furnished to do so, subject to the following
|
||||||
|
+ * conditions:
|
||||||
|
+ *
|
||||||
|
+ * The above copyright notice and this permission notice shall be
|
||||||
|
+ * included in all copies or substantial portions of the Software.
|
||||||
|
+ *
|
||||||
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/dts-v1/;
|
||||||
|
+#include "sun8i-h3-nanopi.dtsi"
|
||||||
|
+#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||||
|
+
|
||||||
|
+/ {
|
||||||
|
+ model = "FriendlyARM NanoPi DUO";
|
||||||
|
+ compatible = "friendlyarm,nanopi-duo", "allwinner,sun8i-h3";
|
||||||
|
+
|
||||||
|
+ aliases {
|
||||||
|
+ ethernet0 = &emac;
|
||||||
|
+ ethernet1 = &xr819;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_sy8113b: gpio-regulator {
|
||||||
|
+ compatible = "regulator-gpio";
|
||||||
|
+ regulator-name = "vdd-cpux";
|
||||||
|
+ regulator-type = "voltage";
|
||||||
|
+ regulator-boot-on;
|
||||||
|
+ regulator-always-on;
|
||||||
|
+ regulator-min-microvolt = <1100000>;
|
||||||
|
+ regulator-max-microvolt = <1300000>;
|
||||||
|
+ regulator-ramp-delay = <50>; // 50=4ms check
|
||||||
|
+
|
||||||
|
+ gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; // PL6 check
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpios-states = <0x1>;
|
||||||
|
+ states = <1100000 0x0
|
||||||
|
+ 1300000 0x1>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_vcc_wifi: reg_vcc_wifi {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-min-microvolt = <1800000>;
|
||||||
|
+ regulator-max-microvolt = <1800000>;
|
||||||
|
+ regulator-name = "vcc-wifi";
|
||||||
|
+ gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; // PL7 WIFI_POWER_EN
|
||||||
|
+ startup-delay-us = <70000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&wifi_en_npi>;
|
||||||
|
+ reset-gpios = <&pio 6 13 GPIO_ACTIVE_LOW>; // PG13 WL_RESTN
|
||||||
|
+ post-power-on-delay-ms = <200>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&cpu0 {
|
||||||
|
+ cpu-supply = <®_sy8113b>;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&emac {
|
||||||
|
+ phy-handle = <&int_mii_phy>;
|
||||||
|
+ phy-mode = "mii";
|
||||||
|
+ allwinner,leds-active-low;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc1_pins>;
|
||||||
|
+ vqmmc-supply = <®_vcc_wifi>;
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ non-removable;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ xr819: sdio_wifi@1 {
|
||||||
|
+ reg = <1>;
|
||||||
|
+ compatible = "xradio,xr819";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&wifi_wake>;
|
||||||
|
+ interrupt-parent = <&pio>;
|
||||||
|
+ interrupts = <6 10 IRQ_TYPE_EDGE_RISING>;
|
||||||
|
+ interrupt-names = "host-wake";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1_pins {
|
||||||
|
+ bias-pull-up;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&pio {
|
||||||
|
+ wifi_en_npi: wifi_en_pin {
|
||||||
|
+ pins = "PG13";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+ wifi_wake: wifi_wake@0 {
|
||||||
|
+ pins = "PG10";
|
||||||
|
+ function = "irq";
|
||||||
|
+ pull = <SUN4I_PINCTRL_NO_PULL>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "peripheral";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /*
|
||||||
|
+ * USB Type-A port VBUS is always on. However, MicroUSB VBUS can only
|
||||||
|
+ * power up the board; when it's used as OTG port, this VBUS is
|
||||||
|
+ * always off even if the board is powered via GPIO pins.
|
||||||
|
+ */
|
||||||
|
+ status = "okay";
|
||||||
|
+ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
|
||||||
|
+};
|
233
patch/kernel/sunxi-dev/board-h2plus-sunvell-r69-add-device.patch
Normal file
233
patch/kernel/sunxi-dev/board-h2plus-sunvell-r69-add-device.patch
Normal file
|
@ -0,0 +1,233 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
|
||||||
|
index e3d5a6c..0d3eef6 100644
|
||||||
|
--- a/arch/arm/boot/dts/Makefile
|
||||||
|
+++ b/arch/arm/boot/dts/Makefile
|
||||||
|
@@ -995,6 +995,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
|
||||||
|
sun8i-h2-plus-orangepi-r1.dtb \
|
||||||
|
sun8i-h2-plus-bananapi-m2-zero.dtb \
|
||||||
|
sun8i-h2-plus-orangepi-zero.dtb \
|
||||||
|
+ sun8i-h2-plus-sunvell-r69.dtb \
|
||||||
|
sun8i-h3-bananapi-m2-plus.dtb \
|
||||||
|
sun8i-h3-beelink-x2.dtb \
|
||||||
|
sun8i-h3-libretech-all-h3-cc.dtb \
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h2-plus-sunvell-r69.dts b/arch/arm/boot/dts/sun8i-h2-plus-sunvell-r69.dts
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1adfb0c
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h2-plus-sunvell-r69.dts
|
||||||
|
@@ -0,0 +1,215 @@
|
||||||
|
+/*
|
||||||
|
+ * Based original Sunvell R69 FEX file (2018 <github.com/karabek>)
|
||||||
|
+ *
|
||||||
|
+ * This file is dual-licensed: you can use it either under the terms
|
||||||
|
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||||
|
+ * licensing only applies to this file, and not this project as a
|
||||||
|
+ * whole.
|
||||||
|
+ *
|
||||||
|
+ * a) This file is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This file 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.
|
||||||
|
+ *
|
||||||
|
+ * Or, alternatively,
|
||||||
|
+ *
|
||||||
|
+ * b) Permission is hereby granted, free of charge, to any person
|
||||||
|
+ * obtaining a copy of this software and associated documentation
|
||||||
|
+ * files (the "Software"), to deal in the Software without
|
||||||
|
+ * restriction, including without limitation the rights to use,
|
||||||
|
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
+ * sell copies of the Software, and to permit persons to whom the
|
||||||
|
+ * Software is furnished to do so, subject to the following
|
||||||
|
+ * conditions:
|
||||||
|
+ *
|
||||||
|
+ * The above copyright notice and this permission notice shall be
|
||||||
|
+ * included in all copies or substantial portions of the Software.
|
||||||
|
+ *
|
||||||
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/dts-v1/;
|
||||||
|
+#include "sun8i-h3.dtsi"
|
||||||
|
+#include "sunxi-common-regulators.dtsi"
|
||||||
|
+
|
||||||
|
+#include <dt-bindings/gpio/gpio.h>
|
||||||
|
+#include <dt-bindings/input/input.h>
|
||||||
|
+#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||||
|
+
|
||||||
|
+/ {
|
||||||
|
+ model = "Sunvell R69";
|
||||||
|
+ compatible = "sunvell,sunvell-r69", "allwinner,sun8i-h2-plus";
|
||||||
|
+
|
||||||
|
+ aliases {
|
||||||
|
+ serial0 = &uart0;
|
||||||
|
+ ethernet0 = &emac;
|
||||||
|
+ ethernet1 = &xr819;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ chosen {
|
||||||
|
+ stdout-path = "serial0:115200n8";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ connector {
|
||||||
|
+ compatible = "hdmi-connector";
|
||||||
|
+ type = "a";
|
||||||
|
+
|
||||||
|
+ port {
|
||||||
|
+ hdmi_con_in: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_out_con>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ pwr_led {
|
||||||
|
+ label = "sunvell-r69:blue:pwr";
|
||||||
|
+ gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ linux,default-trigger = "heartbeat";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ status_led {
|
||||||
|
+ label = "sunvell-r69:red:status";
|
||||||
|
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_vcc_wifi: reg_vcc_wifi {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ regulator-name = "vcc-wifi";
|
||||||
|
+ gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ startup-delay-us = <70000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ reset-gpios = <&r_pio 0 0 GPIO_ACTIVE_LOW>;
|
||||||
|
+ post-power-on-delay-ms = <200>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&de {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&emac {
|
||||||
|
+ phy-handle = <&int_mii_phy>;
|
||||||
|
+ phy-mode = "mii";
|
||||||
|
+ allwinner,leds-active-low;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi_out {
|
||||||
|
+ hdmi_out_con: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_con_in>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ir {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&r_ir_rx_pin>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc0_pins>;
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ cd-inverted;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1_pins {
|
||||||
|
+ bias-pull-up;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ /* pinctrl-0 = <&mmc1_pins>; */
|
||||||
|
+ vmmc-supply = <®_vcc_wifi>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ non-removable;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Explicitly define the sdio device, so that we can add an ethernet
|
||||||
|
+ * alias for it (which e.g. makes u-boot set a mac-address).
|
||||||
|
+ */
|
||||||
|
+ xr819: sdio_wifi@1 {
|
||||||
|
+ reg = <1>;
|
||||||
|
+ compatible = "xradio,xr819";
|
||||||
|
+ interrupt-parent = <&pio>;
|
||||||
|
+ interrupts = <0 11 IRQ_TYPE_EDGE_RISING>;
|
||||||
|
+ interrupt-names = "host-wake";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc2 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc2_8bit_pins>;
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <8>;
|
||||||
|
+ non-removable;
|
||||||
|
+ cap-mmc-hw-reset;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&tcon0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart0_pa_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "host"; /* host -or- peripheral */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /* USB VBUS is always on */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
|
@ -0,0 +1,151 @@
|
||||||
|
From 8477a566b36aaae77e53a9949f963ce6ebad55fe Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ondrej Jirman <megous@megous.com>
|
||||||
|
Date: Thu, 12 Jan 2017 16:34:57 +0100
|
||||||
|
Subject: [PATCH] clk: sunxi-ng: Set maximum M = 1 for H3 pll-cpux clock
|
||||||
|
|
||||||
|
When using M factor greater than 1 system is experiencing
|
||||||
|
occasional lockups.
|
||||||
|
|
||||||
|
This change was verified to fix lockups with PLL stress
|
||||||
|
tester available at https://github.com/megous/h3-firmware.
|
||||||
|
|
||||||
|
Note that M factor must not be used outside the kernel
|
||||||
|
either, so for example u-boot needs a similar patch.
|
||||||
|
---
|
||||||
|
drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 24 +++++++++++++++---------
|
||||||
|
1 file changed, 15 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
|
||||||
|
index 77ed0b0ba6819..8d47742def49d 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
|
||||||
|
@@ -30,15 +30,21 @@
|
||||||
|
|
||||||
|
#include "ccu-sun8i-h3.h"
|
||||||
|
|
||||||
|
-static SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpux_clk, "pll-cpux",
|
||||||
|
- "osc24M", 0x000,
|
||||||
|
- 8, 5, /* N */
|
||||||
|
- 4, 2, /* K */
|
||||||
|
- 0, 2, /* M */
|
||||||
|
- 16, 2, /* P */
|
||||||
|
- BIT(31), /* gate */
|
||||||
|
- BIT(28), /* lock */
|
||||||
|
- CLK_SET_RATE_UNGATE);
|
||||||
|
+static struct ccu_nkmp pll_cpux_clk = {
|
||||||
|
+ .enable = BIT(31),
|
||||||
|
+ .lock = BIT(28),
|
||||||
|
+ .n = _SUNXI_CCU_MULT(8, 5),
|
||||||
|
+ .k = _SUNXI_CCU_MULT(4, 2),
|
||||||
|
+ .m = _SUNXI_CCU_DIV_MAX(0, 2, 1),
|
||||||
|
+ .p = _SUNXI_CCU_DIV(16, 2),
|
||||||
|
+ .common = {
|
||||||
|
+ .reg = 0x000,
|
||||||
|
+ .hw.init = CLK_HW_INIT("pll-cpux",
|
||||||
|
+ "osc24M",
|
||||||
|
+ &ccu_nkmp_ops,
|
||||||
|
+ CLK_SET_RATE_UNGATE),
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
|
||||||
|
From c313a0ac340bf1131d475527171764dc49901895 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ondrej Jirman <megous@megous.com>
|
||||||
|
Date: Wed, 5 Apr 2017 15:43:48 +0200
|
||||||
|
Subject: [PATCH] clk: sunxi-ng: Limit pll_cpux P factor for rates > 288MHz on
|
||||||
|
H3
|
||||||
|
|
||||||
|
Datasheet for H3 mandates that CPUX PLL must not use postdivider
|
||||||
|
(P factor must be 1) for clock rates above 288MHz.
|
||||||
|
|
||||||
|
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||||
|
---
|
||||||
|
drivers/clk/sunxi-ng/ccu-sun8i-h3.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
|
||||||
|
index 8d47742def49d..7cc9467f373f2 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-h3.c
|
||||||
|
@@ -37,6 +37,7 @@ static struct ccu_nkmp pll_cpux_clk = {
|
||||||
|
.k = _SUNXI_CCU_MULT(4, 2),
|
||||||
|
.m = _SUNXI_CCU_DIV_MAX(0, 2, 1),
|
||||||
|
.p = _SUNXI_CCU_DIV(16, 2),
|
||||||
|
+ .max_rate_for_p = 288000000,
|
||||||
|
.common = {
|
||||||
|
.reg = 0x000,
|
||||||
|
.hw.init = CLK_HW_INIT("pll-cpux",
|
||||||
|
From f07a20e4ce93e7e0f333f9f6e57f14fd4ab66abd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Ondrej Jirman <megous@megous.com>
|
||||||
|
Date: Thu, 12 Jan 2017 16:37:24 +0100
|
||||||
|
Subject: [PATCH] clk: sunxi-ng: Allow to limit the use of NKMP clock's P
|
||||||
|
factor
|
||||||
|
|
||||||
|
Some SoCs mandate the maximum clock rate for which the use
|
||||||
|
of postdivider P factor is allowed. Allow to configure maximum
|
||||||
|
clock rate.
|
||||||
|
|
||||||
|
Signed-off-by: Ondrej Jirman <megous@megous.com>
|
||||||
|
---
|
||||||
|
drivers/clk/sunxi-ng/ccu_nkmp.c | 13 ++++++++-----
|
||||||
|
drivers/clk/sunxi-ng/ccu_nkmp.h | 1 +
|
||||||
|
2 files changed, 9 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.c b/drivers/clk/sunxi-ng/ccu_nkmp.c
|
||||||
|
index ebd9436d2c7cd..96dbc543b2cbc 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu_nkmp.c
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu_nkmp.c
|
||||||
|
@@ -33,16 +33,19 @@ static unsigned long ccu_nkmp_calc_rate(unsigned long parent,
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ccu_nkmp_find_best(unsigned long parent, unsigned long rate,
|
||||||
|
- struct _ccu_nkmp *nkmp)
|
||||||
|
+ struct _ccu_nkmp *nkmp, struct ccu_nkmp *_nkmp)
|
||||||
|
{
|
||||||
|
unsigned long best_rate = 0;
|
||||||
|
unsigned long best_n = 0, best_k = 0, best_m = 0, best_p = 0;
|
||||||
|
- unsigned long _n, _k, _m, _p;
|
||||||
|
+ unsigned long _n, _k, _m, _p, _max_p;
|
||||||
|
+
|
||||||
|
+ _max_p = (_nkmp->max_rate_for_p == 0 || rate <= _nkmp->max_rate_for_p) ?
|
||||||
|
+ nkmp->max_p : nkmp->min_p;
|
||||||
|
|
||||||
|
for (_k = nkmp->min_k; _k <= nkmp->max_k; _k++) {
|
||||||
|
for (_n = nkmp->min_n; _n <= nkmp->max_n; _n++) {
|
||||||
|
for (_m = nkmp->min_m; _m <= nkmp->max_m; _m++) {
|
||||||
|
- for (_p = nkmp->min_p; _p <= nkmp->max_p; _p <<= 1) {
|
||||||
|
+ for (_p = nkmp->min_p; _p <= _max_p; _p <<= 1) {
|
||||||
|
unsigned long tmp_rate;
|
||||||
|
|
||||||
|
tmp_rate = ccu_nkmp_calc_rate(parent,
|
||||||
|
@@ -146,7 +149,7 @@ static long ccu_nkmp_round_rate(struct clk_hw *hw, unsigned long rate,
|
||||||
|
_nkmp.min_p = 1;
|
||||||
|
_nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1);
|
||||||
|
|
||||||
|
- ccu_nkmp_find_best(*parent_rate, rate, &_nkmp);
|
||||||
|
+ ccu_nkmp_find_best(*parent_rate, rate, &_nkmp, nkmp);
|
||||||
|
|
||||||
|
rate = ccu_nkmp_calc_rate(*parent_rate, _nkmp.n, _nkmp.k,
|
||||||
|
_nkmp.m, _nkmp.p);
|
||||||
|
@@ -177,7 +180,7 @@ static int ccu_nkmp_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||||
|
_nkmp.min_p = 1;
|
||||||
|
_nkmp.max_p = nkmp->p.max ?: 1 << ((1 << nkmp->p.width) - 1);
|
||||||
|
|
||||||
|
- ccu_nkmp_find_best(parent_rate, rate, &_nkmp);
|
||||||
|
+ ccu_nkmp_find_best(parent_rate, rate, &_nkmp, nkmp);
|
||||||
|
|
||||||
|
n_mask = GENMASK(nkmp->n.width + nkmp->n.shift - 1, nkmp->n.shift);
|
||||||
|
k_mask = GENMASK(nkmp->k.width + nkmp->k.shift - 1, nkmp->k.shift);
|
||||||
|
diff --git a/drivers/clk/sunxi-ng/ccu_nkmp.h b/drivers/clk/sunxi-ng/ccu_nkmp.h
|
||||||
|
index 6940503e7fc46..bbea3e5ed6fba 100644
|
||||||
|
--- a/drivers/clk/sunxi-ng/ccu_nkmp.h
|
||||||
|
+++ b/drivers/clk/sunxi-ng/ccu_nkmp.h
|
||||||
|
@@ -33,6 +33,7 @@ struct ccu_nkmp {
|
||||||
|
struct ccu_mult_internal k;
|
||||||
|
struct ccu_div_internal m;
|
||||||
|
struct ccu_div_internal p;
|
||||||
|
+ unsigned long max_rate_for_p;
|
||||||
|
|
||||||
|
unsigned int fixed_post_div;
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
|
||||||
|
index 9f33f6fae..561182a9f 100644
|
||||||
|
--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
|
||||||
|
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
|
||||||
|
@@ -47,6 +47,23 @@
|
||||||
|
compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
|
||||||
|
};
|
||||||
|
|
||||||
|
+&mmc2 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc2_8bit_pins>;
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <8>;
|
||||||
|
+ non-removable;
|
||||||
|
+ cap-mmc-hw-reset;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc2_8bit_pins {
|
||||||
|
+ /* Increase drive strength for DDR modes */
|
||||||
|
+ drive-strength = <40>;
|
||||||
|
+ /* eMMC is missing pull-ups */
|
||||||
|
+ bias-pull-up;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
&ehci0 {
|
||||||
|
status = "okay";
|
||||||
|
};
|
397
patch/kernel/sunxi-dev/board-h5-add-0000-nanopi-k1plus.patch
Normal file
397
patch/kernel/sunxi-dev/board-h5-add-0000-nanopi-k1plus.patch
Normal file
|
@ -0,0 +1,397 @@
|
||||||
|
From ba9ba2949e86b5a00b0ae89b5e298b4cd46118ee Mon Sep 17 00:00:00 2001
|
||||||
|
From: wuweidong <625769020@qq.com>
|
||||||
|
Date: Mon, 27 Nov 2017 10:23:51 +0800
|
||||||
|
Subject: [PATCH] arm64: dts: sun50i-h5-nanopi: Add a new board NanoPi K1 Plus
|
||||||
|
|
||||||
|
---
|
||||||
|
arch/arm64/boot/dts/allwinner/Makefile | 1 +
|
||||||
|
.../allwinner/sun50i-h5-nanopi-k1-plus.dts | 555 ++++++++++++++++++
|
||||||
|
2 files changed, 556 insertions(+)
|
||||||
|
create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts
|
||||||
|
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
index c03224962034..eb4494332002 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
@@ -10,6 +10,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinebook.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-sopine-baseboard.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-teres-i.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
|
||||||
|
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-k1-plus.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..52337a18721f
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts
|
||||||
|
@@ -0,0 +1,367 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2016 ARM Ltd.
|
||||||
|
+ *
|
||||||
|
+ * This file is dual-licensed: you can use it either under the terms
|
||||||
|
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||||
|
+ * licensing only applies to this file, and not this project as a
|
||||||
|
+ * whole.
|
||||||
|
+ *
|
||||||
|
+ * a) This file is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This file 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.
|
||||||
|
+ *
|
||||||
|
+ * Or, alternatively,
|
||||||
|
+ *
|
||||||
|
+ * b) Permission is hereby granted, free of charge, to any person
|
||||||
|
+ * obtaining a copy of this software and associated documentation
|
||||||
|
+ * files (the "Software"), to deal in the Software without
|
||||||
|
+ * restriction, including without limitation the rights to use,
|
||||||
|
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
+ * sell copies of the Software, and to permit persons to whom the
|
||||||
|
+ * Software is furnished to do so, subject to the following
|
||||||
|
+ * conditions:
|
||||||
|
+ *
|
||||||
|
+ * The above copyright notice and this permission notice shall be
|
||||||
|
+ * included in all copies or substantial portions of the Software.
|
||||||
|
+ *
|
||||||
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/dts-v1/;
|
||||||
|
+#include "sun50i-h5.dtsi"
|
||||||
|
+
|
||||||
|
+#include <dt-bindings/gpio/gpio.h>
|
||||||
|
+#include <dt-bindings/input/input.h>
|
||||||
|
+#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||||
|
+
|
||||||
|
+/ {
|
||||||
|
+ model = "FriendlyElec NanoPi K1 Plus";
|
||||||
|
+ compatible = "friendlyelec,nanopi-k1-plus", "allwinner,sun50i-h5";
|
||||||
|
+
|
||||||
|
+ reg_vcc3v3: vcc3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "vcc3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ aliases {
|
||||||
|
+ ethernet0 = &emac;
|
||||||
|
+ serial0 = &uart0;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ chosen {
|
||||||
|
+ stdout-path = "serial0:115200n8";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ connector {
|
||||||
|
+ compatible = "hdmi-connector";
|
||||||
|
+ type = "a";
|
||||||
|
+
|
||||||
|
+ port {
|
||||||
|
+ hdmi_con_in: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_out_con>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ status {
|
||||||
|
+ label = "nanopi:green:status";
|
||||||
|
+ gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ linux,default-trigger = "heartbeat";
|
||||||
|
+ };
|
||||||
|
+ pwr {
|
||||||
|
+ label = "nanopi:red:pwr";
|
||||||
|
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ default-state = "on";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ r-gpio-keys {
|
||||||
|
+ compatible = "gpio-keys";
|
||||||
|
+
|
||||||
|
+ sw4 {
|
||||||
|
+ label = "sw4";
|
||||||
|
+ linux,code = <BTN_0>;
|
||||||
|
+ gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_gmac_3v3: gmac-3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&gmac_power_pin_nanopi>;
|
||||||
|
+ regulator-name = "gmac-3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ startup-delay-us = <100000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_usb0_vbus: usb0-vbus {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "usb0-vbus";
|
||||||
|
+ regulator-min-microvolt = <5000000>;
|
||||||
|
+ regulator-max-microvolt = <5000000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
|
||||||
|
+ status = "okay";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&wifi_en_npi>;
|
||||||
|
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
|
||||||
|
+ post-power-on-delay-ms = <200>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ rfkill_bt {
|
||||||
|
+ compatible = "rfkill-gpio";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&bt_pwr_pin>;
|
||||||
|
+ reset-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
|
||||||
|
+ clocks = <&osc32k>;
|
||||||
|
+ clock-frequency = <32768>;
|
||||||
|
+ rfkill-name = "sunxi-bt";
|
||||||
|
+ rfkill-type = "bluetooth";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ pcm5102a: pcm5102a-codec {
|
||||||
|
+ #sound-dai-cells = <0>;
|
||||||
|
+ compatible = "ti,pcm5102a";
|
||||||
|
+ status = "disabled";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&codec {
|
||||||
|
+ allwinner,audio-routing =
|
||||||
|
+ "Line Out", "LINEOUT",
|
||||||
|
+ "MIC1", "Mic",
|
||||||
|
+ "Mic", "MBIAS";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&de {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&external_mdio {
|
||||||
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
||||||
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||||
|
+ reg = <0>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&emac {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
||||||
|
+ phy-supply = <®_gmac_3v3>;
|
||||||
|
+ phy-handle = <&ext_rgmii_phy>;
|
||||||
|
+ phy-mode = "rgmii";
|
||||||
|
+ local-mac-address = [ 00 00 00 00 00 00 ];
|
||||||
|
+ allwinner,leds-active-low;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ir {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&r_ir_rx_pin>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc0 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ vqmmc-supply = <®_vcc3v3>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ non-removable;
|
||||||
|
+ status = "okay";
|
||||||
|
+ brcmf: bcrmf@1 {
|
||||||
|
+ reg = <1>;
|
||||||
|
+ compatible = "brcm,bcm4329-fmac";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc2 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <8>;
|
||||||
|
+ non-removable;
|
||||||
|
+ cap-mmc-hw-reset;
|
||||||
|
+ boot_device = <0>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc2_8bit_pins {
|
||||||
|
+ /* Increase drive strength for DDR modes */
|
||||||
|
+ drive-strength = <40>;
|
||||||
|
+ /* eMMC is missing pull-ups */
|
||||||
|
+ bias-pull-up;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi_out {
|
||||||
|
+ hdmi_out_con: endpoint {
|
||||||
|
+ remote-endpoint = <&hdmi_con_in>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+&pio {
|
||||||
|
+ leds_npi: led_pins@0 {
|
||||||
|
+ pins = "PA10";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+ gmac_power_pin_nanopi: gmac_power_pin@0 {
|
||||||
|
+ pins = "PD6";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+ bt_pwr_pin: bt_pwr_pin@0 {
|
||||||
|
+ pins = "PG13";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+ spi0_cs_pins: spi0_cs_pins {
|
||||||
|
+ pins = "PC3", "PA6";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+&r_pio {
|
||||||
|
+ leds_r_npi: led_pins@0 {
|
||||||
|
+ pins = "PL10";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+ vdd_cpux_r_npi: regulator_pins@0 {
|
||||||
|
+ allwinner,pins = "PL6";
|
||||||
|
+ allwinner,function = "gpio_out";
|
||||||
|
+ allwinner,drive = <SUN4I_PINCTRL_10_MA>;
|
||||||
|
+ allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
|
||||||
|
+ };
|
||||||
|
+ wifi_en_npi: wifi_en_pin {
|
||||||
|
+ pins = "PL7";
|
||||||
|
+ function = "gpio_out";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&spi0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+ spi-flash@0 {
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <0>;
|
||||||
|
+ compatible = "jedec,spi-nor";
|
||||||
|
+ reg = <0>; /* Chip select 0 */
|
||||||
|
+ spi-max-frequency = <10000000>;
|
||||||
|
+ status = "okay";
|
||||||
|
+ partitions {
|
||||||
|
+ compatible = "fixed-partitions";
|
||||||
|
+ #address-cells = <1>;
|
||||||
|
+ #size-cells = <1>;
|
||||||
|
+ partition@0 {
|
||||||
|
+ label = "uboot";
|
||||||
|
+ reg = <0x0 0x100000>;
|
||||||
|
+ };
|
||||||
|
+ partition@100000 {
|
||||||
|
+ label = "env";
|
||||||
|
+ reg = <0x100000 0x100000>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart0_pa_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart1 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart1_pins>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart2 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart2_pins>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart3 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart3_pins>, <&uart3_rts_cts_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "otg";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /* USB Type-A ports' VBUS is always on */
|
||||||
|
+ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
|
||||||
|
+ usb0_vbus-supply = <®_usb0_vbus>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&i2s0 {
|
||||||
|
+ sound-dai = <&pcm5102a>;
|
||||||
|
+ status = "disabled";
|
||||||
|
+};
|
||||||
|
\ No newline at end of file
|
228
patch/kernel/sunxi-dev/board-h5-add-0001-nanopi-neo-core2.patch
Normal file
228
patch/kernel/sunxi-dev/board-h5-add-0001-nanopi-neo-core2.patch
Normal file
|
@ -0,0 +1,228 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
index c6fc096..731e2ae 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
@@ -11,6 +11,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-teres-i.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-libretech-all-h3-cc.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-plus2.dtb
|
||||||
|
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-core2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-k1-plus.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-core2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-core2.dts
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..b3035ddd7
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo-core2.dts
|
||||||
|
@@ -0,0 +1,210 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2017 Antony Antony <antony@phenome.org>
|
||||||
|
+ * Copyright (C) 2016 ARM Ltd.
|
||||||
|
+ *
|
||||||
|
+ * This file is dual-licensed: you can use it either under the terms
|
||||||
|
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||||
|
+ * licensing only applies to this file, and not this project as a
|
||||||
|
+ * whole.
|
||||||
|
+ *
|
||||||
|
+ * a) This file is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This file 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.
|
||||||
|
+ *
|
||||||
|
+ * Or, alternatively,
|
||||||
|
+ *
|
||||||
|
+ * b) Permission is hereby granted, free of charge, to any person
|
||||||
|
+ * obtaining a copy of this software and associated documentation
|
||||||
|
+ * files (the "Software"), to deal in the Software without
|
||||||
|
+ * restriction, including without limitation the rights to use,
|
||||||
|
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
+ * sell copies of the Software, and to permit persons to whom the
|
||||||
|
+ * Software is furnished to do so, subject to the following
|
||||||
|
+ * conditions:
|
||||||
|
+ *
|
||||||
|
+ * The above copyright notice and this permission notice shall be
|
||||||
|
+ * included in all copies or substantial portions of the Software.
|
||||||
|
+ *
|
||||||
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/dts-v1/;
|
||||||
|
+#include "sun50i-h5.dtsi"
|
||||||
|
+
|
||||||
|
+#include <dt-bindings/gpio/gpio.h>
|
||||||
|
+#include <dt-bindings/input/input.h>
|
||||||
|
+#include <dt-bindings/pinctrl/sun4i-a10.h>
|
||||||
|
+
|
||||||
|
+/ {
|
||||||
|
+ model = "FriendlyARM NanoPi NEO Core2";
|
||||||
|
+ compatible = "friendlyarm,nanopi-neo-core2", "allwinner,sun50i-h5";
|
||||||
|
+
|
||||||
|
+ aliases {
|
||||||
|
+ ethernet0 = &emac;
|
||||||
|
+ serial0 = &uart0;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ chosen {
|
||||||
|
+ stdout-path = "serial0:115200n8";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ pwr {
|
||||||
|
+ label = "nanopi:red:pwr";
|
||||||
|
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
|
||||||
|
+ linux,default-trigger = "default-on";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ status {
|
||||||
|
+ label = "nanopi:green:status";
|
||||||
|
+ gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */
|
||||||
|
+ linux,default-trigger = "heartbeat";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_gmac_3v3: gmac-3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ regulator-name = "gmac-3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ startup-delay-us = <100000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_vcc3v3: vcc3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "vcc3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
|
||||||
|
+ post-power-on-delay-ms = <200>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&cpu0 {
|
||||||
|
+ cpu-supply = <&vdd_cpux>;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&codec {
|
||||||
|
+ allwinner,audio-routing =
|
||||||
|
+ "Line Out", "LINEOUT",
|
||||||
|
+ "MIC1", "Mic",
|
||||||
|
+ "Mic", "MBIAS";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&emac {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
||||||
|
+ phy-supply = <®_gmac_3v3>;
|
||||||
|
+ phy-handle = <&ext_rgmii_phy>;
|
||||||
|
+ phy-mode = "rgmii";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&external_mdio {
|
||||||
|
+ ext_rgmii_phy: ethernet-phy@7 {
|
||||||
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||||
|
+ reg = <7>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc0 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ vqmmc-supply = <®_vcc3v3>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ non-removable;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ brcmf: wifi@1 {
|
||||||
|
+ reg = <1>;
|
||||||
|
+ compatible = "brcm,bcm4329-fmac";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc2 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc2_8bit_pins>;
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <8>;
|
||||||
|
+ non-removable;
|
||||||
|
+ cap-mmc-hw-reset;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&r_i2c {
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ vdd_cpux: regulator@65 {
|
||||||
|
+ compatible = "silergy,sy8106a";
|
||||||
|
+ reg = <0x65>;
|
||||||
|
+ silergy,fixed-microvolt = <1000000>;
|
||||||
|
+ regulator-min-microvolt = <1000000>;
|
||||||
|
+ regulator-max-microvolt = <1400000>;
|
||||||
|
+ regulator-ramp-delay = <200>;
|
||||||
|
+ regulator-boot-on;
|
||||||
|
+ regulator-always-on;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart0_pa_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "host";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /* USB Type-A ports' VBUS is always on */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
198
patch/kernel/sunxi-dev/board-h5-add-0002-nanopi-neo2-v1.1.patch
Normal file
198
patch/kernel/sunxi-dev/board-h5-add-0002-nanopi-neo2-v1.1.patch
Normal file
|
@ -0,0 +1,198 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
index 731e2aec..bb9012fa 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
@@ -16,6 +16,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo2.dtb
|
||||||
|
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo2-v1.1.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-plus2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-core2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-m1-plus2.dtb
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2-v1.1.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2-v1.1.dts
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..cab3c73b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-neo2-v1.1.dts
|
||||||
|
@@ -0,0 +1,180 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
+ *
|
||||||
|
+ * This file is dual-licensed: you can use it either under the terms
|
||||||
|
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||||
|
+ * licensing only applies to this file, and not this project as a
|
||||||
|
+ * whole.
|
||||||
|
+ *
|
||||||
|
+ * a) This file is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This file 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.
|
||||||
|
+ *
|
||||||
|
+ * Or, alternatively,
|
||||||
|
+ *
|
||||||
|
+ * b) Permission is hereby granted, free of charge, to any person
|
||||||
|
+ * obtaining a copy of this software and associated documentation
|
||||||
|
+ * files (the "Software"), to deal in the Software without
|
||||||
|
+ * restriction, including without limitation the rights to use,
|
||||||
|
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
+ * sell copies of the Software, and to permit persons to whom the
|
||||||
|
+ * Software is furnished to do so, subject to the following
|
||||||
|
+ * conditions:
|
||||||
|
+ *
|
||||||
|
+ * The above copyright notice and this permission notice shall be
|
||||||
|
+ * included in all copies or substantial portions of the Software.
|
||||||
|
+ *
|
||||||
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/dts-v1/;
|
||||||
|
+#include "sun50i-h5.dtsi"
|
||||||
|
+
|
||||||
|
+#include <dt-bindings/gpio/gpio.h>
|
||||||
|
+
|
||||||
|
+/ {
|
||||||
|
+ model = "FriendlyARM NanoPi NEO 2";
|
||||||
|
+ compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5";
|
||||||
|
+
|
||||||
|
+ aliases {
|
||||||
|
+ ethernet0 = &emac;
|
||||||
|
+ serial0 = &uart0;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ chosen {
|
||||||
|
+ stdout-path = "serial0:115200n8";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ pwr {
|
||||||
|
+ label = "nanopi:red:pwr";
|
||||||
|
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
|
||||||
|
+ linux,default-trigger = "default-on";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ status {
|
||||||
|
+ label = "nanopi:green:status";
|
||||||
|
+ gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */
|
||||||
|
+ linux,default-trigger = "heartbeat";
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_gmac_3v3: gmac-3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "gmac-3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ startup-delay-us = <100000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_vcc3v3: vcc3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "vcc3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ vdd_cpux: gpio-regulator {
|
||||||
|
+ compatible = "regulator-gpio";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ regulator-name = "vdd-cpux";
|
||||||
|
+ regulator-type = "voltage";
|
||||||
|
+ regulator-boot-on;
|
||||||
|
+ regulator-always-on;
|
||||||
|
+ regulator-min-microvolt = <1100000>;
|
||||||
|
+ regulator-max-microvolt = <1300000>;
|
||||||
|
+ regulator-ramp-delay = <50>; /* 4ms */
|
||||||
|
+ gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
|
||||||
|
+ gpios-states = <0x1>;
|
||||||
|
+ states = <1100000 0x0
|
||||||
|
+ 1300000 0x1>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_usb0_vbus: usb0-vbus {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "usb0-vbus";
|
||||||
|
+ regulator-min-microvolt = <5000000>;
|
||||||
|
+ regulator-max-microvolt = <5000000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
|
||||||
|
+ status = "okay";
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&cpu0 {
|
||||||
|
+ cpu-supply = <&vdd_cpux>;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&emac {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
||||||
|
+ phy-supply = <®_gmac_3v3>;
|
||||||
|
+ phy-handle = <&ext_rgmii_phy>;
|
||||||
|
+ phy-mode = "rgmii";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&external_mdio {
|
||||||
|
+ ext_rgmii_phy: ethernet-phy@7 {
|
||||||
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||||
|
+ reg = <7>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc0 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart0_pa_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "otg";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /* USB Type-A port's VBUS is always on */
|
||||||
|
+ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
|
||||||
|
+ usb0_vbus-supply = <®_usb0_vbus>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
262
patch/kernel/sunxi-dev/board-h5-add-0003-nanopi-m1-plus2.patch
Normal file
262
patch/kernel/sunxi-dev/board-h5-add-0003-nanopi-m1-plus2.patch
Normal file
|
@ -0,0 +1,262 @@
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
index 323f30fa..ac1eead4 100644
|
||||||
|
--- a/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/Makefile
|
||||||
|
@@ -17,6 +17,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-plus2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-neo-core2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-k1-plus.dtb
|
||||||
|
+dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-m1-plus2.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb
|
||||||
|
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb
|
||||||
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-m1-plus2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-m1-plus2.dts
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a6bf32d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-m1-plus2.dts
|
||||||
|
@@ -0,0 +1,244 @@
|
||||||
|
+/*
|
||||||
|
+ * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
|
||||||
|
+ * Copyright (C) 2017 Armbian
|
||||||
|
+ *
|
||||||
|
+ * This file is dual-licensed: you can use it either under the terms
|
||||||
|
+ * of the GPL or the X11 license, at your option. Note that this dual
|
||||||
|
+ * licensing only applies to this file, and not this project as a
|
||||||
|
+ * whole.
|
||||||
|
+ *
|
||||||
|
+ * a) This file is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU General Public License as
|
||||||
|
+ * published by the Free Software Foundation; either version 2 of the
|
||||||
|
+ * License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This file 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.
|
||||||
|
+ *
|
||||||
|
+ * Or, alternatively,
|
||||||
|
+ *
|
||||||
|
+ * b) Permission is hereby granted, free of charge, to any person
|
||||||
|
+ * obtaining a copy of this software and associated documentation
|
||||||
|
+ * files (the "Software"), to deal in the Software without
|
||||||
|
+ * restriction, including without limitation the rights to use,
|
||||||
|
+ * copy, modify, merge, publish, distribute, sublicense, and/or
|
||||||
|
+ * sell copies of the Software, and to permit persons to whom the
|
||||||
|
+ * Software is furnished to do so, subject to the following
|
||||||
|
+ * conditions:
|
||||||
|
+ *
|
||||||
|
+ * The above copyright notice and this permission notice shall be
|
||||||
|
+ * included in all copies or substantial portions of the Software.
|
||||||
|
+ *
|
||||||
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
+ * OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/dts-v1/;
|
||||||
|
+#include "sun50i-h5.dtsi"
|
||||||
|
+
|
||||||
|
+#include <dt-bindings/gpio/gpio.h>
|
||||||
|
+
|
||||||
|
+/ {
|
||||||
|
+ model = "FriendlyARM Nanopi M1 Plus 2";
|
||||||
|
+ compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5";
|
||||||
|
+
|
||||||
|
+ aliases {
|
||||||
|
+ ethernet0 = &emac;
|
||||||
|
+ serial0 = &uart0;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ chosen {
|
||||||
|
+ stdout-path = "serial0:115200n8";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ leds {
|
||||||
|
+ compatible = "gpio-leds";
|
||||||
|
+
|
||||||
|
+ pwr {
|
||||||
|
+ label = "nanopi:green:pwr";
|
||||||
|
+ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ default-state = "on";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ status {
|
||||||
|
+ label = "nanopi:blue:status";
|
||||||
|
+ gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ };
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_gmac_3v3: gmac-3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "gmac-3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ startup-delay-us = <100000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_vcc3v3: vcc3v3 {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "vcc3v3";
|
||||||
|
+ regulator-min-microvolt = <3300000>;
|
||||||
|
+ regulator-max-microvolt = <3300000>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ reg_usb0_vbus: usb0-vbus {
|
||||||
|
+ compatible = "regulator-fixed";
|
||||||
|
+ regulator-name = "usb0-vbus";
|
||||||
|
+ regulator-min-microvolt = <5000000>;
|
||||||
|
+ regulator-max-microvolt = <5000000>;
|
||||||
|
+ enable-active-high;
|
||||||
|
+ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
|
||||||
|
+ status = "okay";
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+ wifi_pwrseq: wifi_pwrseq {
|
||||||
|
+ compatible = "mmc-pwrseq-simple";
|
||||||
|
+ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
|
||||||
|
+ post-power-on-delay-ms = <50>;
|
||||||
|
+ };
|
||||||
|
+
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ehci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&emac {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
||||||
|
+ phy-supply = <®_gmac_3v3>;
|
||||||
|
+ phy-handle = <&ext_rgmii_phy>;
|
||||||
|
+ phy-mode = "rgmii";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mdio {
|
||||||
|
+ ext_rgmii_phy: ethernet-phy@7 {
|
||||||
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||||
|
+ reg = <7>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc0 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc1 {
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ vqmmc-supply = <®_vcc3v3>;
|
||||||
|
+ mmc-pwrseq = <&wifi_pwrseq>;
|
||||||
|
+ bus-width = <4>;
|
||||||
|
+ non-removable;
|
||||||
|
+ status = "okay";
|
||||||
|
+
|
||||||
|
+ brcmf: brcmf@1 {
|
||||||
|
+ reg = <1>;
|
||||||
|
+ compatible = "brcm,bcm4329-fmac";
|
||||||
|
+ interrupt-parent = <&pio>;
|
||||||
|
+ interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 */
|
||||||
|
+ interrupt-names = "host-wake";
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&wifi_wake>;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mmc2 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&mmc2_8bit_pins>;
|
||||||
|
+ vmmc-supply = <®_vcc3v3>;
|
||||||
|
+ bus-width = <8>;
|
||||||
|
+ non-removable;
|
||||||
|
+ cap-mmc-hw-reset;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&de {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci1 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci2 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&ohci3 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&mixer0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&r_pio {
|
||||||
|
+ wifi_wake: wifi_wake@0 {
|
||||||
|
+ pins = "PL7";
|
||||||
|
+ function = "irq";
|
||||||
|
+ bias-pull-up;
|
||||||
|
+ };
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&sound_hdmi {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&tcon0 {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&r_i2c {
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&uart0 {
|
||||||
|
+ pinctrl-names = "default";
|
||||||
|
+ pinctrl-0 = <&uart0_pa_pins>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usb_otg {
|
||||||
|
+ dr_mode = "peripheral";
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+&usbphy {
|
||||||
|
+ /* USB Type-A port's VBUS is always on */
|
||||||
|
+ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
|
||||||
|
+ usb0_vbus-supply = <®_usb0_vbus>;
|
||||||
|
+ status = "okay";
|
||||||
|
+};
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue