Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
cadd349
FROMLIST: USB: core: Enable root_hub's remote wakeup for wakeup sources
chenhuacai Jan 31, 2025
10216f8
FROMLIST: PCI: Use local_pci_probe() when best selected cpu is offline
May 11, 2025
6d701d8
FROMLIST: PCI: Prevent LS7A Bus Master clearing on kexec
chenhuacai May 11, 2025
97a3cbe
REVERT: Revert "Mark xe driver as BROKEN if kernel page size is not 4kB"
MingcongBai Aug 17, 2025
fe40958
BACKPORT: FROMLIST: drm/xe/bo: fix alignment with non-4K kernel page …
MingcongBai Feb 26, 2025
9f71265
BACKPORT: FROMLIST: drm/xe/guc: use SZ_4K for alignment
MingcongBai Feb 26, 2025
f2cb31b
BACKPORT: FROMLIST: drm/xe/regs: fix RING_CTL_SIZE(size) calculation
MingcongBai Feb 26, 2025
ea7ebab
FROMLIST: drm/xe: use 4K alignment for cursor jumps
MingcongBai Feb 26, 2025
0e5b345
FROMLIST: drm/xe/query: use PAGE_SIZE as the minimum page alignment
MingcongBai Feb 26, 2025
1fb90b5
FROMLIST: RFC: drm/amdkfd: disable HSA_AMD_SVM on LoongArch and AArch64
MingcongBai Aug 14, 2025
e54efff
BACKPORT: FROMLIST: drm/ttm: save the device's DMA coherency status i…
Icenowy Jun 29, 2024
14eaf85
BACKPORT: FROMLIST: drm/ttm: downgrade cached to write_combined when …
Icenowy Jun 29, 2024
9dd3db8
FROMLIST: LoongArch: KVM: Get VM PMU capability from HW GCFG register
bibo-mao Sep 30, 2025
628c460
FROMLIST: Input: atkbd - skip deactivate for HONOR FMB-P's internal k…
Cryolitia Oct 22, 2025
c3a2a59
FROMLIST: gpio: loongson-64bit: Switch to dynamic allocate GPIO base …
AaronDot Oct 23, 2025
d94fd8b
FROMLIST: net: stmmac: Add generic suspend/resume helper for PCI-base…
ziyao233 Nov 24, 2025
05b1e26
FROMLIST: net: stmmac: loongson: Use generic PCI suspend/resume routines
ziyao233 Nov 24, 2025
ecadf77
FROMLIST: net: stmmac: pci: Use generic PCI suspend/resume routines
ziyao233 Nov 24, 2025
1afd5d7
FROMLIST: Input: Add driver for PixArt PS/2 touchpad
AaronDot Nov 27, 2025
2d05c11
FROMLIST: loongarch: retrieve CPU package ID from PPTT when available
CSharperMantle Jan 23, 2026
becc130
BACKPORT: FROMLIST: ACPI: PCI: check if the root io space is page ali…
shankerwangmiao Aug 14, 2024
fd72100
FROMLIST: PCI/MSI: Conservatively generalize no_64bit_msi into msi_ad…
dramforever Jan 23, 2026
f59f6fb
FROMLIST: PCI/MSI: Check msi_addr_mask in msi_verify_entries()
dramforever Jan 23, 2026
48cec9d
FROMLIST: drm/radeon: Raise msi_addr_mask to dma_bits
dramforever Jan 23, 2026
7159de9
FROMLIST: ALSA: hda/intel: Raise msi_addr_mask to dma_bits
dramforever Jan 23, 2026
0e2b304
FROMLIST: drm/amd/display: Wrap dcn32_override_min_req_memclk() in DC…
xry111 Mar 6, 2026
d2974b4
LOONGSON: irqchip/loongson-eiointc: Improve IRQ affinity setting
chenhuacai Nov 9, 2022
60c6578
LOONGSON: LoongArch: Add CPU HWMon platform driver
chenhuacai Oct 29, 2020
1e87f30
LOONGSON: drivers/firmware: Move sysfb_init() from device_initcall to…
chenhuacai Jan 28, 2024
69f5754
LOONGSON: drm/ast: Restore vaddr field to struct ast_plane
chenhuacai May 29, 2025
b5d5d6b
LOONGSON: drm/ast: Support both SHMEM helper and VRAM helper
chenhuacai Feb 28, 2025
e9b46e1
AOSCOS: ast: Drop drm_gem_vram_{,un}pin calls
xry111 Aug 26, 2025
4580db9
BACKPORT: UBUNTU: SAUCE: iommu/intel: disable DMAR for SKL integrated…
acelan Aug 12, 2024
d981d49
BACKPORT: UBUNTU: SAUCE: iommu/intel: disable DMAR for KBL and CML in…
acelan Nov 18, 2024
1b9f2ff
BACKPORT: DEEPIN: pci/quirks: LS7A2000: Fix pm transition of devices …
AaronDot Feb 14, 2025
6a52a3f
SURFACE: (surface3-oemb) add DMI matches for Surface 3 with broken DM…
kitakar5525 Oct 18, 2020
3dd183f
SURFACE: surface3-spi: workaround: disable DMA mode to avoid crash by…
kitakar5525 Dec 6, 2019
6291c6e
SURFACE: mwifiex: Add quirk resetting the PCI bridge on MS Surface de…
jonas2515 Nov 3, 2020
f519e13
SURFACE: mwifiex: pcie: disable bridge_d3 for Surface gen4+
kitakar5525 Oct 3, 2020
50353b5
BACKPORT: SURFACE: Bluetooth: btusb: Lower passive lescan interval on…
jonas2515 Mar 25, 2021
b8eec8d
SURFACE: ath10k: Add module parameters to override board files
qzed Feb 26, 2021
d72bbbf
SURFACE: mei: me: Add Icelake device ID for iTouch
StollD Jul 30, 2020
9a3ff4c
BACKPORT: SURFACE: iommu: Use IOMMU passthrough mode for IPTS
Apr 12, 2022
dc1b787
SURFACE: hid: Add support for Intel Precise Touch and Stylus
StollD Dec 11, 2022
14ae745
SURFACE: iommu: intel: Disable source id verification for ITHC
StollD Dec 11, 2022
7396910
SURFACE: hid: Add support for Intel Touch Host Controller
quo Dec 11, 2022
1073523
SURFACE: rtc: Add basic support for RTC via Surface System Aggregator…
qzed Jun 17, 2022
5d436bd
SURFACE: platform/surface: aggregator_registry: Add Surface Laptop 7 …
qzed Apr 19, 2025
c8052a8
SURFACE: i2c: acpi: Implement RawBytes read access
qzed Jul 25, 2020
f807898
SURFACE: platform/surface: Add driver for Surface Book 1 dGPU switch
qzed Feb 13, 2021
759de4f
SURFACE: Input: soc_button_array - support AMD variant Surface devices
nakato Oct 4, 2021
3e64440
SURFACE: platform/surface: surfacepro3_button: don't load on amd variant
nakato Oct 4, 2021
c9037cb
SURFACE: USB: quirks: Add USB_QUIRK_DELAY_INIT for Surface Go 3 Type-…
qzed Feb 18, 2023
b8b794f
SURFACE: hid/multitouch: Turn off Type Cover keyboard backlight when …
jonas2515 Nov 5, 2020
f3720d4
BACKPORT: SURFACE: hid/multitouch: Add support for surface pro type c…
pjungkamp Feb 25, 2022
253a8af
BACKPORT: SURFACE: PCI: Add quirk to prevent calling shutdown method
qzed Feb 19, 2023
405d2b9
SURFACE: platform/surface: gpe: Add support for Surface Pro 9
qzed Mar 12, 2023
0f91652
SURFACE: ACPI: delay enumeration of devices with a _DEP pointing to a…
jwrdegoede Oct 10, 2021
38276ed
BACKPORT: SURFACE: iommu: intel-ipu: use IOMMU passthrough mode for I…
zouxiaoh Jun 25, 2021
f5ac0b4
SURFACE: platform/x86: int3472: Enable I2c daisy chain
djrscally Oct 10, 2021
fce00f8
SURFACE: media: i2c: Clarify that gain is Analogue gain in OV7251
djrscally Mar 21, 2023
5d712d4
SURFACE: media: v4l2-core: Acquire privacy led in v4l2_async_register…
djrscally Mar 22, 2023
f3858f1
SURFACE: platform: x86: int3472: Add MFD cell for tps68470 LED
Mar 21, 2023
3b9b89e
SURFACE: include: mfd: tps68470: Add masks for LEDA and LEDB
Mar 21, 2023
4c598d2
SURFACE: leds: tps68470: Add LED control for tps68470
Mar 21, 2023
7d3bbc3
SURFACE: media: i2c: dw9719: fix probe error on surface go 2
mojyack Mar 25, 2024
d65a81a
SURFACE: ACPI: Add quirk for Surface Laptop 4 AMD missing irq 7 override
nakato May 29, 2021
0a5483b
SURFACE: ACPI: Add AMD 13" Surface Laptop 4 model to irq 7 override q…
qzed Jun 3, 2021
8a60657
BACKPORT: SURFACE: acpi: allow usage of acpi_tad on HW-reduced platforms
groengpx Dec 5, 2022
385032d
AOSCOS: drm: amdgpu: use amdgpu by default for si/cik devices
MingcongBai Sep 21, 2024
f9622b5
AOSCOS: Revert "rcu: Fix rcu_barrier() VS post CPUHP_TEARDOWN_CPU inv…
MingcongBai Oct 15, 2024
469374b
AOSCOS: drm: loongson: add ls7a1000_support module parameter
MingcongBai Oct 29, 2024
7c5de85
AOSCOS: platform/x86: hp-wmi: Mark 8BAB board for OMEN thermal profile
MingcongBai Nov 2, 2024
f9b30d1
AOSCOS: drm: amdgpu: disable ABM (Adaptive Backlight Management) by d…
MingcongBai Oct 24, 2024
b1536e7
AOSCOS: drm: loongson: add ls7a2000_support module parameter
MingcongBai Jan 19, 2025
18f8d44
FROMLIST: drm/radeon: Call mmiowb() at the end of radeon_ring_commit()
chenhuacai Feb 20, 2024
ca5928d
AOSCOS: drm/radeon: limit mmiowb() hack for radeon_ring_commit() to M…
MingcongBai Feb 24, 2025
2f80022
AOSCOS: USB: core: only enable root_hub wakeup on MACH_LOONGSON64
MingcongBai Feb 26, 2025
27a096f
AOSCOS: gpio: loongson-64bit: Add LS7A GPIO interrupt support
xry111 Jun 21, 2025
c2208d3
AOSCOS: ACPI / scan: Add pwm_lookup_entry for PWM3 on LS7A
xry111 Aug 16, 2025
cfc96c5
AOSCOS: scsi: dc395x: correctly discard the return value in certain r…
Cyanoxygen Sep 10, 2025
87b5a56
AOSCOS: crypto: padlock-sha: return -ENODEV on Zhaoxin KaiXian KX-600…
MingcongBai Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions arch/loongarch/include/asm/kvm_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ struct kvm_arch {
struct kvm_phyid_map *phyid_map;
/* Enabled PV features */
unsigned long pv_features;
/* Supported features from KVM */
unsigned long support_features;

s64 time_offset;
struct kvm_context __percpu *vmcs;
Expand Down Expand Up @@ -293,6 +295,12 @@ static inline int kvm_get_pmu_num(struct kvm_vcpu_arch *arch)
return (arch->cpucfg[6] & CPUCFG6_PMNUM) >> CPUCFG6_PMNUM_SHIFT;
}

/* Check whether KVM support this feature, however VMM may disable it */
static inline bool kvm_vm_support(struct kvm_arch *arch, int feature)
{
return !!(arch->support_features & BIT_ULL(feature));
}

bool kvm_arch_pmi_in_guest(struct kvm_vcpu *vcpu);

/* Debug: dump vcpu state */
Expand Down
2 changes: 2 additions & 0 deletions arch/loongarch/include/asm/loongarch.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
#define CSR_GCFG_GPERF_SHIFT 24
#define CSR_GCFG_GPERF_WIDTH 3
#define CSR_GCFG_GPERF (_ULCAST_(0x7) << CSR_GCFG_GPERF_SHIFT)
#define CSR_GCFG_GPMP_SHIFT 23
#define CSR_GCFG_GPMP (_ULCAST_(0x1) << CSR_GCFG_GPMP_SHIFT)
#define CSR_GCFG_GCI_SHIFT 20
#define CSR_GCFG_GCI_WIDTH 2
#define CSR_GCFG_GCI (_ULCAST_(0x3) << CSR_GCFG_GCI_SHIFT)
Expand Down
9 changes: 8 additions & 1 deletion arch/loongarch/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ int pptt_enabled;

int __init parse_acpi_topology(void)
{
int cpu, topology_id;
int cpu, topology_id, package_id;

for_each_possible_cpu(cpu) {
topology_id = find_acpi_cpu_topology(cpu, 0);
Expand All @@ -194,6 +194,13 @@ int __init parse_acpi_topology(void)

cpu_data[cpu].core = topology_id;
}

package_id = find_acpi_cpu_topology_package(cpu);
if (package_id < 0) {
pr_warn("Invalid BIOS PPTT\n");
return -ENOENT;
}
cpu_data[cpu].package = package_id;
}

pptt_enabled = 1;
Expand Down
2 changes: 1 addition & 1 deletion arch/loongarch/kernel/smp.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void loongson_init_secondary(void)
numa_add_cpu(cpu);
#endif
per_cpu(cpu_state, cpu) = CPU_ONLINE;
cpu_data[cpu].package =
cpu_data[cpu].package = pptt_enabled ? cpu_data[cpu].package :
cpu_logical_map(cpu) / loongson_sysconf.cores_per_package;
cpu_data[cpu].core = pptt_enabled ? cpu_data[cpu].core :
cpu_logical_map(cpu) % loongson_sysconf.cores_per_package;
Expand Down
30 changes: 20 additions & 10 deletions arch/loongarch/kvm/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <linux/kvm_host.h>
#include <asm/kvm_mmu.h>
#include <asm/kvm_vcpu.h>
#include <asm/kvm_csr.h>
#include <asm/kvm_eiointc.h>
#include <asm/kvm_pch_pic.h>

Expand All @@ -24,6 +25,23 @@ const struct kvm_stats_header kvm_vm_stats_header = {
sizeof(kvm_vm_stats_desc),
};

static void kvm_vm_init_features(struct kvm *kvm)
{
unsigned long val;

/* Enable all PV features by default */
kvm->arch.pv_features = BIT(KVM_FEATURE_IPI);
kvm->arch.support_features = BIT(KVM_LOONGARCH_VM_FEAT_PV_IPI);
if (kvm_pvtime_supported()) {
kvm->arch.pv_features |= BIT(KVM_FEATURE_STEAL_TIME);
kvm->arch.support_features |= BIT(KVM_LOONGARCH_VM_FEAT_PV_STEALTIME);
}

val = read_csr_gcfg();
if (val & CSR_GCFG_GPMP)
kvm->arch.support_features |= BIT(KVM_LOONGARCH_VM_FEAT_PMU);
}

int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
{
int i;
Expand All @@ -42,11 +60,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
spin_lock_init(&kvm->arch.phyid_map_lock);

kvm_init_vmcs(kvm);

/* Enable all PV features by default */
kvm->arch.pv_features = BIT(KVM_FEATURE_IPI);
if (kvm_pvtime_supported())
kvm->arch.pv_features |= BIT(KVM_FEATURE_STEAL_TIME);
kvm_vm_init_features(kvm);

/*
* cpu_vabits means user address space only (a half of total).
Expand Down Expand Up @@ -137,13 +151,9 @@ static int kvm_vm_feature_has_attr(struct kvm *kvm, struct kvm_device_attr *attr
return 0;
return -ENXIO;
case KVM_LOONGARCH_VM_FEAT_PMU:
if (cpu_has_pmp)
return 0;
return -ENXIO;
case KVM_LOONGARCH_VM_FEAT_PV_IPI:
return 0;
case KVM_LOONGARCH_VM_FEAT_PV_STEALTIME:
if (kvm_pvtime_supported())
if (kvm_vm_support(&kvm->arch, attr->attr))
return 0;
return -ENXIO;
case KVM_LOONGARCH_VM_FEAT_PTW:
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powernv/pci-ioda.c
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ static int __pnv_pci_ioda_msi_setup(struct pnv_phb *phb, struct pci_dev *dev,
return -ENXIO;

/* Force 32-bit MSI on some broken devices */
if (dev->no_64bit_msi)
if (dev->msi_addr_mask < DMA_BIT_MASK(64))
is_64 = 0;

/* Assign XIVE to PE */
Expand Down
4 changes: 2 additions & 2 deletions arch/powerpc/platforms/pseries/msi.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ static int rtas_prepare_msi_irqs(struct pci_dev *pdev, int nvec_in, int type,
*/
again:
if (type == PCI_CAP_ID_MSI) {
if (pdev->no_64bit_msi) {
if (pdev->msi_addr_mask < DMA_BIT_MASK(64)) {
rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSI_FN, nvec);
if (rc < 0) {
/*
Expand All @@ -414,7 +414,7 @@ static int rtas_prepare_msi_irqs(struct pci_dev *pdev, int nvec_in, int type,
if (use_32bit_msi_hack && rc > 0)
rtas_hack_32bit_msi_gen2(pdev);
} else {
if (pdev->no_64bit_msi)
if (pdev->msi_addr_mask < DMA_BIT_MASK(64))
rc = rtas_change_msi(pdn, RTAS_CHANGE_32MSIX_FN, nvec);
else
rc = rtas_change_msi(pdn, RTAS_CHANGE_MSIX_FN, nvec);
Expand Down
24 changes: 24 additions & 0 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/efi-bgrt.h>
#include <linux/serial_core.h>
#include <linux/pgtable.h>
#include <linux/dmi.h>

#include <xen/xen.h>

Expand Down Expand Up @@ -1175,6 +1176,24 @@ static void __init mp_config_acpi_legacy_irqs(void)
}
}

static const struct dmi_system_id surface_quirk[] __initconst = {
{
.ident = "Microsoft Surface Laptop 4 (AMD 15\")",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
DMI_MATCH(DMI_PRODUCT_SKU, "Surface_Laptop_4_1952:1953")
},
},
{
.ident = "Microsoft Surface Laptop 4 (AMD 13\")",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
DMI_MATCH(DMI_PRODUCT_SKU, "Surface_Laptop_4_1958:1959")
},
},
{}
};

/*
* Parse IOAPIC related entries in MADT
* returns 0 on success, < 0 on error
Expand Down Expand Up @@ -1231,6 +1250,11 @@ static int __init acpi_parse_madt_ioapic_entries(void)
acpi_sci_ioapic_setup(acpi_gbl_FADT.sci_interrupt, 0, 0,
acpi_gbl_FADT.sci_interrupt);

if (dmi_check_system(surface_quirk)) {
pr_warn("Surface hack: Override irq 7\n");
mp_override_legacy_irq(7, 3, 3, 7);
}

/* Fill in identity legacy mappings where no override */
mp_config_acpi_legacy_irqs();

Expand Down
1 change: 1 addition & 0 deletions drivers/acpi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ obj-$(CONFIG_ACPI_VIOT) += viot.o

obj-$(CONFIG_RISCV) += riscv/
obj-$(CONFIG_X86) += x86/
obj-$(CONFIG_LOONGARCH) += loongarch/
36 changes: 24 additions & 12 deletions drivers/acpi/acpi_tad.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,14 @@ static ssize_t caps_show(struct device *dev, struct device_attribute *attr,

static DEVICE_ATTR_RO(caps);

static struct attribute *acpi_tad_attrs[] = {
&dev_attr_caps.attr,
NULL,
};
static const struct attribute_group acpi_tad_attr_group = {
.attrs = acpi_tad_attrs,
};

static ssize_t ac_alarm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
Expand Down Expand Up @@ -481,15 +489,14 @@ static ssize_t ac_status_show(struct device *dev, struct device_attribute *attr,

static DEVICE_ATTR_RW(ac_status);

static struct attribute *acpi_tad_attrs[] = {
&dev_attr_caps.attr,
static struct attribute *acpi_tad_ac_attrs[] = {
&dev_attr_ac_alarm.attr,
&dev_attr_ac_policy.attr,
&dev_attr_ac_status.attr,
NULL,
};
static const struct attribute_group acpi_tad_attr_group = {
.attrs = acpi_tad_attrs,
static const struct attribute_group acpi_tad_ac_attr_group = {
.attrs = acpi_tad_ac_attrs,
};

static ssize_t dc_alarm_store(struct device *dev, struct device_attribute *attr,
Expand Down Expand Up @@ -568,13 +575,18 @@ static void acpi_tad_remove(struct platform_device *pdev)
if (dd->capabilities & ACPI_TAD_RT)
sysfs_remove_group(&dev->kobj, &acpi_tad_time_attr_group);

if (dd->capabilities & ACPI_TAD_AC_WAKE)
sysfs_remove_group(&dev->kobj, &acpi_tad_ac_attr_group);

if (dd->capabilities & ACPI_TAD_DC_WAKE)
sysfs_remove_group(&dev->kobj, &acpi_tad_dc_attr_group);

sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group);

acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
if (dd->capabilities & ACPI_TAD_AC_WAKE) {
acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
acpi_tad_clear_status(dev, ACPI_TAD_AC_TIMER);
}
if (dd->capabilities & ACPI_TAD_DC_WAKE) {
acpi_tad_disable_timer(dev, ACPI_TAD_DC_TIMER);
acpi_tad_clear_status(dev, ACPI_TAD_DC_TIMER);
Expand Down Expand Up @@ -616,12 +628,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
goto remove_handler;
}

if (!acpi_has_method(handle, "_PRW")) {
dev_info(dev, "Missing _PRW\n");
ret = -ENODEV;
goto remove_handler;
}

dd = devm_kzalloc(dev, sizeof(*dd), GFP_KERNEL);
if (!dd) {
ret = -ENOMEM;
Expand Down Expand Up @@ -652,6 +658,12 @@ static int acpi_tad_probe(struct platform_device *pdev)
if (ret)
goto fail;

if (caps & ACPI_TAD_AC_WAKE) {
ret = sysfs_create_group(&dev->kobj, &acpi_tad_ac_attr_group);
if (ret)
goto fail;
}

if (caps & ACPI_TAD_DC_WAKE) {
ret = sysfs_create_group(&dev->kobj, &acpi_tad_dc_attr_group);
if (ret)
Expand Down
6 changes: 6 additions & 0 deletions drivers/acpi/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ void acpi_lpss_init(void);
static inline void acpi_lpss_init(void) {}
#endif

#if IS_ENABLED(CONFIG_PWM_LOONGSON)
void acpi_ls7a_pwm_init(void);
#else
static inline void acpi_ls7a_pwm_init(void) {}
#endif

void acpi_apd_init(void);

acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src);
Expand Down
3 changes: 3 additions & 0 deletions drivers/acpi/loongarch/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ifdef CONFIG_PWM_LOONGSON
obj-y += acpi-ls7a-backlight.o
endif
42 changes: 42 additions & 0 deletions drivers/acpi/loongarch/acpi-ls7a-backlight.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (C) 2025 Xi Ruoyao <xry111@aosc.io>
*
* ACPI support for devices using LG110 <sarcasm>discrete</sarcasm> graphics
* with LS7A PWM controlling the backlight.
*/

#include <linux/acpi.h>
#include <linux/pwm.h>

#include "../internal.h"

static struct pwm_lookup ls7a_pwm_lookup[] = {
PWM_LOOKUP_WITH_MODULE("LOON0006:03", 0, NULL, "gsgpu_backlight", 0,
PWM_POLARITY_NORMAL, "pwm-loongson"),
};

static int acpi_ls7a_pwm_attach(struct acpi_device *adev,
const struct acpi_device_id *id)
{
if (acpi_dev_uid_match(adev, 3))
pwm_add_table(ls7a_pwm_lookup, ARRAY_SIZE(ls7a_pwm_lookup));

return 0;
}

static const struct acpi_device_id acpi_ls7a_pwm_ids[] = {
{ "LOON0006", 0 },
{ },
};

static struct acpi_scan_handler ls7a_pwm_handler = {
.ids = acpi_ls7a_pwm_ids,
.attach = acpi_ls7a_pwm_attach,
};


void __init acpi_ls7a_pwm_init(void)
{
acpi_scan_add_handler(&ls7a_pwm_handler);
}
14 changes: 11 additions & 3 deletions drivers/acpi/pci_root.c
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ static void acpi_pci_root_validate_resources(struct device *dev,
}
}

static void acpi_pci_root_remap_iospace(const struct fwnode_handle *fwnode,
static void acpi_pci_root_remap_iospace(struct acpi_device *device,
struct resource_entry *entry)
{
#ifdef PCI_IOBASE
Expand All @@ -868,7 +868,15 @@ static void acpi_pci_root_remap_iospace(const struct fwnode_handle *fwnode,
resource_size_t length = resource_size(res);
unsigned long port;

if (pci_register_io_range(fwnode, cpu_addr, length))
if (!PAGE_ALIGNED(cpu_addr) || !PAGE_ALIGNED(length) ||
!PAGE_ALIGNED(pci_addr)) {
dev_err(&device->dev,
FW_BUG "I/O resource %pR or its offset %pa is not page aligned\n",
res, &entry->offset);
goto err;
}

if (pci_register_io_range(&device->fwnode, cpu_addr, length))
goto err;

port = pci_address_to_pio(cpu_addr);
Expand Down Expand Up @@ -911,7 +919,7 @@ int acpi_pci_probe_root_resources(struct acpi_pci_root_info *info)
resource_list_for_each_entry_safe(entry, tmp, list) {
acpi_arch_pci_probe_root_dev_filter(entry);
if (entry->res->flags & IORESOURCE_IO)
acpi_pci_root_remap_iospace(&device->fwnode,
acpi_pci_root_remap_iospace(device,
entry);

if (entry->res->flags & IORESOURCE_DISABLED)
Expand Down
4 changes: 4 additions & 0 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2205,6 +2205,9 @@ static acpi_status acpi_bus_check_add_2(acpi_handle handle, u32 lvl_not_used,

static void acpi_default_enumeration(struct acpi_device *device)
{
if (!acpi_dev_ready_for_enumeration(device))
return;

/*
* Do not enumerate devices with enumeration_by_parent flag set as
* they will be enumerated by their respective parents.
Expand Down Expand Up @@ -2713,6 +2716,7 @@ void __init acpi_scan_init(void)
acpi_power_resources_init();
acpi_int340x_thermal_init();
acpi_init_lpit();
acpi_ls7a_pwm_init();

acpi_scan_add_handler(&generic_device_handler);

Expand Down
Loading
Loading