Added PCBA build

This commit is contained in:
Michel-FK 2020-07-27 21:09:31 +02:00
parent e391eeaeed
commit 3dd8a49f7f
39 changed files with 3006 additions and 2 deletions

0
PCBA/Config.in Normal file
View File

View File

@ -0,0 +1,3 @@
setenv bootargs console=ttyS0,115200
setenv fdt_high 0xffffffff
bootm 0x41000000 0x41b00000 0x41800000

File diff suppressed because it is too large Load Diff

View File

View File

@ -0,0 +1,180 @@
CONFIG_LOCALVERSION="-funkey"
CONFIG_KERNEL_LZO=y
CONFIG_DEFAULT_HOSTNAME="funkey"
CONFIG_NO_HZ=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_LOG_BUF_SHIFT=16
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
CONFIG_CGROUPS=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="${BR_BINARIES_DIR}/rootfs.cpio"
# CONFIG_RD_GZIP is not set
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_EMBEDDED=y
CONFIG_PERF_EVENTS=y
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_PARTITION_ADVANCED=y
# CONFIG_EFI_PARTITION is not set
CONFIG_ARCH_SUNXI=y
# CONFIG_MACH_SUN4I is not set
# CONFIG_MACH_SUN5I is not set
# CONFIG_MACH_SUN6I is not set
# CONFIG_MACH_SUN7I is not set
# CONFIG_MACH_SUN9I is not set
CONFIG_SMP=y
CONFIG_HAVE_ARM_ARCH_TIMER=y
CONFIG_HOTPLUG_CPU=y
CONFIG_ARM_PSCI=y
CONFIG_HIGHMEM=y
CONFIG_CPU_FREQ=y
CONFIG_CPUFREQ_DT=y
CONFIG_VFP=y
CONFIG_NEON=y
# CONFIG_COREDUMP is not set
# CONFIG_SUSPEND is not set
CONFIG_PM=y
CONFIG_PM_DEBUG=y
CONFIG_PM_ADVANCED_DEBUG=y
CONFIG_NET=y
CONFIG_PACKET=y
CONFIG_UNIX=y
CONFIG_INET=y
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_DIAG is not set
CONFIG_DNS_RESOLVER=y
# CONFIG_WIRELESS is not set
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# CONFIG_ALLOW_DEV_COREDUMP is not set
# CONFIG_SUNXI_RSB is not set
CONFIG_BLK_DEV_LOOP=y
CONFIG_BLK_DEV_LOOP_MIN_COUNT=1
CONFIG_SCSI=y
CONFIG_BLK_DEV_SD=y
CONFIG_NETDEVICES=y
# CONFIG_ETHERNET is not set
# CONFIG_WLAN is not set
CONFIG_INPUT_POLLDEV=y
CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_KEYBOARD is not set
# CONFIG_INPUT_MOUSE is not set
CONFIG_INPUT_MISC=y
CONFIG_INPUT_UINPUT=y
CONFIG_LEGACY_PTY_COUNT=4
CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_NR_UARTS=8
CONFIG_SERIAL_8250_RUNTIME_UARTS=8
CONFIG_SERIAL_8250_DW=y
CONFIG_SERIAL_OF_PLATFORM=y
# CONFIG_HW_RANDOM is not set
CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MV64XXX=y
CONFIG_SPI=y
CONFIG_SPI_SUN6I=y
CONFIG_GPIO_SYSFS=y
CONFIG_GPIO_AXP209=y
CONFIG_POWER_SUPPLY=y
CONFIG_CHARGER_AXP20X=y
CONFIG_BATTERY_AXP20X=y
CONFIG_AXP20X_POWER=y
# CONFIG_HWMON is not set
CONFIG_THERMAL=y
CONFIG_CPU_THERMAL=y
CONFIG_WATCHDOG=y
CONFIG_SUNXI_WATCHDOG=y
CONFIG_MFD_AXP20X_I2C=y
CONFIG_MFD_SYSCON=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_REGULATOR_AXP20X=y
# CONFIG_RC_CORE is not set
CONFIG_FB=y
CONFIG_FB_SIMPLE=y
CONFIG_FB_SSD1307=y
CONFIG_BACKLIGHT_PWM=y
CONFIG_FRAMEBUFFER_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
CONFIG_LOGO=y
CONFIG_SOUND=y
CONFIG_SND=y
# CONFIG_SND_DRIVERS is not set
# CONFIG_SND_SPI is not set
# CONFIG_SND_USB is not set
CONFIG_SND_SOC=y
CONFIG_SND_SUN4I_CODEC=y
CONFIG_SND_SUN8I_CODEC_ANALOG=y
# CONFIG_HID is not set
# CONFIG_USB_HID is not set
CONFIG_USB=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_HCD_PLATFORM=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_OHCI_HCD_PLATFORM=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_MUSB_SUNXI=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_USB_GADGET=y
CONFIG_USB_ZERO=m
CONFIG_USB_ETH=m
CONFIG_USB_ETH_EEM=y
CONFIG_USB_G_NCM=m
CONFIG_USB_MASS_STORAGE=m
CONFIG_USB_G_SERIAL=m
CONFIG_USB_G_ACM_MS=m
CONFIG_MMC=y
# CONFIG_PWRSEQ_EMMC is not set
CONFIG_MMC_SUNXI=y
CONFIG_RTC_CLASS=y
# CONFIG_RTC_INTF_SYSFS is not set
# CONFIG_RTC_INTF_PROC is not set
CONFIG_DMADEVICES=y
CONFIG_DMA_SUN6I=y
CONFIG_SYNC_FILE=y
CONFIG_STAGING=y
CONFIG_FB_TFT=y
CONFIG_FB_TFT_ST7789V=y
CONFIG_FB_FLEX=y
# CONFIG_SUN8I_A23_CCU is not set
# CONFIG_SUN8I_A33_CCU is not set
# CONFIG_SUN8I_H3_CCU is not set
CONFIG_SUN8I_DE2_CCU=y
# CONFIG_IOMMU_SUPPORT is not set
CONFIG_IIO=y
CONFIG_AXP20X_ADC=y
CONFIG_PWM_SUN4I=y
CONFIG_PHY_SUN4I_USB=y
CONFIG_NVMEM_SUNXI_SID=y
CONFIG_EXT4_FS=y
# CONFIG_EXT4_USE_FOR_EXT2 is not set
CONFIG_FANOTIFY=y
CONFIG_AUTOFS4_FS=y
CONFIG_VFAT_FS=y
CONFIG_TMPFS=y
CONFIG_CONFIGFS_FS=y
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set
CONFIG_NLS_CODEPAGE_437=y
CONFIG_NLS_ISO8859_1=y
CONFIG_PRINTK_TIME=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_DEBUG_BUGVERBOSE is not set
# CONFIG_RCU_TRACE is not set
# CONFIG_FTRACE is not set
# CONFIG_ARM_UNWIND is not set
CONFIG_KEYS=y
CONFIG_CRYPTO_CCM=y
CONFIG_CRYPTO_GCM=y
CONFIG_CRYPTO_CMAC=y
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_DEV_SUN4I_SS=y
CONFIG_XZ_DEC=y

View File

@ -0,0 +1,4 @@
RETROFE_OVERRIDE_SRCDIR = ../funkey_retrofe
RETROFE_LAYOUT_OVERRIDE_SRCDIR = ../funkey_retrofe_layout_240x240
SDL_OVERRIDE_SRCDIR = ../funkey_sdl1.2
FUNKEY_GPIO_MAPPING_OVERRIDE_SRCDIR = ../funkey-gpio-mapping

View File

@ -0,0 +1,195 @@
--- /dev/null 2019-05-04 09:53:55.553276856 +0200
+++ a/arch/arm/boot/dts/sun8i-v3s-funkey.dts 2019-05-04 20:06:53.118696800 +0200
@@ -0,0 +1,192 @@
+/*
+ * Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-v3s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+/ {
+ model = "FunKey";
+ compatible = "funkey", "allwinner,sun8i-v3s";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ backlight: backlight {
+ compatible = "pwm-backlight";
+ pwms = <&pwm 0 100000 1>;
+ brightness-levels = <0 1 2 3 8 14 21 32 46 60 80 100>; //2.2 div factor
+ default-brightness-level = <11>;
+ power-supply = <&reg_vcc5v0>;
+ };
+};
+
+&codec {
+ allwinner,audio-routing =
+ "Headphone", "HP",
+ "Headphone", "HPCOM",
+ "MIC1", "Mic",
+ "Mic", "HBIAS";
+ status = "okay";
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&i2c0 {
+ status = "okay";
+
+ /* axp209: pmic@34 {
+ compatible = "x-powers,axp209";
+ reg = <0x34>;
+ interrupts = <0>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ }; */
+};
+
+&mmc0 {
+ pinctrl-0 = <&mmc0_pins_a>;
+ pinctrl-names = "default";
+ broken-cd;
+ bus-width = <4>;
+ vmmc-supply = <&reg_vcc3v3>;
+ vqmmc-supply = <&reg_vcc3v3>;
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
+/*
+#include "axp209.dtsi"
+
+&reg_dcdc2 {
+ regulator-always-on;
+ regulator-min-microvolt = <1000000>;
+ regulator-max-microvolt = <1400000>;
+ regulator-name = "vdd-cpu-sys-ephy";
+};
+
+&reg_dcdc3 {
+ regulator-always-on;
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3450000>;
+ regulator-name = "vcc-io-ephy-mcsi-usb";
+};
+
+&reg_ldo1 {
+ regulator-min-microvolt = <3000000>;
+ regulator-max-microvolt = <3600000>;
+ regulator-name = "vcc-rtc";
+};
+
+&reg_ldo2 {
+ regulator-always-on;
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <3300000>;
+ regulator-name = "avcc-pll";
+};
+*/
+
+&reg_vcc3v0 {
+ regulator-always-on;
+ status = "okay";
+};
+
+&reg_vcc3v3 {
+ regulator-always-on;
+ status = "okay";
+};
+
+&reg_vcc5v0 {
+ regulator-always-on;
+ status = "okay";
+};
+
+&spi0 {
+ status = "okay";
+
+ st7789v@0 {
+ compatible = "sitronix,st7789v";
+ reg = <0>;
+ spi-max-frequency = <50000000>;
+ txbuflen = <115200>;
+ rotate = <0>;
+ fps = <50>;
+ buswidth = <8>;
+ reset-gpios = <&pio 1 2 GPIO_ACTIVE_HIGH>; //PB2
+ dc-gpios = <&pio 2 0 GPIO_ACTIVE_LOW>; //PC0 (MISO)
+ debug = <0>;
+ };
+};
+
+&uart0 {
+ pinctrl-0 = <&uart0_pins_a>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&pwm {
+ pinctrl-names = "default";
+ pinctrl-0 = <&pwm0_pins>;
+ status = "okay";
+};
+
+&usb_otg {
+ dr_mode = "peripheral";
+ status = "okay";
+};
+
+&usbphy {
+ usb0_vbus-supply = <&reg_vcc5v0>;
+ phy-supply = <&reg_vcc5v0>;
+ vcc = <&reg_vcc5v0>;
+ status = "okay";
+};

View File

@ -0,0 +1,12 @@
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 1f97ae8..e798bf1 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -932,6 +932,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
sun8i-h3-orangepi-plus2e.dtb \
sun8i-r16-bananapi-m2m.dtb \
sun8i-r16-parrot.dtb \
+ sun8i-v3s-funkey.dtb \
sun8i-v3s-licheepi-zero.dtb \
sun8i-v3s-licheepi-zero-dock.dtb \
sun8i-v3s-licheepi-zero-with-480x272-lcd.dtb \

View File

@ -0,0 +1,39 @@
diff --git a/arch/arm/boot/dts/sun8i-v3s-funkey.dts b/arch/arm/boot/dts/sun8i-v3s-funkey.dts
index ad694808..3be3c7f1 100644
--- a/arch/arm/boot/dts/sun8i-v3s-funkey.dts
+++ b/arch/arm/boot/dts/sun8i-v3s-funkey.dts
@@ -74,6 +74,10 @@
status = "okay";
};
+&codec_analog {
+ status = "okay";
+};
+
&ehci0 {
status = "okay";
};
diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi
index 5379f2d7..02f6c844 100644
--- a/arch/arm/boot/dts/sun8i-v3s.dtsi
+++ b/arch/arm/boot/dts/sun8i-v3s.dtsi
@@ -433,6 +444,7 @@
codec_analog: codec-analog@01c23000 {
compatible = "allwinner,sun8i-v3s-codec-analog";
reg = <0x01c23000 0x4>;
+ status = "disabled";
};
uart0: serial@01c28000 {
diff --git a/sound/soc/sunxi/Makefile b/sound/soc/sunxi/Makefile
index 4a9ef673..655780ab 100644
--- a/sound/soc/sunxi/Makefile
+++ b/sound/soc/sunxi/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
+obj-$(CONFIG_SND_SUN8I_CODEC_ANALOG) += sun8i-codec-analog.o
obj-$(CONFIG_SND_SUN4I_CODEC) += sun4i-codec.o
obj-$(CONFIG_SND_SUN4I_I2S) += sun4i-i2s.o
obj-$(CONFIG_SND_SUN4I_SPDIF) += sun4i-spdif.o
-obj-$(CONFIG_SND_SUN8I_CODEC_ANALOG) += sun8i-codec-analog.o
obj-$(CONFIG_SND_SUN8I_CODEC) += sun8i-codec.o

View File

@ -0,0 +1,207 @@
/*
* Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
*
* This file is dual-licensed: you can use it either under the terms
* of the GPL or the X11 license, at your option. Note that this dual
* licensing only applies to this file, and not this project as a
* whole.
*
* a) This file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This file is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Or, alternatively,
*
* b) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
/dts-v1/;
#include "sun8i-v3s.dtsi"
#include "sunxi-common-regulators.dtsi"
/ {
model = "FunKey";
compatible = "funkey", "allwinner,sun8i-v3s";
aliases {
serial0 = &uart0;
};
chosen {
stdout-path = "serial0:115200n8";
};
backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm 0 1000000 0>;
brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
default-brightness-level = <10>;
power-supply = <&reg_vcc5v0>;
};
};
&codec {
allwinner,audio-routing =
"Headphone", "HP",
"Headphone", "HPCOM",
"MIC1", "Mic",
"Mic", "HBIAS";
status = "okay";
};
&ehci0 {
status = "okay";
};
&i2c0 {
status = "okay";
axp209: pmic@34 {
compatible = "x-powers,axp209";
reg = <0x34>;
interrupt-parent = <&pio>;
interrupts = <1 5 IRQ_TYPE_EDGE_FALLING>;
interrupt-controller;
#interrupt-cells = <1>;
};
};
&mmc0 {
pinctrl-0 = <&mmc0_pins_a>;
pinctrl-names = "default";
broken-cd;
bus-width = <4>;
vmmc-supply = <&reg_vcc3v3>;
vqmmc-supply = <&reg_vcc3v3>;
status = "okay";
};
&ohci0 {
status = "okay";
};
#include "axp209.dtsi"
&ac_power_supply {
status = "okay";
};
&axp_gpio {
status = "okay";
};
&battery_power_supply {
status = "okay";
};
&usb_power_supply {
status = "okay";
};
&reg_dcdc2 {
regulator-always-on;
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1400000>;
regulator-name = "vdd-cpu-sys-ephy";
};
&reg_dcdc3 {
regulator-always-on;
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3450000>;
regulator-name = "vcc-io-ephy-mcsi-usb";
};
&reg_ldo1 {
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3600000>;
regulator-name = "vcc-rtc";
};
&reg_ldo2 {
regulator-always-on;
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <3300000>;
regulator-name = "avcc-pll";
};
&reg_vcc3v0 {
regulator-always-on;
status = "okay";
};
&reg_vcc3v3 {
regulator-always-on;
status = "okay";
};
&reg_vcc5v0 {
regulator-always-on;
status = "okay";
};
&spi0 {
status = "okay";
st7789v@0 {
compatible = "sitronix,st7789v";
reg = <0>;
spi-max-frequency = <40000000>;
txbuflen = <115200>;
rotate = <0>;
fps = <39>;
buswidth = <8>;
reset-gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; //PE1
dc-gpios = <&pio 2 0 GPIO_ACTIVE_LOW>; //PC0 (MISO)
debug = <0>;
};
};
&uart0 {
pinctrl-0 = <&uart0_pins_a>;
pinctrl-names = "default";
status = "okay";
};
&pwm {
pinctrl-names = "default";
pinctrl-0 = <&pwm0_pins>;
status = "okay";
};
&usb_otg {
dr_mode = "peripheral";
status = "okay";
};
&usbphy {
usb0_vbus-supply = <&reg_vcc5v0>;
phy-supply = <&reg_vcc5v0>;
vcc = <&reg_vcc5v0>;
status = "okay";
};

View File

@ -0,0 +1,86 @@
--- /dev/null 2019-03-22 21:33:35.539154398 +0100
+++ a/arch/arm/dts/sun8i-v3s-funkey.dts 2019-03-22 22:22:37.417295027 +0100
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2019 Michel Stempin <michel.stempin@wanadoo.fr>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ * a) This file is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * Or, alternatively,
+ *
+ * b) Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+#include "sun8i-v3s.dtsi"
+#include "sunxi-common-regulators.dtsi"
+
+/ {
+ model = "FunKey";
+ compatible = "funkey", "allwinner,sun8i-v3s";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+};
+
+&mmc0 {
+ pinctrl-0 = <&mmc0_pins_a>;
+ pinctrl-names = "default";
+ broken-cd;
+ bus-width = <4>;
+ vmmc-supply = <&reg_vcc3v3>;
+ status = "okay";
+};
+
+&uart0 {
+ pinctrl-0 = <&uart0_pins_a>;
+ pinctrl-names = "default";
+ status = "okay";
+};
+
+&usb_otg {
+ dr_mode = "otg";
+ status = "okay";
+};
+
+&usbphy {
+ usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+};

View File

@ -0,0 +1,47 @@
--- a/board/sunxi/board.c 2017-08-12 11:24:24.000000000 +0200
+++ b/board/sunxi/board.c 2019-04-27 23:04:05.811352883 +0200
@@ -540,9 +540,9 @@
power_failed |= axp_set_sw(IS_ENABLED(CONFIG_AXP_SW_ON));
#endif
#endif
- printf("DRAM:");
+ //printf("DRAM:");
ramsize = sunxi_dram_init();
- printf(" %d MiB\n", (int)(ramsize >> 20));
+ //printf(" %d MiB\n", (int)(ramsize >> 20));
if (!ramsize)
hang();
--- a/common/console.c 2017-08-12 11:24:24.000000000 +0200
+++ b/common/console.c 2019-04-27 22:30:13.944154949 +0200
@@ -695,7 +695,7 @@
if (getenv("silent") != NULL)
gd->flags |= GD_FLG_SILENT;
else
- gd->flags &= ~GD_FLG_SILENT;
+ gd->flags |= GD_FLG_SILENT;
#endif
}
--- a/common/spl/spl.c 2017-08-12 11:24:24.000000000 +0200
+++ b/common/spl/spl.c 2019-04-27 23:06:27.269590207 +0200
@@ -316,7 +316,7 @@
loader = spl_ll_find_loader(spl_boot_list[i]);
#if defined(CONFIG_SPL_SERIAL_SUPPORT) && defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
if (loader)
- printf("Trying to boot from %s", loader->name);
+ ;//printf("Trying to boot from %s", loader->name);
else
puts("SPL: Unsupported Boot Device!\n");
#endif
@@ -407,8 +407,9 @@
gd->have_console = 1;
- puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
+ /*puts("\nU-Boot SPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
U_BOOT_TIME ")\n");
+ */
#ifdef CONFIG_SPL_DISPLAY_PRINT
spl_display_print();
#endif

View File

@ -0,0 +1,12 @@
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 469dd71..e91a8d3 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -281,6 +281,7 @@ dtb-$(CONFIG_MACH_SUN8I_H3) += \
sun8i-h3-orangepi-plus2e.dtb \
sun8i-h3-nanopi-neo.dtb
dtb-$(CONFIG_MACH_SUN8I_V3S) += \
+ sun8i-v3s-funkey.dtb \
sun8i-v3s-licheepi-zero.dtb
dtb-$(CONFIG_MACH_SUN50I) += \
sun50i-a64-pine64-plus.dtb \

View File

@ -0,0 +1,31 @@
--- a/include/configs/sunxi-common.h 2017-08-12 11:24:24.000000000 +0200
+++ b/include/configs/sunxi-common.h 2019-05-02 23:02:22.078624435 +0200
@@ -475,14 +475,26 @@
#define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
"fel "
+#if CONFIG_IS_ENABLED(CMD_PXE)
+# define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
+#else
+# define BOOT_TARGET_PXE(func)
+#endif
+
+#if CONFIG_IS_ENABLED(CMD_DHCP)
+# define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na)
+#else
+# define BOOT_TARGET_DHCP(func)
+#endif
+
#define BOOT_TARGET_DEVICES(func) \
func(FEL, fel, na) \
BOOT_TARGET_DEVICES_MMC(func) \
BOOT_TARGET_DEVICES_MMC_EXTRA(func) \
BOOT_TARGET_DEVICES_SCSI(func) \
BOOT_TARGET_DEVICES_USB(func) \
- func(PXE, pxe, na) \
- func(DHCP, dhcp, na)
+ BOOT_TARGET_PXE(func) \
+ BOOT_TARGET_DHCP(func)
#ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT
#define BOOTCMD_SUNXI_COMPAT \

View File

@ -0,0 +1,18 @@
--- a/board/sunxi/board.c 2019-05-02 23:50:23.708139670 +0200
+++ b/board/sunxi/board.c 2019-05-02 23:51:19.105112063 +0200
@@ -652,6 +652,7 @@
if ((sid[3] & 0xffffff) == 0)
sid[3] |= 0x800000;
+#if defined(CONFIG_CMD_NET)
for (i = 0; i < 4; i++) {
sprintf(ethaddr, "ethernet%d", i);
if (!fdt_get_alias(fdt, ethaddr))
@@ -675,6 +676,7 @@
eth_setenv_enetaddr(ethaddr, mac_addr);
}
+#endif
if (!getenv("serial#")) {
snprintf(serial_string, sizeof(serial_string),

12
PCBA/board/funkey/post-build.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh
# Add swap partition to fstab
sed -i '/^\/swap/d' "${TARGET_DIR}/etc/fstab"
echo "/swap none swap defaults 0 0" >> "${TARGET_DIR}/etc/fstab"
# Add local path to init scripts
sed -i '3iexport PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin' ${TARGET_DIR}/etc/init.d/rcK
sed -i '3iexport PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin' ${TARGET_DIR}/etc/init.d/rcS
# Remove log daemon init scripts since they are loaded from inittab
rm -f ${TARGET_DIR}/etc/init.d/S01syslogd ${TARGET_DIR}/etc/init.d/S02klogd

View File

@ -0,0 +1,76 @@
# FunKey
Intro
=====
This directory contains a buildroot-based external configuration for
building the FunKey.
How to get it
===============
Clone the FunKey OS repository and the required submodules from
BitBucket:
$ git clone --recurse-submodules git@bitbucket.org:keymu2/funkey-os.git <Funkey directory>
Then enter into the created directory:
$ cd <Funkey directory>
How to build it
===============
Configure Buildroot
-------------------
There is only one Funkey defconfig files in Buildroot:
$ ./fun funkey_defconfig
Build the rootfs
----------------
Note: you will need to have access to the network, since Buildroot
will download the packages' sources.
You may now build your FunKey with:
$ ./have fun
(This may take a while, consider getting yourself a coffee ;-) )
Result of the build
-------------------
After building, you should obtain this tree:
FunKey/output/images/
+-- boot.scr
+-- boot.vfat
+-- rootfs.ext2
+-- rootfs.ext4 -> rootfs.ext2
+-- sdcard.img
+-- sun8i-v3s-funkey.dtb
+-- u-boot.bin
+-- u-boot-sunxi-with-spl.bin
`-- uImage
How to write the SD card
========================
Once the build process is finished you will have an image called
"sdcard.img" in the FunKey/output/images/ directory.
Copy the bootable "sdcard.img" onto an SD card with "dd":
$ sudo dd if=<Funkey directory>/FunKey/output/images/sdcard.img of=/dev/sdX
Alternatively, you can use the Etcher graphical tool to burn the image
to the SD card safely and on any platform:
https://etcher.io/
Once the SD card is burned, insert it into your FunKey board, and
power it up. Your new system should come up now and start a console on
the UART0 serial port.

View File

@ -0,0 +1,9 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
configfs /sys/kernel/config configfs rw,relatime 0 0

View File

@ -0,0 +1,21 @@
#!/bin/sh
THIS=$(basename $0)
case "$1" in
start)
if /etc/rc.local; then
echo "Starting rc.local: OK"
exit 0
else
echo "Starting rc.local: ERROR"
exit 1
fi
;;
stop)
;;
*)
echo "Usage: $0 {start|stop}" >&2
exit 2
;;
esac

View File

@ -0,0 +1,47 @@
#!/bin/sh
# Assure that the kernel has module support.
[ -e /proc/ksyms -o -e /proc/modules ] || exit 0
THIS=$(basename $0)
case "${1}" in
start)
# Exit if there's no modules file or there are no
# valid entries
if [ -r /etc/sysconfig/modules ]; then
egrep -qv '^($|#)' /etc/sysconfig/modules
if [ $? -ne 0 ]; then
exit 0
fi
fi
# Only try to load modules if the user has actually given us
# some modules to load.
while read MODULE ARGS; do
# Ignore comments and blank lines.
case "$MODULE" in
""|"#"*) continue ;;
esac
# Attempt to load the module, making
# sure to pass any arguments provided.
modprobe ${MODULE} ${ARGS} >/dev/null
# Print the module name if successful,
# otherwise take note.
if [ $? -eq 0 ]; then
echo "Loading module ${MODULE}: OK"
else
echo "Loading module ${MODULE}: ERROR"
fi
done < /etc/sysconfig/modules
;;
stop)
;;
*)
echo "Usage: ${0} {start|stop}"
exit 1
;;
esac

View File

@ -0,0 +1,209 @@
#!/bin/sh
#
# alsa-utils initscript
#
### BEGIN INIT INFO
# Provides: alsa-utils
# Required-Start: $local_fs $remote_fs
# Required-Stop: $remote_fs
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: Restore and store ALSA driver settings
# Description: This script stores and restores mixer levels on
# shutdown and bootup.On sysv-rc systems: to
# disable storing of mixer levels on shutdown,
# remove /etc/rc[06].d/K50alsa-utils. To disable
# restoring of mixer levels on bootup, rename the
# "S50alsa-utils" symbolic link in /etc/rcS.d/ to
# "K50alsa-utils".
### END INIT INFO
# Don't use set -e; check exit status instead
# Exit silently if package is no longer installed
[ -x /usr/sbin/alsactl ] || exit 0
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MYNAME=/etc/init.d/alsa-utils
ALSACTLHOME=/run/alsa
[ -d "$ALSACTLHOME" ] || mkdir -p "$ALSACTLHOME"
. /lib/lsb/init-functions
. /usr/share/alsa/utils.sh
# $1 EXITSTATUS
# [$2 MESSAGE]
log_action_end_msg_and_exit()
{
log_action_end_msg "$1" ${2:+"$2"}
exit $1
}
# $1 PROGRAM
executable()
{
# If which is not available then we must be running before
# /usr is mounted on a system that has which in /usr/bin/.
# Conclude that $1 is not executable.
[ -x /bin/which ] || [ -x /usr/bin/which ] || return 1
which "$1" >/dev/null 2>&1
}
executable amixer || { echo "${MYNAME}: Error: No amixer program available." >&2 ; exit 1 ; }
# $1 <card ID> | "all"
restore_levels()
{
[ -f /var/lib/alsa/asound.state ] || return 1
CARD="$1"
[ "$1" = all ] && CARD=""
# Assume that if alsactl prints a message on stderr
# then it failed somehow. This works around the fact
# that alsactl doesn't return nonzero status when it
# can't restore settings for the card
if MSG="$(alsactl -E HOME="$ALSACTLHOME" restore $CARD 2>&1 >/dev/null)" && [ ! "$MSG" ] ; then
return 0
else
# Retry with the "force" option. This restores more levels
# but it results in much longer error messages.
alsactl -F restore $CARD >/dev/null 2>&1
log_action_cont_msg "warning: 'alsactl -E HOME="$ALSACTLHOME" restore${CARD:+ $CARD}' failed with error message '$MSG'"
return 1
fi
}
# $1 <card ID> | "all"
store_levels()
{
CARD="$1"
[ "$1" = all ] && CARD=""
if MSG="$(alsactl -E HOME="$ALSACTLHOME" store $CARD 2>&1)" ; then
sleep 1
return 0
else
log_action_cont_msg "warning: 'alsactl store${CARD:+ $CARD}' failed with error message '$MSG'"
return 1
fi
}
# $1 <card ID>
mute_and_zero_levels_on_card()
{
CARDOPT="-c $1"
for CTL in \
Master \
PCM \
Synth \
CD \
Line \
Mic \
"PCM,1" \
Wave \
Music \
AC97 \
"Master Digital" \
DAC \
"DAC,0" \
"DAC,1" \
Headphone \
Speaker \
Playback
do
mute_and_zero_level "$CTL"
done
# for CTL in \
# "Audigy Analog/Digital Output Jack" \
# "SB Live Analog/Digital Output Jack"
# do
# switch_control "$CTL" off
# done
return 0
}
# $1 <card ID> | "all"
mute_and_zero_levels()
{
TTZML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
mute_and_zero_levels_on_card "$CARD" || TTZML_RETURNSTATUS=1
done
;;
*)
mute_and_zero_levels_on_card "$1" || TTZML_RETURNSTATUS=1
;;
esac
return $TTZML_RETURNSTATUS
}
# $1 <card ID> | "all"
card_OK()
{
[ "$1" ] || bugout
if [ "$1" = all ] ; then
[ -d /proc/asound ]
return $?
else
[ -d "/proc/asound/card$1" ] || [ -d "/proc/asound/$1" ]
return $?
fi
}
# If a card identifier is provided in $2 then regard it as an error
# if that card is not present; otherwise don't regard it as an error.
case "$1" in
start)
EXITSTATUS=0
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Starting ALSA" ;;
*) log_action_begin_msg "Starting ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
preinit_levels "$TARGET_CARD" || EXITSTATUS=1
if ! restore_levels "$TARGET_CARD" ; then
sanify_levels "$TARGET_CARD" || EXITSTATUS=1
restore_levels "$TARGET_CARD" >/dev/null 2>&1 || :
fi
log_action_end_msg_and_exit "$EXITSTATUS"
;;
stop)
EXITSTATUS=0
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Stopping ALSA" ;;
*) log_action_begin_msg "Stopping ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
store_levels "$TARGET_CARD" || EXITSTATUS=1
#mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
log_action_end_msg_and_exit "$EXITSTATUS"
;;
restart|force-reload)
EXITSTATUS=0
$0 stop || EXITSTATUS=1
$0 start || EXITSTATUS=1
exit $EXITSTATUS
;;
reset)
TARGET_CARD="$2"
case "$TARGET_CARD" in
""|all) TARGET_CARD=all ; log_action_begin_msg "Resetting ALSA" ;;
*) log_action_begin_msg "Resetting ALSA card ${TARGET_CARD}" ;;
esac
card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
preinit_levels "$TARGET_CARD"
sanify_levels "$TARGET_CARD"
log_action_end_msg_and_exit "$?"
;;
*)
echo "Usage: $MYNAME {start [CARD]|stop [CARD]|restart [CARD]|reset [CARD]}" >&2
exit 3
;;
esac

View File

@ -0,0 +1,40 @@
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels. The runlevels field is
# completely ignored by BusyBox init. If you want runlevels, use
# sysvinit.
#
# Format for each entry: <id>:<runlevels>:<action>:<process>
#
# id == tty to run on, or empty for /dev/console
# runlevels == ignored
# action == one of sysinit, respawn, askfirst, wait, and once
# process == program to run
# Startup the system
::sysinit:/bin/cat /etc/issue
::sysinit:/bin/mount -t proc proc /proc
::sysinit:/bin/mount -o remount,rw /
::sysinit:/bin/mkdir -p /dev/pts /dev/shm
::sysinit:/bin/mount -a
null::sysinit:/bin/ln -sf /proc/self/fd /dev/fd
null::sysinit:/bin/ln -sf /proc/self/fd/0 /dev/stdin
null::sysinit:/bin/ln -sf /proc/self/fd/1 /dev/stdout
null::sysinit:/bin/ln -sf /proc/self/fd/2 /dev/stderr
::sysinit:/bin/hostname -F /etc/hostname
# now run any rc scripts
::sysinit:/etc/init.d/rcS
# Start an automatic root login on the console
::respawn:-/bin/login -f root
# Stuff to do for the 3-finger salute
#::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r

View File

@ -0,0 +1,10 @@
_______ __ __
| ___|.--.--.-----.| |/ |.-----.--.--.
| ___|| | | || < | -__| | |
|___| |_____|__|__||__|\__||_____|___ |
FUN ON A KEYCHAIN |_____|
-----------------------------------------------------
Version 0.5 PCBA
-----------------------------------------------------

View File

@ -0,0 +1,20 @@
export PATH="/usr/local/games:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
if [ "$PS1" ]; then
if [ "`id -u`" -eq 0 ]; then
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\# '
else
export PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
fi
fi
export PAGER='/bin/more'
export EDITOR='/usr/bin/nano'
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i

View File

@ -0,0 +1,14 @@
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
exit 0

View File

@ -0,0 +1,34 @@
#!/bin/sh
#set -xv
if [ x"$THIS" != x ]; then
THIS="${THIS}: "
fi
log_action_msg () {
echo "${THIS}${@}." | tee /dev/kmsg
}
log_action_begin_msg () {
echo -n "${THIS}${@}: " | tee /dev/kmsg
}
log_action_cont_msg () {
echo "${THIS}${@}..." | tee /dev/kmsg
}
log_action_end_msg () {
local end
if [ -z "${2:-}" ]; then
end=""
else
end=" ($2)"
fi
if [ $1 -eq 0 ]; then
echo "${THIS}OK${end}" | tee /dev/kmsg
else
echo "${THIS}ERROR${end}" | tee /dev/kmsg
fi
}

View File

@ -0,0 +1,20 @@
#!/bin/sh
# Define log functions if they do not exist yet
type -t info >/dev/null 2>&1
if [ $? -ne 0 ]; then
info () {
echo "$SELF:" "$@" | tee /dev/kmsg
}
warn () {
echo "$SELF:" "$@" >&2 | tee /dev/kmsg
}
die () {
local return_code=$1
shift
warn "$@"
exit $return_code
}
fi

View File

@ -0,0 +1,182 @@
# Shell snippet.
bugout() { echo "${MYNAME}: Programming error" >&2 ; exit 123 ; }
echo_card_indices()
{
if [ -f /proc/asound/cards ] ; then
sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards
fi
}
filter_amixer_output()
{
sed \
-e '/Unable to find simple control/d' \
-e '/Unknown playback setup/d' \
-e '/^$/d'
}
# The following functions try to set many controls.
# No card has all the controls and so some of the attempts are bound to fail.
# Because of this, the functions can't return useful status values.
# $1 <control>
# $2 <level>
# $CARDOPT
unmute_and_set_level()
{
{ [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
amixer $CARDOPT -q set "$1" "$2" unmute 2>&1 | filter_amixer_output || :
return 0
}
# $1 <control>
# $CARDOPT
mute_and_zero_level()
{
{ [ "$1" ] && [ "$CARDOPT" ] ; } || bugout
amixer $CARDOPT -q set "$1" "0%" mute 2>&1 | filter_amixer_output || :
return 0
}
# $1 <control>
# $2 "on" | "off"
# $CARDOPT
switch_control()
{
{ [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
amixer $CARDOPT -q set "$1" "$2" 2>&1 | filter_amixer_output || :
return 0
}
# $1 <card ID>
sanify_levels_on_card()
{
CARDOPT="-c $1"
unmute_and_set_level "Master" "80%"
unmute_and_set_level "Master Mono" "80%" # See Bug#406047
unmute_and_set_level "Master Digital" "80%" # E.g., cs4237B
unmute_and_set_level "Playback" "80%"
unmute_and_set_level "Headphone" "70%"
unmute_and_set_level "PCM" "80%"
unmute_and_set_level "PCM,1" "80%" # E.g., ess1969
unmute_and_set_level "DAC" "80%" # E.g., envy24, cs46xx
unmute_and_set_level "DAC,0" "80%" # E.g., envy24
unmute_and_set_level "DAC,1" "80%" # E.g., envy24
unmute_and_set_level "Synth" "80%"
unmute_and_set_level "CD" "80%"
mute_and_zero_level "Mic"
mute_and_zero_level "IEC958" # Ubuntu #19648
# Intel P4P800-MX (Ubuntu bug #5813)
switch_control "Master Playback Switch" on
switch_control "Master Surround" on
# Trident/YMFPCI/emu10k1:
unmute_and_set_level "Wave" "80%"
unmute_and_set_level "Music" "80%"
unmute_and_set_level "AC97" "80%"
# DRC:
unmute_and_set_level "Dynamic Range Compression" "80%"
# Required for HDA Intel (hda-intel):
unmute_and_set_level "Front" "80%"
unmute_and_set_level "Master Front" "80%"
# Required for SB Live 7.1/24-bit (ca0106):
unmute_and_set_level "Analog Front" "80%"
# Required at least for Via 823x hardware on DFI K8M800-MLVF Motherboard with kernels 2.6.10-3/4 (see ubuntu #7286):
switch_control "IEC958 Capture Monitor" off
# Required for hardware allowing toggles for AC97 through IEC958,
# valid values are 0, 1, 2, 3. Needs to be set to 0 for PCM1.
unmute_and_set_level "IEC958 Playback AC97-SPSA" "0"
# Required for newer Via hardware (see Ubuntu #31784)
unmute_and_set_level "VIA DXS,0" "80%"
unmute_and_set_level "VIA DXS,1" "80%"
unmute_and_set_level "VIA DXS,2" "80%"
unmute_and_set_level "VIA DXS,3" "80%"
# Required on some notebooks with ICH4:
switch_control "Headphone Jack Sense" off
switch_control "Line Jack Sense" off
# Some machines need one or more of these to be on;
# others need one or more of these to be off:
#
# switch_control "External Amplifier" on
# switch_control "Audigy Analog/Digital Output Jack" on
# switch_control "SB Live Analog/Digital Output Jack" on
# D1984 -- Thinkpad T61/X61
switch_control "Speaker" on
switch_control "Headphone" on
# HDA-Intel w/ "Digital" capture mixer (See Ubuntu #193823)
unmute_and_set_level "Digital" "80%"
# On MacBookPro5,3 and later models (See Bug#597791)
unmute_and_set_level "Front Speaker" "80%"
# On MacBook5,2 models (See Bug#602973)
unmute_and_set_level "LFE" "80%"
# On Intel 82801H (See Bug#603550)
unmute_and_set_level "Speaker" "80%"
return 0
}
# $1 <card ID> | "all"
sanify_levels()
{
TTSDML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
sanify_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
done
;;
*)
sanify_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
;;
esac
return $TTSDML_RETURNSTATUS
}
# $1 <card ID>
preinit_levels_on_card()
{
CARDOPT="-c $1"
# Silly dance to activate internal speakers by default on PowerMac
# Snapper and Tumbler
id=$(cat /proc/asound/card$1/id 2>/dev/null)
if [ "$id" = "Snapper" -o "$id" = "Tumbler" ]; then
switch_control "Auto Mute" off
switch_control "PC Speaker" off
switch_control "Auto Mute" on
fi
}
# $1 <card ID> | "all"
preinit_levels()
{
TTSDML_RETURNSTATUS=0
case "$1" in
all)
for CARD in $(echo_card_indices) ; do
preinit_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
done
;;
*)
preinit_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
;;
esac
return $TTSDML_RETURNSTATUS
}

View File

@ -0,0 +1,162 @@
state.Codec {
control.1 {
iface MIXER
name 'DAC Playback Volume'
value 51
comment {
access 'read write'
type INTEGER
count 1
range '0 - 63'
dbmin -7308
dbmax 0
dbvalue.0 -1392
}
}
control.2 {
iface MIXER
name 'Headphone Playback Volume'
value 50
comment {
access 'read write'
type INTEGER
count 1
range '0 - 63'
dbmin -9999999
dbmax 0
dbvalue.0 -1300
}
}
control.3 {
iface MIXER
name 'Headphone Playback Switch'
value.0 true
value.1 true
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.4 {
iface MIXER
name 'Mic1 Playback Volume'
value 3
comment {
access 'read write'
type INTEGER
count 1
range '0 - 7'
dbmin -450
dbmax 600
dbvalue.0 0
}
}
control.5 {
iface MIXER
name 'Mic1 Boost Volume'
value 4
comment {
access 'read write'
type INTEGER
count 1
range '0 - 7'
dbmin 0
dbmax 4200
dbvalue.0 3300
}
}
control.6 {
iface MIXER
name 'ADC Gain Capture Volume'
value 3
comment {
access 'read write'
type INTEGER
count 1
range '0 - 7'
dbmin -450
dbmax 600
dbvalue.0 0
}
}
control.7 {
iface MIXER
name 'DAC Playback Switch'
value.0 true
value.1 true
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.8 {
iface MIXER
name 'DAC Reversed Playback Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.9 {
iface MIXER
name 'Mic1 Playback Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.10 {
iface MIXER
name 'Mixer Capture Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.11 {
iface MIXER
name 'Mixer Reversed Capture Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.12 {
iface MIXER
name 'Mic1 Capture Switch'
value.0 false
value.1 false
comment {
access 'read write'
type BOOLEAN
count 2
}
}
control.13 {
iface MIXER
name 'Headphone Source Playback Route'
value.0 DAC
value.1 DAC
comment {
access 'read write'
type ENUMERATED
count 2
item.0 DAC
item.1 Mixer
}
}
}

View File

@ -0,0 +1,30 @@
CONFIG_ARM=y
CONFIG_ARCH_SUNXI=y
# CONFIG_ARMV7_NONSEC is not set
CONFIG_IDENT_STRING=" FunKey"
# CONFIG_PRE_CONSOLE_BUFFER is not set
CONFIG_MACH_SUN8I_V3S=y
CONFIG_DRAM_CLK=360
CONFIG_DRAM_ZQ=14779
# CONFIG_VIDEO is not set
CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-funkey"
CONFIG_LOCALVERSION="-funkey"
# CONFIG_DISTRO_DEFAULTS is not set
CONFIG_BOOTDELAY=0
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_SYS_STDIO_DEREGISTER=y
# CONFIG_DISPLAY_CPUINFO is not set
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_SPL=y
CONFIG_HUSH_PARSER=y
CONFIG_CMD_BOOTZ=y
# CONFIG_CMD_IMLS is not set
# CONFIG_CMD_FLASH is not set
# CONFIG_CMD_FPGA is not set
# CONFIG_CMD_NET is not set
# CONFIG_CMD_NFS is not set
CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_FAT=y
CONFIG_CMD_FS_GENERIC=y
CONFIG_REGEX=y

View File

View File

@ -0,0 +1,64 @@
BR2_arm=y
BR2_cortex_a7=y
BR2_DL_DIR="$(BR2_EXTERNAL_FUNKEY_PATH)/dl"
BR2_CCACHE=y
BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/patches"
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y
BR2_TARGET_GENERIC_HOSTNAME="FunKey"
BR2_TARGET_GENERIC_ISSUE="Welcome to Buildroot for the FunKey"
BR2_ROOTFS_DEVICE_TABLE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/device_table.txt"
BR2_TARGET_GENERIC_ROOT_PASSWD="funkey"
BR2_TARGET_GENERIC_GETTY_PORT="ttyS0"
BR2_TARGET_GENERIC_GETTY_BAUDRATE_115200=y
BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/users_table.txt"
BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/rootfs-overlay"
BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/post-build.sh"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_GIT=y
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/linux"
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="cda44c146b9b87290bc7c636ffa7d88cbfb03ace"
BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/linux.config"
BR2_LINUX_KERNEL_UIMAGE=y
BR2_LINUX_KERNEL_LZO=y
BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x41000000"
BR2_LINUX_KERNEL_DTS_SUPPORT=y
BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-funkey"
BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/busybox.config"
BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
BR2_PACKAGE_ALSA_UTILS=y
BR2_PACKAGE_ALSA_UTILS_ALSACONF=y
BR2_PACKAGE_ALSA_UTILS_ACONNECT=y
BR2_PACKAGE_ALSA_UTILS_ALSALOOP=y
BR2_PACKAGE_ALSA_UTILS_ALSAUCM=y
BR2_PACKAGE_ALSA_UTILS_ALSATPLG=y
BR2_PACKAGE_ALSA_UTILS_AMIDI=y
BR2_PACKAGE_ALSA_UTILS_AMIXER=y
BR2_PACKAGE_ALSA_UTILS_APLAY=y
BR2_PACKAGE_ALSA_UTILS_APLAYMIDI=y
BR2_PACKAGE_ALSA_UTILS_ARECORDMIDI=y
BR2_PACKAGE_ALSA_UTILS_ASEQDUMP=y
BR2_PACKAGE_ALSA_UTILS_ASEQNET=y
BR2_PACKAGE_ALSA_UTILS_BAT=y
BR2_PACKAGE_ALSA_UTILS_IECSET=y
BR2_PACKAGE_ALSA_UTILS_SPEAKER_TEST=y
BR2_PACKAGE_AUMIX=y
# BR2_PACKAGE_IFUPDOWN_SCRIPTS is not set
BR2_PACKAGE_NANO=y
BR2_TARGET_ROOTFS_CPIO_LZMA=y
BR2_TARGET_ROOTFS_CPIO_UIMAGE=y
BR2_TARGET_ROOTFS_INITRAMFS=y
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_UBOOT=y
BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
BR2_TARGET_UBOOT_CUSTOM_GIT=y
BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/Lichee-Pi/u-boot"
BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="32ab1804cd7c5858be8009e35ca07502dc8765c7"
BR2_TARGET_UBOOT_USE_CUSTOM_CONFIG=y
BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/uboot.config"
BR2_TARGET_UBOOT_NEEDS_DTC=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM=y
BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin"
BR2_TARGET_UBOOT_BOOT_SCRIPT=y
BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/boot.cmd"

2
PCBA/external.desc Normal file
View File

@ -0,0 +1,2 @@
name: FUNKEY
desc: FunKey packages

1
PCBA/external.mk Normal file
View File

@ -0,0 +1 @@
include $(sort $(wildcard $(BR2_EXTERNAL_FUNKEY_PATH)/package/*/*.mk))

8
fel-boot.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
cd PCBA/output/images
sudo ~/sunxi-tools/sunxi-fel -v -p uboot u-boot-sunxi-with-spl.bin \
write 0x41000000 uImage \
write 0x41800000 sun8i-v3s-funkey.dtb \
write 0x41900000 boot.scr \
write 0x41B00000 rootfs.cpio.uboot
cd -

2
fun
View File

@ -7,7 +7,7 @@ case "$1" in
$BR distclean funkey_defconfig
;;
update)
$BR savedefconfig linux-update-defconfig uboot-update-defconfig
$BR savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
;;
*)
$BR $*

5
have
View File

@ -4,8 +4,11 @@ case "$1" in
fun)
buildroot/utils/brmake -C buildroot BR2_EXTERNAL=../FunKey O=../FunKey/output
;;
pcba)
buildroot/utils/brmake -C buildroot BR2_EXTERNAL=../PCBA O=../PCBA/output
;;
*)
echo "You can only have fun!" >&2
echo "You can only have fun or pcba!" >&2
exit 1
;;
esac

15
pcba Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
BR="make -C buildroot BR2_EXTERNAL=../PCBA O=../PCBA/output"
case "$1" in
start)
$BR distclean funkey_defconfig
;;
update)
$BR savedefconfig linux-update-defconfig uboot-update-defconfig busybox-update-config
;;
*)
$BR $*
;;
esac