aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2012-08-13 21:18:02 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-04 14:20:23 -0300
commit38b2df95c53be4bd5421d933ca0dabbcb82741d0 (patch)
tree06f53c59c0b28b3c0adb147d22c1fe4297509e4f /drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c
parent4872b46b73618190bc3debcbc552460ddb4aad11 (diff)
[media] drx-j: add a driver for Trident drx-j frontend
Add support for the Trident DRX-J driver, including a card profile for the PCTV 80e which uses the chip. Thanks to Trident for allowing the release of this code under a BSD license, and of course Hauppauge/PCTV for pushing for its release to the community. [pdickeybeta@gmail.com: modified to fix compilation errors and also to move the driver files from the drx39xy subdirectory to the frontends directory] [m.chehab@samsung.com: fix merge conflicts, commented drx-j compilation and added EM28XX_R06_I2C_CLK setup also to the board setup] Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c')
-rw-r--r--drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c134
1 files changed, 134 insertions, 0 deletions
diff --git a/drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c b/drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c
new file mode 100644
index 00000000000..2b9344f9244
--- /dev/null
+++ b/drivers/media/dvb-frontends/drx39xyj/drx39xxj_dummy.c
@@ -0,0 +1,134 @@
+#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;
+}