Commit 9482354f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] drx-j: Use the Linux error codes

Instead of defining its own set of error codes, use the linux
native ones.

Please note that this patch made a "stupid" error code mapping, just
replacing the codes with the closest one. In special, -EIO is being
used on several places. I'm pretty sure this could be better assigned,
but a change like that would require lots o time and efforts, without
much benefit.

So lets do adjstments at the error codes latter, when we have more
time.
Acked-by: default avatarDevin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 63713517
...@@ -71,8 +71,8 @@ Exported FUNCTIONS ...@@ -71,8 +71,8 @@ Exported FUNCTIONS
* \fn drxbsp_i2c_init() * \fn drxbsp_i2c_init()
* \brief Initialize I2C communication module. * \brief Initialize I2C communication module.
* \return drx_status_t Return status. * \return drx_status_t Return status.
* \retval DRX_STS_OK Initialization successful. * \retval 0 Initialization successful.
* \retval DRX_STS_ERROR Initialization failed. * \retval -EIO Initialization failed.
*/ */
drx_status_t drxbsp_i2c_init(void); drx_status_t drxbsp_i2c_init(void);
...@@ -80,8 +80,8 @@ Exported FUNCTIONS ...@@ -80,8 +80,8 @@ Exported FUNCTIONS
* \fn drxbsp_i2c_term() * \fn drxbsp_i2c_term()
* \brief Terminate I2C communication module. * \brief Terminate I2C communication module.
* \return drx_status_t Return status. * \return drx_status_t Return status.
* \retval DRX_STS_OK Termination successful. * \retval 0 Termination successful.
* \retval DRX_STS_ERROR Termination failed. * \retval -EIO Termination failed.
*/ */
drx_status_t drxbsp_i2c_term(void); drx_status_t drxbsp_i2c_term(void);
...@@ -100,9 +100,9 @@ Exported FUNCTIONS ...@@ -100,9 +100,9 @@ Exported FUNCTIONS
* \param r_count The number of bytes to read * \param r_count The number of bytes to read
* \param r_data The array to read the data from * \param r_data The array to read the data from
* \return drx_status_t Return status. * \return drx_status_t Return status.
* \retval DRX_STS_OK Succes. * \retval 0 Succes.
* \retval DRX_STS_ERROR Failure. * \retval -EIO Failure.
* \retval DRX_STS_INVALID_ARG Parameter 'wcount' is not zero but parameter * \retval -EINVAL Parameter 'wcount' is not zero but parameter
* 'wdata' contains NULL. * 'wdata' contains NULL.
* Idem for 'rcount' and 'rdata'. * Idem for 'rcount' and 'rdata'.
* Both w_dev_addr and r_dev_addr are NULL. * Both w_dev_addr and r_dev_addr are NULL.
......
...@@ -43,7 +43,7 @@ static int drx39xxj_set_powerstate(struct dvb_frontend *fe, int enable) ...@@ -43,7 +43,7 @@ static int drx39xxj_set_powerstate(struct dvb_frontend *fe, int enable)
power_mode = DRX_POWER_DOWN; power_mode = DRX_POWER_DOWN;
result = drx_ctrl(demod, DRX_CTRL_POWER_MODE, &power_mode); result = drx_ctrl(demod, DRX_CTRL_POWER_MODE, &power_mode);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "Power state change failed\n"); printk(KERN_ERR "Power state change failed\n");
return 0; return 0;
} }
...@@ -62,7 +62,7 @@ static int drx39xxj_read_status(struct dvb_frontend *fe, fe_status_t *status) ...@@ -62,7 +62,7 @@ static int drx39xxj_read_status(struct dvb_frontend *fe, fe_status_t *status)
*status = 0; *status = 0;
result = drx_ctrl(demod, DRX_CTRL_LOCK_STATUS, &lock_status); result = drx_ctrl(demod, DRX_CTRL_LOCK_STATUS, &lock_status);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "drx39xxj: could not get lock status!\n"); printk(KERN_ERR "drx39xxj: could not get lock status!\n");
*status = 0; *status = 0;
} }
...@@ -107,7 +107,7 @@ static int drx39xxj_read_ber(struct dvb_frontend *fe, u32 *ber) ...@@ -107,7 +107,7 @@ static int drx39xxj_read_ber(struct dvb_frontend *fe, u32 *ber)
struct drx_sig_quality sig_quality; struct drx_sig_quality sig_quality;
result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality); result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "drx39xxj: could not get ber!\n"); printk(KERN_ERR "drx39xxj: could not get ber!\n");
*ber = 0; *ber = 0;
return 0; return 0;
...@@ -126,7 +126,7 @@ static int drx39xxj_read_signal_strength(struct dvb_frontend *fe, ...@@ -126,7 +126,7 @@ static int drx39xxj_read_signal_strength(struct dvb_frontend *fe,
struct drx_sig_quality sig_quality; struct drx_sig_quality sig_quality;
result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality); result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "drx39xxj: could not get signal strength!\n"); printk(KERN_ERR "drx39xxj: could not get signal strength!\n");
*strength = 0; *strength = 0;
return 0; return 0;
...@@ -145,7 +145,7 @@ static int drx39xxj_read_snr(struct dvb_frontend *fe, u16 *snr) ...@@ -145,7 +145,7 @@ static int drx39xxj_read_snr(struct dvb_frontend *fe, u16 *snr)
struct drx_sig_quality sig_quality; struct drx_sig_quality sig_quality;
result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality); result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "drx39xxj: could not read snr!\n"); printk(KERN_ERR "drx39xxj: could not read snr!\n");
*snr = 0; *snr = 0;
return 0; return 0;
...@@ -163,7 +163,7 @@ static int drx39xxj_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) ...@@ -163,7 +163,7 @@ static int drx39xxj_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
struct drx_sig_quality sig_quality; struct drx_sig_quality sig_quality;
result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality); result = drx_ctrl(demod, DRX_CTRL_SIG_QUALITY, &sig_quality);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "drx39xxj: could not get uc blocks!\n"); printk(KERN_ERR "drx39xxj: could not get uc blocks!\n");
*ucblocks = 0; *ucblocks = 0;
return 0; return 0;
...@@ -217,7 +217,7 @@ static int drx39xxj_set_frontend(struct dvb_frontend *fe) ...@@ -217,7 +217,7 @@ static int drx39xxj_set_frontend(struct dvb_frontend *fe)
if (standard != state->current_standard || state->powered_up == 0) { if (standard != state->current_standard || state->powered_up == 0) {
/* Set the standard (will be powered up if necessary */ /* Set the standard (will be powered up if necessary */
result = drx_ctrl(demod, DRX_CTRL_SET_STANDARD, &standard); result = drx_ctrl(demod, DRX_CTRL_SET_STANDARD, &standard);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "Failed to set standard! result=%02x\n", printk(KERN_ERR "Failed to set standard! result=%02x\n",
result); result);
return -EINVAL; return -EINVAL;
...@@ -234,7 +234,7 @@ static int drx39xxj_set_frontend(struct dvb_frontend *fe) ...@@ -234,7 +234,7 @@ static int drx39xxj_set_frontend(struct dvb_frontend *fe)
/* program channel */ /* program channel */
result = drx_ctrl(demod, DRX_CTRL_SET_CHANNEL, &channel); result = drx_ctrl(demod, DRX_CTRL_SET_CHANNEL, &channel);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "Failed to set channel!\n"); printk(KERN_ERR "Failed to set channel!\n");
return -EINVAL; return -EINVAL;
} }
...@@ -242,7 +242,7 @@ static int drx39xxj_set_frontend(struct dvb_frontend *fe) ...@@ -242,7 +242,7 @@ static int drx39xxj_set_frontend(struct dvb_frontend *fe)
uio_data.uio = DRX_UIO1; uio_data.uio = DRX_UIO1;
uio_data.value = false; uio_data.value = false;
result = drx_ctrl(demod, DRX_CTRL_UIO_WRITE, &uio_data); result = drx_ctrl(demod, DRX_CTRL_UIO_WRITE, &uio_data);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "Failed to disable LNA!\n"); printk(KERN_ERR "Failed to disable LNA!\n");
return 0; return 0;
} }
...@@ -288,7 +288,7 @@ static int drx39xxj_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) ...@@ -288,7 +288,7 @@ static int drx39xxj_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
} }
result = drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &i2c_gate_state); result = drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &i2c_gate_state);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "drx39xxj: could not open i2c gate [%d]\n", printk(KERN_ERR "drx39xxj: could not open i2c gate [%d]\n",
result); result);
dump_stack(); dump_stack();
...@@ -382,7 +382,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) ...@@ -382,7 +382,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
demod->my_tuner = NULL; demod->my_tuner = NULL;
result = drx_open(demod); result = drx_open(demod);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "DRX open failed! Aborting\n"); printk(KERN_ERR "DRX open failed! Aborting\n");
kfree(state); kfree(state);
return NULL; return NULL;
...@@ -393,7 +393,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) ...@@ -393,7 +393,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
uio_cfg.mode = DRX_UIO_MODE_READWRITE; uio_cfg.mode = DRX_UIO_MODE_READWRITE;
/* Configure user-I/O #3: enable read/write */ /* Configure user-I/O #3: enable read/write */
result = drx_ctrl(demod, DRX_CTRL_UIO_CFG, &uio_cfg); result = drx_ctrl(demod, DRX_CTRL_UIO_CFG, &uio_cfg);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "Failed to setup LNA GPIO!\n"); printk(KERN_ERR "Failed to setup LNA GPIO!\n");
return NULL; return NULL;
} }
...@@ -401,7 +401,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) ...@@ -401,7 +401,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
uio_data.uio = DRX_UIO1; uio_data.uio = DRX_UIO1;
uio_data.value = false; uio_data.value = false;
result = drx_ctrl(demod, DRX_CTRL_UIO_WRITE, &uio_data); result = drx_ctrl(demod, DRX_CTRL_UIO_WRITE, &uio_data);
if (result != DRX_STS_OK) { if (result != 0) {
printk(KERN_ERR "Failed to disable LNA!\n"); printk(KERN_ERR "Failed to disable LNA!\n");
return NULL; return NULL;
} }
......
...@@ -13,19 +13,19 @@ ...@@ -13,19 +13,19 @@
/* Dummy function to satisfy drxj.c */ /* Dummy function to satisfy drxj.c */
int drxbsp_tuner_open(struct tuner_instance *tuner) int drxbsp_tuner_open(struct tuner_instance *tuner)
{ {
return DRX_STS_OK; return 0;
} }
int drxbsp_tuner_close(struct tuner_instance *tuner) int drxbsp_tuner_close(struct tuner_instance *tuner)
{ {
return DRX_STS_OK; return 0;
} }
int drxbsp_tuner_set_frequency(struct tuner_instance *tuner, int drxbsp_tuner_set_frequency(struct tuner_instance *tuner,
u32 mode, u32 mode,
s32 center_frequency) s32 center_frequency)
{ {
return DRX_STS_OK; return 0;
} }
int int
...@@ -34,13 +34,13 @@ drxbsp_tuner_get_frequency(struct tuner_instance *tuner, ...@@ -34,13 +34,13 @@ drxbsp_tuner_get_frequency(struct tuner_instance *tuner,
s32 *r_ffrequency, s32 *r_ffrequency,
s32 *i_ffrequency) s32 *i_ffrequency)
{ {
return DRX_STS_OK; return 0;
} }
int drxbsp_hst_sleep(u32 n) int drxbsp_hst_sleep(u32 n)
{ {
msleep(n); msleep(n);
return DRX_STS_OK; return 0;
} }
u32 drxbsp_hst_clock(void) u32 drxbsp_hst_clock(void)
...@@ -107,7 +107,7 @@ int drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr, ...@@ -107,7 +107,7 @@ int drxbsp_i2c_write_read(struct i2c_device_addr *w_dev_addr,
return -EREMOTEIO; return -EREMOTEIO;
} }
return DRX_STS_OK; return 0;
#ifdef DJH_DEBUG #ifdef DJH_DEBUG
struct drx39xxj_state *state = w_dev_addr->user_data; struct drx39xxj_state *state = w_dev_addr->user_data;
......
...@@ -154,7 +154,7 @@ static int drxdap_fasi_write_reg8(struct i2c_device_addr *dev_addr, /* address o ...@@ -154,7 +154,7 @@ static int drxdap_fasi_write_reg8(struct i2c_device_addr *dev_addr, /* address o
u8 data, /* data to write */ u8 data, /* data to write */
u32 flags) u32 flags)
{ /* special device flags */ { /* special device flags */
return DRX_STS_ERROR; return -EIO;
} }
static int drxdap_fasi_read_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */ static int drxdap_fasi_read_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */
...@@ -162,7 +162,7 @@ static int drxdap_fasi_read_reg8(struct i2c_device_addr *dev_addr, /* address of ...@@ -162,7 +162,7 @@ static int drxdap_fasi_read_reg8(struct i2c_device_addr *dev_addr, /* address of
u8 *data, /* buffer to receive data */ u8 *data, /* buffer to receive data */
u32 flags) u32 flags)
{ /* special device flags */ { /* special device flags */
return DRX_STS_ERROR; return -EIO;
} }
static int drxdap_fasi_read_modify_write_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */ static int drxdap_fasi_read_modify_write_reg8(struct i2c_device_addr *dev_addr, /* address of I2C device */
...@@ -171,7 +171,7 @@ static int drxdap_fasi_read_modify_write_reg8(struct i2c_device_addr *dev_addr, ...@@ -171,7 +171,7 @@ static int drxdap_fasi_read_modify_write_reg8(struct i2c_device_addr *dev_addr,
u8 datain, /* data to send */ u8 datain, /* data to send */
u8 *dataout) u8 *dataout)
{ /* data to receive back */ { /* data to receive back */
return DRX_STS_ERROR; return -EIO;
} }
static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr, /* address of I2C device */ static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr, /* address of I2C device */
...@@ -180,7 +180,7 @@ static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr, ...@@ -180,7 +180,7 @@ static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr,
u32 datain, /* data to send */ u32 datain, /* data to send */
u32 *dataout) u32 *dataout)
{ /* data to receive back */ { /* data to receive back */
return DRX_STS_ERROR; return -EIO;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -204,9 +204,9 @@ static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr, ...@@ -204,9 +204,9 @@ static int drxdap_fasi_read_modify_write_reg32(struct i2c_device_addr *dev_addr,
* the target platform. * the target platform.
* *
* Output: * Output:
* - DRX_STS_OK if reading was successful * - 0 if reading was successful
* in that case: data read is in *data. * in that case: data read is in *data.
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
...@@ -222,7 +222,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, ...@@ -222,7 +222,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
/* Check parameters ******************************************************* */ /* Check parameters ******************************************************* */
if (dev_addr == NULL) { if (dev_addr == NULL) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) + overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) +
...@@ -233,7 +233,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, ...@@ -233,7 +233,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
DRXDAP_FASI_LONG_FORMAT(addr)) || DRXDAP_FASI_LONG_FORMAT(addr)) ||
(overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) || (overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) ||
((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1)) { ((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1)) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
/* ReadModifyWrite & mode flag bits are not allowed */ /* ReadModifyWrite & mode flag bits are not allowed */
...@@ -284,7 +284,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, ...@@ -284,7 +284,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
* No special action is needed for write chunks here. * No special action is needed for write chunks here.
*/ */
rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, 0, 0, 0); rc = drxbsp_i2c_write_read(dev_addr, bufx, buf, 0, 0, 0);
if (rc == DRX_STS_OK) if (rc == 0)
rc = drxbsp_i2c_write_read(0, 0, 0, dev_addr, todo, data); rc = drxbsp_i2c_write_read(0, 0, 0, dev_addr, todo, data);
#else #else
/* In multi master mode, do everything in one RW action */ /* In multi master mode, do everything in one RW action */
...@@ -294,7 +294,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, ...@@ -294,7 +294,7 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
data += todo; data += todo;
addr += (todo >> 1); addr += (todo >> 1);
datasize -= todo; datasize -= todo;
} while (datasize && rc == DRX_STS_OK); } while (datasize && rc == 0);
return rc; return rc;
} }
...@@ -318,9 +318,9 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr, ...@@ -318,9 +318,9 @@ static int drxdap_fasi_read_block(struct i2c_device_addr *dev_addr,
* master on the I2C bus. * master on the I2C bus.
* *
* Output: * Output:
* - DRX_STS_OK if reading was successful * - 0 if reading was successful
* in that case: read back data is at *rdata * in that case: read back data is at *rdata
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
...@@ -329,15 +329,15 @@ static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr, ...@@ -329,15 +329,15 @@ static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr,
u32 raddr, u32 raddr,
u16 wdata, u16 *rdata) u16 wdata, u16 *rdata)
{ {
int rc = DRX_STS_ERROR; int rc = -EIO;
#if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1) #if (DRXDAPFASI_LONG_ADDR_ALLOWED == 1)
if (rdata == NULL) { if (rdata == NULL) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
rc = drxdap_fasi_write_reg16(dev_addr, waddr, wdata, DRXDAP_FASI_RMW); rc = drxdap_fasi_write_reg16(dev_addr, waddr, wdata, DRXDAP_FASI_RMW);
if (rc == DRX_STS_OK) if (rc == 0)
rc = drxdap_fasi_read_reg16(dev_addr, raddr, rdata, 0); rc = drxdap_fasi_read_reg16(dev_addr, raddr, rdata, 0);
#endif #endif
...@@ -356,9 +356,9 @@ static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr, ...@@ -356,9 +356,9 @@ static int drxdap_fasi_read_modify_write_reg16(struct i2c_device_addr *dev_addr,
* converted back to the target platform's endianness. * converted back to the target platform's endianness.
* *
* Output: * Output:
* - DRX_STS_OK if reading was successful * - 0 if reading was successful
* in that case: read data is at *data * in that case: read data is at *data
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
...@@ -370,7 +370,7 @@ static int drxdap_fasi_read_reg16(struct i2c_device_addr *dev_addr, ...@@ -370,7 +370,7 @@ static int drxdap_fasi_read_reg16(struct i2c_device_addr *dev_addr,
int rc; int rc;
if (!data) { if (!data) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
rc = drxdap_fasi_read_block(dev_addr, addr, sizeof(*data), buf, flags); rc = drxdap_fasi_read_block(dev_addr, addr, sizeof(*data), buf, flags);
*data = buf[0] + (((u16) buf[1]) << 8); *data = buf[0] + (((u16) buf[1]) << 8);
...@@ -389,9 +389,9 @@ static int drxdap_fasi_read_reg16(struct i2c_device_addr *dev_addr, ...@@ -389,9 +389,9 @@ static int drxdap_fasi_read_reg16(struct i2c_device_addr *dev_addr,
* converted back to the target platform's endianness. * converted back to the target platform's endianness.
* *
* Output: * Output:
* - DRX_STS_OK if reading was successful * - 0 if reading was successful
* in that case: read data is at *data * in that case: read data is at *data
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
...@@ -403,7 +403,7 @@ static int drxdap_fasi_read_reg32(struct i2c_device_addr *dev_addr, ...@@ -403,7 +403,7 @@ static int drxdap_fasi_read_reg32(struct i2c_device_addr *dev_addr,
int rc; int rc;
if (!data) { if (!data) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
rc = drxdap_fasi_read_block(dev_addr, addr, sizeof(*data), buf, flags); rc = drxdap_fasi_read_block(dev_addr, addr, sizeof(*data), buf, flags);
*data = (((u32) buf[0]) << 0) + *data = (((u32) buf[0]) << 0) +
...@@ -429,8 +429,8 @@ static int drxdap_fasi_read_reg32(struct i2c_device_addr *dev_addr, ...@@ -429,8 +429,8 @@ static int drxdap_fasi_read_reg32(struct i2c_device_addr *dev_addr,
* the target platform. * the target platform.
* *
* Output: * Output:
* - DRX_STS_OK if writing was successful * - 0 if writing was successful
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
...@@ -440,14 +440,14 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, ...@@ -440,14 +440,14 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
u8 *data, u32 flags) u8 *data, u32 flags)
{ {
u8 buf[DRXDAP_MAX_WCHUNKSIZE]; u8 buf[DRXDAP_MAX_WCHUNKSIZE];
int st = DRX_STS_ERROR; int st = -EIO;
int first_err = DRX_STS_OK; int first_err = 0;
u16 overhead_size = 0; u16 overhead_size = 0;
u16 block_size = 0; u16 block_size = 0;
/* Check parameters ******************************************************* */ /* Check parameters ******************************************************* */
if (dev_addr == NULL) { if (dev_addr == NULL) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) + overhead_size = (IS_I2C_10BIT(dev_addr->i2c_addr) ? 2 : 1) +
...@@ -458,7 +458,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, ...@@ -458,7 +458,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
DRXDAP_FASI_LONG_FORMAT(addr)) || DRXDAP_FASI_LONG_FORMAT(addr)) ||
(overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) || (overhead_size > (DRXDAP_MAX_WCHUNKSIZE)) ||
((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1)) { ((datasize != 0) && (data == NULL)) || ((datasize & 1) == 1)) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
flags &= DRXDAP_FASI_FLAGS; flags &= DRXDAP_FASI_FLAGS;
...@@ -527,7 +527,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, ...@@ -527,7 +527,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
(struct i2c_device_addr *)(NULL), (struct i2c_device_addr *)(NULL),
0, (u8 *)(NULL)); 0, (u8 *)(NULL));
if ((st != DRX_STS_OK) && (first_err == DRX_STS_OK)) { if ((st != 0) && (first_err == 0)) {
/* at the end, return the first error encountered */ /* at the end, return the first error encountered */
first_err = st; first_err = st;
} }
...@@ -544,7 +544,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, ...@@ -544,7 +544,7 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
(struct i2c_device_addr *)(NULL), (struct i2c_device_addr *)(NULL),
0, (u8 *)(NULL)); 0, (u8 *)(NULL));
if ((st != DRX_STS_OK) && (first_err == DRX_STS_OK)) { if ((st != 0) && (first_err == 0)) {
/* at the end, return the first error encountered */ /* at the end, return the first error encountered */
first_err = st; first_err = st;
} }
...@@ -568,8 +568,8 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr, ...@@ -568,8 +568,8 @@ static int drxdap_fasi_write_block(struct i2c_device_addr *dev_addr,
* converted from the target platform's endianness to little endian. * converted from the target platform's endianness to little endian.
* *
* Output: * Output:
* - DRX_STS_OK if writing was successful * - 0 if writing was successful
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
...@@ -597,8 +597,8 @@ static int drxdap_fasi_write_reg16(struct i2c_device_addr *dev_addr, ...@@ -597,8 +597,8 @@ static int drxdap_fasi_write_reg16(struct i2c_device_addr *dev_addr,
* converted from the target platform's endianness to little endian. * converted from the target platform's endianness to little endian.
* *
* Output: * Output:
* - DRX_STS_OK if writing was successful * - 0 if writing was successful
* - DRX_STS_ERROR if anything went wrong * - -EIO if anything went wrong
* *
******************************/ ******************************/
......
...@@ -197,8 +197,8 @@ static void *get_scan_context(struct drx_demod_instance *demod, void *scan_conte ...@@ -197,8 +197,8 @@ static void *get_scan_context(struct drx_demod_instance *demod, void *scan_conte
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \param lock_stat: Pointer to bool indicating if end result is lock or not. * \param lock_stat: Pointer to bool indicating if end result is lock or not.
* \return int. * \return int.
* \retval DRX_STS_OK: Success * \retval 0: Success
* \retval DRX_STS_ERROR: I2C failure or bsp function failure. * \retval -EIO: I2C failure or bsp function failure.
* *
* Wait until timeout, desired lock or NEVER_LOCK. * Wait until timeout, desired lock or NEVER_LOCK.
* Assume: * Assume:
...@@ -229,8 +229,8 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked) ...@@ -229,8 +229,8 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked)
while (!done_waiting) { while (!done_waiting) {
if (drx_ctrl(demod, DRX_CTRL_LOCK_STATUS, &lock_state) != if (drx_ctrl(demod, DRX_CTRL_LOCK_STATUS, &lock_state) !=
DRX_STS_OK) { 0) {
return DRX_STS_ERROR; return -EIO;
} }
current_time = drxbsp_hst_clock(); current_time = drxbsp_hst_clock();
...@@ -246,14 +246,14 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked) ...@@ -246,14 +246,14 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked)
/* lock_state == DRX_NOT_LOCKED and timeout */ /* lock_state == DRX_NOT_LOCKED and timeout */
done_waiting = true; done_waiting = true;
} else { } else {
if (drxbsp_hst_sleep(10) != DRX_STS_OK) { if (drxbsp_hst_sleep(10) != 0) {
return DRX_STS_ERROR; return -EIO;
} }
} /* if ( timer_value > timeout_value ) .. */ } /* if ( timer_value > timeout_value ) .. */
} /* while */ } /* while */
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -263,8 +263,8 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked) ...@@ -263,8 +263,8 @@ static int scan_wait_for_lock(struct drx_demod_instance *demod, bool *is_locked)
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \param skip : Minimum frequency step to take. * \param skip : Minimum frequency step to take.
* \return int. * \return int.
* \retval DRX_STS_OK: Succes. * \retval 0: Succes.
* \retval DRX_STS_INVALID_ARG: Invalid frequency plan. * \retval -EINVAL: Invalid frequency plan.
* *
* Helper function for ctrl_scan_next() function. * Helper function for ctrl_scan_next() function.
* Compute next frequency & index in frequency plan. * Compute next frequency & index in frequency plan.
...@@ -331,7 +331,7 @@ scan_prepare_next_scan(struct drx_demod_instance *demod, s32 skip) ...@@ -331,7 +331,7 @@ scan_prepare_next_scan(struct drx_demod_instance *demod, s32 skip)
common_attr->scan_freq_plan_index = table_index; common_attr->scan_freq_plan_index = table_index;
common_attr->scan_next_frequency = next_frequency; common_attr->scan_next_frequency = next_frequency;
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -345,10 +345,10 @@ scan_prepare_next_scan(struct drx_demod_instance *demod, s32 skip) ...@@ -345,10 +345,10 @@ scan_prepare_next_scan(struct drx_demod_instance *demod, s32 skip)
* \param get_next_channel: Return true if next frequency is desired at next call * \param get_next_channel: Return true if next frequency is desired at next call
* *
* \return int. * \return int.
* \retval DRX_STS_OK: Channel found, DRX_CTRL_GET_CHANNEL can be used * \retval 0: Channel found, DRX_CTRL_GET_CHANNEL can be used
* to retrieve channel parameters. * to retrieve channel parameters.
* \retval DRX_STS_BUSY: Channel not found (yet). * \retval -EBUSY: Channel not found (yet).
* \retval DRX_STS_ERROR: Something went wrong. * \retval -EIO: Something went wrong.
* *
* scan_channel and get_next_channel will be NULL for INIT and STOP. * scan_channel and get_next_channel will be NULL for INIT and STOP.
*/ */
...@@ -358,25 +358,25 @@ scan_function_default(void *scan_context, ...@@ -358,25 +358,25 @@ scan_function_default(void *scan_context,
struct drx_channel *scan_channel, bool *get_next_channel) struct drx_channel *scan_channel, bool *get_next_channel)
{ {
struct drx_demod_instance *demod = NULL; struct drx_demod_instance *demod = NULL;
int status = DRX_STS_ERROR; int status = -EIO;
bool is_locked = false; bool is_locked = false;
demod = (struct drx_demod_instance *) scan_context; demod = (struct drx_demod_instance *) scan_context;
if (scan_command != DRX_SCAN_COMMAND_NEXT) { if (scan_command != DRX_SCAN_COMMAND_NEXT) {
/* just return OK if not doing "scan next" */ /* just return OK if not doing "scan next" */
return DRX_STS_OK; return 0;
} }
*get_next_channel = false; *get_next_channel = false;
status = drx_ctrl(demod, DRX_CTRL_SET_CHANNEL, scan_channel); status = drx_ctrl(demod, DRX_CTRL_SET_CHANNEL, scan_channel);
if (status != DRX_STS_OK) { if (status != 0) {
return status; return status;
} }
status = scan_wait_for_lock(demod, &is_locked); status = scan_wait_for_lock(demod, &is_locked);
if (status != DRX_STS_OK) { if (status != 0) {
return status; return status;
} }
...@@ -385,10 +385,10 @@ scan_function_default(void *scan_context, ...@@ -385,10 +385,10 @@ scan_function_default(void *scan_context,
if (!is_locked) { if (!is_locked) {
/* no channel found */ /* no channel found */
return DRX_STS_BUSY; return -EBUSY;
} }
/* channel found */ /* channel found */
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -398,10 +398,10 @@ scan_function_default(void *scan_context, ...@@ -398,10 +398,10 @@ scan_function_default(void *scan_context,
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \param scan_param: Pointer to scan parameters. * \param scan_param: Pointer to scan parameters.
* \return int. * \return int.
* \retval DRX_STS_OK: Initialized for scan. * \retval 0: Initialized for scan.
* \retval DRX_STS_ERROR: No overlap between frequency plan and tuner * \retval -EIO: No overlap between frequency plan and tuner
* range. * range.
* \retval DRX_STS_INVALID_ARG: Wrong parameters. * \retval -EINVAL: Wrong parameters.
* *
* This function should be called before starting a complete channel scan. * This function should be called before starting a complete channel scan.
* It will prepare everything for a complete channel scan. * It will prepare everything for a complete channel scan.
...@@ -413,7 +413,6 @@ scan_function_default(void *scan_context, ...@@ -413,7 +413,6 @@ scan_function_default(void *scan_context,
static int static int
ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_param) ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_param)
{ {
int status = DRX_STS_ERROR;
struct drx_common_attr *common_attr = (struct drx_common_attr *) (NULL); struct drx_common_attr *common_attr = (struct drx_common_attr *) (NULL);
s32 max_tuner_freq = 0; s32 max_tuner_freq = 0;
s32 min_tuner_freq = 0; s32 min_tuner_freq = 0;
...@@ -437,7 +436,7 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par ...@@ -437,7 +436,7 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par
(scan_param->frequency_plan_size == 0) (scan_param->frequency_plan_size == 0)
) { ) {
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
/* Check frequency plan contents */ /* Check frequency plan contents */
...@@ -454,13 +453,13 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par ...@@ -454,13 +453,13 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par
if (step <= 0) { if (step <= 0) {
/* Step must be positive and non-zero */ /* Step must be positive and non-zero */
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
if (first_freq > last_freq) { if (first_freq > last_freq) {
/* First center frequency is higher than last center frequency */ /* First center frequency is higher than last center frequency */
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
width = last_freq - first_freq; width = last_freq - first_freq;
...@@ -469,7 +468,7 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par ...@@ -469,7 +468,7 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par
/* Difference between last and first center frequency is not /* Difference between last and first center frequency is not
an integer number of steps */ an integer number of steps */
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
/* Check if frequency plan entry intersects with tuner range */ /* Check if frequency plan entry intersects with tuner range */
...@@ -517,7 +516,7 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par ...@@ -517,7 +516,7 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par
if (nr_channels_in_plan == 0) { if (nr_channels_in_plan == 0) {
/* Tuner range and frequency plan ranges do not overlap */ /* Tuner range and frequency plan ranges do not overlap */
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_ERROR; return -EIO;
} }
/* Store parameters */ /* Store parameters */
...@@ -528,12 +527,14 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par ...@@ -528,12 +527,14 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par
scan_context = get_scan_context(demod, scan_context); scan_context = get_scan_context(demod, scan_context);
status = (*(get_scan_function(demod))) /*
(scan_context, DRX_SCAN_COMMAND_INIT, NULL, NULL); * FIXME: Should we really ignore the result of the scan function?
*/
(*(get_scan_function(demod)))(scan_context, DRX_SCAN_COMMAND_INIT, NULL, NULL);
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -542,13 +543,13 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par ...@@ -542,13 +543,13 @@ ctrl_scan_init(struct drx_demod_instance *demod, struct drx_scan_param *scan_par
* \brief Stop scanning. * \brief Stop scanning.
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \return int. * \return int.
* \retval DRX_STS_OK: Scan stopped. * \retval 0: Scan stopped.
* \retval DRX_STS_ERROR: Something went wrong. * \retval -EIO: Something went wrong.
* \retval DRX_STS_INVALID_ARG: Wrong parameters. * \retval -EINVAL: Wrong parameters.
*/ */
static int ctrl_scan_stop(struct drx_demod_instance *demod) static int ctrl_scan_stop(struct drx_demod_instance *demod)
{ {
int status = DRX_STS_ERROR; int status = -EIO;
struct drx_common_attr *common_attr = (struct drx_common_attr *) (NULL); struct drx_common_attr *common_attr = (struct drx_common_attr *) (NULL);
void *scan_context = NULL; void *scan_context = NULL;
...@@ -559,7 +560,7 @@ static int ctrl_scan_stop(struct drx_demod_instance *demod) ...@@ -559,7 +560,7 @@ static int ctrl_scan_stop(struct drx_demod_instance *demod)
(common_attr->scan_max_channels == 0)) { (common_attr->scan_max_channels == 0)) {
/* Scan was not running, just return OK */ /* Scan was not running, just return OK */
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_OK; return 0;
} }
/* Call default or device-specific scanning stop function */ /* Call default or device-specific scanning stop function */
...@@ -583,15 +584,15 @@ static int ctrl_scan_stop(struct drx_demod_instance *demod) ...@@ -583,15 +584,15 @@ static int ctrl_scan_stop(struct drx_demod_instance *demod)
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \param scan_progress: Pointer to scan progress. * \param scan_progress: Pointer to scan progress.
* \return int. * \return int.
* \retval DRX_STS_OK: Channel found, DRX_CTRL_GET_CHANNEL can be used * \retval 0: Channel found, DRX_CTRL_GET_CHANNEL can be used
* to retrieve channel parameters. * to retrieve channel parameters.
* \retval DRX_STS_BUSY: Tried part of the channels, as specified in * \retval -EBUSY: Tried part of the channels, as specified in
* num_tries field of scan parameters. At least one * num_tries field of scan parameters. At least one
* more call to DRX_CTRL_SCAN_NEXT is needed to * more call to DRX_CTRL_SCAN_NEXT is needed to
* complete scanning. * complete scanning.
* \retval DRX_STS_READY: Reached end of scan range. * \retval -ERANGE: Reached end of scan range.
* \retval DRX_STS_ERROR: Something went wrong. * \retval -EIO: Something went wrong.
* \retval DRX_STS_INVALID_ARG: Wrong parameters. The scan_progress may be NULL. * \retval -EINVAL: Wrong parameters. The scan_progress may be NULL.
* *
* Progress indication will run from 0 upto DRX_SCAN_MAX_PROGRESS during scan. * Progress indication will run from 0 upto DRX_SCAN_MAX_PROGRESS during scan.
* *
...@@ -609,7 +610,7 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -609,7 +610,7 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
/* Check scan parameters */ /* Check scan parameters */
if (scan_progress == NULL) { if (scan_progress == NULL) {
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
*scan_progress = 0; *scan_progress = 0;
...@@ -618,7 +619,7 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -618,7 +619,7 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
(common_attr->scan_max_channels == 0)) { (common_attr->scan_max_channels == 0)) {
/* ctrl_scan_init() was not called succesfully before ctrl_scan_next() */ /* ctrl_scan_init() was not called succesfully before ctrl_scan_next() */
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_ERROR; return -EIO;
} }
*scan_progress = (u16) (((common_attr->scan_channels_scanned) * *scan_progress = (u16) (((common_attr->scan_channels_scanned) *
...@@ -631,7 +632,7 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -631,7 +632,7 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
for (i = 0; ((i < num_tries) && (!(*scan_ready))); i++) { for (i = 0; ((i < num_tries) && (!(*scan_ready))); i++) {
struct drx_channel scan_channel = { 0 }; struct drx_channel scan_channel = { 0 };
int status = DRX_STS_ERROR; int status = -EIO;
struct drx_frequency_plan *freq_plan = (struct drx_frequency_plan *) (NULL); struct drx_frequency_plan *freq_plan = (struct drx_frequency_plan *) (NULL);
bool next_channel = false; bool next_channel = false;
void *scan_context = NULL; void *scan_context = NULL;
...@@ -666,10 +667,10 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -666,10 +667,10 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
/* Proceed to next channel if requested */ /* Proceed to next channel if requested */
if (next_channel) { if (next_channel) {
int next_status = DRX_STS_ERROR; int next_status = -EIO;
s32 skip = 0; s32 skip = 0;
if (status == DRX_STS_OK) { if (status == 0) {
/* a channel was found, so skip some frequency steps */ /* a channel was found, so skip some frequency steps */
skip = common_attr->scan_param->skip; skip = common_attr->scan_param->skip;
} }
...@@ -681,12 +682,12 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -681,12 +682,12 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
((u32) (max_progress))) / ((u32) (max_progress))) /
(common_attr->scan_max_channels)); (common_attr->scan_max_channels));
if (next_status != DRX_STS_OK) { if (next_status != 0) {
common_attr->scan_active = false; common_attr->scan_active = false;
return next_status; return next_status;
} }
} }
if (status != DRX_STS_BUSY) { if (status != -EBUSY) {
/* channel found or error */ /* channel found or error */
common_attr->scan_active = false; common_attr->scan_active = false;
return status; return status;
...@@ -697,12 +698,12 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -697,12 +698,12 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
/* End of scan reached: call stop-scan, ignore any error */ /* End of scan reached: call stop-scan, ignore any error */
ctrl_scan_stop(demod); ctrl_scan_stop(demod);
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_READY; return -ERANGE;
} }
common_attr->scan_active = false; common_attr->scan_active = false;
return DRX_STS_BUSY; return -EBUSY;
} }
#endif /* #ifndef DRX_EXCLUDE_SCAN */ #endif /* #ifndef DRX_EXCLUDE_SCAN */
...@@ -714,9 +715,9 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress) ...@@ -714,9 +715,9 @@ static int ctrl_scan_next(struct drx_demod_instance *demod, u16 *scan_progress)
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \param tunerChannel: Pointer to tuning parameters. * \param tunerChannel: Pointer to tuning parameters.
* \return int. * \return int.
* \retval DRX_STS_OK: Tuner programmed successfully. * \retval 0: Tuner programmed successfully.
* \retval DRX_STS_ERROR: Something went wrong. * \retval -EIO: Something went wrong.
* \retval DRX_STS_INVALID_ARG: Wrong parameters. * \retval -EINVAL: Wrong parameters.
* *
* tunerChannel passes parameters to program the tuner, * tunerChannel passes parameters to program the tuner,
* but also returns the actual RF and IF frequency from the tuner. * but also returns the actual RF and IF frequency from the tuner.
...@@ -728,20 +729,20 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -728,20 +729,20 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
struct drx_common_attr *common_attr = (struct drx_common_attr *) (NULL); struct drx_common_attr *common_attr = (struct drx_common_attr *) (NULL);
enum drx_standard standard = DRX_STANDARD_UNKNOWN; enum drx_standard standard = DRX_STANDARD_UNKNOWN;
u32 tuner_mode = 0; u32 tuner_mode = 0;
int status = DRX_STS_ERROR; int status = -EIO;
s32 if_frequency = 0; s32 if_frequency = 0;
bool tuner_slow_mode = false; bool tuner_slow_mode = false;
/* can't tune without a tuner */ /* can't tune without a tuner */
if (demod->my_tuner == NULL) { if (demod->my_tuner == NULL) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
common_attr = (struct drx_common_attr *) demod->my_common_attr; common_attr = (struct drx_common_attr *) demod->my_common_attr;
/* select analog or digital tuner mode based on current standard */ /* select analog or digital tuner mode based on current standard */
if (drx_ctrl(demod, DRX_CTRL_GET_STANDARD, &standard) != DRX_STS_OK) { if (drx_ctrl(demod, DRX_CTRL_GET_STANDARD, &standard) != 0) {
return DRX_STS_ERROR; return -EIO;
} }
if (DRX_ISATVSTD(standard)) { if (DRX_ISATVSTD(standard)) {
...@@ -763,7 +764,7 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -763,7 +764,7 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
tuner_mode |= TUNER_MODE_8MHZ; tuner_mode |= TUNER_MODE_8MHZ;
break; break;
default: /* note: also for unknown bandwidth */ default: /* note: also for unknown bandwidth */
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
DRX_GET_TUNERSLOWMODE(demod, tuner_slow_mode); DRX_GET_TUNERSLOWMODE(demod, tuner_slow_mode);
...@@ -777,11 +778,11 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -777,11 +778,11 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
if (common_attr->tuner_port_nr == 1) { if (common_attr->tuner_port_nr == 1) {
bool bridge_closed = true; bool bridge_closed = true;
int status_bridge = DRX_STS_ERROR; int status_bridge = -EIO;
status_bridge = status_bridge =
drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &bridge_closed); drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &bridge_closed);
if (status_bridge != DRX_STS_OK) { if (status_bridge != 0) {
return status_bridge; return status_bridge;
} }
} }
...@@ -792,17 +793,17 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -792,17 +793,17 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
/* attempt restoring bridge before checking status of set_frequency */ /* attempt restoring bridge before checking status of set_frequency */
if (common_attr->tuner_port_nr == 1) { if (common_attr->tuner_port_nr == 1) {
bool bridge_closed = false; bool bridge_closed = false;
int status_bridge = DRX_STS_ERROR; int status_bridge = -EIO;
status_bridge = status_bridge =
drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &bridge_closed); drx_ctrl(demod, DRX_CTRL_I2C_BRIDGE, &bridge_closed);
if (status_bridge != DRX_STS_OK) { if (status_bridge != 0) {
return status_bridge; return status_bridge;
} }
} }
/* now check status of drxbsp_tuner_set_frequency */ /* now check status of drxbsp_tuner_set_frequency */
if (status != DRX_STS_OK) { if (status != 0) {
return status; return status;
} }
...@@ -811,7 +812,7 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -811,7 +812,7 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
tuner_mode, tuner_mode,
&(channel->frequency), &(channel->frequency),
&(if_frequency)); &(if_frequency));
if (status != DRX_STS_OK) { if (status != 0) {
return status; return status;
} }
...@@ -819,7 +820,7 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -819,7 +820,7 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
TODO: check if this is required and safe */ TODO: check if this is required and safe */
DRX_SET_INTERMEDIATEFREQ(demod, if_frequency); DRX_SET_INTERMEDIATEFREQ(demod, if_frequency);
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -829,9 +830,9 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel ...@@ -829,9 +830,9 @@ ctrl_program_tuner(struct drx_demod_instance *demod, struct drx_channel *channel
* \param demod: Pointer to demodulator instance. * \param demod: Pointer to demodulator instance.
* \param registers: Registers to dump. * \param registers: Registers to dump.
* \return int. * \return int.
* \retval DRX_STS_OK: Dump executed successfully. * \retval 0: Dump executed successfully.
* \retval DRX_STS_ERROR: Something went wrong. * \retval -EIO: Something went wrong.
* \retval DRX_STS_INVALID_ARG: Wrong parameters. * \retval -EINVAL: Wrong parameters.
* *
*/ */
static int ctrl_dump_registers(struct drx_demod_instance *demod, static int ctrl_dump_registers(struct drx_demod_instance *demod,
...@@ -841,12 +842,12 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod, ...@@ -841,12 +842,12 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod,
if (registers == NULL) { if (registers == NULL) {
/* registers not supplied */ /* registers not supplied */
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
/* start dumping registers */ /* start dumping registers */
while (registers[i].address != 0) { while (registers[i].address != 0) {
int status = DRX_STS_ERROR; int status = -EIO;
u16 value = 0; u16 value = 0;
u32 data = 0; u32 data = 0;
...@@ -857,7 +858,7 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod, ...@@ -857,7 +858,7 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod,
data = (u32) value; data = (u32) value;
if (status != DRX_STS_OK) { if (status != 0) {
/* no breakouts; /* no breakouts;
depending on device ID, some HW blocks might not be available */ depending on device ID, some HW blocks might not be available */
data |= ((u32) status) << 16; data |= ((u32) status) << 16;
...@@ -867,7 +868,7 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod, ...@@ -867,7 +868,7 @@ static int ctrl_dump_registers(struct drx_demod_instance *demod,
} }
/* all done, all OK (any errors are saved inside data) */ /* all done, all OK (any errors are saved inside data) */
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -963,15 +964,15 @@ static u16 u_code_compute_crc(u8 *block_data, u16 nr_words) ...@@ -963,15 +964,15 @@ static u16 u_code_compute_crc(u8 *block_data, u16 nr_words)
* \param mc_info: Pointer to information about microcode data. * \param mc_info: Pointer to information about microcode data.
* \param action: Either UCODE_UPLOAD or UCODE_VERIFY * \param action: Either UCODE_UPLOAD or UCODE_VERIFY
* \return int. * \return int.
* \retval DRX_STS_OK: * \retval 0:
* - In case of UCODE_UPLOAD: code is successfully uploaded. * - In case of UCODE_UPLOAD: code is successfully uploaded.
* - In case of UCODE_VERIFY: image on device is equal to * - In case of UCODE_VERIFY: image on device is equal to
* image provided to this control function. * image provided to this control function.
* \retval DRX_STS_ERROR: * \retval -EIO:
* - In case of UCODE_UPLOAD: I2C error. * - In case of UCODE_UPLOAD: I2C error.
* - In case of UCODE_VERIFY: I2C error or image on device * - In case of UCODE_VERIFY: I2C error or image on device
* is not equal to image provided to this control function. * is not equal to image provided to this control function.
* \retval DRX_STS_INVALID_ARG: * \retval -EINVAL:
* - Invalid arguments. * - Invalid arguments.
* - Provided image is corrupt * - Provided image is corrupt
*/ */
...@@ -990,7 +991,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -990,7 +991,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
/* Check arguments */ /* Check arguments */
if ((mc_info == NULL) || (mc_info->mc_data == NULL)) { if ((mc_info == NULL) || (mc_info->mc_data == NULL)) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
mc_data = mc_info->mc_data; mc_data = mc_info->mc_data;
...@@ -1003,7 +1004,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1003,7 +1004,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
if ((mc_magic_word != DRX_UCODE_MAGIC_WORD) || (mc_nr_of_blks == 0)) { if ((mc_magic_word != DRX_UCODE_MAGIC_WORD) || (mc_nr_of_blks == 0)) {
/* wrong endianess or wrong data ? */ /* wrong endianess or wrong data ? */
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
/* Scan microcode blocks first for version info if uploading */ /* Scan microcode blocks first for version info if uploading */
...@@ -1053,7 +1054,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1053,7 +1054,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
It is also valid if no validation control exists. It is also valid if no validation control exists.
*/ */
rc = drx_ctrl(demod, DRX_CTRL_VALIDATE_UCODE, NULL); rc = drx_ctrl(demod, DRX_CTRL_VALIDATE_UCODE, NULL);
if (rc != DRX_STS_OK && rc != DRX_STS_FUNC_NOT_AVAILABLE) { if (rc != 0 && rc != -ENOTSUPP) {
return rc; return rc;
} }
...@@ -1085,7 +1086,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1085,7 +1086,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
(block_hdr.CRC != u_code_compute_crc(mc_data, block_hdr.size))) (block_hdr.CRC != u_code_compute_crc(mc_data, block_hdr.size)))
) { ) {
/* Wrong data ! */ /* Wrong data ! */
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
mc_block_nr_bytes = block_hdr.size * ((u16) sizeof(u16)); mc_block_nr_bytes = block_hdr.size * ((u16) sizeof(u16));
...@@ -1103,8 +1104,8 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1103,8 +1104,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
addr, mc_block_nr_bytes, addr, mc_block_nr_bytes,
mc_data, mc_data,
0x0000) != 0x0000) !=
DRX_STS_OK) { 0) {
return DRX_STS_ERROR; return -EIO;
} /* if */ } /* if */
} }
break; break;
...@@ -1144,8 +1145,8 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1144,8 +1145,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
(u8 *) (u8 *)
mc_data_buffer, mc_data_buffer,
0x0000) != 0x0000) !=
DRX_STS_OK) { 0) {
return DRX_STS_ERROR; return -EIO;
} }
result = result =
...@@ -1154,7 +1155,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1154,7 +1155,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
bytes_to_compare); bytes_to_compare);
if (result != 0) { if (result != 0) {
return DRX_STS_ERROR; return -EIO;
} }
curr_addr += curr_addr +=
...@@ -1170,7 +1171,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1170,7 +1171,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
/*================================================================*/ /*================================================================*/
default: default:
return DRX_STS_INVALID_ARG; return -EINVAL;
break; break;
} /* switch ( action ) */ } /* switch ( action ) */
...@@ -1182,7 +1183,7 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1182,7 +1183,7 @@ ctrl_u_code(struct drx_demod_instance *demod,
} /* for( i = 0 ; i<mc_nr_of_blks ; i++ ) */ } /* for( i = 0 ; i<mc_nr_of_blks ; i++ ) */
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -1192,8 +1193,8 @@ ctrl_u_code(struct drx_demod_instance *demod, ...@@ -1192,8 +1193,8 @@ ctrl_u_code(struct drx_demod_instance *demod,
* \param demod: A pointer to a demodulator instance. * \param demod: A pointer to a demodulator instance.
* \param version_list: Pointer to linked list of versions. * \param version_list: Pointer to linked list of versions.
* \return int. * \return int.
* \retval DRX_STS_OK: Version information stored in version_list * \retval 0: Version information stored in version_list
* \retval DRX_STS_INVALID_ARG: Invalid arguments. * \retval -EINVAL: Invalid arguments.
*/ */
static int static int
ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version_list) ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version_list)
...@@ -1206,11 +1207,11 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version ...@@ -1206,11 +1207,11 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
static struct drx_version_list drx_driver_core_version_list; static struct drx_version_list drx_driver_core_version_list;
struct drx_version_list *demod_version_list = (struct drx_version_list *) (NULL); struct drx_version_list *demod_version_list = (struct drx_version_list *) (NULL);
int return_status = DRX_STS_ERROR; int return_status = -EIO;
/* Check arguments */ /* Check arguments */
if (version_list == NULL) { if (version_list == NULL) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
/* Get version info list from demod */ /* Get version info list from demod */
...@@ -1230,7 +1231,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version ...@@ -1230,7 +1231,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
drx_driver_core_version_list.version = &drx_driver_core_version; drx_driver_core_version_list.version = &drx_driver_core_version;
drx_driver_core_version_list.next = (struct drx_version_list *) (NULL); drx_driver_core_version_list.next = (struct drx_version_list *) (NULL);
if ((return_status == DRX_STS_OK) && (demod_version_list != NULL)) { if ((return_status == 0) && (demod_version_list != NULL)) {
/* Append versioninfo from driver to versioninfo from demod */ /* Append versioninfo from driver to versioninfo from demod */
/* Return version info in "bottom-up" order. This way, multiple /* Return version info in "bottom-up" order. This way, multiple
devices can be handled without using malloc. */ devices can be handled without using malloc. */
...@@ -1246,7 +1247,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version ...@@ -1246,7 +1247,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
*version_list = &drx_driver_core_version_list; *version_list = &drx_driver_core_version_list;
} }
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -1259,7 +1260,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version ...@@ -1259,7 +1260,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
* \brief This function is obsolete. * \brief This function is obsolete.
* \param demods: Don't care, parameter is ignored. * \param demods: Don't care, parameter is ignored.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK: Initialization completed. * \retval 0: Initialization completed.
* *
* This function is obsolete, prototype available for backward compatability. * This function is obsolete, prototype available for backward compatability.
* *
...@@ -1267,7 +1268,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version ...@@ -1267,7 +1268,7 @@ ctrl_version(struct drx_demod_instance *demod, struct drx_version_list **version
int drx_init(struct drx_demod_instance *demods[]) int drx_init(struct drx_demod_instance *demods[])
{ {
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -1275,7 +1276,7 @@ int drx_init(struct drx_demod_instance *demods[]) ...@@ -1275,7 +1276,7 @@ int drx_init(struct drx_demod_instance *demods[])
/** /**
* \brief This function is obsolete. * \brief This function is obsolete.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK: Terminated driver successful. * \retval 0: Terminated driver successful.
* *
* This function is obsolete, prototype available for backward compatability. * This function is obsolete, prototype available for backward compatability.
* *
...@@ -1283,7 +1284,7 @@ int drx_init(struct drx_demod_instance *demods[]) ...@@ -1283,7 +1284,7 @@ int drx_init(struct drx_demod_instance *demods[])
int drx_term(void) int drx_term(void)
{ {
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
...@@ -1292,16 +1293,16 @@ int drx_term(void) ...@@ -1292,16 +1293,16 @@ int drx_term(void)
* \brief Open a demodulator instance. * \brief Open a demodulator instance.
* \param demod: A pointer to a demodulator instance. * \param demod: A pointer to a demodulator instance.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK: Opened demod instance with succes. * \retval 0: Opened demod instance with succes.
* \retval DRX_STS_ERROR: Driver not initialized or unable to initialize * \retval -EIO: Driver not initialized or unable to initialize
* demod. * demod.
* \retval DRX_STS_INVALID_ARG: Demod instance has invalid content. * \retval -EINVAL: Demod instance has invalid content.
* *
*/ */
int drx_open(struct drx_demod_instance *demod) int drx_open(struct drx_demod_instance *demod)
{ {
int status = DRX_STS_OK; int status = 0;
if ((demod == NULL) || if ((demod == NULL) ||
(demod->my_demod_funct == NULL) || (demod->my_demod_funct == NULL) ||
...@@ -1309,12 +1310,12 @@ int drx_open(struct drx_demod_instance *demod) ...@@ -1309,12 +1310,12 @@ int drx_open(struct drx_demod_instance *demod)
(demod->my_ext_attr == NULL) || (demod->my_ext_attr == NULL) ||
(demod->my_i2c_dev_addr == NULL) || (demod->my_i2c_dev_addr == NULL) ||
(demod->my_common_attr->is_opened)) { (demod->my_common_attr->is_opened)) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
status = (*(demod->my_demod_funct->open_func)) (demod); status = (*(demod->my_demod_funct->open_func)) (demod);
if (status == DRX_STS_OK) if (status == 0)
demod->my_common_attr->is_opened = true; demod->my_common_attr->is_opened = true;
return status; return status;
...@@ -1326,10 +1327,10 @@ int drx_open(struct drx_demod_instance *demod) ...@@ -1326,10 +1327,10 @@ int drx_open(struct drx_demod_instance *demod)
* \brief Close device. * \brief Close device.
* \param demod: A pointer to a demodulator instance. * \param demod: A pointer to a demodulator instance.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK: Closed demod instance with succes. * \retval 0: Closed demod instance with succes.
* \retval DRX_STS_ERROR: Driver not initialized or error during close * \retval -EIO: Driver not initialized or error during close
* demod. * demod.
* \retval DRX_STS_INVALID_ARG: Demod instance has invalid content. * \retval -EINVAL: Demod instance has invalid content.
* *
* Free resources occupied by device instance. * Free resources occupied by device instance.
* Put device into sleep mode. * Put device into sleep mode.
...@@ -1337,7 +1338,7 @@ int drx_open(struct drx_demod_instance *demod) ...@@ -1337,7 +1338,7 @@ int drx_open(struct drx_demod_instance *demod)
int drx_close(struct drx_demod_instance *demod) int drx_close(struct drx_demod_instance *demod)
{ {
int status = DRX_STS_OK; int status = 0;
if ((demod == NULL) || if ((demod == NULL) ||
(demod->my_demod_funct == NULL) || (demod->my_demod_funct == NULL) ||
...@@ -1345,7 +1346,7 @@ int drx_close(struct drx_demod_instance *demod) ...@@ -1345,7 +1346,7 @@ int drx_close(struct drx_demod_instance *demod)
(demod->my_ext_attr == NULL) || (demod->my_ext_attr == NULL) ||
(demod->my_i2c_dev_addr == NULL) || (demod->my_i2c_dev_addr == NULL) ||
(!demod->my_common_attr->is_opened)) { (!demod->my_common_attr->is_opened)) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
status = (*(demod->my_demod_funct->close_func)) (demod); status = (*(demod->my_demod_funct->close_func)) (demod);
...@@ -1363,12 +1364,12 @@ int drx_close(struct drx_demod_instance *demod) ...@@ -1363,12 +1364,12 @@ int drx_close(struct drx_demod_instance *demod)
* \param ctrl: Reference to desired control function. * \param ctrl: Reference to desired control function.
* \param ctrl_data: Pointer to data structure for control function. * \param ctrl_data: Pointer to data structure for control function.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK: Control function completed successfully. * \retval 0: Control function completed successfully.
* \retval DRX_STS_ERROR: Driver not initialized or error during * \retval -EIO: Driver not initialized or error during
* control demod. * control demod.
* \retval DRX_STS_INVALID_ARG: Demod instance or ctrl_data has invalid * \retval -EINVAL: Demod instance or ctrl_data has invalid
* content. * content.
* \retval DRX_STS_FUNC_NOT_AVAILABLE: Specified control function is not * \retval -ENOTSUPP: Specified control function is not
* available. * available.
* *
* Data needed or returned by the control function is stored in ctrl_data. * Data needed or returned by the control function is stored in ctrl_data.
...@@ -1378,20 +1379,20 @@ int drx_close(struct drx_demod_instance *demod) ...@@ -1378,20 +1379,20 @@ int drx_close(struct drx_demod_instance *demod)
int int
drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data) drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data)
{ {
int status = DRX_STS_ERROR; int status = -EIO;
if ((demod == NULL) || if ((demod == NULL) ||
(demod->my_demod_funct == NULL) || (demod->my_demod_funct == NULL) ||
(demod->my_common_attr == NULL) || (demod->my_common_attr == NULL) ||
(demod->my_ext_attr == NULL) || (demod->my_i2c_dev_addr == NULL) (demod->my_ext_attr == NULL) || (demod->my_i2c_dev_addr == NULL)
) { ) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
if (((!demod->my_common_attr->is_opened) && if (((!demod->my_common_attr->is_opened) &&
(ctrl != DRX_CTRL_PROBE_DEVICE) && (ctrl != DRX_CTRL_VERSION)) (ctrl != DRX_CTRL_PROBE_DEVICE) && (ctrl != DRX_CTRL_VERSION))
) { ) {
return DRX_STS_INVALID_ARG; return -EINVAL;
} }
if ((DRX_ISPOWERDOWNMODE(demod->my_common_attr->current_power_mode) && if ((DRX_ISPOWERDOWNMODE(demod->my_common_attr->current_power_mode) &&
...@@ -1400,7 +1401,7 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data) ...@@ -1400,7 +1401,7 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data)
(ctrl != DRX_CTRL_NOP) && (ctrl != DRX_CTRL_VERSION) (ctrl != DRX_CTRL_NOP) && (ctrl != DRX_CTRL_VERSION)
) )
) { ) {
return DRX_STS_FUNC_NOT_AVAILABLE; return -ENOTSUPP;
} }
/* Fixed control functions */ /* Fixed control functions */
...@@ -1408,7 +1409,7 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data) ...@@ -1408,7 +1409,7 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data)
/*======================================================================*/ /*======================================================================*/
case DRX_CTRL_NOP: case DRX_CTRL_NOP:
/* No operation */ /* No operation */
return DRX_STS_OK; return 0;
break; break;
/*======================================================================*/ /*======================================================================*/
...@@ -1425,7 +1426,7 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data) ...@@ -1425,7 +1426,7 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data)
/* Virtual functions */ /* Virtual functions */
/* First try calling function from derived class */ /* First try calling function from derived class */
status = (*(demod->my_demod_funct->ctrl_func)) (demod, ctrl, ctrl_data); status = (*(demod->my_demod_funct->ctrl_func)) (demod, ctrl, ctrl_data);
if (status == DRX_STS_FUNC_NOT_AVAILABLE) { if (status == -ENOTSUPP) {
/* Now try calling a the base class function */ /* Now try calling a the base class function */
switch (ctrl) { switch (ctrl) {
/*===================================================================*/ /*===================================================================*/
...@@ -1488,13 +1489,13 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data) ...@@ -1488,13 +1489,13 @@ drx_ctrl(struct drx_demod_instance *demod, u32 ctrl, void *ctrl_data)
/*===================================================================*/ /*===================================================================*/
default: default:
return DRX_STS_FUNC_NOT_AVAILABLE; return -ENOTSUPP;
} }
} else { } else {
return status; return status;
} }
return DRX_STS_OK; return 0;
} }
/*============================================================================*/ /*============================================================================*/
......
...@@ -28,30 +28,11 @@ ...@@ -28,30 +28,11 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/**
* \file $Id: drx_driver.h,v 1.84 2010/01/14 22:47:50 dingtao Exp $
*
* \brief DRX driver API
*
*/
#ifndef __DRXDRIVER_H__ #ifndef __DRXDRIVER_H__
#define __DRXDRIVER_H__ #define __DRXDRIVER_H__
#include <linux/kernel.h> #include <linux/kernel.h>
/*------------------------------------------------------------------------- #include <linux/errno.h>
INCLUDES
-------------------------------------------------------------------------*/
enum drx_status {
DRX_STS_READY = 3, /**< device/service is ready */
DRX_STS_BUSY = 2, /**< device/service is busy */
DRX_STS_OK = 1, /**< everything is OK */
DRX_STS_INVALID_ARG = -1,
/**< invalid arguments */
DRX_STS_ERROR = -2, /**< general error */
DRX_STS_FUNC_NOT_AVAILABLE = -3
/**< unavailable functionality */
};
/* /*
* This structure contains the I2C address, the device ID and a user_data pointer. * This structure contains the I2C address, the device ID and a user_data pointer.
...@@ -82,8 +63,8 @@ Exported FUNCTIONS ...@@ -82,8 +63,8 @@ Exported FUNCTIONS
* \fn drxbsp_i2c_init() * \fn drxbsp_i2c_init()
* \brief Initialize I2C communication module. * \brief Initialize I2C communication module.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK Initialization successful. * \retval 0 Initialization successful.
* \retval DRX_STS_ERROR Initialization failed. * \retval -EIO Initialization failed.
*/ */
int drxbsp_i2c_init(void); int drxbsp_i2c_init(void);
...@@ -91,8 +72,8 @@ int drxbsp_i2c_init(void); ...@@ -91,8 +72,8 @@ int drxbsp_i2c_init(void);
* \fn drxbsp_i2c_term() * \fn drxbsp_i2c_term()
* \brief Terminate I2C communication module. * \brief Terminate I2C communication module.
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK Termination successful. * \retval 0 Termination successful.
* \retval DRX_STS_ERROR Termination failed. * \retval -EIO Termination failed.
*/ */
int drxbsp_i2c_term(void); int drxbsp_i2c_term(void);
...@@ -111,9 +92,9 @@ int drxbsp_i2c_term(void); ...@@ -111,9 +92,9 @@ int drxbsp_i2c_term(void);
* \param r_count The number of bytes to read * \param r_count The number of bytes to read
* \param r_data The array to read the data from * \param r_data The array to read the data from
* \return int Return status. * \return int Return status.
* \retval DRX_STS_OK Succes. * \retval 0 Succes.
* \retval DRX_STS_ERROR Failure. * \retval -EIO Failure.
* \retval DRX_STS_INVALID_ARG Parameter 'wcount' is not zero but parameter * \retval -EINVAL Parameter 'wcount' is not zero but parameter
* 'wdata' contains NULL. * 'wdata' contains NULL.
* Idem for 'rcount' and 'rdata'. * Idem for 'rcount' and 'rdata'.
* Both w_dev_addr and r_dev_addr are NULL. * Both w_dev_addr and r_dev_addr are NULL.
...@@ -2738,7 +2719,7 @@ Access macros ...@@ -2738,7 +2719,7 @@ Access macros
config.cfg_type = cfg_name; \ config.cfg_type = cfg_name; \
config.cfg_data = &cfg_data; \ config.cfg_data = &cfg_data; \
cfg_status = drx_ctrl(demod, DRX_CTRL_GET_CFG, &config); \ cfg_status = drx_ctrl(demod, DRX_CTRL_GET_CFG, &config); \
if (cfg_status == DRX_STS_OK) { \ if (cfg_status == 0) { \
value = cfg_data; \ value = cfg_data; \
} else { \ } else { \
value = (data_type)error_value; \ value = (data_type)error_value; \
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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