![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-only */ 0002 /* 0003 * include/linux/extcon/extcon-adc-jack.h 0004 * 0005 * Analog Jack extcon driver with ADC-based detection capability. 0006 * 0007 * Copyright (C) 2012 Samsung Electronics 0008 * MyungJoo Ham <myungjoo.ham@samsung.com> 0009 */ 0010 0011 #ifndef _EXTCON_ADC_JACK_H_ 0012 #define _EXTCON_ADC_JACK_H_ __FILE__ 0013 0014 #include <linux/module.h> 0015 #include <linux/extcon.h> 0016 0017 /** 0018 * struct adc_jack_cond - condition to use an extcon state 0019 * denotes the last adc_jack_cond element among the array) 0020 * @id: the unique id of each external connector 0021 * @min_adc: min adc value for this condition 0022 * @max_adc: max adc value for this condition 0023 * 0024 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means 0025 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and 0026 * 1 are attached (1<<0 | 1<<1 == 0x3) 0027 * 0028 * Note that you don't need to describe condition for "no cable attached" 0029 * because when no adc_jack_cond is met, state = 0 is automatically chosen. 0030 */ 0031 struct adc_jack_cond { 0032 unsigned int id; 0033 u32 min_adc; 0034 u32 max_adc; 0035 }; 0036 0037 /** 0038 * struct adc_jack_pdata - platform data for adc jack device. 0039 * @name: name of the extcon device. If null, "adc-jack" is used. 0040 * @consumer_channel: Unique name to identify the channel on the consumer 0041 * side. This typically describes the channels used within 0042 * the consumer. E.g. 'battery_voltage' 0043 * @cable_names: array of extcon id for supported cables. 0044 * @adc_contitions: array of struct adc_jack_cond conditions ending 0045 * with .state = 0 entry. This describes how to decode 0046 * adc values into extcon state. 0047 * @irq_flags: irq flags used for the @irq 0048 * @handling_delay_ms: in some devices, we need to read ADC value some 0049 * milli-seconds after the interrupt occurs. You may 0050 * describe such delays with @handling_delay_ms, which 0051 * is rounded-off by jiffies. 0052 * @wakeup_source: flag to wake up the system for extcon events. 0053 */ 0054 struct adc_jack_pdata { 0055 const char *name; 0056 const char *consumer_channel; 0057 0058 const unsigned int *cable_names; 0059 0060 /* The last entry's state should be 0 */ 0061 struct adc_jack_cond *adc_conditions; 0062 0063 unsigned long irq_flags; 0064 unsigned long handling_delay_ms; /* in ms */ 0065 bool wakeup_source; 0066 }; 0067 0068 #endif /* _EXTCON_ADC_JACK_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |