mirror of
https://github.com/Fishwaldo/build.git
synced 2025-07-23 13:29:33 +00:00
Move sunxi/64 current to 5.7, legacy to 5.4 (#2098)
* Move sunxi/64 current to 5.7, legacy to 5.4 * Update sunxidev config
This commit is contained in:
parent
812245def3
commit
caa47bad65
430 changed files with 20432 additions and 75488 deletions
440
patch/kernel/sunxi-current/0001-mfd-Add-support-for-AC200.patch
Normal file
440
patch/kernel/sunxi-current/0001-mfd-Add-support-for-AC200.patch
Normal file
|
@ -0,0 +1,440 @@
|
|||
From d98aa318aabd4aba05328f9c832b23bdf2e1677a Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Fri, 16 Aug 2019 16:38:21 +0200
|
||||
Subject: [PATCH 1/4] mfd: Add support for AC200
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/mfd/Kconfig | 9 ++
|
||||
drivers/mfd/Makefile | 1 +
|
||||
drivers/mfd/ac200.c | 170 +++++++++++++++++++++++++++++++
|
||||
include/linux/mfd/ac200.h | 208 ++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 388 insertions(+)
|
||||
create mode 100644 drivers/mfd/ac200.c
|
||||
create mode 100644 include/linux/mfd/ac200.h
|
||||
|
||||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
|
||||
index 420900852166..a45e7c88ac9b 100644
|
||||
--- a/drivers/mfd/Kconfig
|
||||
+++ b/drivers/mfd/Kconfig
|
||||
@@ -178,6 +178,15 @@ config MFD_AC100
|
||||
This driver include only the core APIs. You have to select individual
|
||||
components like codecs or RTC under the corresponding menus.
|
||||
|
||||
+config MFD_AC200
|
||||
+ tristate "X-Powers AC200"
|
||||
+ select MFD_CORE
|
||||
+ depends on I2C
|
||||
+ help
|
||||
+ If you say Y here you get support for the X-Powers AC200 IC.
|
||||
+ This driver include only the core APIs. You have to select individual
|
||||
+ components like Ethernet PHY or RTC under the corresponding menus.
|
||||
+
|
||||
config MFD_AXP20X
|
||||
tristate
|
||||
select MFD_CORE
|
||||
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
|
||||
index aed99f08739f..4431a4cf19ca 100644
|
||||
--- a/drivers/mfd/Makefile
|
||||
+++ b/drivers/mfd/Makefile
|
||||
@@ -141,6 +141,7 @@ obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
|
||||
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
|
||||
|
||||
obj-$(CONFIG_MFD_AC100) += ac100.o
|
||||
+obj-$(CONFIG_MFD_AC200) += ac200.o
|
||||
obj-$(CONFIG_MFD_AXP20X) += axp20x.o
|
||||
obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
|
||||
obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
|
||||
diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c
|
||||
new file mode 100644
|
||||
index 000000000000..570573790d91
|
||||
--- /dev/null
|
||||
+++ b/drivers/mfd/ac200.c
|
||||
@@ -0,0 +1,170 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * MFD core driver for X-Powers' AC200 IC
|
||||
+ *
|
||||
+ * The AC200 is a chip which is co-packaged with Allwinner H6 SoC and
|
||||
+ * includes analog audio codec, analog TV encoder, ethernet PHY, eFuse
|
||||
+ * and RTC.
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/i2c.h>
|
||||
+#include <linux/interrupt.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mfd/core.h>
|
||||
+#include <linux/mfd/ac200.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/of.h>
|
||||
+
|
||||
+/* Interrupts */
|
||||
+#define AC200_IRQ_RTC 0
|
||||
+#define AC200_IRQ_EPHY 1
|
||||
+#define AC200_IRQ_TVE 2
|
||||
+
|
||||
+/* IRQ enable register */
|
||||
+#define AC200_SYS_IRQ_ENABLE_OUT_EN BIT(15)
|
||||
+#define AC200_SYS_IRQ_ENABLE_RTC BIT(12)
|
||||
+#define AC200_SYS_IRQ_ENABLE_EPHY BIT(8)
|
||||
+#define AC200_SYS_IRQ_ENABLE_TVE BIT(4)
|
||||
+
|
||||
+static const struct regmap_range_cfg ac200_range_cfg[] = {
|
||||
+ {
|
||||
+ .range_min = AC200_SYS_VERSION,
|
||||
+ .range_max = AC200_IC_CHARA1,
|
||||
+ .selector_reg = AC200_TWI_REG_ADDR_H,
|
||||
+ .selector_mask = 0xff,
|
||||
+ .selector_shift = 0,
|
||||
+ .window_start = 0,
|
||||
+ .window_len = 256,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static const struct regmap_config ac200_regmap_config = {
|
||||
+ .reg_bits = 8,
|
||||
+ .val_bits = 16,
|
||||
+ .ranges = ac200_range_cfg,
|
||||
+ .num_ranges = ARRAY_SIZE(ac200_range_cfg),
|
||||
+ .max_register = AC200_IC_CHARA1,
|
||||
+};
|
||||
+
|
||||
+static const struct regmap_irq ac200_regmap_irqs[] = {
|
||||
+ REGMAP_IRQ_REG(AC200_IRQ_RTC, 0, AC200_SYS_IRQ_ENABLE_RTC),
|
||||
+ REGMAP_IRQ_REG(AC200_IRQ_EPHY, 0, AC200_SYS_IRQ_ENABLE_EPHY),
|
||||
+ REGMAP_IRQ_REG(AC200_IRQ_TVE, 0, AC200_SYS_IRQ_ENABLE_TVE),
|
||||
+};
|
||||
+
|
||||
+static const struct regmap_irq_chip ac200_regmap_irq_chip = {
|
||||
+ .name = "ac200_irq_chip",
|
||||
+ .status_base = AC200_SYS_IRQ_STATUS,
|
||||
+ .mask_base = AC200_SYS_IRQ_ENABLE,
|
||||
+ .mask_invert = true,
|
||||
+ .irqs = ac200_regmap_irqs,
|
||||
+ .num_irqs = ARRAY_SIZE(ac200_regmap_irqs),
|
||||
+ .num_regs = 1,
|
||||
+};
|
||||
+
|
||||
+static const struct resource ephy_resource[] = {
|
||||
+ DEFINE_RES_IRQ(AC200_IRQ_EPHY),
|
||||
+};
|
||||
+
|
||||
+static const struct mfd_cell ac200_cells[] = {
|
||||
+ {
|
||||
+ .name = "ac200-ephy",
|
||||
+ .num_resources = ARRAY_SIZE(ephy_resource),
|
||||
+ .resources = ephy_resource,
|
||||
+ .of_compatible = "x-powers,ac200-ephy",
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int ac200_i2c_probe(struct i2c_client *i2c,
|
||||
+ const struct i2c_device_id *id)
|
||||
+{
|
||||
+ struct device *dev = &i2c->dev;
|
||||
+ struct ac200_dev *ac200;
|
||||
+ int ret;
|
||||
+
|
||||
+ ac200 = devm_kzalloc(dev, sizeof(*ac200), GFP_KERNEL);
|
||||
+ if (!ac200)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ i2c_set_clientdata(i2c, ac200);
|
||||
+
|
||||
+ ac200->regmap = devm_regmap_init_i2c(i2c, &ac200_regmap_config);
|
||||
+ if (IS_ERR(ac200->regmap)) {
|
||||
+ ret = PTR_ERR(ac200->regmap);
|
||||
+ dev_err(dev, "regmap init failed: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ /* do a reset to put chip in a known state */
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, AC200_SYS_CONTROL, 0);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, AC200_SYS_CONTROL, 1);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* enable interrupt pin */
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, AC200_SYS_IRQ_ENABLE,
|
||||
+ AC200_SYS_IRQ_ENABLE_OUT_EN);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = regmap_add_irq_chip(ac200->regmap, i2c->irq, IRQF_ONESHOT, 0,
|
||||
+ &ac200_regmap_irq_chip, &ac200->regmap_irqc);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, ac200_cells,
|
||||
+ ARRAY_SIZE(ac200_cells), NULL, 0, NULL);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "failed to add MFD devices: %d\n", ret);
|
||||
+ regmap_del_irq_chip(i2c->irq, ac200->regmap_irqc);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ac200_i2c_remove(struct i2c_client *i2c)
|
||||
+{
|
||||
+ struct ac200_dev *ac200 = i2c_get_clientdata(i2c);
|
||||
+
|
||||
+ regmap_write(ac200->regmap, AC200_SYS_CONTROL, 0);
|
||||
+
|
||||
+ mfd_remove_devices(&i2c->dev);
|
||||
+ regmap_del_irq_chip(i2c->irq, ac200->regmap_irqc);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct i2c_device_id ac200_ids[] = {
|
||||
+ { "ac200", },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(i2c, ac200_ids);
|
||||
+
|
||||
+static const struct of_device_id ac200_of_match[] = {
|
||||
+ { .compatible = "x-powers,ac200" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ac200_of_match);
|
||||
+
|
||||
+static struct i2c_driver ac200_i2c_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "ac200",
|
||||
+ .of_match_table = of_match_ptr(ac200_of_match),
|
||||
+ },
|
||||
+ .probe = ac200_i2c_probe,
|
||||
+ .remove = ac200_i2c_remove,
|
||||
+ .id_table = ac200_ids,
|
||||
+};
|
||||
+module_i2c_driver(ac200_i2c_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("MFD core driver for AC200");
|
||||
+MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
diff --git a/include/linux/mfd/ac200.h b/include/linux/mfd/ac200.h
|
||||
new file mode 100644
|
||||
index 000000000000..0c677094a5b3
|
||||
--- /dev/null
|
||||
+++ b/include/linux/mfd/ac200.h
|
||||
@@ -0,0 +1,208 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+/*
|
||||
+ * AC200 register list
|
||||
+ *
|
||||
+ * Copyright (C) 2019 Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __LINUX_MFD_AC200_H
|
||||
+#define __LINUX_MFD_AC200_H
|
||||
+
|
||||
+#include <linux/regmap.h>
|
||||
+
|
||||
+/* interface registers (can be accessed from any page) */
|
||||
+#define AC200_TWI_CHANGE_TO_RSB 0x3E
|
||||
+#define AC200_TWI_PAD_DELAY 0xC4
|
||||
+#define AC200_TWI_REG_ADDR_H 0xFE
|
||||
+
|
||||
+/* General registers */
|
||||
+#define AC200_SYS_VERSION 0x0000
|
||||
+#define AC200_SYS_CONTROL 0x0002
|
||||
+#define AC200_SYS_IRQ_ENABLE 0x0004
|
||||
+#define AC200_SYS_IRQ_STATUS 0x0006
|
||||
+#define AC200_SYS_CLK_CTL 0x0008
|
||||
+#define AC200_SYS_DLDO_OSC_CTL 0x000A
|
||||
+#define AC200_SYS_PLL_CTL0 0x000C
|
||||
+#define AC200_SYS_PLL_CTL1 0x000E
|
||||
+#define AC200_SYS_AUDIO_CTL0 0x0010
|
||||
+#define AC200_SYS_AUDIO_CTL1 0x0012
|
||||
+#define AC200_SYS_EPHY_CTL0 0x0014
|
||||
+#define AC200_SYS_EPHY_CTL1 0x0016
|
||||
+#define AC200_SYS_TVE_CTL0 0x0018
|
||||
+#define AC200_SYS_TVE_CTL1 0x001A
|
||||
+
|
||||
+/* Audio Codec registers */
|
||||
+#define AC200_AC_SYS_CLK_CTL 0x2000
|
||||
+#define AC200_SYS_MOD_RST 0x2002
|
||||
+#define AC200_SYS_SAMP_CTL 0x2004
|
||||
+#define AC200_I2S_CTL 0x2100
|
||||
+#define AC200_I2S_CLK 0x2102
|
||||
+#define AC200_I2S_FMT0 0x2104
|
||||
+#define AC200_I2S_FMT1 0x2108
|
||||
+#define AC200_I2S_MIX_SRC 0x2114
|
||||
+#define AC200_I2S_MIX_GAIN 0x2116
|
||||
+#define AC200_I2S_DACDAT_DVC 0x2118
|
||||
+#define AC200_I2S_ADCDAT_DVC 0x211A
|
||||
+#define AC200_AC_DAC_DPC 0x2200
|
||||
+#define AC200_AC_DAC_MIX_SRC 0x2202
|
||||
+#define AC200_AC_DAC_MIX_GAIN 0x2204
|
||||
+#define AC200_DACA_OMIXER_CTRL 0x2220
|
||||
+#define AC200_OMIXER_SR 0x2222
|
||||
+#define AC200_LINEOUT_CTRL 0x2224
|
||||
+#define AC200_AC_ADC_DPC 0x2300
|
||||
+#define AC200_MBIAS_CTRL 0x2310
|
||||
+#define AC200_ADC_MIC_CTRL 0x2320
|
||||
+#define AC200_ADCMIXER_SR 0x2322
|
||||
+#define AC200_ANALOG_TUNING0 0x232A
|
||||
+#define AC200_ANALOG_TUNING1 0x232C
|
||||
+#define AC200_AC_AGC_SEL 0x2480
|
||||
+#define AC200_ADC_DAPLCTRL 0x2500
|
||||
+#define AC200_ADC_DAPRCTRL 0x2502
|
||||
+#define AC200_ADC_DAPLSTA 0x2504
|
||||
+#define AC200_ADC_DAPRSTA 0x2506
|
||||
+#define AC200_ADC_DAPLTL 0x2508
|
||||
+#define AC200_ADC_DAPRTL 0x250A
|
||||
+#define AC200_ADC_DAPLHAC 0x250C
|
||||
+#define AC200_ADC_DAPLLAC 0x250E
|
||||
+#define AC200_ADC_DAPRHAC 0x2510
|
||||
+#define AC200_ADC_DAPRLAC 0x2512
|
||||
+#define AC200_ADC_DAPLDT 0x2514
|
||||
+#define AC200_ADC_DAPLAT 0x2516
|
||||
+#define AC200_ADC_DAPRDT 0x2518
|
||||
+#define AC200_ADC_DAPRAT 0x251A
|
||||
+#define AC200_ADC_DAPNTH 0x251C
|
||||
+#define AC200_ADC_DAPLHNAC 0x251E
|
||||
+#define AC200_ADC_DAPLLNAC 0x2520
|
||||
+#define AC200_ADC_DAPRHNAC 0x2522
|
||||
+#define AC200_ADC_DAPRLNAC 0x2524
|
||||
+#define AC200_AC_DAPHHPFC 0x2526
|
||||
+#define AC200_AC_DAPLHPFC 0x2528
|
||||
+#define AC200_AC_DAPOPT 0x252A
|
||||
+#define AC200_AC_DAC_DAPCTRL 0x3000
|
||||
+#define AC200_AC_DRC_HHPFC 0x3002
|
||||
+#define AC200_AC_DRC_LHPFC 0x3004
|
||||
+#define AC200_AC_DRC_CTRL 0x3006
|
||||
+#define AC200_AC_DRC_LPFHAT 0x3008
|
||||
+#define AC200_AC_DRC_LPFLAT 0x300A
|
||||
+#define AC200_AC_DRC_RPFHAT 0x300C
|
||||
+#define AC200_AC_DRC_RPFLAT 0x300E
|
||||
+#define AC200_AC_DRC_LPFHRT 0x3010
|
||||
+#define AC200_AC_DRC_LPFLRT 0x3012
|
||||
+#define AC200_AC_DRC_RPFHRT 0x3014
|
||||
+#define AC200_AC_DRC_RPFLRT 0x3016
|
||||
+#define AC200_AC_DRC_LRMSHAT 0x3018
|
||||
+#define AC200_AC_DRC_LRMSLAT 0x301A
|
||||
+#define AC200_AC_DRC_RRMSHAT 0x301C
|
||||
+#define AC200_AC_DRC_RRMSLAT 0x301E
|
||||
+#define AC200_AC_DRC_HCT 0x3020
|
||||
+#define AC200_AC_DRC_LCT 0x3022
|
||||
+#define AC200_AC_DRC_HKC 0x3024
|
||||
+#define AC200_AC_DRC_LKC 0x3026
|
||||
+#define AC200_AC_DRC_HOPC 0x3028
|
||||
+#define AC200_AC_DRC_LOPC 0x302A
|
||||
+#define AC200_AC_DRC_HLT 0x302C
|
||||
+#define AC200_AC_DRC_LLT 0x302E
|
||||
+#define AC200_AC_DRC_HKI 0x3030
|
||||
+#define AC200_AC_DRC_LKI 0x3032
|
||||
+#define AC200_AC_DRC_HOPL 0x3034
|
||||
+#define AC200_AC_DRC_LOPL 0x3036
|
||||
+#define AC200_AC_DRC_HET 0x3038
|
||||
+#define AC200_AC_DRC_LET 0x303A
|
||||
+#define AC200_AC_DRC_HKE 0x303C
|
||||
+#define AC200_AC_DRC_LKE 0x303E
|
||||
+#define AC200_AC_DRC_HOPE 0x3040
|
||||
+#define AC200_AC_DRC_LOPE 0x3042
|
||||
+#define AC200_AC_DRC_HKN 0x3044
|
||||
+#define AC200_AC_DRC_LKN 0x3046
|
||||
+#define AC200_AC_DRC_SFHAT 0x3048
|
||||
+#define AC200_AC_DRC_SFLAT 0x304A
|
||||
+#define AC200_AC_DRC_SFHRT 0x304C
|
||||
+#define AC200_AC_DRC_SFLRT 0x304E
|
||||
+#define AC200_AC_DRC_MXGHS 0x3050
|
||||
+#define AC200_AC_DRC_MXGLS 0x3052
|
||||
+#define AC200_AC_DRC_MNGHS 0x3054
|
||||
+#define AC200_AC_DRC_MNGLS 0x3056
|
||||
+#define AC200_AC_DRC_EPSHC 0x3058
|
||||
+#define AC200_AC_DRC_EPSLC 0x305A
|
||||
+#define AC200_AC_DRC_HPFHGAIN 0x305E
|
||||
+#define AC200_AC_DRC_HPFLGAIN 0x3060
|
||||
+#define AC200_AC_DRC_BISTCR 0x3100
|
||||
+#define AC200_AC_DRC_BISTST 0x3102
|
||||
+
|
||||
+/* TVE registers */
|
||||
+#define AC200_TVE_CTL0 0x4000
|
||||
+#define AC200_TVE_CTL1 0x4002
|
||||
+#define AC200_TVE_MOD0 0x4004
|
||||
+#define AC200_TVE_MOD1 0x4006
|
||||
+#define AC200_TVE_DAC_CFG0 0x4008
|
||||
+#define AC200_TVE_DAC_CFG1 0x400A
|
||||
+#define AC200_TVE_YC_DELAY 0x400C
|
||||
+#define AC200_TVE_YC_FILTER 0x400E
|
||||
+#define AC200_TVE_BURST_FRQ0 0x4010
|
||||
+#define AC200_TVE_BURST_FRQ1 0x4012
|
||||
+#define AC200_TVE_FRONT_PORCH 0x4014
|
||||
+#define AC200_TVE_BACK_PORCH 0x4016
|
||||
+#define AC200_TVE_TOTAL_LINE 0x401C
|
||||
+#define AC200_TVE_FIRST_ACTIVE 0x401E
|
||||
+#define AC200_TVE_BLACK_LEVEL 0x4020
|
||||
+#define AC200_TVE_BLANK_LEVEL 0x4022
|
||||
+#define AC200_TVE_PLUG_EN 0x4030
|
||||
+#define AC200_TVE_PLUG_IRQ_EN 0x4032
|
||||
+#define AC200_TVE_PLUG_IRQ_STA 0x4034
|
||||
+#define AC200_TVE_PLUG_STA 0x4038
|
||||
+#define AC200_TVE_PLUG_DEBOUNCE 0x4040
|
||||
+#define AC200_TVE_DAC_TEST 0x4042
|
||||
+#define AC200_TVE_PLUG_PULSE_LEVEL 0x40F4
|
||||
+#define AC200_TVE_PLUG_PULSE_START 0x40F8
|
||||
+#define AC200_TVE_PLUG_PULSE_PERIOD 0x40FA
|
||||
+#define AC200_TVE_IF_CTL 0x5000
|
||||
+#define AC200_TVE_IF_TIM0 0x5008
|
||||
+#define AC200_TVE_IF_TIM1 0x500A
|
||||
+#define AC200_TVE_IF_TIM2 0x500C
|
||||
+#define AC200_TVE_IF_TIM3 0x500E
|
||||
+#define AC200_TVE_IF_SYNC0 0x5010
|
||||
+#define AC200_TVE_IF_SYNC1 0x5012
|
||||
+#define AC200_TVE_IF_SYNC2 0x5014
|
||||
+#define AC200_TVE_IF_TIM4 0x5016
|
||||
+#define AC200_TVE_IF_STATUS 0x5018
|
||||
+
|
||||
+/* EPHY registers */
|
||||
+#define AC200_EPHY_CTL 0x6000
|
||||
+#define AC200_EPHY_BIST 0x6002
|
||||
+
|
||||
+/* eFuse registers (0x8000 - 0x9FFF, layout unknown) */
|
||||
+
|
||||
+/* RTC registers */
|
||||
+#define AC200_LOSC_CTRL0 0xA000
|
||||
+#define AC200_LOSC_CTRL1 0xA002
|
||||
+#define AC200_LOSC_AUTO_SWT_STA 0xA004
|
||||
+#define AC200_INTOSC_CLK_PRESCAL 0xA008
|
||||
+#define AC200_RTC_YY_MM_DD0 0xA010
|
||||
+#define AC200_RTC_YY_MM_DD1 0xA012
|
||||
+#define AC200_RTC_HH_MM_SS0 0xA014
|
||||
+#define AC200_RTC_HH_MM_SS1 0xA016
|
||||
+#define AC200_ALARM0_CUR_VLU0 0xA024
|
||||
+#define AC200_ALARM0_CUR_VLU1 0xA026
|
||||
+#define AC200_ALARM0_ENABLE 0xA028
|
||||
+#define AC200_ALARM0_IRQ_EN 0xA02C
|
||||
+#define AC200_ALARM0_IRQ_STA 0xA030
|
||||
+#define AC200_ALARM1_WK_HH_MM_SS0 0xA040
|
||||
+#define AC200_ALARM1_WK_HH_MM_SS1 0xA042
|
||||
+#define AC200_ALARM1_ENABLE 0xA044
|
||||
+#define AC200_ALARM1_IRQ_EN 0xA048
|
||||
+#define AC200_ALARM1_IRQ_STA 0xA04C
|
||||
+#define AC200_ALARM_CONFIG 0xA050
|
||||
+#define AC200_LOSC_OUT_GATING 0xA060
|
||||
+#define AC200_GP_DATA(x) (0xA100 + (x) * 2)
|
||||
+#define AC200_RTC_DEB 0xA170
|
||||
+#define AC200_GPL_HOLD_OUTPUT 0xA180
|
||||
+#define AC200_VDD_RTC 0xA190
|
||||
+#define AC200_IC_CHARA0 0xA1F0
|
||||
+#define AC200_IC_CHARA1 0xA1F2
|
||||
+
|
||||
+struct ac200_dev {
|
||||
+ struct regmap *regmap;
|
||||
+ struct regmap_irq_chip_data *regmap_irqc;
|
||||
+};
|
||||
+
|
||||
+#endif /* __LINUX_MFD_AC200_H */
|
||||
--
|
||||
2.20.1
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,272 @@
|
|||
From 1b528543ea41a9837d39e9ab621631c77122f1aa Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Fri, 16 Aug 2019 16:38:57 +0200
|
||||
Subject: [PATCH 2/4] net: phy: Add support for AC200 EPHY
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/net/phy/Kconfig | 7 ++
|
||||
drivers/net/phy/Makefile | 1 +
|
||||
drivers/net/phy/ac200.c | 220 +++++++++++++++++++++++++++++++++++++++
|
||||
3 files changed, 228 insertions(+)
|
||||
create mode 100644 drivers/net/phy/ac200.c
|
||||
|
||||
diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
|
||||
index 2e016271e126..248d9384091c 100644
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -266,6 +266,13 @@ config ADIN_PHY
|
||||
- ADIN1300 - Robust,Industrial, Low Latency 10/100/1000 Gigabit
|
||||
Ethernet PHY
|
||||
|
||||
+config AC200_PHY
|
||||
+ tristate "AC200 EPHY"
|
||||
+ depends on NVMEM
|
||||
+ depends on OF
|
||||
+ help
|
||||
+ Fast ethernet PHY as found in X-Powers AC200 multi-function device.
|
||||
+
|
||||
config AMD_PHY
|
||||
tristate "AMD PHYs"
|
||||
---help---
|
||||
diff --git a/drivers/net/phy/Makefile b/drivers/net/phy/Makefile
|
||||
index fe5badf13b65..2143587f010e 100644
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -49,6 +49,7 @@ obj-$(CONFIG_SFP) += sfp.o
|
||||
sfp-obj-$(CONFIG_SFP) += sfp-bus.o
|
||||
obj-y += $(sfp-obj-y) $(sfp-obj-m)
|
||||
|
||||
+obj-$(CONFIG_AC200_PHY) += ac200.o
|
||||
obj-$(CONFIG_ADIN_PHY) += adin.o
|
||||
obj-$(CONFIG_AMD_PHY) += amd.o
|
||||
aquantia-objs += aquantia_main.o
|
||||
diff --git a/drivers/net/phy/ac200.c b/drivers/net/phy/ac200.c
|
||||
new file mode 100644
|
||||
index 000000000000..cb713188f7ec
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/phy/ac200.c
|
||||
@@ -0,0 +1,220 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/**
|
||||
+ * Driver for AC200 Ethernet PHY
|
||||
+ *
|
||||
+ * Copyright (c) 2020 Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/mfd/ac200.h>
|
||||
+#include <linux/nvmem-consumer.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/phy.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#define AC200_EPHY_ID 0x00441400
|
||||
+#define AC200_EPHY_ID_MASK 0x0ffffff0
|
||||
+
|
||||
+/* macros for system ephy control 0 register */
|
||||
+#define AC200_EPHY_RESET_INVALID BIT(0)
|
||||
+#define AC200_EPHY_SYSCLK_GATING BIT(1)
|
||||
+
|
||||
+/* macros for system ephy control 1 register */
|
||||
+#define AC200_EPHY_E_EPHY_MII_IO_EN BIT(0)
|
||||
+#define AC200_EPHY_E_LNK_LED_IO_EN BIT(1)
|
||||
+#define AC200_EPHY_E_SPD_LED_IO_EN BIT(2)
|
||||
+#define AC200_EPHY_E_DPX_LED_IO_EN BIT(3)
|
||||
+
|
||||
+/* macros for ephy control register */
|
||||
+#define AC200_EPHY_SHUTDOWN BIT(0)
|
||||
+#define AC200_EPHY_LED_POL BIT(1)
|
||||
+#define AC200_EPHY_CLK_SEL BIT(2)
|
||||
+#define AC200_EPHY_ADDR(x) (((x) & 0x1F) << 4)
|
||||
+#define AC200_EPHY_XMII_SEL BIT(11)
|
||||
+#define AC200_EPHY_CALIB(x) (((x) & 0xF) << 12)
|
||||
+
|
||||
+struct ac200_ephy_dev {
|
||||
+ struct clk *clk;
|
||||
+ struct phy_driver *ephy;
|
||||
+ struct regmap *regmap;
|
||||
+};
|
||||
+
|
||||
+static char *ac200_phy_name = "AC200 EPHY";
|
||||
+
|
||||
+static int ac200_ephy_config_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ const struct ac200_ephy_dev *priv = phydev->drv->driver_data;
|
||||
+ unsigned int value;
|
||||
+ int ret;
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0100); /* Switch to Page 1 */
|
||||
+ phy_write(phydev, 0x12, 0x4824); /* Disable APS */
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0200); /* Switch to Page 2 */
|
||||
+ phy_write(phydev, 0x18, 0x0000); /* PHYAFE TRX optimization */
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0600); /* Switch to Page 6 */
|
||||
+ phy_write(phydev, 0x14, 0x708f); /* PHYAFE TX optimization */
|
||||
+ phy_write(phydev, 0x13, 0xF000); /* PHYAFE RX optimization */
|
||||
+ phy_write(phydev, 0x15, 0x1530);
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0800); /* Switch to Page 6 */
|
||||
+ phy_write(phydev, 0x18, 0x00bc); /* PHYAFE TRX optimization */
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0100); /* switch to page 1 */
|
||||
+ phy_clear_bits(phydev, 0x17, BIT(3)); /* disable intelligent IEEE */
|
||||
+
|
||||
+ /* next two blocks disable 802.3az IEEE */
|
||||
+ phy_write(phydev, 0x1f, 0x0200); /* switch to page 2 */
|
||||
+ phy_write(phydev, 0x18, 0x0000);
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0000); /* switch to page 0 */
|
||||
+ phy_clear_bits_mmd(phydev, 0x7, 0x3c, BIT(1));
|
||||
+
|
||||
+ if (phydev->interface == PHY_INTERFACE_MODE_RMII)
|
||||
+ value = AC200_EPHY_XMII_SEL;
|
||||
+ else
|
||||
+ value = 0;
|
||||
+
|
||||
+ ret = regmap_update_bits(priv->regmap, AC200_EPHY_CTL,
|
||||
+ AC200_EPHY_XMII_SEL, value);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /* FIXME: This is H6 specific */
|
||||
+ phy_set_bits(phydev, 0x13, BIT(12));
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ac200_ephy_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ac200_dev *ac200 = dev_get_drvdata(pdev->dev.parent);
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct ac200_ephy_dev *priv;
|
||||
+ struct nvmem_cell *calcell;
|
||||
+ struct phy_driver *ephy;
|
||||
+ u16 *caldata, calib;
|
||||
+ size_t callen;
|
||||
+ int ret;
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ ephy = devm_kzalloc(dev, sizeof(*ephy), GFP_KERNEL);
|
||||
+ if (!ephy)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ priv->clk = devm_clk_get(dev, NULL);
|
||||
+ if (IS_ERR(priv->clk)) {
|
||||
+ dev_err(dev, "Can't obtain the clock!\n");
|
||||
+ return PTR_ERR(priv->clk);
|
||||
+ }
|
||||
+
|
||||
+ calcell = devm_nvmem_cell_get(dev, "calibration");
|
||||
+ if (IS_ERR(calcell)) {
|
||||
+ dev_err(dev, "Unable to find calibration data!\n");
|
||||
+ return PTR_ERR(calcell);
|
||||
+ }
|
||||
+
|
||||
+ caldata = nvmem_cell_read(calcell, &callen);
|
||||
+ if (IS_ERR(caldata)) {
|
||||
+ dev_err(dev, "Unable to read calibration data!\n");
|
||||
+ return PTR_ERR(caldata);
|
||||
+ }
|
||||
+
|
||||
+ if (callen != 2) {
|
||||
+ dev_err(dev, "Calibration data has wrong length: 2 != %zu\n",
|
||||
+ callen);
|
||||
+ kfree(caldata);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ calib = *caldata + 3;
|
||||
+ kfree(caldata);
|
||||
+
|
||||
+ ret = clk_prepare_enable(priv->clk);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ephy->phy_id = AC200_EPHY_ID;
|
||||
+ ephy->phy_id_mask = AC200_EPHY_ID_MASK;
|
||||
+ ephy->name = ac200_phy_name;
|
||||
+ ephy->driver_data = priv;
|
||||
+ ephy->soft_reset = genphy_soft_reset;
|
||||
+ ephy->config_init = ac200_ephy_config_init;
|
||||
+ ephy->suspend = genphy_suspend;
|
||||
+ ephy->resume = genphy_resume;
|
||||
+
|
||||
+ priv->ephy = ephy;
|
||||
+ priv->regmap = ac200->regmap;
|
||||
+ platform_set_drvdata(pdev, priv);
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, AC200_SYS_EPHY_CTL0,
|
||||
+ AC200_EPHY_RESET_INVALID |
|
||||
+ AC200_EPHY_SYSCLK_GATING);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, AC200_SYS_EPHY_CTL1,
|
||||
+ AC200_EPHY_E_EPHY_MII_IO_EN |
|
||||
+ AC200_EPHY_E_LNK_LED_IO_EN |
|
||||
+ AC200_EPHY_E_SPD_LED_IO_EN |
|
||||
+ AC200_EPHY_E_DPX_LED_IO_EN);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, AC200_EPHY_CTL,
|
||||
+ AC200_EPHY_LED_POL |
|
||||
+ AC200_EPHY_CLK_SEL |
|
||||
+ AC200_EPHY_ADDR(1) |
|
||||
+ AC200_EPHY_CALIB(calib));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = phy_driver_register(priv->ephy, THIS_MODULE);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Unable to register phy\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ac200_ephy_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ac200_ephy_dev *priv = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ phy_driver_unregister(priv->ephy);
|
||||
+
|
||||
+ regmap_write(priv->regmap, AC200_EPHY_CTL, AC200_EPHY_SHUTDOWN);
|
||||
+ regmap_write(priv->regmap, AC200_SYS_EPHY_CTL1, 0);
|
||||
+ regmap_write(priv->regmap, AC200_SYS_EPHY_CTL0, 0);
|
||||
+
|
||||
+ clk_disable_unprepare(priv->clk);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id ac200_ephy_match[] = {
|
||||
+ { .compatible = "x-powers,ac200-ephy" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ac200_ephy_match);
|
||||
+
|
||||
+static struct platform_driver ac200_ephy_driver = {
|
||||
+ .probe = ac200_ephy_probe,
|
||||
+ .remove = ac200_ephy_remove,
|
||||
+ .driver = {
|
||||
+ .name = "ac200-ephy",
|
||||
+ .of_match_table = ac200_ephy_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(ac200_ephy_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>");
|
||||
+MODULE_DESCRIPTION("AC200 Ethernet PHY driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -1,997 +0,0 @@
|
|||
From ad9301a2a36b5ecc0152a97cb79a53e3765fb72b Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Tue, 29 Oct 2019 13:16:57 +0100
|
||||
Subject: drm/bridge: split some definitions of ANX78xx to dedicated headers
|
||||
|
||||
Some definitions currently in analogix-anx78xx.h are not restricted to
|
||||
the ANX78xx series, but also applicable to other DisplayPort
|
||||
transmitters by Analogix.
|
||||
|
||||
Split out them to dedicated headers, and make analogix-anx78xx.h include
|
||||
them.
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Torsten Duwe <duwe@suse.de>
|
||||
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
Link: https://patchwork.freedesktop.org/patch/msgid/20191107135212.4D41E68BE1@verein.lst.de
|
||||
---
|
||||
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h | 460 +--------------------
|
||||
.../gpu/drm/bridge/analogix/analogix-i2c-dptx.h | 245 +++++++++++
|
||||
.../drm/bridge/analogix/analogix-i2c-txcommon.h | 231 +++++++++++
|
||||
3 files changed, 479 insertions(+), 457 deletions(-)
|
||||
create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
create mode 100644 drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||
|
||||
(limited to 'drivers/gpu/drm/bridge/analogix')
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
|
||||
index 55d6c2109740..db2a2725acb2 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.h
|
||||
@@ -6,6 +6,9 @@
|
||||
#ifndef __ANX78xx_H
|
||||
#define __ANX78xx_H
|
||||
|
||||
+#include "analogix-i2c-dptx.h"
|
||||
+#include "analogix-i2c-txcommon.h"
|
||||
+
|
||||
/***************************************************************/
|
||||
/* Register definitions for RX_PO */
|
||||
/***************************************************************/
|
||||
@@ -209,463 +212,6 @@
|
||||
#define SP_CLEAR_AVMUTE BIT(4)
|
||||
#define SP_SET_AVMUTE BIT(0)
|
||||
|
||||
-/***************************************************************/
|
||||
-/* Register definitions for TX_P0 */
|
||||
-/***************************************************************/
|
||||
-
|
||||
-/* HDCP Status Register */
|
||||
-#define SP_TX_HDCP_STATUS_REG 0x00
|
||||
-#define SP_AUTH_FAIL BIT(5)
|
||||
-#define SP_AUTHEN_PASS BIT(1)
|
||||
-
|
||||
-/* HDCP Control Register 0 */
|
||||
-#define SP_HDCP_CTRL0_REG 0x01
|
||||
-#define SP_RX_REPEATER BIT(6)
|
||||
-#define SP_RE_AUTH BIT(5)
|
||||
-#define SP_SW_AUTH_OK BIT(4)
|
||||
-#define SP_HARD_AUTH_EN BIT(3)
|
||||
-#define SP_HDCP_ENC_EN BIT(2)
|
||||
-#define SP_BKSV_SRM_PASS BIT(1)
|
||||
-#define SP_KSVLIST_VLD BIT(0)
|
||||
-/* HDCP Function Enabled */
|
||||
-#define SP_HDCP_FUNCTION_ENABLED (BIT(0) | BIT(1) | BIT(2) | BIT(3))
|
||||
-
|
||||
-/* HDCP Receiver BSTATUS Register 0 */
|
||||
-#define SP_HDCP_RX_BSTATUS0_REG 0x1b
|
||||
-/* HDCP Receiver BSTATUS Register 1 */
|
||||
-#define SP_HDCP_RX_BSTATUS1_REG 0x1c
|
||||
-
|
||||
-/* HDCP Embedded "Blue Screen" Content Registers */
|
||||
-#define SP_HDCP_VID0_BLUE_SCREEN_REG 0x2c
|
||||
-#define SP_HDCP_VID1_BLUE_SCREEN_REG 0x2d
|
||||
-#define SP_HDCP_VID2_BLUE_SCREEN_REG 0x2e
|
||||
-
|
||||
-/* HDCP Wait R0 Timing Register */
|
||||
-#define SP_HDCP_WAIT_R0_TIME_REG 0x40
|
||||
-
|
||||
-/* HDCP Link Integrity Check Timer Register */
|
||||
-#define SP_HDCP_LINK_CHECK_TIMER_REG 0x41
|
||||
-
|
||||
-/* HDCP Repeater Ready Wait Timer Register */
|
||||
-#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42
|
||||
-
|
||||
-/* HDCP Auto Timer Register */
|
||||
-#define SP_HDCP_AUTO_TIMER_REG 0x51
|
||||
-
|
||||
-/* HDCP Key Status Register */
|
||||
-#define SP_HDCP_KEY_STATUS_REG 0x5e
|
||||
-
|
||||
-/* HDCP Key Command Register */
|
||||
-#define SP_HDCP_KEY_COMMAND_REG 0x5f
|
||||
-#define SP_DISABLE_SYNC_HDCP BIT(2)
|
||||
-
|
||||
-/* OTP Memory Key Protection Registers */
|
||||
-#define SP_OTP_KEY_PROTECT1_REG 0x60
|
||||
-#define SP_OTP_KEY_PROTECT2_REG 0x61
|
||||
-#define SP_OTP_KEY_PROTECT3_REG 0x62
|
||||
-#define SP_OTP_PSW1 0xa2
|
||||
-#define SP_OTP_PSW2 0x7e
|
||||
-#define SP_OTP_PSW3 0xc6
|
||||
-
|
||||
-/* DP System Control Registers */
|
||||
-#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1)
|
||||
-/* Bits for DP System Control Register 2 */
|
||||
-#define SP_CHA_STA BIT(2)
|
||||
-/* Bits for DP System Control Register 3 */
|
||||
-#define SP_HPD_STATUS BIT(6)
|
||||
-#define SP_STRM_VALID BIT(2)
|
||||
-/* Bits for DP System Control Register 4 */
|
||||
-#define SP_ENHANCED_MODE BIT(3)
|
||||
-
|
||||
-/* DP Video Control Register */
|
||||
-#define SP_DP_VIDEO_CTRL_REG 0x84
|
||||
-#define SP_COLOR_F_MASK 0x06
|
||||
-#define SP_COLOR_F_SHIFT 1
|
||||
-#define SP_BPC_MASK 0xe0
|
||||
-#define SP_BPC_SHIFT 5
|
||||
-# define SP_BPC_6BITS 0x00
|
||||
-# define SP_BPC_8BITS 0x01
|
||||
-# define SP_BPC_10BITS 0x02
|
||||
-# define SP_BPC_12BITS 0x03
|
||||
-
|
||||
-/* DP Audio Control Register */
|
||||
-#define SP_DP_AUDIO_CTRL_REG 0x87
|
||||
-#define SP_AUD_EN BIT(0)
|
||||
-
|
||||
-/* 10us Pulse Generate Timer Registers */
|
||||
-#define SP_I2C_GEN_10US_TIMER0_REG 0x88
|
||||
-#define SP_I2C_GEN_10US_TIMER1_REG 0x89
|
||||
-
|
||||
-/* Packet Send Control Register */
|
||||
-#define SP_PACKET_SEND_CTRL_REG 0x90
|
||||
-#define SP_AUD_IF_UP BIT(7)
|
||||
-#define SP_AVI_IF_UD BIT(6)
|
||||
-#define SP_MPEG_IF_UD BIT(5)
|
||||
-#define SP_SPD_IF_UD BIT(4)
|
||||
-#define SP_AUD_IF_EN BIT(3)
|
||||
-#define SP_AVI_IF_EN BIT(2)
|
||||
-#define SP_MPEG_IF_EN BIT(1)
|
||||
-#define SP_SPD_IF_EN BIT(0)
|
||||
-
|
||||
-/* DP HDCP Control Register */
|
||||
-#define SP_DP_HDCP_CTRL_REG 0x92
|
||||
-#define SP_AUTO_EN BIT(7)
|
||||
-#define SP_AUTO_START BIT(5)
|
||||
-#define SP_LINK_POLLING BIT(1)
|
||||
-
|
||||
-/* DP Main Link Bandwidth Setting Register */
|
||||
-#define SP_DP_MAIN_LINK_BW_SET_REG 0xa0
|
||||
-#define SP_LINK_BW_SET_MASK 0x1f
|
||||
-#define SP_INITIAL_SLIM_M_AUD_SEL BIT(5)
|
||||
-
|
||||
-/* DP Training Pattern Set Register */
|
||||
-#define SP_DP_TRAINING_PATTERN_SET_REG 0xa2
|
||||
-
|
||||
-/* DP Lane 0 Link Training Control Register */
|
||||
-#define SP_DP_LANE0_LT_CTRL_REG 0xa3
|
||||
-#define SP_TX_SW_SET_MASK 0x1b
|
||||
-#define SP_MAX_PRE_REACH BIT(5)
|
||||
-#define SP_MAX_DRIVE_REACH BIT(4)
|
||||
-#define SP_PRE_EMP_LEVEL1 BIT(3)
|
||||
-#define SP_DRVIE_CURRENT_LEVEL1 BIT(0)
|
||||
-
|
||||
-/* DP Link Training Control Register */
|
||||
-#define SP_DP_LT_CTRL_REG 0xa8
|
||||
-#define SP_LT_ERROR_TYPE_MASK 0x70
|
||||
-# define SP_LT_NO_ERROR 0x00
|
||||
-# define SP_LT_AUX_WRITE_ERROR 0x01
|
||||
-# define SP_LT_MAX_DRIVE_REACHED 0x02
|
||||
-# define SP_LT_WRONG_LANE_COUNT_SET 0x03
|
||||
-# define SP_LT_LOOP_SAME_5_TIME 0x04
|
||||
-# define SP_LT_CR_FAIL_IN_EQ 0x05
|
||||
-# define SP_LT_EQ_LOOP_5_TIME 0x06
|
||||
-#define SP_LT_EN BIT(0)
|
||||
-
|
||||
-/* DP CEP Training Control Registers */
|
||||
-#define SP_DP_CEP_TRAINING_CTRL0_REG 0xa9
|
||||
-#define SP_DP_CEP_TRAINING_CTRL1_REG 0xaa
|
||||
-
|
||||
-/* DP Debug Register 1 */
|
||||
-#define SP_DP_DEBUG1_REG 0xb0
|
||||
-#define SP_DEBUG_PLL_LOCK BIT(4)
|
||||
-#define SP_POLLING_EN BIT(1)
|
||||
-
|
||||
-/* DP Polling Control Register */
|
||||
-#define SP_DP_POLLING_CTRL_REG 0xb4
|
||||
-#define SP_AUTO_POLLING_DISABLE BIT(0)
|
||||
-
|
||||
-/* DP Link Debug Control Register */
|
||||
-#define SP_DP_LINK_DEBUG_CTRL_REG 0xb8
|
||||
-#define SP_M_VID_DEBUG BIT(5)
|
||||
-#define SP_NEW_PRBS7 BIT(4)
|
||||
-#define SP_INSERT_ER BIT(1)
|
||||
-#define SP_PRBS31_EN BIT(0)
|
||||
-
|
||||
-/* AUX Misc control Register */
|
||||
-#define SP_AUX_MISC_CTRL_REG 0xbf
|
||||
-
|
||||
-/* DP PLL control Register */
|
||||
-#define SP_DP_PLL_CTRL_REG 0xc7
|
||||
-#define SP_PLL_RST BIT(6)
|
||||
-
|
||||
-/* DP Analog Power Down Register */
|
||||
-#define SP_DP_ANALOG_POWER_DOWN_REG 0xc8
|
||||
-#define SP_CH0_PD BIT(0)
|
||||
-
|
||||
-/* DP Misc Control Register */
|
||||
-#define SP_DP_MISC_CTRL_REG 0xcd
|
||||
-#define SP_EQ_TRAINING_LOOP BIT(6)
|
||||
-
|
||||
-/* DP Extra I2C Device Address Register */
|
||||
-#define SP_DP_EXTRA_I2C_DEV_ADDR_REG 0xce
|
||||
-#define SP_I2C_STRETCH_DISABLE BIT(7)
|
||||
-
|
||||
-#define SP_I2C_EXTRA_ADDR 0x50
|
||||
-
|
||||
-/* DP Downspread Control Register 1 */
|
||||
-#define SP_DP_DOWNSPREAD_CTRL1_REG 0xd0
|
||||
-
|
||||
-/* DP M Value Calculation Control Register */
|
||||
-#define SP_DP_M_CALCULATION_CTRL_REG 0xd9
|
||||
-#define SP_M_GEN_CLK_SEL BIT(0)
|
||||
-
|
||||
-/* AUX Channel Access Status Register */
|
||||
-#define SP_AUX_CH_STATUS_REG 0xe0
|
||||
-#define SP_AUX_STATUS 0x0f
|
||||
-
|
||||
-/* AUX Channel DEFER Control Register */
|
||||
-#define SP_AUX_DEFER_CTRL_REG 0xe2
|
||||
-#define SP_DEFER_CTRL_EN BIT(7)
|
||||
-
|
||||
-/* DP Buffer Data Count Register */
|
||||
-#define SP_BUF_DATA_COUNT_REG 0xe4
|
||||
-#define SP_BUF_DATA_COUNT_MASK 0x1f
|
||||
-#define SP_BUF_CLR BIT(7)
|
||||
-
|
||||
-/* DP AUX Channel Control Register 1 */
|
||||
-#define SP_DP_AUX_CH_CTRL1_REG 0xe5
|
||||
-#define SP_AUX_TX_COMM_MASK 0x0f
|
||||
-#define SP_AUX_LENGTH_MASK 0xf0
|
||||
-#define SP_AUX_LENGTH_SHIFT 4
|
||||
-
|
||||
-/* DP AUX CH Address Register 0 */
|
||||
-#define SP_AUX_ADDR_7_0_REG 0xe6
|
||||
-
|
||||
-/* DP AUX CH Address Register 1 */
|
||||
-#define SP_AUX_ADDR_15_8_REG 0xe7
|
||||
-
|
||||
-/* DP AUX CH Address Register 2 */
|
||||
-#define SP_AUX_ADDR_19_16_REG 0xe8
|
||||
-#define SP_AUX_ADDR_19_16_MASK 0x0f
|
||||
-
|
||||
-/* DP AUX Channel Control Register 2 */
|
||||
-#define SP_DP_AUX_CH_CTRL2_REG 0xe9
|
||||
-#define SP_AUX_SEL_RXCM BIT(6)
|
||||
-#define SP_AUX_CHSEL BIT(3)
|
||||
-#define SP_AUX_PN_INV BIT(2)
|
||||
-#define SP_ADDR_ONLY BIT(1)
|
||||
-#define SP_AUX_EN BIT(0)
|
||||
-
|
||||
-/* DP Video Stream Control InfoFrame Register */
|
||||
-#define SP_DP_3D_VSC_CTRL_REG 0xea
|
||||
-#define SP_INFO_FRAME_VSC_EN BIT(0)
|
||||
-
|
||||
-/* DP Video Stream Data Byte 1 Register */
|
||||
-#define SP_DP_VSC_DB1_REG 0xeb
|
||||
-
|
||||
-/* DP AUX Channel Control Register 3 */
|
||||
-#define SP_DP_AUX_CH_CTRL3_REG 0xec
|
||||
-#define SP_WAIT_COUNTER_7_0_MASK 0xff
|
||||
-
|
||||
-/* DP AUX Channel Control Register 4 */
|
||||
-#define SP_DP_AUX_CH_CTRL4_REG 0xed
|
||||
-
|
||||
-/* DP AUX Buffer Data Registers */
|
||||
-#define SP_DP_BUF_DATA0_REG 0xf0
|
||||
-
|
||||
-/***************************************************************/
|
||||
-/* Register definitions for TX_P2 */
|
||||
-/***************************************************************/
|
||||
-
|
||||
-/*
|
||||
- * Core Register Definitions
|
||||
- */
|
||||
-
|
||||
-/* Device ID Low Byte Register */
|
||||
-#define SP_DEVICE_IDL_REG 0x02
|
||||
-
|
||||
-/* Device ID High Byte Register */
|
||||
-#define SP_DEVICE_IDH_REG 0x03
|
||||
-
|
||||
-/* Device version register */
|
||||
-#define SP_DEVICE_VERSION_REG 0x04
|
||||
-
|
||||
-/* Power Down Control Register */
|
||||
-#define SP_POWERDOWN_CTRL_REG 0x05
|
||||
-#define SP_REGISTER_PD BIT(7)
|
||||
-#define SP_HDCP_PD BIT(5)
|
||||
-#define SP_AUDIO_PD BIT(4)
|
||||
-#define SP_VIDEO_PD BIT(3)
|
||||
-#define SP_LINK_PD BIT(2)
|
||||
-#define SP_TOTAL_PD BIT(1)
|
||||
-
|
||||
-/* Reset Control Register 1 */
|
||||
-#define SP_RESET_CTRL1_REG 0x06
|
||||
-#define SP_MISC_RST BIT(7)
|
||||
-#define SP_VIDCAP_RST BIT(6)
|
||||
-#define SP_VIDFIF_RST BIT(5)
|
||||
-#define SP_AUDFIF_RST BIT(4)
|
||||
-#define SP_AUDCAP_RST BIT(3)
|
||||
-#define SP_HDCP_RST BIT(2)
|
||||
-#define SP_SW_RST BIT(1)
|
||||
-#define SP_HW_RST BIT(0)
|
||||
-
|
||||
-/* Reset Control Register 2 */
|
||||
-#define SP_RESET_CTRL2_REG 0x07
|
||||
-#define SP_AUX_RST BIT(2)
|
||||
-#define SP_SERDES_FIFO_RST BIT(1)
|
||||
-#define SP_I2C_REG_RST BIT(0)
|
||||
-
|
||||
-/* Video Control Register 1 */
|
||||
-#define SP_VID_CTRL1_REG 0x08
|
||||
-#define SP_VIDEO_EN BIT(7)
|
||||
-#define SP_VIDEO_MUTE BIT(2)
|
||||
-#define SP_DE_GEN BIT(1)
|
||||
-#define SP_DEMUX BIT(0)
|
||||
-
|
||||
-/* Video Control Register 2 */
|
||||
-#define SP_VID_CTRL2_REG 0x09
|
||||
-#define SP_IN_COLOR_F_MASK 0x03
|
||||
-#define SP_IN_YC_BIT_SEL BIT(2)
|
||||
-#define SP_IN_BPC_MASK 0x70
|
||||
-#define SP_IN_BPC_SHIFT 4
|
||||
-# define SP_IN_BPC_12BIT 0x03
|
||||
-# define SP_IN_BPC_10BIT 0x02
|
||||
-# define SP_IN_BPC_8BIT 0x01
|
||||
-# define SP_IN_BPC_6BIT 0x00
|
||||
-#define SP_IN_D_RANGE BIT(7)
|
||||
-
|
||||
-/* Video Control Register 3 */
|
||||
-#define SP_VID_CTRL3_REG 0x0a
|
||||
-#define SP_HPD_OUT BIT(6)
|
||||
-
|
||||
-/* Video Control Register 5 */
|
||||
-#define SP_VID_CTRL5_REG 0x0c
|
||||
-#define SP_CSC_STD_SEL BIT(7)
|
||||
-#define SP_XVYCC_RNG_LMT BIT(6)
|
||||
-#define SP_RANGE_Y2R BIT(5)
|
||||
-#define SP_CSPACE_Y2R BIT(4)
|
||||
-#define SP_RGB_RNG_LMT BIT(3)
|
||||
-#define SP_Y_RNG_LMT BIT(2)
|
||||
-#define SP_RANGE_R2Y BIT(1)
|
||||
-#define SP_CSPACE_R2Y BIT(0)
|
||||
-
|
||||
-/* Video Control Register 6 */
|
||||
-#define SP_VID_CTRL6_REG 0x0d
|
||||
-#define SP_TEST_PATTERN_EN BIT(7)
|
||||
-#define SP_VIDEO_PROCESS_EN BIT(6)
|
||||
-#define SP_VID_US_MODE BIT(3)
|
||||
-#define SP_VID_DS_MODE BIT(2)
|
||||
-#define SP_UP_SAMPLE BIT(1)
|
||||
-#define SP_DOWN_SAMPLE BIT(0)
|
||||
-
|
||||
-/* Video Control Register 8 */
|
||||
-#define SP_VID_CTRL8_REG 0x0f
|
||||
-#define SP_VID_VRES_TH BIT(0)
|
||||
-
|
||||
-/* Total Line Status Low Byte Register */
|
||||
-#define SP_TOTAL_LINE_STAL_REG 0x24
|
||||
-
|
||||
-/* Total Line Status High Byte Register */
|
||||
-#define SP_TOTAL_LINE_STAH_REG 0x25
|
||||
-
|
||||
-/* Active Line Status Low Byte Register */
|
||||
-#define SP_ACT_LINE_STAL_REG 0x26
|
||||
-
|
||||
-/* Active Line Status High Byte Register */
|
||||
-#define SP_ACT_LINE_STAH_REG 0x27
|
||||
-
|
||||
-/* Vertical Front Porch Status Register */
|
||||
-#define SP_V_F_PORCH_STA_REG 0x28
|
||||
-
|
||||
-/* Vertical SYNC Width Status Register */
|
||||
-#define SP_V_SYNC_STA_REG 0x29
|
||||
-
|
||||
-/* Vertical Back Porch Status Register */
|
||||
-#define SP_V_B_PORCH_STA_REG 0x2a
|
||||
-
|
||||
-/* Total Pixel Status Low Byte Register */
|
||||
-#define SP_TOTAL_PIXEL_STAL_REG 0x2b
|
||||
-
|
||||
-/* Total Pixel Status High Byte Register */
|
||||
-#define SP_TOTAL_PIXEL_STAH_REG 0x2c
|
||||
-
|
||||
-/* Active Pixel Status Low Byte Register */
|
||||
-#define SP_ACT_PIXEL_STAL_REG 0x2d
|
||||
-
|
||||
-/* Active Pixel Status High Byte Register */
|
||||
-#define SP_ACT_PIXEL_STAH_REG 0x2e
|
||||
-
|
||||
-/* Horizontal Front Porch Status Low Byte Register */
|
||||
-#define SP_H_F_PORCH_STAL_REG 0x2f
|
||||
-
|
||||
-/* Horizontal Front Porch Statys High Byte Register */
|
||||
-#define SP_H_F_PORCH_STAH_REG 0x30
|
||||
-
|
||||
-/* Horizontal SYNC Width Status Low Byte Register */
|
||||
-#define SP_H_SYNC_STAL_REG 0x31
|
||||
-
|
||||
-/* Horizontal SYNC Width Status High Byte Register */
|
||||
-#define SP_H_SYNC_STAH_REG 0x32
|
||||
-
|
||||
-/* Horizontal Back Porch Status Low Byte Register */
|
||||
-#define SP_H_B_PORCH_STAL_REG 0x33
|
||||
-
|
||||
-/* Horizontal Back Porch Status High Byte Register */
|
||||
-#define SP_H_B_PORCH_STAH_REG 0x34
|
||||
-
|
||||
-/* InfoFrame AVI Packet DB1 Register */
|
||||
-#define SP_INFOFRAME_AVI_DB1_REG 0x70
|
||||
-
|
||||
-/* Bit Control Specific Register */
|
||||
-#define SP_BIT_CTRL_SPECIFIC_REG 0x80
|
||||
-#define SP_BIT_CTRL_SELECT_SHIFT 1
|
||||
-#define SP_ENABLE_BIT_CTRL BIT(0)
|
||||
-
|
||||
-/* InfoFrame Audio Packet DB1 Register */
|
||||
-#define SP_INFOFRAME_AUD_DB1_REG 0x83
|
||||
-
|
||||
-/* InfoFrame MPEG Packet DB1 Register */
|
||||
-#define SP_INFOFRAME_MPEG_DB1_REG 0xb0
|
||||
-
|
||||
-/* Audio Channel Status Registers */
|
||||
-#define SP_AUD_CH_STATUS_BASE 0xd0
|
||||
-
|
||||
-/* Audio Channel Num Register 5 */
|
||||
-#define SP_I2S_CHANNEL_NUM_MASK 0xe0
|
||||
-# define SP_I2S_CH_NUM_1 (0x00 << 5)
|
||||
-# define SP_I2S_CH_NUM_2 (0x01 << 5)
|
||||
-# define SP_I2S_CH_NUM_3 (0x02 << 5)
|
||||
-# define SP_I2S_CH_NUM_4 (0x03 << 5)
|
||||
-# define SP_I2S_CH_NUM_5 (0x04 << 5)
|
||||
-# define SP_I2S_CH_NUM_6 (0x05 << 5)
|
||||
-# define SP_I2S_CH_NUM_7 (0x06 << 5)
|
||||
-# define SP_I2S_CH_NUM_8 (0x07 << 5)
|
||||
-#define SP_EXT_VUCP BIT(2)
|
||||
-#define SP_VBIT BIT(1)
|
||||
-#define SP_AUDIO_LAYOUT BIT(0)
|
||||
-
|
||||
-/* Analog Debug Register 2 */
|
||||
-#define SP_ANALOG_DEBUG2_REG 0xdd
|
||||
-#define SP_FORCE_SW_OFF_BYPASS 0x20
|
||||
-#define SP_XTAL_FRQ 0x1c
|
||||
-# define SP_XTAL_FRQ_19M2 (0x00 << 2)
|
||||
-# define SP_XTAL_FRQ_24M (0x01 << 2)
|
||||
-# define SP_XTAL_FRQ_25M (0x02 << 2)
|
||||
-# define SP_XTAL_FRQ_26M (0x03 << 2)
|
||||
-# define SP_XTAL_FRQ_27M (0x04 << 2)
|
||||
-# define SP_XTAL_FRQ_38M4 (0x05 << 2)
|
||||
-# define SP_XTAL_FRQ_52M (0x06 << 2)
|
||||
-#define SP_POWERON_TIME_1P5MS 0x03
|
||||
-
|
||||
-/* Analog Control 0 Register */
|
||||
-#define SP_ANALOG_CTRL0_REG 0xe1
|
||||
-
|
||||
-/* Common Interrupt Status Register 1 */
|
||||
-#define SP_COMMON_INT_STATUS_BASE (0xf1 - 1)
|
||||
-#define SP_PLL_LOCK_CHG 0x40
|
||||
-
|
||||
-/* Common Interrupt Status Register 2 */
|
||||
-#define SP_COMMON_INT_STATUS2 0xf2
|
||||
-#define SP_HDCP_AUTH_CHG BIT(1)
|
||||
-#define SP_HDCP_AUTH_DONE BIT(0)
|
||||
-
|
||||
-#define SP_HDCP_LINK_CHECK_FAIL BIT(0)
|
||||
-
|
||||
-/* Common Interrupt Status Register 4 */
|
||||
-#define SP_COMMON_INT_STATUS4_REG 0xf4
|
||||
-#define SP_HPD_IRQ BIT(6)
|
||||
-#define SP_HPD_ESYNC_ERR BIT(4)
|
||||
-#define SP_HPD_CHG BIT(2)
|
||||
-#define SP_HPD_LOST BIT(1)
|
||||
-#define SP_HPD_PLUG BIT(0)
|
||||
-
|
||||
-/* DP Interrupt Status Register */
|
||||
-#define SP_DP_INT_STATUS1_REG 0xf7
|
||||
-#define SP_TRAINING_FINISH BIT(5)
|
||||
-#define SP_POLLING_ERR BIT(4)
|
||||
-
|
||||
-/* Common Interrupt Mask Register */
|
||||
-#define SP_COMMON_INT_MASK_BASE (0xf8 - 1)
|
||||
-
|
||||
-#define SP_COMMON_INT_MASK4_REG 0xfb
|
||||
-
|
||||
-/* DP Interrupts Mask Register */
|
||||
-#define SP_DP_INT_MASK1_REG 0xfe
|
||||
-
|
||||
-/* Interrupt Control Register */
|
||||
-#define SP_INT_CTRL_REG 0xff
|
||||
-
|
||||
/***************************************************************/
|
||||
/* Register definitions for TX_P1 */
|
||||
/***************************************************************/
|
||||
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
new file mode 100644
|
||||
index 000000000000..4777e48c87a9
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
@@ -0,0 +1,245 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+/*
|
||||
+ * Copyright(c) 2016, Analogix Semiconductor.
|
||||
+ *
|
||||
+ * Based on anx7808 driver obtained from chromeos with copyright:
|
||||
+ * Copyright(c) 2013, Google Inc.
|
||||
+ */
|
||||
+#ifndef _ANALOGIX_I2C_DPTX_H_
|
||||
+#define _ANALOGIX_I2C_DPTX_H_
|
||||
+
|
||||
+/***************************************************************/
|
||||
+/* Register definitions for TX_P0 */
|
||||
+/***************************************************************/
|
||||
+
|
||||
+/* HDCP Status Register */
|
||||
+#define SP_TX_HDCP_STATUS_REG 0x00
|
||||
+#define SP_AUTH_FAIL BIT(5)
|
||||
+#define SP_AUTHEN_PASS BIT(1)
|
||||
+
|
||||
+/* HDCP Control Register 0 */
|
||||
+#define SP_HDCP_CTRL0_REG 0x01
|
||||
+#define SP_RX_REPEATER BIT(6)
|
||||
+#define SP_RE_AUTH BIT(5)
|
||||
+#define SP_SW_AUTH_OK BIT(4)
|
||||
+#define SP_HARD_AUTH_EN BIT(3)
|
||||
+#define SP_HDCP_ENC_EN BIT(2)
|
||||
+#define SP_BKSV_SRM_PASS BIT(1)
|
||||
+#define SP_KSVLIST_VLD BIT(0)
|
||||
+/* HDCP Function Enabled */
|
||||
+#define SP_HDCP_FUNCTION_ENABLED (BIT(0) | BIT(1) | BIT(2) | BIT(3))
|
||||
+
|
||||
+/* HDCP Receiver BSTATUS Register 0 */
|
||||
+#define SP_HDCP_RX_BSTATUS0_REG 0x1b
|
||||
+/* HDCP Receiver BSTATUS Register 1 */
|
||||
+#define SP_HDCP_RX_BSTATUS1_REG 0x1c
|
||||
+
|
||||
+/* HDCP Embedded "Blue Screen" Content Registers */
|
||||
+#define SP_HDCP_VID0_BLUE_SCREEN_REG 0x2c
|
||||
+#define SP_HDCP_VID1_BLUE_SCREEN_REG 0x2d
|
||||
+#define SP_HDCP_VID2_BLUE_SCREEN_REG 0x2e
|
||||
+
|
||||
+/* HDCP Wait R0 Timing Register */
|
||||
+#define SP_HDCP_WAIT_R0_TIME_REG 0x40
|
||||
+
|
||||
+/* HDCP Link Integrity Check Timer Register */
|
||||
+#define SP_HDCP_LINK_CHECK_TIMER_REG 0x41
|
||||
+
|
||||
+/* HDCP Repeater Ready Wait Timer Register */
|
||||
+#define SP_HDCP_RPTR_RDY_WAIT_TIME_REG 0x42
|
||||
+
|
||||
+/* HDCP Auto Timer Register */
|
||||
+#define SP_HDCP_AUTO_TIMER_REG 0x51
|
||||
+
|
||||
+/* HDCP Key Status Register */
|
||||
+#define SP_HDCP_KEY_STATUS_REG 0x5e
|
||||
+
|
||||
+/* HDCP Key Command Register */
|
||||
+#define SP_HDCP_KEY_COMMAND_REG 0x5f
|
||||
+#define SP_DISABLE_SYNC_HDCP BIT(2)
|
||||
+
|
||||
+/* OTP Memory Key Protection Registers */
|
||||
+#define SP_OTP_KEY_PROTECT1_REG 0x60
|
||||
+#define SP_OTP_KEY_PROTECT2_REG 0x61
|
||||
+#define SP_OTP_KEY_PROTECT3_REG 0x62
|
||||
+#define SP_OTP_PSW1 0xa2
|
||||
+#define SP_OTP_PSW2 0x7e
|
||||
+#define SP_OTP_PSW3 0xc6
|
||||
+
|
||||
+/* DP System Control Registers */
|
||||
+#define SP_DP_SYSTEM_CTRL_BASE (0x80 - 1)
|
||||
+/* Bits for DP System Control Register 2 */
|
||||
+#define SP_CHA_STA BIT(2)
|
||||
+/* Bits for DP System Control Register 3 */
|
||||
+#define SP_HPD_STATUS BIT(6)
|
||||
+#define SP_STRM_VALID BIT(2)
|
||||
+/* Bits for DP System Control Register 4 */
|
||||
+#define SP_ENHANCED_MODE BIT(3)
|
||||
+
|
||||
+/* DP Video Control Register */
|
||||
+#define SP_DP_VIDEO_CTRL_REG 0x84
|
||||
+#define SP_COLOR_F_MASK 0x06
|
||||
+#define SP_COLOR_F_SHIFT 1
|
||||
+#define SP_BPC_MASK 0xe0
|
||||
+#define SP_BPC_SHIFT 5
|
||||
+# define SP_BPC_6BITS 0x00
|
||||
+# define SP_BPC_8BITS 0x01
|
||||
+# define SP_BPC_10BITS 0x02
|
||||
+# define SP_BPC_12BITS 0x03
|
||||
+
|
||||
+/* DP Audio Control Register */
|
||||
+#define SP_DP_AUDIO_CTRL_REG 0x87
|
||||
+#define SP_AUD_EN BIT(0)
|
||||
+
|
||||
+/* 10us Pulse Generate Timer Registers */
|
||||
+#define SP_I2C_GEN_10US_TIMER0_REG 0x88
|
||||
+#define SP_I2C_GEN_10US_TIMER1_REG 0x89
|
||||
+
|
||||
+/* Packet Send Control Register */
|
||||
+#define SP_PACKET_SEND_CTRL_REG 0x90
|
||||
+#define SP_AUD_IF_UP BIT(7)
|
||||
+#define SP_AVI_IF_UD BIT(6)
|
||||
+#define SP_MPEG_IF_UD BIT(5)
|
||||
+#define SP_SPD_IF_UD BIT(4)
|
||||
+#define SP_AUD_IF_EN BIT(3)
|
||||
+#define SP_AVI_IF_EN BIT(2)
|
||||
+#define SP_MPEG_IF_EN BIT(1)
|
||||
+#define SP_SPD_IF_EN BIT(0)
|
||||
+
|
||||
+/* DP HDCP Control Register */
|
||||
+#define SP_DP_HDCP_CTRL_REG 0x92
|
||||
+#define SP_AUTO_EN BIT(7)
|
||||
+#define SP_AUTO_START BIT(5)
|
||||
+#define SP_LINK_POLLING BIT(1)
|
||||
+
|
||||
+/* DP Main Link Bandwidth Setting Register */
|
||||
+#define SP_DP_MAIN_LINK_BW_SET_REG 0xa0
|
||||
+#define SP_LINK_BW_SET_MASK 0x1f
|
||||
+#define SP_INITIAL_SLIM_M_AUD_SEL BIT(5)
|
||||
+
|
||||
+/* DP Training Pattern Set Register */
|
||||
+#define SP_DP_TRAINING_PATTERN_SET_REG 0xa2
|
||||
+
|
||||
+/* DP Lane 0 Link Training Control Register */
|
||||
+#define SP_DP_LANE0_LT_CTRL_REG 0xa3
|
||||
+#define SP_TX_SW_SET_MASK 0x1b
|
||||
+#define SP_MAX_PRE_REACH BIT(5)
|
||||
+#define SP_MAX_DRIVE_REACH BIT(4)
|
||||
+#define SP_PRE_EMP_LEVEL1 BIT(3)
|
||||
+#define SP_DRVIE_CURRENT_LEVEL1 BIT(0)
|
||||
+
|
||||
+/* DP Link Training Control Register */
|
||||
+#define SP_DP_LT_CTRL_REG 0xa8
|
||||
+#define SP_LT_ERROR_TYPE_MASK 0x70
|
||||
+# define SP_LT_NO_ERROR 0x00
|
||||
+# define SP_LT_AUX_WRITE_ERROR 0x01
|
||||
+# define SP_LT_MAX_DRIVE_REACHED 0x02
|
||||
+# define SP_LT_WRONG_LANE_COUNT_SET 0x03
|
||||
+# define SP_LT_LOOP_SAME_5_TIME 0x04
|
||||
+# define SP_LT_CR_FAIL_IN_EQ 0x05
|
||||
+# define SP_LT_EQ_LOOP_5_TIME 0x06
|
||||
+#define SP_LT_EN BIT(0)
|
||||
+
|
||||
+/* DP CEP Training Control Registers */
|
||||
+#define SP_DP_CEP_TRAINING_CTRL0_REG 0xa9
|
||||
+#define SP_DP_CEP_TRAINING_CTRL1_REG 0xaa
|
||||
+
|
||||
+/* DP Debug Register 1 */
|
||||
+#define SP_DP_DEBUG1_REG 0xb0
|
||||
+#define SP_DEBUG_PLL_LOCK BIT(4)
|
||||
+#define SP_POLLING_EN BIT(1)
|
||||
+
|
||||
+/* DP Polling Control Register */
|
||||
+#define SP_DP_POLLING_CTRL_REG 0xb4
|
||||
+#define SP_AUTO_POLLING_DISABLE BIT(0)
|
||||
+
|
||||
+/* DP Link Debug Control Register */
|
||||
+#define SP_DP_LINK_DEBUG_CTRL_REG 0xb8
|
||||
+#define SP_M_VID_DEBUG BIT(5)
|
||||
+#define SP_NEW_PRBS7 BIT(4)
|
||||
+#define SP_INSERT_ER BIT(1)
|
||||
+#define SP_PRBS31_EN BIT(0)
|
||||
+
|
||||
+/* AUX Misc control Register */
|
||||
+#define SP_AUX_MISC_CTRL_REG 0xbf
|
||||
+
|
||||
+/* DP PLL control Register */
|
||||
+#define SP_DP_PLL_CTRL_REG 0xc7
|
||||
+#define SP_PLL_RST BIT(6)
|
||||
+
|
||||
+/* DP Analog Power Down Register */
|
||||
+#define SP_DP_ANALOG_POWER_DOWN_REG 0xc8
|
||||
+#define SP_CH0_PD BIT(0)
|
||||
+
|
||||
+/* DP Misc Control Register */
|
||||
+#define SP_DP_MISC_CTRL_REG 0xcd
|
||||
+#define SP_EQ_TRAINING_LOOP BIT(6)
|
||||
+
|
||||
+/* DP Extra I2C Device Address Register */
|
||||
+#define SP_DP_EXTRA_I2C_DEV_ADDR_REG 0xce
|
||||
+#define SP_I2C_STRETCH_DISABLE BIT(7)
|
||||
+
|
||||
+#define SP_I2C_EXTRA_ADDR 0x50
|
||||
+
|
||||
+/* DP Downspread Control Register 1 */
|
||||
+#define SP_DP_DOWNSPREAD_CTRL1_REG 0xd0
|
||||
+
|
||||
+/* DP M Value Calculation Control Register */
|
||||
+#define SP_DP_M_CALCULATION_CTRL_REG 0xd9
|
||||
+#define SP_M_GEN_CLK_SEL BIT(0)
|
||||
+
|
||||
+/* AUX Channel Access Status Register */
|
||||
+#define SP_AUX_CH_STATUS_REG 0xe0
|
||||
+#define SP_AUX_STATUS 0x0f
|
||||
+
|
||||
+/* AUX Channel DEFER Control Register */
|
||||
+#define SP_AUX_DEFER_CTRL_REG 0xe2
|
||||
+#define SP_DEFER_CTRL_EN BIT(7)
|
||||
+
|
||||
+/* DP Buffer Data Count Register */
|
||||
+#define SP_BUF_DATA_COUNT_REG 0xe4
|
||||
+#define SP_BUF_DATA_COUNT_MASK 0x1f
|
||||
+#define SP_BUF_CLR BIT(7)
|
||||
+
|
||||
+/* DP AUX Channel Control Register 1 */
|
||||
+#define SP_DP_AUX_CH_CTRL1_REG 0xe5
|
||||
+#define SP_AUX_TX_COMM_MASK 0x0f
|
||||
+#define SP_AUX_LENGTH_MASK 0xf0
|
||||
+#define SP_AUX_LENGTH_SHIFT 4
|
||||
+
|
||||
+/* DP AUX CH Address Register 0 */
|
||||
+#define SP_AUX_ADDR_7_0_REG 0xe6
|
||||
+
|
||||
+/* DP AUX CH Address Register 1 */
|
||||
+#define SP_AUX_ADDR_15_8_REG 0xe7
|
||||
+
|
||||
+/* DP AUX CH Address Register 2 */
|
||||
+#define SP_AUX_ADDR_19_16_REG 0xe8
|
||||
+#define SP_AUX_ADDR_19_16_MASK 0x0f
|
||||
+
|
||||
+/* DP AUX Channel Control Register 2 */
|
||||
+#define SP_DP_AUX_CH_CTRL2_REG 0xe9
|
||||
+#define SP_AUX_SEL_RXCM BIT(6)
|
||||
+#define SP_AUX_CHSEL BIT(3)
|
||||
+#define SP_AUX_PN_INV BIT(2)
|
||||
+#define SP_ADDR_ONLY BIT(1)
|
||||
+#define SP_AUX_EN BIT(0)
|
||||
+
|
||||
+/* DP Video Stream Control InfoFrame Register */
|
||||
+#define SP_DP_3D_VSC_CTRL_REG 0xea
|
||||
+#define SP_INFO_FRAME_VSC_EN BIT(0)
|
||||
+
|
||||
+/* DP Video Stream Data Byte 1 Register */
|
||||
+#define SP_DP_VSC_DB1_REG 0xeb
|
||||
+
|
||||
+/* DP AUX Channel Control Register 3 */
|
||||
+#define SP_DP_AUX_CH_CTRL3_REG 0xec
|
||||
+#define SP_WAIT_COUNTER_7_0_MASK 0xff
|
||||
+
|
||||
+/* DP AUX Channel Control Register 4 */
|
||||
+#define SP_DP_AUX_CH_CTRL4_REG 0xed
|
||||
+
|
||||
+/* DP AUX Buffer Data Registers */
|
||||
+#define SP_DP_BUF_DATA0_REG 0xf0
|
||||
+
|
||||
+#endif
|
||||
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||
new file mode 100644
|
||||
index 000000000000..677e78fb862f
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||
@@ -0,0 +1,231 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+/*
|
||||
+ * Copyright(c) 2016, Analogix Semiconductor. All rights reserved.
|
||||
+ */
|
||||
+#ifndef _ANALOGIX_I2C_TXCOMMON_H_
|
||||
+#define _ANALOGIX_I2C_TXCOMMON_H_
|
||||
+
|
||||
+/***************************************************************/
|
||||
+/* Register definitions for TX_P2 */
|
||||
+/***************************************************************/
|
||||
+
|
||||
+/*
|
||||
+ * Core Register Definitions
|
||||
+ */
|
||||
+
|
||||
+/* Device ID Low Byte Register */
|
||||
+#define SP_DEVICE_IDL_REG 0x02
|
||||
+
|
||||
+/* Device ID High Byte Register */
|
||||
+#define SP_DEVICE_IDH_REG 0x03
|
||||
+
|
||||
+/* Device version register */
|
||||
+#define SP_DEVICE_VERSION_REG 0x04
|
||||
+
|
||||
+/* Power Down Control Register */
|
||||
+#define SP_POWERDOWN_CTRL_REG 0x05
|
||||
+#define SP_REGISTER_PD BIT(7)
|
||||
+#define SP_HDCP_PD BIT(5)
|
||||
+#define SP_AUDIO_PD BIT(4)
|
||||
+#define SP_VIDEO_PD BIT(3)
|
||||
+#define SP_LINK_PD BIT(2)
|
||||
+#define SP_TOTAL_PD BIT(1)
|
||||
+
|
||||
+/* Reset Control Register 1 */
|
||||
+#define SP_RESET_CTRL1_REG 0x06
|
||||
+#define SP_MISC_RST BIT(7)
|
||||
+#define SP_VIDCAP_RST BIT(6)
|
||||
+#define SP_VIDFIF_RST BIT(5)
|
||||
+#define SP_AUDFIF_RST BIT(4)
|
||||
+#define SP_AUDCAP_RST BIT(3)
|
||||
+#define SP_HDCP_RST BIT(2)
|
||||
+#define SP_SW_RST BIT(1)
|
||||
+#define SP_HW_RST BIT(0)
|
||||
+
|
||||
+/* Reset Control Register 2 */
|
||||
+#define SP_RESET_CTRL2_REG 0x07
|
||||
+#define SP_AUX_RST BIT(2)
|
||||
+#define SP_SERDES_FIFO_RST BIT(1)
|
||||
+#define SP_I2C_REG_RST BIT(0)
|
||||
+
|
||||
+/* Video Control Register 1 */
|
||||
+#define SP_VID_CTRL1_REG 0x08
|
||||
+#define SP_VIDEO_EN BIT(7)
|
||||
+#define SP_VIDEO_MUTE BIT(2)
|
||||
+#define SP_DE_GEN BIT(1)
|
||||
+#define SP_DEMUX BIT(0)
|
||||
+
|
||||
+/* Video Control Register 2 */
|
||||
+#define SP_VID_CTRL2_REG 0x09
|
||||
+#define SP_IN_COLOR_F_MASK 0x03
|
||||
+#define SP_IN_YC_BIT_SEL BIT(2)
|
||||
+#define SP_IN_BPC_MASK 0x70
|
||||
+#define SP_IN_BPC_SHIFT 4
|
||||
+# define SP_IN_BPC_12BIT 0x03
|
||||
+# define SP_IN_BPC_10BIT 0x02
|
||||
+# define SP_IN_BPC_8BIT 0x01
|
||||
+# define SP_IN_BPC_6BIT 0x00
|
||||
+#define SP_IN_D_RANGE BIT(7)
|
||||
+
|
||||
+/* Video Control Register 3 */
|
||||
+#define SP_VID_CTRL3_REG 0x0a
|
||||
+#define SP_HPD_OUT BIT(6)
|
||||
+
|
||||
+/* Video Control Register 5 */
|
||||
+#define SP_VID_CTRL5_REG 0x0c
|
||||
+#define SP_CSC_STD_SEL BIT(7)
|
||||
+#define SP_XVYCC_RNG_LMT BIT(6)
|
||||
+#define SP_RANGE_Y2R BIT(5)
|
||||
+#define SP_CSPACE_Y2R BIT(4)
|
||||
+#define SP_RGB_RNG_LMT BIT(3)
|
||||
+#define SP_Y_RNG_LMT BIT(2)
|
||||
+#define SP_RANGE_R2Y BIT(1)
|
||||
+#define SP_CSPACE_R2Y BIT(0)
|
||||
+
|
||||
+/* Video Control Register 6 */
|
||||
+#define SP_VID_CTRL6_REG 0x0d
|
||||
+#define SP_TEST_PATTERN_EN BIT(7)
|
||||
+#define SP_VIDEO_PROCESS_EN BIT(6)
|
||||
+#define SP_VID_US_MODE BIT(3)
|
||||
+#define SP_VID_DS_MODE BIT(2)
|
||||
+#define SP_UP_SAMPLE BIT(1)
|
||||
+#define SP_DOWN_SAMPLE BIT(0)
|
||||
+
|
||||
+/* Video Control Register 8 */
|
||||
+#define SP_VID_CTRL8_REG 0x0f
|
||||
+#define SP_VID_VRES_TH BIT(0)
|
||||
+
|
||||
+/* Total Line Status Low Byte Register */
|
||||
+#define SP_TOTAL_LINE_STAL_REG 0x24
|
||||
+
|
||||
+/* Total Line Status High Byte Register */
|
||||
+#define SP_TOTAL_LINE_STAH_REG 0x25
|
||||
+
|
||||
+/* Active Line Status Low Byte Register */
|
||||
+#define SP_ACT_LINE_STAL_REG 0x26
|
||||
+
|
||||
+/* Active Line Status High Byte Register */
|
||||
+#define SP_ACT_LINE_STAH_REG 0x27
|
||||
+
|
||||
+/* Vertical Front Porch Status Register */
|
||||
+#define SP_V_F_PORCH_STA_REG 0x28
|
||||
+
|
||||
+/* Vertical SYNC Width Status Register */
|
||||
+#define SP_V_SYNC_STA_REG 0x29
|
||||
+
|
||||
+/* Vertical Back Porch Status Register */
|
||||
+#define SP_V_B_PORCH_STA_REG 0x2a
|
||||
+
|
||||
+/* Total Pixel Status Low Byte Register */
|
||||
+#define SP_TOTAL_PIXEL_STAL_REG 0x2b
|
||||
+
|
||||
+/* Total Pixel Status High Byte Register */
|
||||
+#define SP_TOTAL_PIXEL_STAH_REG 0x2c
|
||||
+
|
||||
+/* Active Pixel Status Low Byte Register */
|
||||
+#define SP_ACT_PIXEL_STAL_REG 0x2d
|
||||
+
|
||||
+/* Active Pixel Status High Byte Register */
|
||||
+#define SP_ACT_PIXEL_STAH_REG 0x2e
|
||||
+
|
||||
+/* Horizontal Front Porch Status Low Byte Register */
|
||||
+#define SP_H_F_PORCH_STAL_REG 0x2f
|
||||
+
|
||||
+/* Horizontal Front Porch Statys High Byte Register */
|
||||
+#define SP_H_F_PORCH_STAH_REG 0x30
|
||||
+
|
||||
+/* Horizontal SYNC Width Status Low Byte Register */
|
||||
+#define SP_H_SYNC_STAL_REG 0x31
|
||||
+
|
||||
+/* Horizontal SYNC Width Status High Byte Register */
|
||||
+#define SP_H_SYNC_STAH_REG 0x32
|
||||
+
|
||||
+/* Horizontal Back Porch Status Low Byte Register */
|
||||
+#define SP_H_B_PORCH_STAL_REG 0x33
|
||||
+
|
||||
+/* Horizontal Back Porch Status High Byte Register */
|
||||
+#define SP_H_B_PORCH_STAH_REG 0x34
|
||||
+
|
||||
+/* InfoFrame AVI Packet DB1 Register */
|
||||
+#define SP_INFOFRAME_AVI_DB1_REG 0x70
|
||||
+
|
||||
+/* Bit Control Specific Register */
|
||||
+#define SP_BIT_CTRL_SPECIFIC_REG 0x80
|
||||
+#define SP_BIT_CTRL_SELECT_SHIFT 1
|
||||
+#define SP_ENABLE_BIT_CTRL BIT(0)
|
||||
+
|
||||
+/* InfoFrame Audio Packet DB1 Register */
|
||||
+#define SP_INFOFRAME_AUD_DB1_REG 0x83
|
||||
+
|
||||
+/* InfoFrame MPEG Packet DB1 Register */
|
||||
+#define SP_INFOFRAME_MPEG_DB1_REG 0xb0
|
||||
+
|
||||
+/* Audio Channel Status Registers */
|
||||
+#define SP_AUD_CH_STATUS_BASE 0xd0
|
||||
+
|
||||
+/* Audio Channel Num Register 5 */
|
||||
+#define SP_I2S_CHANNEL_NUM_MASK 0xe0
|
||||
+# define SP_I2S_CH_NUM_1 (0x00 << 5)
|
||||
+# define SP_I2S_CH_NUM_2 (0x01 << 5)
|
||||
+# define SP_I2S_CH_NUM_3 (0x02 << 5)
|
||||
+# define SP_I2S_CH_NUM_4 (0x03 << 5)
|
||||
+# define SP_I2S_CH_NUM_5 (0x04 << 5)
|
||||
+# define SP_I2S_CH_NUM_6 (0x05 << 5)
|
||||
+# define SP_I2S_CH_NUM_7 (0x06 << 5)
|
||||
+# define SP_I2S_CH_NUM_8 (0x07 << 5)
|
||||
+#define SP_EXT_VUCP BIT(2)
|
||||
+#define SP_VBIT BIT(1)
|
||||
+#define SP_AUDIO_LAYOUT BIT(0)
|
||||
+
|
||||
+/* Analog Debug Register 2 */
|
||||
+#define SP_ANALOG_DEBUG2_REG 0xdd
|
||||
+#define SP_FORCE_SW_OFF_BYPASS 0x20
|
||||
+#define SP_XTAL_FRQ 0x1c
|
||||
+# define SP_XTAL_FRQ_19M2 (0x00 << 2)
|
||||
+# define SP_XTAL_FRQ_24M (0x01 << 2)
|
||||
+# define SP_XTAL_FRQ_25M (0x02 << 2)
|
||||
+# define SP_XTAL_FRQ_26M (0x03 << 2)
|
||||
+# define SP_XTAL_FRQ_27M (0x04 << 2)
|
||||
+# define SP_XTAL_FRQ_38M4 (0x05 << 2)
|
||||
+# define SP_XTAL_FRQ_52M (0x06 << 2)
|
||||
+#define SP_POWERON_TIME_1P5MS 0x03
|
||||
+
|
||||
+/* Analog Control 0 Register */
|
||||
+#define SP_ANALOG_CTRL0_REG 0xe1
|
||||
+
|
||||
+/* Common Interrupt Status Register 1 */
|
||||
+#define SP_COMMON_INT_STATUS_BASE (0xf1 - 1)
|
||||
+#define SP_PLL_LOCK_CHG 0x40
|
||||
+
|
||||
+/* Common Interrupt Status Register 2 */
|
||||
+#define SP_COMMON_INT_STATUS2 0xf2
|
||||
+#define SP_HDCP_AUTH_CHG BIT(1)
|
||||
+#define SP_HDCP_AUTH_DONE BIT(0)
|
||||
+
|
||||
+#define SP_HDCP_LINK_CHECK_FAIL BIT(0)
|
||||
+
|
||||
+/* Common Interrupt Status Register 4 */
|
||||
+#define SP_COMMON_INT_STATUS4_REG 0xf4
|
||||
+#define SP_HPD_IRQ BIT(6)
|
||||
+#define SP_HPD_ESYNC_ERR BIT(4)
|
||||
+#define SP_HPD_CHG BIT(2)
|
||||
+#define SP_HPD_LOST BIT(1)
|
||||
+#define SP_HPD_PLUG BIT(0)
|
||||
+
|
||||
+/* DP Interrupt Status Register */
|
||||
+#define SP_DP_INT_STATUS1_REG 0xf7
|
||||
+#define SP_TRAINING_FINISH BIT(5)
|
||||
+#define SP_POLLING_ERR BIT(4)
|
||||
+
|
||||
+/* Common Interrupt Mask Register */
|
||||
+#define SP_COMMON_INT_MASK_BASE (0xf8 - 1)
|
||||
+
|
||||
+#define SP_COMMON_INT_MASK4_REG 0xfb
|
||||
+
|
||||
+/* DP Interrupts Mask Register */
|
||||
+#define SP_DP_INT_MASK1_REG 0xfe
|
||||
+
|
||||
+/* Interrupt Control Register */
|
||||
+#define SP_INT_CTRL_REG 0xff
|
||||
+
|
||||
+#endif /* _ANALOGIX_I2C_TXCOMMON_H_ */
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
From 1b08baab634bebd4ef94ca449b81d7550c91abf0 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sun, 12 Jan 2020 12:09:12 +0100
|
||||
Subject: [PATCH 3/4] arm64: dts: allwinner: h6: Add AC200 EPHY related nodes
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 63 ++++++++++++++++++++
|
||||
1 file changed, 63 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
index 3329283e38ab..81caf1e96407 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
@@ -16,6 +16,16 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
+ ac200_pwm_clk: ac200_clk {
|
||||
+ compatible = "pwm-clock";
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <24000000>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm1_pin>;
|
||||
+ pwms = <&pwm 1 42 0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
cpus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@@ -248,6 +258,10 @@
|
||||
ths_calibration: thermal-sensor-calibration@14 {
|
||||
reg = <0x14 0x8>;
|
||||
};
|
||||
+
|
||||
+ ephy_calibration: ephy-calibration@2c {
|
||||
+ reg = <0x2c 0x2>;
|
||||
+ };
|
||||
};
|
||||
|
||||
watchdog: watchdog@30090a0 {
|
||||
@@ -291,6 +305,14 @@
|
||||
function = "emac";
|
||||
drive-strength = <40>;
|
||||
};
|
||||
+
|
||||
+ /omit-if-no-ref/
|
||||
+ ext_rmii_pins: rmii_pins {
|
||||
+ pins = "PA0", "PA1", "PA2", "PA3", "PA4",
|
||||
+ "PA5", "PA6", "PA7", "PA8", "PA9";
|
||||
+ function = "emac";
|
||||
+ drive-strength = <40>;
|
||||
+ };
|
||||
|
||||
hdmi_pins: hdmi-pins {
|
||||
pins = "PH8", "PH9", "PH10";
|
||||
@@ -311,6 +333,11 @@
|
||||
pins = "PD23", "PD24";
|
||||
function = "i2c2";
|
||||
};
|
||||
+
|
||||
+ i2c3_pins: i2c3-pins {
|
||||
+ pins = "PB17", "PB18";
|
||||
+ function = "i2c3";
|
||||
+ };
|
||||
|
||||
mmc0_pins: mmc0-pins {
|
||||
pins = "PF0", "PF1", "PF2", "PF3",
|
||||
@@ -329,6 +356,11 @@
|
||||
bias-pull-up;
|
||||
};
|
||||
|
||||
+ pwm1_pin: pwm1-pin {
|
||||
+ pins = "PB19";
|
||||
+ function = "pwm1";
|
||||
+ };
|
||||
+
|
||||
mmc2_pins: mmc2-pins {
|
||||
pins = "PC1", "PC4", "PC5", "PC6",
|
||||
"PC7", "PC8", "PC9", "PC10",
|
||||
@@ -504,6 +536,37 @@
|
||||
#size-cells = <0>;
|
||||
};
|
||||
|
||||
+ i2c3: i2c@5002c00 {
|
||||
+ compatible = "allwinner,sun50i-h6-i2c",
|
||||
+ "allwinner,sun6i-a31-i2c";
|
||||
+ reg = <0x05002c00 0x400>;
|
||||
+ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&ccu CLK_BUS_I2C3>;
|
||||
+ resets = <&ccu RST_BUS_I2C3>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2c3_pins>;
|
||||
+ status = "disabled";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ac200: mfd@10 {
|
||||
+ compatible = "x-powers,ac200";
|
||||
+ reg = <0x10>;
|
||||
+ interrupt-parent = <&pio>;
|
||||
+ interrupts = <1 20 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ interrupt-controller;
|
||||
+ #interrupt-cells = <1>;
|
||||
+
|
||||
+ ac200_ephy: phy {
|
||||
+ compatible = "x-powers,ac200-ephy";
|
||||
+ clocks = <&ac200_pwm_clk>;
|
||||
+ nvmem-cells = <&ephy_calibration>;
|
||||
+ nvmem-cell-names = "calibration";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
emac: ethernet@5020000 {
|
||||
compatible = "allwinner,sun50i-h6-emac",
|
||||
"allwinner,sun50i-a64-emac";
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
From 15a2214233c38b98cb76e7214c83fbc26068a909 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sun, 12 Jan 2020 12:19:51 +0100
|
||||
Subject: [PATCH 4/4] arm64: dts: allwinner: h6: tanix-tx6: Enable ethernet
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../dts/allwinner/sun50i-h6-tanix-tx6.dts | 32 +++++++++++++++++++
|
||||
1 file changed, 32 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts
|
||||
index 83e6cb0e59ce..41a2e3454be5 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-tanix-tx6.dts
|
||||
@@ -12,6 +12,7 @@
|
||||
compatible = "oranth,tanix-tx6", "allwinner,sun50i-h6";
|
||||
|
||||
aliases {
|
||||
+ ethernet0 = &emac;
|
||||
serial0 = &uart0;
|
||||
};
|
||||
|
||||
@@ -39,6 +40,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&ac200_ephy {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&ac200_pwm_clk {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -47,6 +56,14 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&emac {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ext_rmii_pins>;
|
||||
+ phy-mode = "rmii";
|
||||
+ phy-handle = <&ext_rmii_phy>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ehci0 {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -69,6 +86,17 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2c3 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&mdio {
|
||||
+ ext_rmii_phy: ethernet-phy@1 {
|
||||
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&mmc0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&mmc0_pins>;
|
||||
@@ -86,6 +114,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&pwm {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&r_ir {
|
||||
linux,rc-map-name = "rc-tanix-tx5max";
|
||||
status = "okay";
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
From dea73d61466e4f09c8184f7bb5375975878645b3 Mon Sep 17 00:00:00 2001
|
||||
From: Torsten Duwe <duwe@lst.de>
|
||||
Date: Tue, 29 Oct 2019 13:16:57 +0100
|
||||
Subject: drm/bridge: Prepare Analogix anx6345 support
|
||||
|
||||
Add bit definitions required for the anx6345 and add a
|
||||
sanity check in anx_dp_aux_transfer.
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Torsten Duwe <duwe@suse.de>
|
||||
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
Link: https://patchwork.freedesktop.org/patch/msgid/20191107135218.01C2168C4E@verein.lst.de
|
||||
---
|
||||
drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c | 2 +-
|
||||
drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h | 8 ++++++++
|
||||
drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h | 3 +++
|
||||
3 files changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
(limited to 'drivers/gpu/drm/bridge/analogix')
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||
index 60707bb5afe7..fe40bab21530 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||
@@ -116,7 +116,7 @@ ssize_t anx_dp_aux_transfer(struct regmap *map_dptx,
|
||||
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 db24f7290461..663c4bea6e70 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
@@ -72,7 +72,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)
|
||||
|
||||
@@ -117,6 +121,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
|
||||
|
||||
@@ -130,6 +137,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 677e78fb862f..3c843497d835 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-txcommon.h
|
||||
@@ -177,6 +177,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
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -31,7 +31,7 @@ index d0a8d5810c0a..9a715a6bdbf9 100644
|
|||
#define SUN4I_I2S_FIFO_TX_REG 0x0c
|
||||
#define SUN4I_I2S_FIFO_RX_REG 0x10
|
||||
|
||||
@@ -97,33 +100,53 @@
|
||||
@@ -100,22 +100,25 @@
|
||||
#define SUN8I_I2S_CTRL_MODE_PCM (0 << 4)
|
||||
|
||||
#define SUN8I_I2S_FMT0_LRCLK_POLARITY_MASK BIT(19)
|
||||
|
@ -63,9 +63,8 @@ index d0a8d5810c0a..9a715a6bdbf9 100644
|
|||
|
||||
#define SUN8I_I2S_TX_CHAN_MAP_REG 0x44
|
||||
#define SUN8I_I2S_TX_CHAN_SEL_REG 0x34
|
||||
#define SUN8I_I2S_TX_CHAN_OFFSET_MASK GENMASK(13, 12)
|
||||
-#define SUN8I_I2S_TX_CHAN_OFFSET(offset) (offset << 12)
|
||||
+#define SUN8I_I2S_TX_CHAN_OFFSET(offset) ((offset) << 12)
|
||||
@@ -123,10 +126,27 @@
|
||||
#define SUN8I_I2S_TX_CHAN_OFFSET(offset) ((offset) << 12)
|
||||
#define SUN8I_I2S_TX_CHAN_EN_MASK GENMASK(11, 4)
|
||||
#define SUN8I_I2S_TX_CHAN_EN(num_chan) (((1 << num_chan) - 1) << 4)
|
||||
+#define SUN8I_I2S_TX_CHAN_SEL_MASK GENMASK(2, 0)
|
||||
|
@ -485,7 +484,7 @@ index d0a8d5810c0a..9a715a6bdbf9 100644
|
|||
break;
|
||||
|
||||
default:
|
||||
@@ -661,12 +928,8 @@ static int sun8i_i2s_set_soc_fmt(const struct sun4i_i2s *i2s,
|
||||
@@ -913,12 +933,8 @@ static int sun8i_i2s_set_soc_fmt(struct sun4i_i2s *i2s,
|
||||
|
||||
regmap_update_bits(i2s->regmap, SUN4I_I2S_CTRL_REG,
|
||||
SUN8I_I2S_CTRL_MODE_MASK, mode);
|
|
@ -1,208 +0,0 @@
|
|||
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>
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Reviewed-by: Rob Herring <robh@kernel.org>
|
||||
Signed-off-by: Torsten Duwe <duwe@suse.de>
|
||||
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
||||
---
|
||||
.../bindings/display/bridge/anx6345.yaml | 102 ++++++++++++++++++++++
|
||||
1 file changed, 102 insertions(+)
|
||||
create mode 100644 Documentation/devicetree/bindings/display/bridge/anx6345.yaml
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/display/bridge/anx6345.yaml b/Documentation/devicetree/bindings/display/bridge/anx6345.yaml
|
||||
new file mode 100644
|
||||
index 000000000000..094e8e8a5faa
|
||||
--- /dev/null
|
||||
+++ b/Documentation/devicetree/bindings/display/bridge/anx6345.yaml
|
||||
@@ -0,0 +1,102 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+%YAML 1.2
|
||||
+---
|
||||
+$id: http://devicetree.org/schemas/display/bridge/anx6345.yaml#
|
||||
+$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
+
|
||||
+title: Analogix ANX6345 eDP Transmitter Device Tree Bindings
|
||||
+
|
||||
+maintainers:
|
||||
+ - Torsten Duwe <duwe@lst.de>
|
||||
+
|
||||
+description: |
|
||||
+ The ANX6345 is an ultra-low power Full-HD eDP transmitter designed for
|
||||
+ portable devices.
|
||||
+
|
||||
+properties:
|
||||
+ compatible:
|
||||
+ const: analogix,anx6345
|
||||
+
|
||||
+ reg:
|
||||
+ maxItems: 1
|
||||
+ description: base I2C address of the device
|
||||
+
|
||||
+ reset-gpios:
|
||||
+ maxItems: 1
|
||||
+ description: GPIO connected to active low reset
|
||||
+
|
||||
+ dvdd12-supply:
|
||||
+ maxItems: 1
|
||||
+ description: Regulator for 1.2V digital core power.
|
||||
+
|
||||
+ dvdd25-supply:
|
||||
+ maxItems: 1
|
||||
+ description: Regulator for 2.5V digital core power.
|
||||
+
|
||||
+ ports:
|
||||
+ type: object
|
||||
+
|
||||
+ properties:
|
||||
+ port@0:
|
||||
+ type: object
|
||||
+ description: |
|
||||
+ Video port for LVTTL input
|
||||
+
|
||||
+ port@1:
|
||||
+ type: object
|
||||
+ description: |
|
||||
+ Video port for eDP output (panel or connector).
|
||||
+ May be omitted if EDID works reliably.
|
||||
+
|
||||
+ required:
|
||||
+ - port@0
|
||||
+
|
||||
+required:
|
||||
+ - compatible
|
||||
+ - reg
|
||||
+ - reset-gpios
|
||||
+ - dvdd12-supply
|
||||
+ - dvdd25-supply
|
||||
+ - ports
|
||||
+
|
||||
+additionalProperties: false
|
||||
+
|
||||
+examples:
|
||||
+ - |
|
||||
+ i2c0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ anx6345: anx6345@38 {
|
||||
+ compatible = "analogix,anx6345";
|
||||
+ reg = <0x38>;
|
||||
+ reset-gpios = <&pio42 1 /* GPIO_ACTIVE_LOW */>;
|
||||
+ dvdd25-supply = <®_dldo2>;
|
||||
+ dvdd12-supply = <®_fldo1>;
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ anx6345_in: port@0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ reg = <0>;
|
||||
+ anx6345_in_tcon0: endpoint@0 {
|
||||
+ reg = <0>;
|
||||
+ remote-endpoint = <&tcon0_out_anx6345>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ anx6345_out: port@1 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ reg = <1>;
|
||||
+ anx6345_out_panel: endpoint@0 {
|
||||
+ reg = <0>;
|
||||
+ remote-endpoint = <&panel_in_edp>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
|
||||
|
||||
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, and enable the display engine, video mixer
|
||||
and tcon0 as well.
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
Signed-off-by: Torsten Duwe <duwe@suse.de>
|
||||
---
|
||||
.../boot/dts/allwinner/sun50i-a64-teres-i.dts | 45 ++++++++++++++++++++--
|
||||
1 file changed, 41 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 1069e7012c9c..970415106dcf 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||
@@ -100,18 +100,41 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&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>;
|
||||
status = "okay";
|
||||
+
|
||||
+ anx6345: anx6345@38 {
|
||||
+ compatible = "analogix,anx6345";
|
||||
+ reg = <0x38>;
|
||||
+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
|
||||
+ dvdd25-supply = <®_dldo2>;
|
||||
+ dvdd12-supply = <®_dldo3>;
|
||||
+
|
||||
+ ports {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ port@0 {
|
||||
+ anx6345_in: endpoint {
|
||||
+ remote-endpoint = <&tcon0_out_anx6345>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&mixer0 {
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
&mmc0 {
|
||||
@@ -319,6 +342,20 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&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_pb_pins>;
|
|
@ -44,53 +44,11 @@ index c21f2331add6..8161895dde52 100644
|
|||
vcc-hdmi-supply = <®_dldo1>;
|
||||
};
|
||||
|
||||
+&sound_hdmi {
|
||||
+&hdmi_sound {
|
||||
+ 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
|
||||
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
From 8df6da42f1244573edd3d22d39dbe8fc66a01cbd Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Wed, 12 Feb 2020 00:01:29 +0800
|
||||
Subject: [PATCH] drm/bridge: analogix-anx6345: fix acquisition of the
|
||||
regulators
|
||||
|
||||
When calling regulator_get(), the regulator name should not contain
|
||||
"-supply" (it will be attached to the regulator name to construct the DT
|
||||
property name by regulator framework). However, the driver currently
|
||||
passed bogus "-supply", which breaks the support to its DT binding.
|
||||
|
||||
Fix this by remove the bogus "-supply" in regulator names.
|
||||
|
||||
Fixes: 6aa192698089 ("drm/bridge: Add Analogix anx6345 support")
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
---
|
||||
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||
index 56f55c53abfd8..0d8d083b02074 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||
@@ -712,14 +712,14 @@ static int anx6345_i2c_probe(struct i2c_client *client,
|
||||
DRM_DEBUG("No panel found\n");
|
||||
|
||||
/* 1.2V digital core power regulator */
|
||||
- anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
|
||||
+ anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12");
|
||||
if (IS_ERR(anx6345->dvdd12)) {
|
||||
DRM_ERROR("dvdd12-supply not found\n");
|
||||
return PTR_ERR(anx6345->dvdd12);
|
||||
}
|
||||
|
||||
/* 2.5V digital core power regulator */
|
||||
- anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
|
||||
+ anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25");
|
||||
if (IS_ERR(anx6345->dvdd25)) {
|
||||
DRM_ERROR("dvdd25-supply not found\n");
|
||||
return PTR_ERR(anx6345->dvdd25);
|
|
@ -1,39 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
From 0f5fc158851b63fd145b1b105376b8976eb4934d Mon Sep 17 00:00:00 2001
|
||||
From: Corentin Labbe <clabbe.montjoie@gmail.com>
|
||||
Date: Wed, 23 Oct 2019 22:05:08 +0200
|
||||
Subject: arm64: dts: allwinner: sun50i: Add Crypto Engine node on A64
|
||||
|
||||
The Crypto Engine is a hardware cryptographic accelerator that supports
|
||||
many algorithms.
|
||||
It could be found on most Allwinner SoCs.
|
||||
|
||||
This patch enables the Crypto Engine on the Allwinner A64 SoC Device-tree.
|
||||
|
||||
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index 69128a6dfc46..5daa398f9246 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -487,6 +487,15 @@
|
||||
reg = <0x1c14000 0x400>;
|
||||
};
|
||||
|
||||
+ crypto: crypto@1c15000 {
|
||||
+ compatible = "allwinner,sun50i-a64-crypto";
|
||||
+ reg = <0x01c15000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&ccu CLK_BUS_CE>, <&ccu CLK_CE>;
|
||||
+ clock-names = "bus", "mod";
|
||||
+ resets = <&ccu RST_BUS_CE>;
|
||||
+ };
|
||||
+
|
||||
usb_otg: usb@1c19000 {
|
||||
compatible = "allwinner,sun8i-a33-musb";
|
||||
reg = <0x01c19000 0x0400>;
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -1,91 +0,0 @@
|
|||
From b68d225323c9a479b26ee22a2cb4bf4eefe13cc5 Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Sun, 7 May 2017 14:41:24 +0800
|
||||
Subject: [PATCH] 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.
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
---
|
||||
.../dts/allwinner/sun50i-a64-pinebook.dts | 37 +++++++++++++++++++
|
||||
1 file changed, 37 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
index c06c540e6c08a..83f555a6995ce 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
@@ -109,6 +109,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&de {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ehci0 {
|
||||
phys = <&usbphy 0>;
|
||||
phy-names = "usb";
|
||||
@@ -119,6 +123,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&mixer0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&mmc0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&mmc0_pins>;
|
||||
@@ -183,6 +191,20 @@
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&r_i2c_pl89_pins>;
|
||||
status = "okay";
|
||||
+
|
||||
+ anx6345: anx6345@38 {
|
||||
+ compatible = "analogix,anx6345";
|
||||
+ reg = <0x38>;
|
||||
+ reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
|
||||
+ dvdd25-supply = <®_dldo2>;
|
||||
+ dvdd12-supply = <®_fldo1>;
|
||||
+
|
||||
+ port {
|
||||
+ anx6345_in: endpoint {
|
||||
+ remote-endpoint = <&tcon0_out_anx6345>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
|
||||
&r_pio {
|
||||
@@ -238,6 +260,7 @@
|
||||
|
||||
®_dc1sw {
|
||||
regulator-name = "vcc-lcd";
|
||||
+ regulator-always-on; // HACK
|
||||
};
|
||||
|
||||
®_dcdc1 {
|
||||
@@ -357,6 +380,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_pb_pins>;
|
|
@ -1,80 +0,0 @@
|
|||
From 16c8ff571a16f47592ae161f92737b2fd50a0e70 Mon Sep 17 00:00:00 2001
|
||||
From: Jagan Teki <jagan@amarulasolutions.com>
|
||||
Date: Sun, 22 Dec 2019 18:52:28 +0530
|
||||
Subject: arm64: dts: allwinner: a64: Add MIPI DSI pipeline
|
||||
|
||||
Add MIPI DSI pipeline for Allwinner A64.
|
||||
|
||||
- dsi node, with A64 compatible since it doesn't support
|
||||
DSI_SCLK gating unlike A33
|
||||
- dphy node, with A64 compatible with A33 fallback since
|
||||
DPHY on A64 and A33 is similar
|
||||
- finally, attach the dsi_in to tcon0 for complete MIPI DSI
|
||||
|
||||
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
|
||||
Tested-by: Merlijn Wajer <merlijn@wizzup.org>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 37 +++++++++++++++++++++++++++
|
||||
1 file changed, 37 insertions(+)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index 9a89324d02db..92688b89c2a4 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -367,6 +367,12 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
reg = <1>;
|
||||
+
|
||||
+ tcon0_out_dsi: endpoint@1 {
|
||||
+ reg = <1>;
|
||||
+ remote-endpoint = <&dsi_in_tcon0>;
|
||||
+ allwinner,tcon-channel = <1>;
|
||||
+ };
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1017,6 +1023,37 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ dsi: dsi@1ca0000 {
|
||||
+ compatible = "allwinner,sun50i-a64-mipi-dsi";
|
||||
+ reg = <0x01ca0000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&ccu CLK_BUS_MIPI_DSI>;
|
||||
+ resets = <&ccu RST_BUS_MIPI_DSI>;
|
||||
+ phys = <&dphy>;
|
||||
+ phy-names = "dphy";
|
||||
+ status = "disabled";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ port {
|
||||
+ dsi_in_tcon0: endpoint {
|
||||
+ remote-endpoint = <&tcon0_out_dsi>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ dphy: d-phy@1ca1000 {
|
||||
+ compatible = "allwinner,sun50i-a64-mipi-dphy",
|
||||
+ "allwinner,sun6i-a31-mipi-dphy";
|
||||
+ reg = <0x01ca1000 0x1000>;
|
||||
+ clocks = <&ccu CLK_BUS_MIPI_DSI>,
|
||||
+ <&ccu CLK_DSI_DPHY>;
|
||||
+ clock-names = "bus", "mod";
|
||||
+ resets = <&ccu RST_BUS_MIPI_DSI>;
|
||||
+ status = "disabled";
|
||||
+ #phy-cells = <0>;
|
||||
+ };
|
||||
+
|
||||
hdmi: hdmi@1ee0000 {
|
||||
compatible = "allwinner,sun50i-a64-dw-hdmi",
|
||||
"allwinner,sun8i-a83t-dw-hdmi";
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -2,19 +2,6 @@ diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/
|
|||
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>;
|
||||
};
|
||||
|
@ -49,23 +36,6 @@ index dc785da9c..141fd186b 100644
|
|||
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";
|
||||
|
@ -103,45 +73,6 @@ index dc785da9c..141fd186b 100644
|
|||
};
|
||||
|
||||
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>;
|
||||
@@ -963,6 +1033,19 @@
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
|
||||
From 61fd036d01111679b01e4b92e6bd0cdd33809aea Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Ribalda Delgado <ribalda@kernel.org>
|
||||
Date: Mon, 7 Oct 2019 12:06:33 -0300
|
||||
Subject: [PATCH] media: add V4L2_CID_UNIT_CELL_SIZE control
|
||||
|
||||
This control returns the unit cell size in nanometres. The struct provides
|
||||
the width and the height in separated fields to take into consideration
|
||||
asymmetric pixels and/or hardware binning.
|
||||
This control is required for automatic calibration of sensors/cameras.
|
||||
|
||||
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
|
||||
Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-ctrls.c | 5 +++++
|
||||
include/uapi/linux/v4l2-controls.h | 1 +
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
index 96cab2e173d3..bf50d37ef6c1 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
@@ -996,6 +996,7 @@ const char *v4l2_ctrl_get_name(u32 id)
|
||||
case V4L2_CID_AUTO_FOCUS_RANGE: return "Auto Focus, Range";
|
||||
case V4L2_CID_PAN_SPEED: return "Pan, Speed";
|
||||
case V4L2_CID_TILT_SPEED: return "Tilt, Speed";
|
||||
+ case V4L2_CID_UNIT_CELL_SIZE: return "Unit Cell Size";
|
||||
|
||||
/* FM Radio Modulator controls */
|
||||
/* Keep the order of the 'case's the same as in v4l2-controls.h! */
|
||||
@@ -1377,6 +1378,10 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type,
|
||||
case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER:
|
||||
*type = V4L2_CTRL_TYPE_VP8_FRAME_HEADER;
|
||||
break;
|
||||
+ case V4L2_CID_UNIT_CELL_SIZE:
|
||||
+ *type = V4L2_CTRL_TYPE_AREA;
|
||||
+ *flags |= V4L2_CTRL_FLAG_READ_ONLY;
|
||||
+ break;
|
||||
default:
|
||||
*type = V4L2_CTRL_TYPE_INTEGER;
|
||||
break;
|
||||
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
|
||||
index a2669b79b294..5a7bedee2b0e 100644
|
||||
--- a/include/uapi/linux/v4l2-controls.h
|
||||
+++ b/include/uapi/linux/v4l2-controls.h
|
||||
@@ -1034,6 +1034,7 @@ enum v4l2_jpeg_chroma_subsampling {
|
||||
#define V4L2_CID_TEST_PATTERN_GREENR (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 5)
|
||||
#define V4L2_CID_TEST_PATTERN_BLUE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 6)
|
||||
#define V4L2_CID_TEST_PATTERN_GREENB (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 7)
|
||||
+#define V4L2_CID_UNIT_CELL_SIZE (V4L2_CID_IMAGE_SOURCE_CLASS_BASE + 8)
|
||||
|
||||
|
||||
/* Image processing controls */
|
||||
--
|
||||
2.23.0
|
|
@ -1,92 +0,0 @@
|
|||
From 59f5e9b9a802a177727017218dcf026dc390c37d Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Thu, 19 Dec 2019 09:28:23 -0800
|
||||
Subject: arm64: dts: allwinner: a64: Add thermal sensors and thermal zones
|
||||
|
||||
A64 has 3 thermal sensors: 1 for CPU, 2 for GPU.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 42 +++++++++++++++++++++++++++
|
||||
1 file changed, 42 insertions(+)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index ab42c0664b3e..9a89324d02db 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -10,6 +10,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>;
|
||||
@@ -172,6 +173,29 @@
|
||||
(GIC_CPU_MASK_SIMPLE(4) | IRQ_TYPE_LEVEL_HIGH)>;
|
||||
};
|
||||
|
||||
+ thermal-zones {
|
||||
+ cpu_thermal: cpu0-thermal {
|
||||
+ /* milliseconds */
|
||||
+ polling-delay-passive = <0>;
|
||||
+ polling-delay = <0>;
|
||||
+ thermal-sensors = <&ths 0>;
|
||||
+ };
|
||||
+
|
||||
+ gpu0_thermal: gpu0-thermal {
|
||||
+ /* milliseconds */
|
||||
+ polling-delay-passive = <0>;
|
||||
+ polling-delay = <0>;
|
||||
+ thermal-sensors = <&ths 1>;
|
||||
+ };
|
||||
+
|
||||
+ gpu1_thermal: gpu1-thermal {
|
||||
+ /* milliseconds */
|
||||
+ polling-delay-passive = <0>;
|
||||
+ polling-delay = <0>;
|
||||
+ thermal-sensors = <&ths 2>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
soc {
|
||||
compatible = "simple-bus";
|
||||
#address-cells = <1>;
|
||||
@@ -446,6 +470,12 @@
|
||||
sid: eeprom@1c14000 {
|
||||
compatible = "allwinner,sun50i-a64-sid";
|
||||
reg = <0x1c14000 0x400>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ ths_calibration: thermal-sensor-calibration@34 {
|
||||
+ reg = <0x34 0x8>;
|
||||
+ };
|
||||
};
|
||||
|
||||
crypto: crypto@1c15000 {
|
||||
@@ -771,6 +801,18 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ ths: thermal-sensor@1c25000 {
|
||||
+ compatible = "allwinner,sun50i-a64-ths";
|
||||
+ reg = <0x01c25000 0x100>;
|
||||
+ clocks = <&ccu CLK_BUS_THS>, <&ccu CLK_THS>;
|
||||
+ clock-names = "bus", "mod";
|
||||
+ interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ resets = <&ccu RST_BUS_THS>;
|
||||
+ nvmem-cells = <&ths_calibration>;
|
||||
+ nvmem-cell-names = "calibration";
|
||||
+ #thermal-sensor-cells = <1>;
|
||||
+ };
|
||||
+
|
||||
uart0: serial@1c28000 {
|
||||
compatible = "snps,dw-apb-uart";
|
||||
reg = <0x01c28000 0x400>;
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
|
||||
From d1dc49370f8371b00e682ac409aa1987ce641e93 Mon Sep 17 00:00:00 2001
|
||||
From: Ricardo Ribalda Delgado <ribalda@kernel.org>
|
||||
Date: Mon, 7 Oct 2019 12:06:31 -0300
|
||||
Subject: [PATCH] media: add V4L2_CTRL_TYPE_AREA control type
|
||||
|
||||
This type contains the width and the height of a rectangular area.
|
||||
|
||||
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
||||
Signed-off-by: Ricardo Ribalda Delgado <ribalda@kernel.org>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-ctrls.c | 21 ++++++++++++++
|
||||
include/media/v4l2-ctrls.h | 42 ++++++++++++++++++++++++++++
|
||||
include/uapi/linux/videodev2.h | 6 ++++
|
||||
3 files changed, 69 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
index 219d8aeefa20..96cab2e173d3 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
|
||||
@@ -1677,6 +1677,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||
{
|
||||
struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params;
|
||||
struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
|
||||
+ struct v4l2_area *area;
|
||||
void *p = ptr.p + idx * ctrl->elem_size;
|
||||
|
||||
switch ((u32)ctrl->type) {
|
||||
@@ -1753,6 +1754,11 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx,
|
||||
zero_padding(p_vp8_frame_header->entropy_header);
|
||||
zero_padding(p_vp8_frame_header->coder_state);
|
||||
break;
|
||||
+ case V4L2_CTRL_TYPE_AREA:
|
||||
+ area = p;
|
||||
+ if (!area->width || !area->height)
|
||||
+ return -EINVAL;
|
||||
+ break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -2427,6 +2433,9 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
|
||||
case V4L2_CTRL_TYPE_VP8_FRAME_HEADER:
|
||||
elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header);
|
||||
break;
|
||||
+ case V4L2_CTRL_TYPE_AREA:
|
||||
+ elem_size = sizeof(struct v4l2_area);
|
||||
+ break;
|
||||
default:
|
||||
if (type < V4L2_CTRL_COMPOUND_TYPES)
|
||||
elem_size = sizeof(s32);
|
||||
@@ -4116,6 +4125,18 @@ int __v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
|
||||
}
|
||||
EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_string);
|
||||
|
||||
+int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
|
||||
+ const struct v4l2_area *area)
|
||||
+{
|
||||
+ lockdep_assert_held(ctrl->handler->lock);
|
||||
+
|
||||
+ /* It's a driver bug if this happens. */
|
||||
+ WARN_ON(ctrl->type != V4L2_CTRL_TYPE_AREA);
|
||||
+ *ctrl->p_new.p_area = *area;
|
||||
+ return set_ctrl(NULL, ctrl, 0);
|
||||
+}
|
||||
+EXPORT_SYMBOL(__v4l2_ctrl_s_ctrl_area);
|
||||
+
|
||||
void v4l2_ctrl_request_complete(struct media_request *req,
|
||||
struct v4l2_ctrl_handler *main_hdl)
|
||||
{
|
||||
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h
|
||||
index fb0883836548..c9ca867ef32b 100644
|
||||
--- a/include/media/v4l2-ctrls.h
|
||||
+++ b/include/media/v4l2-ctrls.h
|
||||
@@ -50,6 +50,7 @@ struct poll_table_struct;
|
||||
* @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params.
|
||||
* @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params.
|
||||
* @p_vp8_frame_header: Pointer to a VP8 frame header structure.
|
||||
+ * @p_area: Pointer to an area.
|
||||
* @p: Pointer to a compound value.
|
||||
*/
|
||||
union v4l2_ctrl_ptr {
|
||||
@@ -68,6 +69,7 @@ union v4l2_ctrl_ptr {
|
||||
struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
|
||||
struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
|
||||
struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header;
|
||||
+ struct v4l2_area *p_area;
|
||||
void *p;
|
||||
};
|
||||
|
||||
@@ -1087,6 +1089,46 @@ static inline int v4l2_ctrl_s_ctrl_string(struct v4l2_ctrl *ctrl, const char *s)
|
||||
return rval;
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * __v4l2_ctrl_s_ctrl_area() - Unlocked variant of v4l2_ctrl_s_ctrl_area().
|
||||
+ *
|
||||
+ * @ctrl: The control.
|
||||
+ * @area: The new area.
|
||||
+ *
|
||||
+ * This sets the control's new area safely by going through the control
|
||||
+ * framework. This function assumes the control's handler is already locked,
|
||||
+ * allowing it to be used from within the &v4l2_ctrl_ops functions.
|
||||
+ *
|
||||
+ * This function is for area type controls only.
|
||||
+ */
|
||||
+int __v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
|
||||
+ const struct v4l2_area *area);
|
||||
+
|
||||
+/**
|
||||
+ * v4l2_ctrl_s_ctrl_area() - Helper function to set a control's area value
|
||||
+ * from within a driver.
|
||||
+ *
|
||||
+ * @ctrl: The control.
|
||||
+ * @area: The new area.
|
||||
+ *
|
||||
+ * This sets the control's new area safely by going through the control
|
||||
+ * framework. This function will lock the control's handler, so it cannot be
|
||||
+ * used from within the &v4l2_ctrl_ops functions.
|
||||
+ *
|
||||
+ * This function is for area type controls only.
|
||||
+ */
|
||||
+static inline int v4l2_ctrl_s_ctrl_area(struct v4l2_ctrl *ctrl,
|
||||
+ const struct v4l2_area *area)
|
||||
+{
|
||||
+ int rval;
|
||||
+
|
||||
+ v4l2_ctrl_lock(ctrl);
|
||||
+ rval = __v4l2_ctrl_s_ctrl_area(ctrl, area);
|
||||
+ v4l2_ctrl_unlock(ctrl);
|
||||
+
|
||||
+ return rval;
|
||||
+}
|
||||
+
|
||||
/* Internal helper functions that deal with control events. */
|
||||
extern const struct v4l2_subscribed_event_ops v4l2_ctrl_sub_ev_ops;
|
||||
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 530638dffd93..b3c0961b62a0 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -422,6 +422,11 @@ struct v4l2_fract {
|
||||
__u32 denominator;
|
||||
};
|
||||
|
||||
+struct v4l2_area {
|
||||
+ __u32 width;
|
||||
+ __u32 height;
|
||||
+};
|
||||
+
|
||||
/**
|
||||
* struct v4l2_capability - Describes V4L2 device caps returned by VIDIOC_QUERYCAP
|
||||
*
|
||||
@@ -1720,6 +1725,7 @@ enum v4l2_ctrl_type {
|
||||
V4L2_CTRL_TYPE_U8 = 0x0100,
|
||||
V4L2_CTRL_TYPE_U16 = 0x0101,
|
||||
V4L2_CTRL_TYPE_U32 = 0x0102,
|
||||
+ V4L2_CTRL_TYPE_AREA = 0x0106,
|
||||
};
|
||||
|
||||
/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
|
||||
--
|
||||
2.23.0
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
From b71818cbda252fc0ceb09939518376141f3b63ce Mon Sep 17 00:00:00 2001
|
||||
From: Chen-Yu Tsai <wens@csie.org>
|
||||
Date: Mon, 6 Jan 2020 17:00:30 +0800
|
||||
Subject: arm64: dts: allwinner: sun50i-a64: Use macros for newly exported
|
||||
clocks
|
||||
|
||||
A few clocks from the CCU were exported later, and references to them in
|
||||
the device tree were using raw numbers.
|
||||
|
||||
Now that the DT binding header changes are in as well, switch to the
|
||||
macros for more clarity.
|
||||
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index 92688b89c2a4..293059ffbbf6 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -590,7 +590,7 @@
|
||||
interrupts = <GIC_SPI 11 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>;
|
||||
- clocks = <&ccu 58>, <&osc24M>, <&rtc 0>;
|
||||
+ clocks = <&ccu CLK_BUS_PIO>, <&osc24M>, <&rtc 0>;
|
||||
clock-names = "apb", "hosc", "losc";
|
||||
gpio-controller;
|
||||
#gpio-cells = <3>;
|
||||
@@ -1091,7 +1091,7 @@
|
||||
compatible = "allwinner,sun50i-a64-hdmi-phy";
|
||||
reg = <0x01ef0000 0x10000>;
|
||||
clocks = <&ccu CLK_BUS_HDMI>, <&ccu CLK_HDMI_DDC>,
|
||||
- <&ccu 7>;
|
||||
+ <&ccu CLK_PLL_VIDEO0>;
|
||||
clock-names = "bus", "mod", "pll-0";
|
||||
resets = <&ccu RST_BUS_HDMI0>;
|
||||
reset-names = "phy";
|
||||
@@ -1121,7 +1121,8 @@
|
||||
r_ccu: clock@1f01400 {
|
||||
compatible = "allwinner,sun50i-a64-r-ccu";
|
||||
reg = <0x01f01400 0x100>;
|
||||
- clocks = <&osc24M>, <&rtc 0>, <&rtc 2>, <&ccu 11>;
|
||||
+ clocks = <&osc24M>, <&rtc 0>, <&rtc 2>,
|
||||
+ <&ccu CLK_PLL_PERIPH0>;
|
||||
clock-names = "hosc", "losc", "iosc", "pll-periph";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,61 +0,0 @@
|
|||
From f267eff70c0c4f51765fcb2498444d7bc0048725 Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Tue, 7 Jan 2020 20:20:15 -0800
|
||||
Subject: arm64: dts: allwinner: a64: add CPU clock to CPU0-3 nodes
|
||||
|
||||
Add CPU clock to the CPU nodes since it is a prerequisite for enabling
|
||||
DVFS.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
[wens@csie.org: Replace CLK_CPUX macro with raw number]
|
||||
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index 293059ffbbf6..72eedd39a2eb 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -51,6 +51,8 @@
|
||||
reg = <0>;
|
||||
enable-method = "psci";
|
||||
next-level-cache = <&L2>;
|
||||
+ clocks = <&ccu 21>;
|
||||
+ clock-names = "cpu";
|
||||
};
|
||||
|
||||
cpu1: cpu@1 {
|
||||
@@ -59,6 +61,8 @@
|
||||
reg = <1>;
|
||||
enable-method = "psci";
|
||||
next-level-cache = <&L2>;
|
||||
+ clocks = <&ccu 21>;
|
||||
+ clock-names = "cpu";
|
||||
};
|
||||
|
||||
cpu2: cpu@2 {
|
||||
@@ -67,6 +71,8 @@
|
||||
reg = <2>;
|
||||
enable-method = "psci";
|
||||
next-level-cache = <&L2>;
|
||||
+ clocks = <&ccu 21>;
|
||||
+ clock-names = "cpu";
|
||||
};
|
||||
|
||||
cpu3: cpu@3 {
|
||||
@@ -75,6 +81,8 @@
|
||||
reg = <3>;
|
||||
enable-method = "psci";
|
||||
next-level-cache = <&L2>;
|
||||
+ clocks = <&ccu 21>;
|
||||
+ clock-names = "cpu";
|
||||
};
|
||||
|
||||
L2: l2-cache {
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
|
||||
From f8cca8c97a63d77f48334cde81d15014f43530ef Mon Sep 17 00:00:00 2001
|
||||
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Date: Fri, 11 Oct 2019 06:32:41 -0300
|
||||
Subject: [PATCH] media: v4l2-mem2mem: support held capture buffers
|
||||
|
||||
Check for held buffers that are ready to be returned to vb2 in
|
||||
__v4l2_m2m_try_queue(). This avoids drivers having to handle this
|
||||
case.
|
||||
|
||||
Add v4l2_m2m_buf_done_and_job_finish() to correctly return source
|
||||
and destination buffers and mark the job as finished while taking
|
||||
a held destination buffer into account (i.e. that buffer won't be
|
||||
returned). This has to be done while job_spinlock is held to avoid
|
||||
race conditions.
|
||||
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-mem2mem.c | 130 ++++++++++++++++++-------
|
||||
include/media/v4l2-mem2mem.h | 33 ++++++-
|
||||
2 files changed, 128 insertions(+), 35 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
index 19937dd3c6f6..79c3656f24f7 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
@@ -284,7 +284,8 @@ static void v4l2_m2m_try_run(struct v4l2_m2m_dev *m2m_dev)
|
||||
static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||
struct v4l2_m2m_ctx *m2m_ctx)
|
||||
{
|
||||
- unsigned long flags_job, flags_out, flags_cap;
|
||||
+ unsigned long flags_job;
|
||||
+ struct vb2_v4l2_buffer *dst, *src;
|
||||
|
||||
dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx);
|
||||
|
||||
@@ -307,20 +308,30 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||
goto job_unlock;
|
||||
}
|
||||
|
||||
- spin_lock_irqsave(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
||||
- if (list_empty(&m2m_ctx->out_q_ctx.rdy_queue)
|
||||
- && !m2m_ctx->out_q_ctx.buffered) {
|
||||
+ src = v4l2_m2m_next_src_buf(m2m_ctx);
|
||||
+ dst = v4l2_m2m_next_dst_buf(m2m_ctx);
|
||||
+ if (!src && !m2m_ctx->out_q_ctx.buffered) {
|
||||
dprintk("No input buffers available\n");
|
||||
- goto out_unlock;
|
||||
+ goto job_unlock;
|
||||
}
|
||||
- spin_lock_irqsave(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
||||
- if (list_empty(&m2m_ctx->cap_q_ctx.rdy_queue)
|
||||
- && !m2m_ctx->cap_q_ctx.buffered) {
|
||||
+ if (!dst && !m2m_ctx->cap_q_ctx.buffered) {
|
||||
dprintk("No output buffers available\n");
|
||||
- goto cap_unlock;
|
||||
+ goto job_unlock;
|
||||
+ }
|
||||
+
|
||||
+ if (src && dst &&
|
||||
+ dst->is_held && dst->vb2_buf.copied_timestamp &&
|
||||
+ dst->vb2_buf.timestamp != src->vb2_buf.timestamp) {
|
||||
+ dst->is_held = false;
|
||||
+ v4l2_m2m_dst_buf_remove(m2m_ctx);
|
||||
+ v4l2_m2m_buf_done(dst, VB2_BUF_STATE_DONE);
|
||||
+ dst = v4l2_m2m_next_dst_buf(m2m_ctx);
|
||||
+
|
||||
+ if (!dst && !m2m_ctx->cap_q_ctx.buffered) {
|
||||
+ dprintk("No output buffers available after returning held buffer\n");
|
||||
+ goto job_unlock;
|
||||
+ }
|
||||
}
|
||||
- spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
||||
- spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
||||
|
||||
if (m2m_dev->m2m_ops->job_ready
|
||||
&& (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {
|
||||
@@ -331,13 +342,6 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||
list_add_tail(&m2m_ctx->queue, &m2m_dev->job_queue);
|
||||
m2m_ctx->job_flags |= TRANS_QUEUED;
|
||||
|
||||
- spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
||||
- return;
|
||||
-
|
||||
-cap_unlock:
|
||||
- spin_unlock_irqrestore(&m2m_ctx->cap_q_ctx.rdy_spinlock, flags_cap);
|
||||
-out_unlock:
|
||||
- spin_unlock_irqrestore(&m2m_ctx->out_q_ctx.rdy_spinlock, flags_out);
|
||||
job_unlock:
|
||||
spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags_job);
|
||||
}
|
||||
@@ -412,37 +416,97 @@ static void v4l2_m2m_cancel_job(struct v4l2_m2m_ctx *m2m_ctx)
|
||||
}
|
||||
}
|
||||
|
||||
-void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
- struct v4l2_m2m_ctx *m2m_ctx)
|
||||
+/*
|
||||
+ * Schedule the next job, called from v4l2_m2m_job_finish() or
|
||||
+ * v4l2_m2m_buf_done_and_job_finish().
|
||||
+ */
|
||||
+static void v4l2_m2m_schedule_next_job(struct v4l2_m2m_dev *m2m_dev,
|
||||
+ struct v4l2_m2m_ctx *m2m_ctx)
|
||||
{
|
||||
- unsigned long flags;
|
||||
+ /*
|
||||
+ * This instance might have more buffers ready, but since we do not
|
||||
+ * allow more than one job on the job_queue per instance, each has
|
||||
+ * to be scheduled separately after the previous one finishes.
|
||||
+ */
|
||||
+ __v4l2_m2m_try_queue(m2m_dev, m2m_ctx);
|
||||
|
||||
- spin_lock_irqsave(&m2m_dev->job_spinlock, flags);
|
||||
+ /*
|
||||
+ * We might be running in atomic context,
|
||||
+ * but the job must be run in non-atomic context.
|
||||
+ */
|
||||
+ schedule_work(&m2m_dev->job_work);
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Assumes job_spinlock is held, called from v4l2_m2m_job_finish() or
|
||||
+ * v4l2_m2m_buf_done_and_job_finish().
|
||||
+ */
|
||||
+static bool _v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
+ struct v4l2_m2m_ctx *m2m_ctx)
|
||||
+{
|
||||
if (!m2m_dev->curr_ctx || m2m_dev->curr_ctx != m2m_ctx) {
|
||||
- spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
|
||||
dprintk("Called by an instance not currently running\n");
|
||||
- return;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
list_del(&m2m_dev->curr_ctx->queue);
|
||||
m2m_dev->curr_ctx->job_flags &= ~(TRANS_QUEUED | TRANS_RUNNING);
|
||||
wake_up(&m2m_dev->curr_ctx->finished);
|
||||
m2m_dev->curr_ctx = NULL;
|
||||
+ return true;
|
||||
+}
|
||||
|
||||
- spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
|
||||
-
|
||||
- /* This instance might have more buffers ready, but since we do not
|
||||
- * allow more than one job on the job_queue per instance, each has
|
||||
- * to be scheduled separately after the previous one finishes. */
|
||||
- __v4l2_m2m_try_queue(m2m_dev, m2m_ctx);
|
||||
+void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
+ struct v4l2_m2m_ctx *m2m_ctx)
|
||||
+{
|
||||
+ unsigned long flags;
|
||||
+ bool schedule_next;
|
||||
|
||||
- /* We might be running in atomic context,
|
||||
- * but the job must be run in non-atomic context.
|
||||
+ /*
|
||||
+ * This function should not be used for drivers that support
|
||||
+ * holding capture buffers. Those should use
|
||||
+ * v4l2_m2m_buf_done_and_job_finish() instead.
|
||||
*/
|
||||
- schedule_work(&m2m_dev->job_work);
|
||||
+ WARN_ON(m2m_ctx->cap_q_ctx.q.subsystem_flags &
|
||||
+ VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF);
|
||||
+ spin_lock_irqsave(&m2m_dev->job_spinlock, flags);
|
||||
+ schedule_next = _v4l2_m2m_job_finish(m2m_dev, m2m_ctx);
|
||||
+ spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
|
||||
+
|
||||
+ if (schedule_next)
|
||||
+ v4l2_m2m_schedule_next_job(m2m_dev, m2m_ctx);
|
||||
}
|
||||
EXPORT_SYMBOL(v4l2_m2m_job_finish);
|
||||
|
||||
+void v4l2_m2m_buf_done_and_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
+ struct v4l2_m2m_ctx *m2m_ctx,
|
||||
+ enum vb2_buffer_state state)
|
||||
+{
|
||||
+ struct vb2_v4l2_buffer *src_buf, *dst_buf;
|
||||
+ bool schedule_next = false;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&m2m_dev->job_spinlock, flags);
|
||||
+ src_buf = v4l2_m2m_src_buf_remove(m2m_ctx);
|
||||
+ dst_buf = v4l2_m2m_next_dst_buf(m2m_ctx);
|
||||
+
|
||||
+ if (WARN_ON(!src_buf || !dst_buf))
|
||||
+ goto unlock;
|
||||
+ v4l2_m2m_buf_done(src_buf, state);
|
||||
+ dst_buf->is_held = src_buf->flags & V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF;
|
||||
+ if (!dst_buf->is_held) {
|
||||
+ v4l2_m2m_dst_buf_remove(m2m_ctx);
|
||||
+ v4l2_m2m_buf_done(dst_buf, state);
|
||||
+ }
|
||||
+ schedule_next = _v4l2_m2m_job_finish(m2m_dev, m2m_ctx);
|
||||
+unlock:
|
||||
+ spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
|
||||
+
|
||||
+ if (schedule_next)
|
||||
+ v4l2_m2m_schedule_next_job(m2m_dev, m2m_ctx);
|
||||
+}
|
||||
+EXPORT_SYMBOL(v4l2_m2m_buf_done_and_job_finish);
|
||||
+
|
||||
int v4l2_m2m_reqbufs(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
struct v4l2_requestbuffers *reqbufs)
|
||||
{
|
||||
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
|
||||
index 0b9c3a287061..229d9f5d4370 100644
|
||||
--- a/include/media/v4l2-mem2mem.h
|
||||
+++ b/include/media/v4l2-mem2mem.h
|
||||
@@ -21,7 +21,8 @@
|
||||
* callback.
|
||||
* The job does NOT have to end before this callback returns
|
||||
* (and it will be the usual case). When the job finishes,
|
||||
- * v4l2_m2m_job_finish() has to be called.
|
||||
+ * v4l2_m2m_job_finish() or v4l2_m2m_buf_done_and_job_finish()
|
||||
+ * has to be called.
|
||||
* @job_ready: optional. Should return 0 if the driver does not have a job
|
||||
* fully prepared to run yet (i.e. it will not be able to finish a
|
||||
* transaction without sleeping). If not provided, it will be
|
||||
@@ -33,7 +34,8 @@
|
||||
* stop the device safely; e.g. in the next interrupt handler),
|
||||
* even if the transaction would not have been finished by then.
|
||||
* After the driver performs the necessary steps, it has to call
|
||||
- * v4l2_m2m_job_finish() (as if the transaction ended normally).
|
||||
+ * v4l2_m2m_job_finish() or v4l2_m2m_buf_done_and_job_finish() as
|
||||
+ * if the transaction ended normally.
|
||||
* This function does not have to (and will usually not) wait
|
||||
* until the device enters a state when it can be stopped.
|
||||
*/
|
||||
@@ -173,6 +175,33 @@ void v4l2_m2m_try_schedule(struct v4l2_m2m_ctx *m2m_ctx);
|
||||
void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
struct v4l2_m2m_ctx *m2m_ctx);
|
||||
|
||||
+/**
|
||||
+ * v4l2_m2m_buf_done_and_job_finish() - return source/destination buffers with
|
||||
+ * state and inform the framework that a job has been finished and have it
|
||||
+ * clean up
|
||||
+ *
|
||||
+ * @m2m_dev: opaque pointer to the internal data to handle M2M context
|
||||
+ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx
|
||||
+ * @state: vb2 buffer state passed to v4l2_m2m_buf_done().
|
||||
+ *
|
||||
+ * Drivers that set V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF must use this
|
||||
+ * function instead of job_finish() to take held buffers into account. It is
|
||||
+ * optional for other drivers.
|
||||
+ *
|
||||
+ * This function removes the source buffer from the ready list and returns
|
||||
+ * it with the given state. The same is done for the destination buffer, unless
|
||||
+ * it is marked 'held'. In that case the buffer is kept on the ready list.
|
||||
+ *
|
||||
+ * After that the job is finished (see job_finish()).
|
||||
+ *
|
||||
+ * This allows for multiple output buffers to be used to fill in a single
|
||||
+ * capture buffer. This is typically used by stateless decoders where
|
||||
+ * multiple e.g. H.264 slices contribute to a single decoded frame.
|
||||
+ */
|
||||
+void v4l2_m2m_buf_done_and_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
+ struct v4l2_m2m_ctx *m2m_ctx,
|
||||
+ enum vb2_buffer_state state);
|
||||
+
|
||||
static inline void
|
||||
v4l2_m2m_buf_done(struct vb2_v4l2_buffer *buf, enum vb2_buffer_state state)
|
||||
{
|
||||
--
|
||||
2.23.0
|
|
@ -1,104 +0,0 @@
|
|||
From e1c3804a177418fe14d95f0c4ccba5ae66f73d82 Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Tue, 7 Jan 2020 20:20:16 -0800
|
||||
Subject: arm64: dts: allwinner: a64: add cooling maps and thermal tripping
|
||||
points
|
||||
|
||||
Add cooling maps and thermal tripping points to prevent CPU overheating when
|
||||
running at the highest frequency. Tripping points are taken from A33 dts since
|
||||
A64 user manual doesn't mention when we should start throttling.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 44 +++++++++++++++++++++++++++
|
||||
1 file changed, 44 insertions(+)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
index 72eedd39a2eb..862b47dc9dc9 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
||||
@@ -53,6 +53,7 @@
|
||||
next-level-cache = <&L2>;
|
||||
clocks = <&ccu 21>;
|
||||
clock-names = "cpu";
|
||||
+ #cooling-cells = <2>;
|
||||
};
|
||||
|
||||
cpu1: cpu@1 {
|
||||
@@ -63,6 +64,7 @@
|
||||
next-level-cache = <&L2>;
|
||||
clocks = <&ccu 21>;
|
||||
clock-names = "cpu";
|
||||
+ #cooling-cells = <2>;
|
||||
};
|
||||
|
||||
cpu2: cpu@2 {
|
||||
@@ -73,6 +75,7 @@
|
||||
next-level-cache = <&L2>;
|
||||
clocks = <&ccu 21>;
|
||||
clock-names = "cpu";
|
||||
+ #cooling-cells = <2>;
|
||||
};
|
||||
|
||||
cpu3: cpu@3 {
|
||||
@@ -83,6 +86,7 @@
|
||||
next-level-cache = <&L2>;
|
||||
clocks = <&ccu 21>;
|
||||
clock-names = "cpu";
|
||||
+ #cooling-cells = <2>;
|
||||
};
|
||||
|
||||
L2: l2-cache {
|
||||
@@ -187,6 +191,46 @@
|
||||
polling-delay-passive = <0>;
|
||||
polling-delay = <0>;
|
||||
thermal-sensors = <&ths 0>;
|
||||
+
|
||||
+ cooling-maps {
|
||||
+ map0 {
|
||||
+ trip = <&cpu_alert0>;
|
||||
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ };
|
||||
+ map1 {
|
||||
+ trip = <&cpu_alert1>;
|
||||
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
+ <&cpu3 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 {
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
|
||||
From bef41d93aac64b54c3008ca6170bec54f85784f5 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Fri, 11 Oct 2019 06:32:43 -0300
|
||||
Subject: [PATCH] media: v4l2-mem2mem: add stateless_(try_)decoder_cmd ioctl
|
||||
helpers
|
||||
|
||||
These helpers are used by stateless codecs when they support multiple
|
||||
slices per frame and hold capture buffer flag is set. It's expected that
|
||||
all such codecs will use this code.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Co-developed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-mem2mem.c | 53 ++++++++++++++++++++++++++
|
||||
include/media/v4l2-mem2mem.h | 4 ++
|
||||
2 files changed, 57 insertions(+)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
index 79c3656f24f7..b46d2c388349 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
@@ -1218,6 +1218,59 @@ int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_try_decoder_cmd);
|
||||
|
||||
+int v4l2_m2m_ioctl_stateless_try_decoder_cmd(struct file *file, void *fh,
|
||||
+ struct v4l2_decoder_cmd *dc)
|
||||
+{
|
||||
+ if (dc->cmd != V4L2_DEC_CMD_FLUSH)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ dc->flags = 0;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_stateless_try_decoder_cmd);
|
||||
+
|
||||
+int v4l2_m2m_ioctl_stateless_decoder_cmd(struct file *file, void *priv,
|
||||
+ struct v4l2_decoder_cmd *dc)
|
||||
+{
|
||||
+ struct v4l2_fh *fh = file->private_data;
|
||||
+ struct vb2_v4l2_buffer *out_vb, *cap_vb;
|
||||
+ struct v4l2_m2m_dev *m2m_dev = fh->m2m_ctx->m2m_dev;
|
||||
+ unsigned long flags;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = v4l2_m2m_ioctl_stateless_try_decoder_cmd(file, priv, dc);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+
|
||||
+ spin_lock_irqsave(&m2m_dev->job_spinlock, flags);
|
||||
+ out_vb = v4l2_m2m_last_src_buf(fh->m2m_ctx);
|
||||
+ cap_vb = v4l2_m2m_last_dst_buf(fh->m2m_ctx);
|
||||
+
|
||||
+ /*
|
||||
+ * If there is an out buffer pending, then clear any HOLD flag.
|
||||
+ *
|
||||
+ * By clearing this flag we ensure that when this output
|
||||
+ * buffer is processed any held capture buffer will be released.
|
||||
+ */
|
||||
+ if (out_vb) {
|
||||
+ out_vb->flags &= ~V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF;
|
||||
+ } else if (cap_vb && cap_vb->is_held) {
|
||||
+ /*
|
||||
+ * If there were no output buffers, but there is a
|
||||
+ * capture buffer that is held, then release that
|
||||
+ * buffer.
|
||||
+ */
|
||||
+ cap_vb->is_held = false;
|
||||
+ v4l2_m2m_dst_buf_remove(fh->m2m_ctx);
|
||||
+ v4l2_m2m_buf_done(cap_vb, VB2_BUF_STATE_DONE);
|
||||
+ }
|
||||
+ spin_unlock_irqrestore(&m2m_dev->job_spinlock, flags);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_stateless_decoder_cmd);
|
||||
+
|
||||
/*
|
||||
* v4l2_file_operations helpers. It is assumed here same lock is used
|
||||
* for the output and the capture buffer queue.
|
||||
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
|
||||
index 229d9f5d4370..3d9e48ed8817 100644
|
||||
--- a/include/media/v4l2-mem2mem.h
|
||||
+++ b/include/media/v4l2-mem2mem.h
|
||||
@@ -701,6 +701,10 @@ int v4l2_m2m_ioctl_try_encoder_cmd(struct file *file, void *fh,
|
||||
struct v4l2_encoder_cmd *ec);
|
||||
int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh,
|
||||
struct v4l2_decoder_cmd *dc);
|
||||
+int v4l2_m2m_ioctl_stateless_try_decoder_cmd(struct file *file, void *fh,
|
||||
+ struct v4l2_decoder_cmd *dc);
|
||||
+int v4l2_m2m_ioctl_stateless_decoder_cmd(struct file *file, void *priv,
|
||||
+ struct v4l2_decoder_cmd *dc);
|
||||
int v4l2_m2m_fop_mmap(struct file *file, struct vm_area_struct *vma);
|
||||
__poll_t v4l2_m2m_fop_poll(struct file *file, poll_table *wait);
|
||||
|
||||
--
|
||||
2.23.0
|
|
@ -1,101 +0,0 @@
|
|||
From 51b3eaba8ad742ab72131ef436208312f0b70605 Mon Sep 17 00:00:00 2001
|
||||
From: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Date: Tue, 7 Jan 2020 20:20:17 -0800
|
||||
Subject: arm64: dts: allwinner: a64: add dtsi with CPU operating points
|
||||
|
||||
Add operating points for A64. These are taken from FEX file from BSP
|
||||
for A64.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
---
|
||||
.../boot/dts/allwinner/sun50i-a64-cpu-opp.dtsi | 75 ++++++++++++++++++++++
|
||||
1 file changed, 75 insertions(+)
|
||||
create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-a64-cpu-opp.dtsi
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64-cpu-opp.dtsi')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-cpu-opp.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-cpu-opp.dtsi
|
||||
new file mode 100644
|
||||
index 000000000000..578c37490d90
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-cpu-opp.dtsi
|
||||
@@ -0,0 +1,75 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (C) 2020 Vasily khoruzhick <anarsoul@gmail.com>
|
||||
+ */
|
||||
+
|
||||
+/ {
|
||||
+ cpu0_opp_table: opp_table0 {
|
||||
+ compatible = "operating-points-v2";
|
||||
+ opp-shared;
|
||||
+
|
||||
+ 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 = <1260000>;
|
||||
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
+ };
|
||||
+
|
||||
+ opp-1152000000 {
|
||||
+ opp-hz = /bits/ 64 <1152000000>;
|
||||
+ opp-microvolt = <1300000>;
|
||||
+ clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&cpu0 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ operating-points-v2 = <&cpu0_opp_table>;
|
||||
+};
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
|
||||
From f07602ac388723233e9e3c5a05b54baf34e0a3e9 Mon Sep 17 00:00:00 2001
|
||||
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Date: Fri, 11 Oct 2019 06:32:44 -0300
|
||||
Subject: [PATCH] media: v4l2-mem2mem: add new_frame detection
|
||||
|
||||
Drivers that support VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF
|
||||
typically want to know if a new frame is started (i.e. the first
|
||||
slice is about to be processed). Add a new_frame bool to v4l2_m2m_ctx
|
||||
and set it accordingly.
|
||||
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-mem2mem.c | 11 +++++++++--
|
||||
include/media/v4l2-mem2mem.h | 7 +++++++
|
||||
2 files changed, 16 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
index b46d2c388349..db07ef3bf3d0 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
@@ -319,8 +319,10 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||
goto job_unlock;
|
||||
}
|
||||
|
||||
- if (src && dst &&
|
||||
- dst->is_held && dst->vb2_buf.copied_timestamp &&
|
||||
+ m2m_ctx->new_frame = true;
|
||||
+
|
||||
+ if (src && dst && dst->is_held &&
|
||||
+ dst->vb2_buf.copied_timestamp &&
|
||||
dst->vb2_buf.timestamp != src->vb2_buf.timestamp) {
|
||||
dst->is_held = false;
|
||||
v4l2_m2m_dst_buf_remove(m2m_ctx);
|
||||
@@ -333,6 +335,11 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||
}
|
||||
}
|
||||
|
||||
+ if (src && dst && (m2m_ctx->cap_q_ctx.q.subsystem_flags &
|
||||
+ VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF))
|
||||
+ m2m_ctx->new_frame = !dst->vb2_buf.copied_timestamp ||
|
||||
+ dst->vb2_buf.timestamp != src->vb2_buf.timestamp;
|
||||
+
|
||||
if (m2m_dev->m2m_ops->job_ready
|
||||
&& (!m2m_dev->m2m_ops->job_ready(m2m_ctx->priv))) {
|
||||
dprintk("Driver not ready\n");
|
||||
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
|
||||
index 3d9e48ed8817..1d85e24791e4 100644
|
||||
--- a/include/media/v4l2-mem2mem.h
|
||||
+++ b/include/media/v4l2-mem2mem.h
|
||||
@@ -75,6 +75,11 @@ struct v4l2_m2m_queue_ctx {
|
||||
* struct v4l2_m2m_ctx - Memory to memory context structure
|
||||
*
|
||||
* @q_lock: struct &mutex lock
|
||||
+ * @new_frame: valid in the device_run callback: if true, then this
|
||||
+ * starts a new frame; if false, then this is a new slice
|
||||
+ * for an existing frame. This is always true unless
|
||||
+ * V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF is set, which
|
||||
+ * indicates slicing support.
|
||||
* @m2m_dev: opaque pointer to the internal data to handle M2M context
|
||||
* @cap_q_ctx: Capture (output to memory) queue context
|
||||
* @out_q_ctx: Output (input from memory) queue context
|
||||
@@ -91,6 +96,8 @@ struct v4l2_m2m_ctx {
|
||||
/* optional cap/out vb2 queues lock */
|
||||
struct mutex *q_lock;
|
||||
|
||||
+ bool new_frame;
|
||||
+
|
||||
/* internal use only */
|
||||
struct v4l2_m2m_dev *m2m_dev;
|
||||
|
||||
--
|
||||
2.23.0
|
|
@ -1,199 +0,0 @@
|
|||
|
||||
From 137272cdf7cc5be835f44216e6003769d1638480 Mon Sep 17 00:00:00 2001
|
||||
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Date: Fri, 11 Oct 2019 06:32:40 -0300
|
||||
Subject: [PATCH] media: vb2: add V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF
|
||||
|
||||
This patch adds support for the V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF
|
||||
flag.
|
||||
|
||||
It also adds a new V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF
|
||||
capability.
|
||||
|
||||
Drivers should set vb2_queue->subsystem_flags to
|
||||
VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF to indicate support
|
||||
for this flag.
|
||||
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
Documentation/media/uapi/v4l/buffer.rst | 13 +++++++++++++
|
||||
Documentation/media/uapi/v4l/vidioc-reqbufs.rst | 6 ++++++
|
||||
drivers/media/common/videobuf2/videobuf2-v4l2.c | 12 ++++++++++--
|
||||
include/media/videobuf2-core.h | 3 +++
|
||||
include/media/videobuf2-v4l2.h | 5 +++++
|
||||
include/uapi/linux/videodev2.h | 13 ++++++++-----
|
||||
6 files changed, 45 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/buffer.rst b/Documentation/media/uapi/v4l/buffer.rst
|
||||
index 1cbd9cde57f3..9149b57728e5 100644
|
||||
--- a/Documentation/media/uapi/v4l/buffer.rst
|
||||
+++ b/Documentation/media/uapi/v4l/buffer.rst
|
||||
@@ -607,6 +607,19 @@ Buffer Flags
|
||||
applications shall use this flag for output buffers if the data in
|
||||
this buffer has not been created by the CPU but by some
|
||||
DMA-capable unit, in which case caches have not been used.
|
||||
+ * .. _`V4L2-BUF-FLAG-M2M-HOLD-CAPTURE-BUF`:
|
||||
+
|
||||
+ - ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF``
|
||||
+ - 0x00000200
|
||||
+ - Only valid if ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF`` is
|
||||
+ set. It is typically used with stateless decoders where multiple
|
||||
+ output buffers each decode to a slice of the decoded frame.
|
||||
+ Applications can set this flag when queueing the output buffer
|
||||
+ to prevent the driver from dequeueing the capture buffer after
|
||||
+ the output buffer has been decoded (i.e. the capture buffer is
|
||||
+ 'held'). If the timestamp of this output buffer differs from that
|
||||
+ of the previous output buffer, then that indicates the start of a
|
||||
+ new frame and the previously held capture buffer is dequeued.
|
||||
* .. _`V4L2-BUF-FLAG-LAST`:
|
||||
|
||||
- ``V4L2_BUF_FLAG_LAST``
|
||||
diff --git a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst
|
||||
index d7faef10e39b..d0c643db477a 100644
|
||||
--- a/Documentation/media/uapi/v4l/vidioc-reqbufs.rst
|
||||
+++ b/Documentation/media/uapi/v4l/vidioc-reqbufs.rst
|
||||
@@ -125,6 +125,7 @@ aborting or finishing any DMA in progress, an implicit
|
||||
.. _V4L2-BUF-CAP-SUPPORTS-DMABUF:
|
||||
.. _V4L2-BUF-CAP-SUPPORTS-REQUESTS:
|
||||
.. _V4L2-BUF-CAP-SUPPORTS-ORPHANED-BUFS:
|
||||
+.. _V4L2-BUF-CAP-SUPPORTS-M2M-HOLD-CAPTURE-BUF:
|
||||
|
||||
.. cssclass:: longtable
|
||||
|
||||
@@ -150,6 +151,11 @@ aborting or finishing any DMA in progress, an implicit
|
||||
- The kernel allows calling :ref:`VIDIOC_REQBUFS` while buffers are still
|
||||
mapped or exported via DMABUF. These orphaned buffers will be freed
|
||||
when they are unmapped or when the exported DMABUF fds are closed.
|
||||
+ * - ``V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF``
|
||||
+ - 0x00000020
|
||||
+ - Only valid for stateless decoders. If set, then userspace can set the
|
||||
+ ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag to hold off on returning the
|
||||
+ capture buffer until the OUTPUT timestamp changes.
|
||||
|
||||
Return Value
|
||||
============
|
||||
diff --git a/drivers/media/common/videobuf2/videobuf2-v4l2.c b/drivers/media/common/videobuf2/videobuf2-v4l2.c
|
||||
index 5a9ba3846f0a..e652f4318284 100644
|
||||
--- a/drivers/media/common/videobuf2/videobuf2-v4l2.c
|
||||
+++ b/drivers/media/common/videobuf2/videobuf2-v4l2.c
|
||||
@@ -49,8 +49,11 @@ module_param(debug, int, 0644);
|
||||
V4L2_BUF_FLAG_REQUEST_FD | \
|
||||
V4L2_BUF_FLAG_TIMESTAMP_MASK)
|
||||
/* Output buffer flags that should be passed on to the driver */
|
||||
-#define V4L2_BUFFER_OUT_FLAGS (V4L2_BUF_FLAG_PFRAME | V4L2_BUF_FLAG_BFRAME | \
|
||||
- V4L2_BUF_FLAG_KEYFRAME | V4L2_BUF_FLAG_TIMECODE)
|
||||
+#define V4L2_BUFFER_OUT_FLAGS (V4L2_BUF_FLAG_PFRAME | \
|
||||
+ V4L2_BUF_FLAG_BFRAME | \
|
||||
+ V4L2_BUF_FLAG_KEYFRAME | \
|
||||
+ V4L2_BUF_FLAG_TIMECODE | \
|
||||
+ V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF)
|
||||
|
||||
/*
|
||||
* __verify_planes_array() - verify that the planes array passed in struct
|
||||
@@ -194,6 +197,7 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b
|
||||
}
|
||||
vbuf->sequence = 0;
|
||||
vbuf->request_fd = -1;
|
||||
+ vbuf->is_held = false;
|
||||
|
||||
if (V4L2_TYPE_IS_MULTIPLANAR(b->type)) {
|
||||
switch (b->memory) {
|
||||
@@ -321,6 +325,8 @@ static int vb2_fill_vb2_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b
|
||||
*/
|
||||
vbuf->flags &= ~V4L2_BUF_FLAG_TIMECODE;
|
||||
vbuf->field = b->field;
|
||||
+ if (!(q->subsystem_flags & VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF))
|
||||
+ vbuf->flags &= ~V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF;
|
||||
} else {
|
||||
/* Zero any output buffer flags as this is a capture buffer */
|
||||
vbuf->flags &= ~V4L2_BUFFER_OUT_FLAGS;
|
||||
@@ -654,6 +660,8 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
|
||||
*caps |= V4L2_BUF_CAP_SUPPORTS_USERPTR;
|
||||
if (q->io_modes & VB2_DMABUF)
|
||||
*caps |= V4L2_BUF_CAP_SUPPORTS_DMABUF;
|
||||
+ if (q->subsystem_flags & VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF)
|
||||
+ *caps |= V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF;
|
||||
#ifdef CONFIG_MEDIA_CONTROLLER_REQUEST_API
|
||||
if (q->supports_requests)
|
||||
*caps |= V4L2_BUF_CAP_SUPPORTS_REQUESTS;
|
||||
diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h
|
||||
index 640aabe69450..a2b2208b02da 100644
|
||||
--- a/include/media/videobuf2-core.h
|
||||
+++ b/include/media/videobuf2-core.h
|
||||
@@ -505,6 +505,8 @@ struct vb2_buf_ops {
|
||||
* @buf_ops: callbacks to deliver buffer information.
|
||||
* between user-space and kernel-space.
|
||||
* @drv_priv: driver private data.
|
||||
+ * @subsystem_flags: Flags specific to the subsystem (V4L2/DVB/etc.). Not used
|
||||
+ * by the vb2 core.
|
||||
* @buf_struct_size: size of the driver-specific buffer structure;
|
||||
* "0" indicates the driver doesn't want to use a custom buffer
|
||||
* structure type. for example, ``sizeof(struct vb2_v4l2_buffer)``
|
||||
@@ -571,6 +573,7 @@ struct vb2_queue {
|
||||
const struct vb2_buf_ops *buf_ops;
|
||||
|
||||
void *drv_priv;
|
||||
+ u32 subsystem_flags;
|
||||
unsigned int buf_struct_size;
|
||||
u32 timestamp_flags;
|
||||
gfp_t gfp_flags;
|
||||
diff --git a/include/media/videobuf2-v4l2.h b/include/media/videobuf2-v4l2.h
|
||||
index 8a10889dc2fd..59bf33a12648 100644
|
||||
--- a/include/media/videobuf2-v4l2.h
|
||||
+++ b/include/media/videobuf2-v4l2.h
|
||||
@@ -33,6 +33,7 @@
|
||||
* @timecode: frame timecode.
|
||||
* @sequence: sequence count of this frame.
|
||||
* @request_fd: the request_fd associated with this buffer
|
||||
+ * @is_held: if true, then this capture buffer was held
|
||||
* @planes: plane information (userptr/fd, length, bytesused, data_offset).
|
||||
*
|
||||
* Should contain enough information to be able to cover all the fields
|
||||
@@ -46,9 +47,13 @@ struct vb2_v4l2_buffer {
|
||||
struct v4l2_timecode timecode;
|
||||
__u32 sequence;
|
||||
__s32 request_fd;
|
||||
+ bool is_held;
|
||||
struct vb2_plane planes[VB2_MAX_PLANES];
|
||||
};
|
||||
|
||||
+/* VB2 V4L2 flags as set in vb2_queue.subsystem_flags */
|
||||
+#define VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 0)
|
||||
+
|
||||
/*
|
||||
* to_vb2_v4l2_buffer() - cast struct vb2_buffer * to struct vb2_v4l2_buffer *
|
||||
*/
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index b3c0961b62a0..9f4e66affac4 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -920,11 +920,12 @@ struct v4l2_requestbuffers {
|
||||
};
|
||||
|
||||
/* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */
|
||||
-#define V4L2_BUF_CAP_SUPPORTS_MMAP (1 << 0)
|
||||
-#define V4L2_BUF_CAP_SUPPORTS_USERPTR (1 << 1)
|
||||
-#define V4L2_BUF_CAP_SUPPORTS_DMABUF (1 << 2)
|
||||
-#define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3)
|
||||
-#define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4)
|
||||
+#define V4L2_BUF_CAP_SUPPORTS_MMAP (1 << 0)
|
||||
+#define V4L2_BUF_CAP_SUPPORTS_USERPTR (1 << 1)
|
||||
+#define V4L2_BUF_CAP_SUPPORTS_DMABUF (1 << 2)
|
||||
+#define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3)
|
||||
+#define V4L2_BUF_CAP_SUPPORTS_ORPHANED_BUFS (1 << 4)
|
||||
+#define V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF (1 << 5)
|
||||
|
||||
/**
|
||||
* struct v4l2_plane - plane info for multi-planar buffers
|
||||
@@ -1046,6 +1047,8 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv)
|
||||
#define V4L2_BUF_FLAG_IN_REQUEST 0x00000080
|
||||
/* timecode field is valid */
|
||||
#define V4L2_BUF_FLAG_TIMECODE 0x00000100
|
||||
+/* Don't return the capture buffer until OUTPUT timestamp changes */
|
||||
+#define V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF 0x00000200
|
||||
/* Buffer is prepared for queuing */
|
||||
#define V4L2_BUF_FLAG_PREPARED 0x00000400
|
||||
/* Cache handling flags */
|
||||
--
|
||||
2.23.0
|
|
@ -1,66 +0,0 @@
|
|||
|
||||
From bac06ec36ea2012ff0daa9767d0f77bf9c6064ec Mon Sep 17 00:00:00 2001
|
||||
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Date: Fri, 11 Oct 2019 06:32:42 -0300
|
||||
Subject: [PATCH] media: videodev2.h: add V4L2_DEC_CMD_FLUSH
|
||||
|
||||
Add this new V4L2_DEC_CMD_FLUSH decoder command and document it.
|
||||
|
||||
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
|
||||
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst | 10 +++++++++-
|
||||
Documentation/media/videodev2.h.rst.exceptions | 1 +
|
||||
include/uapi/linux/videodev2.h | 1 +
|
||||
3 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst
|
||||
index 57f0066f4cff..f1a504836f31 100644
|
||||
--- a/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst
|
||||
+++ b/Documentation/media/uapi/v4l/vidioc-decoder-cmd.rst
|
||||
@@ -208,7 +208,15 @@ introduced in Linux 3.3. They are, however, mandatory for stateful mem2mem decod
|
||||
been started yet, the driver will return an ``EPERM`` error code. When
|
||||
the decoder is already running, this command does nothing. No
|
||||
flags are defined for this command.
|
||||
-
|
||||
+ * - ``V4L2_DEC_CMD_FLUSH``
|
||||
+ - 4
|
||||
+ - Flush any held capture buffers. Only valid for stateless decoders.
|
||||
+ This command is typically used when the application reached the
|
||||
+ end of the stream and the last output buffer had the
|
||||
+ ``V4L2_BUF_FLAG_M2M_HOLD_CAPTURE_BUF`` flag set. This would prevent
|
||||
+ dequeueing the capture buffer containing the last decoded frame.
|
||||
+ So this command can be used to explicitly flush that final decoded
|
||||
+ frame. This command does nothing if there are no held capture buffers.
|
||||
|
||||
Return Value
|
||||
============
|
||||
diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions
|
||||
index b58e381bdf7b..c23e5ef30c78 100644
|
||||
--- a/Documentation/media/videodev2.h.rst.exceptions
|
||||
+++ b/Documentation/media/videodev2.h.rst.exceptions
|
||||
@@ -435,6 +435,7 @@ replace define V4L2_DEC_CMD_START decoder-cmds
|
||||
replace define V4L2_DEC_CMD_STOP decoder-cmds
|
||||
replace define V4L2_DEC_CMD_PAUSE decoder-cmds
|
||||
replace define V4L2_DEC_CMD_RESUME decoder-cmds
|
||||
+replace define V4L2_DEC_CMD_FLUSH decoder-cmds
|
||||
|
||||
replace define V4L2_DEC_CMD_START_MUTE_AUDIO decoder-cmds
|
||||
replace define V4L2_DEC_CMD_PAUSE_TO_BLACK decoder-cmds
|
||||
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
|
||||
index 9f4e66affac4..d969842bbfe2 100644
|
||||
--- a/include/uapi/linux/videodev2.h
|
||||
+++ b/include/uapi/linux/videodev2.h
|
||||
@@ -1984,6 +1984,7 @@ struct v4l2_encoder_cmd {
|
||||
#define V4L2_DEC_CMD_STOP (1)
|
||||
#define V4L2_DEC_CMD_PAUSE (2)
|
||||
#define V4L2_DEC_CMD_RESUME (3)
|
||||
+#define V4L2_DEC_CMD_FLUSH (4)
|
||||
|
||||
/* Flags for V4L2_DEC_CMD_START */
|
||||
#define V4L2_DEC_CMD_START_MUTE_AUDIO (1 << 0)
|
||||
--
|
||||
2.23.0
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
From 7119ecef4e5ec51e45e6fbe1b5da4385fcae8ded Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Wed, 6 Nov 2019 08:02:53 +0100
|
||||
Subject: [PATCH] media: v4l2-mem2mem: Fix hold buf flag checks
|
||||
|
||||
Hold buf flag is set on output queue, not capture. Fix that.
|
||||
|
||||
Fixes: f07602ac3887 ("media: v4l2-mem2mem: add new_frame detection")
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-mem2mem.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
index db07ef3bf3d0..1afd9c6ad908 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
@@ -335,7 +335,7 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev,
|
||||
}
|
||||
}
|
||||
|
||||
- if (src && dst && (m2m_ctx->cap_q_ctx.q.subsystem_flags &
|
||||
+ if (src && dst && (m2m_ctx->out_q_ctx.q.subsystem_flags &
|
||||
VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF))
|
||||
m2m_ctx->new_frame = !dst->vb2_buf.copied_timestamp ||
|
||||
dst->vb2_buf.timestamp != src->vb2_buf.timestamp;
|
||||
@@ -474,7 +474,7 @@ void v4l2_m2m_job_finish(struct v4l2_m2m_dev *m2m_dev,
|
||||
* holding capture buffers. Those should use
|
||||
* v4l2_m2m_buf_done_and_job_finish() instead.
|
||||
*/
|
||||
- WARN_ON(m2m_ctx->cap_q_ctx.q.subsystem_flags &
|
||||
+ WARN_ON(m2m_ctx->out_q_ctx.q.subsystem_flags &
|
||||
VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF);
|
||||
spin_lock_irqsave(&m2m_dev->job_spinlock, flags);
|
||||
schedule_next = _v4l2_m2m_job_finish(m2m_dev, m2m_ctx);
|
||||
--
|
||||
2.24.0
|
|
@ -1,47 +0,0 @@
|
|||
Add DPB entry flags to help indicate when a reference frame is a field picture
|
||||
and how the DPB entry is referenced, top or bottom field or full frame.
|
||||
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
---
|
||||
Documentation/media/uapi/v4l/ext-ctrls-codec.rst | 12 ++++++++++++
|
||||
include/media/h264-ctrls.h | 4 ++++
|
||||
2 files changed, 16 insertions(+)
|
||||
|
||||
diff --git a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
|
||||
index bc5dd8e76567..eb6c32668ad7 100644
|
||||
--- a/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
|
||||
+++ b/Documentation/media/uapi/v4l/ext-ctrls-codec.rst
|
||||
@@ -2022,6 +2022,18 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type -
|
||||
* - ``V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM``
|
||||
- 0x00000004
|
||||
- The DPB entry is a long term reference frame
|
||||
+ * - ``V4L2_H264_DPB_ENTRY_FLAG_FIELD_PICTURE``
|
||||
+ - 0x00000008
|
||||
+ - The DPB entry is a field picture
|
||||
+ * - ``V4L2_H264_DPB_ENTRY_FLAG_REF_TOP``
|
||||
+ - 0x00000010
|
||||
+ - The DPB entry is a top field reference
|
||||
+ * - ``V4L2_H264_DPB_ENTRY_FLAG_REF_BOTTOM``
|
||||
+ - 0x00000020
|
||||
+ - The DPB entry is a bottom field reference
|
||||
+ * - ``V4L2_H264_DPB_ENTRY_FLAG_REF_FRAME``
|
||||
+ - 0x00000030
|
||||
+ - The DPB entry is a reference frame
|
||||
|
||||
``V4L2_CID_MPEG_VIDEO_H264_DECODE_MODE (enum)``
|
||||
Specifies the decoding mode to use. Currently exposes slice-based and
|
||||
diff --git a/include/media/h264-ctrls.h b/include/media/h264-ctrls.h
|
||||
index e877bf1d537c..76020ebd1e6c 100644
|
||||
--- a/include/media/h264-ctrls.h
|
||||
+++ b/include/media/h264-ctrls.h
|
||||
@@ -185,6 +185,10 @@ struct v4l2_ctrl_h264_slice_params {
|
||||
#define V4L2_H264_DPB_ENTRY_FLAG_VALID 0x01
|
||||
#define V4L2_H264_DPB_ENTRY_FLAG_ACTIVE 0x02
|
||||
#define V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM 0x04
|
||||
+#define V4L2_H264_DPB_ENTRY_FLAG_FIELD_PICTURE 0x08
|
||||
+#define V4L2_H264_DPB_ENTRY_FLAG_REF_TOP 0x10
|
||||
+#define V4L2_H264_DPB_ENTRY_FLAG_REF_BOTTOM 0x20
|
||||
+#define V4L2_H264_DPB_ENTRY_FLAG_REF_FRAME 0x30
|
||||
|
||||
struct v4l2_h264_dpb_entry {
|
||||
__u64 reference_ts;
|
|
@ -1,145 +0,0 @@
|
|||
|
||||
If a decoder needs a minimal buffer count to be queued on it's CAPTURE
|
||||
queue, if a CMD_STOP is sent after a STREAMON but before all the required
|
||||
buffers are queued, it should comply to the drain sequence and mark the
|
||||
last queued buffer with V4L2_BUF_FLAG_LAST and mark it done to be dequeued.
|
||||
|
||||
This introduces a v4l2-mem2mem ioctl decoder command to track the command
|
||||
sent to the decoder, and should be called by the affected drivers.
|
||||
|
||||
Suggested-by: Hans Verkuil <hverkuil@xs4all.nl>
|
||||
Suggested-by: Maxime Jourdan <mjourdan@baylibre.com>
|
||||
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
|
||||
---
|
||||
drivers/media/v4l2-core/v4l2-mem2mem.c | 61 +++++++++++++++++++++++++-
|
||||
include/media/v4l2-mem2mem.h | 14 ++++++
|
||||
2 files changed, 73 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
index 1afd9c6ad908..b09616f9f102 100644
|
||||
--- a/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
+++ b/drivers/media/v4l2-core/v4l2-mem2mem.c
|
||||
@@ -556,6 +556,28 @@ int v4l2_m2m_querybuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_querybuf);
|
||||
|
||||
+static void v4l2_m2m_flag_last_buf_done(struct vb2_queue *q)
|
||||
+{
|
||||
+ struct vb2_buffer *vb;
|
||||
+ struct vb2_v4l2_buffer *vbuf;
|
||||
+ unsigned int i;
|
||||
+
|
||||
+ if (WARN_ON(q->is_output))
|
||||
+ return;
|
||||
+ if (list_empty(&q->queued_list))
|
||||
+ return;
|
||||
+
|
||||
+ vb = list_first_entry(&q->queued_list, struct vb2_buffer, queued_entry);
|
||||
+ for (i = 0; i < vb->num_planes; i++)
|
||||
+ vb2_set_plane_payload(vb, i, 0);
|
||||
+
|
||||
+ vb->state = VB2_BUF_STATE_ACTIVE;
|
||||
+ atomic_inc(&q->owned_by_drv_count);
|
||||
+ vbuf = to_vb2_v4l2_buffer(vb);
|
||||
+ vbuf->flags |= V4L2_BUF_FLAG_LAST;
|
||||
+ vb2_buffer_done(vb, VB2_BUF_STATE_DONE);
|
||||
+}
|
||||
+
|
||||
int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
struct v4l2_buffer *buf)
|
||||
{
|
||||
@@ -570,11 +592,22 @@ int v4l2_m2m_qbuf(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
__func__);
|
||||
return -EPERM;
|
||||
}
|
||||
+
|
||||
ret = vb2_qbuf(vq, vdev->v4l2_dev->mdev, buf);
|
||||
- if (!ret && !(buf->flags & V4L2_BUF_FLAG_IN_REQUEST))
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ /*
|
||||
+ * If the capture queue isn't streaming and we were asked to
|
||||
+ * stop, DONE the buffer instantly and flag as LAST
|
||||
+ */
|
||||
+ if (!V4L2_TYPE_IS_OUTPUT(vq->type) && m2m_ctx->stopped &&
|
||||
+ vb2_is_streaming(vq) && !vb2_start_streaming_called(vq))
|
||||
+ v4l2_m2m_flag_last_buf_done(vq);
|
||||
+ else if ((buf->flags & V4L2_BUF_FLAG_IN_REQUEST))
|
||||
v4l2_m2m_try_schedule(m2m_ctx);
|
||||
|
||||
- return ret;
|
||||
+ return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_qbuf);
|
||||
|
||||
@@ -1225,6 +1258,30 @@ int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_try_decoder_cmd);
|
||||
|
||||
+int v4l2_m2m_decoder_cmd(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
+ struct v4l2_decoder_cmd *dc)
|
||||
+{
|
||||
+ if (dc->cmd != V4L2_DEC_CMD_STOP && dc->cmd != V4L2_DEC_CMD_START)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ if (dc->cmd == V4L2_DEC_CMD_STOP)
|
||||
+ m2m_ctx->stopped = true;
|
||||
+ else
|
||||
+ m2m_ctx->stopped = false;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(v4l2_m2m_decoder_cmd);
|
||||
+
|
||||
+int v4l2_m2m_ioctl_decoder_cmd(struct file *file, void *priv,
|
||||
+ struct v4l2_decoder_cmd *dc)
|
||||
+{
|
||||
+ struct v4l2_fh *fh = file->private_data;
|
||||
+
|
||||
+ return v4l2_m2m_decoder_cmd(file, fh->m2m_ctx, dc);
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(v4l2_m2m_ioctl_decoder_cmd);
|
||||
+
|
||||
/*
|
||||
* v4l2_file_operations helpers. It is assumed here same lock is used
|
||||
* for the output and the capture buffer queue.
|
||||
diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h
|
||||
index 1d85e24791e4..4c083cffdd86 100644
|
||||
--- a/include/media/v4l2-mem2mem.h
|
||||
+++ b/include/media/v4l2-mem2mem.h
|
||||
@@ -98,6 +98,8 @@ struct v4l2_m2m_ctx {
|
||||
|
||||
bool new_frame;
|
||||
|
||||
+ bool stopped;
|
||||
+
|
||||
/* internal use only */
|
||||
struct v4l2_m2m_dev *m2m_dev;
|
||||
|
||||
@@ -312,6 +314,16 @@ int v4l2_m2m_streamon(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
int v4l2_m2m_streamoff(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
enum v4l2_buf_type type);
|
||||
|
||||
+/**
|
||||
+ * v4l2_m2m_decoder_cmd() - execute a decoder command
|
||||
+ *
|
||||
+ * @file: pointer to struct &file
|
||||
+ * @m2m_ctx: m2m context assigned to the instance given by struct &v4l2_m2m_ctx
|
||||
+ * @dc: pointer to the decoder command
|
||||
+ */
|
||||
+int v4l2_m2m_decoder_cmd(struct file *file, struct v4l2_m2m_ctx *m2m_ctx,
|
||||
+ struct v4l2_decoder_cmd *dc);
|
||||
+
|
||||
/**
|
||||
* v4l2_m2m_poll() - poll replacement, for destination buffers only
|
||||
*
|
||||
@@ -704,6 +716,8 @@ int v4l2_m2m_ioctl_streamon(struct file *file, void *fh,
|
||||
enum v4l2_buf_type type);
|
||||
int v4l2_m2m_ioctl_streamoff(struct file *file, void *fh,
|
||||
enum v4l2_buf_type type);
|
||||
+int v4l2_m2m_ioctl_decoder_cmd(struct file *file, void *fh,
|
||||
+ struct v4l2_decoder_cmd *dc);
|
||||
int v4l2_m2m_ioctl_try_encoder_cmd(struct file *file, void *fh,
|
||||
struct v4l2_encoder_cmd *ec);
|
||||
int v4l2_m2m_ioctl_try_decoder_cmd(struct file *file, void *fh,
|
|
@ -1,73 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
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/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
|
|
@ -1,51 +1,63 @@
|
|||
From 0712eca92c3e6611ec4dc1bc127a30d3882c4336 Mon Sep 17 00:00:00 2001
|
||||
From d1f75332d44f26e734985493c134a727c79cb1f1 Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Tue, 29 Oct 2019 13:16:57 +0100
|
||||
Subject: drm/bridge: extract some Analogix I2C DP common code
|
||||
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 analogix_dp.
|
||||
|
||||
Extract them to a new module.
|
||||
|
||||
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Torsten Duwe <duwe@suse.de>
|
||||
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
Link: https://patchwork.freedesktop.org/patch/msgid/20191107135214.966BD68BFE@verein.lst.de
|
||||
---
|
||||
drivers/gpu/drm/bridge/analogix/Makefile | 2 +-
|
||||
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 146 +-----------------
|
||||
.../gpu/drm/bridge/analogix/analogix-i2c-dptx.c | 165 +++++++++++++++++++++
|
||||
.../gpu/drm/bridge/analogix/analogix-i2c-dptx.h | 3 +
|
||||
4 files changed, 170 insertions(+), 146 deletions(-)
|
||||
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
|
||||
|
||||
(limited to 'drivers/gpu/drm/bridge/analogix')
|
||||
|
||||
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 6fcbfd3ee560..7623b9b80167 100644
|
||||
index eb41be845055..c37e2ded8ce3 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/Makefile
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||
@@ -1,4 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
-analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o
|
||||
+analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
|
||||
obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||
@@ -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 274989f96a91..41867be03751 100644
|
||||
index f8433c93f463..bf8291d0ddd0 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
|
||||
@@ -36,8 +36,6 @@
|
||||
@@ -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 anx7808_i2c_addresses[] = {
|
||||
[I2C_IDX_TX_P0] = 0x78,
|
||||
@@ -107,153 +105,11 @@ static int anx78xx_clear_bits(struct regmap *map, u8 reg, u8 mask)
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -196,40 +208,42 @@ index 274989f96a91..41867be03751 100644
|
|||
- return err;
|
||||
-
|
||||
- return msg->size;
|
||||
+ return anx_dp_aux_transfer(anx78xx->map[I2C_IDX_TX_P0], msg);
|
||||
+ 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..60707bb5afe7
|
||||
index 000000000000..9cb30962032e
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.c
|
||||
@@ -0,0 +1,165 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
@@ -0,0 +1,169 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright(c) 2016, Analogix Semiconductor.
|
||||
+ * Copyright(c) 2017 Icenowy Zheng <icenowy@aosc.io>
|
||||
+ *
|
||||
+ * Based on anx7808 driver obtained from chromeos with copyright:
|
||||
+ * Copyright(c) 2013, Google Inc.
|
||||
+ * 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/drm_drv.h>
|
||||
+#include <drm/drm_dp_helper.h>
|
||||
+#include <drm/drm_print.h>
|
||||
+
|
||||
+#include "analogix-i2c-dptx.h"
|
||||
+
|
||||
+#define AUX_WAIT_TIMEOUT_MS 15
|
||||
+#define AUX_CH_BUFFER_SIZE 16
|
||||
+
|
||||
+static int anx_i2c_dp_clear_bits(struct regmap *map, u8 reg, u8 mask)
|
||||
+static int anx_clear_bits(struct regmap *map, u8 reg, u8 mask)
|
||||
+{
|
||||
+ return regmap_update_bits(map, reg, mask, 0);
|
||||
+}
|
||||
+
|
||||
+static bool anx_dp_aux_op_finished(struct regmap *map_dptx)
|
||||
+static bool anx_aux_op_finished(struct regmap *map_dptx)
|
||||
+{
|
||||
+ unsigned int value;
|
||||
+ int err;
|
||||
|
@ -241,7 +255,7 @@ index 000000000000..60707bb5afe7
|
|||
+ return (value & SP_AUX_EN) == 0;
|
||||
+}
|
||||
+
|
||||
+static int anx_dp_aux_wait(struct regmap *map_dptx)
|
||||
+static int anx_aux_wait(struct regmap *map_dptx)
|
||||
+{
|
||||
+ unsigned long timeout;
|
||||
+ unsigned int status;
|
||||
|
@ -249,9 +263,9 @@ index 000000000000..60707bb5afe7
|
|||
+
|
||||
+ timeout = jiffies + msecs_to_jiffies(AUX_WAIT_TIMEOUT_MS) + 1;
|
||||
+
|
||||
+ while (!anx_dp_aux_op_finished(map_dptx)) {
|
||||
+ while (!anx_aux_op_finished(map_dptx)) {
|
||||
+ if (time_after(jiffies, timeout)) {
|
||||
+ if (!anx_dp_aux_op_finished(map_dptx)) {
|
||||
+ if (!anx_aux_op_finished(map_dptx)) {
|
||||
+ DRM_ERROR("Timed out waiting AUX to finish\n");
|
||||
+ return -ETIMEDOUT;
|
||||
+ }
|
||||
|
@ -278,7 +292,7 @@ index 000000000000..60707bb5afe7
|
|||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int anx_dp_aux_address(struct regmap *map_dptx, unsigned int addr)
|
||||
+static int anx_aux_address(struct regmap *map_dptx, unsigned int addr)
|
||||
+{
|
||||
+ int err;
|
||||
+
|
||||
|
@ -306,8 +320,7 @@ index 000000000000..60707bb5afe7
|
|||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+ssize_t anx_dp_aux_transfer(struct regmap *map_dptx,
|
||||
+ struct drm_dp_aux_msg *msg)
|
||||
+ssize_t anx_aux_transfer(struct regmap *map_dptx, struct drm_dp_aux_msg *msg)
|
||||
+{
|
||||
+ u8 ctrl1 = msg->request;
|
||||
+ u8 ctrl2 = SP_AUX_EN;
|
||||
|
@ -334,7 +347,7 @@ index 000000000000..60707bb5afe7
|
|||
+ }
|
||||
+
|
||||
+ /* Write address and request */
|
||||
+ err = anx_dp_aux_address(map_dptx, msg->address);
|
||||
+ err = anx_aux_address(map_dptx, msg->address);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
|
@ -348,7 +361,7 @@ index 000000000000..60707bb5afe7
|
|||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ err = anx_dp_aux_wait(map_dptx);
|
||||
+ err = anx_aux_wait(map_dptx);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
|
@ -363,26 +376,28 @@ index 000000000000..60707bb5afe7
|
|||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ err = anx_i2c_dp_clear_bits(map_dptx, SP_DP_AUX_CH_CTRL2_REG,
|
||||
+ SP_ADDR_ONLY);
|
||||
+ err = anx_clear_bits(map_dptx, SP_DP_AUX_CH_CTRL2_REG, SP_ADDR_ONLY);
|
||||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ return msg->size;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(anx_dp_aux_transfer);
|
||||
+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 4777e48c87a9..db24f7290461 100644
|
||||
index bc0831b127bf..c2ca854613a0 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-i2c-dptx.h
|
||||
@@ -242,4 +242,7 @@
|
||||
@@ -245,4 +245,6 @@
|
||||
/* DP AUX Buffer Data Registers */
|
||||
#define SP_DP_BUF_DATA0_REG 0xf0
|
||||
|
||||
+ssize_t anx_dp_aux_transfer(struct regmap *map_dptx,
|
||||
+ struct drm_dp_aux_msg *msg);
|
||||
+ssize_t anx_aux_transfer(struct regmap *map_dptx, struct drm_dp_aux_msg *msg);
|
||||
+
|
||||
#endif
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
2.17.1
|
||||
|
|
@ -1,37 +1,36 @@
|
|||
From 6aa192698089b450b06d609355fc9c82c07856d2 Mon Sep 17 00:00:00 2001
|
||||
From 2da065ab8aa3f562a02dfd3df4ad971d1229b136 Mon Sep 17 00:00:00 2001
|
||||
From: Icenowy Zheng <icenowy@aosc.io>
|
||||
Date: Tue, 29 Oct 2019 13:16:57 +0100
|
||||
Subject: drm/bridge: Add Analogix anx6345 support
|
||||
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.
|
||||
|
||||
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>
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
Signed-off-by: Torsten Duwe <duwe@suse.de>
|
||||
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
|
||||
Link: https://patchwork.freedesktop.org/patch/msgid/20191107135220.590D968BFE@verein.lst.de
|
||||
---
|
||||
drivers/gpu/drm/bridge/analogix/Kconfig | 12 +
|
||||
drivers/gpu/drm/bridge/analogix/Makefile | 1 +
|
||||
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 793 +++++++++++++++++++++
|
||||
3 files changed, 806 insertions(+)
|
||||
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
|
||||
|
||||
(limited to 'drivers/gpu/drm/bridge/analogix')
|
||||
|
||||
diff --git a/drivers/gpu/drm/bridge/analogix/Kconfig b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||
index 29ba1b21019e..1425a96a28c3 100644
|
||||
index eb893b465dd8..784ddca83b47 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/Kconfig
|
||||
@@ -1,6 +1,18 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
@@ -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
|
||||
+ select DRM_ANALOGIX_DP_I2C
|
||||
+ select DRM_KMS_HELPER
|
||||
+ select REGMAP_I2C
|
||||
+ help
|
||||
|
@ -39,73 +38,71 @@ index 29ba1b21019e..1425a96a28c3 100644
|
|||
+ transmitter designed for portable devices. The
|
||||
+ ANX6345 transforms the LVTTL RGB output of an
|
||||
+ application processor to eDP or DisplayPort.
|
||||
+
|
||||
config DRM_ANALOGIX_ANX78XX
|
||||
tristate "Analogix ANX78XX bridge"
|
||||
+ select DRM_ANALOGIX_DP
|
||||
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 7623b9b80167..97669b374098 100644
|
||||
index c37e2ded8ce3..3af9feab6e17 100644
|
||||
--- a/drivers/gpu/drm/bridge/analogix/Makefile
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/Makefile
|
||||
@@ -1,4 +1,5 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
analogix_dp-objs := analogix_dp_core.o analogix_dp_reg.o analogix-i2c-dptx.o
|
||||
+obj-$(CONFIG_DRM_ANALOGIX_ANX6345) += analogix-anx6345.o
|
||||
obj-$(CONFIG_DRM_ANALOGIX_ANX78XX) += analogix-anx78xx.o
|
||||
@@ -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..4574d6b264de
|
||||
index 000000000000..81676407aa6d
|
||||
--- /dev/null
|
||||
+++ b/drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
|
||||
@@ -0,0 +1,793 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
@@ -0,0 +1,863 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright(c) 2016, Analogix Semiconductor.
|
||||
+ * Copyright(c) 2017, Icenowy Zheng <icenowy@aosc.io>
|
||||
+ *
|
||||
+ * Based on anx7808 driver obtained from chromeos with copyright:
|
||||
+ * Copyright(c) 2013, Google Inc.
|
||||
+ * 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/gpio/consumer.h>
|
||||
+#include <linux/i2c.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/regulator/consumer.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/gpio/consumer.h>
|
||||
+#include <linux/regulator/consumer.h>
|
||||
+
|
||||
+#include <drm/drm_drv.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 <drm/drm_of.h>
|
||||
+#include <drm/drm_panel.h>
|
||||
+#include <drm/drm_print.h>
|
||||
+#include <drm/drm_probe_helper.h>
|
||||
+
|
||||
+#include "analogix-i2c-dptx.h"
|
||||
+#include "analogix-i2c-txcommon.h"
|
||||
+
|
||||
+#define POLL_DELAY 50000 /* us */
|
||||
+#define POLL_TIMEOUT 5000000 /* us */
|
||||
+
|
||||
+#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] = 0x70,
|
||||
+ [I2C_IDX_TXCOM] = 0x72,
|
||||
+ [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;
|
||||
+};
|
||||
+#define I2C_NUM_ADDRESSES ARRAY_SIZE(anx6345_i2c_addresses)
|
||||
+
|
||||
+struct anx6345 {
|
||||
+ struct drm_dp_aux aux;
|
||||
|
@ -114,13 +111,12 @@ index 000000000000..4574d6b264de
|
|||
+ struct edid *edid;
|
||||
+ struct drm_connector connector;
|
||||
+ struct drm_dp_link link;
|
||||
+ struct drm_panel *panel;
|
||||
+ struct regulator *dvdd12;
|
||||
+ struct regulator *dvdd25;
|
||||
+ struct gpio_desc *gpiod_reset;
|
||||
+ struct mutex lock; /* protect EDID access */
|
||||
+ struct anx6345_platform_data pdata;
|
||||
+ struct mutex lock;
|
||||
+
|
||||
+ /* I2C Slave addresses of ANX6345 are mapped as DPTX and SYS */
|
||||
+ /*
|
||||
+ * 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];
|
||||
+
|
||||
|
@ -155,7 +151,7 @@ index 000000000000..4574d6b264de
|
|||
+{
|
||||
+ struct anx6345 *anx6345 = container_of(aux, struct anx6345, aux);
|
||||
+
|
||||
+ return anx_dp_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
|
||||
+ return anx_aux_transfer(anx6345->map[I2C_IDX_DPTX], msg);
|
||||
+}
|
||||
+
|
||||
+static int anx6345_dp_link_training(struct anx6345 *anx6345)
|
||||
|
@ -281,17 +277,21 @@ index 000000000000..4574d6b264de
|
|||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ return regmap_read_poll_timeout(anx6345->map[I2C_IDX_DPTX],
|
||||
+ 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: colordepth is hardcoded for now */
|
||||
+ /* 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)
|
||||
|
@ -338,41 +338,61 @@ index 000000000000..4574d6b264de
|
|||
+ if (err)
|
||||
+ return err;
|
||||
+
|
||||
+ return anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||
+ 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;
|
||||
+
|
||||
+ /* Ensure reset is asserted before starting power on sequence */
|
||||
+ gpiod_set_value_cansleep(anx6345->gpiod_reset, 1);
|
||||
+ usleep_range(1000, 2000);
|
||||
+
|
||||
+ err = regulator_enable(anx6345->dvdd12);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to enable dvdd12 regulator: %d\n",
|
||||
+ 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);
|
||||
+ }
|
||||
+
|
||||
+ /* T1 - delay between VDD12 and VDD25 should be 0-2ms */
|
||||
+ 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;
|
||||
+ }
|
||||
+
|
||||
+ err = regulator_enable(anx6345->dvdd25);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to enable dvdd25 regulator: %d\n",
|
||||
+ err);
|
||||
+ return;
|
||||
+ usleep_range(5000, 10000);
|
||||
+ }
|
||||
+
|
||||
+ /* T2 - delay between RESETN and all power rail stable,
|
||||
+ * should be 2-5ms
|
||||
+ */
|
||||
+ usleep_range(2000, 5000);
|
||||
+ 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(anx6345->gpiod_reset, 0);
|
||||
+ 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,
|
||||
|
@ -380,39 +400,50 @@ index 000000000000..4574d6b264de
|
|||
+ anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM], SP_POWERDOWN_CTRL_REG,
|
||||
+ SP_REGISTER_PD | SP_TOTAL_PD);
|
||||
+
|
||||
+ if (anx6345->panel)
|
||||
+ drm_panel_prepare(anx6345->panel);
|
||||
+
|
||||
+ anx6345->powered = true;
|
||||
+}
|
||||
+
|
||||
+static void anx6345_poweroff(struct anx6345 *anx6345)
|
||||
+{
|
||||
+ struct anx6345_platform_data *pdata = &anx6345->pdata;
|
||||
+ int err;
|
||||
+
|
||||
+ gpiod_set_value_cansleep(anx6345->gpiod_reset, 1);
|
||||
+ if (WARN_ON(!anx6345->powered))
|
||||
+ return;
|
||||
+
|
||||
+ gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
|
||||
+ usleep_range(1000, 2000);
|
||||
+
|
||||
+ if (anx6345->panel)
|
||||
+ drm_panel_unprepare(anx6345->panel);
|
||||
+
|
||||
+ err = regulator_disable(anx6345->dvdd25);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to disable dvdd25 regulator: %d\n",
|
||||
+ err);
|
||||
+ return;
|
||||
+ if (pdata->vcc_panel) {
|
||||
+ err = regulator_disable(pdata->vcc_panel);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to disable panel regulator: %d\n",
|
||||
+ err);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ usleep_range(5000, 10000);
|
||||
+ if (pdata->dvdd25) {
|
||||
+ err = regulator_disable(pdata->dvdd25);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to disable DVDD25 regulator: %d\n",
|
||||
+ err);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ err = regulator_disable(anx6345->dvdd12);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to disable dvdd12 regulator: %d\n",
|
||||
+ err);
|
||||
+ return;
|
||||
+ usleep_range(5000, 10000);
|
||||
+ }
|
||||
+
|
||||
+ usleep_range(1000, 2000);
|
||||
+ 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;
|
||||
+}
|
||||
|
@ -426,21 +457,13 @@ index 000000000000..4574d6b264de
|
|||
+
|
||||
+ /* Power on needed modules */
|
||||
+ err = anx6345_clear_bits(anx6345->map[I2C_IDX_TXCOM],
|
||||
+ SP_POWERDOWN_CTRL_REG,
|
||||
+ SP_VIDEO_PD | SP_LINK_PD);
|
||||
+ SP_POWERDOWN_CTRL_REG,
|
||||
+ SP_VIDEO_PD | SP_LINK_PD);
|
||||
+
|
||||
+ err = anx6345_tx_initialization(anx6345);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed eDP transmitter initialization: %d\n", err);
|
||||
+ anx6345_poweroff(anx6345);
|
||||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ err = anx6345_dp_link_training(anx6345);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed link training: %d\n", err);
|
||||
+ anx6345_poweroff(anx6345);
|
||||
+ return err;
|
||||
+ DRM_ERROR("Failed transmitter initialization: %d\n", err);
|
||||
+ goto err_poweroff;
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
|
@ -450,6 +473,44 @@ index 000000000000..4574d6b264de
|
|||
+ 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)
|
||||
|
@ -468,9 +529,13 @@ index 000000000000..4574d6b264de
|
|||
+ return err;
|
||||
+
|
||||
+ /* Force stream valid */
|
||||
+ return anx6345_set_bits(anx6345->map[I2C_IDX_DPTX],
|
||||
+ 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)
|
||||
|
@ -492,49 +557,70 @@ index 000000000000..4574d6b264de
|
|||
+ 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;
|
||||
+ bool power_off = false;
|
||||
+
|
||||
+ 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) {
|
||||
+ if (!anx6345->powered) {
|
||||
+ anx6345_poweron(anx6345);
|
||||
+ power_off = true;
|
||||
+ }
|
||||
+
|
||||
+ err = anx6345_get_downstream_info(anx6345);
|
||||
+ err = anx6345_probe_edid_from_of(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");
|
||||
+
|
||||
+ err = drm_connector_update_edid_property(connector,
|
||||
+ anx6345->edid);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to update EDID property: %d\n", err);
|
||||
+ DRM_ERROR("Failed to probe EDID from device tree: &d\n", err);
|
||||
+ goto unlock;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ num_modes += drm_add_edid_modes(connector, anx6345->edid);
|
||||
+ 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:
|
||||
+ if (power_off)
|
||||
+ anx6345_poweroff(anx6345);
|
||||
+
|
||||
+ mutex_unlock(&anx6345->lock);
|
||||
+
|
||||
+ if (!num_modes && anx6345->panel)
|
||||
+ num_modes += drm_panel_get_modes(anx6345->panel);
|
||||
+
|
||||
+ return num_modes;
|
||||
+}
|
||||
+
|
||||
|
@ -542,19 +628,16 @@ index 000000000000..4574d6b264de
|
|||
+ .get_modes = anx6345_get_modes,
|
||||
+};
|
||||
+
|
||||
+static void
|
||||
+anx6345_connector_destroy(struct drm_connector *connector)
|
||||
+static enum drm_connector_status anx6345_detect(struct drm_connector *connector,
|
||||
+ bool force)
|
||||
+{
|
||||
+ struct anx6345 *anx6345 = connector_to_anx6345(connector);
|
||||
+
|
||||
+ if (anx6345->panel)
|
||||
+ drm_panel_detach(anx6345->panel);
|
||||
+ drm_connector_cleanup(connector);
|
||||
+ return connector_status_connected;
|
||||
+}
|
||||
+
|
||||
+static const struct drm_connector_funcs anx6345_connector_funcs = {
|
||||
+ .fill_modes = drm_helper_probe_single_connector_modes,
|
||||
+ .destroy = anx6345_connector_destroy,
|
||||
+ .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,
|
||||
|
@ -607,29 +690,21 @@ index 000000000000..4574d6b264de
|
|||
+ return err;
|
||||
+ }
|
||||
+
|
||||
+ if (anx6345->panel) {
|
||||
+ err = drm_panel_attach(anx6345->panel, &anx6345->connector);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to attach panel: %d\n", err);
|
||||
+ return err;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static enum drm_mode_status
|
||||
+anx6345_bridge_mode_valid(struct drm_bridge *bridge,
|
||||
+ const struct drm_display_mode *mode)
|
||||
+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 MODE_NO_INTERLACE;
|
||||
+ return false;
|
||||
+
|
||||
+ /* Max 1200p at 5.4 Ghz, one lane */
|
||||
+ if (mode->clock > 154000)
|
||||
+ return MODE_CLOCK_HIGH;
|
||||
+ return false;
|
||||
+
|
||||
+ return MODE_OK;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static void anx6345_bridge_disable(struct drm_bridge *bridge)
|
||||
|
@ -639,11 +714,16 @@ index 000000000000..4574d6b264de
|
|||
+ /* 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);
|
||||
+ if (anx6345->panel)
|
||||
+ drm_panel_disable(anx6345->panel);
|
||||
+}
|
||||
+
|
||||
+ if (anx6345->powered)
|
||||
+ anx6345_poweroff(anx6345);
|
||||
+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)
|
||||
|
@ -651,9 +731,6 @@ index 000000000000..4574d6b264de
|
|||
+ struct anx6345 *anx6345 = bridge_to_anx6345(bridge);
|
||||
+ int err;
|
||||
+
|
||||
+ if (anx6345->panel)
|
||||
+ drm_panel_enable(anx6345->panel);
|
||||
+
|
||||
+ err = anx6345_start(anx6345);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to initialize: %d\n", err);
|
||||
|
@ -667,8 +744,9 @@ index 000000000000..4574d6b264de
|
|||
+
|
||||
+static const struct drm_bridge_funcs anx6345_bridge_funcs = {
|
||||
+ .attach = anx6345_bridge_attach,
|
||||
+ .mode_valid = anx6345_bridge_mode_valid,
|
||||
+ .mode_fixup = anx6345_bridge_mode_fixup,
|
||||
+ .disable = anx6345_bridge_disable,
|
||||
+ .mode_set = anx6345_bridge_mode_set,
|
||||
+ .enable = anx6345_bridge_enable,
|
||||
+};
|
||||
+
|
||||
|
@ -686,90 +764,40 @@ index 000000000000..4574d6b264de
|
|||
+ .reg_bits = 8,
|
||||
+ .val_bits = 8,
|
||||
+ .max_register = 0xff,
|
||||
+ .cache_type = REGCACHE_NONE,
|
||||
+};
|
||||
+
|
||||
+static const u16 anx6345_chipid_list[] = {
|
||||
+ 0x6345,
|
||||
+};
|
||||
+
|
||||
+static bool anx6345_get_chip_id(struct anx6345 *anx6345)
|
||||
+{
|
||||
+ unsigned int i, idl, idh, version;
|
||||
+
|
||||
+ if (regmap_read(anx6345->map[I2C_IDX_TXCOM], SP_DEVICE_IDL_REG, &idl))
|
||||
+ return false;
|
||||
+
|
||||
+ if (regmap_read(anx6345->map[I2C_IDX_TXCOM], SP_DEVICE_IDH_REG, &idh))
|
||||
+ return false;
|
||||
+
|
||||
+ anx6345->chipid = (u8)idl | ((u8)idh << 8);
|
||||
+
|
||||
+ if (regmap_read(anx6345->map[I2C_IDX_TXCOM], SP_DEVICE_VERSION_REG,
|
||||
+ &version))
|
||||
+ return false;
|
||||
+
|
||||
+ 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);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ DRM_ERROR("ANX%x (ver. %d) not supported by this driver\n",
|
||||
+ anx6345->chipid, version);
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+static int anx6345_i2c_probe(struct i2c_client *client,
|
||||
+ const struct i2c_device_id *id)
|
||||
+{
|
||||
+ struct anx6345 *anx6345;
|
||||
+ struct device *dev;
|
||||
+ int i, err;
|
||||
+ 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);
|
||||
+
|
||||
+ dev = &anx6345->client->dev;
|
||||
+
|
||||
+ err = drm_of_find_panel_or_bridge(client->dev.of_node, 1, 0,
|
||||
+ &anx6345->panel, NULL);
|
||||
+ if (err == -EPROBE_DEFER)
|
||||
+ err = anx6345_init_pdata(anx6345);
|
||||
+ if (err) {
|
||||
+ DRM_ERROR("Failed to initialize pdata: %d\n", err);
|
||||
+ return err;
|
||||
+
|
||||
+ if (err)
|
||||
+ DRM_DEBUG("No panel found\n");
|
||||
+
|
||||
+ /* 1.2V digital core power regulator */
|
||||
+ anx6345->dvdd12 = devm_regulator_get(dev, "dvdd12-supply");
|
||||
+ if (IS_ERR(anx6345->dvdd12)) {
|
||||
+ DRM_ERROR("dvdd12-supply not found\n");
|
||||
+ return PTR_ERR(anx6345->dvdd12);
|
||||
+ }
|
||||
+
|
||||
+ /* 2.5V digital core power regulator */
|
||||
+ anx6345->dvdd25 = devm_regulator_get(dev, "dvdd25-supply");
|
||||
+ if (IS_ERR(anx6345->dvdd25)) {
|
||||
+ DRM_ERROR("dvdd25-supply not found\n");
|
||||
+ return PTR_ERR(anx6345->dvdd25);
|
||||
+ }
|
||||
+
|
||||
+ /* GPIO for chip reset */
|
||||
+ anx6345->gpiod_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
|
||||
+ if (IS_ERR(anx6345->gpiod_reset)) {
|
||||
+ DRM_ERROR("Reset gpio not found\n");
|
||||
+ return PTR_ERR(anx6345->gpiod_reset);
|
||||
+ }
|
||||
+
|
||||
+ /* Map slave addresses of ANX6345 */
|
||||
|
@ -799,16 +827,49 @@ index 000000000000..4574d6b264de
|
|||
+
|
||||
+ /* Look for supported chip ID */
|
||||
+ anx6345_poweron(anx6345);
|
||||
+ if (anx6345_get_chip_id(anx6345)) {
|
||||
+ anx6345->bridge.funcs = &anx6345_bridge_funcs;
|
||||
+ drm_bridge_add(&anx6345->bridge);
|
||||
+
|
||||
+ return 0;
|
||||
+ } else {
|
||||
+ anx6345_poweroff(anx6345);
|
||||
+ err = -ENODEV;
|
||||
+ 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;
|
||||
|
@ -824,8 +885,6 @@ index 000000000000..4574d6b264de
|
|||
+
|
||||
+ kfree(anx6345->edid);
|
||||
+
|
||||
+ mutex_destroy(&anx6345->lock);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
|
@ -835,11 +894,13 @@ index 000000000000..4574d6b264de
|
|||
+};
|
||||
+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 = {
|
||||
|
@ -855,6 +916,67 @@ index 000000000000..4574d6b264de
|
|||
+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
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
2.17.1
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
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-current/0137-Pinebook-HDMI-audio.patch
Normal file
39
patch/kernel/sunxi-current/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";
|
||||
};
|
||||
|
||||
+&hdmi_sound {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&tcon0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&lcd_rgb666_pins>;
|
||||
--
|
||||
2.17.1
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,311 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,366 +0,0 @@
|
|||
H6 PWM block is basically the same as A20 PWM, except that it also has
|
||||
bus clock and reset line which needs to be handled accordingly.
|
||||
|
||||
Expand Allwinner PWM binding with H6 PWM specifics.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../bindings/pwm/allwinner,sun4i-a10-pwm.yaml | 36 ++++++++++++++++++-
|
||||
1 file changed, 35 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml b/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
|
||||
index 0ac52f83a58c..deca5d81802f 100644
|
||||
--- a/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
|
||||
+++ b/Documentation/devicetree/bindings/pwm/allwinner,sun4i-a10-pwm.yaml
|
||||
@@ -30,13 +30,47 @@ properties:
|
||||
- items:
|
||||
- const: allwinner,sun50i-h5-pwm
|
||||
- const: allwinner,sun5i-a13-pwm
|
||||
+ - const: allwinner,sun50i-h6-pwm
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
- clocks:
|
||||
+ # Even though it only applies to subschemas under the conditionals,
|
||||
+ # not listing them here will trigger a warning because of the
|
||||
+ # additionalsProperties set to false.
|
||||
+ clocks: true
|
||||
+ clock-names: true
|
||||
+ resets:
|
||||
maxItems: 1
|
||||
|
||||
+allOf:
|
||||
+ - if:
|
||||
+ properties:
|
||||
+ compatible:
|
||||
+ contains:
|
||||
+ const: allwinner,sun50i-h6-pwm
|
||||
+
|
||||
+ then:
|
||||
+ properties:
|
||||
+ clocks:
|
||||
+ items:
|
||||
+ - description: Module Clock
|
||||
+ - description: Bus Clock
|
||||
+
|
||||
+ clock-names:
|
||||
+ items:
|
||||
+ - const: pwm
|
||||
+ - const: bus
|
||||
+
|
||||
+ required:
|
||||
+ - clock-names
|
||||
+ - resets
|
||||
+
|
||||
+ else:
|
||||
+ properties:
|
||||
+ clocks:
|
||||
+ maxItems: 1
|
||||
+
|
||||
required:
|
||||
- "#pwm-cells"
|
||||
- compatible
|
||||
|
||||
H6 PWM core needs deasserted reset line in order to work.
|
||||
|
||||
Add a quirk for it.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
|
||||
---
|
||||
drivers/pwm/pwm-sun4i.c | 27 +++++++++++++++++++++++++--
|
||||
1 file changed, 25 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
|
||||
index de78c824bbfd..1b7be8fbde86 100644
|
||||
--- a/drivers/pwm/pwm-sun4i.c
|
||||
+++ b/drivers/pwm/pwm-sun4i.c
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pwm.h>
|
||||
+#include <linux/reset.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/time.h>
|
||||
@@ -72,12 +73,14 @@ static const u32 prescaler_table[] = {
|
||||
|
||||
struct sun4i_pwm_data {
|
||||
bool has_prescaler_bypass;
|
||||
+ bool has_reset;
|
||||
unsigned int npwm;
|
||||
};
|
||||
|
||||
struct sun4i_pwm_chip {
|
||||
struct pwm_chip chip;
|
||||
struct clk *clk;
|
||||
+ struct reset_control *rst;
|
||||
void __iomem *base;
|
||||
spinlock_t ctrl_lock;
|
||||
const struct sun4i_pwm_data *data;
|
||||
@@ -371,6 +374,14 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(pwm->clk))
|
||||
return PTR_ERR(pwm->clk);
|
||||
|
||||
+ if (pwm->data->has_reset) {
|
||||
+ pwm->rst = devm_reset_control_get(&pdev->dev, NULL);
|
||||
+ if (IS_ERR(pwm->rst))
|
||||
+ return PTR_ERR(pwm->rst);
|
||||
+
|
||||
+ reset_control_deassert(pwm->rst);
|
||||
+ }
|
||||
+
|
||||
pwm->chip.dev = &pdev->dev;
|
||||
pwm->chip.ops = &sun4i_pwm_ops;
|
||||
pwm->chip.base = -1;
|
||||
@@ -383,19 +394,31 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
|
||||
ret = pwmchip_add(&pwm->chip);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "failed to add PWM chip: %d\n", ret);
|
||||
- return ret;
|
||||
+ goto err_pwm_add;
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, pwm);
|
||||
|
||||
return 0;
|
||||
+
|
||||
+err_pwm_add:
|
||||
+ reset_control_assert(pwm->rst);
|
||||
+
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
static int sun4i_pwm_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct sun4i_pwm_chip *pwm = platform_get_drvdata(pdev);
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = pwmchip_remove(&pwm->chip);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
|
||||
- return pwmchip_remove(&pwm->chip);
|
||||
+ reset_control_assert(pwm->rst);
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver sun4i_pwm_driver = {
|
||||
|
||||
H6 PWM core needs bus clock to be enabled in order to work.
|
||||
|
||||
Add a quirk for it.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/pwm/pwm-sun4i.c | 15 +++++++++++++++
|
||||
1 file changed, 15 insertions(+)
|
||||
|
||||
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
|
||||
index 1b7be8fbde86..7d3ac3f2dc3f 100644
|
||||
--- a/drivers/pwm/pwm-sun4i.c
|
||||
+++ b/drivers/pwm/pwm-sun4i.c
|
||||
@@ -72,6 +72,7 @@ static const u32 prescaler_table[] = {
|
||||
};
|
||||
|
||||
struct sun4i_pwm_data {
|
||||
+ bool has_bus_clock;
|
||||
bool has_prescaler_bypass;
|
||||
bool has_reset;
|
||||
unsigned int npwm;
|
||||
@@ -79,6 +80,7 @@ struct sun4i_pwm_data {
|
||||
|
||||
struct sun4i_pwm_chip {
|
||||
struct pwm_chip chip;
|
||||
+ struct clk *bus_clk;
|
||||
struct clk *clk;
|
||||
struct reset_control *rst;
|
||||
void __iomem *base;
|
||||
@@ -382,6 +384,16 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
|
||||
reset_control_deassert(pwm->rst);
|
||||
}
|
||||
|
||||
+ if (pwm->data->has_bus_clock) {
|
||||
+ pwm->bus_clk = devm_clk_get(&pdev->dev, "bus");
|
||||
+ if (IS_ERR(pwm->bus_clk)) {
|
||||
+ ret = PTR_ERR(pwm->bus_clk);
|
||||
+ goto err_bus;
|
||||
+ }
|
||||
+
|
||||
+ clk_prepare_enable(pwm->bus_clk);
|
||||
+ }
|
||||
+
|
||||
pwm->chip.dev = &pdev->dev;
|
||||
pwm->chip.ops = &sun4i_pwm_ops;
|
||||
pwm->chip.base = -1;
|
||||
@@ -402,6 +414,8 @@ static int sun4i_pwm_probe(struct platform_device *pdev)
|
||||
return 0;
|
||||
|
||||
err_pwm_add:
|
||||
+ clk_disable_unprepare(pwm->bus_clk);
|
||||
+err_bus:
|
||||
reset_control_assert(pwm->rst);
|
||||
|
||||
return ret;
|
||||
@@ -416,6 +430,7 @@ static int sun4i_pwm_remove(struct platform_device *pdev)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
+ clk_disable_unprepare(pwm->bus_clk);
|
||||
reset_control_assert(pwm->rst);
|
||||
|
||||
return 0;
|
||||
|
||||
Note that while H6 PWM has two channels, only first one is wired to
|
||||
output pin. Second channel is used as a clock source to companion AC200
|
||||
chip which is bundled into same package.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/pwm/pwm-sun4i.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
|
||||
index 7d3ac3f2dc3f..9e0eca79ff88 100644
|
||||
--- a/drivers/pwm/pwm-sun4i.c
|
||||
+++ b/drivers/pwm/pwm-sun4i.c
|
||||
@@ -331,6 +331,13 @@ static const struct sun4i_pwm_data sun4i_pwm_single_bypass = {
|
||||
.npwm = 1,
|
||||
};
|
||||
|
||||
+static const struct sun4i_pwm_data sun50i_pwm_dual_bypass_clk_rst = {
|
||||
+ .has_bus_clock = true,
|
||||
+ .has_prescaler_bypass = true,
|
||||
+ .has_reset = true,
|
||||
+ .npwm = 2,
|
||||
+};
|
||||
+
|
||||
static const struct of_device_id sun4i_pwm_dt_ids[] = {
|
||||
{
|
||||
.compatible = "allwinner,sun4i-a10-pwm",
|
||||
@@ -347,6 +354,9 @@ static const struct of_device_id sun4i_pwm_dt_ids[] = {
|
||||
}, {
|
||||
.compatible = "allwinner,sun8i-h3-pwm",
|
||||
.data = &sun4i_pwm_single_bypass,
|
||||
+ }, {
|
||||
+ .compatible = "allwinner,sun50i-h6-pwm",
|
||||
+ .data = &sun50i_pwm_dual_bypass_clk_rst,
|
||||
}, {
|
||||
/* sentinel */
|
||||
},
|
||||
|
||||
PWM core has an option to bypass whole logic and output unchanged source
|
||||
clock as PWM output. This is achieved by enabling bypass bit.
|
||||
|
||||
Note that when bypass is enabled, no other setting has any meaning, not
|
||||
even enable bit.
|
||||
|
||||
This mode of operation is needed to achieve high enough frequency to
|
||||
serve as clock source for AC200 chip, which is integrated into same
|
||||
package as H6 SoC.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
drivers/pwm/pwm-sun4i.c | 31 ++++++++++++++++++++++++++++++-
|
||||
1 file changed, 30 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/drivers/pwm/pwm-sun4i.c b/drivers/pwm/pwm-sun4i.c
|
||||
index 9e0eca79ff88..848cff26f385 100644
|
||||
--- a/drivers/pwm/pwm-sun4i.c
|
||||
+++ b/drivers/pwm/pwm-sun4i.c
|
||||
@@ -120,6 +120,19 @@ static void sun4i_pwm_get_state(struct pwm_chip *chip,
|
||||
|
||||
val = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG);
|
||||
|
||||
+ /*
|
||||
+ * PWM chapter in H6 manual has a diagram which explains that if bypass
|
||||
+ * bit is set, no other setting has any meaning. Even more, experiment
|
||||
+ * proved that also enable bit is ignored in this case.
|
||||
+ */
|
||||
+ if (val & BIT_CH(PWM_BYPASS, pwm->hwpwm)) {
|
||||
+ state->period = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC, clk_rate);
|
||||
+ state->duty_cycle = state->period / 2;
|
||||
+ state->polarity = PWM_POLARITY_NORMAL;
|
||||
+ state->enabled = true;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
if ((PWM_REG_PRESCAL(val, pwm->hwpwm) == PWM_PRESCAL_MASK) &&
|
||||
sun4i_pwm->data->has_prescaler_bypass)
|
||||
prescaler = 1;
|
||||
@@ -211,7 +224,8 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
{
|
||||
struct sun4i_pwm_chip *sun4i_pwm = to_sun4i_pwm_chip(chip);
|
||||
struct pwm_state cstate;
|
||||
- u32 ctrl;
|
||||
+ u32 ctrl, clk_rate;
|
||||
+ bool bypass;
|
||||
int ret;
|
||||
unsigned int delay_us;
|
||||
unsigned long now;
|
||||
@@ -226,6 +240,16 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
}
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Although it would make much more sense to check for bypass in
|
||||
+ * sun4i_pwm_calculate(), value of bypass bit also depends on "enabled".
|
||||
+ * Period is allowed to be rounded up or down.
|
||||
+ */
|
||||
+ clk_rate = clk_get_rate(sun4i_pwm->clk);
|
||||
+ bypass = (state->period == NSEC_PER_SEC / clk_rate ||
|
||||
+ state->period == DIV_ROUND_UP(NSEC_PER_SEC, clk_rate)) &&
|
||||
+ state->enabled;
|
||||
+
|
||||
spin_lock(&sun4i_pwm->ctrl_lock);
|
||||
ctrl = sun4i_pwm_readl(sun4i_pwm, PWM_CTRL_REG);
|
||||
|
||||
@@ -273,6 +297,11 @@ static int sun4i_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||
ctrl &= ~BIT_CH(PWM_CLK_GATING, pwm->hwpwm);
|
||||
}
|
||||
|
||||
+ if (bypass)
|
||||
+ ctrl |= BIT_CH(PWM_BYPASS, pwm->hwpwm);
|
||||
+ else
|
||||
+ ctrl &= ~BIT_CH(PWM_BYPASS, pwm->hwpwm);
|
||||
+
|
||||
sun4i_pwm_writel(sun4i_pwm, ctrl, PWM_CTRL_REG);
|
||||
|
||||
spin_unlock(&sun4i_pwm->ctrl_lock);
|
||||
|
||||
Allwinner H6 PWM is similar to that in A20 except that it has additional
|
||||
bus clock and reset line.
|
||||
|
||||
Note that first PWM channel is connected to output pin and second
|
||||
channel is used internally, as a clock source to AC200 co-packaged chip.
|
||||
This means that any combination of these two channels can be used and
|
||||
thus it doesn't make sense to add pinctrl nodes at this point.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
index e8bed58e7246..c1abd805cfdc 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
@@ -229,6 +229,16 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ pwm: pwm@300a000 {
|
||||
+ compatible = "allwinner,sun50i-h6-pwm";
|
||||
+ reg = <0x0300a000 0x400>;
|
||||
+ clocks = <&osc24M>, <&ccu CLK_BUS_PWM>;
|
||||
+ clock-names = "pwm", "bus";
|
||||
+ resets = <&ccu RST_BUS_PWM>;
|
||||
+ #pwm-cells = <3>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
pio: pinctrl@300b000 {
|
||||
compatible = "allwinner,sun50i-h6-pinctrl";
|
||||
reg = <0x0300b000 0x400>;
|
|
@ -1,569 +0,0 @@
|
|||
diff -Naur linux-5.3-rc2-old/drivers/mfd/ac200.c linux-5.3-rc2-old-new/drivers/mfd/ac200.c
|
||||
--- linux-5.3-rc2-old/drivers/mfd/ac200.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-5.3-rc2-old-new/drivers/mfd/ac200.c 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -0,0 +1,223 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-only
|
||||
+/*
|
||||
+ * MFD core driver for X-Powers' AC200 IC
|
||||
+ *
|
||||
+ * The AC200 is a chip which is co-packaged with Allwinner H6 SoC and
|
||||
+ * includes analog audio codec, analog TV encoder, ethernet PHY, eFuse
|
||||
+ * and RTC.
|
||||
+ *
|
||||
+ * Copyright (c) 2019 Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ *
|
||||
+ * Based on AC100 driver with following copyrights:
|
||||
+ * Copyright (2016) Chen-Yu Tsai
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/i2c.h>
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/mfd/core.h>
|
||||
+#include <linux/mfd/ac200.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/mutex.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/regmap.h>
|
||||
+
|
||||
+struct ac200_dev {
|
||||
+ struct clk *clk;
|
||||
+ /*
|
||||
+ * Lock is needed for serializing concurrent access to
|
||||
+ * AC200 registers in order not to mess with register page.
|
||||
+ */
|
||||
+ struct mutex lock;
|
||||
+ struct regmap *regmap;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Register values can't be cached because registers are divided
|
||||
+ * into multiple pages.
|
||||
+ */
|
||||
+static const struct regmap_config ac200_regmap_config = {
|
||||
+ .reg_bits = 8,
|
||||
+ .val_bits = 16,
|
||||
+};
|
||||
+
|
||||
+int ac200_reg_read(struct ac200_dev *ac200, u16 reg, u16 *value)
|
||||
+{
|
||||
+ unsigned int val;
|
||||
+ int ret;
|
||||
+
|
||||
+ mutex_lock(&ac200->lock);
|
||||
+ ret = regmap_write(ac200->regmap, AC200_TWI_REG_ADDR_H, reg >> 8);
|
||||
+ if (ret)
|
||||
+ goto read_reg_out;
|
||||
+
|
||||
+ ret = regmap_read(ac200->regmap, reg & 0xff, &val);
|
||||
+ *value = val;
|
||||
+
|
||||
+read_reg_out:
|
||||
+ mutex_unlock(&ac200->lock);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(ac200_reg_read);
|
||||
+
|
||||
+int ac200_reg_write(struct ac200_dev *ac200, u16 reg, u16 value)
|
||||
+{
|
||||
+ int ret;
|
||||
+
|
||||
+ mutex_lock(&ac200->lock);
|
||||
+ ret = regmap_write(ac200->regmap, AC200_TWI_REG_ADDR_H, reg >> 8);
|
||||
+ if (ret)
|
||||
+ goto write_reg_out;
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, reg & 0xff, value);
|
||||
+
|
||||
+write_reg_out:
|
||||
+ mutex_unlock(&ac200->lock);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(ac200_reg_write);
|
||||
+
|
||||
+int ac200_reg_mod(struct ac200_dev *ac200, u16 reg, u16 mask, u16 value)
|
||||
+{
|
||||
+ unsigned int val;
|
||||
+ int ret;
|
||||
+
|
||||
+ mutex_lock(&ac200->lock);
|
||||
+ ret = regmap_write(ac200->regmap, AC200_TWI_REG_ADDR_H, reg >> 8);
|
||||
+ if (ret)
|
||||
+ goto mod_reg_out;
|
||||
+
|
||||
+ ret = regmap_read(ac200->regmap, reg & 0xff, &val);
|
||||
+ if (ret)
|
||||
+ goto mod_reg_out;
|
||||
+
|
||||
+ val &= ~mask;
|
||||
+ val |= value;
|
||||
+
|
||||
+ ret = regmap_write(ac200->regmap, reg & 0xff, val);
|
||||
+
|
||||
+mod_reg_out:
|
||||
+ mutex_unlock(&ac200->lock);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+EXPORT_SYMBOL_GPL(ac200_reg_mod);
|
||||
+
|
||||
+static struct mfd_cell ac200_cells[] = {
|
||||
+ {
|
||||
+ .name = "ac200-codec",
|
||||
+ .of_compatible = "x-powers,ac200-codec",
|
||||
+ }, {
|
||||
+ .name = "ac200-efuse",
|
||||
+ .of_compatible = "x-powers,ac200-efuse",
|
||||
+ }, {
|
||||
+ .name = "ac200-ephy",
|
||||
+ .of_compatible = "x-powers,ac200-ephy",
|
||||
+ }, {
|
||||
+ .name = "ac200-rtc",
|
||||
+ .of_compatible = "x-powers,ac200-rtc",
|
||||
+ }, {
|
||||
+ .name = "ac200-tve",
|
||||
+ .of_compatible = "x-powers,ac200-tve",
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int ac200_i2c_probe(struct i2c_client *i2c,
|
||||
+ const struct i2c_device_id *id)
|
||||
+{
|
||||
+ struct device *dev = &i2c->dev;
|
||||
+ struct ac200_dev *ac200;
|
||||
+ int ret;
|
||||
+
|
||||
+ ac200 = devm_kzalloc(dev, sizeof(*ac200), GFP_KERNEL);
|
||||
+ if (!ac200)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ mutex_init(&ac200->lock);
|
||||
+ i2c_set_clientdata(i2c, ac200);
|
||||
+
|
||||
+ ac200->clk = devm_clk_get(dev, NULL);
|
||||
+ if (IS_ERR(ac200->clk)) {
|
||||
+ ret = PTR_ERR(ac200->clk);
|
||||
+ dev_err(dev, "Can't obtain the clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ac200->regmap = devm_regmap_init_i2c(i2c, &ac200_regmap_config);
|
||||
+ if (IS_ERR(ac200->regmap)) {
|
||||
+ ret = PTR_ERR(ac200->regmap);
|
||||
+ dev_err(dev, "Regmap init failed: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = clk_prepare_enable(ac200->clk);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Can't enable the clock: %d\n", ret);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ ret = ac200_reg_write(ac200, AC200_SYS_CONTROL, 0);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Can't put AC200 in reset: %d\n", ret);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ ret = ac200_reg_write(ac200, AC200_SYS_CONTROL, 1);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Can't put AC200 out of reset: %d\n", ret);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, ac200_cells,
|
||||
+ ARRAY_SIZE(ac200_cells), NULL, 0, NULL);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Failed to add MFD devices: %d\n", ret);
|
||||
+ goto err;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err:
|
||||
+ clk_disable_unprepare(ac200->clk);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static int ac200_i2c_remove(struct i2c_client *i2c)
|
||||
+{
|
||||
+ struct ac200_dev *ac200 = i2c_get_clientdata(i2c);
|
||||
+
|
||||
+ ac200_reg_write(ac200, AC200_SYS_CONTROL, 0);
|
||||
+
|
||||
+ clk_disable_unprepare(ac200->clk);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct i2c_device_id ac200_ids[] = {
|
||||
+ { "ac200", },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(i2c, ac200_ids);
|
||||
+
|
||||
+static const struct of_device_id ac200_of_match[] = {
|
||||
+ { .compatible = "x-powers,ac200" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ac200_of_match);
|
||||
+
|
||||
+static struct i2c_driver ac200_i2c_driver = {
|
||||
+ .driver = {
|
||||
+ .name = "ac200",
|
||||
+ .of_match_table = of_match_ptr(ac200_of_match),
|
||||
+ },
|
||||
+ .probe = ac200_i2c_probe,
|
||||
+ .remove = ac200_i2c_remove,
|
||||
+ .id_table = ac200_ids,
|
||||
+};
|
||||
+module_i2c_driver(ac200_i2c_driver);
|
||||
+
|
||||
+MODULE_DESCRIPTION("MFD core driver for AC200");
|
||||
+MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>");
|
||||
+MODULE_LICENSE("GPL v2");
|
||||
diff -Naur linux-5.3-rc2-old/drivers/mfd/Kconfig linux-5.3-rc2-old-new/drivers/mfd/Kconfig
|
||||
--- linux-5.3-rc2-old/drivers/mfd/Kconfig 2019-07-28 21:47:02.000000000 +0200
|
||||
+++ linux-5.3-rc2-old-new/drivers/mfd/Kconfig 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -178,6 +178,15 @@
|
||||
This driver include only the core APIs. You have to select individual
|
||||
components like codecs or RTC under the corresponding menus.
|
||||
|
||||
+config MFD_AC200
|
||||
+ tristate "X-Powers AC200"
|
||||
+ select MFD_CORE
|
||||
+ depends on I2C
|
||||
+ help
|
||||
+ If you say Y here you get support for the X-Powers AC200 IC.
|
||||
+ This driver include only the core APIs. You have to select individual
|
||||
+ components like Ethernet PHY or RTC under the corresponding menus.
|
||||
+
|
||||
config MFD_AXP20X
|
||||
tristate
|
||||
select MFD_CORE
|
||||
diff -Naur linux-5.3-rc2-old/drivers/mfd/Makefile linux-5.3-rc2-old-new/drivers/mfd/Makefile
|
||||
--- linux-5.3-rc2-old/drivers/mfd/Makefile 2019-07-28 21:47:02.000000000 +0200
|
||||
+++ linux-5.3-rc2-old-new/drivers/mfd/Makefile 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -143,6 +143,7 @@
|
||||
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
|
||||
|
||||
obj-$(CONFIG_MFD_AC100) += ac100.o
|
||||
+obj-$(CONFIG_MFD_AC200) += ac200.o
|
||||
obj-$(CONFIG_MFD_AXP20X) += axp20x.o
|
||||
obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
|
||||
obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
|
||||
diff -Naur linux-5.3-rc2-old/drivers/net/phy/ac200.c linux-5.3-rc2-old-new/drivers/net/phy/ac200.c
|
||||
--- linux-5.3-rc2-old/drivers/net/phy/ac200.c 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-5.3-rc2-old-new/drivers/net/phy/ac200.c 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -0,0 +1,231 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/**
|
||||
+ * Driver for AC200 Ethernet PHY
|
||||
+ *
|
||||
+ * Copyright (c) 2019 Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/mfd/ac200.h>
|
||||
+#include <linux/nvmem-consumer.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/phy.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+
|
||||
+#define AC200_EPHY_ID 0x00441400
|
||||
+#define AC200_EPHY_ID_MASK 0x0ffffff0
|
||||
+
|
||||
+/* macros for system ephy control 0 register */
|
||||
+#define AC200_EPHY_RESET_INVALID BIT(0)
|
||||
+#define AC200_EPHY_SYSCLK_GATING BIT(1)
|
||||
+
|
||||
+/* macros for system ephy control 1 register */
|
||||
+#define AC200_EPHY_E_EPHY_MII_IO_EN BIT(0)
|
||||
+#define AC200_EPHY_E_LNK_LED_IO_EN BIT(1)
|
||||
+#define AC200_EPHY_E_SPD_LED_IO_EN BIT(2)
|
||||
+#define AC200_EPHY_E_DPX_LED_IO_EN BIT(3)
|
||||
+
|
||||
+/* macros for ephy control register */
|
||||
+#define AC200_EPHY_SHUTDOWN BIT(0)
|
||||
+#define AC200_EPHY_LED_POL BIT(1)
|
||||
+#define AC200_EPHY_CLK_SEL BIT(2)
|
||||
+#define AC200_EPHY_ADDR(x) (((x) & 0x1F) << 4)
|
||||
+#define AC200_EPHY_XMII_SEL BIT(11)
|
||||
+#define AC200_EPHY_CALIB(x) (((x) & 0xF) << 12)
|
||||
+
|
||||
+struct ac200_ephy_dev {
|
||||
+ struct phy_driver *ephy;
|
||||
+ struct ac200_dev *ac200;
|
||||
+};
|
||||
+
|
||||
+static char *ac200_phy_name = "AC200 EPHY";
|
||||
+
|
||||
+static void disable_intelligent_ieee(struct phy_device *phydev)
|
||||
+{
|
||||
+ unsigned int value;
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0100); /* switch to page 1 */
|
||||
+ value = phy_read(phydev, 0x17);
|
||||
+ value &= ~BIT(3); /* disable IEEE */
|
||||
+ phy_write(phydev, 0x17, value);
|
||||
+ phy_write(phydev, 0x1f, 0x0000); /* switch to page 0 */
|
||||
+}
|
||||
+
|
||||
+static void disable_802_3az_ieee(struct phy_device *phydev)
|
||||
+{
|
||||
+ unsigned int value;
|
||||
+
|
||||
+ phy_write(phydev, 0xd, 0x7);
|
||||
+ phy_write(phydev, 0xe, 0x3c);
|
||||
+ phy_write(phydev, 0xd, BIT(14) | 0x7);
|
||||
+ value = phy_read(phydev, 0xe);
|
||||
+ value &= ~BIT(1);
|
||||
+ phy_write(phydev, 0xd, 0x7);
|
||||
+ phy_write(phydev, 0xe, 0x3c);
|
||||
+ phy_write(phydev, 0xd, BIT(14) | 0x7);
|
||||
+ phy_write(phydev, 0xe, value);
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0200); /* switch to page 2 */
|
||||
+ phy_write(phydev, 0x18, 0x0000);
|
||||
+}
|
||||
+
|
||||
+static int ac200_ephy_config_init(struct phy_device *phydev)
|
||||
+{
|
||||
+ const struct ac200_ephy_dev *priv = phydev->drv->driver_data;
|
||||
+ u16 value;
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0100); /* Switch to Page 1 */
|
||||
+ phy_write(phydev, 0x12, 0x4824); /* Disable APS */
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0200); /* Switch to Page 2 */
|
||||
+ phy_write(phydev, 0x18, 0x0000); /* PHYAFE TRX optimization */
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0600); /* Switch to Page 6 */
|
||||
+ phy_write(phydev, 0x14, 0x708f); /* PHYAFE TX optimization */
|
||||
+ phy_write(phydev, 0x13, 0xF000); /* PHYAFE RX optimization */
|
||||
+ phy_write(phydev, 0x15, 0x1530);
|
||||
+
|
||||
+ phy_write(phydev, 0x1f, 0x0800); /* Switch to Page 6 */
|
||||
+ phy_write(phydev, 0x18, 0x00bc); /* PHYAFE TRX optimization */
|
||||
+
|
||||
+ disable_intelligent_ieee(phydev); /* Disable Intelligent IEEE */
|
||||
+ disable_802_3az_ieee(phydev); /* Disable 802.3az IEEE */
|
||||
+ phy_write(phydev, 0x1f, 0x0000); /* Switch to Page 0 */
|
||||
+
|
||||
+ value = (phydev->interface == PHY_INTERFACE_MODE_RMII) ?
|
||||
+ AC200_EPHY_XMII_SEL : 0;
|
||||
+ ac200_reg_mod(priv->ac200, AC200_EPHY_CTL, AC200_EPHY_XMII_SEL, value);
|
||||
+
|
||||
+ /* FIXME: This is probably H6 specific */
|
||||
+ value = phy_read(phydev, 0x13);
|
||||
+ value |= BIT(12);
|
||||
+ phy_write(phydev, 0x13, value);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static const struct mdio_device_id __maybe_unused ac200_ephy_phy_tbl[] = {
|
||||
+ { AC200_EPHY_ID, AC200_EPHY_ID_MASK },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(mdio, ac200_ephy_phy_tbl);
|
||||
+
|
||||
+static int ac200_ephy_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ac200_dev *ac200 = dev_get_drvdata(pdev->dev.parent);
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct ac200_ephy_dev *priv;
|
||||
+ struct nvmem_cell *calcell;
|
||||
+ struct phy_driver *ephy;
|
||||
+ u16 *caldata, calib;
|
||||
+ size_t callen;
|
||||
+ int ret;
|
||||
+
|
||||
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||
+ if (!priv)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ ephy = devm_kzalloc(dev, sizeof(*ephy), GFP_KERNEL);
|
||||
+ if (!ephy)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ calcell = devm_nvmem_cell_get(dev, "ephy_calib");
|
||||
+ if (IS_ERR(calcell)) {
|
||||
+ dev_err(dev, "Unable to find calibration data!\n");
|
||||
+ return PTR_ERR(calcell);
|
||||
+ }
|
||||
+
|
||||
+ caldata = nvmem_cell_read(calcell, &callen);
|
||||
+ if (IS_ERR(caldata)) {
|
||||
+ dev_err(dev, "Unable to read calibration data!\n");
|
||||
+ return PTR_ERR(caldata);
|
||||
+ }
|
||||
+
|
||||
+ if (callen != 2) {
|
||||
+ dev_err(dev, "Calibration data has wrong length: 2 != %lu\n",
|
||||
+ callen);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ calib = *caldata + 3;
|
||||
+ kfree(caldata);
|
||||
+
|
||||
+ ephy->phy_id = AC200_EPHY_ID;
|
||||
+ ephy->phy_id_mask = AC200_EPHY_ID_MASK;
|
||||
+ ephy->name = ac200_phy_name;
|
||||
+ ephy->driver_data = priv;
|
||||
+ ephy->soft_reset = genphy_soft_reset;
|
||||
+ ephy->config_init = ac200_ephy_config_init;
|
||||
+ ephy->suspend = genphy_suspend;
|
||||
+ ephy->resume = genphy_resume;
|
||||
+
|
||||
+ priv->ac200 = ac200;
|
||||
+ priv->ephy = ephy;
|
||||
+ platform_set_drvdata(pdev, priv);
|
||||
+
|
||||
+ ret = ac200_reg_write(ac200, AC200_SYS_EPHY_CTL0,
|
||||
+ AC200_EPHY_RESET_INVALID |
|
||||
+ AC200_EPHY_SYSCLK_GATING);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = ac200_reg_write(ac200, AC200_SYS_EPHY_CTL1,
|
||||
+ AC200_EPHY_E_EPHY_MII_IO_EN |
|
||||
+ AC200_EPHY_E_LNK_LED_IO_EN |
|
||||
+ AC200_EPHY_E_SPD_LED_IO_EN |
|
||||
+ AC200_EPHY_E_DPX_LED_IO_EN);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = ac200_reg_write(ac200, AC200_EPHY_CTL,
|
||||
+ AC200_EPHY_LED_POL |
|
||||
+ AC200_EPHY_CLK_SEL |
|
||||
+ AC200_EPHY_ADDR(1) |
|
||||
+ AC200_EPHY_CALIB(calib));
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+
|
||||
+ ret = phy_driver_register(priv->ephy, THIS_MODULE);
|
||||
+ if (ret) {
|
||||
+ dev_err(dev, "Unable to register phy\n");
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int ac200_ephy_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct ac200_ephy_dev *priv = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ phy_driver_unregister(priv->ephy);
|
||||
+
|
||||
+ ac200_reg_write(priv->ac200, AC200_EPHY_CTL,
|
||||
+ AC200_EPHY_SHUTDOWN);
|
||||
+ ac200_reg_write(priv->ac200, AC200_SYS_EPHY_CTL1, 0);
|
||||
+ ac200_reg_write(priv->ac200, AC200_SYS_EPHY_CTL0, 0);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id ac200_ephy_match[] = {
|
||||
+ { .compatible = "x-powers,ac200-ephy" },
|
||||
+ { /* sentinel */ }
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, ac200_ephy_match);
|
||||
+
|
||||
+static struct platform_driver ac200_ephy_driver = {
|
||||
+ .probe = ac200_ephy_probe,
|
||||
+ .remove = ac200_ephy_remove,
|
||||
+ .driver = {
|
||||
+ .name = "ac200-ephy",
|
||||
+ .of_match_table = ac200_ephy_match,
|
||||
+ },
|
||||
+};
|
||||
+module_platform_driver(ac200_ephy_driver);
|
||||
+
|
||||
+MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@siol.net>>");
|
||||
+MODULE_DESCRIPTION("AC200 Ethernet PHY driver");
|
||||
+MODULE_LICENSE("GPL");
|
||||
diff -Naur linux-5.3-rc2-old/drivers/net/phy/Kconfig linux-5.3-rc2-old-new/drivers/net/phy/Kconfig
|
||||
--- linux-5.3-rc2-old/drivers/net/phy/Kconfig 2019-07-28 21:47:02.000000000 +0200
|
||||
+++ linux-5.3-rc2-old-new/drivers/net/phy/Kconfig 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -244,6 +244,13 @@
|
||||
depends on HWMON || HWMON=n
|
||||
select MDIO_I2C
|
||||
|
||||
+config AC200_PHY
|
||||
+ tristate "AC200 EPHY"
|
||||
+ depends on NVMEM
|
||||
+ depends on OF
|
||||
+ help
|
||||
+ Fast ethernet PHY as found in X-Powers AC200 multi-function device.
|
||||
+
|
||||
config AMD_PHY
|
||||
tristate "AMD PHYs"
|
||||
---help---
|
||||
diff -Naur linux-5.3-rc2-old/drivers/net/phy/Makefile linux-5.3-rc2-old-new/drivers/net/phy/Makefile
|
||||
--- linux-5.3-rc2-old/drivers/net/phy/Makefile 2019-07-28 21:47:02.000000000 +0200
|
||||
+++ linux-5.3-rc2-old-new/drivers/net/phy/Makefile 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -46,6 +46,7 @@
|
||||
sfp-obj-$(CONFIG_SFP) += sfp-bus.o
|
||||
obj-y += $(sfp-obj-y) $(sfp-obj-m)
|
||||
|
||||
+obj-$(CONFIG_AC200_PHY) += ac200.o
|
||||
obj-$(CONFIG_ADIN_PHY) += adin.o
|
||||
obj-$(CONFIG_AMD_PHY) += amd.o
|
||||
aquantia-objs += aquantia_main.o
|
||||
|
||||
diff -Naur linux-5.3-rc2-old/include/linux/mfd/ac200.h linux-5.3-rc2-old-new/include/linux/mfd/ac200.h
|
||||
--- linux-5.3-rc2-old/include/linux/mfd/ac200.h 1970-01-01 01:00:00.000000000 +0100
|
||||
+++ linux-5.3-rc2-old-new/include/linux/mfd/ac200.h 2019-08-03 15:24:25.929999997 +0200
|
||||
@@ -0,0 +1,44 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
+/*
|
||||
+ * Functions and registers to access AC200 IC.
|
||||
+ *
|
||||
+ * Copyright (C) 2019 Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __LINUX_MFD_AC200_H
|
||||
+#define __LINUX_MFD_AC200_H
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+
|
||||
+struct ac200_dev;
|
||||
+
|
||||
+/* interface registers (can be accessed from any page) */
|
||||
+#define AC200_TWI_CHANGE_TO_RSB 0x3E
|
||||
+#define AC200_TWI_PAD_DELAY 0xC4
|
||||
+#define AC200_TWI_REG_ADDR_H 0xFE
|
||||
+
|
||||
+/* General registers */
|
||||
+#define AC200_SYS_VERSION 0x0000
|
||||
+#define AC200_SYS_CONTROL 0x0002
|
||||
+#define AC200_SYS_IRQ_ENABLE 0x0004
|
||||
+#define AC200_SYS_IRQ_STATUS 0x0006
|
||||
+#define AC200_SYS_CLK_CTL 0x0008
|
||||
+#define AC200_SYS_DLDO_OSC_CTL 0x000A
|
||||
+#define AC200_SYS_PLL_CTL0 0x000C
|
||||
+#define AC200_SYS_PLL_CTL1 0x000E
|
||||
+#define AC200_SYS_AUDIO_CTL0 0x0010
|
||||
+#define AC200_SYS_AUDIO_CTL1 0x0012
|
||||
+#define AC200_SYS_EPHY_CTL0 0x0014
|
||||
+#define AC200_SYS_EPHY_CTL1 0x0016
|
||||
+#define AC200_SYS_TVE_CTL0 0x0018
|
||||
+#define AC200_SYS_TVE_CTL1 0x001A
|
||||
+
|
||||
+/* EPHY registers */
|
||||
+#define AC200_EPHY_CTL 0x6000
|
||||
+#define AC200_EPHY_BIST 0x6002
|
||||
+
|
||||
+int ac200_reg_read(struct ac200_dev *ac200, u16 reg, u16 *value);
|
||||
+int ac200_reg_write(struct ac200_dev *ac200, u16 reg, u16 value);
|
||||
+int ac200_reg_mod(struct ac200_dev *ac200, u16 reg, u16 mask, u16 value);
|
||||
+
|
||||
+#endif /* __LINUX_MFD_AC200_H */
|
|
@ -1,79 +0,0 @@
|
|||
diff -Naur linux-5.3-rc6-old/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi linux-5.3-rc6-new/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
--- linux-5.3-rc6-old/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi 2019-09-02 12:17:46.116666674 +0200
|
||||
+++ linux-5.3-rc6-new/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi 2019-09-02 12:31:05.253333344 +0200
|
||||
@@ -17,6 +17,16 @@
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
+ ac200_pwm_clk: ac200_clk {
|
||||
+ compatible = "pwm-clock";
|
||||
+ #clock-cells = <0>;
|
||||
+ clock-frequency = <24000000>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&pwm1_pin>;
|
||||
+ pwms = <&pwm 1 42 0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
cpus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@@ -241,7 +250,10 @@
|
||||
reg = <0x03006000 0x400>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
+ ephy_calib: ephy_calib@2c {
|
||||
+ reg = <0x2c 0x2>;
|
||||
+ };
|
||||
speedbin_efuse: speed@1c {
|
||||
reg = <0x1c 0x4>;
|
||||
};
|
||||
@@ -326,6 +341,16 @@
|
||||
pins = "PH0", "PH1";
|
||||
function = "uart0";
|
||||
};
|
||||
+
|
||||
+ i2c3_pins: i2c3-pins {
|
||||
+ pins = "PB17", "PB18";
|
||||
+ function = "i2c3";
|
||||
+ };
|
||||
+
|
||||
+ pwm1_pin: pwm1-pin {
|
||||
+ pins = "PB19";
|
||||
+ function = "pwm1";
|
||||
+ };
|
||||
};
|
||||
|
||||
gic: interrupt-controller@3021000 {
|
||||
@@ -431,6 +456,30 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ i2c3: i2c@5002c00 {
|
||||
+ compatible = "allwinner,sun6i-a31-i2c";
|
||||
+ reg = <0x05002c00 0x400>;
|
||||
+ interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
|
||||
+ clocks = <&ccu CLK_BUS_I2C3>;
|
||||
+ resets = <&ccu RST_BUS_I2C3>;
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&i2c3_pins>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+
|
||||
+ ac200: mfd@10 {
|
||||
+ compatible = "x-powers,ac200";
|
||||
+ reg = <0x10>;
|
||||
+ clocks = <&ac200_pwm_clk>;
|
||||
+
|
||||
+ ac200_ephy: phy {
|
||||
+ compatible = "x-powers,ac200-ephy";
|
||||
+ nvmem-cells = <&ephy_calib>;
|
||||
+ nvmem-cell-names = "ephy_calib";
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
emac: ethernet@5020000 {
|
||||
compatible = "allwinner,sun50i-h6-emac",
|
||||
"allwinner,sun50i-a64-emac";
|
|
@ -1,127 +0,0 @@
|
|||
|
||||
From dec555256f2cb61ee94975727ec2d4a8d592ac92 Mon Sep 17 00:00:00 2001
|
||||
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Date: Fri, 30 Aug 2019 06:26:23 -0300
|
||||
Subject: [PATCH] media: cedrus: choose default pixelformat in try_fmt
|
||||
|
||||
If an unsupported pixelformat is passed to try_fmt, then pick
|
||||
the first valid pixelformat instead. This is more standard V4L2
|
||||
behavior.
|
||||
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
.../staging/media/sunxi/cedrus/cedrus_video.c | 46 ++++++++-----------
|
||||
1 file changed, 20 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index eeee3efd247b..d69c9bcdb8e2 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -62,33 +62,30 @@ static inline struct cedrus_ctx *cedrus_file2ctx(struct file *file)
|
||||
static struct cedrus_format *cedrus_find_format(u32 pixelformat, u32 directions,
|
||||
unsigned int capabilities)
|
||||
{
|
||||
+ struct cedrus_format *first_valid_fmt = NULL;
|
||||
struct cedrus_format *fmt;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < CEDRUS_FORMATS_COUNT; i++) {
|
||||
fmt = &cedrus_formats[i];
|
||||
|
||||
- if (fmt->capabilities && (fmt->capabilities & capabilities) !=
|
||||
- fmt->capabilities)
|
||||
+ if ((fmt->capabilities & capabilities) != fmt->capabilities ||
|
||||
+ !(fmt->directions & directions))
|
||||
continue;
|
||||
|
||||
- if (fmt->pixelformat == pixelformat &&
|
||||
- (fmt->directions & directions) != 0)
|
||||
+ if (fmt->pixelformat == pixelformat)
|
||||
break;
|
||||
+
|
||||
+ if (!first_valid_fmt)
|
||||
+ first_valid_fmt = fmt;
|
||||
}
|
||||
|
||||
if (i == CEDRUS_FORMATS_COUNT)
|
||||
- return NULL;
|
||||
+ return first_valid_fmt;
|
||||
|
||||
return &cedrus_formats[i];
|
||||
}
|
||||
|
||||
-static bool cedrus_check_format(u32 pixelformat, u32 directions,
|
||||
- unsigned int capabilities)
|
||||
-{
|
||||
- return cedrus_find_format(pixelformat, directions, capabilities);
|
||||
-}
|
||||
-
|
||||
static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
|
||||
{
|
||||
unsigned int width = pix_fmt->width;
|
||||
@@ -252,11 +249,14 @@ static int cedrus_try_fmt_vid_cap(struct file *file, void *priv,
|
||||
struct cedrus_ctx *ctx = cedrus_file2ctx(file);
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
struct v4l2_pix_format *pix_fmt = &f->fmt.pix;
|
||||
+ struct cedrus_format *fmt =
|
||||
+ cedrus_find_format(pix_fmt->pixelformat, CEDRUS_DECODE_DST,
|
||||
+ dev->capabilities);
|
||||
|
||||
- if (!cedrus_check_format(pix_fmt->pixelformat, CEDRUS_DECODE_DST,
|
||||
- dev->capabilities))
|
||||
+ if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
+ pix_fmt->pixelformat = fmt->pixelformat;
|
||||
cedrus_prepare_format(pix_fmt);
|
||||
|
||||
return 0;
|
||||
@@ -268,15 +268,18 @@ static int cedrus_try_fmt_vid_out(struct file *file, void *priv,
|
||||
struct cedrus_ctx *ctx = cedrus_file2ctx(file);
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
struct v4l2_pix_format *pix_fmt = &f->fmt.pix;
|
||||
+ struct cedrus_format *fmt =
|
||||
+ cedrus_find_format(pix_fmt->pixelformat, CEDRUS_DECODE_SRC,
|
||||
+ dev->capabilities);
|
||||
|
||||
- if (!cedrus_check_format(pix_fmt->pixelformat, CEDRUS_DECODE_SRC,
|
||||
- dev->capabilities))
|
||||
+ if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
/* Source image size has to be provided by userspace. */
|
||||
if (pix_fmt->sizeimage == 0)
|
||||
return -EINVAL;
|
||||
|
||||
+ pix_fmt->pixelformat = fmt->pixelformat;
|
||||
cedrus_prepare_format(pix_fmt);
|
||||
|
||||
return 0;
|
||||
@@ -364,21 +367,12 @@ static int cedrus_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
|
||||
struct device *alloc_devs[])
|
||||
{
|
||||
struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
- struct cedrus_dev *dev = ctx->dev;
|
||||
struct v4l2_pix_format *pix_fmt;
|
||||
- u32 directions;
|
||||
|
||||
- if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
|
||||
- directions = CEDRUS_DECODE_SRC;
|
||||
+ if (V4L2_TYPE_IS_OUTPUT(vq->type))
|
||||
pix_fmt = &ctx->src_fmt;
|
||||
- } else {
|
||||
- directions = CEDRUS_DECODE_DST;
|
||||
+ else
|
||||
pix_fmt = &ctx->dst_fmt;
|
||||
- }
|
||||
-
|
||||
- if (!cedrus_check_format(pix_fmt->pixelformat, directions,
|
||||
- dev->capabilities))
|
||||
- return -EINVAL;
|
||||
|
||||
if (*nplanes) {
|
||||
if (sizes[0] < pix_fmt->sizeimage)
|
||||
--
|
||||
2.23.0
|
|
@ -1,135 +0,0 @@
|
|||
|
||||
From 965c71e8adcff315e16b58c00cd312598fc0222c Mon Sep 17 00:00:00 2001
|
||||
From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Date: Fri, 30 Aug 2019 06:26:24 -0300
|
||||
Subject: [PATCH] media: cedrus: fix various format-related compliance issues
|
||||
|
||||
Initialize the context on open() with valid capture and output
|
||||
formats. It is good practice to always have valid formats internally.
|
||||
|
||||
This solves one vb2 warning in the kernel log where the sizeimage
|
||||
value of the output format was 0 when requesting buffers, which is
|
||||
not allowed.
|
||||
|
||||
It also simplifies the g_fmt ioctl implementations since they no longer
|
||||
have to check if a valid format was ever set.
|
||||
|
||||
cedrus_prepare_format() now also validates sizeimage for the output
|
||||
formats, ensuring userspace can't set it to 0 since that would cause
|
||||
the same vb2 warning.
|
||||
|
||||
Finally remove the sizeimage == 0 check in cedrus_try_fmt_vid_out()
|
||||
since cedrus_prepare_format() will now adjust this value.
|
||||
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Reviewed-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.c | 10 +++++++
|
||||
.../staging/media/sunxi/cedrus/cedrus_video.c | 28 ++-----------------
|
||||
.../staging/media/sunxi/cedrus/cedrus_video.h | 1 +
|
||||
3 files changed, 14 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
index 3439f6ad6338..0cf637c8a1e3 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.c
|
||||
@@ -241,6 +241,16 @@ static int cedrus_open(struct file *file)
|
||||
ret = PTR_ERR(ctx->fh.m2m_ctx);
|
||||
goto err_ctrls;
|
||||
}
|
||||
+ ctx->dst_fmt.pixelformat = V4L2_PIX_FMT_SUNXI_TILED_NV12;
|
||||
+ cedrus_prepare_format(&ctx->dst_fmt);
|
||||
+ ctx->src_fmt.pixelformat = V4L2_PIX_FMT_MPEG2_SLICE;
|
||||
+ /*
|
||||
+ * TILED_NV12 has more strict requirements, so copy the width and
|
||||
+ * height to src_fmt to ensure that is matches the dst_fmt resolution.
|
||||
+ */
|
||||
+ ctx->src_fmt.width = ctx->dst_fmt.width;
|
||||
+ ctx->src_fmt.height = ctx->dst_fmt.height;
|
||||
+ cedrus_prepare_format(&ctx->src_fmt);
|
||||
|
||||
v4l2_fh_add(&ctx->fh);
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index d69c9bcdb8e2..3ec3a2db790c 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -86,7 +86,7 @@ static struct cedrus_format *cedrus_find_format(u32 pixelformat, u32 directions,
|
||||
return &cedrus_formats[i];
|
||||
}
|
||||
|
||||
-static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
|
||||
+void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
|
||||
{
|
||||
unsigned int width = pix_fmt->width;
|
||||
unsigned int height = pix_fmt->height;
|
||||
@@ -104,7 +104,8 @@ static void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt)
|
||||
case V4L2_PIX_FMT_H264_SLICE:
|
||||
/* Zero bytes per line for encoded source. */
|
||||
bytesperline = 0;
|
||||
-
|
||||
+ /* Choose some minimum size since this can't be 0 */
|
||||
+ sizeimage = max_t(u32, SZ_1K, sizeimage);
|
||||
break;
|
||||
|
||||
case V4L2_PIX_FMT_SUNXI_TILED_NV12:
|
||||
@@ -211,16 +212,7 @@ static int cedrus_g_fmt_vid_cap(struct file *file, void *priv,
|
||||
{
|
||||
struct cedrus_ctx *ctx = cedrus_file2ctx(file);
|
||||
|
||||
- /* Fall back to dummy default by lack of hardware configuration. */
|
||||
- if (!ctx->dst_fmt.width || !ctx->dst_fmt.height) {
|
||||
- f->fmt.pix.pixelformat = V4L2_PIX_FMT_SUNXI_TILED_NV12;
|
||||
- cedrus_prepare_format(&f->fmt.pix);
|
||||
-
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
f->fmt.pix = ctx->dst_fmt;
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -229,17 +221,7 @@ static int cedrus_g_fmt_vid_out(struct file *file, void *priv,
|
||||
{
|
||||
struct cedrus_ctx *ctx = cedrus_file2ctx(file);
|
||||
|
||||
- /* Fall back to dummy default by lack of hardware configuration. */
|
||||
- if (!ctx->dst_fmt.width || !ctx->dst_fmt.height) {
|
||||
- f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG2_SLICE;
|
||||
- f->fmt.pix.sizeimage = SZ_1K;
|
||||
- cedrus_prepare_format(&f->fmt.pix);
|
||||
-
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
f->fmt.pix = ctx->src_fmt;
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -275,10 +257,6 @@ static int cedrus_try_fmt_vid_out(struct file *file, void *priv,
|
||||
if (!fmt)
|
||||
return -EINVAL;
|
||||
|
||||
- /* Source image size has to be provided by userspace. */
|
||||
- if (pix_fmt->sizeimage == 0)
|
||||
- return -EINVAL;
|
||||
-
|
||||
pix_fmt->pixelformat = fmt->pixelformat;
|
||||
cedrus_prepare_format(pix_fmt);
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.h b/drivers/staging/media/sunxi/cedrus/cedrus_video.h
|
||||
index 0e4f7a8cccf2..05050c0a0921 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.h
|
||||
@@ -26,5 +26,6 @@ extern const struct v4l2_ioctl_ops cedrus_ioctl_ops;
|
||||
|
||||
int cedrus_queue_init(void *priv, struct vb2_queue *src_vq,
|
||||
struct vb2_queue *dst_vq);
|
||||
+void cedrus_prepare_format(struct v4l2_pix_format *pix_fmt);
|
||||
|
||||
#endif
|
||||
--
|
||||
2.23.0
|
|
@ -1,139 +0,0 @@
|
|||
|
||||
From eabf10e5e3009e0c7e9a9b98a7f8299e690bcc55 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Fri, 11 Oct 2019 06:32:45 -0300
|
||||
Subject: [PATCH] media: cedrus: h264: Support multiple slices per frame
|
||||
|
||||
With recent changes, support for decoding multi-slice frames can be
|
||||
easily added now.
|
||||
|
||||
Signal VPU if current slice is first in frame or not and add information
|
||||
about first macroblock coordinates.
|
||||
|
||||
When frame contains multiple slices and driver works in slice mode, it's
|
||||
more efficient to hold capture buffer in queue until all slices of a
|
||||
same frame are decoded.
|
||||
|
||||
Add support for that to Cedrus driver by exposing and implementing
|
||||
V4L2_BUF_CAP_SUPPORTS_M2M_HOLD_CAPTURE_BUF capability.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
[hverkuil-cisco@xs4all.nl: rewritten to use v4l2_m2m_buf_done_and_job_finish]
|
||||
[hverkuil-cisco@xs4all.nl: removed unnecessary (u32) cast]
|
||||
[hverkuil-cisco@xs4all.nl: use new_frame v4l2_m2m_ctx bool]
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 12 +++++++++++-
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 16 ++--------------
|
||||
.../staging/media/sunxi/cedrus/cedrus_video.c | 14 ++++++++++++++
|
||||
3 files changed, 27 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index d6a782703c9b..cd85668f9c80 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -301,6 +301,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
dma_addr_t src_buf_addr;
|
||||
u32 offset = slice->header_bit_size;
|
||||
u32 len = (slice->size * 8) - offset;
|
||||
+ unsigned int pic_width_in_mbs;
|
||||
+ bool mbaff_pic;
|
||||
u32 reg;
|
||||
|
||||
cedrus_write(dev, VE_H264_VLD_LEN, len);
|
||||
@@ -370,12 +372,20 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
reg |= VE_H264_SPS_DIRECT_8X8_INFERENCE;
|
||||
cedrus_write(dev, VE_H264_SPS, reg);
|
||||
|
||||
+ mbaff_pic = !(slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC) &&
|
||||
+ (sps->flags & V4L2_H264_SPS_FLAG_MB_ADAPTIVE_FRAME_FIELD);
|
||||
+ pic_width_in_mbs = sps->pic_width_in_mbs_minus1 + 1;
|
||||
+
|
||||
// slice parameters
|
||||
reg = 0;
|
||||
+ reg |= ((slice->first_mb_in_slice % pic_width_in_mbs) & 0xff) << 24;
|
||||
+ reg |= (((slice->first_mb_in_slice / pic_width_in_mbs) *
|
||||
+ (mbaff_pic + 1)) & 0xff) << 16;
|
||||
reg |= decode->nal_ref_idc ? BIT(12) : 0;
|
||||
reg |= (slice->slice_type & 0xf) << 8;
|
||||
reg |= slice->cabac_init_idc & 0x3;
|
||||
- reg |= VE_H264_SHS_FIRST_SLICE_IN_PIC;
|
||||
+ if (ctx->fh.m2m_ctx->new_frame)
|
||||
+ reg |= VE_H264_SHS_FIRST_SLICE_IN_PIC;
|
||||
if (slice->flags & V4L2_H264_SLICE_FLAG_FIELD_PIC)
|
||||
reg |= VE_H264_SHS_FIELD_PIC;
|
||||
if (slice->flags & V4L2_H264_SLICE_FLAG_BOTTOM_FIELD)
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
index a942cd9bed57..e7e18424bab1 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
@@ -103,7 +103,6 @@ static irqreturn_t cedrus_irq(int irq, void *data)
|
||||
{
|
||||
struct cedrus_dev *dev = data;
|
||||
struct cedrus_ctx *ctx;
|
||||
- struct vb2_v4l2_buffer *src_buf, *dst_buf;
|
||||
enum vb2_buffer_state state;
|
||||
enum cedrus_irq_status status;
|
||||
|
||||
@@ -121,24 +120,13 @@ static irqreturn_t cedrus_irq(int irq, void *data)
|
||||
dev->dec_ops[ctx->current_codec]->irq_disable(ctx);
|
||||
dev->dec_ops[ctx->current_codec]->irq_clear(ctx);
|
||||
|
||||
- src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx);
|
||||
- dst_buf = v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx);
|
||||
-
|
||||
- if (!src_buf || !dst_buf) {
|
||||
- v4l2_err(&dev->v4l2_dev,
|
||||
- "Missing source and/or destination buffers\n");
|
||||
- return IRQ_HANDLED;
|
||||
- }
|
||||
-
|
||||
if (status == CEDRUS_IRQ_ERROR)
|
||||
state = VB2_BUF_STATE_ERROR;
|
||||
else
|
||||
state = VB2_BUF_STATE_DONE;
|
||||
|
||||
- v4l2_m2m_buf_done(src_buf, state);
|
||||
- v4l2_m2m_buf_done(dst_buf, state);
|
||||
-
|
||||
- v4l2_m2m_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx);
|
||||
+ v4l2_m2m_buf_done_and_job_finish(ctx->dev->m2m_dev, ctx->fh.m2m_ctx,
|
||||
+ state);
|
||||
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index 3ec3a2db790c..f745f66c4440 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -303,6 +303,17 @@ static int cedrus_s_fmt_vid_out(struct file *file, void *priv,
|
||||
|
||||
ctx->src_fmt = f->fmt.pix;
|
||||
|
||||
+ switch (ctx->src_fmt.pixelformat) {
|
||||
+ case V4L2_PIX_FMT_H264_SLICE:
|
||||
+ vq->subsystem_flags |=
|
||||
+ VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF;
|
||||
+ break;
|
||||
+ default:
|
||||
+ vq->subsystem_flags &=
|
||||
+ ~VB2_V4L2_FL_SUPPORTS_M2M_HOLD_CAPTURE_BUF;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
/* Propagate colorspace information to capture. */
|
||||
ctx->dst_fmt.colorspace = f->fmt.pix.colorspace;
|
||||
ctx->dst_fmt.xfer_func = f->fmt.pix.xfer_func;
|
||||
@@ -336,6 +347,9 @@ const struct v4l2_ioctl_ops cedrus_ioctl_ops = {
|
||||
.vidioc_streamon = v4l2_m2m_ioctl_streamon,
|
||||
.vidioc_streamoff = v4l2_m2m_ioctl_streamoff,
|
||||
|
||||
+ .vidioc_try_decoder_cmd = v4l2_m2m_ioctl_stateless_try_decoder_cmd,
|
||||
+ .vidioc_decoder_cmd = v4l2_m2m_ioctl_stateless_decoder_cmd,
|
||||
+
|
||||
.vidioc_subscribe_event = v4l2_ctrl_subscribe_event,
|
||||
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
|
||||
};
|
||||
--
|
||||
2.23.0
|
|
@ -1,34 +0,0 @@
|
|||
|
||||
From c3b32900fbf5178473c6b39260e891e19067edc2 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
|
||||
Date: Tue, 22 Oct 2019 12:26:51 -0300
|
||||
Subject: [PATCH] media: cedrus: Remove unnecessary parenthesis aroundDIV_ROUND_UP
|
||||
|
||||
DIV_ROUND_UP's first argument doesn't need to be wrapped in parenthesis
|
||||
since that is already being taken care of in the macro's definition.
|
||||
|
||||
Signed-off-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index f9dd8cbf3458..21676a1797f1 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -101,9 +101,9 @@
|
||||
#define VE_DEC_MPEG_PICCODEDSIZE (VE_ENGINE_DEC_MPEG + 0x08)
|
||||
|
||||
#define VE_DEC_MPEG_PICCODEDSIZE_WIDTH(w) \
|
||||
- SHIFT_AND_MASK_BITS(DIV_ROUND_UP((w), 16), 15, 8)
|
||||
+ SHIFT_AND_MASK_BITS(DIV_ROUND_UP(w, 16), 15, 8)
|
||||
#define VE_DEC_MPEG_PICCODEDSIZE_HEIGHT(h) \
|
||||
- SHIFT_AND_MASK_BITS(DIV_ROUND_UP((h), 16), 7, 0)
|
||||
+ SHIFT_AND_MASK_BITS(DIV_ROUND_UP(h, 16), 7, 0)
|
||||
|
||||
#define VE_DEC_MPEG_PICBOUNDSIZE (VE_ENGINE_DEC_MPEG + 0x0c)
|
||||
|
||||
--
|
||||
2.23.0
|
File diff suppressed because it is too large
Load diff
|
@ -1,110 +0,0 @@
|
|||
|
||||
From b4e33e09e7938513bfaba034731c7e84e73c6a5b Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sat, 26 Oct 2019 09:27:51 +0200
|
||||
Subject: [PATCH] media: cedrus: Fix decoding for some H264 videos
|
||||
|
||||
It seems that for some H264 videos at least one bitstream parsing
|
||||
trigger must be called in order to be decoded correctly. There is no
|
||||
explanation why this helps, but it was observed that two sample videos
|
||||
with this fix are now decoded correctly and there is no regression with
|
||||
others.
|
||||
|
||||
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
.../staging/media/sunxi/cedrus/cedrus_h264.c | 30 +++++++++++++++++--
|
||||
.../staging/media/sunxi/cedrus/cedrus_regs.h | 3 ++
|
||||
2 files changed, 30 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index cd85668f9c80..db336449c4f2 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright (c) 2018 Bootlin
|
||||
*/
|
||||
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <media/videobuf2-dma-contig.h>
|
||||
@@ -289,6 +290,28 @@ static void cedrus_write_pred_weight_table(struct cedrus_ctx *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * It turns out that using VE_H264_VLD_OFFSET to skip bits is not reliable. In
|
||||
+ * rare cases frame is not decoded correctly. However, setting offset to 0 and
|
||||
+ * skipping appropriate amount of bits with flush bits trigger always works.
|
||||
+ */
|
||||
+static void cedrus_skip_bits(struct cedrus_dev *dev, int num)
|
||||
+{
|
||||
+ int count = 0;
|
||||
+
|
||||
+ while (count < num) {
|
||||
+ int tmp = min(num - count, 32);
|
||||
+
|
||||
+ cedrus_write(dev, VE_H264_TRIGGER_TYPE,
|
||||
+ VE_H264_TRIGGER_TYPE_FLUSH_BITS |
|
||||
+ VE_H264_TRIGGER_TYPE_N_BITS(tmp));
|
||||
+ while (cedrus_read(dev, VE_H264_STATUS) & VE_H264_STATUS_VLD_BUSY)
|
||||
+ udelay(1);
|
||||
+
|
||||
+ count += tmp;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
struct cedrus_run *run)
|
||||
{
|
||||
@@ -299,14 +322,13 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
struct vb2_buffer *src_buf = &run->src->vb2_buf;
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
dma_addr_t src_buf_addr;
|
||||
- u32 offset = slice->header_bit_size;
|
||||
- u32 len = (slice->size * 8) - offset;
|
||||
+ u32 len = slice->size * 8;
|
||||
unsigned int pic_width_in_mbs;
|
||||
bool mbaff_pic;
|
||||
u32 reg;
|
||||
|
||||
cedrus_write(dev, VE_H264_VLD_LEN, len);
|
||||
- cedrus_write(dev, VE_H264_VLD_OFFSET, offset);
|
||||
+ cedrus_write(dev, VE_H264_VLD_OFFSET, 0);
|
||||
|
||||
src_buf_addr = vb2_dma_contig_plane_dma_addr(src_buf, 0);
|
||||
cedrus_write(dev, VE_H264_VLD_END,
|
||||
@@ -325,6 +347,8 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
cedrus_write(dev, VE_H264_TRIGGER_TYPE,
|
||||
VE_H264_TRIGGER_TYPE_INIT_SWDEC);
|
||||
|
||||
+ cedrus_skip_bits(dev, slice->header_bit_size);
|
||||
+
|
||||
if (((pps->flags & V4L2_H264_PPS_FLAG_WEIGHTED_PRED) &&
|
||||
(slice->slice_type == V4L2_H264_SLICE_TYPE_P ||
|
||||
slice->slice_type == V4L2_H264_SLICE_TYPE_SP)) ||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index 6fc28d21a6c7..4275a307d282 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -541,13 +541,16 @@
|
||||
VE_H264_CTRL_SLICE_DECODE_INT)
|
||||
|
||||
#define VE_H264_TRIGGER_TYPE 0x224
|
||||
+#define VE_H264_TRIGGER_TYPE_N_BITS(x) (((x) & 0x3f) << 8)
|
||||
#define VE_H264_TRIGGER_TYPE_AVC_SLICE_DECODE (8 << 0)
|
||||
#define VE_H264_TRIGGER_TYPE_INIT_SWDEC (7 << 0)
|
||||
+#define VE_H264_TRIGGER_TYPE_FLUSH_BITS (3 << 0)
|
||||
|
||||
#define VE_H264_STATUS 0x228
|
||||
#define VE_H264_STATUS_VLD_DATA_REQ_INT VE_H264_CTRL_VLD_DATA_REQ_INT
|
||||
#define VE_H264_STATUS_DECODE_ERR_INT VE_H264_CTRL_DECODE_ERR_INT
|
||||
#define VE_H264_STATUS_SLICE_DECODE_INT VE_H264_CTRL_SLICE_DECODE_INT
|
||||
+#define VE_H264_STATUS_VLD_BUSY BIT(8)
|
||||
|
||||
#define VE_H264_STATUS_INT_MASK VE_H264_CTRL_INT_MASK
|
||||
|
||||
--
|
||||
2.24.0
|
|
@ -1,34 +0,0 @@
|
|||
|
||||
From e2c02ba9bd0068b00628d7874d8a8d1eb5168177 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Tue, 29 Oct 2019 00:00:52 +0000
|
||||
Subject: [PATCH] media: cedrus: Use correct H264 8x8 scaling list
|
||||
|
||||
Documentation now defines the expected order of scaling lists,
|
||||
change to use correct indices.
|
||||
|
||||
Fixes: 6eb9b758e307 ("media: cedrus: Add H264 decoding support")
|
||||
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
|
||||
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index 7487f6ab7576..74e4c5e3894e 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -245,8 +245,8 @@ static void cedrus_write_scaling_lists(struct cedrus_ctx *ctx,
|
||||
sizeof(scaling->scaling_list_8x8[0]));
|
||||
|
||||
cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_8x8_1,
|
||||
- scaling->scaling_list_8x8[3],
|
||||
- sizeof(scaling->scaling_list_8x8[3]));
|
||||
+ scaling->scaling_list_8x8[1],
|
||||
+ sizeof(scaling->scaling_list_8x8[1]));
|
||||
|
||||
cedrus_h264_write_sram(dev, CEDRUS_SRAM_H264_SCALING_LIST_4x4,
|
||||
scaling->scaling_list_4x4,
|
||||
--
|
||||
2.24.0
|
|
@ -1,118 +0,0 @@
|
|||
|
||||
From 3aef46bd5bf24a845e05d2531ed61f53ee8c7797 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Sun, 10 Nov 2019 07:30:01 +0100
|
||||
Subject: [PATCH 1/3] media: cedrus: Properly signal size in mode register
|
||||
|
||||
Mode register also holds information if video width is bigger than 2048
|
||||
and if it is equal to 4096.
|
||||
|
||||
Rework cedrus_engine_enable() to properly signal this properties.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_h264.c | 2 +-
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 2 +-
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.c | 9 +++++++--
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_hw.h | 2 +-
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c | 2 +-
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 2 ++
|
||||
6 files changed, 13 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index 74e4c5e3894e..8a09a08b1af2 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -485,7 +485,7 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
|
||||
- cedrus_engine_enable(dev, CEDRUS_CODEC_H264);
|
||||
+ cedrus_engine_enable(ctx, CEDRUS_CODEC_H264);
|
||||
|
||||
cedrus_write(dev, VE_H264_SDROT_CTRL, 0);
|
||||
cedrus_write(dev, VE_H264_EXTRA_BUFFER1,
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
index 9bc921866f70..6945dc74e1d7 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
@@ -276,7 +276,7 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
}
|
||||
|
||||
/* Activate H265 engine. */
|
||||
- cedrus_engine_enable(dev, CEDRUS_CODEC_H265);
|
||||
+ cedrus_engine_enable(ctx, CEDRUS_CODEC_H265);
|
||||
|
||||
/* Source offset and length in bits. */
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
index 93347d3ba360..daf5f244f93b 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.c
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "cedrus_hw.h"
|
||||
#include "cedrus_regs.h"
|
||||
|
||||
-int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec)
|
||||
+int cedrus_engine_enable(struct cedrus_ctx *ctx, enum cedrus_codec codec)
|
||||
{
|
||||
u32 reg = 0;
|
||||
|
||||
@@ -58,7 +58,12 @@ int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- cedrus_write(dev, VE_MODE, reg);
|
||||
+ if (ctx->src_fmt.width == 4096)
|
||||
+ reg |= VE_MODE_PIC_WIDTH_IS_4096;
|
||||
+ if (ctx->src_fmt.width > 2048)
|
||||
+ reg |= VE_MODE_PIC_WIDTH_MORE_2048;
|
||||
+
|
||||
+ cedrus_write(ctx->dev, VE_MODE, reg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
index 27d0882397aa..604ff932fbf5 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_hw.h
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef _CEDRUS_HW_H_
|
||||
#define _CEDRUS_HW_H_
|
||||
|
||||
-int cedrus_engine_enable(struct cedrus_dev *dev, enum cedrus_codec codec);
|
||||
+int cedrus_engine_enable(struct cedrus_ctx *ctx, enum cedrus_codec codec);
|
||||
void cedrus_engine_disable(struct cedrus_dev *dev);
|
||||
|
||||
void cedrus_dst_format_set(struct cedrus_dev *dev,
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c b/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
|
||||
index 13c34927bad5..8bcd6b8f9e2d 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_mpeg2.c
|
||||
@@ -96,7 +96,7 @@ static void cedrus_mpeg2_setup(struct cedrus_ctx *ctx, struct cedrus_run *run)
|
||||
quantization = run->mpeg2.quantization;
|
||||
|
||||
/* Activate MPEG engine. */
|
||||
- cedrus_engine_enable(dev, CEDRUS_CODEC_MPEG2);
|
||||
+ cedrus_engine_enable(ctx, CEDRUS_CODEC_MPEG2);
|
||||
|
||||
/* Set intra quantization matrix. */
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index 4275a307d282..ace3d49fcd82 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#define VE_MODE 0x00
|
||||
|
||||
+#define VE_MODE_PIC_WIDTH_IS_4096 BIT(22)
|
||||
+#define VE_MODE_PIC_WIDTH_MORE_2048 BIT(21)
|
||||
#define VE_MODE_REC_WR_MODE_2MB (0x01 << 20)
|
||||
#define VE_MODE_REC_WR_MODE_1MB (0x00 << 20)
|
||||
#define VE_MODE_DDR_MODE_BW_128 (0x03 << 16)
|
||||
--
|
||||
2.24.0
|
|
@ -1,211 +0,0 @@
|
|||
|
||||
From 03e612e701a61aa9cc9fd8e25cd47d8d685ef675 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Wed, 6 Nov 2019 22:05:37 +0100
|
||||
Subject: [PATCH 2/3] media: cedrus: Fix H264 4k support
|
||||
|
||||
H264 decoder needs additional or bigger buffers in order to decode 4k
|
||||
videos.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus.h | 7 ++
|
||||
.../staging/media/sunxi/cedrus/cedrus_h264.c | 91 +++++++++++++++++--
|
||||
.../staging/media/sunxi/cedrus/cedrus_regs.h | 11 +++
|
||||
3 files changed, 101 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
index c45fb9a7ad07..96765555ab8a 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus.h
|
||||
@@ -116,8 +116,15 @@ struct cedrus_ctx {
|
||||
ssize_t mv_col_buf_size;
|
||||
void *pic_info_buf;
|
||||
dma_addr_t pic_info_buf_dma;
|
||||
+ ssize_t pic_info_buf_size;
|
||||
void *neighbor_info_buf;
|
||||
dma_addr_t neighbor_info_buf_dma;
|
||||
+ void *deblk_buf;
|
||||
+ dma_addr_t deblk_buf_dma;
|
||||
+ ssize_t deblk_buf_size;
|
||||
+ void *intra_pred_buf;
|
||||
+ dma_addr_t intra_pred_buf_dma;
|
||||
+ ssize_t intra_pred_buf_size;
|
||||
} h264;
|
||||
struct {
|
||||
void *mv_col_buf;
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
index 8a09a08b1af2..bfb4a4820a67 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h264.c
|
||||
@@ -39,7 +39,7 @@ struct cedrus_h264_sram_ref_pic {
|
||||
#define CEDRUS_H264_FRAME_NUM 18
|
||||
|
||||
#define CEDRUS_NEIGHBOR_INFO_BUF_SIZE (16 * SZ_1K)
|
||||
-#define CEDRUS_PIC_INFO_BUF_SIZE (128 * SZ_1K)
|
||||
+#define CEDRUS_MIN_PIC_INFO_BUF_SIZE (130 * SZ_1K)
|
||||
|
||||
static void cedrus_h264_write_sram(struct cedrus_dev *dev,
|
||||
enum cedrus_h264_sram_off off,
|
||||
@@ -342,6 +342,20 @@ static void cedrus_set_params(struct cedrus_ctx *ctx,
|
||||
VE_H264_VLD_ADDR_FIRST | VE_H264_VLD_ADDR_VALID |
|
||||
VE_H264_VLD_ADDR_LAST);
|
||||
|
||||
+ if (ctx->src_fmt.width > 2048) {
|
||||
+ cedrus_write(dev, VE_BUF_CTRL,
|
||||
+ VE_BUF_CTRL_INTRAPRED_MIXED_RAM |
|
||||
+ VE_BUF_CTRL_DBLK_MIXED_RAM);
|
||||
+ cedrus_write(dev, VE_DBLK_DRAM_BUF_ADDR,
|
||||
+ ctx->codec.h264.deblk_buf_dma);
|
||||
+ cedrus_write(dev, VE_INTRAPRED_DRAM_BUF_ADDR,
|
||||
+ ctx->codec.h264.intra_pred_buf_dma);
|
||||
+ } else {
|
||||
+ cedrus_write(dev, VE_BUF_CTRL,
|
||||
+ VE_BUF_CTRL_INTRAPRED_INT_SRAM |
|
||||
+ VE_BUF_CTRL_DBLK_INT_SRAM);
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* FIXME: Since the bitstream parsing is done in software, and
|
||||
* in userspace, this shouldn't be needed anymore. But it
|
||||
@@ -502,18 +516,30 @@ static void cedrus_h264_setup(struct cedrus_ctx *ctx,
|
||||
static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||
{
|
||||
struct cedrus_dev *dev = ctx->dev;
|
||||
+ unsigned int pic_info_size;
|
||||
unsigned int field_size;
|
||||
unsigned int mv_col_size;
|
||||
int ret;
|
||||
|
||||
+ /* Formula for picture buffer size is taken from CedarX source. */
|
||||
+
|
||||
+ if (ctx->src_fmt.width > 2048)
|
||||
+ pic_info_size = CEDRUS_H264_FRAME_NUM * 0x4000;
|
||||
+ else
|
||||
+ pic_info_size = CEDRUS_H264_FRAME_NUM * 0x1000;
|
||||
+
|
||||
/*
|
||||
- * FIXME: It seems that the H6 cedarX code is using a formula
|
||||
- * here based on the size of the frame, while all the older
|
||||
- * code is using a fixed size, so that might need to be
|
||||
- * changed at some point.
|
||||
+ * FIXME: If V4L2_H264_SPS_FLAG_FRAME_MBS_ONLY is set,
|
||||
+ * there is no need to multiply by 2.
|
||||
*/
|
||||
+ pic_info_size += ctx->src_fmt.height * 2 * 64;
|
||||
+
|
||||
+ if (pic_info_size < CEDRUS_MIN_PIC_INFO_BUF_SIZE)
|
||||
+ pic_info_size = CEDRUS_MIN_PIC_INFO_BUF_SIZE;
|
||||
+
|
||||
+ ctx->codec.h264.pic_info_buf_size = pic_info_size;
|
||||
ctx->codec.h264.pic_info_buf =
|
||||
- dma_alloc_coherent(dev->dev, CEDRUS_PIC_INFO_BUF_SIZE,
|
||||
+ dma_alloc_coherent(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||
&ctx->codec.h264.pic_info_buf_dma,
|
||||
GFP_KERNEL);
|
||||
if (!ctx->codec.h264.pic_info_buf)
|
||||
@@ -566,15 +592,56 @@ static int cedrus_h264_start(struct cedrus_ctx *ctx)
|
||||
goto err_neighbor_buf;
|
||||
}
|
||||
|
||||
+ if (ctx->src_fmt.width > 2048) {
|
||||
+ /*
|
||||
+ * Formulas for deblock and intra prediction buffer sizes
|
||||
+ * are taken from CedarX source.
|
||||
+ */
|
||||
+
|
||||
+ ctx->codec.h264.deblk_buf_size =
|
||||
+ ALIGN(ctx->src_fmt.width, 32) * 12;
|
||||
+ ctx->codec.h264.deblk_buf =
|
||||
+ dma_alloc_coherent(dev->dev,
|
||||
+ ctx->codec.h264.deblk_buf_size,
|
||||
+ &ctx->codec.h264.deblk_buf_dma,
|
||||
+ GFP_KERNEL);
|
||||
+ if (!ctx->codec.h264.deblk_buf) {
|
||||
+ ret = -ENOMEM;
|
||||
+ goto err_mv_col_buf;
|
||||
+ }
|
||||
+
|
||||
+ ctx->codec.h264.intra_pred_buf_size =
|
||||
+ ALIGN(ctx->src_fmt.width, 64) * 5;
|
||||
+ ctx->codec.h264.intra_pred_buf =
|
||||
+ dma_alloc_coherent(dev->dev,
|
||||
+ ctx->codec.h264.intra_pred_buf_size,
|
||||
+ &ctx->codec.h264.intra_pred_buf_dma,
|
||||
+ GFP_KERNEL);
|
||||
+ if (!ctx->codec.h264.intra_pred_buf) {
|
||||
+ ret = -ENOMEM;
|
||||
+ goto err_deblk_buf;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
|
||||
+err_deblk_buf:
|
||||
+ dma_free_coherent(dev->dev, ctx->codec.h264.deblk_buf_size,
|
||||
+ ctx->codec.h264.deblk_buf,
|
||||
+ ctx->codec.h264.deblk_buf_dma);
|
||||
+
|
||||
+err_mv_col_buf:
|
||||
+ dma_free_coherent(dev->dev, ctx->codec.h264.mv_col_buf_size,
|
||||
+ ctx->codec.h264.mv_col_buf,
|
||||
+ ctx->codec.h264.mv_col_buf_dma);
|
||||
+
|
||||
err_neighbor_buf:
|
||||
dma_free_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||
ctx->codec.h264.neighbor_info_buf,
|
||||
ctx->codec.h264.neighbor_info_buf_dma);
|
||||
|
||||
err_pic_buf:
|
||||
- dma_free_coherent(dev->dev, CEDRUS_PIC_INFO_BUF_SIZE,
|
||||
+ dma_free_coherent(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||
ctx->codec.h264.pic_info_buf,
|
||||
ctx->codec.h264.pic_info_buf_dma);
|
||||
return ret;
|
||||
@@ -590,9 +657,17 @@ static void cedrus_h264_stop(struct cedrus_ctx *ctx)
|
||||
dma_free_coherent(dev->dev, CEDRUS_NEIGHBOR_INFO_BUF_SIZE,
|
||||
ctx->codec.h264.neighbor_info_buf,
|
||||
ctx->codec.h264.neighbor_info_buf_dma);
|
||||
- dma_free_coherent(dev->dev, CEDRUS_PIC_INFO_BUF_SIZE,
|
||||
+ dma_free_coherent(dev->dev, ctx->codec.h264.pic_info_buf_size,
|
||||
ctx->codec.h264.pic_info_buf,
|
||||
ctx->codec.h264.pic_info_buf_dma);
|
||||
+ if (ctx->codec.h264.deblk_buf_size)
|
||||
+ dma_free_coherent(dev->dev, ctx->codec.h264.deblk_buf_size,
|
||||
+ ctx->codec.h264.deblk_buf,
|
||||
+ ctx->codec.h264.deblk_buf_dma);
|
||||
+ if (ctx->codec.h264.intra_pred_buf_size)
|
||||
+ dma_free_coherent(dev->dev, ctx->codec.h264.intra_pred_buf_size,
|
||||
+ ctx->codec.h264.intra_pred_buf,
|
||||
+ ctx->codec.h264.intra_pred_buf_dma);
|
||||
}
|
||||
|
||||
static void cedrus_h264_trigger(struct cedrus_ctx *ctx)
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index ace3d49fcd82..7beb03d3bb39 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -46,6 +46,17 @@
|
||||
#define VE_MODE_DEC_H264 (0x01 << 0)
|
||||
#define VE_MODE_DEC_MPEG (0x00 << 0)
|
||||
|
||||
+#define VE_BUF_CTRL 0x50
|
||||
+
|
||||
+#define VE_BUF_CTRL_INTRAPRED_EXT_RAM (0x02 << 2)
|
||||
+#define VE_BUF_CTRL_INTRAPRED_MIXED_RAM (0x01 << 2)
|
||||
+#define VE_BUF_CTRL_INTRAPRED_INT_SRAM (0x00 << 2)
|
||||
+#define VE_BUF_CTRL_DBLK_EXT_RAM (0x02 << 0)
|
||||
+#define VE_BUF_CTRL_DBLK_MIXED_RAM (0x01 << 0)
|
||||
+#define VE_BUF_CTRL_DBLK_INT_SRAM (0x00 << 0)
|
||||
+
|
||||
+#define VE_DBLK_DRAM_BUF_ADDR 0x54
|
||||
+#define VE_INTRAPRED_DRAM_BUF_ADDR 0x58
|
||||
#define VE_PRIMARY_CHROMA_BUF_LEN 0xc4
|
||||
#define VE_PRIMARY_FB_LINE_STRIDE 0xc8
|
||||
|
||||
--
|
||||
2.24.0
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
|
||||
From 0b3e5c15f9cb8b56599c50e6bf4f46ee1c1253bc Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Wed, 6 Nov 2019 22:05:38 +0100
|
||||
Subject: [PATCH 3/3] media: cedrus: Increase maximum supported size
|
||||
|
||||
There are few variations of 4k resolutions. The biggest one is
|
||||
4096x2304 which is also supported by HW. It has also nice property that
|
||||
both width and size are divisible by maximum HEVC CTB size, which is 64.
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
|
||||
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
|
||||
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
|
||||
---
|
||||
drivers/staging/media/sunxi/cedrus/cedrus_video.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index cc15a5cf107d..15cf1f10221b 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
#define CEDRUS_MIN_WIDTH 16U
|
||||
#define CEDRUS_MIN_HEIGHT 16U
|
||||
-#define CEDRUS_MAX_WIDTH 3840U
|
||||
-#define CEDRUS_MAX_HEIGHT 2160U
|
||||
+#define CEDRUS_MAX_WIDTH 4096U
|
||||
+#define CEDRUS_MAX_HEIGHT 2304U
|
||||
|
||||
static struct cedrus_format cedrus_formats[] = {
|
||||
{
|
||||
--
|
||||
2.24.0
|
||||
|
File diff suppressed because it is too large
Load diff
|
@ -1,89 +0,0 @@
|
|||
From 60808cc1810d47f91c368de8ffb7db59cabceaf9 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Tue, 28 May 2019 21:05:34 +0200
|
||||
Subject: [PATCH] 10-bit HEVC hack
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
---
|
||||
.../staging/media/sunxi/cedrus/cedrus_h265.c | 12 +++++++++++
|
||||
.../staging/media/sunxi/cedrus/cedrus_regs.h | 4 ++++
|
||||
.../staging/media/sunxi/cedrus/cedrus_video.c | 20 ++++++++++++++-----
|
||||
3 files changed, 31 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
index 97dce6ffbbc5..d866662cd5a5 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c
|
||||
@@ -520,6 +520,18 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx,
|
||||
|
||||
cedrus_write(dev, VE_DEC_H265_DEC_PCM_CTRL, reg);
|
||||
|
||||
+ if (sps->bit_depth_luma_minus8) {
|
||||
+ unsigned int size;
|
||||
+
|
||||
+ size = ALIGN(ctx->src_fmt.width, 16) * ALIGN(ctx->src_fmt.height, 16);
|
||||
+
|
||||
+ reg = (size * 3) / 2;
|
||||
+ cedrus_write(dev, VE_DEC_H265_OFFSET_ADDR_FIRST_OUT, reg);
|
||||
+
|
||||
+ reg = DIV_ROUND_UP(ctx->src_fmt.width, 4);
|
||||
+ cedrus_write(dev, VE_DEC_H265_10BIT_CONFIGURE, ALIGN(reg, 32));
|
||||
+ }
|
||||
+
|
||||
/* PPS. */
|
||||
|
||||
reg = VE_DEC_H265_DEC_PPS_CTRL0_PPS_CR_QP_OFFSET(pps->pps_cr_qp_offset) |
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
index df1cceef8d93..150eae2d92d2 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h
|
||||
@@ -498,6 +498,10 @@
|
||||
|
||||
#define VE_DEC_H265_LOW_ADDR (VE_ENGINE_DEC_H265 + 0x80)
|
||||
|
||||
+#define VE_DEC_H265_OFFSET_ADDR_FIRST_OUT (VE_ENGINE_DEC_H265 + 0x84)
|
||||
+#define VE_DEC_H265_OFFSET_ADDR_SECOND_OUT (VE_ENGINE_DEC_H265 + 0x88)
|
||||
+#define VE_DEC_H265_10BIT_CONFIGURE (VE_ENGINE_DEC_H265 + 0x8c)
|
||||
+
|
||||
#define VE_DEC_H265_LOW_ADDR_PRIMARY_CHROMA(a) \
|
||||
SHIFT_AND_MASK_BITS(a, 31, 24)
|
||||
#define VE_DEC_H265_LOW_ADDR_SECONDARY_CHROMA(a) \
|
||||
diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_video.c b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
index 497b1199d3fe..178ad45b79d8 100644
|
||||
--- a/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
+++ b/drivers/staging/media/sunxi/cedrus/cedrus_video.c
|
||||
@@ -367,17 +367,27 @@ static int cedrus_queue_setup(struct vb2_queue *vq, unsigned int *nbufs,
|
||||
{
|
||||
struct cedrus_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct v4l2_pix_format *pix_fmt;
|
||||
+ unsigned int extra_size = 0;
|
||||
|
||||
- if (V4L2_TYPE_IS_OUTPUT(vq->type))
|
||||
+ if (V4L2_TYPE_IS_OUTPUT(vq->type)) {
|
||||
pix_fmt = &ctx->src_fmt;
|
||||
- else
|
||||
+ } else {
|
||||
pix_fmt = &ctx->dst_fmt;
|
||||
|
||||
+ /* The HEVC decoder needs extra size on the output buffer. */
|
||||
+ if (ctx->src_fmt.pixelformat == V4L2_PIX_FMT_HEVC_SLICE) {
|
||||
+ extra_size = DIV_ROUND_UP(pix_fmt->width, 4);
|
||||
+ extra_size = ALIGN(extra_size, 32);
|
||||
+ extra_size *= ALIGN(pix_fmt->height, 16) * 3;
|
||||
+ extra_size /= 2;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (*nplanes) {
|
||||
- if (sizes[0] < pix_fmt->sizeimage)
|
||||
- return -EINVAL;
|
||||
+ if (sizes[0] < (pix_fmt->sizeimage + extra_size))
|
||||
+ sizes[0] = pix_fmt->sizeimage + extra_size;
|
||||
} else {
|
||||
- sizes[0] = pix_fmt->sizeimage;
|
||||
+ sizes[0] = pix_fmt->sizeimage + extra_size;
|
||||
*nplanes = 1;
|
||||
}
|
||||
|
||||
--
|
||||
2.23.0
|
|
@ -1,68 +0,0 @@
|
|||
From 6db1aaf4d9735e04f6f310db6410d1dcf340a749 Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Fri, 4 Oct 2019 00:21:30 +0200
|
||||
Subject: arm64: dts: allwinner: a64: orangepi-win: Enable audio codec
|
||||
|
||||
This patch enables internal audio codec on OrangePi Win board by
|
||||
enabling all relevant nodes and adding appropriate routing. Board has
|
||||
on-board microphone (MIC1) and 3.5 mm jack with stereo audio and
|
||||
microphone (MIC2).
|
||||
|
||||
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Signed-off-by: Maxime Ripard <mripard@kernel.org>
|
||||
---
|
||||
.../boot/dts/allwinner/sun50i-a64-orangepi-win.dts | 29 ++++++++++++++++++++++
|
||||
1 file changed, 29 insertions(+)
|
||||
|
||||
(limited to 'arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts')
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
index 04446e4716c4..f54a415f2e3b 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
@@ -114,6 +114,19 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&codec {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&codec_analog {
|
||||
+ cpvdd-supply = <®_eldo1>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&dai {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
@@ -333,6 +346,22 @@
|
||||
vcc-hdmi-supply = <®_dldo1>;
|
||||
};
|
||||
|
||||
+&sound {
|
||||
+ status = "okay";
|
||||
+ simple-audio-card,widgets = "Headphone", "Headphone Jack",
|
||||
+ "Microphone", "Microphone Jack",
|
||||
+ "Microphone", "Onboard Microphone";
|
||||
+ 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",
|
||||
+ "Headphone Jack", "HP",
|
||||
+ "MIC2", "Microphone Jack",
|
||||
+ "Onboard Microphone", "MBIAS",
|
||||
+ "MIC1", "Onboard Microphone";
|
||||
+};
|
||||
+
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
--
|
||||
cgit 1.2-0.3.lf.el7
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
Add CPU regulator and operating points for all the A64-based boards
|
||||
that are currently supported to enable DVFS.
|
||||
|
||||
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
|
||||
---
|
||||
.../dts/allwinner/sun50i-a64-amarula-relic.dts | 17 +++++++++++++++++
|
||||
.../dts/allwinner/sun50i-a64-bananapi-m64.dts | 17 +++++++++++++++++
|
||||
.../dts/allwinner/sun50i-a64-nanopi-a64.dts | 17 +++++++++++++++++
|
||||
.../boot/dts/allwinner/sun50i-a64-olinuxino.dts | 17 +++++++++++++++++
|
||||
.../dts/allwinner/sun50i-a64-orangepi-win.dts | 17 +++++++++++++++++
|
||||
.../boot/dts/allwinner/sun50i-a64-pine64.dts | 17 +++++++++++++++++
|
||||
.../boot/dts/allwinner/sun50i-a64-pinebook.dts | 17 +++++++++++++++++
|
||||
.../boot/dts/allwinner/sun50i-a64-sopine.dtsi | 17 +++++++++++++++++
|
||||
.../boot/dts/allwinner/sun50i-a64-teres-i.dts | 17 +++++++++++++++++
|
||||
9 files changed, 153 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts
|
||||
index 5634245d11db..6ee7291293ec 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-amarula-relic.dts
|
||||
@@ -7,6 +7,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -65,6 +66,22 @@ wifi_pwrseq: wifi-pwrseq {
|
||||
};
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&csi {
|
||||
status = "okay";
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
|
||||
index 208373efee49..9b80e06f40d6 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
|
||||
@@ -43,6 +43,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -108,6 +109,22 @@ &codec_analog {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&dai {
|
||||
status = "okay";
|
||||
};
|
||||
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 9b9d9157128c..6b81b91da504 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||
@@ -43,6 +43,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -87,6 +88,22 @@ wifi_pwrseq: wifi_pwrseq {
|
||||
};
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
|
||||
index 01a9a52edae4..fb45c32558c5 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-olinuxino.dts
|
||||
@@ -43,6 +43,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -87,6 +88,22 @@ wifi_pwrseq: wifi_pwrseq {
|
||||
};
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
index f54a415f2e3b..a510cf40a9fe 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
@@ -44,6 +44,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -123,6 +124,22 @@ &codec_analog {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&dai {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||
index 409523cb0950..7cb01886aa32 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
||||
@@ -43,6 +43,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -84,6 +85,22 @@ &codec_analog {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&dai {
|
||||
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 78c82a665c84..74a8569c677f 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
@@ -8,6 +8,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
@@ -98,6 +99,22 @@ &codec_analog {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&dai {
|
||||
status = "okay";
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
|
||||
index 9d20e13f0c02..e64f330ca420 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-sopine.dtsi
|
||||
@@ -44,6 +44,7 @@
|
||||
*/
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
|
||||
@@ -51,6 +52,22 @@ &codec_analog {
|
||||
cpvdd-supply = <®_eldo1>;
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&mmc0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&mmc0_pins>;
|
||||
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 970415106dcf..0356608ce467 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts
|
||||
@@ -8,6 +8,7 @@
|
||||
/dts-v1/;
|
||||
|
||||
#include "sun50i-a64.dtsi"
|
||||
+#include "sun50i-a64-cpu-opp.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
@@ -104,6 +105,22 @@ &de {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu1 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu2 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
+&cpu3 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&ehci1 {
|
||||
status = "okay";
|
||||
};
|
||||
--
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,18 +0,0 @@
|
|||
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
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
index f55879b..c3621dd 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
@@ -70,6 +80,13 @@
|
||||
clock-output-names = "osc24M";
|
||||
};
|
||||
|
||||
+ ext_osc32k: ext_osc32k_clk {
|
||||
+ #clock-cells = <0>;
|
||||
+ compatible = "fixed-clock";
|
||||
+ clock-frequency = <32768>;
|
||||
+ clock-output-names = "ext_osc32k";
|
||||
+ };
|
||||
+
|
||||
pmu {
|
||||
compatible = "arm,cortex-a53-pmu";
|
||||
interrupts = <GIC_SPI 140 IRQ_TYPE_LEVEL_HIGH>,
|
||||
@@ -922,6 +1050,7 @@
|
||||
interrupts = <5 IRQ_TYPE_LEVEL_HIGH>,
|
||||
<6 IRQ_TYPE_LEVEL_HIGH>;
|
||||
clock-output-names = "osc32k", "osc32k-out", "iosc";
|
||||
+ clocks = <&ext_osc32k>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
index 421dfbb..ae64248 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
+++ b/arch/arm/boot/dts/sun8i-r40.dtsi
|
||||
@@ -403,6 +420,11 @@
|
||||
function = "uart0";
|
||||
};
|
||||
|
||||
+ uart2_pi_pins: uart2-pi-pins {
|
||||
+ pins = "PI18", "PI19";
|
||||
+ function = "uart2";
|
||||
+ };
|
||||
+
|
||||
uart3_pg_pins: uart3-pg-pins {
|
||||
pins = "PG6", "PG7";
|
||||
function = "uart3";
|
||||
@@ -412,6 +463,23 @@
|
||||
pins = "PG8", "PG9";
|
||||
function = "uart3";
|
||||
};
|
||||
+
|
||||
+ uart4_ph_pins: uart4-ph-pins {
|
||||
+ pins = "PH4", "PH5";
|
||||
+ function = "uart4";
|
||||
+ };
|
||||
+
|
||||
+
|
||||
+ uart5_ph_pins: uart5-ph-pins {
|
||||
+ pins = "PH6", "PH7";
|
||||
+ function = "uart5";
|
||||
+ };
|
||||
+
|
||||
+ uart7_pi_pins: uart7-pi-pins {
|
||||
+ pins = "PI20", "PI21";
|
||||
+ function = "uart7";
|
||||
+ };
|
||||
+
|
||||
};
|
||||
|
||||
wdt: watchdog@1c20c90 {
|
|
@ -0,0 +1,84 @@
|
|||
diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
index 42d62d1..35bba4e 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts
|
||||
@@ -305,6 +305,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&uart2 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart2_pi_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
&uart3 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
|
||||
@@ -324,6 +330,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&uart4 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart4_ph_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&uart5 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart5_ph_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&uart7 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart7_pi_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
&usbphy {
|
||||
usb1_vbus-supply = <®_vcc5v0>;
|
||||
usb2_vbus-supply = <®_vcc5v0>;
|
||||
diff --git a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
|
||||
index 15c22b0..967833c 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
|
||||
+++ b/arch/arm/boot/dts/sun8i-v40-bananapi-m2-berry.dts
|
||||
@@ -280,6 +280,12 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&uart2 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart2_pi_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
&uart3 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
|
||||
@@ -299,6 +305,24 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&uart4 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart4_ph_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&uart5 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart5_ph_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
+&uart7 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&uart7_pi_pins>;
|
||||
+ status = "disabled";
|
||||
+};
|
||||
+
|
||||
&usbphy {
|
||||
usb1_vbus-supply = <®_vcc5v0>;
|
||||
status = "okay";
|
|
@ -48,7 +48,7 @@ index b8f46e2..24cb8b9 100644
|
|||
};
|
||||
};
|
||||
|
||||
+&sound_hdmi {
|
||||
+&hdmi_sound {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
By default, gpio-keys configures the pin to trigger wakeup IRQs on
|
||||
either edge. The lid switch should only trigger wakeup when opening the
|
||||
lid, not when closing it.
|
||||
|
||||
Signed-off-by: Samuel Holland <samuel@sholland.org>
|
||||
---
|
||||
arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
index 78c82a665c84..836ae51e5c2a 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "sun50i-a64.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/gpio-keys.h>
|
||||
#include <dt-bindings/input/input.h>
|
||||
#include <dt-bindings/pwm/pwm.h>
|
||||
|
||||
@@ -60,6 +61,7 @@
|
||||
linux,code = <SW_LID>;
|
||||
linux,can-disable;
|
||||
wakeup-source;
|
||||
+ wakeup-event-action = <EV_ACT_DEASSERTED>;
|
||||
};
|
||||
};
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
diff --git a/arch/arm/boot/dts/sun8i-a83t.dtsi b/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||
index 000d00222..a775abe72 100644
|
||||
--- a/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||
+++ b/arch/arm/boot/dts/sun8i-a83t.dtsi
|
||||
@@ -222,17 +222,6 @@
|
||||
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
};
|
||||
|
||||
- opp-1608000000 {
|
||||
- opp-hz = /bits/ 64 <1608000000>;
|
||||
- opp-microvolt = <1000000>;
|
||||
- clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
- };
|
||||
-
|
||||
- opp-1800000000 {
|
||||
- opp-hz = /bits/ 64 <1800000000>;
|
||||
- opp-microvolt = <1080000>;
|
||||
- clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
- };
|
||||
};
|
||||
|
||||
cpu1_opp_table: opp_table1 {
|
||||
@@ -257,17 +246,6 @@
|
||||
clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
};
|
||||
|
||||
- opp-1608000000 {
|
||||
- opp-hz = /bits/ 64 <1608000000>;
|
||||
- opp-microvolt = <1000000>;
|
||||
- clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
- };
|
||||
-
|
||||
- opp-1800000000 {
|
||||
- opp-hz = /bits/ 64 <1800000000>;
|
||||
- opp-microvolt = <1080000>;
|
||||
- clock-latency-ns = <244144>; /* 8 32k periods */
|
||||
- };
|
||||
};
|
||||
|
||||
scpi_protocol: scpi {
|
|
@ -1,50 +0,0 @@
|
|||
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";
|
|
@ -231,7 +231,7 @@ index 0000000..a6bf32d
|
|||
+ };
|
||||
+};
|
||||
+
|
||||
+&sound_hdmi {
|
||||
+&hdmi_sound {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
|
|
106
patch/kernel/sunxi-current/board-h6-improve-thermals.patch
Normal file
106
patch/kernel/sunxi-current/board-h6-improve-thermals.patch
Normal file
|
@ -0,0 +1,106 @@
|
|||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi
|
||||
index bef3f50b1..90e4d1764 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-cpu-opp.dtsi
|
||||
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
// Copyright (C) 2020 Ondrej Jirman <megous@megous.com>
|
||||
// Copyright (C) 2020 Clément Péron <peron.clem@gmail.com>
|
||||
+// Copyright (C) 2020 Igor Pecovnik <igor@armbian.com>
|
||||
|
||||
/ {
|
||||
cpu_opp_table: cpu-opp-table {
|
||||
@@ -122,26 +123,67 @@
|
||||
|
||||
&cpu_thermal {
|
||||
trips {
|
||||
- cpu_hot_trip: cpu-hot {
|
||||
+ cpu_warm: cpu_warm {
|
||||
+ temperature = <75000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+
|
||||
+ cpu_hot_pre: cpu_hot_pre {
|
||||
temperature = <80000>;
|
||||
hysteresis = <2000>;
|
||||
type = "passive";
|
||||
};
|
||||
+
|
||||
+ cpu_hot: cpu_hot {
|
||||
+ temperature = <85000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+
|
||||
+ cpu_very_hot_pre: cpu_very_hot_pre {
|
||||
+ temperature = <90000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "passive";
|
||||
+ };
|
||||
|
||||
- cpu_very_hot_trip: cpu-very-hot {
|
||||
- temperature = <100000>;
|
||||
- hysteresis = <0>;
|
||||
+ cpu_very_hot: cpu_very_hot {
|
||||
+ temperature = <95000>;
|
||||
+ hysteresis = <2000>;
|
||||
+ type = "passive";
|
||||
+ };
|
||||
+
|
||||
+ cpu_crit: cpu_crit {
|
||||
+ temperature = <105000>;
|
||||
+ hysteresis = <2000>;
|
||||
type = "critical";
|
||||
};
|
||||
};
|
||||
|
||||
cooling-maps {
|
||||
- cpu-hot-limit {
|
||||
- trip = <&cpu_hot_trip>;
|
||||
- cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
- <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
- <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
|
||||
- <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
|
||||
+ cpu_warm_limit_cpu {
|
||||
+ trip = <&cpu_warm>;
|
||||
+ cooling-device = <&cpu0 THERMAL_NO_LIMIT 2>;
|
||||
+ };
|
||||
+
|
||||
+ cpu_hot_pre_limit_cpu {
|
||||
+ trip = <&cpu_hot_pre>;
|
||||
+ cooling-device = <&cpu0 2 3>;
|
||||
+ };
|
||||
+
|
||||
+ cpu_hot_limit_cpu {
|
||||
+ trip = <&cpu_hot>;
|
||||
+ cooling-device = <&cpu0 3 4>;
|
||||
+ };
|
||||
+
|
||||
+ cpu_very_hot_pre_limit_cpu {
|
||||
+ trip = <&cpu_very_hot_pre>;
|
||||
+ cooling-device = <&cpu0 5 6>;
|
||||
+ };
|
||||
+
|
||||
+ cpu_very_hot_limit_cpu {
|
||||
+ trip = <&cpu_very_hot>;
|
||||
+ cooling-device = <&cpu0 7 THERMAL_NO_LIMIT>;
|
||||
};
|
||||
};
|
||||
};
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
index 82cc1e5fe..00ebb89fc 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6.dtsi
|
||||
@@ -1147,8 +1147,9 @@
|
||||
|
||||
thermal-zones {
|
||||
cpu_thermal: cpu-thermal {
|
||||
- polling-delay-passive = <0>;
|
||||
- polling-delay = <0>;
|
||||
+ /* milliseconds */
|
||||
+ polling-delay-passive = <250>;
|
||||
+ polling-delay = <1000>;
|
||||
thermal-sensors = <&ths 0>;
|
||||
};
|
||||
|
|
@ -2,7 +2,7 @@ diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dts b/arch/a
|
|||
index e098a2475..6c481b547 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-lite2.dts
|
||||
@@ -3,9 +3,344 @@
|
||||
@@ -3,9 +3,350 @@
|
||||
* Copyright (C) 2018 Jagan Teki <jagan@openedev.com>
|
||||
*/
|
||||
|
||||
|
@ -98,6 +98,11 @@ index e098a2475..6c481b547 100644
|
|||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&gpu {
|
||||
+ mali-supply = <®_dcdcc>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
|
@ -244,6 +249,7 @@ index e098a2475..6c481b547 100644
|
|||
+ };
|
||||
+
|
||||
+ reg_dcdcc: dcdcc {
|
||||
+ regulator-enable-ramp-delay = <32000>;
|
||||
+ regulator-min-microvolt = <810000>;
|
||||
+ regulator-max-microvolt = <1080000>;
|
||||
+ regulator-name = "vdd-gpu";
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dts
|
||||
index 12e1756..79139f3 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-one-plus.dts
|
||||
@@ -9,4 +9,39 @@
|
||||
/ {
|
||||
model = "OrangePi One Plus";
|
||||
compatible = "xunlong,orangepi-one-plus", "allwinner,sun50i-h6";
|
||||
+
|
||||
+ aliases {
|
||||
+ serial0 = &uart0;
|
||||
+ ethernet0 = &emac;
|
||||
+ };
|
||||
+
|
||||
+ reg_gmac_3v3: gmac-3v3 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc-gmac-3v3";
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ startup-delay-us = <100000>;
|
||||
+ enable-active-high;
|
||||
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
|
||||
+ vin-supply = <®_aldo2>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+
|
||||
+&emac {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&ext_rgmii_pins>;
|
||||
+ phy-mode = "rgmii";
|
||||
+ phy-handle = <&ext_rgmii_phy>;
|
||||
+ phy-supply = <®_gmac_3v3>;
|
||||
+ allwinner,rx-delay-ps = <200>;
|
||||
+ allwinner,tx-delay-ps = <200>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&mdio {
|
||||
+ ext_rgmii_phy: ethernet-phy@1 {
|
||||
+ compatible = "ethernet-phy-ieee802.3-c22";
|
||||
+ reg = <1>;
|
||||
+ };
|
||||
};
|
|
@ -1,25 +0,0 @@
|
|||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
index c0150b7..2c6c84f 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
|
||||
@@ -148,6 +185,20 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&de {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&hdmi_out {
|
||||
+ hdmi_out_con: endpoint {
|
||||
+ remote-endpoint = <&hdmi_con_in>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&pio {
|
||||
vcc-pc-supply = <®_bldo2>;
|
||||
vcc-pd-supply = <®_cldo1>;
|
|
@ -2,13 +2,6 @@ diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts b/a
|
|||
index e1ee1cd09..522a08d6c 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-zero-plus2.dts
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
|
||||
+ * Copyright (C) 2019 Adopted by Igor <igor@armbian.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
|
||||
@@ -180,3 +181,12 @@
|
||||
pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
|
||||
status = "okay";
|
||||
|
|
7138
patch/kernel/sunxi-current/check/general-sunxi-overlays.patch
Normal file
7138
patch/kernel/sunxi-current/check/general-sunxi-overlays.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,13 +0,0 @@
|
|||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
index 19bfbf3f..6189d428 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts
|
||||
@@ -57,7 +57,7 @@
|
||||
ethernet0 = &rtl8723cs;
|
||||
};
|
||||
|
||||
- backlight: backlight {
|
||||
+ backlight {
|
||||
compatible = "pwm-backlight";
|
||||
pwms = <&pwm 0 50000 0>;
|
||||
/*
|
|
@ -1,16 +0,0 @@
|
|||
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
||||
index 6c8cd34..735e05c 100644
|
||||
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
||||
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
||||
@@ -580,6 +609,11 @@
|
||||
function = "uart2";
|
||||
};
|
||||
|
||||
+ uart2_rts_cts_pins: uart2-rts-cts-pins {
|
||||
+ pins = "PA2", "PA3";
|
||||
+ function = "uart2";
|
||||
+ };
|
||||
+
|
||||
uart3_pins: uart3-pins {
|
||||
pins = "PA13", "PA14";
|
||||
function = "uart3";
|
|
@ -9,40 +9,60 @@ index 3c79f859..4e5c1d59 100644
|
|||
+*.dtb*
|
||||
+*.scr
|
||||
diff --git a/scripts/Makefile.dtbinst b/scripts/Makefile.dtbinst
|
||||
index 34614a48..8a8313d6 100644
|
||||
index 50d580d77..a08f9bee3 100644
|
||||
--- a/scripts/Makefile.dtbinst
|
||||
+++ b/scripts/Makefile.dtbinst
|
||||
@@ -20,6 +20,9 @@ include scripts/Kbuild.include
|
||||
@@ -13,24 +13,40 @@ src := $(obj)
|
||||
PHONY := __dtbs_install
|
||||
__dtbs_install:
|
||||
|
||||
+export dtbinst_root ?= $(obj)
|
||||
+
|
||||
include include/config/auto.conf
|
||||
include scripts/Kbuild.include
|
||||
include $(src)/Makefile
|
||||
|
||||
dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
|
||||
|
||||
-dtbs := $(addprefix $(dst)/, $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS),$(dtb-)))
|
||||
-subdirs := $(addprefix $(obj)/, $(subdir-y) $(subdir-m))
|
||||
+dtbinst-files := $(sort $(dtb-y) $(if $(CONFIG_OF_ALL_DTBS), $(dtb-)))
|
||||
+dtboinst-files := $(dtbo-y)
|
||||
+script-files := $(scr-y)
|
||||
+readme-files := $(dtbotxt-y)
|
||||
dtbinst-dirs := $(subdir-y) $(subdir-m)
|
||||
|
||||
# Helper targets for Installing DTBs into the boot directory
|
||||
@@ -32,10 +35,19 @@ install-dir = $(patsubst $(dtbinst-root)%,$(INSTALL_DTBS_PATH)%,$(obj))
|
||||
$(dtbinst-files): %.dtb: $(obj)/%.dtb
|
||||
$(call cmd,dtb_install,$(install-dir))
|
||||
|
||||
+dtbinst-dirs := $(subdir-y) $(subdir-m)
|
||||
+
|
||||
+# Helper targets for Installing DTBs into the boot directory
|
||||
+quiet_cmd_dtb_install = INSTALL $<
|
||||
+ cmd_dtb_install = mkdir -p $(2); cp $< $(2)
|
||||
+
|
||||
+install-dir = $(patsubst $(dtbinst_root)%,$(INSTALL_DTBS_PATH)%,$(obj))
|
||||
+
|
||||
+$(dtbinst-files): %.dtb: $(obj)/%.dtb
|
||||
+ $(call cmd,dtb_install,$(install-dir))
|
||||
+
|
||||
+$(dtboinst-files): %.dtbo: $(obj)/%.dtbo
|
||||
+ $(call cmd,dtb_install,$(install-dir))
|
||||
+
|
||||
|
||||
-__dtbs_install: $(dtbs) $(subdirs)
|
||||
- @:
|
||||
+$(script-files): %.scr: $(obj)/%.scr
|
||||
+ $(call cmd,dtb_install,$(install-dir))
|
||||
+
|
||||
|
||||
-quiet_cmd_dtb_install = INSTALL $@
|
||||
- cmd_dtb_install = install -D $< $@
|
||||
+$(readme-files): %: $(src)/%
|
||||
+ $(call cmd,dtb_install,$(install-dir))
|
||||
+
|
||||
$(dtbinst-dirs):
|
||||
$(Q)$(MAKE) $(dtbinst)=$(obj)/$@
|
||||
|
||||
-PHONY += $(dtbinst-files) $(dtbinst-dirs)
|
||||
-__dtbs_install: $(dtbinst-files) $(dtbinst-dirs)
|
||||
|
||||
-$(dst)/%.dtb: $(obj)/%.dtb
|
||||
- $(call cmd,dtb_install)
|
||||
+$(dtbinst-dirs):
|
||||
+ $(Q)$(MAKE) $(dtbinst)=$(obj)/$@
|
||||
|
||||
-PHONY += $(subdirs)
|
||||
-$(subdirs):
|
||||
- $(Q)$(MAKE) $(dtbinst)=$@ dst=$(patsubst $(obj)/%,$(dst)/%,$@)
|
||||
+PHONY += $(dtbinst-files) $(dtboinst-files) $(script-files) $(readme-files) $(dtbinst-dirs)
|
||||
+__dtbs_install: $(dtbinst-files) $(dtboinst-files) $(script-files) $(readme-files) $(dtbinst-dirs)
|
||||
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
|
||||
index 58c05e5d..2b95dda9 100644
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
|
||||
index 9a7def7..08c6a05 100644
|
||||
index 5e4c453..028ef66 100644
|
||||
--- a/drivers/spi/spi.c
|
||||
+++ b/drivers/spi/spi.c
|
||||
@@ -2884,6 +2884,19 @@ int spi_setup(struct spi_device *spi)
|
||||
@@ -3262,6 +3262,19 @@ int spi_setup(struct spi_device *spi)
|
||||
if (spi->controller->setup)
|
||||
status = spi->controller->setup(spi);
|
||||
|
||||
|
@ -19,6 +19,6 @@ index 9a7def7..08c6a05 100644
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
spi_set_cs(spi, false);
|
||||
|
||||
dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
|
||||
if (spi->controller->auto_runtime_pm && spi->controller->set_cs) {
|
||||
status = pm_runtime_get_sync(spi->controller->dev.parent);
|
||||
if (status < 0) {
|
||||
|
|
|
@ -13,7 +13,7 @@ new file mode 100644
|
|||
index 0000000..39d6a27
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/Makefile
|
||||
@@ -0,0 +1,89 @@
|
||||
@@ -0,0 +1,97 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0
|
||||
+dtbo-$(CONFIG_MACH_SUN4I) += \
|
||||
+ sun4i-a10-analog-codec.dtbo \
|
||||
|
@ -92,7 +92,15 @@ index 0000000..39d6a27
|
|||
+ sun8i-h3-usbhost1.dtbo \
|
||||
+ sun8i-h3-usbhost2.dtbo \
|
||||
+ sun8i-h3-usbhost3.dtbo \
|
||||
+ sun8i-h3-w1-gpio.dtbo
|
||||
+ sun8i-h3-w1-gpio.dtbo \
|
||||
+ sun8i-r40-i2c2.dtbo \
|
||||
+ sun8i-r40-i2c3.dtbo \
|
||||
+ sun8i-r40-spi-spidev0.dtbo \
|
||||
+ sun8i-r40-spi-spidev1.dtbo \
|
||||
+ sun8i-r40-uart2.dtbo \
|
||||
+ sun8i-r40-uart4.dtbo \
|
||||
+ sun8i-r40-uart5.dtbo \
|
||||
+ sun8i-r40-uart7.dtbo
|
||||
+
|
||||
+scr-$(CONFIG_MACH_SUN4I) += sun4i-a10-fixup.scr
|
||||
+scr-$(CONFIG_MACH_SUN5I) += sun5i-a13-fixup.scr
|
||||
|
@ -4520,6 +4528,236 @@ index 0000000..f4ccb7f
|
|||
+ };
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-i2c2.dts b/arch/arm/boot/dts/overlay/sun8i-r40-i2c2.dts
|
||||
new file mode 100644
|
||||
index 0000000..a1e3284
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-i2c2.dts
|
||||
@@ -0,0 +1,20 @@
|
||||
+/dts-v1/;
|
||||
+/plugin/;
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-h3";
|
||||
+
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ i2c2 = "/soc/i2c@1c2b400";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ fragment@1 {
|
||||
+ target = <&i2c2>;
|
||||
+ __overlay__ {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-i2c3.dts b/arch/arm/boot/dts/overlay/sun8i-r40-i2c3.dts
|
||||
new file mode 100644
|
||||
index 0000000..a1e3284
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-i2c3.dts
|
||||
@@ -0,0 +1,20 @@
|
||||
+/dts-v1/;
|
||||
+/plugin/;
|
||||
+
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-h3";
|
||||
+
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ i2c3 = "/soc/i2c@1c2b800";
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
+ fragment@1 {
|
||||
+ target = <&i2c3>;
|
||||
+ __overlay__ {
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-spi-spidev0.dts b/arch/arm/boot/dts/overlay/sun8i-r40-spi-spidev0.dts
|
||||
new file mode 100644
|
||||
index 0000000..734a9a8
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-spi-spidev0.dts
|
||||
@@ -0,0 +1,27 @@
|
||||
+/dts-v1/;
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-r40";
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ spi0 = "/soc/spi@1c05000";
|
||||
+ };
|
||||
+ };
|
||||
+ fragment@1 {
|
||||
+ target = <0xffffffff>;
|
||||
+ __overlay__ {
|
||||
+ #address-cells = <0x00000001>;
|
||||
+ #size-cells = <0x00000000>;
|
||||
+ status = "okay";
|
||||
+ spidev@0 {
|
||||
+ compatible = "spidev";
|
||||
+ status = "okay";
|
||||
+ reg = <0x00000000>;
|
||||
+ spi-max-frequency = <0x000f4240>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ __fixups__ {
|
||||
+ spi0 = "/fragment@1:target:0";
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-spi-spidev1.dts b/arch/arm/boot/dts/overlay/sun8i-r40-spi-spidev1.dts
|
||||
new file mode 100644
|
||||
index 0000000..d1d637c
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-spi-spidev1.dts
|
||||
@@ -0,0 +1,27 @@
|
||||
+/dts-v1/;
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-r40";
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ spi1 = "/soc/spi@1c06000";
|
||||
+ };
|
||||
+ };
|
||||
+ fragment@1 {
|
||||
+ target = <0xffffffff>;
|
||||
+ __overlay__ {
|
||||
+ #address-cells = <0x00000001>;
|
||||
+ #size-cells = <0x00000000>;
|
||||
+ status = "okay";
|
||||
+ spidev@0 {
|
||||
+ compatible = "spidev";
|
||||
+ status = "okay";
|
||||
+ reg = <0x00000000>;
|
||||
+ spi-max-frequency = <0x000f4240>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+ __fixups__ {
|
||||
+ spi1 = "/fragment@1:target:0";
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-uart2.dts b/arch/arm/boot/dts/overlay/sun8i-r40-uart2.dts
|
||||
new file mode 100644
|
||||
index 0000000..65e946d
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-uart2.dts
|
||||
@@ -0,0 +1,22 @@
|
||||
+/dts-v1/;
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-r40";
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ serial2 = "/soc/serial@1c28800";
|
||||
+ };
|
||||
+ };
|
||||
+ fragment@1 {
|
||||
+ target = <0xffffffff>;
|
||||
+ __overlay__ {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <0xffffffff>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+ __fixups__ {
|
||||
+ uart2 = "/fragment@1:target:0";
|
||||
+ uart2_pi_pins = "/fragment@1/__overlay__:pinctrl-0:0";
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-uart4.dts b/arch/arm/boot/dts/overlay/sun8i-r40-uart4.dts
|
||||
new file mode 100644
|
||||
index 0000000..65e946d
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-uart4.dts
|
||||
@@ -0,0 +1,22 @@
|
||||
+/dts-v1/;
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-r40";
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ serial4 = "/soc/serial@1c29000";
|
||||
+ };
|
||||
+ };
|
||||
+ fragment@1 {
|
||||
+ target = <0xffffffff>;
|
||||
+ __overlay__ {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <0xffffffff>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+ __fixups__ {
|
||||
+ uart4 = "/fragment@1:target:0";
|
||||
+ uart4_ph_pins = "/fragment@1/__overlay__:pinctrl-0:0";
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-uart5.dts b/arch/arm/boot/dts/overlay/sun8i-r40-uart5.dts
|
||||
new file mode 100644
|
||||
index 0000000..65e946d
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-uart5.dts
|
||||
@@ -0,0 +1,22 @@
|
||||
+/dts-v1/;
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-r40";
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ serial5 = "/soc/serial@1c29400";
|
||||
+ };
|
||||
+ };
|
||||
+ fragment@1 {
|
||||
+ target = <0xffffffff>;
|
||||
+ __overlay__ {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <0xffffffff>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+ __fixups__ {
|
||||
+ uart5 = "/fragment@1:target:0";
|
||||
+ uart5_ph_pins = "/fragment@1/__overlay__:pinctrl-0:0";
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm/boot/dts/overlay/sun8i-r40-uart7.dts b/arch/arm/boot/dts/overlay/sun8i-r40-uart7.dts
|
||||
new file mode 100644
|
||||
index 0000000..65e946d
|
||||
--- /dev/null
|
||||
+++ b/arch/arm/boot/dts/overlay/sun8i-r40-uart7.dts
|
||||
@@ -0,0 +1,22 @@
|
||||
+/dts-v1/;
|
||||
+/ {
|
||||
+ compatible = "allwinner,sun8i-r40";
|
||||
+ fragment@0 {
|
||||
+ target-path = "/aliases";
|
||||
+ __overlay__ {
|
||||
+ serial7 = "/soc/serial@1c29c00";
|
||||
+ };
|
||||
+ };
|
||||
+ fragment@1 {
|
||||
+ target = <0xffffffff>;
|
||||
+ __overlay__ {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <0xffffffff>;
|
||||
+ status = "okay";
|
||||
+ };
|
||||
+ };
|
||||
+ __fixups__ {
|
||||
+ uart7 = "/fragment@1:target:0";
|
||||
+ uart7_pi_pins = "/fragment@1/__overlay__:pinctrl-0:0";
|
||||
+ };
|
||||
+};
|
||||
diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile
|
||||
index fa35163..89df4ff 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/Makefile
|
||||
|
|
|
@ -2,7 +2,7 @@ diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts b/arch/arm6
|
|||
index ec0296a85..ad2c64d51 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-nanopi-a64.dts
|
||||
@@ -293,3 +293,36 @@ &uart0 {
|
||||
@@ -293,3 +293,32 @@ &uart0 {
|
||||
&usbphy {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ index ec0296a85..ad2c64d51 100644
|
|||
+status = "okay";
|
||||
+};
|
||||
+
|
||||
+&sound_hdmi {
|
||||
+&hdmi_sound {
|
||||
+status = "okay";
|
||||
+};
|
||||
+
|
||||
|
@ -20,10 +20,6 @@ index ec0296a85..ad2c64d51 100644
|
|||
+status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2s1 {
|
||||
+status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2s2 {
|
||||
+status = "okay";
|
||||
+};
|
||||
|
|
|
@ -1,151 +0,0 @@
|
|||
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
index f54a415f2..fb4cf5423 100644
|
||||
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts
|
||||
@@ -46,6 +46,8 @@
|
||||
#include "sun50i-a64.dtsi"
|
||||
|
||||
#include <dt-bindings/gpio/gpio.h>
|
||||
+#include <dt-bindings/input/input.h>
|
||||
+#include <dt-bindings/pwm/pwm.h>
|
||||
|
||||
/ {
|
||||
model = "OrangePi Win/Win Plus";
|
||||
@@ -55,9 +57,6 @@
|
||||
ethernet0 = &emac;
|
||||
serial0 = &uart0;
|
||||
serial1 = &uart1;
|
||||
- serial2 = &uart2;
|
||||
- serial3 = &uart3;
|
||||
- serial4 = &uart4;
|
||||
};
|
||||
|
||||
chosen {
|
||||
@@ -127,11 +126,17 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&cpu0 {
|
||||
+ cpu-supply = <®_dcdc2>;
|
||||
+};
|
||||
+
|
||||
&de {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&ehci0 {
|
||||
+ phys = <&usbphy 0>;
|
||||
+ phy-names = "usb";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -159,6 +164,14 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&i2s2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&mixer0 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&mdio {
|
||||
ext_rgmii_phy: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
@@ -195,7 +208,21 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&mmc2 {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
|
||||
+ vmmc-supply = <®_dcdc1>;
|
||||
+ vqmmc-supply = <®_eldo1>;
|
||||
+ bus-width = <8>;
|
||||
+ non-removable;
|
||||
+ cap-mmc-hw-reset;
|
||||
+ mmc-hs200-1_8v;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&ohci0 {
|
||||
+ phys = <&usbphy 0>;
|
||||
+ phy-names = "usb";
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
@@ -309,13 +336,14 @@
|
||||
};
|
||||
|
||||
®_eldo1 {
|
||||
+ regulator-always-on;
|
||||
regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-name = "cpvdd";
|
||||
};
|
||||
|
||||
®_eldo3 {
|
||||
- regulator-min-microvolt = <1500000>;
|
||||
+ regulator-min-microvolt = <1800000>;
|
||||
regulator-max-microvolt = <1800000>;
|
||||
regulator-name = "dvdd-csi";
|
||||
};
|
||||
@@ -338,6 +366,13 @@
|
||||
regulator-name = "vdd-cpus";
|
||||
};
|
||||
|
||||
+®_ldo_io0 {
|
||||
+ regulator-min-microvolt = <3300000>;
|
||||
+ regulator-max-microvolt = <3300000>;
|
||||
+ regulator-name = "vcc-usb";
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
®_rtc_ldo {
|
||||
regulator-name = "vcc-rtc";
|
||||
};
|
||||
@@ -362,6 +397,10 @@
|
||||
"MIC1", "Onboard Microphone";
|
||||
};
|
||||
|
||||
+&sound_hdmi {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&spi0 {
|
||||
status = "okay";
|
||||
|
||||
@@ -401,30 +440,8 @@
|
||||
};
|
||||
};
|
||||
|
||||
-/* On Pi-2 connector, RTS/CTS optional */
|
||||
-&uart2 {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&uart2_pins>;
|
||||
- status = "disabled";
|
||||
-};
|
||||
-
|
||||
-/* On Pi-2 connector, RTS/CTS optional */
|
||||
-&uart3 {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&uart3_pins>;
|
||||
- status = "disabled";
|
||||
-};
|
||||
-
|
||||
-/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
|
||||
-&uart4 {
|
||||
- pinctrl-names = "default";
|
||||
- pinctrl-0 = <&uart4_pins>;
|
||||
- status = "disabled";
|
||||
-};
|
||||
-
|
||||
&usb_otg {
|
||||
- dr_mode = "otg";
|
||||
- status = "okay";
|
||||
+ dr_mode = "host";
|
||||
};
|
||||
|
||||
&usbphy {
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
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