From patchwork Sun Mar 10 11:40:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Schaefer X-Patchwork-Id: 17239 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UEebf-0002ND-Jh; Sun, 10 Mar 2013 12:39:59 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp id 1UEebe-0003QV-CU; Sun, 10 Mar 2013 12:39:59 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752044Ab3CJLj4 (ORCPT + 1 other); Sun, 10 Mar 2013 07:39:56 -0400 Received: from mail-ea0-f170.google.com ([209.85.215.170]:36919 "EHLO mail-ea0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778Ab3CJLj4 (ORCPT ); Sun, 10 Mar 2013 07:39:56 -0400 Received: by mail-ea0-f170.google.com with SMTP id a15so759336eae.15 for ; Sun, 10 Mar 2013 04:39:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:mime-version :content-type:content-transfer-encoding; bh=XXp+XAauby4Elq+6uzUez1Rxz3GzqhK6ca1lEbnZtFw=; b=WWq4wzre8YLcphTOQ4Zw3/N6+GNwlrpr+WB+OU/dhv/nJbL5KAHZ2+5un3dilJlB4t TV6Ktz2mCKfr4dCYQnNQ0kbc5TXr4CznY0WDOU8cSG/iDmC3HE+VLwMGY5NTunTd8K9z BEWlMk4T8BUXyMBPw7FcBqnZHR85HmisIO9H5+5lLc6wEC36LXLnzgSeJJlIBLjqPlkq bvvBAKiSUtllocxSuwty75z3O21cZIOIOs0giX7zCjXVfVNl7dUlsRAbwSeAFgRFUCLm o0us/fw+rvxFofd9z94UmmmcgZQYorULqXzRNYE+y2kQTK7ulVjmDOleoAHSFGnrEj8J R1fg== X-Received: by 10.14.173.67 with SMTP id u43mr25501171eel.22.1362915594867; Sun, 10 Mar 2013 04:39:54 -0700 (PDT) Received: from Athlon64X2-5000.site (ip-178-200-115-25.unitymediagroup.de. [178.200.115.25]) by mx.google.com with ESMTPS id q5sm17850013eeo.17.2013.03.10.04.39.53 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 10 Mar 2013 04:39:54 -0700 (PDT) From: =?UTF-8?q?Frank=20Sch=C3=A4fer?= To: mchehab@redhat.com Cc: hverkuil@xs4all.nl, linux-media@vger.kernel.org, =?UTF-8?q?Frank=20Sch=C3=A4fer?= Subject: [RFC PATCH 1/2] bttv: fix audio mute on device close for the video device node Date: Sun, 10 Mar 2013 12:40:34 +0100 Message-Id: <1362915635-5431-1-git-send-email-fschaefer.oss@googlemail.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.3.10.113318 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, CT_TEXT_PLAIN_UTF8_CAPS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_MEDIA_BODY 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' Signed-off-by: Frank Schäfer --- drivers/media/pci/bt8xx/bttv-driver.c | 22 +++++++++++----------- 1 Datei geändert, 11 Zeilen hinzugefügt(+), 11 Zeilen entfernt(-) diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 8610b6a..2c09bc5 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -992,21 +992,20 @@ static char *audio_modes[] = { static int audio_mux(struct bttv *btv, int input, int mute) { - int gpio_val, signal; + int gpio_val, signal, mute_gpio; struct v4l2_ctrl *ctrl; gpio_inout(bttv_tvcards[btv->c.type].gpiomask, bttv_tvcards[btv->c.type].gpiomask); signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; - btv->mute = mute; btv->audio = input; /* automute */ - mute = mute || (btv->opt_automute && (!signal || !btv->users) + mute_gpio = mute || (btv->opt_automute && (!signal || !btv->users) && !btv->has_radio_tuner); - if (mute) + if (mute_gpio) gpio_val = bttv_tvcards[btv->c.type].gpiomute; else gpio_val = bttv_tvcards[btv->c.type].gpiomux[input]; @@ -1022,7 +1021,7 @@ audio_mux(struct bttv *btv, int input, int mute) } if (bttv_gpio) - bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]); + bttv_gpio_tracking(btv, audio_modes[mute_gpio ? 4 : input]); if (in_interrupt()) return 0; @@ -1031,7 +1030,7 @@ audio_mux(struct bttv *btv, int input, int mute) ctrl = v4l2_ctrl_find(btv->sd_msp34xx->ctrl_handler, V4L2_CID_AUDIO_MUTE); if (ctrl) - v4l2_ctrl_s_ctrl(ctrl, btv->mute); + v4l2_ctrl_s_ctrl(ctrl, mute); /* Note: the inputs tuner/radio/extern/intern are translated to msp routings. This assumes common behavior for all msp3400 @@ -1080,7 +1079,7 @@ audio_mux(struct bttv *btv, int input, int mute) ctrl = v4l2_ctrl_find(btv->sd_tvaudio->ctrl_handler, V4L2_CID_AUDIO_MUTE); if (ctrl) - v4l2_ctrl_s_ctrl(ctrl, btv->mute); + v4l2_ctrl_s_ctrl(ctrl, mute); v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing, input, 0, 0); } @@ -1088,7 +1087,7 @@ audio_mux(struct bttv *btv, int input, int mute) ctrl = v4l2_ctrl_find(btv->sd_tda7432->ctrl_handler, V4L2_CID_AUDIO_MUTE); if (ctrl) - v4l2_ctrl_s_ctrl(ctrl, btv->mute); + v4l2_ctrl_s_ctrl(ctrl, mute); } return 0; } @@ -1300,6 +1299,7 @@ static int bttv_s_ctrl(struct v4l2_ctrl *c) break; case V4L2_CID_AUDIO_MUTE: audio_mute(btv, c->val); + btv->mute = c->val; break; case V4L2_CID_AUDIO_VOLUME: btv->volume_gpio(btv, c->val); @@ -3062,8 +3062,7 @@ static int bttv_open(struct file *file) sizeof(struct bttv_buffer), fh, &btv->lock); set_tvnorm(btv,btv->tvnorm); - set_input(btv, btv->input, btv->tvnorm); - + set_input(btv, btv->input, btv->tvnorm); /* also (un)mutes audio */ /* The V4L2 spec requires one global set of cropping parameters which only change on request. These are stored in btv->crop[1]. @@ -3124,7 +3123,7 @@ static int bttv_release(struct file *file) bttv_field_count(btv); if (!btv->users) - audio_mute(btv, btv->mute); + audio_mute(btv, 1); v4l2_fh_del(&fh->fh); v4l2_fh_exit(&fh->fh); @@ -4209,6 +4208,7 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) btv->std = V4L2_STD_PAL; init_irqreg(btv); v4l2_ctrl_handler_setup(hdl); + audio_mute(btv, 1); if (hdl->error) { result = hdl->error;