arch/arm/mach-pxa/sharpsl_pm.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-pxa/sharpsl_pm.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-pxa/sharpsl_pm.c- Extension
.c- Size
- 25556 bytes
- Lines
- 942
- Domain
- Architecture Layer
- Bucket
- arch/arm
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/interrupt.hlinux/platform_device.hlinux/apm-emulation.hlinux/timer.hlinux/delay.hlinux/leds.hlinux/suspend.hlinux/gpio.hlinux/io.hasm/mach-types.hpm.hpxa2xx-regs.hregs-rtc.hsharpsl_pm.h
Detected Declarations
function sharpsl_pm_pxa_read_max1111function get_percentagefunction get_apm_statusfunction sharpsl_battery_kickfunction sharpsl_battery_threadfunction sharpsl_pm_ledfunction sharpsl_charge_onfunction sharpsl_charge_offfunction sharpsl_charge_errorfunction sharpsl_charge_togglefunction sharpsl_ac_timerfunction sharpsl_ac_isrfunction sharpsl_chrg_full_timerfunction sharpsl_chrg_full_isrfunction sharpsl_fatal_isrfunction sharpsl_average_clearfunction sharpsl_average_valuefunction get_select_valfunction sharpsl_check_battery_tempfunction sharpsl_check_battery_voltagefunction sharpsl_ac_checkfunction sharpsl_pm_suspendfunction sharpsl_pm_resumefunction corgi_goto_sleepfunction corgi_enter_suspendfunction corgi_pxa_pm_enterfunction sharpsl_off_charge_errorfunction sharpsl_off_charge_batteryfunction battery_percentage_showfunction battery_voltage_showfunction sharpsl_apm_get_power_statusfunction sharpsl_pm_probefunction sharpsl_pm_removefunction sharpsl_pm_initfunction sharpsl_pm_exit
Annotated Snippet
if (temp < val[i]) {
temp = val[i];
j = i;
}
}
/* Find MIN val */
temp = val[4];
k = 4;
for (i = 3; i >= 0; i--) {
if (temp > val[i]) {
temp = val[i];
k = i;
}
}
for (i = 0; i < 5; i++)
if (i != j && i != k)
sum += val[i];
dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]);
return sum/3;
}
static int sharpsl_check_battery_temp(void)
{
int val, i, buff[5];
/* Check battery temperature */
for (i = 0; i < 5; i++) {
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
sharpsl_pm.machinfo->measure_temp(1);
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_TEMP);
sharpsl_pm.machinfo->measure_temp(0);
}
val = get_select_val(buff);
dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
if (val > sharpsl_pm.machinfo->charge_on_temp) {
printk(KERN_WARNING "Not charging: temperature out of limits.\n");
return -1;
}
return 0;
}
#ifdef CONFIG_PM
static int sharpsl_check_battery_voltage(void)
{
int val, i, buff[5];
/* disable charge, enable discharge */
sharpsl_pm.machinfo->charge(0);
sharpsl_pm.machinfo->discharge(1);
mdelay(SHARPSL_WAIT_DISCHARGE_ON);
if (sharpsl_pm.machinfo->discharge1)
sharpsl_pm.machinfo->discharge1(1);
/* Check battery voltage */
for (i = 0; i < 5; i++) {
buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
}
if (sharpsl_pm.machinfo->discharge1)
sharpsl_pm.machinfo->discharge1(0);
sharpsl_pm.machinfo->discharge(0);
val = get_select_val(buff);
dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val);
if (val < sharpsl_pm.machinfo->charge_on_volt)
return -1;
return 0;
}
#endif
static int sharpsl_ac_check(void)
{
int temp, i, buff[5];
for (i = 0; i < 5; i++) {
buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT);
mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/interrupt.h`, `linux/platform_device.h`, `linux/apm-emulation.h`, `linux/timer.h`, `linux/delay.h`, `linux/leds.h`.
- Detected declarations: `function sharpsl_pm_pxa_read_max1111`, `function get_percentage`, `function get_apm_status`, `function sharpsl_battery_kick`, `function sharpsl_battery_thread`, `function sharpsl_pm_led`, `function sharpsl_charge_on`, `function sharpsl_charge_off`, `function sharpsl_charge_error`, `function sharpsl_charge_toggle`.
- Atlas domain: Architecture Layer / arch/arm.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.