From patchwork Mon Apr 2 18:24:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Scheller X-Patchwork-Id: 10320165 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 8D7C760375 for ; Mon, 2 Apr 2018 18:24:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E8DA28A4C for ; Mon, 2 Apr 2018 18:24:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 733EC28A67; Mon, 2 Apr 2018 18:24:55 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, 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 13DC528A4C for ; Mon, 2 Apr 2018 18:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754225AbeDBSYy (ORCPT ); Mon, 2 Apr 2018 14:24:54 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:56057 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753194AbeDBSYq (ORCPT ); Mon, 2 Apr 2018 14:24:46 -0400 Received: by mail-wm0-f67.google.com with SMTP id b127so26677655wmf.5 for ; Mon, 02 Apr 2018 11:24:46 -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=hILNoTA/k7T91tKM5xzcAiAh5pdzogIaBIWpYR0qRM+F6E1eWHiBaV/kQnW/KqcqB2 bCCiijQF3zPYDeJmecf8ddTFPjE2fiC5FwnW9gUsKRd+WSSIrPsukM4sL5poR+Ejv4gT uC22ITA39bRjiSMjSbXk8aGRbDA4EcEQ2EylLI1tHxbbo3fPcgMaYINme2mD1/z06HEO 86ZMel7hoO4WjlcFI83d/8k/Mh48eSe4rpffQ7g0oq6wqTavPbym1XkSlSKohZdwUrwU Kj+KMjWD6B+OE8p+qkNbpWeG94fTP05YQ+gRjPLL+xWCb8VJpnPL0a/q8uTc0k277+JX 5WXg== 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=T9M3c5AhvItILOEJjoi9hG/mtr3siWCduWnO73vCB8NRsD9B6ope6MxnbJHitIwui5 IsQAFpfQP91Eg/2HL7GUU8Y9EGYgTt3fm3Xm1qjLyibyIAojw+vlShYki34W5ZfqVSVw avbpaghUdaio9TaROWu2Ls8FsvCk0bSgnIL0TdCSNxBZP7rWq3nr+PrLw5ZHzepMB3r7 q4cnVzKdJqZ1U5HqB7DKYLhuO29QWHho2kpg9xYYSu3sndSvcgX+E4ekB3AjUTVQJozL YjED7Ee8NhAHKRh/n3uoxH81otuGe4+/RhXd27RYfHMhUcicXYqo6eP2HFH9/NIfvLos WOig== X-Gm-Message-State: AElRT7HehV7yApGCwL3PT9YKvxZyOIgyxQTaDIGOVltHbpzQpSKGGARZ ERx+VCJJAnaAumpQosxlNwX6sA== X-Google-Smtp-Source: AIpwx49Wf0XTvzfC0B9xkuWjUozPi0mczvFmt2M3YOQcUbTiNGa54jgxWQqKNXiuz/5zo9LRPrnigg== X-Received: by 10.28.132.211 with SMTP id g202mr1598558wmd.17.1522693485433; Mon, 02 Apr 2018 11:24:45 -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 x9sm2368273wrb.18.2018.04.02.11.24.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Apr 2018 11:24:44 -0700 (PDT) From: Daniel Scheller To: linux-media@vger.kernel.org, mchehab@kernel.org, mchehab@s-opensource.com Subject: [PATCH 17/20] [media] ddbridge/max: implement MCI/MaxSX8 attach function Date: Mon, 2 Apr 2018 20:24:24 +0200 Message-Id: <20180402182427.20918-18-d.scheller.oss@gmail.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180402182427.20918-1-d.scheller.oss@gmail.com> References: <20180402182427.20918-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 */