finepower-f1: new device (Finepower F1) (!645)

[ci:skip-build]: already built successfully in CI
This commit is contained in:
smd 2019-09-23 20:20:27 +03:00 committed by Oliver Smith
parent 9c7cffa8f4
commit a4f38c41c0
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
11 changed files with 7750 additions and 0 deletions

View file

@ -0,0 +1,23 @@
# Reference: <https://postmarketos.org/devicepkg>
pkgname="device-finepower-f1"
pkgdesc="FinePower F1"
pkgver=0.1
pkgrel=0
url="https://postmarketos.org"
license="MIT"
arch="armv7"
options="!check !archcheck"
depends="postmarketos-base linux-finepower-f1 mkbootimg mesa-dri-swrast"
makedepends="devicepkg-dev"
source="deviceinfo"
build() {
devicepkg_build $startdir $pkgname
}
package() {
devicepkg_package $startdir $pkgname
}
sha512sums="621dbc22d55969e1682476d96f0de142c6e5db2ebd1c2787b8dd701a2d1f5c8a93a4570cbbaa408648036bdbb9904a35a5f7cb0c9e996f7ae641b5eb1cad249b deviceinfo"

View file

@ -0,0 +1,33 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="FinePower F1"
deviceinfo_manufacturer="FinePower"
deviceinfo_codename="finepower-f1"
deviceinfo_date=""
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_arch="armv7"
# Device related
deviceinfo_keyboard="true"
deviceinfo_external_storage="true"
deviceinfo_screen_width="320"
deviceinfo_screen_height="480"
deviceinfo_dev_touchscreen="/dev/input/event0"
deviceinfo_dev_touchscreen_calibration=""
deviceinfo_dev_keyboard=""
# Bootloader related
deviceinfo_flash_method="fastboot"
deviceinfo_kernel_cmdline="console=ttyS1,115200n8"
deviceinfo_generate_bootimg="true"
deviceinfo_bootimg_qcdt="true"
deviceinfo_flash_offset_base="0x00000000"
deviceinfo_flash_offset_kernel="0x00008000"
deviceinfo_flash_offset_ramdisk="0x01000000"
deviceinfo_flash_offset_second="0x00f00000"
deviceinfo_flash_offset_tags="0x00000100"
deviceinfo_flash_pagesize="2048"

View file

@ -0,0 +1,13 @@
diff --git a/drivers/net/wireless/Kconfig b/drivers/net/wireless/Kconfig
index bcc52541..23931336 100644
--- a/drivers/net/wireless/Kconfig
+++ b/drivers/net/wireless/Kconfig
@@ -286,7 +286,7 @@ source "drivers/net/wireless/rtlwifi/Kconfig"
source "drivers/net/wireless/ti/Kconfig"
source "drivers/net/wireless/zd1211rw/Kconfig"
source "drivers/net/wireless/mwifiex/Kconfig"
-source "drivers/net/wireless/sprdwl/Kconfig"
+#source "drivers/net/wireless/sprdwl/Kconfig"
#source "drivers/net/wireless/sc2331/Kconfig"
source "drivers/net/wireless/sc2331/sc2331_mem_alloc/Kconfig"
endif # WLAN

View file

@ -0,0 +1,33 @@
diff --git a/drivers/platform/sprd/dump_lowpower_regs.c b/drivers/platform/sprd/dump_lowpower_regs.c
index 9f274d8f..f07e460d 100755
--- a/drivers/platform/sprd/dump_lowpower_regs.c
+++ b/drivers/platform/sprd/dump_lowpower_regs.c
@@ -3,17 +3,17 @@
#include <asm/io.h>
#include <soc/sprd/sci_glb_regs.h>
#include <soc/sprd/iomap.h>
-#include <lowpower_regs_aon_apb.h>
-#include <lowpower_regs_aon_apb_pll.h>
-#include <lowpower_regs_aon_ckg.h>
-#include <lowpower_regs_ap_ahb.h>
-#include <lowpower_regs_ap_ahb_ckg.h>
-#include <lowpower_regs_ap_apb.h>
-#include <lowpower_regs_ap_apb_usb.h>
-#include <lowpower_regs_pinctrl.h>
-#include <lowpower_regs_pmic_glb.h>
-#include <lowpower_regs_pmu_apb.h>
-#include <lowpower_regs_dmc.h>
+#include "lowpower_regs_aon_apb.h"
+#include "lowpower_regs_aon_apb_pll.h"
+#include "lowpower_regs_aon_ckg.h"
+#include "lowpower_regs_ap_ahb.h"
+#include "lowpower_regs_ap_ahb_ckg.h"
+#include "lowpower_regs_ap_apb.h"
+#include "lowpower_regs_ap_apb_usb.h"
+#include "lowpower_regs_pinctrl.h"
+#include "lowpower_regs_pmic_glb.h"
+#include "lowpower_regs_pmu_apb.h"
+#include "lowpower_regs_dmc.h"
#include <soc/sprd/hardware.h>
extern void compare_pin_regs();

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,286 @@
diff --git a/drivers/video/sprdfb/Kconfig b/drivers/video/sprdfb/Kconfig
index 5c929a5..7f0678c 100755
--- a/drivers/video/sprdfb/Kconfig
+++ b/drivers/video/sprdfb/Kconfig
@@ -305,6 +305,11 @@ config FB_LCD_ST7789V_MCU
depends on FB_SC8825 || FB_SCX35 || FB_SCX15
default n
+config FB_LCD_ST7796S_MIPI
+ boolean "support ST7796S mipi panel"
+ depends on FB_SC8825 || FB_SCX35 || FB_SCX30G
+ default n
+
config FB_LCD_NT51017_MIPI_LVDS
boolean "support nt51017 lvds panel"
depends on FB_SC8825 || FB_SCX35
diff --git a/drivers/video/sprdfb/lcd/Makefile b/drivers/video/sprdfb/lcd/Makefile
index c1b385b..df28587 100755
--- a/drivers/video/sprdfb/lcd/Makefile
+++ b/drivers/video/sprdfb/lcd/Makefile
@@ -27,6 +27,7 @@ obj-$(CONFIG_FB_LCD_S6D77ALA_MIPI_PIKEBJ1MINI) += lcd_s6d77a1a01_mipi_pikebj1min
obj-$(CONFIG_FB_LCD_SC7798D_MIPI_PIKEBJ1MINI) += lcd_sc7798d_mipi_pikebj1mini.o
obj-$(CONFIG_FB_LCD_ILI9341) += lcd_ili9341.o
obj-$(CONFIG_FB_LCD_ST7789V_MCU) += lcd_st7789v_mcu.o
+obj-$(CONFIG_FB_LCD_ST7796S_MIPI) += lcd_st7796s_mipi.o
obj-$(CONFIG_FB_LCD_OTM1283A_MIPI) += lcd_otm1283a_mipi.o
obj-$(CONFIG_FB_LCD_NT35502_MIPI) += lcd_nt35502_mipi.o
obj-$(CONFIG_FB_LCD_VIVA_RGB_SPI) += lcd_hx8363_rgb_spi_viva.o
diff --git a/drivers/video/sprdfb/lcd/lcd_st7796s_mipi.c b/drivers/video/sprdfb/lcd/lcd_st7796s_mipi.c
new file mode 100644
index 0000000..2096e01
--- /dev/null
+++ b/drivers/video/sprdfb/lcd/lcd_st7796s_mipi.c
@@ -0,0 +1,252 @@
+/* drivers/video/sprdfb/lcd/lcd_st7796s_mipi.c
+ *
+ * Support for ST7796S mipi LCD device
+ *
+ * Copyright (C) 2010 Spreadtrum
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
+#include "../sprdfb_panel.h"
+
+#define MAX_DATA 100
+
+typedef struct LCM_Init_Code_tag {
+ unsigned int tag;
+ unsigned char data[MAX_DATA];
+}LCM_Init_Code;
+
+typedef struct LCM_force_cmd_code_tag{
+ unsigned int datatype;
+ LCM_Init_Code real_cmd_code;
+}LCM_Force_Cmd_Code;
+
+#define LCM_TAG_SHIFT 24
+#define LCM_TAG_MASK ((1 << 24) -1)
+#define LCM_SEND(len) ((1 << LCM_TAG_SHIFT)| len)
+#define LCM_SLEEP(ms) ((2 << LCM_TAG_SHIFT)| ms)
+
+#define LCM_TAG_SEND (1<< 0)
+#define LCM_TAG_SLEEP (1 << 1)
+
+static LCM_Init_Code init_data[] = {
+ /*{0xF0, 1, {0xC3}}, COMMAND SET CONTROL: ENABLE COMMAND 2 part I
+ {0xF0, 1, {0x96}}, COMMAND SET CONTROL: ENABLE COMMAND 2 part II
+ {0x36, 1, {0x86}}, MADCTL (memory data access control): mirror framebuffer,
+ {0xB4, 1, {0x01}}, DIC (display inversion control) : 1-dot inversion
+ {0x3A, 1, {0x55}}, Interface pixel format: 18-bit//0x55
+ {0xB7, 1, {0x06}}, Entry Mode Set: normal display
+ {0xB9, 2, {0x02,0XC0}},
+ {0x35, 1, {0x00}}, Tearing effect line: disabled
+ {0x44, 2, {0x00,0x00}}, Set tear scanline: 0
+
+ {0xE8, 8, {0x40,0x8a,0x00,0x00,0x29,0x19,0xa5,0x33}}, Display output ctrl adjust
+ {0xC5, 1, {0x25}}, VCOM control: 1.225
+ {0xC2, 1, {0xA5}}, PWR3 Power control: low
+ GAMMA CONTROL
+ {0xE0, 14, {0xF0,0x00,0x03,0x0b,0x0c,0x29,0x2e,0x44,0x41,0x17,0x11,0x13,0x16,0x1b}},
+ {0xE1, 14, {0xF0,0x00,0x02,0x06,0x06,0x24,0x2a,0x43,0x3e,0x2d,0x1a,0x16,0x13,0x17}},
+ {0xEC, 3, {0x00,0x00,0x01}},
+
+ {0xF0, 1, {0x3C}}, COMMAND SET CONTROL
+ {0xF0, 1, {0x69}}, COMMAND SET CONTROL
+
+ {0x29, 1, {0x00}},
+ {REGFLAG_DELAY, 20, {}},*/
+ {LCM_SEND(1), {0xC3}},
+ {LCM_SEND(1), {0x96}},
+ {LCM_SEND(1), {0x86}},
+ {LCM_SEND(1), {0x01}},
+ {LCM_SEND(1), {0x55}},//0x55
+ {LCM_SEND(1), {0x06}},
+ {LCM_SEND(2), {0x02,0XC0}},
+ {LCM_SEND(1), {0x00}},
+ {LCM_SEND(2), {0x00,0x00}},
+
+ {LCM_SEND(8), {0x40,0x8a,0x00,0x00,0x29,0x19,0xa5,0x33}},
+ {LCM_SEND(1), {0x25}},
+ {LCM_SEND(1), {0xA5}},
+
+ {LCM_SEND(14), {0xF0,0x00,0x03,0x0b,0x0c,0x29,0x2e,0x44,0x41,0x17,0x11,0x13,0x16,0x1b}},
+ {LCM_SEND(14), {0xF0,0x00,0x02,0x06,0x06,0x24,0x2a,0x43,0x3e,0x2d,0x1a,0x16,0x13,0x17}},
+ {LCM_SEND(3), {0x00,0x00,0x01}},
+
+ {LCM_SEND(1), {0x3C}},
+ {LCM_SEND(1), {0x69}},
+
+ {LCM_SEND(1), 1, {0x00}},
+ {LCM_SLEEP(20)},
+};
+
+static LCM_Init_Code sleep_in[] = {
+ {LCM_SEND(1), {0x28}},
+ {LCM_SLEEP(50)}, //>150ms
+ {LCM_SEND(1), {0x10}},
+ {LCM_SLEEP(120)}, //>150ms
+};
+
+static LCM_Init_Code sleep_out[] = {
+ {LCM_SEND(1), {0x11}},
+ {LCM_SLEEP(120)},//>120ms
+ {LCM_SEND(1), {0x29}},
+ {LCM_SLEEP(50)}, //>20ms
+};
+
+static int32_t st7796s_mipi_init(struct panel_spec *self)
+{
+ int32_t i;
+ LCM_Init_Code *init = init_data;
+ unsigned int tag;
+
+ mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode;
+ mipi_dcs_write_t mipi_dcs_write = self->info.mipi->ops->mipi_dcs_write;
+ mipi_eotp_set_t mipi_eotp_set = self->info.mipi->ops->mipi_eotp_set;
+
+ printk("kernel ili9486s1_mipi_init\n");
+
+ mipi_set_cmd_mode();
+ mipi_eotp_set(0,0);
+
+ for(i = 0; i < ARRAY_SIZE(init_data); i++){
+ tag = (init->tag >>24);
+ if(tag & LCM_TAG_SEND){
+ mipi_dcs_write(init->data, (init->tag & LCM_TAG_MASK));
+ udelay(20);
+ }else if(tag & LCM_TAG_SLEEP){
+ msleep(init->tag & LCM_TAG_MASK);
+ }
+ init++;
+ }
+ mipi_eotp_set(0,0);
+
+ return 0;
+}
+
+
+static uint32_t st7796s_readid(struct panel_spec *self)
+{
+ printk("lcd_dummy read id!\n");
+ printk("lcd_dummy read id success!\n");
+ return 0x7796;
+}
+
+
+static int32_t st7796s_enter_sleep(struct panel_spec *self, uint8_t is_sleep)
+{
+ int32_t i;
+ LCM_Init_Code *sleep_in_out = NULL;
+ unsigned int tag;
+ int32_t size = 0;
+
+ mipi_set_cmd_mode_t mipi_set_cmd_mode = self->info.mipi->ops->mipi_set_cmd_mode;
+ mipi_dcs_write_t mipi_dcs_write = self->info.mipi->ops->mipi_dcs_write;
+ mipi_eotp_set_t mipi_eotp_set = self->info.mipi->ops->mipi_eotp_set;
+
+ printk("kernel nt35502_enter_sleep, is_sleep = %d\n", is_sleep);
+
+ if(is_sleep){
+ sleep_in_out = sleep_in;
+ size = ARRAY_SIZE(sleep_in);
+ }else{
+ sleep_in_out = sleep_out;
+ size = ARRAY_SIZE(sleep_out);
+ }
+
+ mipi_set_cmd_mode();
+ mipi_eotp_set(0,0);
+
+ for(i = 0; i <size ; i++){
+ tag = (sleep_in_out->tag >>24);
+ if(tag & LCM_TAG_SEND){
+ mipi_dcs_write(sleep_in_out->data, (sleep_in_out->tag & LCM_TAG_MASK));
+ }else if(tag & LCM_TAG_SLEEP){
+ msleep(sleep_in_out->tag & LCM_TAG_MASK);
+ }
+ sleep_in_out++;
+ }
+ mipi_eotp_set(0,0);
+
+ return 0;
+}
+
+/* esd check disabled
+static int32_t st7796s_check_esd(struct panel_spec *self)
+{
+ pr_debug("dummy_check_esd!\n");
+ pr_debug("dummy_check_esd OK!\n");
+ return 1;
+} */
+
+
+static struct panel_operations lcd_st7796s_mipi_operations = {
+ .panel_init = st7796s_mipi_init,
+ .panel_readid = st7796s_readid,
+ .panel_enter_sleep = st7796s_enter_sleep,
+ //.panel_esd_check = dummy_check_esd,
+};
+
+
+static struct timing_rgb lcd_st7796s_mipi_timing = {
+ /* unit: pixel */
+ .hfp = 65, //Horizontal front porch
+ .hbp = 10, //Horizontal back porch
+ .hsync = 10,//6,
+ /*unit: line*/
+ .vfp = 8, //Vertical front porch
+ .vbp = 10, //Vertical back porch
+ .vsync = 3,
+};
+
+static struct info_mipi lcd_st7796s_mipi_info = {
+ .work_mode = SPRDFB_MIPI_MODE_VIDEO,
+ .video_bus_width = 18, /*18,16*/
+ .lan_number = 1,
+ .phy_feq = 340*1000,
+ .h_sync_pol = SPRDFB_POLARITY_NEG,
+ .v_sync_pol = SPRDFB_POLARITY_NEG,
+ .de_pol = SPRDFB_POLARITY_POS,
+ .te_pol = SPRDFB_POLARITY_POS,
+ .color_mode_pol = SPRDFB_POLARITY_POS,
+ .shut_down_pol = SPRDFB_POLARITY_NEG,
+ .timing = &lcd_st7796s_mipi_timing,
+ .ops = NULL,
+};
+
+// DONE
+
+struct panel_spec lcd_st7796s_mipi_spec = {
+ .width = 320,
+ .height = 480,
+ .fps = 60,
+ .type = LCD_MODE_DSI,
+ .direction = LCD_DIRECT_NORMAL,
+ //.is_clean_lcd = true,
+ .info = {
+ .mipi = &lcd_st7796s_mipi_info
+ },
+ .ops = &lcd_st7796s_mipi_operations,
+};
+
+struct panel_cfg lcd_st7796s_mipi = {
+ .dev_id = SPRDFB_MAINLCD_ID,
+ .lcd_id = 0x7796,
+ .lcd_name = "lcd_st7796s_mipi",
+ .panel = &lcd_st7796s_mipi_spec,
+};
+
+static int __init lcd_st7796s_mipi_init(void)
+{
+ return sprdfb_panel_register(&lcd_st7796s_mipi);
+}
+
+subsys_initcall(lcd_st7796s_mipi_init);

View file

@ -0,0 +1,84 @@
# Reference: <https://postmarketos.org/vendorkernel>
# Kernel config based on: arch/arm/configs/sp7731ceb_dt_defconfig
pkgname="linux-finepower-f1"
pkgver=3.10.65
pkgrel=0
pkgdesc="FinePower F1 kernel fork"
arch="armv7"
_carch="arm"
_flavor="finepower-f1"
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev devicepkg-dev dtbtool"
# Compiler: latest GCC from Alpine
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
# Source
_commit="b30390f1645dcf1ebd08148d7d4086a544c56435"
_repository="kernel_7730"
_config="config-${_flavor}.${arch}"
source="
$pkgname-$_commit.zip::https://github.com/jedld/${_repository}/archive/${_commit}.zip
$_config
kernel-use-the-gnu89-standard-explicitly.patch
gcc7-give-up-on-ilog2-const-optimizations.patch
gcc8-fix-put-user.patch
01-remove-path-to-missing-driver.patch
02-fix-includes-dump-lowpower-regs.patch
03-replace-dts.patch
04-add-st7796s-mipi-panel-support.patch
"
builddir="$srcdir/${_repository}-${_commit}"
prepare() {
default_prepare
downstreamkernel_prepare "$srcdir" "$builddir" "$_config" "$_carch" "$HOSTCC"
}
build() {
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-postmarketOS"
# Generate master DTB (deviceinfo_bootimg_qcdt)
dtbTool -s 2048 -p "scripts/dtc" -o "arch/arm/boot/dt.img" "arch/arm/boot"
}
package() {
# kernel.release
install -D "$builddir/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
# zImage (find the right one)
cd "$builddir/arch/$_carch/boot"
_target="$pkgdir/boot/vmlinuz-$_flavor"
for _zimg in zImage-dtb Image.gz-dtb *zImage Image; do
[ -e "$_zimg" ] || continue
msg "zImage found: $_zimg"
install -Dm644 "$_zimg" "$_target"
break
done
if ! [ -e "$_target" ]; then
error "Could not find zImage in $PWD!"
return 1
fi
# Master DTB (deviceinfo_bootimg_qcdt)
install -Dm644 "$builddir/arch/arm/boot/dt.img" \
"$pkgdir/boot/dt.img"
}
sha512sums="bcbb8f6e99bd53b173715765c86845f991c2f769e9c13c72503e4f9062dc7bc97a073a4ad730e804d43efd2bcbcd7b91a0890d6194b5986e453d40a79f08249b linux-finepower-f1-b30390f1645dcf1ebd08148d7d4086a544c56435.zip
aa7bfc0627ff218c59c36086c8c7eeae286d3873c871ce41c1b21e73ff280b8ab255dbb6d74e55e8bf14bd1926f00602ad08d7ea8149085fd3377b860404505b config-finepower-f1.armv7
ad0182a483791fc88e058838bc331b2f04a75ba291e763767babdb815efadfc3b4fda97e69e2e3f00a426cabea088e35297a92bd287592597d1e309be68ee92c kernel-use-the-gnu89-standard-explicitly.patch
77eba606a71eafb36c32e9c5fe5e77f5e4746caac292440d9fb720763d766074a964db1c12bc76fe583c5d1a5c864219c59941f5e53adad182dbc70bf2bc14a7 gcc7-give-up-on-ilog2-const-optimizations.patch
197d40a214ada87fcb2dfc0ae4911704b9a93354b75179cd6b4aadbb627a37ec262cf516921c84a8b1806809b70a7b440cdc8310a4a55fca5d2c0baa988e3967 gcc8-fix-put-user.patch
57ebedabe0caa29773b0e65f219bb7c3e19bf53bd30fca69c07b1345185658dcc33498a39fe3c77bd9579012075f66887c0057ec1d41febe7f041fd0029a1102 01-remove-path-to-missing-driver.patch
8cfb51f2a2b645c5b0bee1ce84c368d475b7f23bf337fa21c0695f8c110a6e9644b96a267dacbda822f29ccd9c39c65881c91922605247398f3cd49d274e2bee 02-fix-includes-dump-lowpower-regs.patch
f72b3616da6f2fc77e36199be295bb5066c93340a2d715bdce196900a4c42371f61a37513b660de0ed978006939af5aa89d85acba2997267d6bc0e7e4d0e32c7 03-replace-dts.patch
37be4144e4effcb3b2db61bd25706e2eb842328ddc57babb758c23c3a69aecb886c36d09a2557a3ff08ce8d58869914a46c5ff71cdf1dbeff8b7c8c7500c2377 04-add-st7796s-mipi-panel-support.patch"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc7-give-up-on-ilog2-const-optimizations.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/gcc8-fix-put-user.patch

View file

@ -0,0 +1 @@
../../.shared-patches/linux/kernel-use-the-gnu89-standard-explicitly.patch