diff options
| -rw-r--r-- | drivers/staging/comedi/drivers/s626.c | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index cd09c37570bc..4315892740c9 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c | |||
| @@ -2459,16 +2459,10 @@ static int s626_allocate_dma_buffers(struct comedi_device *dev) | |||
| 2459 | 2459 | ||
| 2460 | static void s626_initialize(struct comedi_device *dev) | 2460 | static void s626_initialize(struct comedi_device *dev) |
| 2461 | { | 2461 | { |
| 2462 | /* uint8_t PollList; */ | ||
| 2463 | /* uint16_t AdcData; */ | ||
| 2464 | /* uint16_t StartVal; */ | ||
| 2465 | /* uint16_t index; */ | ||
| 2466 | /* unsigned int data[16]; */ | ||
| 2467 | dma_addr_t pPhysBuf; | 2462 | dma_addr_t pPhysBuf; |
| 2468 | uint16_t chan; | 2463 | uint16_t chan; |
| 2469 | int i; | 2464 | int i; |
| 2470 | 2465 | ||
| 2471 | |||
| 2472 | /* enab DEBI and audio pins, enable I2C interface. */ | 2466 | /* enab DEBI and audio pins, enable I2C interface. */ |
| 2473 | MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C); | 2467 | MC_ENABLE(P_MC1, MC1_DEBI | MC1_AUDIO | MC1_I2C); |
| 2474 | /* Configure DEBI operating mode. */ | 2468 | /* Configure DEBI operating mode. */ |
| @@ -2568,38 +2562,50 @@ static void s626_initialize(struct comedi_device *dev) | |||
| 2568 | /* RPS program performs no explicit mem writes. */ | 2562 | /* RPS program performs no explicit mem writes. */ |
| 2569 | WR7146(P_RPS1_TOUT, 0); /* Disable RPS timeouts. */ | 2563 | WR7146(P_RPS1_TOUT, 0); /* Disable RPS timeouts. */ |
| 2570 | 2564 | ||
| 2571 | /* SAA7146 BUG WORKAROUND. Initialize SAA7146 ADC interface | 2565 | #if 0 |
| 2572 | * to a known state by invoking ADCs until FB BUFFER 1 | 2566 | /* |
| 2573 | * register shows that it is correctly receiving ADC data. | 2567 | * SAA7146 BUG WORKAROUND |
| 2574 | * This is necessary because the SAA7146 ADC interface does | 2568 | * |
| 2575 | * not start up in a defined state after a PCI reset. | 2569 | * Initialize SAA7146 ADC interface to a known state by |
| 2570 | * invoking ADCs until FB BUFFER 1 register shows that it | ||
| 2571 | * is correctly receiving ADC data. This is necessary | ||
| 2572 | * because the SAA7146 ADC interface does not start up in | ||
| 2573 | * a defined state after a PCI reset. | ||
| 2576 | */ | 2574 | */ |
| 2577 | 2575 | ||
| 2578 | /* PollList = EOPL; // Create a simple polling */ | 2576 | { |
| 2579 | /* // list for analog input */ | 2577 | uint8_t PollList; |
| 2580 | /* // channel 0. */ | 2578 | uint16_t AdcData; |
| 2581 | /* ResetADC( dev, &PollList ); */ | 2579 | uint16_t StartVal; |
| 2582 | 2580 | uint16_t index; | |
| 2583 | /* s626_ai_rinsn(dev,dev->subdevices,NULL,data); //( &AdcData ); // */ | 2581 | unsigned int data[16]; |
| 2584 | /* //Get initial ADC */ | 2582 | |
| 2585 | /* //value. */ | 2583 | /* Create a simple polling list for analog input channel 0 */ |
| 2586 | 2584 | PollList = EOPL; | |
| 2587 | /* StartVal = data[0]; */ | 2585 | ResetADC(dev, &PollList); |
| 2588 | 2586 | ||
| 2589 | /* // VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION. */ | 2587 | /* Get initial ADC value */ |
| 2590 | /* // Invoke ADCs until the new ADC value differs from the initial */ | 2588 | s626_ai_rinsn(dev, dev->subdevices, NULL, data); |
| 2591 | /* // value or a timeout occurs. The timeout protects against the */ | 2589 | StartVal = data[0]; |
| 2592 | /* // possibility that the driver is restarting and the ADC data is a */ | 2590 | |
| 2593 | /* // fixed value resulting from the applied ADC analog input being */ | 2591 | /* |
| 2594 | /* // unusually quiet or at the rail. */ | 2592 | * VERSION 2.01 CHANGE: TIMEOUT ADDED TO PREVENT HANGED EXECUTION. |
| 2595 | 2593 | * | |
| 2596 | /* for ( index = 0; index < 500; index++ ) */ | 2594 | * Invoke ADCs until the new ADC value differs from the initial |
| 2597 | /* { */ | 2595 | * value or a timeout occurs. The timeout protects against the |
| 2598 | /* s626_ai_rinsn(dev,dev->subdevices,NULL,data); */ | 2596 | * possibility that the driver is restarting and the ADC data is a |
| 2599 | /* AdcData = data[0]; //ReadADC( &AdcData ); */ | 2597 | * fixed value resulting from the applied ADC analog input being |
| 2600 | /* if ( AdcData != StartVal ) */ | 2598 | * unusually quiet or at the rail. |
| 2601 | /* break; */ | 2599 | */ |
| 2602 | /* } */ | 2600 | for (index = 0; index < 500; index++) { |
| 2601 | s626_ai_rinsn(dev, dev->subdevices, NULL, data); | ||
| 2602 | AdcData = data[0]; | ||
| 2603 | if (AdcData != StartVal) | ||
| 2604 | break; | ||
| 2605 | } | ||
| 2606 | |||
| 2607 | } | ||
| 2608 | #endif /* SAA7146 BUG WORKAROUND */ | ||
| 2603 | 2609 | ||
| 2604 | /* end initADC */ | 2610 | /* end initADC */ |
| 2605 | 2611 | ||
