From patchwork Thu Oct 27 20:35:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Hasler X-Patchwork-Id: 9400399 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B62A4600BA for ; Thu, 27 Oct 2016 20:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A31F02A38A for ; Thu, 27 Oct 2016 20:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9833F2A3BE; Thu, 27 Oct 2016 20:35:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46A702A38A for ; Thu, 27 Oct 2016 20:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S942040AbcJ0Ufa (ORCPT ); Thu, 27 Oct 2016 16:35:30 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36151 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938699AbcJ0Uf3 (ORCPT ); Thu, 27 Oct 2016 16:35:29 -0400 Received: by mail-wm0-f65.google.com with SMTP id c17so4401417wmc.3 for ; Thu, 27 Oct 2016 13:35:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Lg3FlQ8uR8swVMDkvY9K/x3hOgVj1eLFgfrmEcBXK+Q=; b=NMe8yHd28VSrFZNZ89fqk33cGwpoqvuX5BV9jhtjh7wesAnp+wxh2FzgbiheLxi08S wypVJI/QZl01wh3jLB+Rk/yb6xRSsgLzMjqbLcyUFzKIHWeaUQ4RxPMh1S5gBczn335U laX1Q7NNylxUsRdC2NhCJYgpXKJSFGQp0/FxOmJBTr3rilNH2gw5egOl8+VfdfPOJHH3 xg4jD0o8w98Hmowvr8wnKFEo8AUo82NpvbRKlw7SQpb8MGYdfZme2T5yaW06fIGlaIrR zyd/m5TgisfaU6FKST4CKgiyWxUIy/OZOojcSYxP4orJ1hw3GdP3aNN9Ffzqwz5nQfLU C9Pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Lg3FlQ8uR8swVMDkvY9K/x3hOgVj1eLFgfrmEcBXK+Q=; b=AhyXdoK2R19zwWkqDM7Sj3BzOe7gsgvIZ4VW6R9giovH0s2fLPmeg6LOPmiZMVaC64 Gz7Lfls+LQfSFvpsxhMknVRerrLB53dPoZVVtCJx2xFMPCzMQYu8EvrwvUSaoe5J9jcy dj4AZBEa7fOTtKmFMikuVrWPNf5VoxGgcwm5ucj/DzKDB9o0SDhBusFlu1BKPnjvXT05 PDOle7+ydLxbSs7jvc0bGBhvY9bxAePSf+ljJo4dMJ4yx7AlAym1H0amV/nRf7R0h54i IxIb/8gLc3s6xTPngirLY11h24057DI+Nt6W26WY5rlnSvPyPJUmSgVubFoGkfejo9LK 8Cow== X-Gm-Message-State: ABUngvfMPiXyMsK0OVtdrILl6rN3xALLsBZcrPSuHyesLGgFqZbQNzmgj1nCOTaUATvQ6Q== X-Received: by 10.28.17.212 with SMTP id 203mr259941wmr.48.1477600523134; Thu, 27 Oct 2016 13:35:23 -0700 (PDT) Received: from arch-desktop ([2a02:908:672:a420:922b:34ff:fe11:2b9f]) by smtp.gmail.com with ESMTPSA id 132sm5184862wmn.16.2016.10.27.13.35.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 13:35:22 -0700 (PDT) Date: Thu, 27 Oct 2016 22:35:15 +0200 From: Marcel Hasler To: Ezequiel Garcia , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Subject: [PATCH v2 3/3] stk1160: Add module param for setting the record gain. Message-ID: <20161027203515.GA847@arch-desktop> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow setting a custom record gain for the internal AC97 codec (if available). This can be a value between 0 and 15, 8 is the default and should be suitable for most users. The Windows driver also sets this to 8 without any possibility for changing it. Signed-off-by: Marcel Hasler --- drivers/media/usb/stk1160/stk1160-ac97.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/stk1160/stk1160-ac97.c b/drivers/media/usb/stk1160/stk1160-ac97.c index 6dbc39f..31bdd60d 100644 --- a/drivers/media/usb/stk1160/stk1160-ac97.c +++ b/drivers/media/usb/stk1160/stk1160-ac97.c @@ -25,6 +25,11 @@ #include "stk1160.h" #include "stk1160-reg.h" +static u8 gain = 8; + +module_param(gain, byte, 0444); +MODULE_PARM_DESC(gain, "Set capture gain level if AC97 codec is available (0-15, default: 8)"); + static void stk1160_write_ac97(struct stk1160 *dev, u16 reg, u16 value) { /* Set codec register address */ @@ -122,7 +127,11 @@ void stk1160_ac97_setup(struct stk1160 *dev) stk1160_write_ac97(dev, 0x16, 0x0808); /* Aux volume */ stk1160_write_ac97(dev, 0x1a, 0x0404); /* Record select */ stk1160_write_ac97(dev, 0x02, 0x0000); /* Master volume */ - stk1160_write_ac97(dev, 0x1c, 0x0808); /* Record gain */ + + /* Record gain */ + gain = (gain > 15) ? 15 : gain; + stk1160_info("Setting capture gain to %d.", gain); + stk1160_write_ac97(dev, 0x1c, (gain<<8) | gain); #ifdef DEBUG stk1160_ac97_dump_regs(dev);