add sys-kernel/decade-sources
This commit is contained in:
parent
28256ec9db
commit
cdca2294d5
25 changed files with 19550 additions and 0 deletions
45
sys-kernel/decade-sources/decade-sources-5.13.7.ebuild
Normal file
45
sys-kernel/decade-sources/decade-sources-5.13.7.ebuild
Normal file
|
@ -0,0 +1,45 @@
|
|||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI="7"
|
||||
ETYPE="sources"
|
||||
K_WANT_GENPATCHES="base extras experimental"
|
||||
K_GENPATCHES_VER="6"
|
||||
|
||||
inherit kernel-2
|
||||
detect_version
|
||||
detect_arch
|
||||
|
||||
KEYWORDS="~arm64"
|
||||
HOMEPAGE="https://dev.gentoo.org/~mpagano/genpatches"
|
||||
IUSE="experimental"
|
||||
|
||||
DESCRIPTION="Full sources including the Gentoo patchset for the ${KV_MAJOR}.${KV_MINOR} kernel tree."
|
||||
SRC_URI="${KERNEL_URI} ${GENPATCHES_URI} ${ARCH_URI}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/add-board-nanopi-m4v2.patch"
|
||||
"${FILESDIR}/add-csgpio-to-rockchip-spi.patch"
|
||||
"${FILESDIR}/add-fusb30x-driver.patch"
|
||||
"${FILESDIR}/add-maker-friendlyarm.patch"
|
||||
"${FILESDIR}/add-rk3328-usb3-phy-driver.patch"
|
||||
"${FILESDIR}/board-nanopi-m4v2-dts-add-sound-card.patch"
|
||||
"${FILESDIR}/board-nanopi-m4v2-dts-ethernet-tweak.patch"
|
||||
"${FILESDIR}/board-nanopi-m4v2-dts-fix-stability-issues.patch"
|
||||
"${FILESDIR}/board-roc-rk3399-pc-fix-fusb302-compatible.patch"
|
||||
"${FILESDIR}/board-rockpis-0004-ethernet-stmmac-dwmac-rk-Add-MAC-driver-support-for-.patch"
|
||||
"${FILESDIR}/board-rockpis-0008-thermal-rockchip-add-tsadc-support-for-rk3308.patch"
|
||||
"${FILESDIR}/board-rockpis-0016-ASoC-rockchip-add-support-for-rockchip-i2s-tdm-contr.patch"
|
||||
"${FILESDIR}/board-rockpis-0017-WIP-Sync-rockchip_i2s_tdm-to-BSP-tree.patch"
|
||||
"${FILESDIR}/board-rockpis-0018-ASoC-codecs-Add-RK3308-internal-codec-driver.patch"
|
||||
"${FILESDIR}/board-rockpis-0019-Sync-rk3308_codec-to-BSP-tree.patch"
|
||||
"${FILESDIR}/board-rockpis-0022-ASoC-rk3308_codec-replace-codec-to-component.patch"
|
||||
"${FILESDIR}/general-emmc-hs400es-init-tweak.patch"
|
||||
"${FILESDIR}/general-fix-es8316-kernel-panic.patch"
|
||||
"${FILESDIR}/general-increasing_DMA_block_memory_allocation_to_2048.patch"
|
||||
"${FILESDIR}/general-rt5651-add-mclk.patch"
|
||||
"${FILESDIR}/rk3399-add-sclk-i2sout-src-clock.patch"
|
||||
"${FILESDIR}/rk3399-enable-dwc3-xhci-usb-trb-quirk.patch"
|
||||
"${FILESDIR}/rk3399-pci-rockchip-support-ep-gpio-undefined-case.patch"
|
||||
"${FILESDIR}/rk3399-sd-drive-level-8ma.patch"
|
||||
)
|
96
sys-kernel/decade-sources/files/add-board-nanopi-m4v2.patch
Normal file
96
sys-kernel/decade-sources/files/add-board-nanopi-m4v2.patch
Normal file
|
@ -0,0 +1,96 @@
|
|||
diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
index c3e00c0e2db7..c41203318e3a 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/Makefile
|
||||
+++ b/arch/arm64/boot/dts/rockchip/Makefile
|
||||
@@ -34,6 +34,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-kobol-helios64.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-leez-p710.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4.dtb
|
||||
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4v2.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-m4b.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-neo4.dtb
|
||||
dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopi-r4s.dtb
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
new file mode 100644
|
||||
index 000000000..60358ab8c
|
||||
--- /dev/null
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
@@ -0,0 +1,78 @@
|
||||
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
|
||||
+/*
|
||||
+ * FriendlyElec NanoPi M4V2 board device tree source
|
||||
+ *
|
||||
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
|
||||
+ * (http://www.friendlyarm.com)
|
||||
+ *
|
||||
+ * Copyright (c) 2018 Collabora Ltd.
|
||||
+ * Copyright (c) 2019 Arm Ltd.
|
||||
+ */
|
||||
+
|
||||
+/dts-v1/;
|
||||
+#include "rk3399-nanopi4.dtsi"
|
||||
+
|
||||
+/ {
|
||||
+ model = "FriendlyElec NanoPi M4 Ver2.0";
|
||||
+ compatible = "friendlyarm,nanopi-m4", "rockchip,rk3399";
|
||||
+
|
||||
+ vdd_5v: vdd-5v {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vdd_5v";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ };
|
||||
+
|
||||
+ vcc5v0_core: vcc5v0-core {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc5v0_core";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ vin-supply = <&vdd_5v>;
|
||||
+ };
|
||||
+
|
||||
+ vcc5v0_usb1: vcc5v0-usb1 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc5v0_usb1";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ vin-supply = <&vcc5v0_sys>;
|
||||
+ };
|
||||
+
|
||||
+ vcc5v0_usb2: vcc5v0-usb2 {
|
||||
+ compatible = "regulator-fixed";
|
||||
+ regulator-name = "vcc5v0_usb2";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ vin-supply = <&vcc5v0_sys>;
|
||||
+ };
|
||||
+
|
||||
+ vdd_log: vdd-log {
|
||||
+ compatible = "pwm-regulator";
|
||||
+ pwms = <&pwm2 0 25000 1>;
|
||||
+ regulator-name = "vdd_log";
|
||||
+ regulator-always-on;
|
||||
+ regulator-boot-on;
|
||||
+ regulator-min-microvolt = <800000>;
|
||||
+ regulator-max-microvolt = <1400000>;
|
||||
+ regulator-init-microvolt = <900000>;
|
||||
+ vin-supply = <&vcc5v0_core>;
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
+&vcc3v3_sys {
|
||||
+ vin-supply = <&vcc5v0_core>;
|
||||
+};
|
||||
+
|
||||
+&u2phy0_host {
|
||||
+ phy-supply = <&vcc5v0_usb1>;
|
||||
+};
|
||||
+
|
||||
+&u2phy1_host {
|
||||
+ phy-supply = <&vcc5v0_usb2>;
|
||||
+};
|
||||
+
|
||||
+&vbus_typec {
|
||||
+ regulator-always-on;
|
||||
+ vin-supply = <&vdd_5v>;
|
||||
+};
|
|
@ -0,0 +1,83 @@
|
|||
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
|
||||
index 2cc6d99..19e05ad 100644
|
||||
--- a/drivers/spi/spi-rockchip.c
|
||||
+++ b/drivers/spi/spi-rockchip.c
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <linux/clk.h>
|
||||
#include <linux/dmaengine.h>
|
||||
+#include <linux/gpio.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
@@ -185,6 +186,10 @@ struct rockchip_spi {
|
||||
bool cs_asserted[ROCKCHIP_SPI_MAX_CS_NUM];
|
||||
};
|
||||
|
||||
+struct rockchip_spi_data {
|
||||
+ bool cs_gpio_requested;
|
||||
+};
|
||||
+
|
||||
static inline void spi_enable_chip(struct rockchip_spi *rs, bool enable)
|
||||
{
|
||||
writel_relaxed((enable ? 1U : 0U), rs->regs + ROCKCHIP_SPI_SSIENR);
|
||||
@@ -455,6 +460,50 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs,
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int rockchip_spi_setup(struct spi_device *spi)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+ unsigned long flags = (spi->mode & SPI_CS_HIGH) ?
|
||||
+ GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH;
|
||||
+ struct rockchip_spi_data *data = spi_get_ctldata(spi);
|
||||
+
|
||||
+ if (!gpio_is_valid(spi->cs_gpio))
|
||||
+ return 0;
|
||||
+
|
||||
+ if (!data) {
|
||||
+ data = kzalloc(sizeof(*data), GFP_KERNEL);
|
||||
+ if (!data)
|
||||
+ return -ENOMEM;
|
||||
+ spi_set_ctldata(spi, data);
|
||||
+ }
|
||||
+
|
||||
+ if (!data->cs_gpio_requested) {
|
||||
+ ret = gpio_request_one(spi->cs_gpio, flags,
|
||||
+ dev_name(&spi->dev));
|
||||
+ if (!ret)
|
||||
+ data->cs_gpio_requested = 1;
|
||||
+ } else
|
||||
+ ret = gpio_direction_output(spi->cs_gpio, flags);
|
||||
+
|
||||
+ if (ret < 0)
|
||||
+ dev_err(&spi->dev, "Failed to setup cs gpio(%d): %d\n",
|
||||
+ spi->cs_gpio, ret);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+static void rockchip_spi_cleanup(struct spi_device *spi)
|
||||
+{
|
||||
+ struct rockchip_spi_data *data = spi_get_ctldata(spi);
|
||||
+
|
||||
+ if (data) {
|
||||
+ if (data->cs_gpio_requested)
|
||||
+ gpio_free(spi->cs_gpio);
|
||||
+ kfree(data);
|
||||
+ spi_set_ctldata(spi, NULL);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
static int rockchip_spi_config(struct rockchip_spi *rs,
|
||||
struct spi_device *spi, struct spi_transfer *xfer,
|
||||
bool use_dma)
|
||||
@@ -683,6 +732,8 @@ static int rockchip_spi_probe(struct platform_device *pdev)
|
||||
ctlr->max_speed_hz = min(rs->freq / BAUDR_SCKDV_MIN, MAX_SCLK_OUT);
|
||||
|
||||
ctlr->set_cs = rockchip_spi_set_cs;
|
||||
+ ctlr->setup = rockchip_spi_setup;
|
||||
+ ctlr->cleanup = rockchip_spi_cleanup;
|
||||
ctlr->transfer_one = rockchip_spi_transfer_one;
|
||||
ctlr->max_transfer_size = rockchip_spi_max_transfer_size;
|
||||
ctlr->handle_err = rockchip_spi_handle_err;
|
4047
sys-kernel/decade-sources/files/add-fusb30x-driver.patch
Normal file
4047
sys-kernel/decade-sources/files/add-fusb30x-driver.patch
Normal file
File diff suppressed because it is too large
Load diff
211
sys-kernel/decade-sources/files/add-maker-friendlyarm.patch
Normal file
211
sys-kernel/decade-sources/files/add-maker-friendlyarm.patch
Normal file
|
@ -0,0 +1,211 @@
|
|||
From 2fc2cbaaaf0dcebdeffa6e87bbc9ad843a5470dd Mon Sep 17 00:00:00 2001
|
||||
From: hmz007 <hmz007@gmail.com>
|
||||
Date: Sat, 11 Jan 2020 19:35:03 +0800
|
||||
Subject: [PATCH] soc: friendlyelec: Add board info driver
|
||||
|
||||
Change-Id: I122adb4f99c816b5c177f16392fb2df9c10a47be
|
||||
Signed-off-by: hmz007 <hmz007@gmail.com>
|
||||
---
|
||||
drivers/soc/Kconfig | 1 +
|
||||
drivers/soc/Makefile | 1 +
|
||||
drivers/soc/friendlyelec/Kconfig | 11 ++
|
||||
drivers/soc/friendlyelec/Makefile | 1 +
|
||||
drivers/soc/friendlyelec/board.c | 143 ++++++++++++++++++
|
||||
8 files changed, 161 insertions(+)
|
||||
create mode 100644 drivers/soc/friendlyelec/Kconfig
|
||||
create mode 100644 drivers/soc/friendlyelec/Makefile
|
||||
create mode 100644 drivers/soc/friendlyelec/board.c
|
||||
|
||||
diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
|
||||
index 833e04a7835c..9ddbd976395d 100644
|
||||
--- a/drivers/soc/Kconfig
|
||||
+++ b/drivers/soc/Kconfig
|
||||
@@ -21,5 +21,6 @@ source "drivers/soc/ux500/Kconfig"
|
||||
source "drivers/soc/ux500/Kconfig"
|
||||
source "drivers/soc/versatile/Kconfig"
|
||||
source "drivers/soc/xilinx/Kconfig"
|
||||
+source "drivers/soc/friendlyelec/Kconfig"
|
||||
|
||||
endmenu
|
||||
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
|
||||
index f678e4d9e..cfc815a7e 100644
|
||||
--- a/drivers/soc/Makefile
|
||||
+++ b/drivers/soc/Makefile
|
||||
@@ -29,3 +29,4 @@ obj-y += ti/
|
||||
obj-$(CONFIG_ARCH_U8500) += ux500/
|
||||
obj-$(CONFIG_PLAT_VERSATILE) += versatile/
|
||||
obj-y += xilinx/
|
||||
+obj-$(CONFIG_VENDOR_FRIENDLYELEC) += friendlyelec/
|
||||
diff --git a/drivers/soc/friendlyelec/Kconfig b/drivers/soc/friendlyelec/Kconfig
|
||||
new file mode 100644
|
||||
index 000000000000..9e21c663e6c8
|
||||
--- /dev/null
|
||||
+++ b/drivers/soc/friendlyelec/Kconfig
|
||||
@@ -0,0 +1,11 @@
|
||||
+#
|
||||
+# Machine drivers
|
||||
+#
|
||||
+
|
||||
+if ARCH_ROCKCHIP
|
||||
+
|
||||
+config VENDOR_FRIENDLYELEC
|
||||
+ bool "FriendlyElec board based on RK33XX SoCs"
|
||||
+ default n
|
||||
+
|
||||
+endif
|
||||
diff --git a/drivers/soc/friendlyelec/Makefile b/drivers/soc/friendlyelec/Makefile
|
||||
new file mode 100644
|
||||
index 000000000000..870542f05177
|
||||
--- /dev/null
|
||||
+++ b/drivers/soc/friendlyelec/Makefile
|
||||
@@ -0,0 +1 @@
|
||||
+obj-$(CONFIG_VENDOR_FRIENDLYELEC) += board.o
|
||||
diff --git a/drivers/soc/friendlyelec/board.c b/drivers/soc/friendlyelec/board.c
|
||||
new file mode 100644
|
||||
index 000000000000..886a8e1f7dc0
|
||||
--- /dev/null
|
||||
+++ b/drivers/soc/friendlyelec/board.c
|
||||
@@ -0,0 +1,143 @@
|
||||
+/*
|
||||
+ * Copyright (C) Guangzhou FriendlyELEC Computer Tech. Co., Ltd.
|
||||
+ * (http://www.friendlyarm.com)
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or
|
||||
+ * modify it under the terms of the GNU General Public License
|
||||
+ * as published by the Free Software Foundation; either version 2
|
||||
+ * of the License, or (at your option) any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, you can access it online at
|
||||
+ * http://www.gnu.org/licenses/gpl-2.0.html.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/kernel.h>
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/init.h>
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/io.h>
|
||||
+#include <linux/of.h>
|
||||
+#include <linux/of_platform.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/crc32.h>
|
||||
+#include <linux/nvmem-consumer.h>
|
||||
+
|
||||
+#define BOARD_MANF "FriendlyELEC Computer Tech. Co., Ltd."
|
||||
+
|
||||
+static const char *board_mach;
|
||||
+static const char *board_name;
|
||||
+static u32 board_rev;
|
||||
+static u32 board_serial_high, board_serial_low;
|
||||
+
|
||||
+static ssize_t board_sys_info_show(struct device *dev,
|
||||
+ struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ char *s = buf;
|
||||
+
|
||||
+ s += sprintf(s, "Hardware\t: %s\n", board_mach);
|
||||
+ s += sprintf(s, "Revision\t: %04x\n", board_rev);
|
||||
+ s += sprintf(s, "Serial\t\t: %08x%08x\n",
|
||||
+ board_serial_high, board_serial_low);
|
||||
+ s += sprintf(s, "\nModel\t\t: %s\n", board_name);
|
||||
+ s += sprintf(s, "Manufacturer\t: %s\n", BOARD_MANF);
|
||||
+
|
||||
+ return (s - buf);
|
||||
+}
|
||||
+
|
||||
+static struct device_attribute board_attr_info =
|
||||
+ __ATTR(info, S_IRUGO, board_sys_info_show, NULL);
|
||||
+
|
||||
+static int rockchip_cpuinfo_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device *dev = &pdev->dev;
|
||||
+ struct nvmem_cell *cell;
|
||||
+ unsigned char *efuse_buf, buf[16];
|
||||
+ size_t len;
|
||||
+ int i;
|
||||
+
|
||||
+ cell = nvmem_cell_get(dev, "id");
|
||||
+ if (IS_ERR(cell)) {
|
||||
+ dev_err(dev, "failed to get id cell: %ld\n", PTR_ERR(cell));
|
||||
+ return PTR_ERR(cell);
|
||||
+ }
|
||||
+
|
||||
+ efuse_buf = nvmem_cell_read(cell, &len);
|
||||
+ nvmem_cell_put(cell);
|
||||
+
|
||||
+ if (len != 16) {
|
||||
+ kfree(efuse_buf);
|
||||
+ dev_err(dev, "invalid id len: %zu\n", len);
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < 8; i++) {
|
||||
+ buf[i] = efuse_buf[1 + (i << 1)];
|
||||
+ buf[i + 8] = efuse_buf[i << 1];
|
||||
+ }
|
||||
+
|
||||
+ kfree(efuse_buf);
|
||||
+
|
||||
+ board_serial_low = crc32(0, buf, 8);
|
||||
+ board_serial_high = crc32(board_serial_low, buf + 8, 8);
|
||||
+
|
||||
+ dev_info(dev, "Serial\t\t: %08x%08x\n",
|
||||
+ board_serial_high, board_serial_low);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int board_sys_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct device_node *np = pdev->dev.of_node;
|
||||
+ struct device_node *root;
|
||||
+
|
||||
+ root = of_find_node_by_path("/");
|
||||
+
|
||||
+ of_property_read_u32(np, "hwrev", &board_rev);
|
||||
+
|
||||
+ if (of_property_read_string(np, "machine", &board_mach))
|
||||
+ of_property_read_string(root, "compatible", &board_mach);
|
||||
+
|
||||
+ if (of_property_read_string(np, "model", &board_name))
|
||||
+ of_property_read_string(root, "model", &board_name);
|
||||
+
|
||||
+ of_node_put(root);
|
||||
+
|
||||
+ rockchip_cpuinfo_probe(pdev);
|
||||
+
|
||||
+ device_create_file(&pdev->dev, &board_attr_info);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static const struct of_device_id board_sys_of_match[] = {
|
||||
+ { .compatible = "friendlyelec,board" },
|
||||
+ {}
|
||||
+};
|
||||
+MODULE_DEVICE_TABLE(of, board_sys_of_match);
|
||||
+
|
||||
+static struct platform_driver board_sys_driver = {
|
||||
+ .probe = board_sys_probe,
|
||||
+ .driver = {
|
||||
+ .name = "friendlyelec-board",
|
||||
+ .of_match_table = board_sys_of_match,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static int __init board_sys_init(void)
|
||||
+{
|
||||
+ return platform_driver_register(&board_sys_driver);
|
||||
+}
|
||||
+late_initcall(board_sys_init);
|
||||
+
|
||||
+MODULE_AUTHOR("support@friendlyarm.com");
|
||||
+MODULE_DESCRIPTION("FriendlyElec NanoPi Series Machine Driver");
|
||||
+MODULE_LICENSE("GPL v2");
|
1504
sys-kernel/decade-sources/files/add-rk3328-usb3-phy-driver.patch
Normal file
1504
sys-kernel/decade-sources/files/add-rk3328-usb3-phy-driver.patch
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,106 @@
|
|||
diff -u a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi 2019-10-17 23:47:33.000000000 +0300
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi 2019-10-27 22:34:55.988303874 +0300
|
||||
@@ -105,6 +105,27 @@
|
||||
};
|
||||
};
|
||||
|
||||
+ rt5651-sound {
|
||||
+ compatible = "simple-audio-card";
|
||||
+ simple-audio-card,name = "realtek,rt5651-codec";
|
||||
+ simple-audio-card,format = "i2s";
|
||||
+ simple-audio-card,mclk-fs = <256>;
|
||||
+ simple-audio-card,widgets =
|
||||
+ "Microphone", "Mic Jack",
|
||||
+ "Headphone", "Headphone Jack";
|
||||
+ simple-audio-card,routing =
|
||||
+ "Mic Jack", "micbias1",
|
||||
+ "IN1P", "Mic Jack",
|
||||
+ "Headphone Jack", "HPOL",
|
||||
+ "Headphone Jack", "HPOR";
|
||||
+ simple-audio-card,cpu {
|
||||
+ sound-dai = <&i2s1>;
|
||||
+ };
|
||||
+ simple-audio-card,codec {
|
||||
+ sound-dai = <&rt5651>;
|
||||
+ };
|
||||
+ };
|
||||
+
|
||||
sdio_pwrseq: sdio-pwrseq {
|
||||
compatible = "mmc-pwrseq-simple";
|
||||
clocks = <&rk808 1>;
|
||||
@@ -184,6 +205,10 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&hdmi_sound {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&i2c0 {
|
||||
clock-frequency = <400000>;
|
||||
i2c-scl-rising-time-ns = <160>;
|
||||
@@ -432,6 +457,16 @@
|
||||
i2c-scl-rising-time-ns = <150>;
|
||||
i2c-scl-falling-time-ns = <30>;
|
||||
status = "okay";
|
||||
+
|
||||
+ rt5651: rt5651@1a {
|
||||
+ compatible = "realtek,rt5651";
|
||||
+ reg = <0x1a>;
|
||||
+ clocks = <&cru SCLK_I2S_8CH_OUT>;
|
||||
+ clock-names = "mclk";
|
||||
+ hp-det-gpio = <&gpio4 RK_PC4 GPIO_ACTIVE_LOW>;
|
||||
+ // spk-con-gpio = <&gpio0 RK_PB3 GPIO_ACTIVE_HIGH>;
|
||||
+ #sound-dai-cells = <0>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
@@ -459,6 +494,16 @@
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
+&i2s1 {
|
||||
+ rockchip,playback-channels = <8>;
|
||||
+ rockchip,capture-channels = <8>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&i2s2 {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
&io_domains {
|
||||
bt656-supply = <&vcc_1v8>;
|
||||
audio-supply = <&vcca1v8_codec>;
|
||||
@@ -724,3 +769,9 @@
|
||||
&vopl_mmu {
|
||||
status = "okay";
|
||||
};
|
||||
+
|
||||
+&spdif {
|
||||
+ i2c-scl-rising-time-ns = <450>;
|
||||
+ i2c-scl-falling-time-ns = <15>;
|
||||
+ status = "okay";
|
||||
+};
|
||||
diff --git a/sound/soc/rockchip/Kconfig b/sound/soc/rockchip/Kconfig
|
||||
index b43657e6e..fb75c425e 100644
|
||||
--- a/sound/soc/rockchip/Kconfig
|
||||
+++ b/sound/soc/rockchip/Kconfig
|
||||
@@ -53,6 +53,15 @@ config SND_SOC_ROCKCHIP_RT5645
|
||||
Say Y or M here if you want to add support for SoC audio on Rockchip
|
||||
boards using the RT5645/RT5650 codec, such as Veyron.
|
||||
|
||||
+config SND_SOC_ROCKCHIP_RT5651
|
||||
+ tristate "ASoC support for Rockchip boards using a RT5651 codec"
|
||||
+ depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP
|
||||
+ select SND_SOC_ROCKCHIP_I2S
|
||||
+ select SND_SOC_RT5651
|
||||
+ help
|
||||
+ Say Y or M here if you want to add support for SoC audio on Rockchip
|
||||
+ boards using the RT5651 codec, such as FriendlyARM's Nano{Pi,PC} family.
|
||||
+
|
||||
config SND_SOC_RK3288_HDMI_ANALOG
|
||||
tristate "ASoC support multiple codecs for Rockchip RK3288 boards"
|
||||
depends on SND_SOC_ROCKCHIP && I2C && GPIOLIB && CLKDEV_LOOKUP
|
|
@ -0,0 +1,15 @@
|
|||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
index 60358ab8c..057045ca3 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
@@ -48,6 +48,10 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&gmac {
|
||||
+ rx_delay = <0x16>;
|
||||
+};
|
||||
+
|
||||
&vcc3v3_sys {
|
||||
vin-supply = <&vcc5v0_core>;
|
||||
};
|
|
@ -0,0 +1,29 @@
|
|||
By default rk808's buck regulators switch voltage in multiple 100mV jumps.
|
||||
This seems to be too much for NanoPi M4V2 and makes it unstable.
|
||||
|
||||
Shortening the steps to 50mV (4 multiple of base buck step which is 12.5mV)
|
||||
makes the NanoPi M4V2 stable.
|
||||
Tested with multiple hours of running memtester without a single failure.
|
||||
|
||||
Signed-off-by: Piotr Szczepanik <piter75@gmail.com>
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
index 2dcaf497c..094440ce3 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi-m4v2.dts
|
||||
@@ -64,6 +64,10 @@ &gmac {
|
||||
rx_delay = <0x16>;
|
||||
};
|
||||
|
||||
+&rk808 {
|
||||
+ max-buck-steps-per-change = <4>;
|
||||
+};
|
||||
+
|
||||
&vcc3v3_sys {
|
||||
vin-supply = <&vcc5v0_core>;
|
||||
};
|
||||
@@ -80,3 +84,4 @@ &vbus_typec {
|
||||
regulator-always-on;
|
||||
vin-supply = <&vdd_5v>;
|
||||
};
|
||||
+
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
index 9f225e9c3..057c938be 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399-roc-pc.dtsi
|
||||
@@ -506,7 +506,7 @@
|
||||
status = "okay";
|
||||
|
||||
fusb1: usb-typec@22 {
|
||||
- compatible = "fcs,fusb302";
|
||||
+ compatible = "fairchild,fusb302";
|
||||
reg = <0x22>;
|
||||
interrupt-parent = <&gpio1>;
|
||||
interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
|
||||
@@ -523,7 +523,7 @@
|
||||
status = "okay";
|
||||
|
||||
fusb0: usb-typec@22 {
|
||||
- compatible = "fcs,fusb302";
|
||||
+ compatible = "fairchild,fusb302";
|
||||
reg = <0x22>;
|
||||
interrupt-parent = <&gpio1>;
|
||||
interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
|
|
@ -0,0 +1,88 @@
|
|||
From 3aab567792a7fa949e8aca7a92a31f15d435efbe Mon Sep 17 00:00:00 2001
|
||||
From: ashthespy <ashthespy@gmail.com>
|
||||
Date: Thu, 16 Jan 2020 21:11:56 +0100
|
||||
Subject: [PATCH 04/23] ethernet: stmmac: dwmac-rk: Add MAC driver support for
|
||||
rk3308
|
||||
|
||||
Probably in the wrong place, as it's only 10/100 but :meh:
|
||||
|
||||
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
index dc50ba13a746..cfeca75ed284 100644
|
||||
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
|
||||
@@ -482,6 +482,64 @@ static const struct rk_gmac_ops rk3288_ops = {
|
||||
.set_rmii_speed = rk3288_set_rmii_speed,
|
||||
};
|
||||
|
||||
+#define RK3308_GRF_MAC_CON0 0x04a0
|
||||
+
|
||||
+/* Rk3308_GRF_MAC_CON1 */
|
||||
+#define RK3308_MAC_PHY_INTF_SEL_RMII (GRF_CLR_BIT(2) | GRF_CLR_BIT(3) | \
|
||||
+ GRF_BIT(4))
|
||||
+#define RK3308_MAC_SPEED_10M GRF_CLR_BIT(0)
|
||||
+#define Rk3308_MAC_SPEED_100M GRF_BIT(0)
|
||||
+
|
||||
+static void rk3308_set_to_rmii(struct rk_priv_data *bsp_priv)
|
||||
+{
|
||||
+ struct device *dev = &bsp_priv->pdev->dev;
|
||||
+
|
||||
+ if (IS_ERR(bsp_priv->grf)) {
|
||||
+ dev_err(dev, "%s: Missing rockchip,grf property\n", __func__);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ regmap_write(bsp_priv->grf, RK3308_GRF_MAC_CON0,
|
||||
+ RK3308_MAC_PHY_INTF_SEL_RMII);
|
||||
+}
|
||||
+
|
||||
+static void rk3308_set_rmii_speed(struct rk_priv_data *bsp_priv, int speed)
|
||||
+{
|
||||
+ struct device *dev = &bsp_priv->pdev->dev;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (IS_ERR(bsp_priv->clk_mac_speed)) {
|
||||
+ dev_err(dev, "%s: Missing clk_mac_speed clock\n", __func__);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (speed == 10) {
|
||||
+ regmap_write(bsp_priv->grf, RK3308_GRF_MAC_CON0,
|
||||
+ RK3308_MAC_SPEED_10M);
|
||||
+
|
||||
+ ret = clk_set_rate(bsp_priv->clk_mac_speed, 2500000);
|
||||
+ if (ret)
|
||||
+ dev_err(dev, "%s: set clk_mac_speed rate 2500000 failed: %d\n",
|
||||
+ __func__, ret);
|
||||
+ } else if (speed == 100) {
|
||||
+ regmap_write(bsp_priv->grf, RK3308_GRF_MAC_CON0,
|
||||
+ Rk3308_MAC_SPEED_100M);
|
||||
+
|
||||
+ ret = clk_set_rate(bsp_priv->clk_mac_speed, 25000000);
|
||||
+ if (ret)
|
||||
+ dev_err(dev, "%s: set clk_mac_speed rate 25000000 failed: %d\n",
|
||||
+ __func__, ret);
|
||||
+
|
||||
+ } else {
|
||||
+ dev_err(dev, "unknown speed value for RMII! speed=%d", speed);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static const struct rk_gmac_ops rk3308_ops = {
|
||||
+ .set_to_rmii = rk3308_set_to_rmii,
|
||||
+ .set_rmii_speed = rk3308_set_rmii_speed,
|
||||
+};
|
||||
+
|
||||
#define RK3328_GRF_MAC_CON0 0x0900
|
||||
#define RK3328_GRF_MAC_CON1 0x0904
|
||||
#define RK3328_GRF_MAC_CON2 0x0908
|
||||
@@ -1477,6 +1535,7 @@ static const struct of_device_id rk_gmac_dwmac_match[] = {
|
||||
{ .compatible = "rockchip,rk3128-gmac", .data = &rk3128_ops },
|
||||
{ .compatible = "rockchip,rk3228-gmac", .data = &rk3228_ops },
|
||||
{ .compatible = "rockchip,rk3288-gmac", .data = &rk3288_ops },
|
||||
+ { .compatible = "rockchip,rk3308-gmac", .data = &rk3308_ops },
|
||||
{ .compatible = "rockchip,rk3328-gmac", .data = &rk3328_ops },
|
||||
{ .compatible = "rockchip,rk3366-gmac", .data = &rk3366_ops },
|
||||
{ .compatible = "rockchip,rk3368-gmac", .data = &rk3368_ops },
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
From 498c9f200325f0397fd03163a98e053430b80aa4 Mon Sep 17 00:00:00 2001
|
||||
From: ashthespy <ashthespy@users.noreply.github.com>
|
||||
Date: Fri, 17 Jan 2020 15:58:20 +0100
|
||||
Subject: [PATCH 08/23] thermal: rockchip: add tsadc support for rk3308
|
||||
|
||||
From a231e9c68e5f5e6cf5a82a40828cfd1df4ad1f3e Mon Sep 17 00:00:00 2001
|
||||
From: Rocky Hao <rocky.hao@rock-chips.com>
|
||||
Date: Fri, 9 Mar 2018 17:36:39 +0800
|
||||
Subject: [PATCH] thermal: rockchip: add tsadc support for rk3308
|
||||
|
||||
Change-Id: Ibf1782ca471c8ad4b14d6fd64eeb123181903adc
|
||||
Signed-off-by: Rocky Hao <rocky.hao@rock-chips.com>
|
||||
---
|
||||
.../bindings/thermal/rockchip-thermal.txt | 1 +
|
||||
drivers/thermal/rockchip_thermal.c | 28 +++++++++++++++++++
|
||||
2 files changed, 29 insertions(+)
|
||||
|
||||
diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
|
||||
index c6aac9bcacf1..3a0a9556680e 100644
|
||||
--- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
|
||||
+++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt
|
||||
@@ -6,6 +6,7 @@ Required properties:
|
||||
"rockchip,rv1108-tsadc": found on RV1108 SoCs
|
||||
"rockchip,rk3228-tsadc": found on RK3228 SoCs
|
||||
"rockchip,rk3288-tsadc": found on RK3288 SoCs
|
||||
+ "rockchip,rk3308-tsadc": found on RK3308 SoCs
|
||||
"rockchip,rk3328-tsadc": found on RK3328 SoCs
|
||||
"rockchip,rk3368-tsadc": found on RK3368 SoCs
|
||||
"rockchip,rk3399-tsadc": found on RK3399 SoCs
|
||||
diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c
|
||||
index 343c2f5c5a25..d4d66724535a 100644
|
||||
--- a/drivers/thermal/rockchip_thermal.c
|
||||
+++ b/drivers/thermal/rockchip_thermal.c
|
||||
@@ -821,6 +821,30 @@ static void rk_tsadcv2_tshut_mode(int chn, void __iomem *regs,
|
||||
writel_relaxed(val, regs + TSADCV2_INT_EN);
|
||||
}
|
||||
|
||||
+static const struct rockchip_tsadc_chip rk3308_tsadc_data = {
|
||||
+ .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
|
||||
+ .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
|
||||
+ .chn_num = 2, /* 2 channels for tsadc */
|
||||
+
|
||||
+ .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */
|
||||
+ .tshut_temp = 95000,
|
||||
+
|
||||
+ .initialize = rk_tsadcv4_initialize,
|
||||
+ .irq_ack = rk_tsadcv3_irq_ack,
|
||||
+ .control = rk_tsadcv3_control,
|
||||
+ .get_temp = rk_tsadcv2_get_temp,
|
||||
+ .set_alarm_temp = rk_tsadcv2_alarm_temp,
|
||||
+ .set_tshut_temp = rk_tsadcv2_tshut_temp,
|
||||
+ .set_tshut_mode = rk_tsadcv2_tshut_mode,
|
||||
+
|
||||
+ .table = {
|
||||
+ .id = rk3328_code_table,
|
||||
+ .length = ARRAY_SIZE(rk3328_code_table),
|
||||
+ .data_mask = TSADCV2_DATA_MASK,
|
||||
+ .mode = ADC_INCREMENT,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
static const struct rockchip_tsadc_chip px30_tsadc_data = {
|
||||
.chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */
|
||||
.chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */
|
||||
@@ -1032,6 +1056,10 @@ static const struct of_device_id of_rockchip_thermal_match[] = {
|
||||
.compatible = "rockchip,rk3288-tsadc",
|
||||
.data = (void *)&rk3288_tsadc_data,
|
||||
},
|
||||
+ {
|
||||
+ .compatible = "rockchip,rk3308-tsadc",
|
||||
+ .data = (void *)&rk3308_tsadc_data,
|
||||
+ },
|
||||
{
|
||||
.compatible = "rockchip,rk3328-tsadc",
|
||||
.data = (void *)&rk3328_tsadc_data,
|
||||
--
|
||||
2.25.1
|
||||
|
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
|
@ -0,0 +1,459 @@
|
|||
From b882c2185ab561ec88c2540623cfa49e2cb56956 Mon Sep 17 00:00:00 2001
|
||||
From: ashthespy <ashthespy@gmail.com>
|
||||
Date: Mon, 3 Feb 2020 19:35:42 +0100
|
||||
Subject: [PATCH 22/23] ASoC: rk3308_codec: replace codec to component
|
||||
|
||||
---
|
||||
sound/soc/codecs/rk3308_codec.c | 159 ++++++++++++-----------
|
||||
sound/soc/codecs/rk3308_codec_provider.h | 2 +-
|
||||
2 files changed, 84 insertions(+), 77 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/codecs/rk3308_codec.c b/sound/soc/codecs/rk3308_codec.c
|
||||
index 815e22fc346c..16bfb215586e 100644
|
||||
--- a/sound/soc/codecs/rk3308_codec.c
|
||||
+++ b/sound/soc/codecs/rk3308_codec.c
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/reset.h>
|
||||
-#include <linux/rockchip/grf.h>
|
||||
+// #include <linux/rockchip/grf.h>
|
||||
#include <linux/version.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/dmaengine_pcm.h>
|
||||
@@ -156,7 +156,7 @@ struct rk3308_codec_priv {
|
||||
struct gpio_desc *hp_ctl_gpio;
|
||||
struct gpio_desc *spk_ctl_gpio;
|
||||
struct gpio_desc *pa_drv_gpio;
|
||||
- struct snd_soc_codec *codec;
|
||||
+ struct snd_soc_component *component;
|
||||
struct snd_soc_jack *hpdet_jack;
|
||||
struct regulator *vcc_micbias;
|
||||
u32 codec_ver;
|
||||
@@ -883,8 +883,8 @@ static const struct snd_kcontrol_new rk3308_codec_dapm_controls[] = {
|
||||
static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
|
||||
if (e->reg < 0 || e->reg > ADC_LR_GROUP_MAX - 1) {
|
||||
@@ -904,8 +904,8 @@ static int rk3308_codec_agc_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value = ucontrol->value.integer.value[0];
|
||||
int grp = e->reg;
|
||||
@@ -970,8 +970,8 @@ static int rk3308_codec_agc_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -998,8 +998,8 @@ static int rk3308_codec_agc_asr_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -1032,8 +1032,8 @@ static int rk3308_codec_agc_asr_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -1064,8 +1064,8 @@ static int rk3308_codec_mic_mute_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
int grp = e->reg;
|
||||
@@ -1098,8 +1098,8 @@ static int rk3308_codec_mic_mute_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = rk3308->micbias_volt;
|
||||
|
||||
@@ -1109,8 +1109,8 @@ static int rk3308_codec_micbias_volts_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int volt = ucontrol->value.integer.value[0];
|
||||
int ret;
|
||||
|
||||
@@ -1133,8 +1133,8 @@ static int rk3308_codec_micbias_volts_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
ucontrol->value.integer.value[0] = rk3308->enable_micbias;
|
||||
|
||||
@@ -1144,8 +1144,8 @@ static int rk3308_codec_main_micbias_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_main_micbias_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int on = ucontrol->value.integer.value[0];
|
||||
|
||||
if (on) {
|
||||
@@ -1168,8 +1168,8 @@ static int rk3308_codec_mic_gain_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int gain = ucontrol->value.integer.value[0];
|
||||
|
||||
if (gain > RK3308_ADC_CH1_MIC_GAIN_MAX) {
|
||||
@@ -1197,8 +1197,8 @@ static int rk3308_codec_mic_gain_put(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value;
|
||||
|
||||
@@ -1222,8 +1222,8 @@ static int rk3308_codec_hpf_get(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpf_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int value = ucontrol->value.integer.value[0];
|
||||
|
||||
@@ -1259,8 +1259,8 @@ static int rk3308_codec_hpout_l_get_tlv(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpout_l_put_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int dgain = ucontrol->value.integer.value[0];
|
||||
|
||||
if (dgain > RK3308_DAC_L_HPOUT_GAIN_MAX) {
|
||||
@@ -1283,8 +1283,8 @@ static int rk3308_codec_hpout_r_get_tlv(struct snd_kcontrol *kcontrol,
|
||||
static int rk3308_codec_hpout_r_put_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
- struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int dgain = ucontrol->value.integer.value[0];
|
||||
|
||||
if (dgain > RK3308_DAC_R_HPOUT_GAIN_MAX) {
|
||||
@@ -1408,9 +1408,9 @@ static void rk3308_speaker_ctl(struct rk3308_codec_priv *rk3308, int on)
|
||||
}
|
||||
}
|
||||
|
||||
-static int rk3308_codec_reset(struct snd_soc_codec *codec)
|
||||
+static int rk3308_codec_reset(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
reset_control_assert(rk3308->reset);
|
||||
usleep_range(2000, 2500); /* estimated value */
|
||||
@@ -1452,10 +1452,10 @@ static int rk3308_codec_dac_dig_reset(struct rk3308_codec_priv *rk3308)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_set_bias_level(struct snd_soc_codec *codec,
|
||||
+static int rk3308_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_ON:
|
||||
@@ -1473,11 +1473,11 @@ static int rk3308_set_bias_level(struct snd_soc_codec *codec,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_set_dai_fmt(struct snd_soc_dai *codec_dai,
|
||||
+static int rk3308_set_dai_fmt(struct snd_soc_dai *dai,
|
||||
unsigned int fmt)
|
||||
{
|
||||
- struct snd_soc_codec *codec = codec_dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
unsigned int adc_aif1 = 0, adc_aif2 = 0, dac_aif1 = 0, dac_aif2 = 0;
|
||||
int idx, grp, is_master;
|
||||
int type = ADC_TYPE_ALL;
|
||||
@@ -1721,8 +1721,8 @@ static int rk3308_codec_update_adc_grps(struct rk3308_codec_priv *rk3308,
|
||||
|
||||
static int rk3308_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
int dgain;
|
||||
@@ -3630,8 +3630,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_str *playback_str =
|
||||
&substream->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK];
|
||||
int type = ADC_TYPE_LOOPBACK;
|
||||
@@ -3705,8 +3705,8 @@ static int rk3308_hw_params(struct snd_pcm_substream *substream,
|
||||
static int rk3308_pcm_trigger(struct snd_pcm_substream *substream,
|
||||
int cmd, struct snd_soc_dai *dai)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
int type = ADC_TYPE_LOOPBACK;
|
||||
int idx, grp;
|
||||
|
||||
@@ -3749,8 +3749,8 @@ static int rk3308_pcm_trigger(struct snd_pcm_substream *substream,
|
||||
static void rk3308_pcm_shutdown(struct snd_pcm_substream *substream,
|
||||
struct snd_soc_dai *dai)
|
||||
{
|
||||
- struct snd_soc_codec *codec = dai->codec;
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct snd_soc_component *component = dai->component;
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
|
||||
rk3308_codec_close_playback(rk3308);
|
||||
@@ -3809,9 +3809,9 @@ static struct snd_soc_dai_driver rk3308_dai[] = {
|
||||
},
|
||||
};
|
||||
|
||||
-static int rk3308_suspend(struct snd_soc_codec *codec)
|
||||
+static int rk3308_suspend(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (rk3308->no_deep_low_power)
|
||||
goto out;
|
||||
@@ -3822,13 +3822,13 @@ static int rk3308_suspend(struct snd_soc_codec *codec)
|
||||
clk_disable_unprepare(rk3308->pclk);
|
||||
|
||||
out:
|
||||
- rk3308_set_bias_level(codec, SND_SOC_BIAS_OFF);
|
||||
+ rk3308_set_bias_level(component, SND_SOC_BIAS_OFF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_resume(struct snd_soc_codec *codec)
|
||||
+static int rk3308_resume(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
int ret = 0;
|
||||
|
||||
if (rk3308->no_deep_low_power)
|
||||
@@ -3857,7 +3857,7 @@ static int rk3308_resume(struct snd_soc_codec *codec)
|
||||
|
||||
rk3308_codec_dlp_up(rk3308);
|
||||
out:
|
||||
- rk3308_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
||||
+ rk3308_set_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -3972,7 +3972,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308)
|
||||
int ret;
|
||||
|
||||
if (rk3308->codec_ver == ACODEC_VERSION_B) {
|
||||
- ret = snd_soc_add_codec_controls(rk3308->codec,
|
||||
+ ret = snd_soc_add_component_controls(rk3308->component,
|
||||
mic_gains_b,
|
||||
ARRAY_SIZE(mic_gains_b));
|
||||
if (ret) {
|
||||
@@ -3982,7 +3982,7 @@ static int rk3308_codec_dapm_mic_gains(struct rk3308_codec_priv *rk3308)
|
||||
return ret;
|
||||
}
|
||||
} else {
|
||||
- ret = snd_soc_add_codec_controls(rk3308->codec,
|
||||
+ ret = snd_soc_add_component_controls(rk3308->component,
|
||||
mic_gains_a,
|
||||
ARRAY_SIZE(mic_gains_a));
|
||||
if (ret) {
|
||||
@@ -4081,15 +4081,15 @@ static int rk3308_codec_prepare(struct rk3308_codec_priv *rk3308)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_probe(struct snd_soc_codec *codec)
|
||||
+static int rk3308_probe(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
int ext_micbias;
|
||||
|
||||
- rk3308->codec = codec;
|
||||
+ rk3308->component = component;
|
||||
rk3308_codec_set_dac_path_state(rk3308, PATH_IDLE);
|
||||
|
||||
- rk3308_codec_reset(codec);
|
||||
+ rk3308_codec_reset(component);
|
||||
rk3308_codec_power_on(rk3308);
|
||||
|
||||
/* From vendor recommend, disable micbias at first. */
|
||||
@@ -4108,9 +4108,9 @@ static int rk3308_probe(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int rk3308_remove(struct snd_soc_codec *codec)
|
||||
+static void rk3308_remove(struct snd_soc_component *component)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
rk3308_headphone_ctl(rk3308, 0);
|
||||
rk3308_speaker_ctl(rk3308, 0);
|
||||
@@ -4124,17 +4124,25 @@ static int rk3308_remove(struct snd_soc_codec *codec)
|
||||
regcache_cache_only(rk3308->regmap, false);
|
||||
regcache_sync(rk3308->regmap);
|
||||
|
||||
- return 0;
|
||||
}
|
||||
|
||||
-static struct snd_soc_codec_driver soc_codec_dev_rk3308 = {
|
||||
- .probe = rk3308_probe,
|
||||
- .remove = rk3308_remove,
|
||||
- .suspend = rk3308_suspend,
|
||||
- .resume = rk3308_resume,
|
||||
- .set_bias_level = rk3308_set_bias_level,
|
||||
- .controls = rk3308_codec_dapm_controls,
|
||||
- .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls),
|
||||
+static const struct snd_soc_component_driver soc_codec_dev_rk3308_component = {
|
||||
+ .probe = rk3308_probe,
|
||||
+ .remove = rk3308_remove,
|
||||
+ .resume = rk3308_resume,
|
||||
+ .suspend = rk3308_suspend,
|
||||
+ .set_bias_level = rk3308_set_bias_level,
|
||||
+ .controls = rk3308_codec_dapm_controls,
|
||||
+ .num_controls = ARRAY_SIZE(rk3308_codec_dapm_controls),
|
||||
+ // .dapm_widgets = rk3308_dapm_widgets,
|
||||
+ // .num_dapm_widgets = ARRAY_SIZE(rk3308_dapm_widgets),
|
||||
+ // .dapm_routes = rk3308_dapm_routes,
|
||||
+ // .num_dapm_routes = ARRAY_SIZE(rk3308_dapm_routes),
|
||||
+ // .suspend_bias_off = 1,
|
||||
+ // .idle_bias_on = 1,
|
||||
+ // .use_pmdown_time = 1,
|
||||
+ .endianness = 1,
|
||||
+ .non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static const struct reg_default rk3308_codec_reg_defaults[] = {
|
||||
@@ -4299,14 +4307,14 @@ static irqreturn_t rk3308_codec_hpdet_isr(int irq, void *data)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
-void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec,
|
||||
+void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *hpdet_jack);
|
||||
EXPORT_SYMBOL_GPL(rk3308_codec_set_jack_detect_cb);
|
||||
|
||||
-static void rk3308_codec_set_jack_detect(struct snd_soc_codec *codec,
|
||||
+static void rk3308_codec_set_jack_detect(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *hpdet_jack)
|
||||
{
|
||||
- struct rk3308_codec_priv *rk3308 = snd_soc_codec_get_drvdata(codec);
|
||||
+ struct rk3308_codec_priv *rk3308 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
rk3308->hpdet_jack = hpdet_jack;
|
||||
|
||||
@@ -5114,10 +5122,10 @@ static int rk3308_platform_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, rk3308);
|
||||
|
||||
- ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_rk3308,
|
||||
+ ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_rk3308_component,
|
||||
rk3308_dai, ARRAY_SIZE(rk3308_dai));
|
||||
if (ret < 0) {
|
||||
- dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
|
||||
+ dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
|
||||
goto failed;
|
||||
}
|
||||
|
||||
@@ -5140,7 +5148,6 @@ static int rk3308_platform_remove(struct platform_device *pdev)
|
||||
clk_disable_unprepare(rk3308->mclk_rx);
|
||||
clk_disable_unprepare(rk3308->mclk_tx);
|
||||
clk_disable_unprepare(rk3308->pclk);
|
||||
- snd_soc_unregister_codec(&pdev->dev);
|
||||
device_unregister(&rk3308->dev);
|
||||
|
||||
return 0;
|
||||
diff --git a/sound/soc/codecs/rk3308_codec_provider.h b/sound/soc/codecs/rk3308_codec_provider.h
|
||||
index 68042b1328dc..34c1ef86a507 100644
|
||||
--- a/sound/soc/codecs/rk3308_codec_provider.h
|
||||
+++ b/sound/soc/codecs/rk3308_codec_provider.h
|
||||
@@ -21,7 +21,7 @@
|
||||
#define __RK3308_CODEC_PROVIDER_H__
|
||||
|
||||
#ifdef CONFIG_SND_SOC_RK3308
|
||||
-extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_codec *codec,
|
||||
+extern void (*rk3308_codec_set_jack_detect_cb)(struct snd_soc_component *component,
|
||||
struct snd_soc_jack *hpdet_jack);
|
||||
#endif
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
This patch is required to boot some Rock Pi 4 and NanoPC T4 units
|
||||
with kernel 5.3+ and is on par with how it is done in Rockchip's BSP.
|
||||
|
||||
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
|
||||
index de8fbc396..95858e554 100644
|
||||
--- a/drivers/mmc/core/mmc.c
|
||||
+++ b/drivers/mmc/core/mmc.c
|
||||
@@ -1371,12 +1371,12 @@ static int mmc_select_hs400es(struct mmc_card *card)
|
||||
}
|
||||
|
||||
mmc_set_timing(host, MMC_TIMING_MMC_HS);
|
||||
+ mmc_set_clock(host, card->ext_csd.hs_max_dtr);
|
||||
+
|
||||
err = mmc_switch_status(card, true);
|
||||
if (err)
|
||||
goto out_err;
|
||||
|
||||
- mmc_set_clock(host, card->ext_csd.hs_max_dtr);
|
||||
-
|
||||
/* Switch card to DDR with strobe bit */
|
||||
val = EXT_CSD_DDR_BUS_WIDTH_8 | EXT_CSD_BUS_WIDTH_STROBE;
|
||||
err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
|
|
@ -0,0 +1,11 @@
|
|||
--- a/sound/soc/codecs/es8316.c 2020-04-09 19:13:08.268473737 +0000
|
||||
+++ b/sound/soc/codecs/es8316.c 2020-04-09 19:14:00.535995842 +0000
|
||||
@@ -687,7 +687,7 @@
|
||||
snd_soc_component_update_bits(component, ES8316_GPIO_DEBOUNCE,
|
||||
ES8316_GPIO_ENABLE_INTERRUPT, 0);
|
||||
|
||||
- if (es8316->jack->status & SND_JACK_MICROPHONE) {
|
||||
+ if (es8316->jack && (es8316->jack->status & SND_JACK_MICROPHONE)) {
|
||||
es8316_disable_micbias_for_mic_gnd_short_detect(component);
|
||||
snd_soc_jack_report(es8316->jack, 0, SND_JACK_BTN_0);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
diff --git a/kernel/dma/pool.c b/kernel/dma/pool.c
|
||||
index 6bc74a2d5..e3827da51 100644
|
||||
--- a/kernel/dma/pool.c
|
||||
+++ b/kernel/dma/pool.c
|
||||
@@ -164,13 +164,11 @@ static int __init dma_atomic_pool_init(void)
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
- * If coherent_pool was not used on the command line, default the pool
|
||||
- * sizes to 128KB per 1GB of memory, min 128KB, max MAX_ORDER-1.
|
||||
+ * Always use 2MiB as default pool size.
|
||||
+ * See: https://forum.armbian.com/topic/4811-uas-mainline-kernel-coherent-pool-memory-size/
|
||||
*/
|
||||
if (!atomic_pool_size) {
|
||||
- unsigned long pages = totalram_pages() / (SZ_1G / SZ_128K);
|
||||
- pages = min_t(unsigned long, pages, MAX_ORDER_NR_PAGES);
|
||||
- atomic_pool_size = max_t(size_t, pages << PAGE_SHIFT, SZ_128K);
|
||||
+ atomic_pool_size = SZ_2M;
|
||||
}
|
||||
INIT_WORK(&atomic_pool_work, atomic_pool_work_fn);
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
diff --git a/sound/soc/codecs/rt5651.c b/sound/soc/codecs/rt5651.c
|
||||
index c506c9305..41a08b320 100644
|
||||
--- a/sound/soc/codecs/rt5651.c
|
||||
+++ b/sound/soc/codecs/rt5651.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <sound/initval.h>
|
||||
#include <sound/tlv.h>
|
||||
#include <sound/jack.h>
|
||||
+#include <linux/clk.h>
|
||||
|
||||
#include "rl6231.h"
|
||||
#include "rt5651.h"
|
||||
@@ -1511,6 +1512,7 @@ static int rt5651_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
|
||||
static int rt5651_set_bias_level(struct snd_soc_component *component,
|
||||
enum snd_soc_bias_level level)
|
||||
{
|
||||
+ struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
|
||||
switch (level) {
|
||||
case SND_SOC_BIAS_PREPARE:
|
||||
if (SND_SOC_BIAS_STANDBY == snd_soc_component_get_bias_level(component)) {
|
||||
@@ -1518,6 +1520,13 @@ static int rt5651_set_bias_level(struct snd_soc_component *component,
|
||||
snd_soc_component_update_bits(component, RT5651_D_MISC,
|
||||
0xc00, 0xc00);
|
||||
}
|
||||
+ if (!IS_ERR(rt5651->mclk)){
|
||||
+ if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
|
||||
+ clk_disable_unprepare(rt5651->mclk);
|
||||
+ } else {
|
||||
+ clk_prepare_enable(rt5651->mclk);
|
||||
+ }
|
||||
+ }
|
||||
break;
|
||||
case SND_SOC_BIAS_STANDBY:
|
||||
if (SND_SOC_BIAS_OFF == snd_soc_component_get_bias_level(component)) {
|
||||
@@ -2059,6 +2068,13 @@ static int rt5651_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct rt5651_priv *rt5651 = snd_soc_component_get_drvdata(component);
|
||||
|
||||
+ /* Check if MCLK provided */
|
||||
+ rt5651->mclk = devm_clk_get(component->dev, "mclk");
|
||||
+ if (PTR_ERR(rt5651->mclk) == -EPROBE_DEFER){
|
||||
+ dev_err(component->dev, "unable to get mclk\n");
|
||||
+ return -EPROBE_DEFER;
|
||||
+ }
|
||||
+
|
||||
rt5651->component = component;
|
||||
|
||||
snd_soc_component_update_bits(component, RT5651_PWR_ANLG1,
|
||||
diff --git a/sound/soc/codecs/rt5651.h b/sound/soc/codecs/rt5651.h
|
||||
index 20c33a3ec..17524fa9f 100644
|
||||
--- a/sound/soc/codecs/rt5651.h
|
||||
+++ b/sound/soc/codecs/rt5651.h
|
||||
@@ -2097,6 +2097,7 @@ struct rt5651_priv {
|
||||
|
||||
int dmic_en;
|
||||
bool hp_mute;
|
||||
+ struct clk *mclk;
|
||||
};
|
||||
|
||||
#endif /* __RT5651_H__ */
|
|
@ -0,0 +1,25 @@
|
|||
diff --git a/drivers/clk/rockchip/clk-rk3399.c b/drivers/clk/rockchip/clk-rk3399.c
|
||||
index ce1d2446f..38447441b 100644
|
||||
--- a/drivers/clk/rockchip/clk-rk3399.c
|
||||
+++ b/drivers/clk/rockchip/clk-rk3399.c
|
||||
@@ -620,7 +620,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
|
||||
GATE(SCLK_I2S2_8CH, "clk_i2s2", "clk_i2s2_mux", CLK_SET_RATE_PARENT,
|
||||
RK3399_CLKGATE_CON(8), 11, GFLAGS),
|
||||
|
||||
- MUX(0, "clk_i2sout_src", mux_i2sch_p, CLK_SET_RATE_PARENT,
|
||||
+ MUX(SCLK_I2SOUT_SRC, "clk_i2sout_src", mux_i2sch_p, CLK_SET_RATE_PARENT,
|
||||
RK3399_CLKSEL_CON(31), 0, 2, MFLAGS),
|
||||
COMPOSITE_NODIV(SCLK_I2S_8CH_OUT, "clk_i2sout", mux_i2sout_p, CLK_SET_RATE_PARENT,
|
||||
RK3399_CLKSEL_CON(31), 2, 1, MFLAGS,
|
||||
diff --git a/include/dt-bindings/clock/rk3399-cru.h b/include/dt-bindings/clock/rk3399-cru.h
|
||||
index 44e0a319f..b7b07dfda 100644
|
||||
--- a/include/dt-bindings/clock/rk3399-cru.h
|
||||
+++ b/include/dt-bindings/clock/rk3399-cru.h
|
||||
@@ -19,6 +19,7 @@
|
||||
#define ARMCLKB 9
|
||||
|
||||
/* sclk gates (special clocks) */
|
||||
+#define SCLK_I2SOUT_SRC 64
|
||||
#define SCLK_I2C1 65
|
||||
#define SCLK_I2C2 66
|
||||
#define SCLK_I2C3 67
|
|
@ -0,0 +1,20 @@
|
|||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index bcd31e9d6..91f1aa809 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -396,6 +396,7 @@ usbdrd_dwc3_0: usb@fe800000 {
|
||||
snps,dis_u2_susphy_quirk;
|
||||
snps,dis-del-phy-power-chg-quirk;
|
||||
snps,dis-tx-ipgap-linecheck-quirk;
|
||||
+ snps,xhci-trb-ent-quirk;
|
||||
power-domains = <&power RK3399_PD_USB3>;
|
||||
status = "disabled";
|
||||
};
|
||||
@@ -461,6 +462,7 @@ usbdrd_dwc3_1: usb@fe900000 {
|
||||
snps,dis_u2_susphy_quirk;
|
||||
snps,dis-del-phy-power-chg-quirk;
|
||||
snps,dis-tx-ipgap-linecheck-quirk;
|
||||
+ snps,xhci-trb-ent-quirk;
|
||||
power-domains = <&power RK3399_PD_USB3>;
|
||||
status = "disabled";
|
||||
};
|
|
@ -0,0 +1,28 @@
|
|||
From 9de42a7ce7b821596a151cfaa0aca79d53c2170f Mon Sep 17 00:00:00 2001
|
||||
From: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
Date: Sun, 7 Mar 2021 15:24:02 +0100
|
||||
Subject: [PATCH] oo
|
||||
|
||||
Signed-off-by: Aditya Prayoga <aditya@kobol.io>
|
||||
Changed by: Igor Pecovnik <igor.pecovnik@gmail.com>
|
||||
---
|
||||
drivers/pci/controller/pcie-rockchip.c | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c
|
||||
index 990a00e08..193d26562 100644
|
||||
--- a/drivers/pci/controller/pcie-rockchip.c
|
||||
+++ b/drivers/pci/controller/pcie-rockchip.c
|
||||
@@ -118,8 +118,7 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip)
|
||||
}
|
||||
|
||||
if (rockchip->is_rc) {
|
||||
- rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep",
|
||||
- GPIOD_OUT_HIGH);
|
||||
+ rockchip->ep_gpio = devm_gpiod_get_optional(dev, "ep", GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(rockchip->ep_gpio))
|
||||
return dev_err_probe(dev, PTR_ERR(rockchip->ep_gpio),
|
||||
"failed to get ep GPIO\n");
|
||||
--
|
||||
Created with Armbian build tools https://github.com/armbian/build
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
index 6eb9dda..d6fc676 100644
|
||||
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
|
||||
@@ -2285,35 +2285,35 @@
|
||||
sdmmc {
|
||||
sdmmc_bus1: sdmmc-bus1 {
|
||||
rockchip,pins =
|
||||
- <4 RK_PB0 1 &pcfg_pull_up>;
|
||||
+ <4 RK_PB0 1 &pcfg_pull_up_8ma>;
|
||||
};
|
||||
|
||||
sdmmc_bus4: sdmmc-bus4 {
|
||||
rockchip,pins =
|
||||
- <4 RK_PB0 1 &pcfg_pull_up>,
|
||||
- <4 RK_PB1 1 &pcfg_pull_up>,
|
||||
- <4 RK_PB2 1 &pcfg_pull_up>,
|
||||
- <4 RK_PB3 1 &pcfg_pull_up>;
|
||||
+ <4 RK_PB0 1 &pcfg_pull_up_8ma>,
|
||||
+ <4 RK_PB1 1 &pcfg_pull_up_8ma>,
|
||||
+ <4 RK_PB2 1 &pcfg_pull_up_8ma>,
|
||||
+ <4 RK_PB3 1 &pcfg_pull_up_8ma>;
|
||||
};
|
||||
|
||||
sdmmc_clk: sdmmc-clk {
|
||||
rockchip,pins =
|
||||
- <4 RK_PB4 1 &pcfg_pull_none>;
|
||||
+ <4 RK_PB4 1 &pcfg_pull_none_12ma>;
|
||||
};
|
||||
|
||||
sdmmc_cmd: sdmmc-cmd {
|
||||
rockchip,pins =
|
||||
- <4 RK_PB5 1 &pcfg_pull_up>;
|
||||
+ <4 RK_PB5 1 &pcfg_pull_up_8ma>;
|
||||
};
|
||||
|
||||
sdmmc_cd: sdmmc-cd {
|
||||
rockchip,pins =
|
||||
- <0 RK_PA7 1 &pcfg_pull_up>;
|
||||
+ <0 RK_PA7 1 &pcfg_pull_up>;
|
||||
};
|
||||
|
||||
sdmmc_wp: sdmmc-wp {
|
||||
rockchip,pins =
|
||||
- <0 RK_PB0 1 &pcfg_pull_up>;
|
||||
+ <0 RK_PB0 1 &pcfg_pull_up_8ma>;
|
||||
};
|
||||
};
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue