平台 9850KH,Android 7.0
一、LCD移植
文件修改:u-boot15\include\configs\sp9850kh_1h10.h
u-boot15\drivers\video\sprdfb\sprdfb_panel.c
kernel\arch\arm64\boot\dts\sprd\sp9850kh-common.dtsi
在configs\sp9850kh_1h10.h 添加宏定义
#define CONFIG_FB_LCD_VDD18_VCAMA
#define CONFIG_FB_LCD_JD9366_MIPI_LONGYU_S5703
#define CONFIG_SYS_WHITE_ON_BLACK
#ifdef LCD_TEST_PATTERN
#define CONSOLE_COLOR_RED 0xf800
#define CONSOLE_COLOR_GREEN 0x07e0
#define CONSOLE_COLOR_YELLOW 0x07e0
#define CONSOLE_COLOR_BLUE 0x001f
#define CONSOLE_COLOR_MAGENTA 0x001f
#define CONSOLE_COLOR_CYAN 0x001f
u-boot15\drivers\video\sprdfb\lcd 目录下放入lcd_jd9366_00_mipi_longyu_s5703.c
修改makefile:
obj-$(CONFIG_FB_LCD_JD9366_MIPI_LONGYU_S5703) += lcd_jd9366_00_mipi_longyu_s5703.o
修改 sprdfb_panel.c
添加:extern struct panel_spec lcd_jd9366_00_mipi_longyu_s5703_spec; lcd_jd9366_00_mipi_longyu_s5703.c有定义
panel_cfg panel_cfg[]数组中添加
#ifdef CONFIG_FB_LCD_JD9366_MIPI_LONGYU_S5703
{
.lcd_id = 0x936600, //ID型号加电频
.panel = &lcd_jd9366_00_mipi_longyu_s5703_spec,
},
#endif
在\kernel\arch\arm64\boot\dts\sprd\lcd 目录下添加lcd_jd9366_00_mipi_longyu_s5703.dtsi
sp9850kh-common.dtsi 中添加:
#include "lcd/lcd_jd9366_00_mipi_longyu_s5703.dtsi"
#include "sc2721.dtsi"
#include "sprd-battery.dtsi"
#include "sp9850kh-modem.dtsi"
#include
#include "sprd-sound-sharkl.dtsi"
panel_if: sprd-panel-if {
compatible = "sprd-panel-if";
#address-cells = <1>;
#size-cells = <0>;
panel-drivers = <
&lcd_jd9366_00_mipi_longyu_s5703
&l505_lcd_ili9881c_weiyi_mipi_hd
&l505_lcd_jd9365_zgd_mipi
&l505_lcd_otm1289a_kd_mipi
&l505_lcd_jd9365_hf_mipi
&lcd_ili9881p_mipi_hd
&lcd_ili9881c_mipi_hd
&lcd_nt35597_mipi_2k_fpga
&lcd_dummy_rgb
>;
二、TP移植
去平台的 deconfig 文件中打开 CONFIG_TOUCHSCREEN_GSLX680 宏
驱动代码放入kernel\drivers\input\touchscreen 目录下
修改makefile kconfig
驱动:gslx680
makefile:
obj-$(CONFIG_TOUCHSCREEN_GSLX680) += gslx680/
kconfig:
config TOUCHSCREEN_GSLX680
tristate "GSLX680 Touchscreen interface support"
depends on I2C
help
Say Y here if enable support for the GSLX680 multi fingers
touchscreen controller.
If unsure, say N.
To compile this driver as a module, choose M here: the
module will be called gslx680.
kernel\arch\arm64\boot\dts\sprd\sp9850kh-smt-1h10.dts 添加:
&i2c3 {
status = "okay";
gslX680@40{
compatible = "gslX680,gslX680_ts";
reg = <0x40>;
gpios = <&ap_gpio 145 0
&ap_gpio 144 0>;
vdd_name = "vdd28";
virtualkeys = <580 108 1317 40 40
172 396 1317 40 40
158 612 1317 40 40>;
TP_MAX_X = <720>;
TP_MAX_Y = <1440>;
};
};
idh\device\sprd\sharklj1\common\rootdir\system\usr\idc 添加:gslX680_ts.idc
三、camera 移植
\vendor\sprd\modules\libcamera\sensor\sensor_drv\classic 目录下放入对应的sensor代码
修改vendor\sprd\modules\libcamera\sensor sensor_cfg.c
#ifdef GC5005
extern SENSOR_INFO_T g_gc5005_mipi_raw_info;
#endif
#ifdef GC5024
extern SENSOR_INFO_T g_gc5024_mipi_raw_info;
#endif
const SENSOR_MATCH_T back_sensor_infor_tab[] = {
// gc area
#ifdef GC5025
{MODULE_SUNNY, "gc5025", &g_gc5025_mipi_raw_info, {&dw9714_drv_entry, 0}, NULL},
#endif
#ifdef S5K3L8
{MODULE_SUNNY, "s5k3l8", &g_s5k3l8xxm3_mipi_raw_info, {&dw9714_drv_entry, 0}, NULL},
#endif
#ifdef GC5005
{MODULE_SUNNY, "gc5005", &g_gc5005_mipi_raw_info, {&dw9714_drv_entry, 0}, NULL},
#endif
#ifdef GC8024
{MODULE_SUNNY, "gc8024", &g_gc8024_mipi_raw_info, {&dw9714_drv_entry, 0}, NULL},
#endif
#ifdef GC030A
{MODULE_SUNNY, "gc030a", &g_gc030a_mipi_raw_info, {NULL, 0}, NULL},
#endif
...........
{0, "0", NULL, {NULL, 0}, NULL}};
const SENSOR_MATCH_T front_sensor_infor_tab[] = {
// gc area
#ifdef SUB_GC2385
{MODULE_SUNNY, "sub_gc2385", &g_gc2385_mipi_raw_info, {NULL, 0}, NULL},
#endif
#ifdef GC5005
{MODULE_SUNNY, "gc5005", &g_gc5005_mipi_raw_info, {NULL, 0}, NULL},
#endif
.................
{0, "0", NULL, {NULL, 0}, NULL}};
修改 device\sprd\sharklj1\sp9850kh_1h10
BoardConfig.mk
CAMERA_SENSOR_TYPE_BACK := "gc5025 gc8024 s5k3l8"
CAMERA_SENSOR_TYPE_FRONT := "sub_gc2385"
sc2721.dtsi 电压配置
vddcama: ldo@5 {
reg = <5>;
regulator-name = "vddcama";
sprd,default-microvolt = <1800000>;
sprd,step-microvolt = <10000>;
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3750000>;
regulator-microvolt-offset = <0>;
sprd,hide-offset = <1000>;
};
四、电池配置
chg-end-vol = <4200>; //CC2CV voltage
chg-end-vol-check = <4190>; //充满检测电压
chg-bat-safety-vol = <4280>; //电池安全电压
rechg-vol = <4131>; //复充电压
adp-cdp-cur = <700>;
adp-dcp-cur = <700>; //AC充电电流
adp-sdp-cur = <500>; //USB充电电流
ovp-stop = <6000>; //过充保护电压
ovp-restart = <5400>;
gu-mode = <0>; //库仑计模式选择
alm-soc = <5>;
alm-vol = <3450>;
soft-vbat-uvlo = <3050>;
rint = <150>;
cnom = <5000>; //电池容量
rsense-real = <200>;
rsense-spec = <200>;
relax-current = <50>;
fgu-cal-ajust = <0>;
ocv-tab-vol = <4185 4083 4011 3970 3939 3916 3887 3846 3823 3805 3785 3776 3770 3764 3758 3748 3725 3703 3683 3587 3400>;
ocv-tab-cap = <100 95 90 85 80 75 70 65 60 55 50 45 40 35 30 25 20 15 10 5 0>;
五、喇叭
&sound_vbc_r1p0v3_sprd_codec {
status = "okay";
sprd-audio-card,widgets =
"Headphone", "inter HP PA",
"Speaker", "inter Ear PA";
sprd-audio-card,routing =
"HPMIC", "HP Mic Jack",
"MIC", "Mic Jack",
"inter HP PA", "HP PA",
"Ext Spk", "Spk PA",
"inter Ear PA", "EAR",
/* For vbc loopback */
"Aud input", "AD Clk",
"Aud input1", "AD Clk",
"Aud input", "Digital ADCL Switch",
"Aud input", "Digital ADCR Switch",
"Aud input1", "Digital ADC1L Switch",
"Aud input1", "Digital ADC1R Switch";
/* ext_control_type, hook selection, mode, gpio share */
sprd,spk-ext-pa-info = <0 0 3 0>; // 脉冲数
sprd,spk-ext-pa-gpio = <&ap_gpio 92 0>;
sprd,spk-ext-pa-names = "ext_spk_r";
};
六、背光驱动
路径:\sprd\kernel\drivers\video\backlight
七、外置喇叭
9820a 平台:sprd-sound.dtsi
/* 4. machine */
vbc_sound0: sound@0 {
compatible = "sprd,vbc-r2p0-sprd-codec";
sprd,model = "sprdphone";
sprd,vaudio = <&vaudio>;
sprd,vbc = <&vbc_r2p0>;
sprd,codec = <&sprd_codec>;
sprd,pcm = <&sprd_pcm>;
gpio_audio_pa_en = <77>;/*according the sch. pa enable*/
};
sprd-asoc-card.c
static unsigned int gpio_audio_pa_en = 0;
static int customer_ext_speaker_ctrl(int id, int on)
{
if ((id != SPRD_AUDIO_ID_SPEAKER) && (id != SPRD_AUDIO_ID_SPEAKER2)) {
return HOOK_BPY;
}
/* set speaker amplifier */
if (!on) {
gpio_set_value(gpio_audio_pa_en, 0);
} else {
gpio_set_value(gpio_audio_pa_en, 1);
}
return HOOK_OK;
}
of_property_read_u32(node, "gpio_audio_pa_en", &gpio_audio_pa_en);
sp_asoc_pr_info("gpio_audio_pa_en = %d\n", gpio_audio_pa_en);
if(gpio_audio_pa_en != 0 && 0 == is_init) {
static struct sprd_audio_ext_hook audio_hook = {0};
int ret;
ret = gpio_request(gpio_audio_pa_en, "speaker amplifier");
if (ret) {
pr_err("%s: request GPIO_%d error\n", __func__,gpio_audio_pa_en);
return ret;
}
is_init = 1;
gpio_direction_output(gpio_audio_pa_en, 0);
audio_hook.ext_speaker_ctrl = customer_ext_speaker_ctrl;
sprd_ext_hook_register(&audio_hook);
}