public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Scheller <d.scheller.oss@gmail.com>
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	[thread overview]
Message-ID: <20180402182427.20918-18-d.scheller.oss@gmail.com> (raw)
In-Reply-To: <20180402182427.20918-1-d.scheller.oss@gmail.com>

From: Daniel Scheller <d.scheller@gmx.net>

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 <d.scheller@gmx.net>
---
 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 */
-- 
2.16.1

  parent reply	other threads:[~2018-04-02 18:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-02 18:24 [PATCH 00/20] dddvb/ddbridge-0.9.33 Daniel Scheller
2018-04-02 18:24 ` [PATCH 01/20] [media] dvb-frontends/stv0910: add init values for TSINSDELM/L Daniel Scheller
2018-04-02 18:24 ` [PATCH 02/20] [media] dvb-frontends/stv0910: increase parallel TS output speed Daniel Scheller
2018-04-02 18:24 ` [PATCH 03/20] [media] dvb-frontends/stv0910: fix CNR reporting in read_snr() Daniel Scheller
2018-04-02 18:24 ` [PATCH 04/20] [media] ddbridge: move modparams to ddbridge-core.c Daniel Scheller
2018-04-02 18:24 ` [PATCH 05/20] [media] ddbridge: move ddb_wq and the wq+class initialisation to -core Daniel Scheller
2018-04-02 18:24 ` [PATCH 06/20] [media] ddbridge: move MSI IRQ cleanup to a helper function Daniel Scheller
2018-04-02 18:24 ` [PATCH 07/20] [media] ddbridge: request/free_irq using pci_irq_vector, enable MSI-X Daniel Scheller
2018-04-02 18:24 ` [PATCH 08/20] [media] ddbridge: add helper for IRQ handler setup Daniel Scheller
2018-04-02 18:24 ` [PATCH 09/20] [media] ddbridge: add macros to handle IRQs in nibble and byte blocks Daniel Scheller
2018-04-02 18:24 ` [PATCH 10/20] [media] ddbridge: improve separated MSI IRQ handling Daniel Scheller
2018-04-02 18:24 ` [PATCH 11/20] [media] ddbridge: use spin_lock_irqsave() in output_work() Daniel Scheller
2018-04-02 18:24 ` [PATCH 12/20] [media] ddbridge: fix output buffer check Daniel Scheller
2018-04-02 18:24 ` [PATCH 13/20] [media] ddbridge: set devid entry for link 0 Daniel Scheller
2018-04-02 18:24 ` [PATCH 14/20] [media] ddbridge: make DMA buffer count and size modparam-configurable Daniel Scheller
2018-04-02 18:24 ` [PATCH 15/20] [media] ddbridge: support dummy tuners with 125MByte/s dummy data stream Daniel Scheller
2018-04-02 18:24 ` [PATCH 16/20] [media] ddbridge: initial support for MCI-based MaxSX8 cards Daniel Scheller
2018-04-02 18:24 ` Daniel Scheller [this message]
2018-04-02 18:24 ` [PATCH 18/20] [media] ddbridge: add hardware defs and PCI IDs for MCI cards Daniel Scheller
2018-04-02 18:24 ` [PATCH 19/20] [media] ddbridge: recognize and attach the MaxSX8 cards Daniel Scheller
2018-04-02 18:24 ` [PATCH 20/20] [media] ddbridge: set driver version to 0.9.33-integrated Daniel Scheller
2018-04-05 20:45 ` [PATCH 00/20] dddvb/ddbridge-0.9.33 Daniel Scheller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180402182427.20918-18-d.scheller.oss@gmail.com \
    --to=d.scheller.oss@gmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mchehab@s-opensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox