[alsa-devel] [PATCH 1/3] maestro3: Remove unused AC97 register definitions
Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com --- sound/pci/maestro3.c | 68 -------------------------------------------------- 1 files changed, 0 insertions(+), 68 deletions(-)
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index deef213..adb3b4c 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -361,74 +361,6 @@ MODULE_PARM_DESC(amp_gpio, "GPIO pin number for external amp. (default = -1)"); #define DSP2HOST_REQ_I2SRATE 0x02 #define DSP2HOST_REQ_TIMER 0x04
-/* AC97 registers */ -/* XXX fix this crap up */ -/*#define AC97_RESET 0x00*/ - -#define AC97_VOL_MUTE_B 0x8000 -#define AC97_VOL_M 0x1F -#define AC97_LEFT_VOL_S 8 - -#define AC97_MASTER_VOL 0x02 -#define AC97_LINE_LEVEL_VOL 0x04 -#define AC97_MASTER_MONO_VOL 0x06 -#define AC97_PC_BEEP_VOL 0x0A -#define AC97_PC_BEEP_VOL_M 0x0F -#define AC97_SROUND_MASTER_VOL 0x38 -#define AC97_PC_BEEP_VOL_S 1 - -/*#define AC97_PHONE_VOL 0x0C -#define AC97_MIC_VOL 0x0E*/ -#define AC97_MIC_20DB_ENABLE 0x40 - -/*#define AC97_LINEIN_VOL 0x10 -#define AC97_CD_VOL 0x12 -#define AC97_VIDEO_VOL 0x14 -#define AC97_AUX_VOL 0x16*/ -#define AC97_PCM_OUT_VOL 0x18 -/*#define AC97_RECORD_SELECT 0x1A*/ -#define AC97_RECORD_MIC 0x00 -#define AC97_RECORD_CD 0x01 -#define AC97_RECORD_VIDEO 0x02 -#define AC97_RECORD_AUX 0x03 -#define AC97_RECORD_MONO_MUX 0x02 -#define AC97_RECORD_DIGITAL 0x03 -#define AC97_RECORD_LINE 0x04 -#define AC97_RECORD_STEREO 0x05 -#define AC97_RECORD_MONO 0x06 -#define AC97_RECORD_PHONE 0x07 - -/*#define AC97_RECORD_GAIN 0x1C*/ -#define AC97_RECORD_VOL_M 0x0F - -/*#define AC97_GENERAL_PURPOSE 0x20*/ -#define AC97_POWER_DOWN_CTRL 0x26 -#define AC97_ADC_READY 0x0001 -#define AC97_DAC_READY 0x0002 -#define AC97_ANALOG_READY 0x0004 -#define AC97_VREF_ON 0x0008 -#define AC97_PR0 0x0100 -#define AC97_PR1 0x0200 -#define AC97_PR2 0x0400 -#define AC97_PR3 0x0800 -#define AC97_PR4 0x1000 - -#define AC97_RESERVED1 0x28 - -#define AC97_VENDOR_TEST 0x5A - -#define AC97_CLOCK_DELAY 0x5C -#define AC97_LINEOUT_MUX_SEL 0x0001 -#define AC97_MONO_MUX_SEL 0x0002 -#define AC97_CLOCK_DELAY_SEL 0x1F -#define AC97_DAC_CDS_SHIFT 6 -#define AC97_ADC_CDS_SHIFT 11 - -#define AC97_MULTI_CHANNEL_SEL 0x74 - -/*#define AC97_VENDOR_ID1 0x7C -#define AC97_VENDOR_ID2 0x7E*/ - /* * ASSP control regs */
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com --- Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
Regards, Ezequiel. --- sound/oss/swarm_cs4297a.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 09d4648..d0a1000 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c @@ -69,7 +69,6 @@ #include <linux/sound.h> #include <linux/slab.h> #include <linux/soundcard.h> -#include <linux/ac97_codec.h> #include <linux/pci.h> #include <linux/bitops.h> #include <linux/interrupt.h> @@ -77,6 +76,7 @@ #include <linux/poll.h> #include <linux/mutex.h> #include <linux/kernel.h> +#include <sound/ac97_codec.h>
#include <asm/byteorder.h> #include <asm/dma.h> @@ -1162,10 +1162,10 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, };
static const unsigned mixreg[] = { - AC97_PCMOUT_VOL, - AC97_AUX_VOL, - AC97_CD_VOL, - AC97_LINEIN_VOL + AC97_PCM, + AC97_AUX, + AC97_CD, + AC97_LINE }; unsigned char l, r, rl, rr, vidx; unsigned char attentbl[11] = @@ -1264,7 +1264,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source - cs4297a_read_ac97(s, AC97_RECORD_SELECT, + cs4297a_read_ac97(s, AC97_REC_SEL, &temp1); return put_user(mixer_src[temp1 & 7], (int *) arg);
@@ -1314,7 +1314,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, if (val == mixer_src[i]) { temp1 = (i << 8) | i; cs4297a_write_ac97(s, - AC97_RECORD_SELECT, + AC97_REC_SEL, temp1); return 0; } @@ -1349,8 +1349,8 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd,
temp1 |= (rl << 8) | rr;
- cs4297a_write_ac97(s, AC97_MASTER_VOL_STEREO, temp1); - cs4297a_write_ac97(s, AC97_PHONE_VOL, temp1); + cs4297a_write_ac97(s, AC97_MASTER, temp1); + cs4297a_write_ac97(s, AC97_PHONE, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[8] = ((unsigned int) r << 8) | l; @@ -1380,7 +1380,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, temp1 = 0; rl = 15 - rl; // Convert volume to attenuation. temp1 |= rl << 1; - cs4297a_write_ac97(s, AC97_PCBEEP_VOL, temp1); + cs4297a_write_ac97(s, AC97_PC_BEEP, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[6] = l << 8; @@ -1406,7 +1406,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, temp1 = 0;
temp1 = temp1 | (rl << 8) | rr; - cs4297a_write_ac97(s, AC97_RECORD_GAIN, temp1); + cs4297a_write_ac97(s, AC97_REC_GAIN, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[7] = ((unsigned int) r << 8) | l; @@ -1428,7 +1428,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, rl = ((unsigned) l * 5 - 4) / 16; // Convert 0-100 range to 0-31. l = (rl * 16 + 4) / 5; } - cs4297a_read_ac97(s, AC97_MIC_VOL, &temp1); + cs4297a_read_ac97(s, AC97_MIC, &temp1); temp1 &= 0x40; // Isolate 20db gain bit. if (rl < 3) { temp1 |= 0x8000; @@ -1436,7 +1436,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, } rl = 31 - rl; // Convert volume to attenuation. temp1 |= rl; - cs4297a_write_ac97(s, AC97_MIC_VOL, temp1); + cs4297a_write_ac97(s, AC97_MIC, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[5] = val << 8; @@ -2690,7 +2690,7 @@ static int __init cs4297a_init(void)
do { udelay(4000); - rval = cs4297a_read_ac97(s, AC97_POWER_CONTROL, &pwr); + rval = cs4297a_read_ac97(s, AC97_POWERDOWN, &pwr); } while (!rval && (pwr != 0xf));
if (!rval) {
At Mon, 11 Jun 2012 16:58:50 -0300, Ezequiel Garcia wrote:
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
A slight concern by this change is that the driver includes sound/ac97_codec.h although it's based on OSS framework. sound/ac97_codec.h is the header for ALSA ac97 structs, and this can't be mixed up with OSS.
If the intention is only about AC97 register definition, we may split ac97_codec.h into ac97_regs.h and ac97_codecs.h where the former contains only the register definitions (thus framework-neutral) and the latter includes the former.
thanks,
Takashi
Regards, Ezequiel.
sound/oss/swarm_cs4297a.c | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index 09d4648..d0a1000 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c @@ -69,7 +69,6 @@ #include <linux/sound.h> #include <linux/slab.h> #include <linux/soundcard.h> -#include <linux/ac97_codec.h> #include <linux/pci.h> #include <linux/bitops.h> #include <linux/interrupt.h> @@ -77,6 +76,7 @@ #include <linux/poll.h> #include <linux/mutex.h> #include <linux/kernel.h> +#include <sound/ac97_codec.h>
#include <asm/byteorder.h> #include <asm/dma.h> @@ -1162,10 +1162,10 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, };
static const unsigned mixreg[] = {
AC97_PCMOUT_VOL,
AC97_AUX_VOL,
AC97_CD_VOL,
AC97_LINEIN_VOL
AC97_PCM,
AC97_AUX,
AC97_CD,
}; unsigned char l, r, rl, rr, vidx; unsigned char attentbl[11] =AC97_LINE
@@ -1264,7 +1264,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, if (_SIOC_DIR(cmd) == _SIOC_READ) { switch (_IOC_NR(cmd)) { case SOUND_MIXER_RECSRC: // Arg contains a bit for each recording source
cs4297a_read_ac97(s, AC97_RECORD_SELECT,
cs4297a_read_ac97(s, AC97_REC_SEL, &temp1); return put_user(mixer_src[temp1 & 7], (int *) arg);
@@ -1314,7 +1314,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, if (val == mixer_src[i]) { temp1 = (i << 8) | i; cs4297a_write_ac97(s,
AC97_RECORD_SELECT,
AC97_REC_SEL, temp1); return 0; }
@@ -1349,8 +1349,8 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd,
temp1 |= (rl << 8) | rr;
cs4297a_write_ac97(s, AC97_MASTER_VOL_STEREO, temp1);
cs4297a_write_ac97(s, AC97_PHONE_VOL, temp1);
cs4297a_write_ac97(s, AC97_MASTER, temp1);
cs4297a_write_ac97(s, AC97_PHONE, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[8] = ((unsigned int) r << 8) | l; @@ -1380,7 +1380,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, temp1 = 0; rl = 15 - rl; // Convert volume to attenuation. temp1 |= rl << 1;
cs4297a_write_ac97(s, AC97_PCBEEP_VOL, temp1);
cs4297a_write_ac97(s, AC97_PC_BEEP, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[6] = l << 8; @@ -1406,7 +1406,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, temp1 = 0;
temp1 = temp1 | (rl << 8) | rr;
cs4297a_write_ac97(s, AC97_RECORD_GAIN, temp1);
cs4297a_write_ac97(s, AC97_REC_GAIN, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[7] = ((unsigned int) r << 8) | l; @@ -1428,7 +1428,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, rl = ((unsigned) l * 5 - 4) / 16; // Convert 0-100 range to 0-31. l = (rl * 16 + 4) / 5; }
cs4297a_read_ac97(s, AC97_MIC_VOL, &temp1);
temp1 &= 0x40; // Isolate 20db gain bit. if (rl < 3) { temp1 |= 0x8000;cs4297a_read_ac97(s, AC97_MIC, &temp1);
@@ -1436,7 +1436,7 @@ static int mixer_ioctl(struct cs4297a_state *s, unsigned int cmd, } rl = 31 - rl; // Convert volume to attenuation. temp1 |= rl;
cs4297a_write_ac97(s, AC97_MIC_VOL, temp1);
cs4297a_write_ac97(s, AC97_MIC, temp1);
#ifdef OSS_DOCUMENTED_MIXER_SEMANTICS s->mix.vol[5] = val << 8; @@ -2690,7 +2690,7 @@ static int __init cs4297a_init(void)
do { udelay(4000);
rval = cs4297a_read_ac97(s, AC97_POWER_CONTROL, &pwr);
rval = cs4297a_read_ac97(s, AC97_POWERDOWN, &pwr); } while (!rval && (pwr != 0xf)); if (!rval) {
-- 1.7.4.4
Hi Takashi,
On Mon, Jun 18, 2012 at 11:04 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 11 Jun 2012 16:58:50 -0300, Ezequiel Garcia wrote:
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
A slight concern by this change is that the driver includes sound/ac97_codec.h although it's based on OSS framework. sound/ac97_codec.h is the header for ALSA ac97 structs, and this can't be mixed up with OSS.
If the intention is only about AC97 register definition, we may split ac97_codec.h into ac97_regs.h and ac97_codecs.h where the former contains only the register definitions (thus framework-neutral) and the latter includes the former.
Yes, splitting sounds good to me. It could be useful for other ac97 drivers (e.g. em28xx).
I wonder if anyone is using this swarm driver (and/or can test).
Also, is there any date scheduled for OSS removal?
Thanks for reviewing, Ezequiel.
At Mon, 18 Jun 2012 14:50:53 -0300, Ezequiel Garcia wrote:
Hi Takashi,
On Mon, Jun 18, 2012 at 11:04 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 11 Jun 2012 16:58:50 -0300, Ezequiel Garcia wrote:
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
A slight concern by this change is that the driver includes sound/ac97_codec.h although it's based on OSS framework. sound/ac97_codec.h is the header for ALSA ac97 structs, and this can't be mixed up with OSS.
If the intention is only about AC97 register definition, we may split ac97_codec.h into ac97_regs.h and ac97_codecs.h where the former contains only the register definitions (thus framework-neutral) and the latter includes the former.
Yes, splitting sounds good to me. It could be useful for other ac97 drivers (e.g. em28xx).
I wonder if anyone is using this swarm driver (and/or can test).
Also, is there any date scheduled for OSS removal?
Well, so far, we've got rid of OSS drivers only that have the equivalent ALSA drivers. It's a difficult question when we are allowed to remove such old stuff...
Takashi
On Tue, Jun 19, 2012 at 2:38 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 18 Jun 2012 14:50:53 -0300, Ezequiel Garcia wrote:
Hi Takashi,
On Mon, Jun 18, 2012 at 11:04 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 11 Jun 2012 16:58:50 -0300, Ezequiel Garcia wrote:
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
A slight concern by this change is that the driver includes sound/ac97_codec.h although it's based on OSS framework. sound/ac97_codec.h is the header for ALSA ac97 structs, and this can't be mixed up with OSS.
If the intention is only about AC97 register definition, we may split ac97_codec.h into ac97_regs.h and ac97_codecs.h where the former contains only the register definitions (thus framework-neutral) and the latter includes the former.
Yes, splitting sounds good to me. It could be useful for other ac97 drivers (e.g. em28xx).
On a second thought, I'm not sure splitting the header is the best way to proceed. Since swarm just uses some AC97 register definition maybe we could just duplicate those (less than ten) macros in swarm c file.
It's a less intrusive aproach and it allows us to remove the unused linux/ac97_codec.h.
Regards, Ezequiel.
At Tue, 19 Jun 2012 09:41:30 -0300, Ezequiel Garcia wrote:
On Tue, Jun 19, 2012 at 2:38 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 18 Jun 2012 14:50:53 -0300, Ezequiel Garcia wrote:
Hi Takashi,
On Mon, Jun 18, 2012 at 11:04 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 11 Jun 2012 16:58:50 -0300, Ezequiel Garcia wrote:
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
A slight concern by this change is that the driver includes sound/ac97_codec.h although it's based on OSS framework. sound/ac97_codec.h is the header for ALSA ac97 structs, and this can't be mixed up with OSS.
If the intention is only about AC97 register definition, we may split ac97_codec.h into ac97_regs.h and ac97_codecs.h where the former contains only the register definitions (thus framework-neutral) and the latter includes the former.
Yes, splitting sounds good to me. It could be useful for other ac97 drivers (e.g. em28xx).
On a second thought, I'm not sure splitting the header is the best way to proceed. Since swarm just uses some AC97 register definition maybe we could just duplicate those (less than ten) macros in swarm c file.
It's a less intrusive aproach and it allows us to remove the unused linux/ac97_codec.h.
I'm OK in both ways.
Takashi
On Tue, Jun 19, 2012 at 9:47 AM, Takashi Iwai tiwai@suse.de wrote:
At Tue, 19 Jun 2012 09:41:30 -0300, Ezequiel Garcia wrote:
On Tue, Jun 19, 2012 at 2:38 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 18 Jun 2012 14:50:53 -0300, Ezequiel Garcia wrote:
Hi Takashi,
On Mon, Jun 18, 2012 at 11:04 AM, Takashi Iwai tiwai@suse.de wrote:
At Mon, 11 Jun 2012 16:58:50 -0300, Ezequiel Garcia wrote:
This patch removes the last usage of linux/ac97_codec.h by renaming ac97 registers to use sound/ac97_codec.h definitions. This will enable us to remove linux/ac97_codec.h.
Not even compilation tested.
Cc: Ralf Baechle ralf@linux-mips.org Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Hi all,
This patch is important so we can remove linux/ac97_codec.h usage. Since this driver is mips related, I can't test it until I install a mips toolchain. If someone can compile this for me, or even test it with real hardware I think it would be better. If not then I can install a mips toolchain and compile it myself, but I won't be able to test it on real hardware.
This patch should be treated with carefully and be applied only if someone manages to test it.
A slight concern by this change is that the driver includes sound/ac97_codec.h although it's based on OSS framework. sound/ac97_codec.h is the header for ALSA ac97 structs, and this can't be mixed up with OSS.
If the intention is only about AC97 register definition, we may split ac97_codec.h into ac97_regs.h and ac97_codecs.h where the former contains only the register definitions (thus framework-neutral) and the latter includes the former.
Yes, splitting sounds good to me. It could be useful for other ac97 drivers (e.g. em28xx).
On a second thought, I'm not sure splitting the header is the best way to proceed. Since swarm just uses some AC97 register definition maybe we could just duplicate those (less than ten) macros in swarm c file.
It's a less intrusive aproach and it allows us to remove the unused linux/ac97_codec.h.
I'm OK in both ways.
Okey, consider this last two patches nacked and I'll prepare new ones. Still, I would like someone to *at least* compile swarm driver with the patch.
Thanks, Ezequiel.
This file has been superseded by include/sound/ac97_codec.h, and has currently no users.
Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com --- include/linux/ac97_codec.h | 362 -------------------------------------------- 1 files changed, 0 insertions(+), 362 deletions(-) delete mode 100644 include/linux/ac97_codec.h
diff --git a/include/linux/ac97_codec.h b/include/linux/ac97_codec.h deleted file mode 100644 index 0260c3e..0000000 --- a/include/linux/ac97_codec.h +++ /dev/null @@ -1,362 +0,0 @@ -#ifndef _AC97_CODEC_H_ -#define _AC97_CODEC_H_ - -#include <linux/types.h> -#include <linux/soundcard.h> - -/* AC97 1.0 */ -#define AC97_RESET 0x0000 // -#define AC97_MASTER_VOL_STEREO 0x0002 // Line Out -#define AC97_HEADPHONE_VOL 0x0004 // -#define AC97_MASTER_VOL_MONO 0x0006 // TAD Output -#define AC97_MASTER_TONE 0x0008 // -#define AC97_PCBEEP_VOL 0x000a // none -#define AC97_PHONE_VOL 0x000c // TAD Input (mono) -#define AC97_MIC_VOL 0x000e // MIC Input (mono) -#define AC97_LINEIN_VOL 0x0010 // Line Input (stereo) -#define AC97_CD_VOL 0x0012 // CD Input (stereo) -#define AC97_VIDEO_VOL 0x0014 // none -#define AC97_AUX_VOL 0x0016 // Aux Input (stereo) -#define AC97_PCMOUT_VOL 0x0018 // Wave Output (stereo) -#define AC97_RECORD_SELECT 0x001a // -#define AC97_RECORD_GAIN 0x001c -#define AC97_RECORD_GAIN_MIC 0x001e -#define AC97_GENERAL_PURPOSE 0x0020 -#define AC97_3D_CONTROL 0x0022 -#define AC97_MODEM_RATE 0x0024 -#define AC97_POWER_CONTROL 0x0026 - -/* AC'97 2.0 */ -#define AC97_EXTENDED_ID 0x0028 /* Extended Audio ID */ -#define AC97_EXTENDED_STATUS 0x002A /* Extended Audio Status */ -#define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */ -#define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */ -#define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */ -#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */ -#define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */ -#define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */ -#define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */ -#define AC97_RESERVED_3A 0x003A /* Reserved in AC '97 < 2.2 */ - -/* AC'97 2.2 */ -#define AC97_SPDIF_CONTROL 0x003A /* S/PDIF Control */ - -/* range 0x3c-0x58 - MODEM */ -#define AC97_EXTENDED_MODEM_ID 0x003C -#define AC97_EXTEND_MODEM_STAT 0x003E -#define AC97_LINE1_RATE 0x0040 -#define AC97_LINE2_RATE 0x0042 -#define AC97_HANDSET_RATE 0x0044 -#define AC97_LINE1_LEVEL 0x0046 -#define AC97_LINE2_LEVEL 0x0048 -#define AC97_HANDSET_LEVEL 0x004A -#define AC97_GPIO_CONFIG 0x004C -#define AC97_GPIO_POLARITY 0x004E -#define AC97_GPIO_STICKY 0x0050 -#define AC97_GPIO_WAKE_UP 0x0052 -#define AC97_GPIO_STATUS 0x0054 -#define AC97_MISC_MODEM_STAT 0x0056 -#define AC97_RESERVED_58 0x0058 - -/* registers 0x005a - 0x007a are vendor reserved */ - -#define AC97_VENDOR_ID1 0x007c -#define AC97_VENDOR_ID2 0x007e - -/* volume control bit defines */ -#define AC97_MUTE 0x8000 -#define AC97_MICBOOST 0x0040 -#define AC97_LEFTVOL 0x3f00 -#define AC97_RIGHTVOL 0x003f - -/* record mux defines */ -#define AC97_RECMUX_MIC 0x0000 -#define AC97_RECMUX_CD 0x0101 -#define AC97_RECMUX_VIDEO 0x0202 -#define AC97_RECMUX_AUX 0x0303 -#define AC97_RECMUX_LINE 0x0404 -#define AC97_RECMUX_STEREO_MIX 0x0505 -#define AC97_RECMUX_MONO_MIX 0x0606 -#define AC97_RECMUX_PHONE 0x0707 - -/* general purpose register bit defines */ -#define AC97_GP_LPBK 0x0080 /* Loopback mode */ -#define AC97_GP_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 */ -#define AC97_GP_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic */ -#define AC97_GP_RLBK 0x0400 /* Remote Loopback - Modem line codec */ -#define AC97_GP_LLBK 0x0800 /* Local Loopback - Modem Line codec */ -#define AC97_GP_LD 0x1000 /* Loudness 1=on */ -#define AC97_GP_3D 0x2000 /* 3D Enhancement 1=on */ -#define AC97_GP_ST 0x4000 /* Stereo Enhancement 1=on */ -#define AC97_GP_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */ - -/* extended audio status and control bit defines */ -#define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */ -#define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */ -#define AC97_EA_SPDIF 0x0004 /* S/PDIF Enable bit */ -#define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */ -#define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */ -#define AC97_EA_SDAC 0x0040 /* PCM Surround DACs are ready (Read only) */ -#define AC97_EA_LDAC 0x0080 /* PCM LFE DAC is ready (Read only) */ -#define AC97_EA_MDAC 0x0100 /* MIC ADC is ready (Read only) */ -#define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */ -#define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */ -#define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */ -#define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */ -#define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */ -#define AC97_EA_SLOT_MASK 0xffcf /* Mask for slot assignment bits */ -#define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */ -#define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */ -#define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */ -#define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */ - -/* S/PDIF control bit defines */ -#define AC97_SC_PRO 0x0001 /* Professional status */ -#define AC97_SC_NAUDIO 0x0002 /* Non audio stream */ -#define AC97_SC_COPY 0x0004 /* Copyright status */ -#define AC97_SC_PRE 0x0008 /* Preemphasis status */ -#define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */ -#define AC97_SC_L 0x0800 /* Generation Level status */ -#define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */ -#define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */ -#define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */ -#define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */ -#define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */ -#define AC97_SC_V 0x8000 /* Validity status */ - -/* powerdown control and status bit defines */ - -/* status */ -#define AC97_PWR_MDM 0x0010 /* Modem section ready */ -#define AC97_PWR_REF 0x0008 /* Vref nominal */ -#define AC97_PWR_ANL 0x0004 /* Analog section ready */ -#define AC97_PWR_DAC 0x0002 /* DAC section ready */ -#define AC97_PWR_ADC 0x0001 /* ADC section ready */ - -/* control */ -#define AC97_PWR_PR0 0x0100 /* ADC and Mux powerdown */ -#define AC97_PWR_PR1 0x0200 /* DAC powerdown */ -#define AC97_PWR_PR2 0x0400 /* Output mixer powerdown (Vref on) */ -#define AC97_PWR_PR3 0x0800 /* Output mixer powerdown (Vref off) */ -#define AC97_PWR_PR4 0x1000 /* AC-link powerdown */ -#define AC97_PWR_PR5 0x2000 /* Internal Clk disable */ -#define AC97_PWR_PR6 0x4000 /* HP amp powerdown */ -#define AC97_PWR_PR7 0x8000 /* Modem off - if supported */ - -/* extended audio ID register bit defines */ -#define AC97_EXTID_VRA 0x0001 -#define AC97_EXTID_DRA 0x0002 -#define AC97_EXTID_SPDIF 0x0004 -#define AC97_EXTID_VRM 0x0008 -#define AC97_EXTID_DSA0 0x0010 -#define AC97_EXTID_DSA1 0x0020 -#define AC97_EXTID_CDAC 0x0040 -#define AC97_EXTID_SDAC 0x0080 -#define AC97_EXTID_LDAC 0x0100 -#define AC97_EXTID_AMAP 0x0200 -#define AC97_EXTID_REV0 0x0400 -#define AC97_EXTID_REV1 0x0800 -#define AC97_EXTID_ID0 0x4000 -#define AC97_EXTID_ID1 0x8000 - -/* extended status register bit defines */ -#define AC97_EXTSTAT_VRA 0x0001 -#define AC97_EXTSTAT_DRA 0x0002 -#define AC97_EXTSTAT_SPDIF 0x0004 -#define AC97_EXTSTAT_VRM 0x0008 -#define AC97_EXTSTAT_SPSA0 0x0010 -#define AC97_EXTSTAT_SPSA1 0x0020 -#define AC97_EXTSTAT_CDAC 0x0040 -#define AC97_EXTSTAT_SDAC 0x0080 -#define AC97_EXTSTAT_LDAC 0x0100 -#define AC97_EXTSTAT_MADC 0x0200 -#define AC97_EXTSTAT_SPCV 0x0400 -#define AC97_EXTSTAT_PRI 0x0800 -#define AC97_EXTSTAT_PRJ 0x1000 -#define AC97_EXTSTAT_PRK 0x2000 -#define AC97_EXTSTAT_PRL 0x4000 - -/* extended audio ID register bit defines */ -#define AC97_EXTID_VRA 0x0001 -#define AC97_EXTID_DRA 0x0002 -#define AC97_EXTID_SPDIF 0x0004 -#define AC97_EXTID_VRM 0x0008 -#define AC97_EXTID_DSA0 0x0010 -#define AC97_EXTID_DSA1 0x0020 -#define AC97_EXTID_CDAC 0x0040 -#define AC97_EXTID_SDAC 0x0080 -#define AC97_EXTID_LDAC 0x0100 -#define AC97_EXTID_AMAP 0x0200 -#define AC97_EXTID_REV0 0x0400 -#define AC97_EXTID_REV1 0x0800 -#define AC97_EXTID_ID0 0x4000 -#define AC97_EXTID_ID1 0x8000 - -/* extended status register bit defines */ -#define AC97_EXTSTAT_VRA 0x0001 -#define AC97_EXTSTAT_DRA 0x0002 -#define AC97_EXTSTAT_SPDIF 0x0004 -#define AC97_EXTSTAT_VRM 0x0008 -#define AC97_EXTSTAT_SPSA0 0x0010 -#define AC97_EXTSTAT_SPSA1 0x0020 -#define AC97_EXTSTAT_CDAC 0x0040 -#define AC97_EXTSTAT_SDAC 0x0080 -#define AC97_EXTSTAT_LDAC 0x0100 -#define AC97_EXTSTAT_MADC 0x0200 -#define AC97_EXTSTAT_SPCV 0x0400 -#define AC97_EXTSTAT_PRI 0x0800 -#define AC97_EXTSTAT_PRJ 0x1000 -#define AC97_EXTSTAT_PRK 0x2000 -#define AC97_EXTSTAT_PRL 0x4000 - -/* useful power states */ -#define AC97_PWR_D0 0x0000 /* everything on */ -#define AC97_PWR_D1 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4 -#define AC97_PWR_D2 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4 -#define AC97_PWR_D3 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4 -#define AC97_PWR_ANLOFF AC97_PWR_PR2|AC97_PWR_PR3 /* analog section off */ - -/* Total number of defined registers. */ -#define AC97_REG_CNT 64 - - -/* OSS interface to the ac97s.. */ -#define AC97_STEREO_MASK (SOUND_MASK_VOLUME|SOUND_MASK_PCM|\ - SOUND_MASK_LINE|SOUND_MASK_CD|\ - SOUND_MASK_ALTPCM|SOUND_MASK_IGAIN|\ - SOUND_MASK_LINE1|SOUND_MASK_VIDEO) - -#define AC97_SUPPORTED_MASK (AC97_STEREO_MASK | \ - SOUND_MASK_BASS|SOUND_MASK_TREBLE|\ - SOUND_MASK_SPEAKER|SOUND_MASK_MIC|\ - SOUND_MASK_PHONEIN|SOUND_MASK_PHONEOUT) - -#define AC97_RECORD_MASK (SOUND_MASK_MIC|\ - SOUND_MASK_CD|SOUND_MASK_IGAIN|SOUND_MASK_VIDEO|\ - SOUND_MASK_LINE1| SOUND_MASK_LINE|\ - SOUND_MASK_PHONEIN) - -/* original check is not good enough in case FOO is greater than - * SOUND_MIXER_NRDEVICES because the supported_mixers has exactly - * SOUND_MIXER_NRDEVICES elements. - * before matching the given mixer against the bitmask in supported_mixers we - * check if mixer number exceeds maximum allowed size which is as mentioned - * above SOUND_MIXER_NRDEVICES */ -#define supported_mixer(CODEC,FOO) ((FOO >= 0) && \ - (FOO < SOUND_MIXER_NRDEVICES) && \ - (CODEC)->supported_mixers & (1<<FOO) ) - -struct ac97_codec { - /* Linked list of codecs */ - struct list_head list; - - /* AC97 controller connected with */ - void *private_data; - - char *name; - int id; - int dev_mixer; - int type; - u32 model; - - unsigned int modem:1; - - struct ac97_ops *codec_ops; - - /* controller specific lower leverl ac97 accessing routines. - must be re-entrant safe */ - u16 (*codec_read) (struct ac97_codec *codec, u8 reg); - void (*codec_write) (struct ac97_codec *codec, u8 reg, u16 val); - - /* Wait for codec-ready. Ok to sleep here. */ - void (*codec_wait) (struct ac97_codec *codec); - - /* callback used by helper drivers for interesting ac97 setups */ - void (*codec_unregister) (struct ac97_codec *codec); - - struct ac97_driver *driver; - void *driver_private; /* Private data for the driver */ - - spinlock_t lock; - - /* OSS mixer masks */ - int modcnt; - int supported_mixers; - int stereo_mixers; - int record_sources; - - /* Property flags */ - int flags; - - int bit_resolution; - - /* OSS mixer interface */ - int (*read_mixer) (struct ac97_codec *codec, int oss_channel); - void (*write_mixer)(struct ac97_codec *codec, int oss_channel, - unsigned int left, unsigned int right); - int (*recmask_io) (struct ac97_codec *codec, int rw, int mask); - int (*mixer_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg); - - /* saved OSS mixer states */ - unsigned int mixer_state[SOUND_MIXER_NRDEVICES]; - - /* Software Modem interface */ - int (*modem_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg); -}; - -/* - * Operation structures for each known AC97 chip - */ - -struct ac97_ops -{ - /* Initialise */ - int (*init)(struct ac97_codec *c); - /* Amplifier control */ - int (*amplifier)(struct ac97_codec *codec, int on); - /* Digital mode control */ - int (*digital)(struct ac97_codec *codec, int slots, int rate, int mode); -#define AUDIO_DIGITAL 0x8000 -#define AUDIO_PRO 0x4000 -#define AUDIO_DRS 0x2000 -#define AUDIO_CCMASK 0x003F - -#define AC97_DELUDED_MODEM 1 /* Audio codec reports its a modem */ -#define AC97_NO_PCM_VOLUME 2 /* Volume control is missing */ -#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */ -}; - -extern int ac97_probe_codec(struct ac97_codec *); - -extern struct ac97_codec *ac97_alloc_codec(void); -extern void ac97_release_codec(struct ac97_codec *codec); - -struct ac97_driver { - struct list_head list; - char *name; - u32 codec_id; - u32 codec_mask; - int (*probe) (struct ac97_codec *codec, struct ac97_driver *driver); - void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver); -}; - -/* quirk types */ -enum { - AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */ - AC97_TUNE_NONE = 0, /* nothing extra to do */ - AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */ - AC97_TUNE_SWAP_HP, /* swap headphone and master controls */ - AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */ - AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */ - AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */ -}; - -struct ac97_quirk { - unsigned short vendor; /* PCI vendor id */ - unsigned short device; /* PCI device id */ - unsigned short mask; /* device id bit mask, 0 = accept all */ - const char *name; /* name shown as info */ - int type; /* quirk type above */ -}; - -#endif /* _AC97_CODEC_H_ */
At Mon, 11 Jun 2012 16:58:49 -0300, Ezequiel Garcia wrote:
Cc: Jaroslav Kysela perex@perex.cz Cc: Takashi Iwai tiwai@suse.de Cc: Clemens Ladisch clemens@ladisch.de Signed-off-by: Ezequiel Garcia elezegarcia@gmail.com
Applied this one, but left others for now.
thanks,
Takashi
sound/pci/maestro3.c | 68 -------------------------------------------------- 1 files changed, 0 insertions(+), 68 deletions(-)
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index deef213..adb3b4c 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c @@ -361,74 +361,6 @@ MODULE_PARM_DESC(amp_gpio, "GPIO pin number for external amp. (default = -1)"); #define DSP2HOST_REQ_I2SRATE 0x02 #define DSP2HOST_REQ_TIMER 0x04
-/* AC97 registers */ -/* XXX fix this crap up */ -/*#define AC97_RESET 0x00*/
-#define AC97_VOL_MUTE_B 0x8000 -#define AC97_VOL_M 0x1F -#define AC97_LEFT_VOL_S 8
-#define AC97_MASTER_VOL 0x02 -#define AC97_LINE_LEVEL_VOL 0x04 -#define AC97_MASTER_MONO_VOL 0x06 -#define AC97_PC_BEEP_VOL 0x0A -#define AC97_PC_BEEP_VOL_M 0x0F -#define AC97_SROUND_MASTER_VOL 0x38 -#define AC97_PC_BEEP_VOL_S 1
-/*#define AC97_PHONE_VOL 0x0C -#define AC97_MIC_VOL 0x0E*/ -#define AC97_MIC_20DB_ENABLE 0x40
-/*#define AC97_LINEIN_VOL 0x10 -#define AC97_CD_VOL 0x12 -#define AC97_VIDEO_VOL 0x14 -#define AC97_AUX_VOL 0x16*/ -#define AC97_PCM_OUT_VOL 0x18 -/*#define AC97_RECORD_SELECT 0x1A*/ -#define AC97_RECORD_MIC 0x00 -#define AC97_RECORD_CD 0x01 -#define AC97_RECORD_VIDEO 0x02 -#define AC97_RECORD_AUX 0x03 -#define AC97_RECORD_MONO_MUX 0x02 -#define AC97_RECORD_DIGITAL 0x03 -#define AC97_RECORD_LINE 0x04 -#define AC97_RECORD_STEREO 0x05 -#define AC97_RECORD_MONO 0x06 -#define AC97_RECORD_PHONE 0x07
-/*#define AC97_RECORD_GAIN 0x1C*/ -#define AC97_RECORD_VOL_M 0x0F
-/*#define AC97_GENERAL_PURPOSE 0x20*/ -#define AC97_POWER_DOWN_CTRL 0x26 -#define AC97_ADC_READY 0x0001 -#define AC97_DAC_READY 0x0002 -#define AC97_ANALOG_READY 0x0004 -#define AC97_VREF_ON 0x0008 -#define AC97_PR0 0x0100 -#define AC97_PR1 0x0200 -#define AC97_PR2 0x0400 -#define AC97_PR3 0x0800 -#define AC97_PR4 0x1000
-#define AC97_RESERVED1 0x28
-#define AC97_VENDOR_TEST 0x5A
-#define AC97_CLOCK_DELAY 0x5C -#define AC97_LINEOUT_MUX_SEL 0x0001 -#define AC97_MONO_MUX_SEL 0x0002 -#define AC97_CLOCK_DELAY_SEL 0x1F -#define AC97_DAC_CDS_SHIFT 6 -#define AC97_ADC_CDS_SHIFT 11
-#define AC97_MULTI_CHANNEL_SEL 0x74
-/*#define AC97_VENDOR_ID1 0x7C -#define AC97_VENDOR_ID2 0x7E*/
/*
- ASSP control regs
*/
1.7.4.4
participants (2)
-
Ezequiel Garcia
-
Takashi Iwai