From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751943Ab2FROE7 (ORCPT ); Mon, 18 Jun 2012 10:04:59 -0400 Received: from cantor2.suse.de ([195.135.220.15]:54373 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042Ab2FROE6 (ORCPT ); Mon, 18 Jun 2012 10:04:58 -0400 Date: Mon, 18 Jun 2012 16:04:56 +0200 Message-ID: From: Takashi Iwai To: Ezequiel Garcia Cc: , alsa-devel@alsa-project.org, Ralf Baechle , Jaroslav Kysela , Clemens Ladisch Subject: Re: [PATCH 2/3] swarm_cs4297: Rename AC97 registers to use sound/ac97_codec.h definitions In-Reply-To: <1339444731-15678-2-git-send-email-elezegarcia@gmail.com> References: <1339444731-15678-1-git-send-email-elezegarcia@gmail.com> <1339444731-15678-2-git-send-email-elezegarcia@gmail.com> User-Agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.7 Emacs/23.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Jaroslav Kysela > Cc: Takashi Iwai > Cc: Clemens Ladisch > Signed-off-by: Ezequiel Garcia > --- > 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 > #include > #include > -#include > #include > #include > #include > @@ -77,6 +76,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -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) { > -- > 1.7.4.4 > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH 2/3] swarm_cs4297: Rename AC97 registers to use sound/ac97_codec.h definitions Date: Mon, 18 Jun 2012 16:04:56 +0200 Message-ID: References: <1339444731-15678-1-git-send-email-elezegarcia@gmail.com> <1339444731-15678-2-git-send-email-elezegarcia@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 9937224344 for ; Mon, 18 Jun 2012 16:04:56 +0200 (CEST) In-Reply-To: <1339444731-15678-2-git-send-email-elezegarcia@gmail.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Ezequiel Garcia Cc: alsa-devel@alsa-project.org, Clemens Ladisch , linux-kernel@vger.kernel.org, Ralf Baechle List-Id: alsa-devel@alsa-project.org 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 > Cc: Jaroslav Kysela > Cc: Takashi Iwai > Cc: Clemens Ladisch > Signed-off-by: Ezequiel Garcia > --- > 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 > #include > #include > -#include > #include > #include > #include > @@ -77,6 +76,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -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) { > -- > 1.7.4.4 >