|
@@ -13,6 +13,7 @@
|
|
#include <linux/debugfs.h>
|
|
#include <linux/debugfs.h>
|
|
#include <linux/ratelimit.h>
|
|
#include <linux/ratelimit.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
|
|
+#include <linux/fs.h>
|
|
#include <sound/pcm.h>
|
|
#include <sound/pcm.h>
|
|
#include <sound/pcm_params.h>
|
|
#include <sound/pcm_params.h>
|
|
#include <sound/soc.h>
|
|
#include <sound/soc.h>
|
|
@@ -26,6 +27,12 @@
|
|
#define DELAY_FOR_PORT_OPEN_MS (200)
|
|
#define DELAY_FOR_PORT_OPEN_MS (200)
|
|
#define SLIM_MANF_ID_QCOM 0x217
|
|
#define SLIM_MANF_ID_QCOM 0x217
|
|
#define SLIM_PROD_CODE 0x221
|
|
#define SLIM_PROD_CODE 0x221
|
|
|
|
+#define BT_CMD_SLIM_TEST 0xbfac
|
|
|
|
+
|
|
|
|
+struct class *btfm_slim_class;
|
|
|
|
+static int btfm_slim_major;
|
|
|
|
+
|
|
|
|
+struct btfmslim *btfm_slim_drv_data;
|
|
|
|
|
|
static int btfm_num_ports_open;
|
|
static int btfm_num_ports_open;
|
|
|
|
|
|
@@ -562,6 +569,24 @@ static int btfm_slim_status(struct slim_device *sdev,
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static long btfm_slim_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
|
|
|
+{
|
|
|
|
+ int ret = 0;
|
|
|
|
+
|
|
|
|
+ switch (cmd) {
|
|
|
|
+ case BT_CMD_SLIM_TEST:
|
|
|
|
+ BTFMSLIM_INFO("cmd BT_CMD_SLIM_TEST, call btfm_slim_hw_init");
|
|
|
|
+ ret = btfm_slim_hw_init(btfm_slim_drv_data);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static const struct file_operations bt_dev_fops = {
|
|
|
|
+ .unlocked_ioctl = btfm_slim_ioctl,
|
|
|
|
+ .compat_ioctl = btfm_slim_ioctl,
|
|
|
|
+};
|
|
|
|
+
|
|
static int btfm_slim_probe(struct slim_device *slim)
|
|
static int btfm_slim_probe(struct slim_device *slim)
|
|
{
|
|
{
|
|
int ret = 0;
|
|
int ret = 0;
|
|
@@ -610,7 +635,36 @@ static int btfm_slim_probe(struct slim_device *slim)
|
|
ret = -EPROBE_DEFER;
|
|
ret = -EPROBE_DEFER;
|
|
goto dealloc;
|
|
goto dealloc;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ btfm_slim_drv_data = btfm_slim;
|
|
|
|
+ btfm_slim_major = register_chrdev(0, "btfm_slim", &bt_dev_fops);
|
|
|
|
+ if (btfm_slim_major < 0) {
|
|
|
|
+ BTFMSLIM_ERR("%s: failed to allocate char dev\n", __func__);
|
|
|
|
+ ret = -1;
|
|
|
|
+ goto register_err;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ btfm_slim_class = class_create(THIS_MODULE, "btfmslim-dev");
|
|
|
|
+ if (IS_ERR(btfm_slim_class)) {
|
|
|
|
+ BTFMSLIM_ERR("%s: coudn't create class\n", __func__);
|
|
|
|
+ ret = -1;
|
|
|
|
+ goto class_err;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (device_create(btfm_slim_class, NULL, MKDEV(btfm_slim_major, 0),
|
|
|
|
+ NULL, "btfmslim") == NULL) {
|
|
|
|
+ BTFMSLIM_ERR("%s: failed to allocate char dev\n", __func__);
|
|
|
|
+ ret = -1;
|
|
|
|
+ goto device_err;
|
|
|
|
+ }
|
|
return ret;
|
|
return ret;
|
|
|
|
+
|
|
|
|
+device_err:
|
|
|
|
+ class_destroy(btfm_slim_class);
|
|
|
|
+class_err:
|
|
|
|
+ unregister_chrdev(btfm_slim_major, "btfm_slim");
|
|
|
|
+register_err:
|
|
|
|
+ btfm_slim_unregister_codec(&slim->dev);
|
|
dealloc:
|
|
dealloc:
|
|
mutex_destroy(&btfm_slim->io_lock);
|
|
mutex_destroy(&btfm_slim->io_lock);
|
|
mutex_destroy(&btfm_slim->xfer_lock);
|
|
mutex_destroy(&btfm_slim->xfer_lock);
|