[alsa-devel] [PATCH v3 09/16] ALSA: Oxygen: Modify initialization functions

Roman Volkov v1ron at mail.ru
Mon Jan 20 15:14:03 CET 2014


В Sat, 18 Jan 2014 11:50:52 +0100
Clemens Ladisch <clemens at ladisch.de> пишет:

> Roman Volkov wrote:
> > Changes in GPIO values and sequence at startup, CS4245
> > initialization changed and simplified, according to
> > datasheets and reverse-engineering information.
> >
> >  static void cs4245_init(struct oxygen *chip)
> >  {
> >  	struct dg *data = chip->model_data;
> >
> > -	data->cs4245_regs[CS4245_DAC_CTRL_1] =
> > -		CS4245_DAC_FM_SINGLE | CS4245_DAC_DIF_LJUST;
> > -	data->cs4245_regs[CS4245_ADC_CTRL] =
> > -		CS4245_ADC_FM_SINGLE | CS4245_ADC_DIF_LJUST;
> > -	data->cs4245_regs[CS4245_SIGNAL_SEL] =
> > -		CS4245_A_OUT_SEL_HIZ | CS4245_ASYNCH;
> > -	data->cs4245_regs[CS4245_PGA_B_CTRL] = 0;
> > -	data->cs4245_regs[CS4245_PGA_A_CTRL] = 0;
> > -	data->cs4245_regs[CS4245_ANALOG_IN] =
> > -		CS4245_PGA_SOFT | CS4245_PGA_ZERO |
> > CS4245_SEL_INPUT_4;
> > -	data->cs4245_regs[CS4245_DAC_A_CTRL] = 0;
> > -	data->cs4245_regs[CS4245_DAC_B_CTRL] = 0;
> > -	cs4245_registers_init(chip);
> > +	/* Save the initial state: codec version, registers */
> > +	cs4245_shadow_control(chip, CS4245_SAVE_TO_SHADOW);
> > +
> > +	data->cs4245_shadow[CS4245_POWER_CTRL] = 0;
> > +	data->cs4245_shadow[CS4245_SIGNAL_SEL] =
> > CS4245_A_OUT_SEL_DAC |
> > +		CS4245_ASYNCH;
> > +	data->cs4245_shadow[CS4245_DAC_CTRL_1] = 0;
> > +	data->cs4245_shadow[CS4245_DAC_CTRL_2] = CS4245_DAC_SOFT |
> > +		CS4245_DAC_ZERO | CS4245_INVERT_DAC;
> > +	data->cs4245_shadow[CS4245_ADC_CTRL] = 0;
> > +	data->cs4245_shadow[CS4245_ANALOG_IN] = CS4245_PGA_SOFT |
> > +		CS4245_PGA_ZERO;
> 
> Please don't remove symbols like "CS4245_DAC_FM_SINGLE |
> CS4245_DAC_DIF_LJUST"; this would imply that you don't care about
> these settings.

Okay, will remain these settings. It is better to configure them
manually.

> Why don't you initialize registers like PGA/DAC_A/B?

If you meant volume control, the mixer performs initialization of these
settings. Probably they can be initalized to 30% volume, 100% by
default.

> > -	oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA,
> > -			    GPIO_INPUT_ROUTE | GPIO_HP_REAR);
> > +	oxygen_write16(chip, OXYGEN_GPIO_DATA, GPIO_HP_REAR |
> > GPIO_INPUT_ROUTE);
> 
> Why are these bits now initialized to the opposite value?
> 

As I can recall, if GPIOs 5,6 are cleared, the audio input will be
inactive and we can't record anything. HP_REAR switches CS4245 to the
rear jack. I tried any sequences to minimize clicks\pops. Will try to
don't touch the GPIO_HP_REAR, perhaps this reduce the number of relay
switches at startup.

> 
> Regards,
> Clemens
> 



-- 
Kind regards,
Roman Volkov,
v1ron at mail.ru


More information about the Alsa-devel mailing list