From patchwork Wed Aug 23 16:10:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 9917789 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 0BA0360327 for ; Wed, 23 Aug 2017 16:12:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1DB3289C1 for ; Wed, 23 Aug 2017 16:12:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6D2E289C4; Wed, 23 Aug 2017 16:12:31 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM 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 1C751289D1 for ; Wed, 23 Aug 2017 16:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932231AbdHWQKO (ORCPT ); Wed, 23 Aug 2017 12:10:14 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:35006 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932135AbdHWQKK (ORCPT ); Wed, 23 Aug 2017 12:10:10 -0400 Received: by mail-wr0-f194.google.com with SMTP id p8so360161wrf.2 for ; Wed, 23 Aug 2017 09:10:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VbgM0iN4zHGAynRJIuJgBJyC34FuKG1r3GKaBT/8Mig=; b=fEyJ0ftBPoBxPVUPzSxNchGXBTAnuAccw3/OPGAB4txRlT4u0c6CUEeQpS+eKzXKVM phWlgCTTLoLTrJKEF01MF3hm/UWF3oAusSxlwZtAEHxxJExdsNKhbOTII03Yv5h0b+ST 0kILHIu/+Dl1hcnkz6QYAJFqhsKjBmBLg8DN7J9CrECK8Re1NPbverkQUQI0iEkp1vJv IMdxo3ZiHzK7KsHYQmSHLBbrbsaySqLYIo6ordI5bo8pRZvCJ51WdlSU1wm/rpmqPjgF SY67ofUp/QNyB60CiTFQdERfBPE1Z4J8u1KUhXHd93y523L5rejcJHe/03lAffbtrfH3 B3ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VbgM0iN4zHGAynRJIuJgBJyC34FuKG1r3GKaBT/8Mig=; b=m3gGyA6gfXT/VD65BwUbIVgGPogDgKkLF7eBQcVd0rgvkDqXOCdbWNzulVM/5IomRH gxYyQaLGiXTAGVdJ+9tz56W19mLABR13WefRUuLa7U11b5FJka70aSuBm4jNU9swaVRE BXh3NvYHQ7KAgrgQq+X4Dntcp4M4z0gdkJ1zimoFhpkQSouj3UBmO/9yJ717GHrDHznb yoca6ovnMW3w8sj9mpZkLCSzev1+6fuvkYTyBncMCO97jN0RFg+jKMSayGpog0rii+Sd 1X0SV+U9vj/MtWXTKH/s1/fElu9VJwmKtcDKCCOdRCR/ko/x/cix5qfVjb1IHF8yHnts CGZQ== X-Gm-Message-State: AHYfb5hZDz7amCFTzS+D+TKSGtiMk55qiTZWETlF7Q1HFYn9EnMlHNxm tqWSgC6xL3NypH5/ X-Received: by 10.223.184.11 with SMTP id h11mr1812157wrf.163.1503504608578; Wed, 23 Aug 2017 09:10:08 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-88.unity-media.net. [84.118.193.88]) by smtp.gmail.com with ESMTPSA id b13sm2772356wmi.7.2017.08.23.09.10.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Aug 2017 09:10:08 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Cc: jasmin@anw.at Subject: [PATCH 4/5] [media] staging/cxd2099: Add module parameter for buffer mode Date: Wed, 23 Aug 2017 18:10:01 +0200 Message-Id: <20170823161002.25459-5-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170823161002.25459-1-d.scheller.oss@gmail.com> References: <20170823161002.25459-1-d.scheller.oss@gmail.com> 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 From: Daniel Scheller The buffer mode of the cxd2099 driver requires more work regarding error handling and thus can cause issues in some cases, so disable it by default and make that mode of operation controllable by users via a module parameter (ie. 'modprobe cxd2099 buffermode=1' enables current behaviour). The upstream codebase also has the buffer mode disabled by default, so we should match this (but users still can test things out using the modparm). Signed-off-by: Daniel Scheller Tested-by: Jasmin Jessich Signed-off-by: Jasmin Jessich --- drivers/staging/media/cxd2099/cxd2099.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/cxd2099/cxd2099.c b/drivers/staging/media/cxd2099/cxd2099.c index f28916ea69f1..3e30f4864e2b 100644 --- a/drivers/staging/media/cxd2099/cxd2099.c +++ b/drivers/staging/media/cxd2099/cxd2099.c @@ -33,8 +33,9 @@ #include "cxd2099.h" -/* comment this line to deactivate the cxd2099ar buffer mode */ -#define BUFFER_MODE 1 +static int buffermode; +module_param(buffermode, int, 0444); +MODULE_PARM_DESC(buffermode, "Enable use of the CXD2099AR buffer mode (default: disabled)"); static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount); @@ -221,7 +222,6 @@ static int write_reg(struct cxd *ci, u8 reg, u8 val) return write_regm(ci, reg, val, 0xff); } -#ifdef BUFFER_MODE static int write_block(struct cxd *ci, u8 adr, u8 *data, u16 n) { int status = 0; @@ -248,7 +248,6 @@ static int write_block(struct cxd *ci, u8 adr, u8 *data, u16 n) } return status; } -#endif static void set_mode(struct cxd *ci, int mode) { @@ -642,8 +641,6 @@ static int read_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) return len; } -#ifdef BUFFER_MODE - static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) { struct cxd *ci = ca->data; @@ -658,7 +655,6 @@ static int write_data(struct dvb_ca_en50221 *ca, int slot, u8 *ebuf, int ecount) mutex_unlock(&ci->lock); return ecount; } -#endif static struct dvb_ca_en50221 en_templ = { .read_attribute_mem = read_attribute_mem, @@ -669,11 +665,8 @@ static struct dvb_ca_en50221 en_templ = { .slot_shutdown = slot_shutdown, .slot_ts_enable = slot_ts_enable, .poll_slot_status = poll_slot_status, -#ifdef BUFFER_MODE .read_data = read_data, .write_data = write_data, -#endif - }; struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, @@ -703,6 +696,14 @@ struct dvb_ca_en50221 *cxd2099_attach(struct cxd2099_cfg *cfg, ci->en.data = ci; init(ci); dev_info(&i2c->dev, "Attached CXD2099AR at %02x\n", ci->cfg.adr); + + if (!buffermode) { + ci->en.read_data = NULL; + ci->en.write_data = NULL; + } else { + dev_info(&i2c->dev, "Using CXD2099AR buffer mode"); + } + return &ci->en; } EXPORT_SYMBOL(cxd2099_attach);