detect_sensors.c 20.3 KB
Newer Older
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
/***************************************************************************//**
 * @file      detect_sensors.c
 * @brief     Determine sensor boards attached to each of the ports. Use
 *            Device Tree, sysfs to set sensor types per port. Add autodetection
 *            (using pullup/pull downs) later
 * @copyright Copyright 2016 (C) Elphel, Inc.
 * @par <b>License</b>
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *  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.
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *******************************************************************************/

//#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/of_device.h>
#include <linux/module.h>
#include <linux/errno.h>
#include <linux/string.h>

//#include <asm/outercache.h>     // TODO: Implement cache operations for the membridge !!!!
//#include <asm/cacheflush.h>

#include <linux/errno.h>
#include <linux/fs.h>

#include "x393.h"
34
#include <uapi/elphel/x393_devices.h>
35
#include <uapi/elphel/c313a.h>
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
#include "mt9x001.h"
#include "multi10359.h"
#include "detect_sensors.h"

#define DETECT_SENSORS_MODULE_DESCRIPTION "Detect sensor type(s) attached to each of the ports"
#define OF_PREFIX_NAME                    "elphel393-detect_sensors"
struct sensor_port_config_t
 {
     u32  mux;                 ///< sensor multiplexer, currently 0 (SENSOR_DETECT, SENSOR_MUX_10359 or SENSOR_NONE)
     u32  sensor[MAX_SENSORS]; ///< Without mux only [0] is used, with 10359 - 0..2 are used (i2c addressing is shifted so 0 is broadcast)
 };

static struct sensor_port_config_t sensorPortConfig[] = {
        {.mux=SENSOR_NONE,.sensor={SENSOR_NONE,SENSOR_NONE,SENSOR_NONE,SENSOR_NONE}},
        {.mux=SENSOR_NONE,.sensor={SENSOR_NONE,SENSOR_NONE,SENSOR_NONE,SENSOR_NONE}},
        {.mux=SENSOR_NONE,.sensor={SENSOR_NONE,SENSOR_NONE,SENSOR_NONE,SENSOR_NONE}},
        {.mux=SENSOR_NONE,.sensor={SENSOR_NONE,SENSOR_NONE,SENSOR_NONE,SENSOR_NONE}}
};
//struct sensor_port_config_t *pSensorPortConfig;
static const struct of_device_id elphel393_detect_sensors_of_match[];
static struct device *g_dev_ptr; ///< Global pointer to basic device structure. This pointer is used in debugfs output functions
struct sensor_name_t {
    const char * name;
    u32          code;
    int          type; ///< +1 - applicable to sensors, +2 - applicable to multiplexers
Andrey Filippov's avatar
Andrey Filippov committed
61
    sens_iface_t iface;
62
};
Andrey Filippov's avatar
Andrey Filippov committed
63 64
//typedef enum {NONE,PARALLEL12,HISPI} sens_iface_t; ///< Sensor port interface type

65
const struct sensor_name_t sensor_names[] ={
Andrey Filippov's avatar
Andrey Filippov committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
        {.name="detect",     .type=3, .iface=NONE,       .code = 0},                // to be automatically detected
        {.name="none",       .type=3, .iface=NONE,       .code = SENSOR_NONE},      // no device attached
        {.name="mux10359",   .type=2, .iface=PARALLEL12, .code = SENSOR_MUX_10359}, // no device attached
        {.name="zr32112",    .type=1, .iface=PARALLEL12, .code = SENSOR_ZR32112},   // Zoran ZR32112
        {.name="zr32212",    .type=1, .iface=PARALLEL12, .code = SENSOR_ZR32212},   // Zoran ZR32212
        {.name="kac1310",    .type=1, .iface=PARALLEL12, .code = SENSOR_KAC1310},   // Kodak KAC1310
        {.name="kac5000",    .type=1, .iface=PARALLEL12, .code = SENSOR_KAC5000},   // Kodak KAC5000
        {.name="mi1300",     .type=1, .iface=PARALLEL12, .code = SENSOR_MI1300},    // Micron MI1300
        {.name="mt9m001",    .type=1, .iface=PARALLEL12, .code = SENSOR_MT9M001},   // MT9M001
        {.name="mt9d001",    .type=1, .iface=PARALLEL12, .code = SENSOR_MT9D001},   // MT9D001
        {.name="mt9t001",    .type=1, .iface=PARALLEL12, .code = SENSOR_MT9T001},   // MT9T001
        {.name="mt9p006",    .type=1, .iface=PARALLEL12, .code = SENSOR_MT9P006},   // MT9P006
        {.name="mt9f002",    .type=1, .iface=HISPI4,     .code = SENSOR_MT9F002},   // MT9F002
        {.name="ibis51300",  .type=1, .iface=PARALLEL12, .code = SENSOR_IBIS51300}, // FillFactory IBIS51300
        {.name="kai11002",   .type=1, .iface=PARALLEL12, .code = SENSOR_KAI11000},  // Kodak KAI11002
        {.name=NULL,         .type=0, .iface=NONE,       .code = 0} // end of list
82
};
Andrey Filippov's avatar
Andrey Filippov committed
83
static sens_iface_t port_iface[SENSOR_PORTS];
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
//#define DETECT_SENSOR 1 ///< Include sensors, May be OR-ed when looking for sensor/multiplexer code/name
//#define DETECT_MUX 2    ///< Include multiplexers, May be OR-ed when looking for sensor/multiplexer code/name

/** Get sensor/multiplexer code (SENSOR_*) by name */
int get_code_by_name(const char * name, ///< sensor name
                     int    type)       ///< valid type [DETECT_SENSOR]|[DETECT_MUX]
                                        ///< @return sensor code or -EINVAL for invalid name
{
    int i;
    if (name) for (i = 0; sensor_names[i].name; i++){
        if ((sensor_names[i].type & type) && (!strncmp(sensor_names[i].name,name,80))){
            return sensor_names[i].code;
        }
    }
    return -EINVAL;

}

/** Get sensor/multiplexer name (SENSOR_*) by code */
const char * get_name_by_code(int code, ///< sensor code
                              int type) ///< valid type [DETECT_SENSOR]|[DETECT_MUX]
                                        ///< @return sensor name or NULL for invalid code
{
    int i;
    for (i = 0; sensor_names[i].name; i++){
        if ((sensor_names[i].type & type) && (sensor_names[i].code == code)){
            return sensor_names[i].name;
        }
    }
    return NULL;
}

Andrey Filippov's avatar
Andrey Filippov committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129
/** Get sensor/multiplexer interface type by code */
sens_iface_t get_iface_by_code(int code, ///< sensor code
                               int type) ///< valid type [DETECT_SENSOR]|[DETECT_MUX]
                                         ///< @return sensor name or NULL for invalid code
{
    int i;
    for (i = 0; sensor_names[i].name; i++){
        if ((sensor_names[i].type & type) && (sensor_names[i].code == code)){
            return sensor_names[i].iface;
        }
    }
    return NONE;
}

130 131 132 133 134 135 136 137 138

/** Get sensor port multiplexer type */
int get_detected_mux_code(int port) ///< Sensor port number (0..3)
                                    ///< @return port multiplexer code (SENSOR_DETECT, SENSOR_MUX_10359 or SENSOR_NONE)
{
    return sensorPortConfig[port & 3].mux;
}
/** Get sensor type */
int get_detected_sensor_code(int port,    ///< Sensor port number (0..3)
Andrey Filippov's avatar
Andrey Filippov committed
139
                             int sub_chn) ///< Sensor subchannel (0..3), -1 - use first defined sub channel
140 141
                                          ///< @return sensor code (SENSOR_DETECT, SENSOR_NONE, or SENSOR_*)
{
Andrey Filippov's avatar
Andrey Filippov committed
142 143 144 145 146 147 148 149 150 151 152 153 154 155
    int nchn,code;
    port &= 3;
    if (sub_chn >= 0)
        return sensorPortConfig[port].sensor[sub_chn & 3];
    // Negative sensor - find first defined
    nchn = (get_detected_mux_code(port) == SENSOR_NONE)? 1: MAX_SENSORS;
    for (sub_chn = 0; sub_chn < nchn; sub_chn++){
        code = sensorPortConfig[port].sensor[sub_chn];
        if ((code != SENSOR_DETECT) && (code != SENSOR_NONE))
            return code;
    }
    return SENSOR_NONE;
}

Andrey Filippov's avatar
Andrey Filippov committed
156
/** Get configured  sensor port subchannels */
Andrey Filippov's avatar
Andrey Filippov committed
157 158 159 160 161 162 163 164 165 166 167 168
int get_subchannels(int port) ///< Sensor port
                              ///< @return bitmask of available channels
{
    int sub_chn, chn_mask = 0;
    int nchn = (get_detected_mux_code(port) == SENSOR_NONE)? 1: MAX_SENSORS;
    for (sub_chn = 0; sub_chn < nchn; sub_chn++){
        if ((sensorPortConfig[port].sensor[sub_chn]!= SENSOR_DETECT) && (sensorPortConfig[port].sensor[sub_chn] != SENSOR_NONE)) {
            chn_mask |= 1 << sub_chn;
        }
    }
    return chn_mask;

169 170
}

Andrey Filippov's avatar
Andrey Filippov committed
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191

/** Update per-port interface type after changing sensor/multiplexer */
void update_port_iface(int port)  ///< Sensor port number (0..3)
{
    sens_iface_t iface = get_iface_by_code(get_detected_mux_code(port), DETECT_MUX);
    if (iface != NONE) {
        port_iface[port] = iface;
        return;
    }
    port_iface[port] = get_iface_by_code(get_detected_sensor_code(port,-1), DETECT_MUX); // '-1' - any subchannel
}

/** Get per-port interface type */
sens_iface_t get_port_interface(int port)  ///< Sensor port number (0..3)
                                           ///< @ return interface type (none, parallel12, hispi4
{
    return port_iface[port];
}



192 193 194 195 196 197 198 199 200 201 202 203
/** Set sensor port multiplexer type */
int set_detected_mux_code(int port,      ///< Sensor port number (0..3)
                          int mux_type)  ///< Sensor multiplexer type (SENSOR_DETECT, SENSOR_MUX_10359 or SENSOR_NONE)
                                         ///< @return 0 - OK, -EINVAL if mux_type is invalid
{
    if (mux_type < 0)
        return mux_type;
    if (!get_name_by_code(mux_type, DETECT_MUX)){
        pr_err("%s: Invalid port multiplexer code for port %d: 0x%x\n", __func__, port, mux_type);
        return -EINVAL;
    }
    sensorPortConfig[port & 3].mux = mux_type;
Andrey Filippov's avatar
Andrey Filippov committed
204
    update_port_iface(port);
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
    return 0;
}

/** Set sensor port multiplexer type */
int set_detected_sensor_code(int port,      ///< Sensor port number (0..3)
                             int sub_chn,   ///< Sensor subchannel (0..3)
                             int sens_type)  ///< Sensor code (SENSOR_DETECT, SENSOR_NONE, or SENSOR_*)
                                            ///< @return  0 - OK, -EINVAL if mux_type is invalid)
{
    if (sens_type < 0)
        return sens_type;
    if (!get_name_by_code(sens_type, DETECT_SENSOR)){
        pr_err("%s: Invalid sensor code for port %d, subchannel %d: 0x%x\n", __func__, port, sens_type);
        return -EINVAL;
    }
    sensorPortConfig[port & 3].sensor[sub_chn] = sens_type;
Andrey Filippov's avatar
Andrey Filippov committed
221
    update_port_iface(port);
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
    return 0;
}

// SysFS interface to read/modify video memory map
#define SYSFS_PERMISSIONS           0644 /* default permissions for sysfs files */
#define SYSFS_READONLY              0444
#define SYSFS_WRITEONLY             0222
/** Sysfs helper function - get channel number from the last character of the attribute name*/
static int get_channel_from_name(struct device_attribute *attr) ///< Linux kernel interface for exporting device attributes
///< @return channel number
{
    int reg = 0;
    sscanf(attr->attr.name + (strlen(attr->attr.name)-1), "%du", &reg);
    return reg;
}
/** Sysfs helper function - get channel and sub-channel numbers from the last 2 characters of the attribute name*/
static int get_channel_sub_from_name(struct device_attribute *attr) ///< Linux kernel interface for exporting device attributes
///< @return channel * 16 + sub_channel
{
    int reg = 0;
    sscanf(attr->attr.name + (strlen(attr->attr.name)-2), "%du", &reg);
    reg += (reg/10) * 6;
    return reg;
}

static ssize_t show_port_mux(struct device *dev, struct device_attribute *attr, char *buf)
{
Andrey Filippov's avatar
Andrey Filippov committed
249
    const char * name = get_name_by_code(get_detected_mux_code(get_channel_from_name(attr)), DETECT_MUX);
250 251 252 253 254 255 256 257 258
    if (name) return sprintf(buf,"%s\n", name);
    // Should never get here
    return sprintf(buf,"0x%x\n", sensorPortConfig[get_channel_from_name(attr)].mux);
}
static ssize_t show_sensor(struct device *dev, struct device_attribute *attr, char *buf)
{
    int psch = get_channel_sub_from_name(attr);
    int port = (psch>>4) &3;
    int sub_chn = psch &3;
Andrey Filippov's avatar
Andrey Filippov committed
259
    const char * name = get_name_by_code(get_detected_sensor_code(port,sub_chn), DETECT_SENSOR);
260 261 262 263 264 265
    if (name) return sprintf(buf,"%s\n", name);
    // Should never get here
    return sprintf(buf,"0x%x\n", sensorPortConfig[(psch>>4) & 3].sensor[psch & 3]);
}
static ssize_t store_port_mux(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
266
//    size_t len;
267 268
    char name[80];
    int port = get_channel_from_name(attr);
269 270
    int rslt;
    if (sscanf(buf, "%79s", name)){
271 272 273 274 275 276 277 278
        if ((rslt = set_detected_mux_code( port, get_code_by_name(name, DETECT_MUX)))<0)
            return rslt;

    }
    return count;
}
static ssize_t store_sensor(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
279
//    size_t len;
280 281 282 283
    char name[80];
    int psch = get_channel_sub_from_name(attr);
    int port = (psch>>4) &3;
    int sub_chn = psch &3;
284 285
    int rslt;
    if (sscanf(buf, "%79s", name)){
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
        if ((rslt = set_detected_sensor_code(port, sub_chn, get_code_by_name(name, DETECT_SENSOR)))<0)
            return rslt;
    }
    return count;
}

static DEVICE_ATTR(port_mux0,                  SYSFS_PERMISSIONS,     show_port_mux,                   store_port_mux);
static DEVICE_ATTR(port_mux1,                  SYSFS_PERMISSIONS,     show_port_mux,                   store_port_mux);
static DEVICE_ATTR(port_mux2,                  SYSFS_PERMISSIONS,     show_port_mux,                   store_port_mux);
static DEVICE_ATTR(port_mux3,                  SYSFS_PERMISSIONS,     show_port_mux,                   store_port_mux);
static DEVICE_ATTR(sensor00,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor01,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor02,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor03,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor10,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor11,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor12,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor13,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor20,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor21,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor22,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor23,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor30,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor31,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor32,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);
static DEVICE_ATTR(sensor33,                   SYSFS_PERMISSIONS,     show_sensor,                     store_sensor);

static struct attribute *root_dev_attrs[] = {
        &dev_attr_port_mux0.attr,
        &dev_attr_port_mux1.attr,
        &dev_attr_port_mux2.attr,
        &dev_attr_port_mux3.attr,
        &dev_attr_sensor00.attr,
        &dev_attr_sensor01.attr,
        &dev_attr_sensor02.attr,
        &dev_attr_sensor03.attr,
        &dev_attr_sensor10.attr,
        &dev_attr_sensor11.attr,
        &dev_attr_sensor12.attr,
        &dev_attr_sensor13.attr,
        &dev_attr_sensor20.attr,
        &dev_attr_sensor21.attr,
        &dev_attr_sensor22.attr,
        &dev_attr_sensor23.attr,
        &dev_attr_sensor30.attr,
        &dev_attr_sensor31.attr,
        &dev_attr_sensor32.attr,
        &dev_attr_sensor33.attr,
        NULL
};

static const struct attribute_group dev_attr_root_group = {
        .attrs = root_dev_attrs,
        .name  = NULL,
};


static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
{
    int retval=0;
    struct device *dev = &pdev->dev;
    if (&dev->kobj) {
        if (((retval = sysfs_create_group(&dev->kobj, &dev_attr_root_group)))<0) return retval;
    }
    return retval;
}
/** Initialize this driver from the Device Tree.
 * Read per-port multiplexers and sensors. */
 static void detect_sensors_init_of(struct platform_device *pdev) ///< Platform device structure for this driver
 ///< @return 0 on success, or negative error.
 {
     const   char * config_string;
     char names[4][80];
     struct device_node *node = pdev->dev.of_node;
     int num_ports, port, num_sub, sub_chn;
     if (node) {
362 363 364 365 366 367 368 369 370 371 372
         config_string = of_get_property(node,  OF_PREFIX_NAME",port-mux", NULL); // &len);
         pr_info ("Mux config_string = %s (was looking for '%s')\n",config_string, OF_PREFIX_NAME",port-mux");
         if (config_string) {
             num_ports = sscanf(config_string,"%79s %79s %79s %79s", names[0],  names[1],  names[2],  names[3]);
             if (num_ports > SENSOR_PORTS)
                 num_ports = SENSOR_PORTS;
             pr_info ("num_ports= %d\n",num_ports);
             for (port = 0; port < num_ports; port++){
                 pr_info ("Setting port %d mux  '%s' (0x%x)\n",port, names[port], get_code_by_name(names[port], DETECT_MUX));
                 set_detected_mux_code(port, get_code_by_name(names[port], DETECT_MUX));
             }
373 374
         }
         num_ports = of_property_count_strings(node,OF_PREFIX_NAME",sensors");
375 376 377
         if (num_ports > SENSOR_PORTS)
             num_ports = SENSOR_PORTS;
         pr_info ("num_ports = %d (was looking for '%s')\n",num_ports, OF_PREFIX_NAME",sensors");
378 379 380 381 382
         for (port = 0; port < num_ports; port++){
             if (of_property_read_string_index(node, OF_PREFIX_NAME",sensors", port, &config_string)) {
                 pr_err("%s: No data for selected port\n", __func__);
                 BUG();
             }
383 384 385 386 387 388 389 390
             pr_info ("Sensor config_string = %s\n",config_string);
             if (config_string) {
                 num_sub = sscanf(config_string,"%79s %79s %79s %79s", names[0],  names[1],  names[2],  names[3]);
                 pr_info ("port %d : %d subchannels\n",port, num_sub);
                 for (sub_chn = 0; sub_chn < num_sub; sub_chn++){
                     pr_info ("Setting sensor %d:%d '%s' (0x%x)\n",port, sub_chn, names[sub_chn], get_code_by_name(names[sub_chn], DETECT_SENSOR));
                     set_detected_sensor_code(port, sub_chn,  get_code_by_name(names[sub_chn], DETECT_SENSOR));
                 }
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408
             }
         }
     }
 }



 static int detect_sensors_probe(struct platform_device *pdev)
 {
     unsigned int irq;
     int res;
     struct device *dev = &pdev->dev;
     const struct of_device_id *match;
     const __be32 *bufsize_be;
     struct device_node *node;
//     pSensorPortConfig = sensorPortConfig;

     elphel393_detect_sensors_sysfs_register(pdev);
409
     pr_info ("Registered sysfs for detect_sensors");
410
     match = of_match_device(elphel393_detect_sensors_of_match, dev);
411
     if (!match) {
412
         pr_err("Detect sensors ERROR: No device tree for '%s' node found\n",elphel393_detect_sensors_of_match[0].compatible);
413 414
         return -EINVAL;
     }
415 416 417 418

     detect_sensors_init_of(pdev);


419 420
     //    dev_dbg(dev, "Registering character device with name "DEV393_NAME(DEV393_DETECT_SENSORS));
     //    res = register_chrdev(DETECT_SENSORS_MAJOR, DEV393_NAME(DEV393_DETECT_SENSORS), &detect_sensors_fops);
421 422 423 424 425 426 427 428 429 430 431 432 433
     //    if(res < 0) {
     //        dev_err(dev, "\nlogger_init: couldn't get a major number  %d.\n ",DETECT_SENSORS_MAJOR);
     //        return res;
     //    }
     g_dev_ptr = dev; // for debugfs
     return 0;
 }


 /** IMU/GPS logger driver remove function */
 static int detect_sensors_remove(struct platform_device *pdev) ///< [in] pointer to @e platform_device structure
 ///< @return always 0
 {
434
     //    unregister_chrdev(DETECT_SENSORS_MAJOR, DEV393_NAME(DEV393_DETECT_SENSORS));
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449

     return 0;
 }

 static const struct of_device_id elphel393_detect_sensors_of_match[] = {
         { .compatible = "elphel,elphel393-detect_sensors-1.00" },
         { /* end of list */ }
 };

 MODULE_DEVICE_TABLE(of, elphel393_detect_sensors_of_match);

 static struct platform_driver elphel393_detect_sensors = {
         .probe          = detect_sensors_probe,
         .remove         = detect_sensors_remove,
         .driver = {
450
                 .name =           DEV393_NAME(DEV393_DETECT_SENSORS),
451 452 453 454 455 456 457 458 459 460 461
                 .of_match_table = elphel393_detect_sensors_of_match,
         },
 };

 module_platform_driver(elphel393_detect_sensors);


 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
 MODULE_DESCRIPTION(DETECT_SENSORS_MODULE_DESCRIPTION);