3 * tp3780i.c -- board driver for 3780i on ThinkPads
6 * Written By: Mike Sullivan IBM Corporation
8 * Copyright (C) 1999 IBM Corporation
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
22 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
23 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
24 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
25 * solely responsible for determining the appropriateness of using and
26 * distributing the Program and assumes all risks associated with its
27 * exercise of rights under this Agreement, including but not limited to
28 * the risks and costs of program errors, damage to or loss of data,
29 * programs or equipment, and unavailability or interruption of operations.
31 * DISCLAIMER OF LIABILITY
32 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
38 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
45 * 10/23/2000 - Alpha Release
46 * First release to the public
49 #include <linux/version.h>
50 #include <linux/interrupt.h>
51 #include <linux/kernel.h>
52 #include <linux/ptrace.h>
53 #include <linux/ioport.h>
61 extern MWAVE_DEVICE_DATA mwave_s_mdd
;
63 static unsigned short s_ausThinkpadIrqToField
[16] =
64 { 0xFFFF, 0xFFFF, 0xFFFF, 0x0001, 0x0002, 0x0003, 0xFFFF, 0x0004,
65 0xFFFF, 0xFFFF, 0x0005, 0x0006, 0xFFFF, 0xFFFF, 0xFFFF, 0x0007 };
66 static unsigned short s_ausThinkpadDmaToField
[8] =
67 { 0x0001, 0x0002, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0x0003, 0x0004 };
68 static unsigned short s_numIrqs
= 16, s_numDmas
= 8;
71 static void EnableSRAM(THINKPAD_BD_DATA
* pBDData
)
73 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
74 unsigned short usDspBaseIO
= pSettings
->usDspBaseIO
;
75 DSP_GPIO_OUTPUT_DATA_15_8 rGpioOutputData
;
76 DSP_GPIO_DRIVER_ENABLE_15_8 rGpioDriverEnable
;
77 DSP_GPIO_MODE_15_8 rGpioMode
;
79 PRINTK_1(TRACE_TP3780I
, "tp3780i::EnableSRAM, entry\n");
81 MKWORD(rGpioMode
) = ReadMsaCfg(DSP_GpioModeControl_15_8
);
82 rGpioMode
.GpioMode10
= 0;
83 WriteMsaCfg(DSP_GpioModeControl_15_8
, MKWORD(rGpioMode
));
85 MKWORD(rGpioDriverEnable
) = 0;
86 rGpioDriverEnable
.Enable10
= TRUE
;
87 rGpioDriverEnable
.Mask10
= TRUE
;
88 WriteMsaCfg(DSP_GpioDriverEnable_15_8
, MKWORD(rGpioDriverEnable
));
90 MKWORD(rGpioOutputData
) = 0;
91 rGpioOutputData
.Latch10
= 0;
92 rGpioOutputData
.Mask10
= TRUE
;
93 WriteMsaCfg(DSP_GpioOutputData_15_8
, MKWORD(rGpioOutputData
));
95 PRINTK_1(TRACE_TP3780I
, "tp3780i::EnableSRAM exit\n");
99 static irqreturn_t
UartInterrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
101 PRINTK_3(TRACE_TP3780I
,
102 "tp3780i::UartInterrupt entry irq %x dev_id %p\n", irq
, dev_id
);
106 static irqreturn_t
DspInterrupt(int irq
, void *dev_id
, struct pt_regs
*regs
)
108 pMWAVE_DEVICE_DATA pDrvData
= &mwave_s_mdd
;
109 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pDrvData
->rBDData
.rDspSettings
;
110 unsigned short usDspBaseIO
= pSettings
->usDspBaseIO
;
111 unsigned short usIPCSource
= 0, usIsolationMask
, usPCNum
;
113 PRINTK_3(TRACE_TP3780I
,
114 "tp3780i::DspInterrupt entry irq %x dev_id %p\n", irq
, dev_id
);
116 if (dsp3780I_GetIPCSource(usDspBaseIO
, &usIPCSource
) == 0) {
117 PRINTK_2(TRACE_TP3780I
,
118 "tp3780i::DspInterrupt, return from dsp3780i_GetIPCSource, usIPCSource %x\n",
121 for (usPCNum
= 1; usPCNum
<= 16; usPCNum
++) {
122 if (usIPCSource
& usIsolationMask
) {
123 usIPCSource
&= ~usIsolationMask
;
124 PRINTK_3(TRACE_TP3780I
,
125 "tp3780i::DspInterrupt usPCNum %x usIPCSource %x\n",
126 usPCNum
, usIPCSource
);
127 if (pDrvData
->IPCs
[usPCNum
- 1].usIntCount
== 0) {
128 pDrvData
->IPCs
[usPCNum
- 1].usIntCount
= 1;
130 PRINTK_2(TRACE_TP3780I
,
131 "tp3780i::DspInterrupt usIntCount %x\n",
132 pDrvData
->IPCs
[usPCNum
- 1].usIntCount
);
133 if (pDrvData
->IPCs
[usPCNum
- 1].bIsEnabled
== TRUE
) {
134 PRINTK_2(TRACE_TP3780I
,
135 "tp3780i::DspInterrupt, waking up usPCNum %x\n",
137 wake_up_interruptible(&pDrvData
->IPCs
[usPCNum
- 1].ipc_wait_queue
);
139 PRINTK_2(TRACE_TP3780I
,
140 "tp3780i::DspInterrupt, no one waiting for IPC %x\n",
144 if (usIPCSource
== 0)
147 usIsolationMask
= usIsolationMask
<< 1;
150 PRINTK_1(TRACE_TP3780I
,
151 "tp3780i::DspInterrupt, return false from dsp3780i_GetIPCSource\n");
153 PRINTK_1(TRACE_TP3780I
, "tp3780i::DspInterrupt exit\n");
158 int tp3780I_InitializeBoardData(THINKPAD_BD_DATA
* pBDData
)
161 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
164 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_InitializeBoardData entry pBDData %p\n", pBDData
);
166 pBDData
->bDSPEnabled
= FALSE
;
167 pSettings
->bInterruptClaimed
= FALSE
;
169 retval
= smapi_init();
171 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_InitializeBoardData: Error: SMAPI is not available on this machine\n");
173 if (mwave_3780i_irq
|| mwave_3780i_io
|| mwave_uart_irq
|| mwave_uart_io
) {
174 retval
= smapi_set_DSP_cfg();
178 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_InitializeBoardData exit retval %x\n", retval
);
183 int tp3780I_Cleanup(THINKPAD_BD_DATA
* pBDData
)
187 PRINTK_2(TRACE_TP3780I
,
188 "tp3780i::tp3780I_Cleanup entry and exit pBDData %p\n", pBDData
);
193 int tp3780I_CalcResources(THINKPAD_BD_DATA
* pBDData
)
195 SMAPI_DSP_SETTINGS rSmapiInfo
;
196 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
198 PRINTK_2(TRACE_TP3780I
,
199 "tp3780i::tp3780I_CalcResources entry pBDData %p\n", pBDData
);
201 if (smapi_query_DSP_cfg(&rSmapiInfo
)) {
202 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_CalcResources: Error: Could not query DSP config. Aborting.\n");
208 ( rSmapiInfo
.usDspIRQ
== 0 )
209 || ( rSmapiInfo
.usDspBaseIO
== 0 )
210 || ( rSmapiInfo
.usUartIRQ
== 0 )
211 || ( rSmapiInfo
.usUartBaseIO
== 0 )
213 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_CalcResources: Error: Illegal resource setting. Aborting.\n");
217 pSettings
->bDSPEnabled
= (rSmapiInfo
.bDSPEnabled
&& rSmapiInfo
.bDSPPresent
);
218 pSettings
->bModemEnabled
= rSmapiInfo
.bModemEnabled
;
219 pSettings
->usDspIrq
= rSmapiInfo
.usDspIRQ
;
220 pSettings
->usDspDma
= rSmapiInfo
.usDspDMA
;
221 pSettings
->usDspBaseIO
= rSmapiInfo
.usDspBaseIO
;
222 pSettings
->usUartIrq
= rSmapiInfo
.usUartIRQ
;
223 pSettings
->usUartBaseIO
= rSmapiInfo
.usUartBaseIO
;
225 pSettings
->uDStoreSize
= TP_ABILITIES_DATA_SIZE
;
226 pSettings
->uIStoreSize
= TP_ABILITIES_INST_SIZE
;
227 pSettings
->uIps
= TP_ABILITIES_INTS_PER_SEC
;
229 if (pSettings
->bDSPEnabled
&& pSettings
->bModemEnabled
&& pSettings
->usDspIrq
== pSettings
->usUartIrq
) {
230 pBDData
->bShareDspIrq
= pBDData
->bShareUartIrq
= 1;
232 pBDData
->bShareDspIrq
= pBDData
->bShareUartIrq
= 0;
235 PRINTK_1(TRACE_TP3780I
, "tp3780i::tp3780I_CalcResources exit\n");
241 int tp3780I_ClaimResources(THINKPAD_BD_DATA
* pBDData
)
244 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
245 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
246 struct resource
*pres
;
249 PRINTK_2(TRACE_TP3780I
,
250 "tp3780i::tp3780I_ClaimResources entry pBDData %p\n", pBDData
);
252 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
253 pres
= request_region(pSettings
->usDspBaseIO
, 16, "mwave_3780i");
254 if ( pres
== NULL
) retval
= -EIO
;
256 retval
= check_region(pSettings
->usDspBaseIO
, 16);
257 if (!retval
) request_region(pSettings
->usDspBaseIO
, 16, "mwave_3780i");
260 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_ClaimResources: Error: Could not claim I/O region starting at %x\n", pSettings
->usDspBaseIO
);
264 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_ClaimResources exit retval %x\n", retval
);
269 int tp3780I_ReleaseResources(THINKPAD_BD_DATA
* pBDData
)
272 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
274 PRINTK_2(TRACE_TP3780I
,
275 "tp3780i::tp3780I_ReleaseResources entry pBDData %p\n", pBDData
);
277 release_region(pSettings
->usDspBaseIO
& (~3), 16);
279 if (pSettings
->bInterruptClaimed
) {
280 free_irq(pSettings
->usDspIrq
, NULL
);
281 pSettings
->bInterruptClaimed
= FALSE
;
284 PRINTK_2(TRACE_TP3780I
,
285 "tp3780i::tp3780I_ReleaseResources exit retval %x\n", retval
);
292 int tp3780I_EnableDSP(THINKPAD_BD_DATA
* pBDData
)
294 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
295 BOOLEAN bDSPPoweredUp
= FALSE
, bDSPEnabled
= FALSE
, bInterruptAllocated
= FALSE
;
297 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_EnableDSP entry pBDData %p\n", pBDData
);
299 if (pBDData
->bDSPEnabled
) {
300 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_EnableDSP: Error: DSP already enabled!\n");
304 if (!pSettings
->bDSPEnabled
) {
305 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780::tp3780I_EnableDSP: Error: pSettings->bDSPEnabled not set\n");
310 (pSettings
->usDspIrq
>= s_numIrqs
)
311 || (pSettings
->usDspDma
>= s_numDmas
)
312 || (s_ausThinkpadIrqToField
[pSettings
->usDspIrq
] == 0xFFFF)
313 || (s_ausThinkpadDmaToField
[pSettings
->usDspDma
] == 0xFFFF)
315 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_EnableDSP: Error: invalid irq %x\n", pSettings
->usDspIrq
);
320 ((pSettings
->usDspBaseIO
& 0xF00F) != 0)
321 || (pSettings
->usDspBaseIO
& 0x0FF0) == 0
323 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_EnableDSP: Error: Invalid DSP base I/O address %x\n", pSettings
->usDspBaseIO
);
327 if (pSettings
->bModemEnabled
) {
329 pSettings
->usUartIrq
>= s_numIrqs
330 || s_ausThinkpadIrqToField
[pSettings
->usUartIrq
] == 0xFFFF
332 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_EnableDSP: Error: Invalid UART IRQ %x\n", pSettings
->usUartIrq
);
335 switch (pSettings
->usUartBaseIO
) {
343 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Invalid UART base I/O address %x\n", pSettings
->usUartBaseIO
);
348 pSettings
->bDspIrqActiveLow
= pSettings
->bDspIrqPulse
= TRUE
;
349 pSettings
->bUartIrqActiveLow
= pSettings
->bUartIrqPulse
= TRUE
;
351 if (pBDData
->bShareDspIrq
) {
352 pSettings
->bDspIrqActiveLow
= FALSE
;
354 if (pBDData
->bShareUartIrq
) {
355 pSettings
->bUartIrqActiveLow
= FALSE
;
358 pSettings
->usNumTransfers
= TP_CFG_NumTransfers
;
359 pSettings
->usReRequest
= TP_CFG_RerequestTimer
;
360 pSettings
->bEnableMEMCS16
= TP_CFG_MEMCS16
;
361 pSettings
->usIsaMemCmdWidth
= TP_CFG_IsaMemCmdWidth
;
362 pSettings
->bGateIOCHRDY
= TP_CFG_GateIOCHRDY
;
363 pSettings
->bEnablePwrMgmt
= TP_CFG_EnablePwrMgmt
;
364 pSettings
->usHBusTimerLoadValue
= TP_CFG_HBusTimerValue
;
365 pSettings
->bDisableLBusTimeout
= TP_CFG_DisableLBusTimeout
;
366 pSettings
->usN_Divisor
= TP_CFG_N_Divisor
;
367 pSettings
->usM_Multiplier
= TP_CFG_M_Multiplier
;
368 pSettings
->bPllBypass
= TP_CFG_PllBypass
;
369 pSettings
->usChipletEnable
= TP_CFG_ChipletEnable
;
371 if (request_irq(pSettings
->usUartIrq
, &UartInterrupt
, 0, "mwave_uart", NULL
)) {
372 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_EnableDSP: Error: Could not get UART IRQ %x\n", pSettings
->usUartIrq
);
374 } else { /* no conflict just release */
375 free_irq(pSettings
->usUartIrq
, NULL
);
378 if (request_irq(pSettings
->usDspIrq
, &DspInterrupt
, 0, "mwave_3780i", NULL
)) {
379 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: Could not get 3780i IRQ %x\n", pSettings
->usDspIrq
);
382 PRINTK_3(TRACE_TP3780I
,
383 "tp3780i::tp3780I_EnableDSP, got interrupt %x bShareDspIrq %x\n",
384 pSettings
->usDspIrq
, pBDData
->bShareDspIrq
);
385 bInterruptAllocated
= TRUE
;
386 pSettings
->bInterruptClaimed
= TRUE
;
389 smapi_set_DSP_power_state(FALSE
);
390 if (smapi_set_DSP_power_state(TRUE
)) {
391 PRINTK_ERROR(KERN_ERR_MWAVE
"tp3780i::tp3780I_EnableDSP: Error: smapi_set_DSP_power_state(TRUE) failed\n");
394 bDSPPoweredUp
= TRUE
;
397 if (dsp3780I_EnableDSP(pSettings
, s_ausThinkpadIrqToField
, s_ausThinkpadDmaToField
)) {
398 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Error: dsp7880I_EnableDSP() failed\n");
406 pBDData
->bDSPEnabled
= TRUE
;
408 PRINTK_1(TRACE_TP3780I
, "tp3780i::tp3780I_EnableDSP exit\n");
413 PRINTK_ERROR("tp3780i::tp3780I_EnableDSP: Cleaning up\n");
415 dsp3780I_DisableDSP(pSettings
);
417 smapi_set_DSP_power_state(FALSE
);
418 if (bInterruptAllocated
) {
419 free_irq(pSettings
->usDspIrq
, NULL
);
420 pSettings
->bInterruptClaimed
= FALSE
;
426 int tp3780I_DisableDSP(THINKPAD_BD_DATA
* pBDData
)
429 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
431 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_DisableDSP entry pBDData %p\n", pBDData
);
433 if (pBDData
->bDSPEnabled
) {
434 dsp3780I_DisableDSP(&pBDData
->rDspSettings
);
435 if (pSettings
->bInterruptClaimed
) {
436 free_irq(pSettings
->usDspIrq
, NULL
);
437 pSettings
->bInterruptClaimed
= FALSE
;
439 smapi_set_DSP_power_state(FALSE
);
440 pBDData
->bDSPEnabled
= FALSE
;
443 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_DisableDSP exit retval %x\n", retval
);
449 int tp3780I_ResetDSP(THINKPAD_BD_DATA
* pBDData
)
452 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
454 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_ResetDSP entry pBDData %p\n",
457 if (dsp3780I_Reset(pSettings
) == 0) {
463 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_ResetDSP exit retval %x\n", retval
);
469 int tp3780I_StartDSP(THINKPAD_BD_DATA
* pBDData
)
472 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
474 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_StartDSP entry pBDData %p\n", pBDData
);
476 if (dsp3780I_Run(pSettings
) == 0) {
477 // @BUG @TBD EnableSRAM(pBDData);
482 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_StartDSP exit retval %x\n", retval
);
488 int tp3780I_QueryAbilities(THINKPAD_BD_DATA
* pBDData
, MW_ABILITIES
* pAbilities
)
492 PRINTK_2(TRACE_TP3780I
,
493 "tp3780i::tp3780I_QueryAbilities entry pBDData %p\n", pBDData
);
495 /* fill out standard constant fields */
496 pAbilities
->instr_per_sec
= pBDData
->rDspSettings
.uIps
;
497 pAbilities
->data_size
= pBDData
->rDspSettings
.uDStoreSize
;
498 pAbilities
->inst_size
= pBDData
->rDspSettings
.uIStoreSize
;
499 pAbilities
->bus_dma_bw
= pBDData
->rDspSettings
.uDmaBandwidth
;
501 /* fill out dynamically determined fields */
502 pAbilities
->component_list
[0] = 0x00010000 | MW_ADC_MASK
;
503 pAbilities
->component_list
[1] = 0x00010000 | MW_ACI_MASK
;
504 pAbilities
->component_list
[2] = 0x00010000 | MW_AIC1_MASK
;
505 pAbilities
->component_list
[3] = 0x00010000 | MW_AIC2_MASK
;
506 pAbilities
->component_list
[4] = 0x00010000 | MW_CDDAC_MASK
;
507 pAbilities
->component_list
[5] = 0x00010000 | MW_MIDI_MASK
;
508 pAbilities
->component_list
[6] = 0x00010000 | MW_UART_MASK
;
509 pAbilities
->component_count
= 7;
511 /* Fill out Mwave OS and BIOS task names */
513 memcpy(pAbilities
->mwave_os_name
, TP_ABILITIES_MWAVEOS_NAME
,
514 sizeof(TP_ABILITIES_MWAVEOS_NAME
));
515 memcpy(pAbilities
->bios_task_name
, TP_ABILITIES_BIOSTASK_NAME
,
516 sizeof(TP_ABILITIES_BIOSTASK_NAME
));
518 PRINTK_1(TRACE_TP3780I
,
519 "tp3780i::tp3780I_QueryAbilities exit retval=SUCCESSFUL\n");
524 int tp3780I_ReadWriteDspDStore(THINKPAD_BD_DATA
* pBDData
, unsigned int uOpcode
,
525 void __user
*pvBuffer
, unsigned int uCount
,
526 unsigned long ulDSPAddr
)
529 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
530 unsigned short usDspBaseIO
= pSettings
->usDspBaseIO
;
533 PRINTK_6(TRACE_TP3780I
,
534 "tp3780i::tp3780I_ReadWriteDspDStore entry pBDData %p, uOpcode %x, pvBuffer %p, uCount %x, ulDSPAddr %lx\n",
535 pBDData
, uOpcode
, pvBuffer
, uCount
, ulDSPAddr
);
537 if (pBDData
->bDSPEnabled
) {
539 case IOCTL_MW_READ_DATA
:
540 bRC
= dsp3780I_ReadDStore(usDspBaseIO
, pvBuffer
, uCount
, ulDSPAddr
);
543 case IOCTL_MW_READCLEAR_DATA
:
544 bRC
= dsp3780I_ReadAndClearDStore(usDspBaseIO
, pvBuffer
, uCount
, ulDSPAddr
);
547 case IOCTL_MW_WRITE_DATA
:
548 bRC
= dsp3780I_WriteDStore(usDspBaseIO
, pvBuffer
, uCount
, ulDSPAddr
);
553 retval
= (bRC
) ? -EIO
: 0;
554 PRINTK_2(TRACE_TP3780I
, "tp3780i::tp3780I_ReadWriteDspDStore exit retval %x\n", retval
);
560 int tp3780I_ReadWriteDspIStore(THINKPAD_BD_DATA
* pBDData
, unsigned int uOpcode
,
561 void __user
*pvBuffer
, unsigned int uCount
,
562 unsigned long ulDSPAddr
)
565 DSP_3780I_CONFIG_SETTINGS
*pSettings
= &pBDData
->rDspSettings
;
566 unsigned short usDspBaseIO
= pSettings
->usDspBaseIO
;
569 PRINTK_6(TRACE_TP3780I
,
570 "tp3780i::tp3780I_ReadWriteDspIStore entry pBDData %p, uOpcode %x, pvBuffer %p, uCount %x, ulDSPAddr %lx\n",
571 pBDData
, uOpcode
, pvBuffer
, uCount
, ulDSPAddr
);
573 if (pBDData
->bDSPEnabled
) {
575 case IOCTL_MW_READ_INST
:
576 bRC
= dsp3780I_ReadIStore(usDspBaseIO
, pvBuffer
, uCount
, ulDSPAddr
);
579 case IOCTL_MW_WRITE_INST
:
580 bRC
= dsp3780I_WriteIStore(usDspBaseIO
, pvBuffer
, uCount
, ulDSPAddr
);
585 retval
= (bRC
) ? -EIO
: 0;
587 PRINTK_2(TRACE_TP3780I
,
588 "tp3780i::tp3780I_ReadWriteDspIStore exit retval %x\n", retval
);