You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branches 'acpica', 'bgrt', 'bz-11533', 'cpuidle', 'ec', 'hotplug', 'misc', 'red-hat-bz-727865', 'thermal', 'throttling', 'turbostat' and 'video' into release
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
@@ -1,3 +1,23 @@
|
||||
What: /sys/firmware/acpi/bgrt/
|
||||
Date: January 2012
|
||||
Contact: Matthew Garrett <mjg@redhat.com>
|
||||
Description:
|
||||
The BGRT is an ACPI 5.0 feature that allows the OS
|
||||
to obtain a copy of the firmware boot splash and
|
||||
some associated metadata. This is intended to be used
|
||||
by boot splash applications in order to interact with
|
||||
the firmware boot splash in order to avoid jarring
|
||||
transitions.
|
||||
|
||||
image: The image bitmap. Currently a 32-bit BMP.
|
||||
status: 1 if the image is valid, 0 if firmware invalidated it.
|
||||
type: 0 indicates image is in BMP format.
|
||||
version: The version of the BGRT. Currently 1.
|
||||
xoffset: The number of pixels between the left of the screen
|
||||
and the left edge of the image.
|
||||
yoffset: The number of pixels between the top of the screen
|
||||
and the top edge of the image.
|
||||
|
||||
What: /sys/firmware/acpi/interrupts/
|
||||
Date: February 2008
|
||||
Contact: Len Brown <lenb@kernel.org>
|
||||
|
||||
@@ -36,6 +36,7 @@ drwxr-xr-x 2 root root 0 Feb 8 10:42 state3
|
||||
/sys/devices/system/cpu/cpu0/cpuidle/state0:
|
||||
total 0
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
|
||||
-rw-r--r-- 1 root root 4096 Feb 8 10:42 disable
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 name
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 power
|
||||
@@ -45,6 +46,7 @@ total 0
|
||||
/sys/devices/system/cpu/cpu0/cpuidle/state1:
|
||||
total 0
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
|
||||
-rw-r--r-- 1 root root 4096 Feb 8 10:42 disable
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 name
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 power
|
||||
@@ -54,6 +56,7 @@ total 0
|
||||
/sys/devices/system/cpu/cpu0/cpuidle/state2:
|
||||
total 0
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
|
||||
-rw-r--r-- 1 root root 4096 Feb 8 10:42 disable
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 name
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 power
|
||||
@@ -63,6 +66,7 @@ total 0
|
||||
/sys/devices/system/cpu/cpu0/cpuidle/state3:
|
||||
total 0
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 desc
|
||||
-rw-r--r-- 1 root root 4096 Feb 8 10:42 disable
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 latency
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 name
|
||||
-r--r--r-- 1 root root 4096 Feb 8 10:42 power
|
||||
@@ -72,6 +76,7 @@ total 0
|
||||
|
||||
|
||||
* desc : Small description about the idle state (string)
|
||||
* disable : Option to disable this idle state (bool)
|
||||
* latency : Latency to exit out of this idle state (in microseconds)
|
||||
* name : Name of the idle state (string)
|
||||
* power : Power consumed while in this idle state (in milliwatts)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef __ASM_ARM_CPUIDLE_H
|
||||
#define __ASM_ARM_CPUIDLE_H
|
||||
|
||||
#ifdef CONFIG_CPU_IDLE
|
||||
extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index);
|
||||
#else
|
||||
static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index) { return -ENODEV; }
|
||||
#endif
|
||||
|
||||
/* Common ARM WFI state */
|
||||
#define ARM_CPUIDLE_WFI_STATE_PWR(p) {\
|
||||
.enter = arm_cpuidle_simple_enter,\
|
||||
.exit_latency = 1,\
|
||||
.target_residency = 1,\
|
||||
.power_usage = p,\
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID,\
|
||||
.name = "WFI",\
|
||||
.desc = "ARM WFI",\
|
||||
}
|
||||
|
||||
/*
|
||||
* in case power_specified == 1, give a default WFI power value needed
|
||||
* by some governors
|
||||
*/
|
||||
#define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX)
|
||||
|
||||
#endif
|
||||
@@ -21,7 +21,7 @@ obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
|
||||
|
||||
obj-$(CONFIG_LEDS) += leds.o
|
||||
obj-$(CONFIG_OC_ETM) += etm.o
|
||||
|
||||
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
|
||||
obj-$(CONFIG_ISA_DMA_API) += dma.o
|
||||
obj-$(CONFIG_ARCH_ACORN) += ecard.o
|
||||
obj-$(CONFIG_FIQ) += fiq.o fiqasm.o
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright 2012 Linaro Ltd.
|
||||
*
|
||||
* The code contained herein is licensed under the GNU General Public
|
||||
* License. You may obtain a copy of the GNU General Public License
|
||||
* Version 2 or later at the following locations:
|
||||
*
|
||||
* http://www.opensource.org/licenses/gpl-license.html
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*/
|
||||
|
||||
#include <linux/cpuidle.h>
|
||||
#include <asm/proc-fns.h>
|
||||
|
||||
int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv, int index)
|
||||
{
|
||||
cpu_do_idle();
|
||||
|
||||
return index;
|
||||
}
|
||||
@@ -17,9 +17,10 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/cpuidle.h>
|
||||
#include <asm/proc-fns.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/export.h>
|
||||
#include <asm/proc-fns.h>
|
||||
#include <asm/cpuidle.h>
|
||||
|
||||
#include "pm.h"
|
||||
|
||||
@@ -27,66 +28,46 @@
|
||||
|
||||
static DEFINE_PER_CPU(struct cpuidle_device, at91_cpuidle_device);
|
||||
|
||||
static struct cpuidle_driver at91_idle_driver = {
|
||||
.name = "at91_idle",
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
/* Actual code that puts the SoC in different idle states */
|
||||
static int at91_enter_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
struct timeval before, after;
|
||||
int idle_time;
|
||||
u32 saved_lpr;
|
||||
|
||||
local_irq_disable();
|
||||
do_gettimeofday(&before);
|
||||
if (index == 0)
|
||||
/* Wait for interrupt state */
|
||||
cpu_do_idle();
|
||||
else if (index == 1) {
|
||||
asm("b 1f; .align 5; 1:");
|
||||
asm("mcr p15, 0, r0, c7, c10, 4"); /* drain write buffer */
|
||||
saved_lpr = sdram_selfrefresh_enable();
|
||||
cpu_do_idle();
|
||||
sdram_selfrefresh_disable(saved_lpr);
|
||||
}
|
||||
do_gettimeofday(&after);
|
||||
local_irq_enable();
|
||||
idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
|
||||
(after.tv_usec - before.tv_usec);
|
||||
__asm__("b 1f; .align 5; 1:\n"
|
||||
" mcr p15, 0, r0, c7, c10, 4"); /* drain write buffer */
|
||||
|
||||
saved_lpr = sdram_selfrefresh_enable();
|
||||
cpu_do_idle();
|
||||
sdram_selfrefresh_disable(saved_lpr);
|
||||
|
||||
dev->last_residency = idle_time;
|
||||
return index;
|
||||
}
|
||||
|
||||
static struct cpuidle_driver at91_idle_driver = {
|
||||
.name = "at91_idle",
|
||||
.owner = THIS_MODULE,
|
||||
.en_core_tk_irqen = 1,
|
||||
.states[0] = ARM_CPUIDLE_WFI_STATE,
|
||||
.states[1] = {
|
||||
.enter = at91_enter_idle,
|
||||
.exit_latency = 10,
|
||||
.target_residency = 100000,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID,
|
||||
.name = "RAM_SR",
|
||||
.desc = "WFI and DDR Self Refresh",
|
||||
},
|
||||
.state_count = AT91_MAX_STATES,
|
||||
};
|
||||
|
||||
/* Initialize CPU idle by registering the idle states */
|
||||
static int at91_init_cpuidle(void)
|
||||
{
|
||||
struct cpuidle_device *device;
|
||||
struct cpuidle_driver *driver = &at91_idle_driver;
|
||||
|
||||
device = &per_cpu(at91_cpuidle_device, smp_processor_id());
|
||||
device->state_count = AT91_MAX_STATES;
|
||||
driver->state_count = AT91_MAX_STATES;
|
||||
|
||||
/* Wait for interrupt state */
|
||||
driver->states[0].enter = at91_enter_idle;
|
||||
driver->states[0].exit_latency = 1;
|
||||
driver->states[0].target_residency = 10000;
|
||||
driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
|
||||
strcpy(driver->states[0].name, "WFI");
|
||||
strcpy(driver->states[0].desc, "Wait for interrupt");
|
||||
|
||||
/* Wait for interrupt and RAM self refresh state */
|
||||
driver->states[1].enter = at91_enter_idle;
|
||||
driver->states[1].exit_latency = 10;
|
||||
driver->states[1].target_residency = 10000;
|
||||
driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
|
||||
strcpy(driver->states[1].name, "RAM_SR");
|
||||
strcpy(driver->states[1].desc, "WFI and RAM Self Refresh");
|
||||
|
||||
cpuidle_register_driver(&at91_idle_driver);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/export.h>
|
||||
#include <asm/proc-fns.h>
|
||||
#include <asm/cpuidle.h>
|
||||
|
||||
#include <mach/cpuidle.h>
|
||||
#include <mach/ddr2.h>
|
||||
@@ -30,12 +31,43 @@ struct davinci_ops {
|
||||
u32 flags;
|
||||
};
|
||||
|
||||
/* Actual code that puts the SoC in different idle states */
|
||||
static int davinci_enter_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
|
||||
struct davinci_ops *ops = cpuidle_get_statedata(state_usage);
|
||||
|
||||
if (ops && ops->enter)
|
||||
ops->enter(ops->flags);
|
||||
|
||||
index = cpuidle_wrap_enter(dev, drv, index,
|
||||
arm_cpuidle_simple_enter);
|
||||
|
||||
if (ops && ops->exit)
|
||||
ops->exit(ops->flags);
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/* fields in davinci_ops.flags */
|
||||
#define DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN BIT(0)
|
||||
|
||||
static struct cpuidle_driver davinci_idle_driver = {
|
||||
.name = "cpuidle-davinci",
|
||||
.owner = THIS_MODULE,
|
||||
.name = "cpuidle-davinci",
|
||||
.owner = THIS_MODULE,
|
||||
.en_core_tk_irqen = 1,
|
||||
.states[0] = ARM_CPUIDLE_WFI_STATE,
|
||||
.states[1] = {
|
||||
.enter = davinci_enter_idle,
|
||||
.exit_latency = 10,
|
||||
.target_residency = 100000,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID,
|
||||
.name = "DDR SR",
|
||||
.desc = "WFI and DDR Self Refresh",
|
||||
},
|
||||
.state_count = DAVINCI_CPUIDLE_MAX_STATES,
|
||||
};
|
||||
|
||||
static DEFINE_PER_CPU(struct cpuidle_device, davinci_cpuidle_device);
|
||||
@@ -77,41 +109,10 @@ static struct davinci_ops davinci_states[DAVINCI_CPUIDLE_MAX_STATES] = {
|
||||
},
|
||||
};
|
||||
|
||||
/* Actual code that puts the SoC in different idle states */
|
||||
static int davinci_enter_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
|
||||
struct davinci_ops *ops = cpuidle_get_statedata(state_usage);
|
||||
struct timeval before, after;
|
||||
int idle_time;
|
||||
|
||||
local_irq_disable();
|
||||
do_gettimeofday(&before);
|
||||
|
||||
if (ops && ops->enter)
|
||||
ops->enter(ops->flags);
|
||||
/* Wait for interrupt state */
|
||||
cpu_do_idle();
|
||||
if (ops && ops->exit)
|
||||
ops->exit(ops->flags);
|
||||
|
||||
do_gettimeofday(&after);
|
||||
local_irq_enable();
|
||||
idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
|
||||
(after.tv_usec - before.tv_usec);
|
||||
|
||||
dev->last_residency = idle_time;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static int __init davinci_cpuidle_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct cpuidle_device *device;
|
||||
struct cpuidle_driver *driver = &davinci_idle_driver;
|
||||
struct davinci_cpuidle_config *pdata = pdev->dev.platform_data;
|
||||
|
||||
device = &per_cpu(davinci_cpuidle_device, smp_processor_id());
|
||||
@@ -123,27 +124,11 @@ static int __init davinci_cpuidle_probe(struct platform_device *pdev)
|
||||
|
||||
ddr2_reg_base = pdata->ddr2_ctlr_base;
|
||||
|
||||
/* Wait for interrupt state */
|
||||
driver->states[0].enter = davinci_enter_idle;
|
||||
driver->states[0].exit_latency = 1;
|
||||
driver->states[0].target_residency = 10000;
|
||||
driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
|
||||
strcpy(driver->states[0].name, "WFI");
|
||||
strcpy(driver->states[0].desc, "Wait for interrupt");
|
||||
|
||||
/* Wait for interrupt and DDR self refresh state */
|
||||
driver->states[1].enter = davinci_enter_idle;
|
||||
driver->states[1].exit_latency = 10;
|
||||
driver->states[1].target_residency = 10000;
|
||||
driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
|
||||
strcpy(driver->states[1].name, "DDR SR");
|
||||
strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
|
||||
if (pdata->ddr2_pdown)
|
||||
davinci_states[1].flags |= DAVINCI_CPUIDLE_FLAGS_DDR2_PWDN;
|
||||
cpuidle_set_statedata(&device->states_usage[1], &davinci_states[1]);
|
||||
|
||||
device->state_count = DAVINCI_CPUIDLE_MAX_STATES;
|
||||
driver->state_count = DAVINCI_CPUIDLE_MAX_STATES;
|
||||
|
||||
ret = cpuidle_register_driver(&davinci_idle_driver);
|
||||
if (ret) {
|
||||
|
||||
@@ -20,77 +20,47 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/export.h>
|
||||
#include <asm/proc-fns.h>
|
||||
#include <asm/cpuidle.h>
|
||||
#include <mach/kirkwood.h>
|
||||
|
||||
#define KIRKWOOD_MAX_STATES 2
|
||||
|
||||
static struct cpuidle_driver kirkwood_idle_driver = {
|
||||
.name = "kirkwood_idle",
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
|
||||
|
||||
/* Actual code that puts the SoC in different idle states */
|
||||
static int kirkwood_enter_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
struct timeval before, after;
|
||||
int idle_time;
|
||||
|
||||
local_irq_disable();
|
||||
do_gettimeofday(&before);
|
||||
if (index == 0)
|
||||
/* Wait for interrupt state */
|
||||
cpu_do_idle();
|
||||
else if (index == 1) {
|
||||
/*
|
||||
* Following write will put DDR in self refresh.
|
||||
* Note that we have 256 cycles before DDR puts it
|
||||
* self in self-refresh, so the wait-for-interrupt
|
||||
* call afterwards won't get the DDR from self refresh
|
||||
* mode.
|
||||
*/
|
||||
writel(0x7, DDR_OPERATION_BASE);
|
||||
cpu_do_idle();
|
||||
}
|
||||
do_gettimeofday(&after);
|
||||
local_irq_enable();
|
||||
idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC +
|
||||
(after.tv_usec - before.tv_usec);
|
||||
|
||||
/* Update last residency */
|
||||
dev->last_residency = idle_time;
|
||||
writel(0x7, DDR_OPERATION_BASE);
|
||||
cpu_do_idle();
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static struct cpuidle_driver kirkwood_idle_driver = {
|
||||
.name = "kirkwood_idle",
|
||||
.owner = THIS_MODULE,
|
||||
.en_core_tk_irqen = 1,
|
||||
.states[0] = ARM_CPUIDLE_WFI_STATE,
|
||||
.states[1] = {
|
||||
.enter = kirkwood_enter_idle,
|
||||
.exit_latency = 10,
|
||||
.target_residency = 100000,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID,
|
||||
.name = "DDR SR",
|
||||
.desc = "WFI and DDR Self Refresh",
|
||||
},
|
||||
.state_count = KIRKWOOD_MAX_STATES,
|
||||
};
|
||||
|
||||
static DEFINE_PER_CPU(struct cpuidle_device, kirkwood_cpuidle_device);
|
||||
|
||||
/* Initialize CPU idle by registering the idle states */
|
||||
static int kirkwood_init_cpuidle(void)
|
||||
{
|
||||
struct cpuidle_device *device;
|
||||
struct cpuidle_driver *driver = &kirkwood_idle_driver;
|
||||
|
||||
device = &per_cpu(kirkwood_cpuidle_device, smp_processor_id());
|
||||
device->state_count = KIRKWOOD_MAX_STATES;
|
||||
driver->state_count = KIRKWOOD_MAX_STATES;
|
||||
|
||||
/* Wait for interrupt state */
|
||||
driver->states[0].enter = kirkwood_enter_idle;
|
||||
driver->states[0].exit_latency = 1;
|
||||
driver->states[0].target_residency = 10000;
|
||||
driver->states[0].flags = CPUIDLE_FLAG_TIME_VALID;
|
||||
strcpy(driver->states[0].name, "WFI");
|
||||
strcpy(driver->states[0].desc, "Wait for interrupt");
|
||||
|
||||
/* Wait for interrupt and DDR self refresh state */
|
||||
driver->states[1].enter = kirkwood_enter_idle;
|
||||
driver->states[1].exit_latency = 10;
|
||||
driver->states[1].target_residency = 10000;
|
||||
driver->states[1].flags = CPUIDLE_FLAG_TIME_VALID;
|
||||
strcpy(driver->states[1].name, "DDR SR");
|
||||
strcpy(driver->states[1].desc, "WFI and DDR Self Refresh");
|
||||
|
||||
cpuidle_register_driver(&kirkwood_idle_driver);
|
||||
if (cpuidle_register_device(device)) {
|
||||
|
||||
@@ -87,29 +87,14 @@ static int _cpuidle_deny_idle(struct powerdomain *pwrdm,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* omap3_enter_idle - Programs OMAP3 to enter the specified state
|
||||
* @dev: cpuidle device
|
||||
* @drv: cpuidle driver
|
||||
* @index: the index of state to be entered
|
||||
*
|
||||
* Called from the CPUidle framework to program the device to the
|
||||
* specified target state selected by the governor.
|
||||
*/
|
||||
static int omap3_enter_idle(struct cpuidle_device *dev,
|
||||
static int __omap3_enter_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
struct omap3_idle_statedata *cx =
|
||||
cpuidle_get_statedata(&dev->states_usage[index]);
|
||||
struct timespec ts_preidle, ts_postidle, ts_idle;
|
||||
u32 mpu_state = cx->mpu_state, core_state = cx->core_state;
|
||||
int idle_time;
|
||||
|
||||
/* Used to keep track of the total time in idle */
|
||||
getnstimeofday(&ts_preidle);
|
||||
|
||||
local_irq_disable();
|
||||
local_fiq_disable();
|
||||
|
||||
pwrdm_set_next_pwrst(mpu_pd, mpu_state);
|
||||
@@ -148,21 +133,28 @@ static int omap3_enter_idle(struct cpuidle_device *dev,
|
||||
}
|
||||
|
||||
return_sleep_time:
|
||||
getnstimeofday(&ts_postidle);
|
||||
ts_idle = timespec_sub(ts_postidle, ts_preidle);
|
||||
|
||||
local_irq_enable();
|
||||
local_fiq_enable();
|
||||
|
||||
idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \
|
||||
USEC_PER_SEC;
|
||||
|
||||
/* Update cpuidle counters */
|
||||
dev->last_residency = idle_time;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
/**
|
||||
* omap3_enter_idle - Programs OMAP3 to enter the specified state
|
||||
* @dev: cpuidle device
|
||||
* @drv: cpuidle driver
|
||||
* @index: the index of state to be entered
|
||||
*
|
||||
* Called from the CPUidle framework to program the device to the
|
||||
* specified target state selected by the governor.
|
||||
*/
|
||||
static inline int omap3_enter_idle(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
return cpuidle_wrap_enter(dev, drv, index, __omap3_enter_idle);
|
||||
}
|
||||
|
||||
/**
|
||||
* next_valid_state - Find next valid C-state
|
||||
* @dev: cpuidle device
|
||||
|
||||
@@ -62,15 +62,9 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
|
||||
{
|
||||
struct omap4_idle_statedata *cx =
|
||||
cpuidle_get_statedata(&dev->states_usage[index]);
|
||||
struct timespec ts_preidle, ts_postidle, ts_idle;
|
||||
u32 cpu1_state;
|
||||
int idle_time;
|
||||
int cpu_id = smp_processor_id();
|
||||
|
||||
/* Used to keep track of the total time in idle */
|
||||
getnstimeofday(&ts_preidle);
|
||||
|
||||
local_irq_disable();
|
||||
local_fiq_disable();
|
||||
|
||||
/*
|
||||
@@ -128,26 +122,17 @@ static int omap4_enter_idle(struct cpuidle_device *dev,
|
||||
if (index > 0)
|
||||
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu_id);
|
||||
|
||||
getnstimeofday(&ts_postidle);
|
||||
ts_idle = timespec_sub(ts_postidle, ts_preidle);
|
||||
|
||||
local_irq_enable();
|
||||
local_fiq_enable();
|
||||
|
||||
idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \
|
||||
USEC_PER_SEC;
|
||||
|
||||
/* Update cpuidle counters */
|
||||
dev->last_residency = idle_time;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev);
|
||||
|
||||
struct cpuidle_driver omap4_idle_driver = {
|
||||
.name = "omap4_idle",
|
||||
.owner = THIS_MODULE,
|
||||
.name = "omap4_idle",
|
||||
.owner = THIS_MODULE,
|
||||
.en_core_tk_irqen = 1,
|
||||
};
|
||||
|
||||
static inline void _fill_cstate(struct cpuidle_driver *drv,
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/err.h>
|
||||
#include <asm/system.h>
|
||||
#include <asm/cpuidle.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
static void shmobile_enter_wfi(void)
|
||||
@@ -29,37 +30,19 @@ static int shmobile_cpuidle_enter(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
ktime_t before, after;
|
||||
|
||||
before = ktime_get();
|
||||
|
||||
local_irq_disable();
|
||||
local_fiq_disable();
|
||||
|
||||
shmobile_cpuidle_modes[index]();
|
||||
|
||||
local_irq_enable();
|
||||
local_fiq_enable();
|
||||
|
||||
after = ktime_get();
|
||||
dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10;
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static struct cpuidle_device shmobile_cpuidle_dev;
|
||||
static struct cpuidle_driver shmobile_cpuidle_driver = {
|
||||
.name = "shmobile_cpuidle",
|
||||
.owner = THIS_MODULE,
|
||||
.states[0] = {
|
||||
.name = "C1",
|
||||
.desc = "WFI",
|
||||
.exit_latency = 1,
|
||||
.target_residency = 1 * 2,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID,
|
||||
},
|
||||
.safe_state_index = 0, /* C1 */
|
||||
.state_count = 1,
|
||||
.name = "shmobile_cpuidle",
|
||||
.owner = THIS_MODULE,
|
||||
.en_core_tk_irqen = 1,
|
||||
.states[0] = ARM_CPUIDLE_WFI_STATE,
|
||||
.safe_state_index = 0, /* C1 */
|
||||
.state_count = 1,
|
||||
};
|
||||
|
||||
void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv);
|
||||
|
||||
@@ -29,7 +29,6 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev,
|
||||
int index)
|
||||
{
|
||||
unsigned long allowed_mode = SUSP_SH_SLEEP;
|
||||
ktime_t before, after;
|
||||
int requested_state = index;
|
||||
int allowed_state;
|
||||
int k;
|
||||
@@ -47,19 +46,16 @@ static int cpuidle_sleep_enter(struct cpuidle_device *dev,
|
||||
*/
|
||||
k = min_t(int, allowed_state, requested_state);
|
||||
|
||||
before = ktime_get();
|
||||
sh_mobile_call_standby(cpuidle_mode[k]);
|
||||
after = ktime_get();
|
||||
|
||||
dev->last_residency = (int)ktime_to_ns(ktime_sub(after, before)) >> 10;
|
||||
|
||||
return k;
|
||||
}
|
||||
|
||||
static struct cpuidle_device cpuidle_dev;
|
||||
static struct cpuidle_driver cpuidle_driver = {
|
||||
.name = "sh_idle",
|
||||
.owner = THIS_MODULE,
|
||||
.name = "sh_idle",
|
||||
.owner = THIS_MODULE,
|
||||
.en_core_tk_irqen = 1,
|
||||
};
|
||||
|
||||
void sh_mobile_setup_cpuidle(void)
|
||||
|
||||
@@ -642,6 +642,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
|
||||
kfree(buffer.pointer);
|
||||
buffer.length = ACPI_ALLOCATE_BUFFER;
|
||||
buffer.pointer = NULL;
|
||||
lapic = NULL;
|
||||
|
||||
if (!alloc_cpumask_var(&tmp_map, GFP_KERNEL))
|
||||
goto out;
|
||||
@@ -650,7 +651,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
|
||||
goto free_tmp_map;
|
||||
|
||||
cpumask_copy(tmp_map, cpu_present_mask);
|
||||
acpi_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
|
||||
acpi_register_lapic(physid, ACPI_MADT_ENABLED);
|
||||
|
||||
/*
|
||||
* If mp_register_lapic successfully generates a new logical cpu
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include <linux/tboot.h>
|
||||
#include <linux/stackprotector.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/cpuidle.h>
|
||||
|
||||
#include <asm/acpi.h>
|
||||
#include <asm/desc.h>
|
||||
@@ -1422,7 +1423,8 @@ void native_play_dead(void)
|
||||
tboot_shutdown(TB_SHUTDOWN_WFS);
|
||||
|
||||
mwait_play_dead(); /* Only returns on failure */
|
||||
hlt_play_dead();
|
||||
if (cpuidle_play_dead())
|
||||
hlt_play_dead();
|
||||
}
|
||||
|
||||
#else /* ... !CONFIG_HOTPLUG_CPU */
|
||||
|
||||
@@ -384,6 +384,15 @@ config ACPI_CUSTOM_METHOD
|
||||
load additional kernel modules after boot, this feature may be used
|
||||
to override that restriction).
|
||||
|
||||
config ACPI_BGRT
|
||||
tristate "Boottime Graphics Resource Table support"
|
||||
default n
|
||||
help
|
||||
This driver adds support for exposing the ACPI Boottime Graphics
|
||||
Resource Table, which allows the operating system to obtain
|
||||
data from the firmware boot splash. It will appear under
|
||||
/sys/firmware/acpi/bgrt/ .
|
||||
|
||||
source "drivers/acpi/apei/Kconfig"
|
||||
|
||||
endif # ACPI
|
||||
|
||||
@@ -62,6 +62,7 @@ obj-$(CONFIG_ACPI_SBS) += sbs.o
|
||||
obj-$(CONFIG_ACPI_HED) += hed.o
|
||||
obj-$(CONFIG_ACPI_EC_DEBUGFS) += ec_sys.o
|
||||
obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
|
||||
obj-$(CONFIG_ACPI_BGRT) += bgrt.o
|
||||
|
||||
# processor has its own "processor." module_param namespace
|
||||
processor-y := processor_driver.o processor_throttling.o
|
||||
|
||||
@@ -74,8 +74,7 @@ acpi_status acpi_reset(void)
|
||||
|
||||
/* Check if the reset register is supported */
|
||||
|
||||
if (!(acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) ||
|
||||
!reset_reg->address) {
|
||||
if (!reset_reg->address) {
|
||||
return_ACPI_STATUS(AE_NOT_EXIST);
|
||||
}
|
||||
|
||||
|
||||
@@ -363,10 +363,6 @@ static void acpi_tb_convert_fadt(void)
|
||||
u32 address32;
|
||||
u32 i;
|
||||
|
||||
/* Update the local FADT table header length */
|
||||
|
||||
acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
|
||||
|
||||
/*
|
||||
* Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary.
|
||||
* Later code will always use the X 64-bit field. Also, check for an
|
||||
@@ -408,6 +404,10 @@ static void acpi_tb_convert_fadt(void)
|
||||
acpi_gbl_FADT.boot_flags = 0;
|
||||
}
|
||||
|
||||
/* Update the local FADT table header length */
|
||||
|
||||
acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt);
|
||||
|
||||
/*
|
||||
* Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X"
|
||||
* generic address structures as necessary. Later code will always use
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
/*
|
||||
* Copyright 2012 Red Hat, Inc <mjg@redhat.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/sysfs.h>
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acpi_bus.h>
|
||||
|
||||
static struct acpi_table_bgrt *bgrt_tab;
|
||||
static struct kobject *bgrt_kobj;
|
||||
|
||||
struct bmp_header {
|
||||
u16 id;
|
||||
u32 size;
|
||||
} __attribute ((packed));
|
||||
|
||||
static struct bmp_header bmp_header;
|
||||
|
||||
static ssize_t show_version(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->version);
|
||||
}
|
||||
static DEVICE_ATTR(version, S_IRUGO, show_version, NULL);
|
||||
|
||||
static ssize_t show_status(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->status);
|
||||
}
|
||||
static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
|
||||
|
||||
static ssize_t show_type(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_type);
|
||||
}
|
||||
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
|
||||
|
||||
static ssize_t show_xoffset(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_offset_x);
|
||||
}
|
||||
static DEVICE_ATTR(xoffset, S_IRUGO, show_xoffset, NULL);
|
||||
|
||||
static ssize_t show_yoffset(struct device *dev,
|
||||
struct device_attribute *attr, char *buf)
|
||||
{
|
||||
return snprintf(buf, PAGE_SIZE, "%d\n", bgrt_tab->image_offset_y);
|
||||
}
|
||||
static DEVICE_ATTR(yoffset, S_IRUGO, show_yoffset, NULL);
|
||||
|
||||
static ssize_t show_image(struct file *file, struct kobject *kobj,
|
||||
struct bin_attribute *attr, char *buf, loff_t off, size_t count)
|
||||
{
|
||||
int size = attr->size;
|
||||
void __iomem *image = attr->private;
|
||||
|
||||
if (off >= size) {
|
||||
count = 0;
|
||||
} else {
|
||||
if (off + count > size)
|
||||
count = size - off;
|
||||
|
||||
memcpy_fromio(buf, image+off, count);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static struct bin_attribute image_attr = {
|
||||
.attr = {
|
||||
.name = "image",
|
||||
.mode = S_IRUGO,
|
||||
},
|
||||
.read = show_image,
|
||||
};
|
||||
|
||||
static struct attribute *bgrt_attributes[] = {
|
||||
&dev_attr_version.attr,
|
||||
&dev_attr_status.attr,
|
||||
&dev_attr_type.attr,
|
||||
&dev_attr_xoffset.attr,
|
||||
&dev_attr_yoffset.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static struct attribute_group bgrt_attribute_group = {
|
||||
.attrs = bgrt_attributes,
|
||||
};
|
||||
|
||||
static int __init bgrt_init(void)
|
||||
{
|
||||
acpi_status status;
|
||||
int ret;
|
||||
void __iomem *bgrt;
|
||||
|
||||
if (acpi_disabled)
|
||||
return -ENODEV;
|
||||
|
||||
status = acpi_get_table("BGRT", 0,
|
||||
(struct acpi_table_header **)&bgrt_tab);
|
||||
|
||||
if (ACPI_FAILURE(status))
|
||||
return -ENODEV;
|
||||
|
||||
sysfs_bin_attr_init(&image_attr);
|
||||
|
||||
bgrt = ioremap(bgrt_tab->image_address, sizeof(struct bmp_header));
|
||||
|
||||
if (!bgrt) {
|
||||
ret = -EINVAL;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
memcpy_fromio(&bmp_header, bgrt, sizeof(bmp_header));
|
||||
image_attr.size = bmp_header.size;
|
||||
iounmap(bgrt);
|
||||
|
||||
image_attr.private = ioremap(bgrt_tab->image_address, image_attr.size);
|
||||
|
||||
if (!image_attr.private) {
|
||||
ret = -EINVAL;
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
|
||||
bgrt_kobj = kobject_create_and_add("bgrt", acpi_kobj);
|
||||
if (!bgrt_kobj) {
|
||||
ret = -EINVAL;
|
||||
goto out_iounmap;
|
||||
}
|
||||
|
||||
ret = sysfs_create_group(bgrt_kobj, &bgrt_attribute_group);
|
||||
if (ret)
|
||||
goto out_kobject;
|
||||
|
||||
ret = sysfs_create_bin_file(bgrt_kobj, &image_attr);
|
||||
if (ret)
|
||||
goto out_group;
|
||||
|
||||
return 0;
|
||||
|
||||
out_group:
|
||||
sysfs_remove_group(bgrt_kobj, &bgrt_attribute_group);
|
||||
out_kobject:
|
||||
kobject_put(bgrt_kobj);
|
||||
out_iounmap:
|
||||
iounmap(image_attr.private);
|
||||
out_err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void __exit bgrt_exit(void)
|
||||
{
|
||||
iounmap(image_attr.private);
|
||||
sysfs_remove_group(bgrt_kobj, &bgrt_attribute_group);
|
||||
sysfs_remove_bin_file(bgrt_kobj, &image_attr);
|
||||
}
|
||||
|
||||
module_init(bgrt_init);
|
||||
module_exit(bgrt_exit);
|
||||
|
||||
MODULE_AUTHOR("Matthew Garrett");
|
||||
MODULE_DESCRIPTION("BGRT boot graphic support");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -1010,6 +1010,7 @@ static int __init acpi_bus_init(void)
|
||||
}
|
||||
|
||||
struct kobject *acpi_kobj;
|
||||
EXPORT_SYMBOL_GPL(acpi_kobj);
|
||||
|
||||
static int __init acpi_init(void)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user