@@ -82,6 +82,14 @@ static void get_default_min_max_freq(enum motionsensor_type type,
82
82
}
83
83
}
84
84
85
+ /**
86
+ * cros_ec_sensors_core_init() - basic initialization of the core structure
87
+ * @pdev: platform device created for the sensors
88
+ * @indio_dev: iio device structure of the device
89
+ * @physical_device: true if the device refers to a physical device
90
+ *
91
+ * Return: 0 on success, -errno on failure.
92
+ */
85
93
int cros_ec_sensors_core_init (struct platform_device * pdev ,
86
94
struct iio_dev * indio_dev ,
87
95
bool physical_device )
@@ -159,6 +167,16 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
159
167
}
160
168
EXPORT_SYMBOL_GPL (cros_ec_sensors_core_init );
161
169
170
+ /**
171
+ * cros_ec_motion_send_host_cmd() - send motion sense host command
172
+ * @state: pointer to state information for device
173
+ * @opt_length: optional length to reduce the response size, useful on the data
174
+ * path. Otherwise, the maximal allowed response size is used
175
+ *
176
+ * When called, the sub-command is assumed to be set in param->cmd.
177
+ *
178
+ * Return: 0 on success, -errno on failure.
179
+ */
162
180
int cros_ec_motion_send_host_cmd (struct cros_ec_sensors_core_state * state ,
163
181
u16 opt_length )
164
182
{
@@ -421,6 +439,14 @@ int cros_ec_sensors_read_lpc(struct iio_dev *indio_dev,
421
439
}
422
440
EXPORT_SYMBOL_GPL (cros_ec_sensors_read_lpc );
423
441
442
+ /**
443
+ * cros_ec_sensors_read_cmd() - retrieve data using the EC command protocol
444
+ * @indio_dev: pointer to IIO device
445
+ * @scan_mask: bitmap of the sensor indices to scan
446
+ * @data: location to store data
447
+ *
448
+ * Return: 0 on success, -errno on failure.
449
+ */
424
450
int cros_ec_sensors_read_cmd (struct iio_dev * indio_dev ,
425
451
unsigned long scan_mask , s16 * data )
426
452
{
@@ -445,6 +471,18 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev,
445
471
}
446
472
EXPORT_SYMBOL_GPL (cros_ec_sensors_read_cmd );
447
473
474
+ /**
475
+ * cros_ec_sensors_capture() - the trigger handler function
476
+ * @irq: the interrupt number.
477
+ * @p: a pointer to the poll function.
478
+ *
479
+ * On a trigger event occurring, if the pollfunc is attached then this
480
+ * handler is called as a threaded interrupt (and hence may sleep). It
481
+ * is responsible for grabbing data from the device and pushing it into
482
+ * the associated buffer.
483
+ *
484
+ * Return: IRQ_HANDLED
485
+ */
448
486
irqreturn_t cros_ec_sensors_capture (int irq , void * p )
449
487
{
450
488
struct iio_poll_func * pf = p ;
@@ -480,6 +518,16 @@ irqreturn_t cros_ec_sensors_capture(int irq, void *p)
480
518
}
481
519
EXPORT_SYMBOL_GPL (cros_ec_sensors_capture );
482
520
521
+ /**
522
+ * cros_ec_sensors_core_read() - function to request a value from the sensor
523
+ * @st: pointer to state information for device
524
+ * @chan: channel specification structure table
525
+ * @val: will contain one element making up the returned value
526
+ * @val2: will contain another element making up the returned value
527
+ * @mask: specifies which values to be requested
528
+ *
529
+ * Return: the type of value returned by the device
530
+ */
483
531
int cros_ec_sensors_core_read (struct cros_ec_sensors_core_state * st ,
484
532
struct iio_chan_spec const * chan ,
485
533
int * val , int * val2 , long mask )
@@ -520,6 +568,17 @@ int cros_ec_sensors_core_read(struct cros_ec_sensors_core_state *st,
520
568
}
521
569
EXPORT_SYMBOL_GPL (cros_ec_sensors_core_read );
522
570
571
+ /**
572
+ * cros_ec_sensors_core_read_avail() - get available values
573
+ * @indio_dev: pointer to state information for device
574
+ * @chan: channel specification structure table
575
+ * @vals: list of available values
576
+ * @type: type of data returned
577
+ * @length: number of data returned in the array
578
+ * @mask: specifies which values to be requested
579
+ *
580
+ * Return: an error code, IIO_AVAIL_RANGE or IIO_AVAIL_LIST
581
+ */
523
582
int cros_ec_sensors_core_read_avail (struct iio_dev * indio_dev ,
524
583
struct iio_chan_spec const * chan ,
525
584
const int * * vals ,
@@ -541,6 +600,16 @@ int cros_ec_sensors_core_read_avail(struct iio_dev *indio_dev,
541
600
}
542
601
EXPORT_SYMBOL_GPL (cros_ec_sensors_core_read_avail );
543
602
603
+ /**
604
+ * cros_ec_sensors_core_write() - function to write a value to the sensor
605
+ * @st: pointer to state information for device
606
+ * @chan: channel specification structure table
607
+ * @val: first part of value to write
608
+ * @val2: second part of value to write
609
+ * @mask: specifies which values to write
610
+ *
611
+ * Return: the type of value returned by the device
612
+ */
544
613
int cros_ec_sensors_core_write (struct cros_ec_sensors_core_state * st ,
545
614
struct iio_chan_spec const * chan ,
546
615
int val , int val2 , long mask )
0 commit comments