Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb5596bf authored by Venkateshwarlu Domakonda's avatar Venkateshwarlu Domakonda
Browse files

radio: iris: change the FM module from modular to built in



This patch makes the FM driver static similar
to the drivers for other targets.

Change-Id: I9bb434d77b185d1dce35bdd46bf58a99694fe0ad
Signed-off-by: default avatarVenkateshwarlu Domakonda <vdomak@codeaurora.org>
parent 56054fb2
Loading
Loading
Loading
Loading
+35 −6
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
 *  FM HCI_SMD ( FM HCI Shared Memory Driver) is Qualcomm's Shared memory driver
 *  for the HCI protocol. This file is based on drivers/bluetooth/hci_vhci.c
 *
 *  Copyright (c) 2000-2001, 2011-2012, 2014 The Linux Foundation.
 *  Copyright (c) 2000-2001, 2011-2012, 2014-2015 The Linux Foundation.
 *  All rights reserved.
 *
 *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
@@ -29,6 +29,8 @@
#include <linux/workqueue.h>
#include <soc/qcom/smd.h>
#include <media/radio-iris.h>
#include <linux/wakelock.h>
#include <linux/uaccess.h>

struct radio_data {
	struct radio_hci_dev *hdev;
@@ -36,8 +38,12 @@ struct radio_data {
	struct smd_channel  *fm_channel;
};
struct radio_data hs;

static DEFINE_MUTEX(fm_smd_enable);
static int fmsmd_set;
static int hcismd_fm_set_enable(const char *val, struct kernel_param *kp);
module_param_call(fmsmd_set, hcismd_fm_set_enable, NULL, &fmsmd_set, 0644);
static struct work_struct *reset_worker;
static void radio_hci_smd_deregister(void);

static void radio_hci_smd_destruct(struct radio_hci_dev *hdev)
{
@@ -167,6 +173,7 @@ static int radio_hci_smd_register_dev(struct radio_data *hsmd)
		(unsigned long) hsmd);
	hdev->send  = radio_hci_smd_send_frame;
	hdev->destruct = radio_hci_smd_destruct;
	hdev->close_smd = radio_hci_smd_deregister;

	/* Open the SMD Channel and device and register the callback function */
	rc = smd_named_open_on_edge("APPS_FM", SMD_APPS_WCNSS,
@@ -196,20 +203,42 @@ static void radio_hci_smd_deregister(void)
{
	smd_close(hs.fm_channel);
	hs.fm_channel = 0;
	fmsmd_set = 0;
}

static int radio_hci_smd_init(void)
{
	return radio_hci_smd_register_dev(&hs);
}
module_init(radio_hci_smd_init);

static void __exit radio_hci_smd_exit(void)
static void radio_hci_smd_exit(void)
{
	radio_hci_smd_deregister();
}
module_exit(radio_hci_smd_exit);

MODULE_DESCRIPTION("Bluetooth SMD driver");
static int hcismd_fm_set_enable(const char *val, struct kernel_param *kp)
{
	int ret = 0;

	mutex_lock(&fm_smd_enable);
	ret = param_set_int(val, kp);
	if (ret)
		goto done;
	switch (fmsmd_set) {

	case 1:
		radio_hci_smd_init();
		break;
	case 0:
		radio_hci_smd_exit();
		break;
	default:
		ret = -EFAULT;
	}
done:
	mutex_unlock(&fm_smd_enable);
	return ret;
}
MODULE_DESCRIPTION("FM SMD driver");
MODULE_AUTHOR("Ankur Nandwani <ankurn@codeaurora.org>");
MODULE_LICENSE("GPL v2");
+8 −7
Original line number Diff line number Diff line
@@ -3243,8 +3243,6 @@ static int iris_do_calibration(struct iris_device *radio)
			radio->fm_hdev);
	if (retval < 0)
		FMDERR("Disable Failed after calibration %d", retval);
	else
		radio->mode = FM_OFF;

	return retval;
}
@@ -3597,10 +3595,8 @@ static int iris_vidioc_g_ctrl(struct file *file, void *priv,
END:
	if (retval > 0)
		retval = -EINVAL;
	if (retval < 0)
		FMDERR("get control failed with %d\n", retval);
	if (ctrl != NULL)
		FMDERR("get control failed id: %d\n", ctrl->id);
	if (ctrl != NULL && retval < 0)
		FMDERR("get control failed: %d, ret: %d\n", ctrl->id, retval);

	return retval;
}
@@ -5132,7 +5128,7 @@ static int iris_fops_release(struct file *file)
		return -EINVAL;

	if (radio->mode == FM_OFF)
		return 0;
		goto END;

	if (radio->mode == FM_RECV) {
		radio->mode = FM_OFF;
@@ -5142,7 +5138,12 @@ static int iris_fops_release(struct file *file)
		radio->mode = FM_OFF;
		retval = hci_cmd(HCI_FM_DISABLE_TRANS_CMD,
					radio->fm_hdev);
	} else if (radio->mode == FM_CALIB) {
		radio->mode = FM_OFF;
		return retval;
	}
END:
	radio->fm_hdev->close_smd();
	if (retval < 0)
		FMDERR("Err on disable FM %d\n", retval);

+48 −47
Original line number Diff line number Diff line
/*
 *
 * Copyright (c) 2011-2014 The Linux Foundation. All rights reserved.
 * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
 *
 * This file is based on include/net/bluetooth/hci_core.h
 *
@@ -33,52 +33,52 @@
#include <linux/atomic.h>
#include <media/radio-iris-commands.h>

const unsigned char MIN_TX_TONE_VAL = 0x00;
const unsigned char MAX_TX_TONE_VAL = 0x07;
const unsigned char MIN_HARD_MUTE_VAL = 0x00;
const unsigned char MAX_HARD_MUTE_VAL = 0x03;
const unsigned char MIN_SRCH_MODE = 0x00;
const unsigned char MAX_SRCH_MODE = 0x09;
const unsigned char MIN_SCAN_DWELL = 0x00;
const unsigned char MAX_SCAN_DWELL = 0x0F;
const unsigned char MIN_SIG_TH = 0x00;
const unsigned char MAX_SIG_TH = 0x03;
const unsigned char MIN_PTY = 0X00;
const unsigned char MAX_PTY = 0x1F;
const unsigned short MIN_PI = 0x0000;
const unsigned short MAX_PI = 0xFFFF;
const unsigned char MIN_SRCH_STATIONS_CNT = 0x00;
const unsigned char MAX_SRCH_STATIONS_CNT = 0x14;
const unsigned char MIN_CHAN_SPACING = 0x00;
const unsigned char MAX_CHAN_SPACING = 0x02;
const unsigned char MIN_EMPHASIS = 0x00;
const unsigned char MAX_EMPHASIS = 0x01;
const unsigned char MIN_RDS_STD = 0x00;
const unsigned char MAX_RDS_STD = 0x02;
const unsigned char MIN_ANTENNA_VAL = 0x00;
const unsigned char MAX_ANTENNA_VAL = 0x01;
const unsigned char MIN_TX_PS_REPEAT_CNT = 0x01;
const unsigned char MAX_TX_PS_REPEAT_CNT = 0x0F;
const unsigned char MIN_SOFT_MUTE = 0x00;
const unsigned char MAX_SOFT_MUTE = 0x01;
const unsigned char MIN_PEEK_ACCESS_LEN = 0x01;
const unsigned char MAX_PEEK_ACCESS_LEN = 0xF9;
const unsigned char MIN_RESET_CNTR = 0x00;
const unsigned char MAX_RESET_CNTR = 0x01;
const unsigned char MIN_HLSI = 0x00;
const unsigned char MAX_HLSI = 0x02;
const unsigned char MIN_NOTCH_FILTER = 0x00;
const unsigned char MAX_NOTCH_FILTER = 0x02;
const unsigned char MIN_INTF_DET_OUT_LW_TH = 0x00;
const unsigned char MAX_INTF_DET_OUT_LW_TH = 0xFF;
const unsigned char MIN_INTF_DET_OUT_HG_TH = 0x00;
const unsigned char MAX_INTF_DET_OUT_HG_TH = 0xFF;
const signed char MIN_SINR_TH = -128;
const signed char MAX_SINR_TH = 127;
const unsigned char MIN_SINR_SAMPLES = 0x01;
const unsigned char MAX_SINR_SAMPLES = 0xFF;
const signed char MIN_BLEND_HI = -128;
const signed char MAX_BLEND_HI = 127;
#define MIN_TX_TONE_VAL  0x00
#define MAX_TX_TONE_VAL  0x07
#define MIN_HARD_MUTE_VAL  0x00
#define MAX_HARD_MUTE_VAL  0x03
#define MIN_SRCH_MODE  0x00
#define MAX_SRCH_MODE  0x09
#define MIN_SCAN_DWELL  0x00
#define MAX_SCAN_DWELL  0x0F
#define MIN_SIG_TH  0x00
#define MAX_SIG_TH  0x03
#define MIN_PTY  0X00
#define MAX_PTY  0x1F
#define MIN_PI  0x0000
#define MAX_PI  0xFFFF
#define MIN_SRCH_STATIONS_CNT  0x00
#define MAX_SRCH_STATIONS_CNT  0x14
#define MIN_CHAN_SPACING  0x00
#define MAX_CHAN_SPACING  0x02
#define MIN_EMPHASIS  0x00
#define MAX_EMPHASIS  0x01
#define MIN_RDS_STD  0x00
#define MAX_RDS_STD  0x02
#define MIN_ANTENNA_VAL  0x00
#define MAX_ANTENNA_VAL  0x01
#define MIN_TX_PS_REPEAT_CNT  0x01
#define MAX_TX_PS_REPEAT_CNT  0x0F
#define MIN_SOFT_MUTE  0x00
#define MAX_SOFT_MUTE  0x01
#define MIN_PEEK_ACCESS_LEN  0x01
#define MAX_PEEK_ACCESS_LEN  0xF9
#define MIN_RESET_CNTR  0x00
#define MAX_RESET_CNTR  0x01
#define MIN_HLSI  0x00
#define MAX_HLSI  0x02
#define MIN_NOTCH_FILTER  0x00
#define MAX_NOTCH_FILTER  0x02
#define MIN_INTF_DET_OUT_LW_TH  0x00
#define MAX_INTF_DET_OUT_LW_TH  0xFF
#define MIN_INTF_DET_OUT_HG_TH  0x00
#define MAX_INTF_DET_OUT_HG_TH  0xFF
#define MIN_SINR_TH  -128
#define MAX_SINR_TH  127
#define MIN_SINR_SAMPLES  0x01
#define MAX_SINR_SAMPLES  0xFF
#define MIN_BLEND_HI  -128
#define MAX_BLEND_HI  127


/* ---- HCI Packet structures ---- */
@@ -183,6 +183,7 @@ struct radio_hci_dev {
	int (*send)(struct sk_buff *skb);
	void (*destruct)(struct radio_hci_dev *hdev);
	void (*notify)(struct radio_hci_dev *hdev, unsigned int evt);
	void (*close_smd)(void);
};

int radio_hci_register_dev(struct radio_hci_dev *hdev);