[PATCH 6/8] intel_mid_ssp_spi: Add the QoS quirk for slave mode

From: Alan Cox
Date: Wed Feb 09 2011 - 05:38:03 EST


From: Alan Cox <alan@xxxxxxxxxxxxxxx>

This is needed for Moorestown. Again we add this so that the default is off
and the code changed is all within if (quirks & ).

Baed on previous generic driver work by Mathieu SOULARD
<mathieux.soulard@xxxxxxxxx>

Signed-off-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
---

drivers/spi/intel_mid_ssp_spi.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)


diff --git a/drivers/spi/intel_mid_ssp_spi.c b/drivers/spi/intel_mid_ssp_spi.c
index c8cd3bb..26e41c2 100644
--- a/drivers/spi/intel_mid_ssp_spi.c
+++ b/drivers/spi/intel_mid_ssp_spi.c
@@ -186,6 +186,8 @@ struct driver_data {
int rxdma_done;
struct callback_param tx_param;
struct callback_param rx_param;
+ /* PM_QOS request (for Moorestown) */
+ struct pm_qos_request_list pm_qos_req;
};

struct chip_data {
@@ -443,6 +445,10 @@ static void dma_transfer_complete(void *arg)
/* Stop getting Time Outs */
iowrite32(0, reg + SSTO);

+ if (drv_data->quirks & QUIRKS_USE_PM_QOS)
+ pm_qos_update_request(&drv_data->pm_qos_req,
+ PM_QOS_DEFAULT_VALUE);
+
/* release DMA mappings */
unmap_dma_buffers(drv_data, drv_data->cur_msg);

@@ -556,6 +562,8 @@ static void dma_transfer(struct driver_data *drv_data)
struct dma_slave_config *txconf, *rxconf;
struct device *dev = &drv_data->pdev->dev;

+ if (drv_data->quirks & QUIRKS_USE_PM_QOS)
+ pm_qos_update_request(&drv_data->pm_qos_req, MIN_EXIT_LATENCY);
/* get Data Read/Write address */
ssdr_addr = (dma_addr_t)(drv_data->paddr + 0x10);
flag = DMA_PREP_INTERRUPT | DMA_CTRL_ACK;
@@ -1186,6 +1194,9 @@ static void cleanup(struct spi_device *spi)

if (drv_data->dma_inited)
intel_mid_ssp_spi_dma_exit(drv_data);
+ /* Remove the PM_QOS request */
+ if (drv_data->quirks & QUIRKS_USE_PM_QOS)
+ pm_qos_remove_request(&drv_data->pm_qos_req);
kfree(chip);
spi_set_ctldata(spi, NULL);
}
@@ -1332,6 +1343,11 @@ static int intel_mid_ssp_spi_probe(struct pci_dev *pdev,

pci_set_drvdata(pdev, drv_data);

+ /* Create the PM_QOS request */
+ if (drv_data->quirks & QUIRKS_USE_PM_QOS)
+ pm_qos_add_request(&drv_data->pm_qos_req,
+ PM_QOS_CPU_DMA_LATENCY, PM_QOS_DEFAULT_VALUE);
+
pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
pm_runtime_idle(&pdev->dev);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/