Commit 34490a0a authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] staging: as102: Eliminate as10x_handle_t alias

Remove pre-processor defined as10x_handle_t data type by directly
replacing it with struct as102_bus_adapter_t. phandle is renamed
to adap inside function bodies.

Cc: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarSylwester Nawrocki <snjw23@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d758b9ef
...@@ -60,7 +60,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); ...@@ -60,7 +60,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
static void as102_stop_stream(struct as102_dev_t *dev) static void as102_stop_stream(struct as102_dev_t *dev)
{ {
struct as102_bus_adapter_t *bus_adap; struct as10x_bus_adapter_t *bus_adap;
if (dev != NULL) if (dev != NULL)
bus_adap = &dev->bus_adap; bus_adap = &dev->bus_adap;
...@@ -83,7 +83,7 @@ static void as102_stop_stream(struct as102_dev_t *dev) ...@@ -83,7 +83,7 @@ static void as102_stop_stream(struct as102_dev_t *dev)
static int as102_start_stream(struct as102_dev_t *dev) static int as102_start_stream(struct as102_dev_t *dev)
{ {
struct as102_bus_adapter_t *bus_adap; struct as10x_bus_adapter_t *bus_adap;
int ret = -EFAULT; int ret = -EFAULT;
if (dev != NULL) if (dev != NULL)
...@@ -109,7 +109,7 @@ static int as102_start_stream(struct as102_dev_t *dev) ...@@ -109,7 +109,7 @@ static int as102_start_stream(struct as102_dev_t *dev)
static int as10x_pid_filter(struct as102_dev_t *dev, static int as10x_pid_filter(struct as102_dev_t *dev,
int index, u16 pid, int onoff) { int index, u16 pid, int onoff) {
struct as102_bus_adapter_t *bus_adap = &dev->bus_adap; struct as10x_bus_adapter_t *bus_adap = &dev->bus_adap;
int ret = -EFAULT; int ret = -EFAULT;
ENTER(); ENTER();
......
...@@ -50,7 +50,7 @@ extern int elna_enable; ...@@ -50,7 +50,7 @@ extern int elna_enable;
#define AS102_USB_BUF_SIZE 512 #define AS102_USB_BUF_SIZE 512
#define MAX_STREAM_URB 32 #define MAX_STREAM_URB 32
struct as102_bus_adapter_t { struct as10x_bus_adapter_t {
struct usb_device *usb_dev; struct usb_device *usb_dev;
/* bus token lock */ /* bus token lock */
struct mutex lock; struct mutex lock;
...@@ -72,7 +72,7 @@ struct as102_bus_adapter_t { ...@@ -72,7 +72,7 @@ struct as102_bus_adapter_t {
struct as102_dev_t { struct as102_dev_t {
const char *name; const char *name;
struct as102_bus_adapter_t bus_adap; struct as10x_bus_adapter_t bus_adap;
struct list_head device_entry; struct list_head device_entry;
struct kref kref; struct kref kref;
unsigned long minor; unsigned long minor;
......
...@@ -101,7 +101,7 @@ static int parse_hex_line(unsigned char *fw_data, unsigned char *addr, ...@@ -101,7 +101,7 @@ static int parse_hex_line(unsigned char *fw_data, unsigned char *addr,
return (count * 2) + 2; return (count * 2) + 2;
} }
static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, static int as102_firmware_upload(struct as10x_bus_adapter_t *bus_adap,
unsigned char *cmd, unsigned char *cmd,
const struct firmware *firmware) { const struct firmware *firmware) {
...@@ -162,7 +162,7 @@ static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap, ...@@ -162,7 +162,7 @@ static int as102_firmware_upload(struct as102_bus_adapter_t *bus_adap,
return (errno == 0) ? total_read_bytes : errno; return (errno == 0) ? total_read_bytes : errno;
} }
int as102_fw_upload(struct as102_bus_adapter_t *bus_adap) int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap)
{ {
int errno = -EFAULT; int errno = -EFAULT;
const struct firmware *firmware; const struct firmware *firmware;
......
...@@ -34,5 +34,5 @@ struct as10x_fw_pkt_t { ...@@ -34,5 +34,5 @@ struct as10x_fw_pkt_t {
} __packed; } __packed;
#ifdef __KERNEL__ #ifdef __KERNEL__
int as102_fw_upload(struct as102_bus_adapter_t *bus_adap); int as102_fw_upload(struct as10x_bus_adapter_t *bus_adap);
#endif #endif
...@@ -74,7 +74,7 @@ static struct usb_class_driver as102_usb_class_driver = { ...@@ -74,7 +74,7 @@ static struct usb_class_driver as102_usb_class_driver = {
.minor_base = AS102_DEVICE_MAJOR, .minor_base = AS102_DEVICE_MAJOR,
}; };
static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, static int as102_usb_xfer_cmd(struct as10x_bus_adapter_t *bus_adap,
unsigned char *send_buf, int send_buf_len, unsigned char *send_buf, int send_buf_len,
unsigned char *recv_buf, int recv_buf_len) unsigned char *recv_buf, int recv_buf_len)
{ {
...@@ -131,7 +131,7 @@ static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap, ...@@ -131,7 +131,7 @@ static int as102_usb_xfer_cmd(struct as102_bus_adapter_t *bus_adap,
return ret; return ret;
} }
static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, static int as102_send_ep1(struct as10x_bus_adapter_t *bus_adap,
unsigned char *send_buf, unsigned char *send_buf,
int send_buf_len, int send_buf_len,
int swap32) int swap32)
...@@ -154,7 +154,7 @@ static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap, ...@@ -154,7 +154,7 @@ static int as102_send_ep1(struct as102_bus_adapter_t *bus_adap,
return ret ? ret : actual_len; return ret ? ret : actual_len;
} }
static int as102_read_ep2(struct as102_bus_adapter_t *bus_adap, static int as102_read_ep2(struct as10x_bus_adapter_t *bus_adap,
unsigned char *recv_buf, int recv_buf_len) unsigned char *recv_buf, int recv_buf_len)
{ {
int ret = 0, actual_len; int ret = 0, actual_len;
......
...@@ -25,35 +25,35 @@ ...@@ -25,35 +25,35 @@
/** /**
* as10x_cmd_turn_on - send turn on command to AS10x * as10x_cmd_turn_on - send turn on command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* *
* Return 0 when no error, < 0 in case of error. * Return 0 when no error, < 0 in case of error.
*/ */
int as10x_cmd_turn_on(as10x_handle_t *phandle) int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.turn_on.req)); sizeof(pcmd->body.turn_on.req));
/* fill command */ /* fill command */
pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON); pcmd->body.turn_on.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNON);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
sizeof(pcmd->body.turn_on.req) + sizeof(pcmd->body.turn_on.req) +
HEADER_SIZE, HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.turn_on.rsp) + sizeof(prsp->body.turn_on.rsp) +
HEADER_SIZE); HEADER_SIZE);
} else { } else {
error = AS10X_CMD_ERROR; error = AS10X_CMD_ERROR;
} }
...@@ -71,31 +71,31 @@ int as10x_cmd_turn_on(as10x_handle_t *phandle) ...@@ -71,31 +71,31 @@ int as10x_cmd_turn_on(as10x_handle_t *phandle)
/** /**
* as10x_cmd_turn_off - send turn off command to AS10x * as10x_cmd_turn_off - send turn off command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_turn_off(as10x_handle_t *phandle) int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.turn_off.req)); sizeof(pcmd->body.turn_off.req));
/* fill command */ /* fill command */
pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF); pcmd->body.turn_off.req.proc_id = cpu_to_le16(CONTROL_PROC_TURNOFF);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd( error = adap->ops->xfer_cmd(
phandle, (uint8_t *) pcmd, adap, (uint8_t *) pcmd,
sizeof(pcmd->body.turn_off.req) + HEADER_SIZE, sizeof(pcmd->body.turn_off.req) + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE); sizeof(prsp->body.turn_off.rsp) + HEADER_SIZE);
...@@ -116,23 +116,24 @@ int as10x_cmd_turn_off(as10x_handle_t *phandle) ...@@ -116,23 +116,24 @@ int as10x_cmd_turn_off(as10x_handle_t *phandle)
/** /**
* as10x_cmd_set_tune - send set tune command to AS10x * as10x_cmd_set_tune - send set tune command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @ptune: tune parameters * @ptune: tune parameters
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
struct as10x_tune_args *ptune)
{ {
int error; int error;
struct as10x_cmd_t *preq, *prsp; struct as10x_cmd_t *preq, *prsp;
ENTER(); ENTER();
preq = phandle->cmd; preq = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(preq, (++phandle->cmd_xid), as10x_cmd_build(preq, (++adap->cmd_xid),
sizeof(preq->body.set_tune.req)); sizeof(preq->body.set_tune.req));
/* fill command */ /* fill command */
...@@ -150,14 +151,14 @@ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) ...@@ -150,14 +151,14 @@ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
ptune->transmission_mode; ptune->transmission_mode;
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = adap->ops->xfer_cmd(adap,
(uint8_t *) preq, (uint8_t *) preq,
sizeof(preq->body.set_tune.req) sizeof(preq->body.set_tune.req)
+ HEADER_SIZE, + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.set_tune.rsp) sizeof(prsp->body.set_tune.rsp)
+ HEADER_SIZE); + HEADER_SIZE);
} else { } else {
error = AS10X_CMD_ERROR; error = AS10X_CMD_ERROR;
} }
...@@ -175,12 +176,12 @@ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune) ...@@ -175,12 +176,12 @@ int as10x_cmd_set_tune(as10x_handle_t *phandle, struct as10x_tune_args *ptune)
/** /**
* as10x_cmd_get_tune_status - send get tune status command to AS10x * as10x_cmd_get_tune_status - send get tune status command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @pstatus: pointer to updated status structure of the current tune * @pstatus: pointer to updated status structure of the current tune
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_get_tune_status(as10x_handle_t *phandle, int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
struct as10x_tune_status *pstatus) struct as10x_tune_status *pstatus)
{ {
int error; int error;
...@@ -188,11 +189,11 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle, ...@@ -188,11 +189,11 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
ENTER(); ENTER();
preq = phandle->cmd; preq = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(preq, (++phandle->cmd_xid), as10x_cmd_build(preq, (++adap->cmd_xid),
sizeof(preq->body.get_tune_status.req)); sizeof(preq->body.get_tune_status.req));
/* fill command */ /* fill command */
...@@ -200,9 +201,9 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle, ...@@ -200,9 +201,9 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
cpu_to_le16(CONTROL_PROC_GETTUNESTAT); cpu_to_le16(CONTROL_PROC_GETTUNESTAT);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd( error = adap->ops->xfer_cmd(
phandle, adap,
(uint8_t *) preq, (uint8_t *) preq,
sizeof(preq->body.get_tune_status.req) + HEADER_SIZE, sizeof(preq->body.get_tune_status.req) + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
...@@ -233,23 +234,23 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle, ...@@ -233,23 +234,23 @@ int as10x_cmd_get_tune_status(as10x_handle_t *phandle,
/** /**
* as10x_cmd_get_tps - send get TPS command to AS10x * as10x_cmd_get_tps - send get TPS command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x handle
* @ptps: pointer to TPS parameters structure * @ptps: pointer to TPS parameters structure
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap, struct as10x_tps *ptps)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.get_tps.req)); sizeof(pcmd->body.get_tps.req));
/* fill command */ /* fill command */
...@@ -257,14 +258,14 @@ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) ...@@ -257,14 +258,14 @@ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
cpu_to_le16(CONTROL_PROC_GETTPS); cpu_to_le16(CONTROL_PROC_GETTPS);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = adap->ops->xfer_cmd(adap,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.get_tps.req) + sizeof(pcmd->body.get_tps.req) +
HEADER_SIZE, HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.get_tps.rsp) + sizeof(prsp->body.get_tps.rsp) +
HEADER_SIZE); HEADER_SIZE);
} else { } else {
error = AS10X_CMD_ERROR; error = AS10X_CMD_ERROR;
} }
...@@ -296,12 +297,12 @@ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps) ...@@ -296,12 +297,12 @@ int as10x_cmd_get_tps(as10x_handle_t *phandle, struct as10x_tps *ptps)
/** /**
* as10x_cmd_get_demod_stats - send get demod stats command to AS10x * as10x_cmd_get_demod_stats - send get demod stats command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @pdemod_stats: pointer to demod stats parameters structure * @pdemod_stats: pointer to demod stats parameters structure
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap,
struct as10x_demod_stats *pdemod_stats) struct as10x_demod_stats *pdemod_stats)
{ {
int error; int error;
...@@ -309,11 +310,11 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, ...@@ -309,11 +310,11 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.get_demod_stats.req)); sizeof(pcmd->body.get_demod_stats.req));
/* fill command */ /* fill command */
...@@ -321,8 +322,8 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, ...@@ -321,8 +322,8 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS); cpu_to_le16(CONTROL_PROC_GET_DEMOD_STATS);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = adap->ops->xfer_cmd(adap,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.get_demod_stats.req) sizeof(pcmd->body.get_demod_stats.req)
+ HEADER_SIZE, + HEADER_SIZE,
...@@ -360,13 +361,13 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, ...@@ -360,13 +361,13 @@ int as10x_cmd_get_demod_stats(as10x_handle_t *phandle,
/** /**
* as10x_cmd_get_impulse_resp - send get impulse response command to AS10x * as10x_cmd_get_impulse_resp - send get impulse response command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @is_ready: pointer to value indicating when impulse * @is_ready: pointer to value indicating when impulse
* response data is ready * response data is ready
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
uint8_t *is_ready) uint8_t *is_ready)
{ {
int error; int error;
...@@ -374,11 +375,11 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, ...@@ -374,11 +375,11 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.get_impulse_rsp.req)); sizeof(pcmd->body.get_impulse_rsp.req));
/* fill command */ /* fill command */
...@@ -386,8 +387,8 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, ...@@ -386,8 +387,8 @@ int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle,
cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP); cpu_to_le16(CONTROL_PROC_GET_IMPULSE_RESP);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = adap->ops->xfer_cmd(adap,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.get_impulse_rsp.req) sizeof(pcmd->body.get_impulse_rsp.req)
+ HEADER_SIZE, + HEADER_SIZE,
......
...@@ -489,41 +489,41 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id, ...@@ -489,41 +489,41 @@ void as10x_cmd_build(struct as10x_cmd_t *pcmd, uint16_t proc_id,
int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id); int as10x_rsp_parse(struct as10x_cmd_t *r, uint16_t proc_id);
/* as10x cmd */ /* as10x cmd */
int as10x_cmd_turn_on(as10x_handle_t *phandle); int as10x_cmd_turn_on(struct as10x_bus_adapter_t *adap);
int as10x_cmd_turn_off(as10x_handle_t *phandle); int as10x_cmd_turn_off(struct as10x_bus_adapter_t *adap);
int as10x_cmd_set_tune(as10x_handle_t *phandle, int as10x_cmd_set_tune(struct as10x_bus_adapter_t *adap,
struct as10x_tune_args *ptune); struct as10x_tune_args *ptune);
int as10x_cmd_get_tune_status(as10x_handle_t *phandle, int as10x_cmd_get_tune_status(struct as10x_bus_adapter_t *adap,
struct as10x_tune_status *pstatus); struct as10x_tune_status *pstatus);
int as10x_cmd_get_tps(as10x_handle_t *phandle, int as10x_cmd_get_tps(struct as10x_bus_adapter_t *adap,
struct as10x_tps *ptps); struct as10x_tps *ptps);
int as10x_cmd_get_demod_stats(as10x_handle_t *phandle, int as10x_cmd_get_demod_stats(struct as10x_bus_adapter_t *adap,
struct as10x_demod_stats *pdemod_stats); struct as10x_demod_stats *pdemod_stats);
int as10x_cmd_get_impulse_resp(as10x_handle_t *phandle, int as10x_cmd_get_impulse_resp(struct as10x_bus_adapter_t *adap,
uint8_t *is_ready); uint8_t *is_ready);
/* as10x cmd stream */ /* as10x cmd stream */
int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
struct as10x_ts_filter *filter); struct as10x_ts_filter *filter);
int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
uint16_t pid_value); uint16_t pid_value);
int as10x_cmd_start_streaming(as10x_handle_t *phandle); int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap);
int as10x_cmd_stop_streaming(as10x_handle_t *phandle); int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap);
/* as10x cmd cfg */ /* as10x cmd cfg */
int as10x_cmd_set_context(as10x_handle_t *phandle, int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap,
uint16_t tag, uint16_t tag,
uint32_t value); uint32_t value);
int as10x_cmd_get_context(as10x_handle_t *phandle, int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap,
uint16_t tag, uint16_t tag,
uint32_t *pvalue); uint32_t *pvalue);
int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode); int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode);
int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id); int as10x_context_rsp_parse(struct as10x_cmd_t *prsp, uint16_t proc_id);
#endif #endif
...@@ -28,13 +28,13 @@ ...@@ -28,13 +28,13 @@
/** /**
* as10x_cmd_get_context - Send get context command to AS10x * as10x_cmd_get_context - Send get context command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @tag: context tag * @tag: context tag
* @pvalue: pointer where to store context value read * @pvalue: pointer where to store context value read
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, int as10x_cmd_get_context(struct as10x_bus_adapter_t *adap, uint16_t tag,
uint32_t *pvalue) uint32_t *pvalue)
{ {
int error; int error;
...@@ -42,11 +42,11 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -42,11 +42,11 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.context.req)); sizeof(pcmd->body.context.req));
/* fill command */ /* fill command */
...@@ -55,14 +55,14 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -55,14 +55,14 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA); pcmd->body.context.req.type = cpu_to_le16(GET_CONTEXT_DATA);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = adap->ops->xfer_cmd(adap,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.context.req) sizeof(pcmd->body.context.req)
+ HEADER_SIZE, + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.context.rsp) sizeof(prsp->body.context.rsp)
+ HEADER_SIZE); + HEADER_SIZE);
} else { } else {
error = AS10X_CMD_ERROR; error = AS10X_CMD_ERROR;
} }
...@@ -87,13 +87,13 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -87,13 +87,13 @@ int as10x_cmd_get_context(as10x_handle_t *phandle, uint16_t tag,
/** /**
* as10x_cmd_set_context - send set context command to AS10x * as10x_cmd_set_context - send set context command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @tag: context tag * @tag: context tag
* @value: value to set in context * @value: value to set in context
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, int as10x_cmd_set_context(struct as10x_bus_adapter_t *adap, uint16_t tag,
uint32_t value) uint32_t value)
{ {
int error; int error;
...@@ -101,11 +101,11 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -101,11 +101,11 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.context.req)); sizeof(pcmd->body.context.req));
/* fill command */ /* fill command */
...@@ -116,14 +116,14 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -116,14 +116,14 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA); pcmd->body.context.req.type = cpu_to_le16(SET_CONTEXT_DATA);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, error = adap->ops->xfer_cmd(adap,
(uint8_t *) pcmd, (uint8_t *) pcmd,
sizeof(pcmd->body.context.req) sizeof(pcmd->body.context.req)
+ HEADER_SIZE, + HEADER_SIZE,
(uint8_t *) prsp, (uint8_t *) prsp,
sizeof(prsp->body.context.rsp) sizeof(prsp->body.context.rsp)
+ HEADER_SIZE); + HEADER_SIZE);
} else { } else {
error = AS10X_CMD_ERROR; error = AS10X_CMD_ERROR;
} }
...@@ -142,7 +142,7 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -142,7 +142,7 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
/** /**
* as10x_cmd_eLNA_change_mode - send eLNA change mode command to AS10x * as10x_cmd_eLNA_change_mode - send eLNA change mode command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @mode: mode selected: * @mode: mode selected:
* - ON : 0x0 => eLNA always ON * - ON : 0x0 => eLNA always ON
* - OFF : 0x1 => eLNA always OFF * - OFF : 0x1 => eLNA always OFF
...@@ -151,18 +151,18 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag, ...@@ -151,18 +151,18 @@ int as10x_cmd_set_context(as10x_handle_t *phandle, uint16_t tag,
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) int as10x_cmd_eLNA_change_mode(struct as10x_bus_adapter_t *adap, uint8_t mode)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.cfg_change_mode.req)); sizeof(pcmd->body.cfg_change_mode.req));
/* fill command */ /* fill command */
...@@ -171,8 +171,8 @@ int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode) ...@@ -171,8 +171,8 @@ int as10x_cmd_eLNA_change_mode(as10x_handle_t *phandle, uint8_t mode)
pcmd->body.cfg_change_mode.req.mode = mode; pcmd->body.cfg_change_mode.req.mode = mode;
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
sizeof(pcmd->body.cfg_change_mode.req) sizeof(pcmd->body.cfg_change_mode.req)
+ HEADER_SIZE, (uint8_t *) prsp, + HEADER_SIZE, (uint8_t *) prsp,
sizeof(prsp->body.cfg_change_mode.rsp) sizeof(prsp->body.cfg_change_mode.rsp)
......
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
/** /**
* as10x_cmd_add_PID_filter - send add filter command to AS10x * as10x_cmd_add_PID_filter - send add filter command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* @filter: TSFilter filter for DVB-T * @filter: TSFilter filter for DVB-T
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, int as10x_cmd_add_PID_filter(struct as10x_bus_adapter_t *adap,
struct as10x_ts_filter *filter) struct as10x_ts_filter *filter)
{ {
int error; int error;
...@@ -36,11 +36,11 @@ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, ...@@ -36,11 +36,11 @@ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.add_pid_filter.req)); sizeof(pcmd->body.add_pid_filter.req));
/* fill command */ /* fill command */
...@@ -55,8 +55,8 @@ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, ...@@ -55,8 +55,8 @@ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
pcmd->body.add_pid_filter.req.idx = 0xFF; pcmd->body.add_pid_filter.req.idx = 0xFF;
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
sizeof(pcmd->body.add_pid_filter.req) sizeof(pcmd->body.add_pid_filter.req)
+ HEADER_SIZE, (uint8_t *) prsp, + HEADER_SIZE, (uint8_t *) prsp,
sizeof(prsp->body.add_pid_filter.rsp) sizeof(prsp->body.add_pid_filter.rsp)
...@@ -83,12 +83,12 @@ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle, ...@@ -83,12 +83,12 @@ int as10x_cmd_add_PID_filter(as10x_handle_t *phandle,
/** /**
* as10x_cmd_del_PID_filter - Send delete filter command to AS10x * as10x_cmd_del_PID_filter - Send delete filter command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapte
* @pid_value: PID to delete * @pid_value: PID to delete
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, int as10x_cmd_del_PID_filter(struct as10x_bus_adapter_t *adap,
uint16_t pid_value) uint16_t pid_value)
{ {
int error; int error;
...@@ -96,11 +96,11 @@ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, ...@@ -96,11 +96,11 @@ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.del_pid_filter.req)); sizeof(pcmd->body.del_pid_filter.req));
/* fill command */ /* fill command */
...@@ -109,8 +109,8 @@ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, ...@@ -109,8 +109,8 @@ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value); pcmd->body.del_pid_filter.req.pid = cpu_to_le16(pid_value);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
sizeof(pcmd->body.del_pid_filter.req) sizeof(pcmd->body.del_pid_filter.req)
+ HEADER_SIZE, (uint8_t *) prsp, + HEADER_SIZE, (uint8_t *) prsp,
sizeof(prsp->body.del_pid_filter.rsp) sizeof(prsp->body.del_pid_filter.rsp)
...@@ -132,22 +132,22 @@ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle, ...@@ -132,22 +132,22 @@ int as10x_cmd_del_PID_filter(as10x_handle_t *phandle,
/** /**
* as10x_cmd_start_streaming - Send start streaming command to AS10x * as10x_cmd_start_streaming - Send start streaming command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_start_streaming(as10x_handle_t *phandle) int as10x_cmd_start_streaming(struct as10x_bus_adapter_t *adap)
{ {
int error; int error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.start_streaming.req)); sizeof(pcmd->body.start_streaming.req));
/* fill command */ /* fill command */
...@@ -155,8 +155,8 @@ int as10x_cmd_start_streaming(as10x_handle_t *phandle) ...@@ -155,8 +155,8 @@ int as10x_cmd_start_streaming(as10x_handle_t *phandle)
cpu_to_le16(CONTROL_PROC_START_STREAMING); cpu_to_le16(CONTROL_PROC_START_STREAMING);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
sizeof(pcmd->body.start_streaming.req) sizeof(pcmd->body.start_streaming.req)
+ HEADER_SIZE, (uint8_t *) prsp, + HEADER_SIZE, (uint8_t *) prsp,
sizeof(prsp->body.start_streaming.rsp) sizeof(prsp->body.start_streaming.rsp)
...@@ -178,22 +178,22 @@ int as10x_cmd_start_streaming(as10x_handle_t *phandle) ...@@ -178,22 +178,22 @@ int as10x_cmd_start_streaming(as10x_handle_t *phandle)
/** /**
* as10x_cmd_stop_streaming - Send stop streaming command to AS10x * as10x_cmd_stop_streaming - Send stop streaming command to AS10x
* @phandle: pointer to AS10x handle * @adap: pointer to AS10x bus adapter
* *
* Return 0 on success or negative value in case of error. * Return 0 on success or negative value in case of error.
*/ */
int as10x_cmd_stop_streaming(as10x_handle_t *phandle) int as10x_cmd_stop_streaming(struct as10x_bus_adapter_t *adap)
{ {
int8_t error; int8_t error;
struct as10x_cmd_t *pcmd, *prsp; struct as10x_cmd_t *pcmd, *prsp;
ENTER(); ENTER();
pcmd = phandle->cmd; pcmd = adap->cmd;
prsp = phandle->rsp; prsp = adap->rsp;
/* prepare command */ /* prepare command */
as10x_cmd_build(pcmd, (++phandle->cmd_xid), as10x_cmd_build(pcmd, (++adap->cmd_xid),
sizeof(pcmd->body.stop_streaming.req)); sizeof(pcmd->body.stop_streaming.req));
/* fill command */ /* fill command */
...@@ -201,8 +201,8 @@ int as10x_cmd_stop_streaming(as10x_handle_t *phandle) ...@@ -201,8 +201,8 @@ int as10x_cmd_stop_streaming(as10x_handle_t *phandle)
cpu_to_le16(CONTROL_PROC_STOP_STREAMING); cpu_to_le16(CONTROL_PROC_STOP_STREAMING);
/* send command */ /* send command */
if (phandle->ops->xfer_cmd) { if (adap->ops->xfer_cmd) {
error = phandle->ops->xfer_cmd(phandle, (uint8_t *) pcmd, error = adap->ops->xfer_cmd(adap, (uint8_t *) pcmd,
sizeof(pcmd->body.stop_streaming.req) sizeof(pcmd->body.stop_streaming.req)
+ HEADER_SIZE, (uint8_t *) prsp, + HEADER_SIZE, (uint8_t *) prsp,
sizeof(prsp->body.stop_streaming.rsp) sizeof(prsp->body.stop_streaming.rsp)
......
...@@ -17,10 +17,9 @@ ...@@ -17,10 +17,9 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifdef __KERNEL__ #ifdef __KERNEL__
struct as102_bus_adapter_t; struct as10x_bus_adapter_t;
struct as102_dev_t; struct as102_dev_t;
#define as10x_handle_t struct as102_bus_adapter_t
#include "as10x_cmd.h" #include "as10x_cmd.h"
/* values for "mode" field */ /* values for "mode" field */
...@@ -29,29 +28,26 @@ struct as102_dev_t; ...@@ -29,29 +28,26 @@ struct as102_dev_t;
#define REGMODE32 32 #define REGMODE32 32
struct as102_priv_ops_t { struct as102_priv_ops_t {
int (*upload_fw_pkt) (struct as102_bus_adapter_t *bus_adap, int (*upload_fw_pkt) (struct as10x_bus_adapter_t *bus_adap,
unsigned char *buf, int buflen, int swap32); unsigned char *buf, int buflen, int swap32);
int (*send_cmd) (struct as102_bus_adapter_t *bus_adap, int (*send_cmd) (struct as10x_bus_adapter_t *bus_adap,
unsigned char *buf, int buflen); unsigned char *buf, int buflen);
int (*xfer_cmd) (struct as102_bus_adapter_t *bus_adap, int (*xfer_cmd) (struct as10x_bus_adapter_t *bus_adap,
unsigned char *send_buf, int send_buf_len, unsigned char *send_buf, int send_buf_len,
unsigned char *recv_buf, int recv_buf_len); unsigned char *recv_buf, int recv_buf_len);
/*
int (*pid_filter) (struct as102_bus_adapter_t *bus_adap,
int index, u16 pid, int onoff);
*/
int (*start_stream) (struct as102_dev_t *dev); int (*start_stream) (struct as102_dev_t *dev);
void (*stop_stream) (struct as102_dev_t *dev); void (*stop_stream) (struct as102_dev_t *dev);
int (*reset_target) (struct as102_bus_adapter_t *bus_adap); int (*reset_target) (struct as10x_bus_adapter_t *bus_adap);
int (*read_write)(struct as102_bus_adapter_t *bus_adap, uint8_t mode, int (*read_write)(struct as10x_bus_adapter_t *bus_adap, uint8_t mode,
uint32_t rd_addr, uint16_t rd_len, uint32_t rd_addr, uint16_t rd_len,
uint32_t wr_addr, uint16_t wr_len); uint32_t wr_addr, uint16_t wr_len);
int (*as102_read_ep2) (struct as102_bus_adapter_t *bus_adap, int (*as102_read_ep2) (struct as10x_bus_adapter_t *bus_adap,
unsigned char *recv_buf, unsigned char *recv_buf,
int recv_buf_len); int recv_buf_len);
}; };
......
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