From patchwork Sun Sep 7 19:10:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kukububu X-Patchwork-Id: 4860391 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id ED7569F32E for ; Mon, 8 Sep 2014 08:30:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9C74920131 for ; Mon, 8 Sep 2014 08:30:30 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 8FC6520138 for ; Mon, 8 Sep 2014 08:30:28 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A6B11261A7C; Mon, 8 Sep 2014 10:30:27 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, NO_DNS_FOR_FROM,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id A914B260845; Mon, 8 Sep 2014 10:30:21 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id E6AE8260851; Sun, 7 Sep 2014 21:10:19 +0200 (CEST) Received: from moh2-ve1.go2.pl (moh2-ve1.go2.pl [193.17.41.186]) by alsa0.perex.cz (Postfix) with ESMTP id 27FB0260845 for ; Sun, 7 Sep 2014 21:10:13 +0200 (CEST) Received: from moh2-ve1.go2.pl (unknown [10.0.0.186]) by moh2-ve1.go2.pl (Postfix) with ESMTP id DC85644C652; Sun, 7 Sep 2014 21:10:10 +0200 (CEST) Received: from o2.pl (unknown [10.0.0.147]) by moh2-ve1.go2.pl (Postfix) with SMTP; Sun, 7 Sep 2014 21:10:09 +0200 (CEST) From: =?UTF-8?Q?kukububu?= To: alsa-devel@alsa-project.org Mime-Version: 1.0 Message-ID: <63bed6a2.d4bfc94.540cad91.b8037@o2.pl> Date: Sun, 07 Sep 2014 21:10:09 +0200 X-Originator: 89.64.204.25 X-Mailman-Approved-At: Mon, 08 Sep 2014 10:30:21 +0200 Subject: [alsa-devel] =?utf-8?q?vt1613_driver?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, I found driver for vt1613 (which is part of udoo arm computer) at https://github.com/UDOOboard/Kernel_Unico/blob/master/sound/soc/codecs/vt1613.c, but it's not compatibile with current kernel. Below you can find my patch that makes it possible to compile and load this driver. It probably has memory leak on unload (commented kfree), but the worst thing is that Linux still doesn't see sound card. I suppose that volatile register should be changed to reg_default, but I'm not programmer (I only had C course a few years ago and oboiously I've never touched any driver code) therefore this is far beyond my abilities. Can you help me with getting this driver to work on recent kernel please? Regards, Adrian --- /usr/src/linux-armv7/src/linux-3.16/vt1613.c 2014-09-06 17:51:20.037035346 +0000 +++ /root/vt1613/vt1613.c 2014-09-07 18:27:25.258361596 +0000 @@ -33,7 +33,6 @@ #include #include #include -#include #include @@ -126,7 +125,7 @@ if (reg == AC97_RESET || reg == AC97_GPIO_STATUS || reg == AC97_VENDOR_ID1 || reg == AC97_VENDOR_ID2 || reg == AC97_REC_GAIN) { - return soc_ac97_ops.read(codec->ac97, reg); + return soc_ac97_ops->read(codec->ac97, reg); } else { reg = reg >> 1; @@ -142,7 +141,7 @@ u16 *cache = codec->reg_cache; if (reg < 0x7c) - soc_ac97_ops.write(codec->ac97, reg, val); + soc_ac97_ops->write(codec->ac97, reg, val); reg = reg >> 1; if (reg < (ARRAY_SIZE(vt1613_ac97_reg))) cache[reg] = val; @@ -449,13 +448,6 @@ return ret; } -static int vt1613_digital_mute(struct snd_soc_dai *codec_dai, int mute) -{ - struct snd_soc_codec *codec = codec_dai->codec; - - return __vt1613_digital_mute(codec, mute); -} - static int vt1613_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; @@ -561,36 +553,6 @@ return snd_soc_write(codec, reg, runtime->rate); } -static void vt1613_constraints(struct vt1613_priv *vt1613, - struct snd_pcm_substream *mst_substream) -{ - struct snd_pcm_substream *slv_substream; - - /* Pick the stream, which need to be constrained */ - if (mst_substream == vt1613->master_substream) - slv_substream = vt1613->slave_substream; - else if (mst_substream == vt1613->slave_substream) - slv_substream = vt1613->master_substream; - else /* This should not happen.. */ - return; - - /* Set the constraints according to the already configured stream */ - snd_pcm_hw_constraint_minmax(slv_substream->runtime, - SNDRV_PCM_HW_PARAM_RATE, - vt1613->rate, - vt1613->rate); - - snd_pcm_hw_constraint_minmax(slv_substream->runtime, - SNDRV_PCM_HW_PARAM_SAMPLE_BITS, - vt1613->sample_bits, - vt1613->sample_bits); - - snd_pcm_hw_constraint_minmax(slv_substream->runtime, - SNDRV_PCM_HW_PARAM_CHANNELS, - vt1613->channels, - vt1613->channels); -} - static int vt1613_startup(struct snd_pcm_substream *substream, struct snd_soc_dai *dai) { @@ -829,6 +791,7 @@ }, }; +/* static int vt1613_volatile_register(unsigned int reg) { if (reg == VT1613_CHIP_ID || @@ -837,8 +800,9 @@ return 1; return 0; } +*/ -static int vt1613_suspend(struct snd_soc_codec *codec, pm_message_t state) +static int vt1613_suspend(struct snd_soc_codec *codec) { vt1613_set_bias_level(codec, SND_SOC_BIAS_OFF); @@ -881,16 +845,14 @@ static int vt1613_driver_probe(struct snd_soc_codec *codec) { struct vt1613_priv *vt1613 = snd_soc_codec_get_drvdata(codec); - u16 reg, ana_pwr, lreg_ctrl; - int vag; int ret; int i; - ret = snd_soc_new_ac97_codec(codec, &soc_ac97_ops, 0); + ret = snd_soc_new_ac97_codec(codec, soc_ac97_ops, 0); - soc_ac97_ops.reset(codec->ac97); + soc_ac97_ops->reset(codec->ac97); msleep(20); - soc_ac97_ops.warm_reset(codec->ac97); + soc_ac97_ops->warm_reset(codec->ac97); msleep(20); vt1613_init_chip(codec); @@ -904,8 +866,9 @@ snd_soc_write(codec, 0x5A, 0x0400); // <-- [gp000q7] Noise reducing during mic recording on vt1613 vt1613->sysclk = VT1613_APLL_RATE_48000; - snd_soc_add_controls(codec, vt1613_snd_controls, ARRAY_SIZE(vt1613_snd_controls)); - msleep(10); + /* snd_soc_add_controls(codec, vt1613_snd_controls, ARRAY_SIZE(vt1613_snd_controls)); */ + snd_soc_add_codec_controls(codec, vt1613_snd_controls, ARRAY_SIZE(vt1613_snd_controls)); + msleep(10); /* for (i = 0; i < ARRAY_SIZE(vt1613_ac97_reg); i++) printk("REGISTRO IDX 0x%02x = 0x%04x \n", i<<1, snd_soc_read(codec, i<<1)); @@ -936,10 +899,10 @@ .reg_cache_size = ARRAY_SIZE(vt1613_ac97_reg), .reg_word_size = sizeof(u16), .reg_cache_default = vt1613_ac97_reg, - .volatile_register = vt1613_volatile_register, +/* .volatile_register = vt1613_volatile_register,*/ }; -static __devinit int vt1613_codec_probe(struct platform_device *client) +static int vt1613_codec_probe(struct platform_device *client) { struct vt1613_priv *vt1613; int ret; @@ -963,13 +926,13 @@ return 0; } -static __devexit int vt1613_remove(struct platform_device *pdev) +static int vt1613_remove(struct platform_device *pdev) { struct vt1613_priv *vt1613 = platform_get_drvdata(pdev); - - snd_soc_unregister_dais(&vt1613_dai[0], ARRAY_SIZE(vt1613_dai)); + /* + snd_soc_unregister_dais(&vt1613_dai[0]); snd_soc_unregister_codec(&vt1613->codec); - kfree(vt1613->codec.reg_cache); + kfree(vt1613->codec.reg_cache);*/ kfree(vt1613); return 0; @@ -981,7 +944,7 @@ .owner = THIS_MODULE, }, .probe = vt1613_codec_probe, - .remove = __devexit_p(vt1613_remove), + .remove = vt1613_remove, }; static int __init vt1613_modinit(void)