Commit d7b0631e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] drx-j: remove some ugly bindings from drx39xxj_dummy.c

This file does an ugly binding between drxj and DVB frontend.

Remove most of the functions there. We still need to get rid of
get_frequency and set_frequency, but such patch is a little more
complex, as it should also remove some previous tuner bindings.
Acked-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 74c8794a
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
/* Dummy function to satisfy drxj.c */
#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 "drx39xxj.h"
/* Dummy function to satisfy drxj.c */
int drxbsp_tuner_open(struct tuner_instance *tuner)
{
return 0;
}
int drxbsp_tuner_close(struct tuner_instance *tuner)
{
return 0;
}
int drxbsp_tuner_set_frequency(struct tuner_instance *tuner,
u32 mode,
......@@ -38,96 +19,3 @@ drxbsp_tuner_get_frequency(struct tuner_instance *tuner,
{
return 0;
}
int drxbsp_hst_sleep(u32 n)
{
msleep(n);
return 0;
}
u32 drxbsp_hst_clock(void)
{
return jiffies_to_msecs(jiffies);
}
int drxbsp_hst_memcmp(void *s1, void *s2, u32 n)
{
return memcmp(s1, s2, (size_t)n);
}
void *drxbsp_hst_memcpy(void *to, void *from, u32 n)
{
return memcpy(to, from, (size_t)n);
}
int drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr,
u16 w_count,
u8 *wData,
struct i2c_device_addr *r_dev_addr,
u16 r_count, u8 *r_data)
{
struct drx39xxj_state *state;
struct i2c_msg msg[2];
unsigned int num_msgs;
if (w_dev_addr == NULL) {
/* Read only */
state = r_dev_addr->user_data;
msg[0].addr = r_dev_addr->i2c_addr >> 1;
msg[0].flags = I2C_M_RD;
msg[0].buf = r_data;
msg[0].len = r_count;
num_msgs = 1;
} else if (r_dev_addr == NULL) {
/* Write only */
state = w_dev_addr->user_data;
msg[0].addr = w_dev_addr->i2c_addr >> 1;
msg[0].flags = 0;
msg[0].buf = wData;
msg[0].len = w_count;
num_msgs = 1;
} else {
/* Both write and read */
state = w_dev_addr->user_data;
msg[0].addr = w_dev_addr->i2c_addr >> 1;
msg[0].flags = 0;
msg[0].buf = wData;
msg[0].len = w_count;
msg[1].addr = r_dev_addr->i2c_addr >> 1;
msg[1].flags = I2C_M_RD;
msg[1].buf = r_data;
msg[1].len = r_count;
num_msgs = 2;
}
if (state->i2c == NULL) {
pr_err("i2c was zero, aborting\n");
return 0;
}
if (i2c_transfer(state->i2c, msg, num_msgs) != num_msgs) {
pr_warn("drx3933: I2C write/read failed\n");
return -EREMOTEIO;
}
return 0;
#ifdef DJH_DEBUG
struct drx39xxj_state *state = w_dev_addr->user_data;
struct i2c_msg msg[2] = {
{.addr = w_dev_addr->i2c_addr,
.flags = 0, .buf = wData, .len = w_count},
{.addr = r_dev_addr->i2c_addr,
.flags = I2C_M_RD, .buf = r_data, .len = r_count},
};
pr_dbg("drx3933 i2c operation addr=%x i2c=%p, wc=%x rc=%x\n",
w_dev_addr->i2c_addr, state->i2c, w_count, r_count);
if (i2c_transfer(state->i2c, msg, 2) != 2) {
pr_warn("drx3933: I2C write/read failed\n");
return -EREMOTEIO;
}
#endif
return 0;
}
......@@ -39,7 +39,11 @@
*/
#include "drx_dap_fasi.h"
#include "drx_driver.h" /* for drxbsp_hst_memcpy() */
#include "drx39xxj.h"
#include <linux/delay.h>
#include <linux/jiffies.h>
/*============================================================================*/
......@@ -172,6 +176,79 @@ static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr,
return -EIO;
}
int drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr,
u16 w_count,
u8 *wData,
struct i2c_device_addr *r_dev_addr,
u16 r_count, u8 *r_data)
{
struct drx39xxj_state *state;
struct i2c_msg msg[2];
unsigned int num_msgs;
if (w_dev_addr == NULL) {
/* Read only */
state = r_dev_addr->user_data;
msg[0].addr = r_dev_addr->i2c_addr >> 1;
msg[0].flags = I2C_M_RD;
msg[0].buf = r_data;
msg[0].len = r_count;
num_msgs = 1;
} else if (r_dev_addr == NULL) {
/* Write only */
state = w_dev_addr->user_data;
msg[0].addr = w_dev_addr->i2c_addr >> 1;
msg[0].flags = 0;
msg[0].buf = wData;
msg[0].len = w_count;
num_msgs = 1;
} else {
/* Both write and read */
state = w_dev_addr->user_data;
msg[0].addr = w_dev_addr->i2c_addr >> 1;
msg[0].flags = 0;
msg[0].buf = wData;
msg[0].len = w_count;
msg[1].addr = r_dev_addr->i2c_addr >> 1;
msg[1].flags = I2C_M_RD;
msg[1].buf = r_data;
msg[1].len = r_count;
num_msgs = 2;
}
if (state->i2c == NULL) {
pr_err("i2c was zero, aborting\n");
return 0;
}
if (i2c_transfer(state->i2c, msg, num_msgs) != num_msgs) {
pr_warn("drx3933: I2C write/read failed\n");
return -EREMOTEIO;
}
return 0;
#ifdef DJH_DEBUG
struct drx39xxj_state *state = w_dev_addr->user_data;
struct i2c_msg msg[2] = {
{.addr = w_dev_addr->i2c_addr,
.flags = 0, .buf = wData, .len = w_count},
{.addr = r_dev_addr->i2c_addr,
.flags = I2C_M_RD, .buf = r_data, .len = r_count},
};
pr_dbg("drx3933 i2c operation addr=%x i2c=%p, wc=%x rc=%x\n",
w_dev_addr->i2c_addr, state->i2c, w_count, r_count);
if (i2c_transfer(state->i2c, msg, 2) != 2) {
pr_warn("drx3933: I2C write/read failed\n");
return -EREMOTEIO;
}
#endif
return 0;
}
/*============================================================================*/
/******************************
......@@ -515,7 +592,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
(data_block_size <
datasize ? data_block_size : datasize);
}
drxbsp_hst_memcpy(&buf[bufx], data, todo);
memcpy(&buf[bufx], data, todo);
/* write (address if can do and) data */
st = drxbsp_i2c_write_read(dev_addr,
(u16) (bufx + todo),
......
......@@ -225,10 +225,6 @@ struct tuner_instance {
struct tuner_ops *my_funct;
};
int drxbsp_tuner_open(struct tuner_instance *tuner);
int drxbsp_tuner_close(struct tuner_instance *tuner);
int drxbsp_tuner_set_frequency(struct tuner_instance *tuner,
u32 mode,
s32 frequency);
......@@ -238,9 +234,6 @@ int drxbsp_tuner_get_frequency(struct tuner_instance *tuner,
s32 *r_ffrequency,
s32 *i_ffrequency);
int drxbsp_tuner_lock_status(struct tuner_instance *tuner,
enum tuner_lock_status *lock_stat);
int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner,
struct i2c_device_addr *w_dev_addr,
u16 w_count,
......@@ -248,20 +241,6 @@ int drxbsp_tuner_default_i2c_write_read(struct tuner_instance *tuner,
struct i2c_device_addr *r_dev_addr,
u16 r_count, u8 *r_data);
int drxbsp_hst_init(void);
int drxbsp_hst_term(void);
void *drxbsp_hst_memcpy(void *to, void *from, u32 n);
int drxbsp_hst_memcmp(void *s1, void *s2, u32 n);
u32 drxbsp_hst_clock(void);
int drxbsp_hst_sleep(u32 n);
/**************
*
* This section configures the DRX Data Access Protocols (DAPs).
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment