/** * struct adc_jack_data - internal data for adc_jack device driver * @dev: The device structure associated with the adc_jack. * @edev: extcon device. * @cable_names: list of supported cables. * @adc_conditions: list of adc value conditions. * @num_conditions: size of adc_conditions. * @irq: irq number of attach/detach event (0 if not exist). * @handling_delay: interrupt handler will schedule extcon event * handling at handling_delay jiffies. * @handler: extcon event handler called by interrupt handler. * @chan: iio channel being queried. * @wakeup_source: Indicates if the device can wake up the system.
*/ struct adc_jack_data { struct device *dev; struct extcon_dev *edev;
constunsignedint **cable_names; struct adc_jack_cond *adc_conditions; int num_conditions;
int irq; unsignedlong handling_delay; /* in jiffies */ struct delayed_work handler;
ret = iio_read_channel_raw(data->chan, &adc_val); if (ret < 0) {
dev_err(data->dev, "read channel() error: %d\n", ret); return;
}
/* Get state from adc value with adc_conditions */ for (i = 0; i < data->num_conditions; i++) {
def = &data->adc_conditions[i]; if (def->min_adc <= adc_val && def->max_adc >= adc_val) {
extcon_set_state_sync(data->edev, def->id, true); return;
}
}
/* Set the detached state if adc value is not included in the range */ for (i = 0; i < data->num_conditions; i++) {
def = &data->adc_conditions[i];
extcon_set_state_sync(data->edev, def->id, false);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.