summaryrefstree
path: root/kernel/drivers/sensorhub/brcm/bbdpl/bbd_patch.c
blob: a40a10e24b752f93859b5eafa9d1100d9fd52824 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * Copyright 2014 Broadcom Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License, version 2, as
 * published by the Free Software Foundation (the "GPL").
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *  
 * A copy of the GPL is available at 
 * http://www.broadcom.com/licenses/GPLv2.php, or by writing to the Free
 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 * 02111-1307, USA.
 *
 * The BBD (Broadcom Bridge Driver)
 *
 * tabstop = 8
 */

#include "bbd_internal.h"

static unsigned char bbd_patch[] =
{
#if defined(CONFIG_SENSORS_SSP_LUCKY)
#include "bbd_patch_file_lucky.h"
#elif defined(CONFIG_SENSORS_SSP_NOBLELTE) || defined(CONFIG_SENSORS_SSP_ZENLTE)
#if ANDROID_VERSION < 70000			/* M OS*/
#include "bbd_patch_file_noble_m.h"
#else								/* N OS*/
#include "bbd_patch_file_noble.h"
#endif	
#elif defined (CONFIG_SENSORS_SSP_VLTE)
#include "bbd_patch_file_valley.h"
#elif defined (CONFIG_SENSORS_SSP_MARINELTE)
#include "bbd_patch_file.h"
#else  // ZERO
#include "bbd_new_patch_file.h"
#endif
};

void bbd_patch_init_vars(struct bbd_device *dev, int* result)
{
    printk(KERN_INFO "BBD:%s() %u\n", __func__, (u32)sizeof(bbd_patch));

    dev->bbd_ptr[BBD_MINOR_PATCH] = 0;
}

int bbd_patch_uninit(void)
{
    return 0;
}

int bbd_patch_open(struct inode *inode, struct file *filp)
{
    printk(KERN_INFO "BBD:%s() %u\n", __func__, (u32)sizeof(bbd_patch));

    if (!gpbbd_dev)
        return -EFAULT;

    filp->private_data = gpbbd_dev;

    return 0;
}

int bbd_patch_release(struct inode *inode, struct file *filp)
{
    return 0;
}

ssize_t bbd_patch_read( struct file *filp,
			char __user *buf,
			size_t size, loff_t *ppos)
{
    ssize_t rd_size = size;
    size_t  offset = filp->f_pos;

    if (offset >= sizeof(bbd_patch)) {       /* signal EOF */
        *ppos = 0;
        return 0;
    }
    if (offset+size > sizeof(bbd_patch))
        rd_size = sizeof(bbd_patch) - offset;
    if (copy_to_user(buf, bbd_patch + offset, rd_size))
        rd_size = -EFAULT;
    else
        *ppos = filp->f_pos + rd_size;

    return rd_size;
}