From patchwork Mon Apr 9 16:47:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10331771 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 B48AC6037F for ; Mon, 9 Apr 2018 16:48:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A71BE2015F for ; Mon, 9 Apr 2018 16:48:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BF7628801; Mon, 9 Apr 2018 16:48:20 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 299102015F for ; Mon, 9 Apr 2018 16:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753464AbeDIQsP (ORCPT ); Mon, 9 Apr 2018 12:48:15 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36788 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753416AbeDIQsL (ORCPT ); Mon, 9 Apr 2018 12:48:11 -0400 Received: by mail-wr0-f195.google.com with SMTP id y55so10273711wry.3 for ; Mon, 09 Apr 2018 09:48:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=qLNOxQZJpPmC4d3SrHQxqywXukol435WRBtvaN77cIE=; b=DP97EGgynTwT5Gb4OZNw8MnHrhqMNDZWHq33GfdBwdKEswM7mwKGd4qIrbnH2+59d1 WKTAd2wa6MgV4xeeeNsMNTtfPRmkJd7J4CA5p9rnFuLJPkDukqgLN6b0gxGJF+1M9W1n cj/VuwP1U6FhI0F/MI2OwJNISEzs7nCNXQlm1ztQPB4mHhno3l2/Rub01xCclwr0ejRQ 1UEsCfnXO3j0lvnJOseCnI5nIFY0jDD3L+82jK7NSoGY4mw50HbY/dzDyFz2f2aJPrC7 J4wdrfwKTjOC8qtnz4EjPLqJBKCw2OWcu9clzUEPTsx0C+WkL89TPNTRzZtmEBJHePdW ZwYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=qLNOxQZJpPmC4d3SrHQxqywXukol435WRBtvaN77cIE=; b=n0niHDOeYg6mB+zHEKi/KfBovbzRSHDpl4RHa1Wv5SO3NB/OrqoPkBBVhAF01htOy2 dzYOiqjZ4wRqsqRf8+ZZgMwgup2rtwGJbqmIdfZxp+8QXFtjZcT7L6Lqz40gW7Vc1mZ9 KjJtUFTuoUciScO1vB2hKfuf3CnxopcF5sDQxkOhFqeSUEnyGxZm0FUpoJbpYVjQTI/c c2S1FLHQ2+btogySrNbcMmmBi0KgecqB9x8+73xd1uXYjZISJXMauakfuG93eXSxpvWB kHKzfHgHHoPXhjZE76iCGPKgXLdWAuCrXNLrjEnKArN6zBRimpl+hRc29lw/Er55TUbS EMeg== X-Gm-Message-State: AElRT7Gq9cuBjRcGcAvEkQAqeT/P8xWFCi4y5Ws9pWFf3zFU18R8eW/c 65kEjWySePinXEDhO8hfPZW8Eg== X-Google-Smtp-Source: AIpwx4/9jxVT2/2T4h0o9jbuZueSL4nMpQR1iCRSiY2NaYiRDhxfmRP7Sg+u4bozQ++Pb3a0aesNmw== X-Received: by 10.223.172.45 with SMTP id v42mr28440874wrc.2.1523292489666; Mon, 09 Apr 2018 09:48:09 -0700 (PDT) Received: from dvbdev.wuest.de (ip-84-118-193-200.unity-media.net. [84.118.193.200]) by smtp.gmail.com with ESMTPSA id 11sm1380416wmd.1.2018.04.09.09.48.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 09:48:09 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH v2 16/19] [media] ddbridge/max: implement MCI/MaxSX8 attach function Date: Mon, 9 Apr 2018 18:47:49 +0200 Message-Id: <20180409164752.641-17-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180409164752.641-1-d.scheller.oss@gmail.com> References: <20180409164752.641-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 Implement frontend attachment as ddb_fe_attach_mci() into the ddbridge-max module. The MaxSX8 MCI cards are part of the Max card series and make use of the LNB controller driven by the already existing lnb functionality, so here's where this code belongs to. Picked up from the upstream dddvb-0.9.33 release. Signed-off-by: Daniel Scheller --- drivers/media/pci/ddbridge/ddbridge-max.c | 42 +++++++++++++++++++++++++++++++ drivers/media/pci/ddbridge/ddbridge-max.h | 1 + 2 files changed, 43 insertions(+) diff --git a/drivers/media/pci/ddbridge/ddbridge-max.c b/drivers/media/pci/ddbridge/ddbridge-max.c index dc6b81488746..739e4b444cf4 100644 --- a/drivers/media/pci/ddbridge/ddbridge-max.c +++ b/drivers/media/pci/ddbridge/ddbridge-max.c @@ -33,6 +33,7 @@ #include "ddbridge.h" #include "ddbridge-regs.h" #include "ddbridge-io.h" +#include "ddbridge-mci.h" #include "ddbridge-max.h" #include "mxl5xx.h" @@ -452,3 +453,44 @@ int ddb_fe_attach_mxl5xx(struct ddb_input *input) dvb->input = tuner; return 0; } + +/******************************************************************************/ +/* MAX MCI related functions */ + +int ddb_fe_attach_mci(struct ddb_input *input) +{ + struct ddb *dev = input->port->dev; + struct ddb_dvb *dvb = &input->port->dvb[input->nr & 1]; + struct ddb_port *port = input->port; + struct ddb_link *link = &dev->link[port->lnr]; + int demod, tuner; + + demod = input->nr; + tuner = demod & 3; + if (fmode == 3) + tuner = 0; + dvb->fe = ddb_mci_attach(input, 0, demod, &dvb->set_input); + if (!dvb->fe) { + dev_err(dev->dev, "No MAXSX8 found!\n"); + return -ENODEV; + } + if (!dvb->set_input) { + dev_err(dev->dev, "No MCI set_input function pointer!\n"); + return -ENODEV; + } + if (input->nr < 4) { + lnb_command(dev, port->lnr, input->nr, LNB_CMD_INIT); + lnb_set_voltage(dev, port->lnr, input->nr, SEC_VOLTAGE_OFF); + } + ddb_lnb_init_fmode(dev, link, fmode); + + dvb->fe->ops.set_voltage = max_set_voltage; + dvb->fe->ops.enable_high_lnb_voltage = max_enable_high_lnb_voltage; + dvb->fe->ops.set_tone = max_set_tone; + dvb->diseqc_send_master_cmd = dvb->fe->ops.diseqc_send_master_cmd; + dvb->fe->ops.diseqc_send_master_cmd = max_send_master_cmd; + dvb->fe->ops.diseqc_send_burst = max_send_burst; + dvb->fe->sec_priv = input; + dvb->input = tuner; + return 0; +} diff --git a/drivers/media/pci/ddbridge/ddbridge-max.h b/drivers/media/pci/ddbridge/ddbridge-max.h index bf8bf38739f6..82efc53baa94 100644 --- a/drivers/media/pci/ddbridge/ddbridge-max.h +++ b/drivers/media/pci/ddbridge/ddbridge-max.h @@ -25,5 +25,6 @@ int ddb_lnb_init_fmode(struct ddb *dev, struct ddb_link *link, u32 fm); int ddb_fe_attach_mxl5xx(struct ddb_input *input); +int ddb_fe_attach_mci(struct ddb_input *input); #endif /* _DDBRIDGE_MAX_H */