lkml.org 
[lkml]   [2011]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [alsa-devel] [PATCH v2 1/3] ASoC: Asahi Kasei AK4641 codec driver
On Tue, May 17, 2011 at 01:03:23AM +0400, Dmitry Artamonow wrote:
> A driver for the AK4641 codec used in iPAQ hx4700 and Glofiish M800
> among others.

This looks pretty good - a few small issues realting to the use of old
APIs and coding standards below but nothing serious.

> +static int ak4641_sync(struct snd_soc_codec *codec)
> +{
> + u8 *cache = codec->reg_cache;
> + int i, r = 0;
> +
> + for (i = 0; i < AK4641_CACHEREGNUM; i++)
> + r |= snd_soc_write(codec, i, cache[i]);
> +
> + return r;
> +};

You should be able to use snd_soc_cache_sync() instead of open coding
this. There's also a stray ; in there.

> +
> +static int ak4641_add_widgets(struct snd_soc_codec *codec)
> +{
> + struct snd_soc_dapm_context *dapm = &codec->dapm;
> + snd_soc_dapm_new_controls(dapm, ak4641_dapm_widgets,
> + ARRAY_SIZE(ak4641_dapm_widgets));
> +
> + snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
> +
> + snd_soc_dapm_new_widgets(dapm);
> + return 0;

You should be able to convert these to data based init using the
dapm_widgets and dapm_routes fields in the CODEC driver.

> + u8 mode2 = snd_soc_read(codec, AK4641_MODE2) & ~(0x3 << 5);

Use snd_soc_update_bits() to do a read/modify/write cycle rather than
open coding it - it's clearer and will save writing when there's no
change. A similar thing applies in several of the other DAI operations
and set_bias_level().


\
 
 \ /
  Last update: 2011-05-16 23:27    [W:0.047 / U:10.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site