diff mbox

[RFC,v2,1/3] ALSA: hda: add HDA_MAX_CODECS

Message ID 1427263299-14707-2-git-send-email-vinod.koul@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vinod Koul March 25, 2015, 6:01 a.m. UTC
This moves AZX_MAX_CODECS define to HDA_MAX_CODECS so that common code can
use this as well

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
---
 include/sound/hda_verbs.h      |    1 +
 sound/pci/hda/hda_controller.c |    4 ++--
 sound/pci/hda/hda_controller.h |    9 ++++-----
 3 files changed, 7 insertions(+), 7 deletions(-)

Comments

Takashi Iwai March 25, 2015, 6:48 a.m. UTC | #1
At Wed, 25 Mar 2015 11:31:37 +0530,
Vinod Koul wrote:
> 
> This moves AZX_MAX_CODECS define to HDA_MAX_CODECS so that common code can
> use this as well

Well, HDA_MAX_CODECS = 8 isn't about the codec specification, but
rather a limitation of the current standard HD-audio controller h/w.
The spec itself limits to 16 (= 0x0f).

So, I don't want to mix this into hda_verbs.h that is the place
defining the specification.  It's fine to move to hdaudio.h instead,
though.


thanks,

Takashi

> 
> Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> ---
>  include/sound/hda_verbs.h      |    1 +
>  sound/pci/hda/hda_controller.c |    4 ++--
>  sound/pci/hda/hda_controller.h |    9 ++++-----
>  3 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/sound/hda_verbs.h b/include/sound/hda_verbs.h
> index d0509db6d0ec..42b8415b2254 100644
> --- a/include/sound/hda_verbs.h
> +++ b/include/sound/hda_verbs.h
> @@ -550,5 +550,6 @@ enum {
>  
>  /* max. codec address */
>  #define HDA_MAX_CODEC_ADDRESS	0x0f
> +#define HDA_MAX_CODECS		8
>  
>  #endif /* __SOUND_HDA_VERBS_H */
> diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
> index 26ce990592a0..abb3822f5488 100644
> --- a/sound/pci/hda/hda_controller.c
> +++ b/sound/pci/hda/hda_controller.c
> @@ -1066,7 +1066,7 @@ static unsigned int azx_command_addr(u32 cmd)
>  {
>  	unsigned int addr = cmd >> 28;
>  
> -	if (addr >= AZX_MAX_CODECS) {
> +	if (addr >= HDA_MAX_CODECS) {
>  		snd_BUG();
>  		addr = 0;
>  	}
> @@ -1136,7 +1136,7 @@ static void azx_update_rirb(struct azx *chip)
>  		res_ex = le32_to_cpu(chip->rirb.buf[rp + 1]);
>  		res = le32_to_cpu(chip->rirb.buf[rp]);
>  		addr = res_ex & 0xf;
> -		if ((addr >= AZX_MAX_CODECS) || !(chip->codec_mask & (1 << addr))) {
> +		if ((addr >= HDA_MAX_CODECS) || !(chip->codec_mask & (1 << addr))) {
>  			dev_err(chip->card->dev, "spurious response %#x:%#x, rp = %d, wp = %d",
>  				res, res_ex,
>  				chip->rirb.rp, wp);
> diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
> index be1b7ded8d82..2aa75e34a718 100644
> --- a/sound/pci/hda/hda_controller.h
> +++ b/sound/pci/hda/hda_controller.h
> @@ -119,9 +119,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
>  #define RIRB_INT_MASK		0x05
>  
>  /* STATESTS int mask: S3,SD2,SD1,SD0 */
> -#define AZX_MAX_CODECS		8
>  #define AZX_DEFAULT_CODECS	4
> -#define STATESTS_INT_MASK	((1 << AZX_MAX_CODECS) - 1)
> +#define STATESTS_INT_MASK	((1 << HDA_MAX_CODECS) - 1)
>  
>  /* SD_CTL bits */
>  #define SD_CTL_STREAM_RESET	0x01	/* stream reset bit */
> @@ -245,8 +244,8 @@ struct azx_rb {
>  	dma_addr_t addr;	/* physical address of CORB/RIRB buffer */
>  	/* for RIRB */
>  	unsigned short rp, wp;	/* read/write pointers */
> -	int cmds[AZX_MAX_CODECS];	/* number of pending requests */
> -	u32 res[AZX_MAX_CODECS];	/* last read value */
> +	int cmds[HDA_MAX_CODECS];	/* number of pending requests */
> +	u32 res[HDA_MAX_CODECS];	/* last read value */
>  };
>  
>  struct azx;
> @@ -360,7 +359,7 @@ struct azx {
>  	unsigned int disabled:1; /* disabled by VGA-switcher */
>  
>  	/* for debugging */
> -	unsigned int last_cmd[AZX_MAX_CODECS];
> +	unsigned int last_cmd[HDA_MAX_CODECS];
>  
>  #ifdef CONFIG_SND_HDA_DSP_LOADER
>  	struct azx_dev saved_azx_dev;
> -- 
> 1.7.9.5
>
Vinod Koul March 25, 2015, 7:51 a.m. UTC | #2
On Wed, Mar 25, 2015 at 07:48:44AM +0100, Takashi Iwai wrote:
> At Wed, 25 Mar 2015 11:31:37 +0530,
> Vinod Koul wrote:
> > 
> > This moves AZX_MAX_CODECS define to HDA_MAX_CODECS so that common code can
> > use this as well
> 
> Well, HDA_MAX_CODECS = 8 isn't about the codec specification, but
> rather a limitation of the current standard HD-audio controller h/w.
> The spec itself limits to 16 (= 0x0f).
> 
> So, I don't want to mix this into hda_verbs.h that is the place
> defining the specification.  It's fine to move to hdaudio.h instead,
> though.
Sure I will move it there...
diff mbox

Patch

diff --git a/include/sound/hda_verbs.h b/include/sound/hda_verbs.h
index d0509db6d0ec..42b8415b2254 100644
--- a/include/sound/hda_verbs.h
+++ b/include/sound/hda_verbs.h
@@ -550,5 +550,6 @@  enum {
 
 /* max. codec address */
 #define HDA_MAX_CODEC_ADDRESS	0x0f
+#define HDA_MAX_CODECS		8
 
 #endif /* __SOUND_HDA_VERBS_H */
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 26ce990592a0..abb3822f5488 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1066,7 +1066,7 @@  static unsigned int azx_command_addr(u32 cmd)
 {
 	unsigned int addr = cmd >> 28;
 
-	if (addr >= AZX_MAX_CODECS) {
+	if (addr >= HDA_MAX_CODECS) {
 		snd_BUG();
 		addr = 0;
 	}
@@ -1136,7 +1136,7 @@  static void azx_update_rirb(struct azx *chip)
 		res_ex = le32_to_cpu(chip->rirb.buf[rp + 1]);
 		res = le32_to_cpu(chip->rirb.buf[rp]);
 		addr = res_ex & 0xf;
-		if ((addr >= AZX_MAX_CODECS) || !(chip->codec_mask & (1 << addr))) {
+		if ((addr >= HDA_MAX_CODECS) || !(chip->codec_mask & (1 << addr))) {
 			dev_err(chip->card->dev, "spurious response %#x:%#x, rp = %d, wp = %d",
 				res, res_ex,
 				chip->rirb.rp, wp);
diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h
index be1b7ded8d82..2aa75e34a718 100644
--- a/sound/pci/hda/hda_controller.h
+++ b/sound/pci/hda/hda_controller.h
@@ -119,9 +119,8 @@  enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 #define RIRB_INT_MASK		0x05
 
 /* STATESTS int mask: S3,SD2,SD1,SD0 */
-#define AZX_MAX_CODECS		8
 #define AZX_DEFAULT_CODECS	4
-#define STATESTS_INT_MASK	((1 << AZX_MAX_CODECS) - 1)
+#define STATESTS_INT_MASK	((1 << HDA_MAX_CODECS) - 1)
 
 /* SD_CTL bits */
 #define SD_CTL_STREAM_RESET	0x01	/* stream reset bit */
@@ -245,8 +244,8 @@  struct azx_rb {
 	dma_addr_t addr;	/* physical address of CORB/RIRB buffer */
 	/* for RIRB */
 	unsigned short rp, wp;	/* read/write pointers */
-	int cmds[AZX_MAX_CODECS];	/* number of pending requests */
-	u32 res[AZX_MAX_CODECS];	/* last read value */
+	int cmds[HDA_MAX_CODECS];	/* number of pending requests */
+	u32 res[HDA_MAX_CODECS];	/* last read value */
 };
 
 struct azx;
@@ -360,7 +359,7 @@  struct azx {
 	unsigned int disabled:1; /* disabled by VGA-switcher */
 
 	/* for debugging */
-	unsigned int last_cmd[AZX_MAX_CODECS];
+	unsigned int last_cmd[HDA_MAX_CODECS];
 
 #ifdef CONFIG_SND_HDA_DSP_LOADER
 	struct azx_dev saved_azx_dev;