Messages in this thread | | | Date | Wed, 21 Mar 2012 15:56:35 +0000 | From | Mark Brown <> | Subject | Re: [alsa-devel] [PATCH] ASoC: da7210: Add support for spi regmap |
| |
On Wed, Mar 21, 2012 at 09:22:50PM +0530, Ashish Chavan wrote:
> +#if defined(CONFIG_SPI_MASTER) > + /* Dummy read to give two pulses over nCS */ > + regmap_read(da7210->regmap, DA7210_STATUS, &val); > + regmap_read(da7210->regmap, DA7210_STATUS, &val); > + regmap_read(da7210->regmap, DA7210_STATUS, &val); > +#endif
This ifdef stuff should all be runtime configured based on the bus type, unless the cost of the reads is considered immaterial in which case it should be unconditional.
> +#if defined(CONFIG_SPI_MASTER) > + snd_soc_write(codec, 0x00, 0x80); > +#endif
Hrm?
> /* unlock */ > regmap_write(da7210->regmap, DA7210_A_HID_UNLOCK, 0x8B); > @@ -1035,6 +1056,10 @@ static int da7210_probe(struct snd_soc_codec *codec) > regmap_write(da7210->regmap, DA7210_A_HID_UNLOCK, 0x00); > regmap_write(da7210->regmap, DA7210_A_TEST_UNLOCK, 0x00);
I also note that you've not yet updated this to use a regmap patch as was previously requested.
> +#if defined(CONFIG_SPI_MASTER) > +static int __devinit da7210_spi_probe(struct spi_device *spi) > +{ > + struct da7210_priv *da7210; > + int ret; > + > + da7210 = kzalloc(sizeof(struct da7210_priv), GFP_KERNEL); > + if (!da7210) > + return -ENOMEM;
devm_kzalloc().
> + da7210_regmap.read_flag_mask = 0x01; > + da7210_regmap.write_flag_mask = 0x00;
Just have a second, static, regmap variable. The regmap should be declared const.
> + da7210->regmap = regmap_init_spi(spi, &da7210_regmap);
devm_regmap_init_spi() (will come in in the merge window).
> +static struct spi_driver da7210_spi_driver = { > + .driver = { > + .name = "da7210-codec",
No -codec. [unhandled content-type:application/pgp-signature] | |