#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/module.h>
#include <linux/nospec.h>
#include <linux/jiffies.h>
#include "fmdrv.h"
#include "fmdrv_v4l2.h"
#include "fmdrv_common.h"
#include <linux/ti_wilink_st.h>
#include "fmdrv_rx.h"
#include "fmdrv_tx.h"
static struct region_info region_configs[] = …;
static u8 default_radio_region;
module_param(default_radio_region, byte, 0);
MODULE_PARM_DESC(…) …;
static u32 default_rds_buf = …;
module_param(default_rds_buf, uint, 0444);
MODULE_PARM_DESC(…) …;
static u32 radio_nr = …;
module_param(radio_nr, int, 0444);
MODULE_PARM_DESC(…) …;
static void fm_irq_send_flag_getcmd(struct fmdev *);
static void fm_irq_handle_flag_getcmd_resp(struct fmdev *);
static void fm_irq_handle_hw_malfunction(struct fmdev *);
static void fm_irq_handle_rds_start(struct fmdev *);
static void fm_irq_send_rdsdata_getcmd(struct fmdev *);
static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *);
static void fm_irq_handle_rds_finish(struct fmdev *);
static void fm_irq_handle_tune_op_ended(struct fmdev *);
static void fm_irq_handle_power_enb(struct fmdev *);
static void fm_irq_handle_low_rssi_start(struct fmdev *);
static void fm_irq_afjump_set_pi(struct fmdev *);
static void fm_irq_handle_set_pi_resp(struct fmdev *);
static void fm_irq_afjump_set_pimask(struct fmdev *);
static void fm_irq_handle_set_pimask_resp(struct fmdev *);
static void fm_irq_afjump_setfreq(struct fmdev *);
static void fm_irq_handle_setfreq_resp(struct fmdev *);
static void fm_irq_afjump_enableint(struct fmdev *);
static void fm_irq_afjump_enableint_resp(struct fmdev *);
static void fm_irq_start_afjump(struct fmdev *);
static void fm_irq_handle_start_afjump_resp(struct fmdev *);
static void fm_irq_afjump_rd_freq(struct fmdev *);
static void fm_irq_afjump_rd_freq_resp(struct fmdev *);
static void fm_irq_handle_low_rssi_finish(struct fmdev *);
static void fm_irq_send_intmsk_cmd(struct fmdev *);
static void fm_irq_handle_intmsk_cmd_resp(struct fmdev *);
enum fmc_irq_handler_index { … };
static int_handler_prototype int_handler_table[] = …;
static long (*g_st_write) (struct sk_buff *skb);
static struct completion wait_for_fmdrv_reg_comp;
static inline void fm_irq_call(struct fmdev *fmdev)
{ … }
static inline void fm_irq_call_stage(struct fmdev *fmdev, u8 stage)
{ … }
static inline void fm_irq_timeout_stage(struct fmdev *fmdev, u8 stage)
{ … }
#ifdef FM_DUMP_TXRX_PKT
inline void dump_tx_skb_data(struct sk_buff *skb)
{
int len, len_org;
u8 index;
struct fm_cmd_msg_hdr *cmd_hdr;
cmd_hdr = (struct fm_cmd_msg_hdr *)skb->data;
printk(KERN_INFO "<<%shdr:%02x len:%02x opcode:%02x type:%s dlen:%02x",
fm_cb(skb)->completion ? " " : "*", cmd_hdr->hdr,
cmd_hdr->len, cmd_hdr->op,
cmd_hdr->rd_wr ? "RD" : "WR", cmd_hdr->dlen);
len_org = skb->len - FM_CMD_MSG_HDR_SIZE;
if (len_org > 0) {
printk(KERN_CONT "\n data(%d): ", cmd_hdr->dlen);
len = min(len_org, 14);
for (index = 0; index < len; index++)
printk(KERN_CONT "%x ",
skb->data[FM_CMD_MSG_HDR_SIZE + index]);
printk(KERN_CONT "%s", (len_org > 14) ? ".." : "");
}
printk(KERN_CONT "\n");
}
inline void dump_rx_skb_data(struct sk_buff *skb)
{
int len, len_org;
u8 index;
struct fm_event_msg_hdr *evt_hdr;
evt_hdr = (struct fm_event_msg_hdr *)skb->data;
printk(KERN_INFO ">> hdr:%02x len:%02x sts:%02x numhci:%02x opcode:%02x type:%s dlen:%02x",
evt_hdr->hdr, evt_hdr->len,
evt_hdr->status, evt_hdr->num_fm_hci_cmds, evt_hdr->op,
(evt_hdr->rd_wr) ? "RD" : "WR", evt_hdr->dlen);
len_org = skb->len - FM_EVT_MSG_HDR_SIZE;
if (len_org > 0) {
printk(KERN_CONT "\n data(%d): ", evt_hdr->dlen);
len = min(len_org, 14);
for (index = 0; index < len; index++)
printk(KERN_CONT "%x ",
skb->data[FM_EVT_MSG_HDR_SIZE + index]);
printk(KERN_CONT "%s", (len_org > 14) ? ".." : "");
}
printk(KERN_CONT "\n");
}
#endif
void fmc_update_region_info(struct fmdev *fmdev, u8 region_to_set)
{ … }
static void recv_bh_work(struct work_struct *t)
{ … }
static void send_bh_work(struct work_struct *t)
{ … }
static int fm_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
int payload_len, struct completion *wait_completion)
{ … }
int fmc_send_cmd(struct fmdev *fmdev, u8 fm_op, u16 type, void *payload,
unsigned int payload_len, void *response, int *response_len)
{ … }
static inline int check_cmdresp_status(struct fmdev *fmdev,
struct sk_buff **skb)
{ … }
static inline void fm_irq_common_cmd_resp_helper(struct fmdev *fmdev, u8 stage)
{ … }
static void int_timeout_handler(struct timer_list *t)
{ … }
static void fm_irq_send_flag_getcmd(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_flag_getcmd_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_hw_malfunction(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_rds_start(struct fmdev *fmdev)
{ … }
static void fm_irq_send_rdsdata_getcmd(struct fmdev *fmdev)
{ … }
static void fm_rx_update_af_cache(struct fmdev *fmdev, u8 af)
{ … }
static void fm_rdsparse_swapbytes(struct fmdev *fmdev,
struct fm_rdsdata_format *rds_format)
{ … }
static void fm_irq_handle_rdsdata_getcmd_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_rds_finish(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_tune_op_ended(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_power_enb(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_low_rssi_start(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_set_pi(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_set_pi_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_set_pimask(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_set_pimask_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_setfreq(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_setfreq_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_enableint(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_enableint_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_start_afjump(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_start_afjump_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_rd_freq(struct fmdev *fmdev)
{ … }
static void fm_irq_afjump_rd_freq_resp(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_low_rssi_finish(struct fmdev *fmdev)
{ … }
static void fm_irq_send_intmsk_cmd(struct fmdev *fmdev)
{ … }
static void fm_irq_handle_intmsk_cmd_resp(struct fmdev *fmdev)
{ … }
int fmc_is_rds_data_available(struct fmdev *fmdev, struct file *file,
struct poll_table_struct *pts)
{ … }
int fmc_transfer_rds_from_internal_buff(struct fmdev *fmdev, struct file *file,
u8 __user *buf, size_t count)
{ … }
int fmc_set_freq(struct fmdev *fmdev, u32 freq_to_set)
{ … }
int fmc_get_freq(struct fmdev *fmdev, u32 *cur_tuned_frq)
{ … }
int fmc_set_region(struct fmdev *fmdev, u8 region_to_set)
{ … }
int fmc_set_mute_mode(struct fmdev *fmdev, u8 mute_mode_toset)
{ … }
int fmc_set_stereo_mono(struct fmdev *fmdev, u16 mode)
{ … }
int fmc_set_rds_mode(struct fmdev *fmdev, u8 rds_en_dis)
{ … }
static int fm_power_down(struct fmdev *fmdev)
{ … }
static int fm_download_firmware(struct fmdev *fmdev, const u8 *fw_name)
{ … }
static int load_default_rx_configuration(struct fmdev *fmdev)
{ … }
static int fm_power_up(struct fmdev *fmdev, u8 mode)
{ … }
int fmc_set_mode(struct fmdev *fmdev, u8 fm_mode)
{ … }
int fmc_get_mode(struct fmdev *fmdev, u8 *fmmode)
{ … }
static long fm_st_receive(void *arg, struct sk_buff *skb)
{ … }
static void fm_st_reg_comp_cb(void *arg, int data)
{ … }
int fmc_prepare(struct fmdev *fmdev)
{ … }
int fmc_release(struct fmdev *fmdev)
{ … }
static int __init fm_drv_init(void)
{ … }
static void __exit fm_drv_exit(void)
{ … }
module_init(…) …;
module_exit(fm_drv_exit);
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_VERSION(…);
MODULE_LICENSE(…) …;