Skip to content

Commit

Permalink
Reinitialize device on suspend/resume
Browse files Browse the repository at this point in the history
  • Loading branch information
quo committed Nov 28, 2022
1 parent 478f1f1 commit 67ebf09
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/ithc-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ int ithc_dma_rx_init(struct ithc *ithc, u8 channel, const char *devname) {
}
void ithc_dma_rx_enable(struct ithc *ithc, u8 channel) {
bitsb_set(&ithc->regs->dma_rx[channel].control, DMA_RX_CONTROL_ENABLE | DMA_RX_CONTROL_IRQ_ERROR | DMA_RX_CONTROL_IRQ_DATA);
CHECK(waitl, ithc, &ithc->regs->dma_rx[1].status, DMA_RX_STATUS_ENABLED, DMA_RX_STATUS_ENABLED);
}

int ithc_dma_tx_init(struct ithc *ithc) {
Expand Down
2 changes: 0 additions & 2 deletions src/ithc-dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,5 @@ void ithc_dma_rx_enable(struct ithc *ithc, u8 channel);
int ithc_dma_tx_init(struct ithc *ithc);
int ithc_dma_rx(struct ithc *ithc, u8 channel);
int ithc_dma_tx(struct ithc *ithc, u32 cmdcode, u32 datasize, void *cmddata);
void *ithc_data_kmap(struct ithc_dma_data_buffer *b);
void ithc_data_kunmap(struct ithc_dma_data_buffer *b, void *p);
int ithc_set_multitouch(struct ithc *ithc, bool enable);

9 changes: 3 additions & 6 deletions src/ithc-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static int ithc_poll_thread(void *arg) {

static void ithc_disable(struct ithc *ithc) {
bitsl_set(&ithc->regs->control_bits, CONTROL_QUIESCE);
waitl(ithc, &ithc->regs->control_bits, CONTROL_IS_QUIESCED, CONTROL_IS_QUIESCED);
CHECK(waitl, ithc, &ithc->regs->control_bits, CONTROL_IS_QUIESCED, CONTROL_IS_QUIESCED);
bitsl(&ithc->regs->control_bits, CONTROL_NRESET, 0);
bitsb(&ithc->regs->spi_cmd.control, SPI_CMD_CONTROL_SEND, 0);
bitsb(&ithc->regs->dma_tx.control, DMA_TX_CONTROL_SEND, 0);
Expand Down Expand Up @@ -509,17 +509,14 @@ static void ithc_remove(struct pci_dev *pci) {
static int ithc_suspend(struct device *dev) {
struct pci_dev *pci = to_pci_dev(dev);
pci_dbg(pci, "pm suspend\n");
pci_disable_device(pci);
devres_release_group(dev, ithc_start);
return 0;
}

static int ithc_resume(struct device *dev) {
struct pci_dev *pci = to_pci_dev(dev);
struct ithc *ithc = dev_get_drvdata(dev);
pci_dbg(pci, "pm resume\n");
CHECK_RET(pcim_enable_device, pci);
pci_set_master(pci);
return 0;
return ithc_start(pci);
}

static int ithc_freeze(struct device *dev) {
Expand Down

0 comments on commit 67ebf09

Please sign in to comment.