···27272828/**2929 * struct adc_jack_data - internal data for adc_jack device driver3030- * @edev - extcon device.3131- * @cable_names - list of supported cables.3232- * @num_cables - size of cable_names.3333- * @adc_conditions - list of adc value conditions.3434- * @num_conditions - size of adc_conditions.3535- * @irq - irq number of attach/detach event (0 if not exist).3636- * @handling_delay - interrupt handler will schedule extcon event3737- * handling at handling_delay jiffies.3838- * @handler - extcon event handler called by interrupt handler.3939- * @chan - iio channel being queried.3030+ * @edev: extcon device.3131+ * @cable_names: list of supported cables.3232+ * @num_cables: size of cable_names.3333+ * @adc_conditions: list of adc value conditions.3434+ * @num_conditions: size of adc_conditions.3535+ * @irq: irq number of attach/detach event (0 if not exist).3636+ * @handling_delay: interrupt handler will schedule extcon event3737+ * handling at handling_delay jiffies.3838+ * @handler: extcon event handler called by interrupt handler.3939+ * @chan: iio channel being queried.4040 */4141struct adc_jack_data {4242 struct extcon_dev edev;
+13-13
drivers/extcon/extcon-class.c
···74747575/**7676 * check_mutually_exclusive - Check if new_state violates mutually_exclusive7777- * condition.7777+ * condition.7878 * @edev: the extcon device7979 * @new_state: new cable attach status for @edev8080 *···189189190190/**191191 * extcon_update_state() - Update the cable attach states of the extcon device192192- * only for the masked bits.192192+ * only for the masked bits.193193 * @edev: the extcon device194194 * @mask: the bit mask to designate updated bits.195195 * @state: new cable attach status for @edev···227227 edev->state |= state & mask;228228229229 raw_notifier_call_chain(&edev->nh, old_state, edev);230230-231230 /* This could be in interrupt handler */232231 prop_buf = (char *)get_zeroed_page(GFP_ATOMIC);233232 if (prop_buf) {···338339339340/**340341 * extcon_set_cable_state_() - Set the status of a specific cable.341341- * @edev: the extcon device that has the cable.342342- * @index: cable index that can be retrieved by extcon_find_cable_index().342342+ * @edev: the extcon device that has the cable.343343+ * @index: cable index that can be retrieved by344344+ * extcon_find_cable_index().343345 * @cable_state: the new cable status. The default semantics is344346 * true: attached / false: detached.345347 */···359359360360/**361361 * extcon_set_cable_state() - Set the status of a specific cable.362362- * @edev: the extcon device that has the cable.363363- * @cable_name: cable name.362362+ * @edev: the extcon device that has the cable.363363+ * @cable_name: cable name.364364 * @cable_state: the new cable status. The default semantics is365365 * true: attached / false: detached.366366 *···419419420420/**421421 * extcon_register_interest() - Register a notifier for a state change of a422422- * specific cable, not an entier set of cables of a423423- * extcon device.424424- * @obj: an empty extcon_specific_cable_nb object to be returned.422422+ * specific cable, not an entier set of cables of a423423+ * extcon device.424424+ * @obj: an empty extcon_specific_cable_nb object to be returned.425425 * @extcon_name: the name of extcon device.426426 * if NULL, extcon_register_interest will register427427 * every cable with the target cable_name given.428428 * @cable_name: the target cable name.429429- * @nb: the notifier block to get notified.429429+ * @nb: the notifier block to get notified.430430 *431431 * Provide an empty extcon_specific_cable_nb. extcon_register_interest() sets432432 * the struct for you.···487487488488/**489489 * extcon_unregister_interest() - Unregister the notifier registered by490490- * extcon_register_interest().490490+ * extcon_register_interest().491491 * @obj: the extcon_specific_cable_nb object returned by492492 * extcon_register_interest().493493 */···502502503503/**504504 * extcon_register_notifier() - Register a notifiee to get notified by505505- * any attach status changes from the extcon.505505+ * any attach status changes from the extcon.506506 * @edev: the extcon device.507507 * @nb: a notifier block to be registered.508508 *
+35-32
include/linux/extcon.h
···5151enum extcon_cable_name {5252 EXTCON_USB = 0,5353 EXTCON_USB_HOST,5454- EXTCON_TA, /* Travel Adaptor */5454+ EXTCON_TA, /* Travel Adaptor */5555 EXTCON_FAST_CHARGER,5656 EXTCON_SLOW_CHARGER,5757- EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */5757+ EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */5858 EXTCON_HDMI,5959 EXTCON_MHL,6060 EXTCON_DVI,···76767777/**7878 * struct extcon_dev - An extcon device represents one external connector.7979- * @name: The name of this extcon device. Parent device name is used8080- * if NULL.7979+ * @name: The name of this extcon device. Parent device name is8080+ * used if NULL.8181 * @supported_cable: Array of supported cable names ending with NULL.8282 * If supported_cable is NULL, cable name related APIs8383 * are disabled.···8989 * be attached simulataneously. {0x7, 0} is equivalent to9090 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there9191 * can be no simultaneous connections.9292- * @print_name: An optional callback to override the method to print the9393- * name of the extcon device.9292+ * @print_name: An optional callback to override the method to print the9393+ * name of the extcon device.9494 * @print_state: An optional callback to override the method to print the9595- * status of the extcon device.9696- * @dev: Device of this extcon. Do not provide at register-time.9797- * @state: Attach/detach state of this extcon. Do not provide at9898- * register-time9999- * @nh: Notifier for the state change events from this extcon100100- * @entry: To support list of extcon devices so that users can search101101- * for extcon devices based on the extcon name.9595+ * status of the extcon device.9696+ * @dev: Device of this extcon. Do not provide at register-time.9797+ * @state: Attach/detach state of this extcon. Do not provide at9898+ * register-time.9999+ * @nh: Notifier for the state change events from this extcon100100+ * @entry: To support list of extcon devices so that users can search101101+ * for extcon devices based on the extcon name.102102 * @lock:103103 * @max_supported: Internal value to store the number of cables.104104 * @extcon_dev_type: Device_type struct to provide attribute_groups105105 * customized for each extcon device.106106- * @cables: Sysfs subdirectories. Each represents one cable.106106+ * @cables: Sysfs subdirectories. Each represents one cable.107107 *108108 * In most cases, users only need to provide "User initializing data" of109109 * this struct when registering an extcon. In some exceptional cases,···111111 * are overwritten by register function.112112 */113113struct extcon_dev {114114- /* --- Optional user initializing data --- */115115- const char *name;114114+ /* Optional user initializing data */115115+ const char *name;116116 const char **supported_cable;117117- const u32 *mutually_exclusive;117117+ const u32 *mutually_exclusive;118118119119- /* --- Optional callbacks to override class functions --- */119119+ /* Optional callbacks to override class functions */120120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);121121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);122122123123- /* --- Internal data. Please do not set. --- */124124- struct device *dev;125125- u32 state;123123+ /* Internal data. Please do not set. */124124+ struct device *dev;126125 struct raw_notifier_head nh;127126 struct list_head entry;128128- spinlock_t lock; /* could be called by irq handler */129127 int max_supported;128128+ spinlock_t lock; /* could be called by irq handler */129129+ u32 state;130130131131 /* /sys/class/extcon/.../cable.n/... */132132 struct device_type extcon_dev_type;133133 struct extcon_cable *cables;134134+134135 /* /sys/class/extcon/.../mutually_exclusive/... */135136 struct attribute_group attr_g_muex;136137 struct attribute **attrs_muex;···139138};140139141140/**142142- * struct extcon_cable - An internal data for each cable of extcon device.143143- * @edev: The extcon device141141+ * struct extcon_cable - An internal data for each cable of extcon device.142142+ * @edev: The extcon device144143 * @cable_index: Index of this cable in the edev145145- * @attr_g: Attribute group for the cable146146- * @attr_name: "name" sysfs entry147147- * @attr_state: "state" sysfs entry148148- * @attrs: Array pointing to attr_name and attr_state for attr_g144144+ * @attr_g: Attribute group for the cable145145+ * @attr_name: "name" sysfs entry146146+ * @attr_state: "state" sysfs entry147147+ * @attrs: Array pointing to attr_name and attr_state for attr_g149148 */150149struct extcon_cable {151150 struct extcon_dev *edev;···160159161160/**162161 * struct extcon_specific_cable_nb - An internal data for163163- * extcon_register_interest().164164- * @internal_nb: a notifier block bridging extcon notifier and cable notifier.165165- * @user_nb: user provided notifier block for events from a specific cable.162162+ * extcon_register_interest().163163+ * @internal_nb: A notifier block bridging extcon notifier164164+ * and cable notifier.165165+ * @user_nb: user provided notifier block for events from166166+ * a specific cable.166167 * @cable_index: the target cable.167167- * @edev: the target extcon device.168168+ * @edev: the target extcon device.168169 * @previous_value: the saved previous event value.169170 */170171struct extcon_specific_cable_nb {
+21-21
include/linux/extcon/extcon-adc-jack.h
···20202121/**2222 * struct adc_jack_cond - condition to use an extcon state2323- * @state - the corresponding extcon state (if 0, this struct denotes2424- * the last adc_jack_cond element among the array)2525- * @min_adc - min adc value for this condition2626- * @max_adc - max adc value for this condition2323+ * @state: the corresponding extcon state (if 0, this struct2424+ * denotes the last adc_jack_cond element among the array)2525+ * @min_adc: min adc value for this condition2626+ * @max_adc: max adc value for this condition2727 *2828 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means2929 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and···3333 * because when no adc_jack_cond is met, state = 0 is automatically chosen.3434 */3535struct adc_jack_cond {3636- u32 state; /* extcon state value. 0 if invalid */3636+ u32 state; /* extcon state value. 0 if invalid */3737 u32 min_adc;3838 u32 max_adc;3939};40404141/**4242 * struct adc_jack_pdata - platform data for adc jack device.4343- * @name - name of the extcon device. If null, "adc-jack" is used.4444- * @consumer_channel - Unique name to identify the channel on the consumer4545- * side. This typically describes the channels used within4646- * the consumer. E.g. 'battery_voltage'4747- * @cable_names - array of cable names ending with null.4848- * @adc_contitions - array of struct adc_jack_cond conditions ending4949- * with .state = 0 entry. This describes how to decode5050- * adc values into extcon state.5151- * @irq_flags - irq flags used for the @irq5252- * @handling_delay_ms - in some devices, we need to read ADC value some5353- * milli-seconds after the interrupt occurs. You may5454- * describe such delays with @handling_delay_ms, which5555- * is rounded-off by jiffies.4343+ * @name: name of the extcon device. If null, "adc-jack" is used.4444+ * @consumer_channel: Unique name to identify the channel on the consumer4545+ * side. This typically describes the channels used within4646+ * the consumer. E.g. 'battery_voltage'4747+ * @cable_names: array of cable names ending with null.4848+ * @adc_contitions: array of struct adc_jack_cond conditions ending4949+ * with .state = 0 entry. This describes how to decode5050+ * adc values into extcon state.5151+ * @irq_flags: irq flags used for the @irq5252+ * @handling_delay_ms: in some devices, we need to read ADC value some5353+ * milli-seconds after the interrupt occurs. You may5454+ * describe such delays with @handling_delay_ms, which5555+ * is rounded-off by jiffies.5656 */5757struct adc_jack_pdata {5858 const char *name;5959 const char *consumer_channel;6060- /*6161- * The last entry should be NULL6262- */6060+6161+ /* The last entry should be NULL */6362 const char **cable_names;6363+6464 /* The last entry's state should be 0 */6565 struct adc_jack_cond *adc_conditions;6666
+8-8
include/linux/extcon/extcon-gpio.h
···25252626/**2727 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.2828- * @name The name of this GPIO extcon device.2929- * @gpio Corresponding GPIO.3030- * @debounce Debounce time for GPIO IRQ in ms.3131- * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW).3232- * @state_on print_state is overriden with state_on if attached. If Null,3333- * default method of extcon class is used.3434- * @state_off print_state is overriden with state_on if detached. If Null,3535- * default method of extcon class is used.2828+ * @name: The name of this GPIO extcon device.2929+ * @gpio: Corresponding GPIO.3030+ * @debounce: Debounce time for GPIO IRQ in ms.3131+ * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).3232+ * @state_on: print_state is overriden with state_on if attached.3333+ * If NULL, default method of extcon class is used.3434+ * @state_off: print_state is overriden with state_on if detached.3535+ * If NUll, default method of extcon class is used.3636 *3737 * Note that in order for state_on or state_off to be valid, both state_on3838 * and state_off should be not NULL. If at least one of them is NULL,