alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added
@ 2011-03-13 15:18 pbruskispam
  2011-03-13 15:18 ` [PATCH - ctxfi driver 2/4] Fix: mask creation was incorrect pbruskispam
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pbruskispam @ 2011-03-13 15:18 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Przemyslaw Bruski

From: Przemyslaw Bruski <pbruskispam@op.pl>


Signed-off-by: Przemyslaw Bruski <pbruskispam@op.pl>

diff --git a/pci/ctxfi/cthw20k2.c b/pci/ctxfi/cthw20k2.c
index b6b11bf..5364164 100644
--- a/pci/ctxfi/cthw20k2.c
+++ b/pci/ctxfi/cthw20k2.c
@@ -1307,10 +1307,10 @@ static int hw_pll_init(struct hw *hw, unsigned int rsr)
 	set_field(&pllctl, PLLCTL_B, 0);
 	if (48000 == rsr) {
 		set_field(&pllctl, PLLCTL_FD, 16 - 2);
-		set_field(&pllctl, PLLCTL_RD, 1 - 1);
+		set_field(&pllctl, PLLCTL_RD, 1 - 1); /* 3000*16/1 = 48000 */
 	} else { /* 44100 */
 		set_field(&pllctl, PLLCTL_FD, 147 - 2);
-		set_field(&pllctl, PLLCTL_RD, 10 - 1);
+		set_field(&pllctl, PLLCTL_RD, 10 - 1); /* 3000*147/10 = 44100 */
 	}
 	hw_write_20kx(hw, PLL_CTL, pllctl);
 	mdelay(40);
@@ -1740,6 +1740,10 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
 	return data;
 }
 
+#define MIC_BOOST_0DB 0xCF
+#define MIC_BOOST_STEPS_PER_DB 2
+#define MIC_BOOST_20DB (MIC_BOOST_0DB + 20 * MIC_BOOST_STEPS_PER_DB)
+
 static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
 {
 	u32 data;
@@ -1751,10 +1755,12 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
 		hw_write_20kx(hw, GPIO_DATA, data);
 		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x101),
 				MAKE_WM8775_DATA(0x101)); /* Mic-in */
-		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, 0xE7),
-				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
-		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xE7),
-				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
+		hw20k2_i2c_write(hw,
+				MAKE_WM8775_ADDR(WM8775_AADCL, MIC_BOOST_20DB),
+				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
+		hw20k2_i2c_write(hw,
+				MAKE_WM8775_ADDR(WM8775_AADCR, MIC_BOOST_20DB),
+				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
 		break;
 	case ADC_LINEIN:
 		data &= ~(0x1 << 14);
@@ -1827,10 +1833,12 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
 
 		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x101),
 				MAKE_WM8775_DATA(0x101)); /* Mic-in */
-		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, 0xE7),
-				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
-		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xE7),
-				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
+		hw20k2_i2c_write(hw,
+				MAKE_WM8775_ADDR(WM8775_AADCL, MIC_BOOST_20DB),
+				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
+		hw20k2_i2c_write(hw,
+				MAKE_WM8775_ADDR(WM8775_AADCR, MIC_BOOST_20DB),
+				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
 	} else if (mux == 2) {
 		/* Configures GPIO data to select Line-in */
 		data &= ~(0x1 << 14);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH - ctxfi driver 2/4] Fix: mask creation was incorrect
  2011-03-13 15:18 [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added pbruskispam
@ 2011-03-13 15:18 ` pbruskispam
  2011-03-13 15:18 ` [PATCH - ctxfi driver 3/4] Fix: spdif status retrieval always returned the default settings instead of the actual ones pbruskispam
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pbruskispam @ 2011-03-13 15:18 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Przemyslaw Bruski

From: Przemyslaw Bruski <pbruskispam@op.pl>


Signed-off-by: Przemyslaw Bruski <pbruskispam@op.pl>

diff --git a/pci/ctxfi/ctatc.c b/pci/ctxfi/ctatc.c
index 1bff80c..b932154 100644
--- a/pci/ctxfi/ctatc.c
+++ b/pci/ctxfi/ctatc.c
@@ -869,7 +869,7 @@ spdif_passthru_playback_setup(struct ct_atc *atc, struct ct_atc_pcm *apcm)
 	mutex_lock(&atc->atc_mutex);
 	dao->ops->get_spos(dao, &status);
 	if (((status >> 24) & IEC958_AES3_CON_FS) != iec958_con_fs) {
-		status &= ((~IEC958_AES3_CON_FS) << 24);
+		status &= ~(IEC958_AES3_CON_FS << 24);
 		status |= (iec958_con_fs << 24);
 		dao->ops->set_spos(dao, status);
 		dao->ops->commit_write(dao);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH - ctxfi driver 3/4] Fix: spdif status retrieval always returned the default settings instead of the actual ones
  2011-03-13 15:18 [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added pbruskispam
  2011-03-13 15:18 ` [PATCH - ctxfi driver 2/4] Fix: mask creation was incorrect pbruskispam
@ 2011-03-13 15:18 ` pbruskispam
  2011-03-13 15:18 ` [PATCH - ctxfi driver 4/4] Fix: clear input settings before initialization pbruskispam
  2011-03-14 11:45 ` [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: pbruskispam @ 2011-03-13 15:18 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Przemyslaw Bruski

From: Przemyslaw Bruski <pbruskispam@op.pl>


Signed-off-by: Przemyslaw Bruski <pbruskispam@op.pl>

diff --git a/pci/ctxfi/ctmixer.c b/pci/ctxfi/ctmixer.c
index 15c1e72..c3519ff 100644
--- a/pci/ctxfi/ctmixer.c
+++ b/pci/ctxfi/ctmixer.c
@@ -566,19 +566,6 @@ static int ct_spdif_get_mask(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
-static int ct_spdif_default_get(struct snd_kcontrol *kcontrol,
-				struct snd_ctl_elem_value *ucontrol)
-{
-	unsigned int status = SNDRV_PCM_DEFAULT_CON_SPDIF;
-
-	ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
-	ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
-	ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
-	ucontrol->value.iec958.status[3] = (status >> 24) & 0xff;
-
-	return 0;
-}
-
 static int ct_spdif_get(struct snd_kcontrol *kcontrol,
 			struct snd_ctl_elem_value *ucontrol)
 {
@@ -586,6 +573,10 @@ static int ct_spdif_get(struct snd_kcontrol *kcontrol,
 	unsigned int status;
 
 	atc->spdif_out_get_status(atc, &status);
+
+	if (status == 0)
+		status = SNDRV_PCM_DEFAULT_CON_SPDIF;
+
 	ucontrol->value.iec958.status[0] = (status >> 0) & 0xff;
 	ucontrol->value.iec958.status[1] = (status >> 8) & 0xff;
 	ucontrol->value.iec958.status[2] = (status >> 16) & 0xff;
@@ -629,7 +620,7 @@ static struct snd_kcontrol_new iec958_default_ctl = {
 	.name		= SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
 	.count		= 1,
 	.info		= ct_spdif_info,
-	.get		= ct_spdif_default_get,
+	.get		= ct_spdif_get,
 	.put		= ct_spdif_put,
 	.private_value	= MIXER_IEC958_DEFAULT
 };
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH - ctxfi driver 4/4] Fix: clear input settings before initialization
  2011-03-13 15:18 [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added pbruskispam
  2011-03-13 15:18 ` [PATCH - ctxfi driver 2/4] Fix: mask creation was incorrect pbruskispam
  2011-03-13 15:18 ` [PATCH - ctxfi driver 3/4] Fix: spdif status retrieval always returned the default settings instead of the actual ones pbruskispam
@ 2011-03-13 15:18 ` pbruskispam
  2011-03-14 11:45 ` [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: pbruskispam @ 2011-03-13 15:18 UTC (permalink / raw)
  To: patch; +Cc: alsa-devel, Przemyslaw Bruski

From: Przemyslaw Bruski <pbruskispam@op.pl>


Signed-off-by: Przemyslaw Bruski <pbruskispam@op.pl>

diff --git a/pci/ctxfi/ctdaio.c b/pci/ctxfi/ctdaio.c
index af56eb9..47d9ea9 100644
--- a/pci/ctxfi/ctdaio.c
+++ b/pci/ctxfi/ctdaio.c
@@ -176,6 +176,7 @@ static int dao_set_left_input(struct dao *dao, struct rsc *input)
 	if (!entry)
 		return -ENOMEM;
 
+	dao->ops->clear_left_input(dao);
 	/* Program master and conjugate resources */
 	input->ops->master(input);
 	daio->rscl.ops->master(&daio->rscl);
@@ -204,6 +205,7 @@ static int dao_set_right_input(struct dao *dao, struct rsc *input)
 	if (!entry)
 		return -ENOMEM;
 
+	dao->ops->clear_right_input(dao);
 	/* Program master and conjugate resources */
 	input->ops->master(input);
 	daio->rscr.ops->master(&daio->rscr);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added
  2011-03-13 15:18 [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added pbruskispam
                   ` (2 preceding siblings ...)
  2011-03-13 15:18 ` [PATCH - ctxfi driver 4/4] Fix: clear input settings before initialization pbruskispam
@ 2011-03-14 11:45 ` Takashi Iwai
  3 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2011-03-14 11:45 UTC (permalink / raw)
  To: pbruskispam; +Cc: alsa-devel

At Sun, 13 Mar 2011 16:18:55 +0100,
pbruskispam@op.pl wrote:
> 
> From: Przemyslaw Bruski <pbruskispam@op.pl>
> 
> 
> Signed-off-by: Przemyslaw Bruski <pbruskispam@op.pl>

Thanks, I applied now all 4 patches with slight changes in patch
subjects and changelogs for better readability, together with Cc to
stable kernel appropriately.


Takashi


> diff --git a/pci/ctxfi/cthw20k2.c b/pci/ctxfi/cthw20k2.c
> index b6b11bf..5364164 100644
> --- a/pci/ctxfi/cthw20k2.c
> +++ b/pci/ctxfi/cthw20k2.c
> @@ -1307,10 +1307,10 @@ static int hw_pll_init(struct hw *hw, unsigned int rsr)
>  	set_field(&pllctl, PLLCTL_B, 0);
>  	if (48000 == rsr) {
>  		set_field(&pllctl, PLLCTL_FD, 16 - 2);
> -		set_field(&pllctl, PLLCTL_RD, 1 - 1);
> +		set_field(&pllctl, PLLCTL_RD, 1 - 1); /* 3000*16/1 = 48000 */
>  	} else { /* 44100 */
>  		set_field(&pllctl, PLLCTL_FD, 147 - 2);
> -		set_field(&pllctl, PLLCTL_RD, 10 - 1);
> +		set_field(&pllctl, PLLCTL_RD, 10 - 1); /* 3000*147/10 = 44100 */
>  	}
>  	hw_write_20kx(hw, PLL_CTL, pllctl);
>  	mdelay(40);
> @@ -1740,6 +1740,10 @@ static int hw_is_adc_input_selected(struct hw *hw, enum ADCSRC type)
>  	return data;
>  }
>  
> +#define MIC_BOOST_0DB 0xCF
> +#define MIC_BOOST_STEPS_PER_DB 2
> +#define MIC_BOOST_20DB (MIC_BOOST_0DB + 20 * MIC_BOOST_STEPS_PER_DB)
> +
>  static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
>  {
>  	u32 data;
> @@ -1751,10 +1755,12 @@ static int hw_adc_input_select(struct hw *hw, enum ADCSRC type)
>  		hw_write_20kx(hw, GPIO_DATA, data);
>  		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x101),
>  				MAKE_WM8775_DATA(0x101)); /* Mic-in */
> -		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, 0xE7),
> -				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
> -		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xE7),
> -				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
> +		hw20k2_i2c_write(hw,
> +				MAKE_WM8775_ADDR(WM8775_AADCL, MIC_BOOST_20DB),
> +				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
> +		hw20k2_i2c_write(hw,
> +				MAKE_WM8775_ADDR(WM8775_AADCR, MIC_BOOST_20DB),
> +				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
>  		break;
>  	case ADC_LINEIN:
>  		data &= ~(0x1 << 14);
> @@ -1827,10 +1833,12 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
>  
>  		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_ADCMC, 0x101),
>  				MAKE_WM8775_DATA(0x101)); /* Mic-in */
> -		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCL, 0xE7),
> -				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
> -		hw20k2_i2c_write(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xE7),
> -				MAKE_WM8775_DATA(0xE7)); /* +12dB boost */
> +		hw20k2_i2c_write(hw,
> +				MAKE_WM8775_ADDR(WM8775_AADCL, MIC_BOOST_20DB),
> +				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
> +		hw20k2_i2c_write(hw,
> +				MAKE_WM8775_ADDR(WM8775_AADCR, MIC_BOOST_20DB),
> +				MAKE_WM8775_DATA(MIC_BOOST_20DB)); /* +20dB */
>  	} else if (mux == 2) {
>  		/* Configures GPIO data to select Line-in */
>  		data &= ~(0x1 << 14);
> -- 
> 1.7.1
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-14 11:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-13 15:18 [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added pbruskispam
2011-03-13 15:18 ` [PATCH - ctxfi driver 2/4] Fix: mask creation was incorrect pbruskispam
2011-03-13 15:18 ` [PATCH - ctxfi driver 3/4] Fix: spdif status retrieval always returned the default settings instead of the actual ones pbruskispam
2011-03-13 15:18 ` [PATCH - ctxfi driver 4/4] Fix: clear input settings before initialization pbruskispam
2011-03-14 11:45 ` [PATCH - ctxfi driver 1/4] Fix: microphone boost was set at +12dB, not +20dB (like in Windows driver and in adc_conf structure declaration), some comments added Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).