lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+Px+wXBBgeWbjZ5uQmwJgn+d=ZE-N0aehitog7==ak3GDxMsQ@mail.gmail.com>
Date:   Wed, 3 Jul 2019 15:39:19 +0800
From:   Tzung-Bi Shih <tzungbi@...gle.com>
To:     Codrin Ciubotariu <codrin.ciubotariu@...rochip.com>
Cc:     ALSA development <alsa-devel@...a-project.org>,
        linux-kernel@...r.kernel.org, lars@...afoo.de,
        Takashi Iwai <tiwai@...e.com>,
        Liam Girdwood <lgirdwood@...il.com>,
        Mark Brown <broonie@...nel.org>
Subject: Re: [alsa-devel] [PATCH 1/2] ASoC: codecs: ad193x: Group register
 initialization at probe

On Thu, Jun 27, 2019 at 8:05 PM Codrin Ciubotariu
<codrin.ciubotariu@...rochip.com> wrote:
> +struct ad193x_reg_default {
> +       unsigned int reg;
> +       unsigned int val;
> +};
You probably don't need to define this.  There is a struct
reg_sequence in regmap.h.

> +
> +/* codec register values to set after reset */
> +static void ad193x_reg_default_init(struct ad193x_priv *ad193x)
> +{
> +       const struct ad193x_reg_default reg_init[] = {
> +               {  0, 0x99 },   /* PLL_CLK_CTRL0: pll input: mclki/xi 12.288Mhz */
> +               {  1, 0x04 },   /* PLL_CLK_CTRL1: no on-chip Vref */
> +               {  2, 0x40 },   /* DAC_CTRL0: TDM mode */
> +               {  4, 0x1A },   /* DAC_CTRL2: 48kHz de-emphasis, unmute dac */
> +               {  5, 0x00 },   /* DAC_CHNL_MUTE: unmute DAC channels */
> +       };
> +       const struct ad193x_reg_default reg_adc_init[] = {
> +               { 14, 0x03 },   /* ADC_CTRL0: high-pass filter enable */
> +               { 15, 0x43 },   /* ADC_CTRL1: sata delay=1, adc aux mode */
> +       };
> +       int i;
> +
> +       for (i = 0; i < ARRAY_SIZE(reg_init); i++)
> +               regmap_write(ad193x->regmap, reg_init[i].reg, reg_init[i].val);
> +
> +       if (ad193x_has_adc(ad193x)) {
> +               for (i = 0; i < ARRAY_SIZE(reg_adc_init); i++) {
> +                       regmap_write(ad193x->regmap, reg_adc_init[i].reg,
> +                                    reg_adc_init[i].val);
> +               }
> +       }
And you could use regmap_multi_reg_write( ) to substitute the two for-loops.

See https://mailman.alsa-project.org/pipermail/alsa-devel/2019-June/151090.html
as an example.  It also has some reg initializations in component
probe( ).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ