All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Dickey <pdickeybeta@gmail.com>
To: linux-media@vger.kernel.org
Cc: Patrick Dickey <pdickeybeta@gmail.com>
Subject: [PATCH 08/25] added drx39_dummy for pctv80e support
Date: Thu, 10 Nov 2011 17:31:28 -0600	[thread overview]
Message-ID: <1320967905-7932-9-git-send-email-pdickeybeta@gmail.com> (raw)
In-Reply-To: <1320967905-7932-1-git-send-email-pdickeybeta@gmail.com>

---
 drivers/media/dvb/frontends/drx39xxj_dummy.c |  135 ++++++++++++++++++++++++++
 1 files changed, 135 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/dvb/frontends/drx39xxj_dummy.c

diff --git a/drivers/media/dvb/frontends/drx39xxj_dummy.c b/drivers/media/dvb/frontends/drx39xxj_dummy.c
new file mode 100644
index 0000000..3ed2c39
--- /dev/null
+++ b/drivers/media/dvb/frontends/drx39xxj_dummy.c
@@ -0,0 +1,135 @@
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/jiffies.h>
+#include <linux/types.h>
+
+#include "drx_driver.h"
+#include "bsp_types.h"
+#include "bsp_tuner.h"
+#include "drx39xxj.h"
+
+/* Dummy function to satisfy drxj.c */
+DRXStatus_t DRXBSP_TUNER_Open(pTUNERInstance_t tuner)
+{
+	return DRX_STS_OK;
+}
+
+DRXStatus_t DRXBSP_TUNER_Close(pTUNERInstance_t tuner)
+{
+	return DRX_STS_OK;
+}
+
+DRXStatus_t DRXBSP_TUNER_SetFrequency(pTUNERInstance_t tuner,
+				TUNERMode_t mode,
+				DRXFrequency_t centerFrequency)
+{
+	return DRX_STS_OK;
+}
+
+DRXStatus_t
+DRXBSP_TUNER_GetFrequency(pTUNERInstance_t tuner,
+			TUNERMode_t      mode,
+			pDRXFrequency_t  RFfrequency,
+			pDRXFrequency_t  IFfrequency)
+{
+	return DRX_STS_OK;
+}
+
+DRXStatus_t DRXBSP_HST_Sleep(u32_t n)
+{
+	msleep(n);
+	return DRX_STS_OK;
+}
+
+u32_t DRXBSP_HST_Clock(void)
+{
+	return jiffies_to_msecs(jiffies);
+}
+
+int DRXBSP_HST_Memcmp(void *s1, void *s2, u32_t n)
+{
+	return (memcmp(s1, s2, (size_t) n));
+}
+
+void* DRXBSP_HST_Memcpy(void *to, void *from, u32_t n)
+{
+	return (memcpy(to, from, (size_t) n));
+}
+
+DRXStatus_t DRXBSP_I2C_WriteRead(pI2CDeviceAddr_t wDevAddr,
+				u16_t            wCount,
+				pu8_t            wData,
+				pI2CDeviceAddr_t rDevAddr,
+				u16_t            rCount,
+				pu8_t            rData)
+{
+	struct drx39xxj_state *state;
+	struct i2c_msg msg[2];
+	unsigned int num_msgs;
+
+	if (wDevAddr == NULL) {
+		/* Read only */
+		state = rDevAddr->userData;
+		msg[0].addr = rDevAddr->i2cAddr >> 1;
+		msg[0].flags = I2C_M_RD;
+		msg[0].buf = rData;
+		msg[0].len = rCount;
+		num_msgs = 1;
+	} else if (rDevAddr == NULL) {
+		/* Write only */
+		state = wDevAddr->userData;
+		msg[0].addr = wDevAddr->i2cAddr >> 1;
+		msg[0].flags = 0;
+		msg[0].buf = wData;
+		msg[0].len = wCount;
+		num_msgs = 1;
+	} else {
+		/* Both write and read */
+		state = wDevAddr->userData;
+		msg[0].addr = wDevAddr->i2cAddr >> 1;
+		msg[0].flags = 0;
+		msg[0].buf = wData;
+		msg[0].len = wCount;
+		msg[1].addr = rDevAddr->i2cAddr >> 1;
+		msg[1].flags = I2C_M_RD;
+		msg[1].buf = rData;
+		msg[1].len = rCount;
+		num_msgs = 2;
+	}
+
+	if (state->i2c == NULL) {
+	  printk("i2c was zero, aborting\n");
+	  return 0;
+	}
+	if (i2c_transfer(state->i2c, msg, num_msgs) != num_msgs) {
+		printk(KERN_WARNING "drx3933: I2C write/read failed\n");
+		return -EREMOTEIO;
+	}
+
+	return DRX_STS_OK;
+
+#ifdef DJH_DEBUG
+
+	struct drx39xxj_state *state = wDevAddr->userData;
+
+	struct i2c_msg msg[2] = {
+		{ .addr = wDevAddr->i2cAddr,
+		  .flags = 0, .buf = wData, .len = wCount },
+		{ .addr = rDevAddr->i2cAddr,
+		  .flags = I2C_M_RD, .buf = rData, .len = rCount },
+	};
+
+	printk("drx3933 i2c operation addr=%x i2c=%p, wc=%x rc=%x\n",
+	       wDevAddr->i2cAddr, state->i2c, wCount, rCount);
+
+	if (i2c_transfer(state->i2c, msg, 2) != 2) {
+		printk(KERN_WARNING "drx3933: I2C write/read failed\n");
+		return -EREMOTEIO;
+	}
+#endif
+	return 0;
+}
-- 
1.7.5.4


  parent reply	other threads:[~2011-11-10 23:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-10 23:31 [PATCH 00/25] Add PCTV-80e Support to v4l Patrick Dickey
2011-11-10 23:31 ` [PATCH 01/25] added PCTV80e information to cardlist file Patrick Dickey
2011-11-10 23:31 ` [PATCH 02/25] added bsp_host for pctv80e support Patrick Dickey
2011-11-10 23:31 ` [PATCH 03/25] added bsp_i2c " Patrick Dickey
2011-11-10 23:31 ` [PATCH 04/25] added bsp_tuner " Patrick Dickey
2011-11-10 23:31 ` [PATCH 05/25] added bsp_types " Patrick Dickey
2011-11-10 23:31 ` [PATCH 06/25] added drx39xxj " Patrick Dickey
2011-11-10 23:31 ` [PATCH 07/25] added drx39xxj header " Patrick Dickey
2011-11-10 23:31 ` Patrick Dickey [this message]
2011-11-10 23:31 ` [PATCH 09/25] added drx_dap_fasi " Patrick Dickey
2011-11-10 23:31 ` [PATCH 10/25] added drx_dap_fasi header " Patrick Dickey
2011-11-10 23:31 ` [PATCH 11/25] added drx_driver " Patrick Dickey
2011-11-10 23:31 ` [PATCH 12/25] added drx_driver header " Patrick Dickey
2011-11-10 23:31 ` [PATCH 13/25] added drx_driver_version " Patrick Dickey
2011-11-10 23:31 ` [PATCH 15/25] added drxj " Patrick Dickey
2011-11-10 23:31 ` [PATCH 18/25] added drxj_mc_vsb " Patrick Dickey
2011-11-10 23:31 ` [PATCH 19/25] added drxj_mc_vsbqam " Patrick Dickey
2011-11-10 23:31 ` [PATCH 20/25] added drxj_options " Patrick Dickey
2011-11-10 23:31 ` [PATCH 21/25] modified Kconfig to include " Patrick Dickey
2011-11-10 23:31 ` [PATCH 22/25] modified Makefile for " Patrick Dickey
2011-11-10 23:31 ` [PATCH 23/25] modified em28xx-cards " Patrick Dickey
2011-11-10 23:31 ` [PATCH 24/25] modified em28xx-dvb " Patrick Dickey
2011-11-10 23:31 ` [PATCH 25/25] modified em28xx header " Patrick Dickey
2011-11-11  1:45 ` [PATCH 00/25] Add PCTV-80e Support to v4l Devin Heitmueller
2011-11-11  2:36   ` Patrick Dickey
2011-11-11  3:19     ` Devin Heitmueller
2011-11-11 11:39       ` Patrick Dickey
2011-11-11 13:28       ` Patrick Dickey

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=1320967905-7932-9-git-send-email-pdickeybeta@gmail.com \
    --to=pdickeybeta@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.