112
112
#include <sound/ac97_codec.h>
113
113
#include <sound/initval.h>
115
#ifdef CONFIG_SND_ES1968_RADIO
116
#include <sound/tea575x-tuner.h>
115
119
#define CARD_NAME "ESS Maestro1/2"
116
120
#define DRIVER_NAME "ES1968"
2572
2580
#endif /* CONFIG_SND_ES1968_INPUT */
2582
#ifdef CONFIG_SND_ES1968_RADIO
2583
#define GPIO_DATA 0x60
2584
#define IO_MASK 4 /* mask register offset from GPIO_DATA
2585
bits 1=unmask write to given bit */
2586
#define IO_DIR 8 /* direction register offset from GPIO_DATA
2587
bits 0/1=read/write direction */
2588
/* mask bits for GPIO lines */
2589
#define STR_DATA 0x0040 /* GPIO6 */
2590
#define STR_CLK 0x0080 /* GPIO7 */
2591
#define STR_WREN 0x0100 /* GPIO8 */
2592
#define STR_MOST 0x0200 /* GPIO9 */
2594
static void snd_es1968_tea575x_set_pins(struct snd_tea575x *tea, u8 pins)
2596
struct es1968 *chip = tea->private_data;
2597
unsigned long io = chip->io_port + GPIO_DATA;
2600
val |= (pins & TEA575X_DATA) ? STR_DATA : 0;
2601
val |= (pins & TEA575X_CLK) ? STR_CLK : 0;
2602
val |= (pins & TEA575X_WREN) ? STR_WREN : 0;
2607
static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea)
2609
struct es1968 *chip = tea->private_data;
2610
unsigned long io = chip->io_port + GPIO_DATA;
2613
return (val & STR_DATA) ? TEA575X_DATA : 0 |
2614
(val & STR_MOST) ? TEA575X_MOST : 0;
2617
static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool output)
2619
struct es1968 *chip = tea->private_data;
2620
unsigned long io = chip->io_port + GPIO_DATA;
2621
u16 odir = inw(io + IO_DIR);
2624
outw(~(STR_DATA | STR_CLK | STR_WREN), io + IO_MASK);
2625
outw(odir | STR_DATA | STR_CLK | STR_WREN, io + IO_DIR);
2627
outw(~(STR_CLK | STR_WREN | STR_DATA | STR_MOST), io + IO_MASK);
2628
outw((odir & ~(STR_DATA | STR_MOST)) | STR_CLK | STR_WREN, io + IO_DIR);
2632
static struct snd_tea575x_ops snd_es1968_tea_ops = {
2633
.set_pins = snd_es1968_tea575x_set_pins,
2634
.get_pins = snd_es1968_tea575x_get_pins,
2635
.set_direction = snd_es1968_tea575x_set_direction,
2574
2639
static int snd_es1968_free(struct es1968 *chip)
2576
2641
#ifdef CONFIG_SND_ES1968_INPUT
2585
2650
outw(0, chip->io_port + ESM_PORT_HOST_IRQ); /* disable IRQ */
2653
#ifdef CONFIG_SND_ES1968_RADIO
2654
snd_tea575x_exit(&chip->tea);
2588
2657
if (chip->irq >= 0)
2589
2658
free_irq(chip->irq, chip);
2590
2659
snd_es1968_free_gameport(chip);
2724
2793
snd_card_set_dev(card, &pci->dev);
2795
#ifdef CONFIG_SND_ES1968_RADIO
2796
chip->tea.private_data = chip;
2797
chip->tea.ops = &snd_es1968_tea_ops;
2798
strlcpy(chip->tea.card, "SF64-PCE2", sizeof(chip->tea.card));
2799
sprintf(chip->tea.bus_info, "PCI:%s", pci_name(pci));
2800
if (!snd_tea575x_init(&chip->tea))
2801
printk(KERN_INFO "es1968: detected TEA575x radio\n");
2726
2804
*chip_ret = chip;