mirror of
https://gitee.com/open-loongarch/linux-6.12.git
synced 2026-10-26 13:07:11 +08:00
update to e7567cc18
1.Fix the issue of the SD card crashing due to repeated plugging and unplugging. 2.add init-polarity to support setup init pwm status 3.loongson2_thermal: update temperature formula 4.Fix alert/critical temperature to 75/105 5.Add alientek-2k300 support
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
# dtb-y = loongson-2k0500-ref.dtb loongson-2k1000-ref.dtb loongson-2k2000-ref.dtb
|
||||
|
||||
ifdef CONFIG_DTB_MATCH_BY_BOARD_NAME
|
||||
dtb-$(CONFIG_LOONGSON_2K300) += ls2k300_mini_dp.dtb ls2k300_vanguard_pi.dtb ls2k300_gongkong_gbkpgk0.dtb
|
||||
dtb-$(CONFIG_LOONGSON_2K300) += ls2k300_mini_dp.dtb ls2k300_vanguard_pi.dtb ls2k300_gongkong_gbkpgk0.dtb \
|
||||
ls2k300_alientek.dtb
|
||||
dtb-$(CONFIG_LOONGSON_2K1000) += ls2k1000_dp.dtb
|
||||
|
||||
obj-y += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
|
||||
|
||||
@@ -1024,13 +1024,13 @@
|
||||
|
||||
trips {
|
||||
cpu_alert: cpu-alert {
|
||||
temperature = <55000>;
|
||||
temperature = <75000>;
|
||||
hysteresis = <5000>;
|
||||
type = "active";
|
||||
};
|
||||
|
||||
cpu_crit: cpu-crit {
|
||||
temperature = <125000>;
|
||||
temperature = <105000>;
|
||||
hysteresis = <5000>;
|
||||
type = "critical";
|
||||
};
|
||||
|
||||
@@ -0,0 +1,267 @@
|
||||
#include "ls2k300_g2k03z0_core_v10.dtsi"
|
||||
#include "loongson_panel_param.dtsi"
|
||||
|
||||
/ {
|
||||
model = "LS2K300-ALIENTEK";
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_gpio_leds>;
|
||||
//板载DSO灯
|
||||
led0 {
|
||||
label = "sys-led";
|
||||
gpios = <&gpio 89 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "heartbeat";
|
||||
default-state = "on";
|
||||
status = "okay";
|
||||
};
|
||||
//板载DS1灯
|
||||
led1 {
|
||||
label = "user-led";
|
||||
gpios = <&gpio 70 GPIO_ACTIVE_LOW>;
|
||||
linux,default-trigger = "none";
|
||||
default-state = "on";
|
||||
status = "okay";
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys: gpio_keys@0 {
|
||||
compatible = "gpio-keys";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&pinctrl_gpio_keys>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
autorepeat;
|
||||
//板载KEY2按键
|
||||
key {
|
||||
label = "USER-KEY";
|
||||
linux,code = <114>;
|
||||
gpios = <&gpio 71 GPIO_ACTIVE_LOW>;
|
||||
gpio-key,wakeup;
|
||||
};
|
||||
};
|
||||
|
||||
lcd_backlight: backlight {
|
||||
compatible = "pwm-backlight";
|
||||
pwms = <&pwm2 0 5000000 0>;
|
||||
brightness-levels = <
|
||||
0 1 2 3 4 5 6 7>;
|
||||
default-brightness-level = <6>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
panel: dvo-connector@0 {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
compatible = "panel-lvds", "auo,b101ean01";
|
||||
backlight = <&lcd_backlight>;
|
||||
width-mm = <223>;
|
||||
height-mm = <125>;
|
||||
label = "ATK-MD0700R-1024x600";
|
||||
data-mapping = "jeida-24";
|
||||
|
||||
panel-timing {
|
||||
clock-frequency = <51200000>;
|
||||
hactive = <1024>;
|
||||
vactive = <600>;
|
||||
hsync-len = <20>;
|
||||
hfront-porch = <160>;
|
||||
hback-porch = <140>;
|
||||
vfront-porch = <12>;
|
||||
vback-porch = <20>;
|
||||
vsync-len = <3>;
|
||||
de-active = <1>;
|
||||
hsync-active = <0>;
|
||||
vsync-active = <0>;
|
||||
pixelclk-active = <0>;
|
||||
};
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
dvo_connector_in: endpoint@0 {
|
||||
reg = <0>;
|
||||
remote-endpoint = <&dc_out_rgb0>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
vccio_codec: 3_3V{
|
||||
compatible = "regulator-fixed";
|
||||
regulator-name = "VCC_IO";
|
||||
regulator-min-microvolt = <3300000>;
|
||||
regulator-max-microvolt = <3300000>;
|
||||
regulator-always-on;
|
||||
};
|
||||
|
||||
// 虽然这个时钟在从模式下没用,但 es8388 驱动必须指定这个时钟
|
||||
es8388_clk: es8388-clock {
|
||||
compatible = "fixed-clock";
|
||||
clock-frequency = <12288000>;
|
||||
#clock-cells = <1>;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
&dc {
|
||||
status = "ok"
|
||||
|
||||
ports {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
port@0 {
|
||||
reg = <0>;
|
||||
dc_out_rgb0: endpoint {
|
||||
remote-endpoint = <&dvo_connector_in>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gmac0 {
|
||||
status = "okay";
|
||||
phy-handle = <&yt8511h0>;
|
||||
mdio {
|
||||
compatible = "snps,dwmac-mdio";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
yt8511h0: ethernet-phy@0 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <0>;
|
||||
motorcomm,led0_cfg = <0x40>; //千兆常亮
|
||||
motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮
|
||||
motorcomm,led2_cfg = <0x2600>; //有数据时闪烁
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&gmac1 {
|
||||
status = "okay";
|
||||
phy-handle = <&yt8511h1>;
|
||||
mdio {
|
||||
compatible = "snps,dwmac-mdio";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
yt8511h1: ethernet-phy@1 {
|
||||
compatible = "ethernet-phy-ieee802.3-c22";
|
||||
reg = <0>;
|
||||
motorcomm,led0_cfg = <0x40>; //千兆常亮
|
||||
motorcomm,led1_cfg = <0x30>; //百兆 十兆常亮
|
||||
motorcomm,led2_cfg = <0x2600>; //有数据时闪烁
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
&i2c2 {
|
||||
status = "ok"
|
||||
|
||||
touchpad: gt911@14 {
|
||||
compatible = "goodix,gt911";
|
||||
reg = <0x14>;
|
||||
// 2K300 GPIO 支持中断控制
|
||||
// GPIO 中断号为 vhwirq-base + pinnum (170 = 128 + 42)
|
||||
interrupt-parent = <&gpio>;
|
||||
interrupts = <202 IRQ_TYPE_EDGE_FALLING>;
|
||||
irq-gpios = <&gpio 74 GPIO_ACTIVE_HIGH>;
|
||||
reset-gpios = <&gpio 75 GPIO_ACTIVE_HIGH>;
|
||||
};
|
||||
};
|
||||
|
||||
&i2c3 {
|
||||
status = "ok"
|
||||
//8388音频芯片
|
||||
codec: es8388@11{
|
||||
compatible = "everest,es8388";
|
||||
reg = <0x11>;
|
||||
hp-det-gpio = <&gpio 81 GPIO_ACTIVE_HIGH>;
|
||||
spk-con-gpio = <&gpio 86 GPIO_ACTIVE_HIGH>;
|
||||
hp-con-gpio = <&gpio 87 GPIO_ACTIVE_HIGH>;
|
||||
AVDD-supply = <&vccio_codec>;
|
||||
DVDD-supply = <&vccio_codec>;
|
||||
HPVDD-supply = <&vccio_codec>;
|
||||
PVDD-supply = <&vccio_codec>;
|
||||
clocks = <&es8388_clk 0>;
|
||||
};
|
||||
};
|
||||
|
||||
&uart0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&uart1 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&pwm2 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&can0 {
|
||||
ls,canfd-stb-gpio = <&gpio 62 GPIO_ACTIVE_HIGH>;
|
||||
status = "okay";
|
||||
//status = "disabled";
|
||||
};
|
||||
|
||||
|
||||
&adc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&rtc0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sdio1 {
|
||||
pinctrl-0 = <&sdio1_pins>;
|
||||
pinctrl-names = "default";
|
||||
cap-sd-highspeed;
|
||||
cap-mmc-highspeed;
|
||||
bus-width = <4>;
|
||||
cd-gpios = <&gpio 63 GPIO_ACTIVE_LOW>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&audio {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&sound {
|
||||
status = "okay";
|
||||
loongson,audio-codec = <&codec>;
|
||||
// Easy Compatible for asound.state Configure
|
||||
loongson,sound-card-name = "ES8388";
|
||||
};
|
||||
|
||||
&pinmux{
|
||||
/*/驱动GPIO子系统实验
|
||||
pinctrl_gpio_62: pinmux_G62_as_gpio {
|
||||
pinctrl-single,bits = <0xc 0x00000000 0x30000000>;
|
||||
};
|
||||
*/
|
||||
|
||||
//DS0和DS1复用为GPIO
|
||||
pinctrl_gpio_leds: pinmux_G70-G89_as_gpio {
|
||||
pinctrl-single,bits = <0x10 0x00000000 0x00003000
|
||||
0x14 0x00000000 0x000c0000>;
|
||||
};
|
||||
|
||||
//KEY2复用为GPIO
|
||||
pinctrl_gpio_keys: pinmux_G71_as_gpio {
|
||||
pinctrl-single,bits = <0x10 0x00000000 0x0000c000>;
|
||||
};
|
||||
};
|
||||
|
||||
&otg {
|
||||
dr_mode = "otg";
|
||||
};
|
||||
@@ -71,6 +71,7 @@ CONFIG_CMDLINE_PARTITION=y
|
||||
CONFIG_ZSWAP=y
|
||||
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y
|
||||
CONFIG_ZBUD=y
|
||||
CONFIG_SLAB_FREELIST_RANDOM=y
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_SPARSEMEM_MANUAL=y
|
||||
CONFIG_PAGE_REPORTING=y
|
||||
|
||||
@@ -71,6 +71,7 @@ CONFIG_CMDLINE_PARTITION=y
|
||||
CONFIG_ZSWAP=y
|
||||
CONFIG_ZSWAP_COMPRESSOR_DEFAULT_ZSTD=y
|
||||
CONFIG_ZBUD=y
|
||||
CONFIG_SLAB_FREELIST_RANDOM=y
|
||||
# CONFIG_COMPAT_BRK is not set
|
||||
CONFIG_SPARSEMEM_MANUAL=y
|
||||
CONFIG_PAGE_REPORTING=y
|
||||
|
||||
@@ -114,6 +114,7 @@ extern u32 __dtb_ls2p500_gbkpjm0_v10_begin[];
|
||||
extern u32 __dtb_ls2k300_mini_dp_begin[];
|
||||
extern u32 __dtb_ls2k300_vanguard_pi_begin[];
|
||||
extern u32 __dtb_ls2k300_gongkong_gbkpgk0_begin[];
|
||||
extern u32 __dtb_ls2k300_alientek_begin[];
|
||||
extern char __dtb_start[];
|
||||
extern struct boot_params *efi_bp;
|
||||
extern struct loongson_board_info b_info;
|
||||
|
||||
@@ -309,6 +309,7 @@ char *board_names[] = {
|
||||
"LS2K300-MINI-DP",
|
||||
"LS2K300-PAI",
|
||||
"LS2K300-GONGKONG-GBKPGK0",
|
||||
"LS2K300-ATK-DL2K0300B-V01",
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
@@ -328,6 +329,7 @@ void *fdts[] = {
|
||||
&__dtb_ls2k300_mini_dp_begin,
|
||||
&__dtb_ls2k300_vanguard_pi_begin,
|
||||
&__dtb_ls2k300_gongkong_gbkpgk0_begin,
|
||||
&__dtb_ls2k300_alientek_begin,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
|
||||
@@ -286,6 +286,7 @@ static int pwm_loongson_probe(struct platform_device *pdev)
|
||||
struct device_node *np = dev->of_node;
|
||||
u32 of_clk_freq = 0;
|
||||
u32 irq;
|
||||
u32 init_polarity = 0;
|
||||
|
||||
irq = platform_get_irq(pdev, 0);
|
||||
dev_info(dev, "irq get:%u\n", irq);
|
||||
@@ -321,6 +322,7 @@ static int pwm_loongson_probe(struct platform_device *pdev)
|
||||
#ifdef CONFIG_OF
|
||||
if (!of_property_read_u32(np, "clock-frequency", &of_clk_freq))
|
||||
ddata->clk_rate = of_clk_freq;
|
||||
of_property_read_u32(np, "init-polarity", &init_polarity);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -339,6 +341,13 @@ static int pwm_loongson_probe(struct platform_device *pdev)
|
||||
chip->atomic = true;
|
||||
dev_set_drvdata(dev, chip);
|
||||
|
||||
pwm_loongson_set_polarity(chip, NULL, init_polarity ? PWM_POLARITY_INVERSED : PWM_POLARITY_NORMAL);
|
||||
if (init_polarity) {
|
||||
pwm_loongson_config(chip, NULL, 0, 100000);
|
||||
pwm_loongson_enable(chip, NULL);
|
||||
pwm_loongson_disable(chip, NULL);
|
||||
}
|
||||
|
||||
ret = devm_pwmchip_add(dev, chip);
|
||||
if (ret < 0)
|
||||
return dev_err_probe(dev, ret, "failed to add PWM chip\n");
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define LOONGSON2_THSENS_CTRL_LOW_REG 0x8
|
||||
#define LOONGSON2_THSENS_STATUS_REG 0x10
|
||||
#define LOONGSON2_THSENS_OUT_REG 0x14
|
||||
#define LOONGSON2_THSENS_CFG_REG 0x18
|
||||
|
||||
#define LOONGSON2_THSENS_INT_LO BIT(0)
|
||||
#define LOONGSON2_THSENS_INT_HIGH BIT(1)
|
||||
@@ -100,7 +101,29 @@ static int loongson2_2k1000_get_temp(struct thermal_zone_device *tz, int *temp)
|
||||
|
||||
val = readl(data->ctrl_reg + LOONGSON2_THSENS_OUT_REG);
|
||||
if (cur_id == ID_2K300) {
|
||||
temp_val = ((val & 0x7ff) * 569) - 394700;
|
||||
int version;
|
||||
int val_fix;
|
||||
u32 reg_val;
|
||||
writel(0xff03, data->ctrl_reg + LOONGSON2_THSENS_CFG_REG); // 0x18
|
||||
reg_val = readl(data->ctrl_reg + LOONGSON2_THSENS_OUT_REG);
|
||||
reg_val &= 0x7ff;
|
||||
|
||||
version = readl(data->ctrl_reg + 0x2AF0); // 0x16003ff0
|
||||
version >>= 4;
|
||||
version &= 1;
|
||||
|
||||
if(version)
|
||||
val_fix = readl(data->ctrl_reg + 0x2AF4) & 0xffff; // 0x16003ff4
|
||||
else
|
||||
val_fix = (readl(data->ctrl_reg + 0x2AF0) >> 20) & 0xffff; // 0x16003ff0
|
||||
|
||||
if (val_fix & 0x8000)
|
||||
val_fix = -(val_fix & 0x7fff);
|
||||
else
|
||||
val_fix = val_fix & 0x7fff;
|
||||
|
||||
reg_val += val_fix;
|
||||
temp_val = reg_val * 570 - 394700;
|
||||
/*
|
||||
* fix old 2k300 use old fuse that will let kernel crash critical temperature
|
||||
*/
|
||||
@@ -116,9 +139,14 @@ static int loongson2_2k1000_get_temp(struct thermal_zone_device *tz, int *temp)
|
||||
old_fuse_2k300 = 1;
|
||||
temp_val = 125000;
|
||||
}
|
||||
if (!warning_2k300_old_fuse_tip && old_fuse_2k300) {
|
||||
pr_err("%s this 2k300 use old fuse so thermal not right!(%d)\n", __func__, val);
|
||||
warning_2k300_old_fuse_tip = 1;
|
||||
if (old_fuse_2k300)
|
||||
{
|
||||
if (!warning_2k300_old_fuse_tip) {
|
||||
pr_err("%s this 2k300 use old fuse so thermal not right!(%d)\n", __func__, val);
|
||||
warning_2k300_old_fuse_tip = 1;
|
||||
}
|
||||
val = readl(data->ctrl_reg + LOONGSON2_THSENS_OUT_REG);
|
||||
temp_val = ((val & 0x7ff) * 569) - 394700;
|
||||
}
|
||||
*temp = temp_val;
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user