mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 13:44:26 -04:00
Merge branch 'alpm' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'alpm' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev: [libata] AHCI: add hw link power management support [libata] Link power management infrastructure
This commit is contained in:
commit
3529a23342
8 changed files with 484 additions and 4 deletions
|
|
@ -236,6 +236,7 @@ enum {
|
|||
|
||||
/* SETFEATURE Sector counts for SATA features */
|
||||
SATA_AN = 0x05, /* Asynchronous Notification */
|
||||
SATA_DIPM = 0x03, /* Device Initiated Power Management */
|
||||
|
||||
/* ATAPI stuff */
|
||||
ATAPI_PKT_DMA = (1 << 0),
|
||||
|
|
@ -378,6 +379,26 @@ struct ata_taskfile {
|
|||
|
||||
#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
|
||||
|
||||
static inline bool ata_id_has_hipm(const u16 *id)
|
||||
{
|
||||
u16 val = id[76];
|
||||
|
||||
if (val == 0 || val == 0xffff)
|
||||
return false;
|
||||
|
||||
return val & (1 << 9);
|
||||
}
|
||||
|
||||
static inline bool ata_id_has_dipm(const u16 *id)
|
||||
{
|
||||
u16 val = id[78];
|
||||
|
||||
if (val == 0 || val == 0xffff)
|
||||
return false;
|
||||
|
||||
return val & (1 << 3);
|
||||
}
|
||||
|
||||
static inline int ata_id_has_fua(const u16 *id)
|
||||
{
|
||||
if ((id[84] & 0xC000) != 0x4000)
|
||||
|
|
|
|||
|
|
@ -133,6 +133,8 @@ enum {
|
|||
ATA_DFLAG_ACPI_PENDING = (1 << 5), /* ACPI resume action pending */
|
||||
ATA_DFLAG_ACPI_FAILED = (1 << 6), /* ACPI on devcfg has failed */
|
||||
ATA_DFLAG_AN = (1 << 7), /* AN configured */
|
||||
ATA_DFLAG_HIPM = (1 << 8), /* device supports HIPM */
|
||||
ATA_DFLAG_DIPM = (1 << 9), /* device supports DIPM */
|
||||
ATA_DFLAG_CFG_MASK = (1 << 12) - 1,
|
||||
|
||||
ATA_DFLAG_PIO = (1 << 12), /* device limited to PIO mode */
|
||||
|
|
@ -186,6 +188,7 @@ enum {
|
|||
ATA_FLAG_ACPI_SATA = (1 << 17), /* need native SATA ACPI layout */
|
||||
ATA_FLAG_AN = (1 << 18), /* controller supports AN */
|
||||
ATA_FLAG_PMP = (1 << 19), /* controller supports PMP */
|
||||
ATA_FLAG_IPM = (1 << 20), /* driver can handle IPM */
|
||||
|
||||
/* The following flag belongs to ap->pflags but is kept in
|
||||
* ap->flags because it's referenced in many LLDs and will be
|
||||
|
|
@ -302,6 +305,7 @@ enum {
|
|||
ATA_EHI_RESUME_LINK = (1 << 1), /* resume link (reset modifier) */
|
||||
ATA_EHI_NO_AUTOPSY = (1 << 2), /* no autopsy */
|
||||
ATA_EHI_QUIET = (1 << 3), /* be quiet */
|
||||
ATA_EHI_LPM = (1 << 4), /* link power management action */
|
||||
|
||||
ATA_EHI_DID_SOFTRESET = (1 << 16), /* already soft-reset this port */
|
||||
ATA_EHI_DID_HARDRESET = (1 << 17), /* already soft-reset this port */
|
||||
|
|
@ -333,6 +337,7 @@ enum {
|
|||
ATA_HORKAGE_BROKEN_HPA = (1 << 4), /* Broken HPA */
|
||||
ATA_HORKAGE_SKIP_PM = (1 << 5), /* Skip PM operations */
|
||||
ATA_HORKAGE_HPA_SIZE = (1 << 6), /* native size off by one */
|
||||
ATA_HORKAGE_IPM = (1 << 7), /* Link PM problems */
|
||||
|
||||
/* DMA mask for user DMA control: User visible values; DO NOT
|
||||
renumber */
|
||||
|
|
@ -378,6 +383,18 @@ typedef int (*ata_reset_fn_t)(struct ata_link *link, unsigned int *classes,
|
|||
unsigned long deadline);
|
||||
typedef void (*ata_postreset_fn_t)(struct ata_link *link, unsigned int *classes);
|
||||
|
||||
/*
|
||||
* host pm policy: If you alter this, you also need to alter libata-scsi.c
|
||||
* (for the ascii descriptions)
|
||||
*/
|
||||
enum link_pm {
|
||||
NOT_AVAILABLE,
|
||||
MIN_POWER,
|
||||
MAX_PERFORMANCE,
|
||||
MEDIUM_POWER,
|
||||
};
|
||||
extern struct class_device_attribute class_device_attr_link_power_management_policy;
|
||||
|
||||
struct ata_ioports {
|
||||
void __iomem *cmd_addr;
|
||||
void __iomem *data_addr;
|
||||
|
|
@ -624,6 +641,7 @@ struct ata_port {
|
|||
|
||||
pm_message_t pm_mesg;
|
||||
int *pm_result;
|
||||
enum link_pm pm_policy;
|
||||
|
||||
struct timer_list fastdrain_timer;
|
||||
unsigned long fastdrain_cnt;
|
||||
|
|
@ -691,7 +709,8 @@ struct ata_port_operations {
|
|||
|
||||
int (*port_suspend) (struct ata_port *ap, pm_message_t mesg);
|
||||
int (*port_resume) (struct ata_port *ap);
|
||||
|
||||
int (*enable_pm) (struct ata_port *ap, enum link_pm policy);
|
||||
void (*disable_pm) (struct ata_port *ap);
|
||||
int (*port_start) (struct ata_port *ap);
|
||||
void (*port_stop) (struct ata_port *ap);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue