diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-07 13:31:29 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-07 13:31:29 -0700 |
commit | e0dccbdf5ac7ccb9da5612100dedba302f3ebcfe (patch) | |
tree | 0bdabbf13844ae18da61bc060348850a8038f0ba /include/linux | |
parent | cf482a49af564a3044de3178ea28f10ad5921b38 (diff) | |
parent | e2a5be107f52cefb9010ccae6f569c3ddaa954cc (diff) | |
download | talos-op-linux-e0dccbdf5ac7ccb9da5612100dedba302f3ebcfe.tar.gz talos-op-linux-e0dccbdf5ac7ccb9da5612100dedba302f3ebcfe.zip |
Merge tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging / IIO driver updates from Greg KH:
"Here is the big staging and iio driver update for 5.2-rc1.
Lots of tiny fixes all over the staging and IIO driver trees here,
along with some new IIO drivers.
The "counter" subsystem was added in here as well, as it is needed by
the IIO drivers and subsystem.
Also we ended up deleting two drivers, making this pull request remove
a few hundred thousand lines of code, always a nice thing to see. Both
of the drivers removed have been replaced with "real" drivers in their
various subsystem directories, and they will be coming to you from
those locations during this merge window.
There are some core vt/selection changes in here, that was due to some
cleanups needed for the speakup fixes. Those have all been acked by
the various subsystem maintainers (i.e. me), so those are ok.
We also added a few new drivers, for some odd hardware, giving new
developers plenty to work on with basic coding style cleanups to come
in the near future.
Other than that, nothing unusual here.
All of these have been in linux-next for a while with no reported
issues, other than an odd gcc warning for one of the new drivers that
should be fixed up soon"
[ I fixed up the warning myself - Linus ]
* tag 'staging-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (663 commits)
staging: kpc2000: kpc_spi: Fix build error for {read,write}q
Staging: rtl8192e: Remove extra space before break statement
Staging: rtl8192u: ieee80211: Fix if-else indentation warning
Staging: rtl8192u: ieee80211: Fix indentation errors by removing extra spaces
staging: most: cdev: fix chrdev_region leak in mod_exit
staging: wlan-ng: Fix improper SPDX comment style
staging: rtl8192u: ieee80211: Resolve ERROR reported by checkpatch
staging: vc04_services: bcm2835-camera: Compress two lines into one line
staging: rtl8723bs: core: Use !x in place of NULL comparison.
staging: rtl8723bs: core: Prefer using the BIT Macro.
staging: fieldbus: anybus-s: fix wait_for_completion_timeout return handling
staging: kpc2000: fix up build problems with readq()
staging: rtlwifi: move remaining phydm .h files
staging: rtlwifi: strip down phydm .h files
staging: rtlwifi: delete the staging driver
staging: fieldbus: anybus-s: rename bus id field to avoid confusion
staging: fieldbus: anybus-s: keep device bus id in bus endianness
Staging: sm750fb: Change *array into *const array
staging: rtl8192u: ieee80211: Fix spelling mistake
staging: rtl8192u: ieee80211: Replace bit shifting with BIT macro
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/counter.h | 510 | ||||
-rw-r--r-- | include/linux/counter_enum.h | 45 | ||||
-rw-r--r-- | include/linux/fsl/ftm.h | 88 | ||||
-rw-r--r-- | include/linux/iio/adc/ad_sigma_delta.h | 1 | ||||
-rw-r--r-- | include/linux/iio/driver.h | 1 | ||||
-rw-r--r-- | include/linux/iio/frequency/ad9523.h | 8 | ||||
-rw-r--r-- | include/linux/iio/gyro/itg3200.h | 1 | ||||
-rw-r--r-- | include/linux/iio/iio.h | 4 | ||||
-rw-r--r-- | include/linux/iio/imu/adis.h | 14 | ||||
-rw-r--r-- | include/linux/iio/timer/stm32-timer-trigger.h | 11 | ||||
-rw-r--r-- | include/linux/selection.h | 7 |
11 files changed, 680 insertions, 10 deletions
diff --git a/include/linux/counter.h b/include/linux/counter.h new file mode 100644 index 000000000000..a061cdcdef7c --- /dev/null +++ b/include/linux/counter.h @@ -0,0 +1,510 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Counter interface + * Copyright (C) 2018 William Breathitt Gray + */ +#ifndef _COUNTER_H_ +#define _COUNTER_H_ + +#include <linux/counter_enum.h> +#include <linux/device.h> +#include <linux/types.h> + +enum counter_count_direction { + COUNTER_COUNT_DIRECTION_FORWARD = 0, + COUNTER_COUNT_DIRECTION_BACKWARD +}; +extern const char *const counter_count_direction_str[2]; + +enum counter_count_mode { + COUNTER_COUNT_MODE_NORMAL = 0, + COUNTER_COUNT_MODE_RANGE_LIMIT, + COUNTER_COUNT_MODE_NON_RECYCLE, + COUNTER_COUNT_MODE_MODULO_N +}; +extern const char *const counter_count_mode_str[4]; + +struct counter_device; +struct counter_signal; + +/** + * struct counter_signal_ext - Counter Signal extensions + * @name: attribute name + * @read: read callback for this attribute; may be NULL + * @write: write callback for this attribute; may be NULL + * @priv: data private to the driver + */ +struct counter_signal_ext { + const char *name; + ssize_t (*read)(struct counter_device *counter, + struct counter_signal *signal, void *priv, char *buf); + ssize_t (*write)(struct counter_device *counter, + struct counter_signal *signal, void *priv, + const char *buf, size_t len); + void *priv; +}; + +/** + * struct counter_signal - Counter Signal node + * @id: unique ID used to identify signal + * @name: device-specific Signal name; ideally, this should match the name + * as it appears in the datasheet documentation + * @ext: optional array of Counter Signal extensions + * @num_ext: number of Counter Signal extensions specified in @ext + * @priv: optional private data supplied by driver + */ +struct counter_signal { + int id; + const char *name; + + const struct counter_signal_ext *ext; + size_t num_ext; + + void *priv; +}; + +/** + * struct counter_signal_enum_ext - Signal enum extension attribute + * @items: Array of strings + * @num_items: Number of items specified in @items + * @set: Set callback function; may be NULL + * @get: Get callback function; may be NULL + * + * The counter_signal_enum_ext structure can be used to implement enum style + * Signal extension attributes. Enum style attributes are those which have a set + * of strings that map to unsigned integer values. The Generic Counter Signal + * enum extension helper code takes care of mapping between value and string, as + * well as generating a "_available" file which contains a list of all available + * items. The get callback is used to query the currently active item; the index + * of the item within the respective items array is returned via the 'item' + * parameter. The set callback is called when the attribute is updated; the + * 'item' parameter contains the index of the newly activated item within the + * respective items array. + */ +struct counter_signal_enum_ext { + const char * const *items; + size_t num_items; + int (*get)(struct counter_device *counter, + struct counter_signal *signal, size_t *item); + int (*set)(struct counter_device *counter, + struct counter_signal *signal, size_t item); +}; + +/** + * COUNTER_SIGNAL_ENUM() - Initialize Signal enum extension + * @_name: Attribute name + * @_e: Pointer to a counter_signal_enum_ext structure + * + * This should usually be used together with COUNTER_SIGNAL_ENUM_AVAILABLE() + */ +#define COUNTER_SIGNAL_ENUM(_name, _e) \ +{ \ + .name = (_name), \ + .read = counter_signal_enum_read, \ + .write = counter_signal_enum_write, \ + .priv = (_e) \ +} + +/** + * COUNTER_SIGNAL_ENUM_AVAILABLE() - Initialize Signal enum available extension + * @_name: Attribute name ("_available" will be appended to the name) + * @_e: Pointer to a counter_signal_enum_ext structure + * + * Creates a read only attribute that lists all the available enum items in a + * newline separated list. This should usually be used together with + * COUNTER_SIGNAL_ENUM() + */ +#define COUNTER_SIGNAL_ENUM_AVAILABLE(_name, _e) \ +{ \ + .name = (_name "_available"), \ + .read = counter_signal_enum_available_read, \ + .priv = (_e) \ +} + +enum counter_synapse_action { + COUNTER_SYNAPSE_ACTION_NONE = 0, + COUNTER_SYNAPSE_ACTION_RISING_EDGE, + COUNTER_SYNAPSE_ACTION_FALLING_EDGE, + COUNTER_SYNAPSE_ACTION_BOTH_EDGES +}; + +/** + * struct counter_synapse - Counter Synapse node + * @action: index of current action mode + * @actions_list: array of available action modes + * @num_actions: number of action modes specified in @actions_list + * @signal: pointer to associated signal + */ +struct counter_synapse { + size_t action; + const enum counter_synapse_action *actions_list; + size_t num_actions; + + struct counter_signal *signal; +}; + +struct counter_count; + +/** + * struct counter_count_ext - Counter Count extension + * @name: attribute name + * @read: read callback for this attribute; may be NULL + * @write: write callback for this attribute; may be NULL + * @priv: data private to the driver + */ +struct counter_count_ext { + const char *name; + ssize_t (*read)(struct counter_device *counter, + struct counter_count *count, void *priv, char *buf); + ssize_t (*write)(struct counter_device *counter, + struct counter_count *count, void *priv, + const char *buf, size_t len); + void *priv; +}; + +enum counter_count_function { + COUNTER_COUNT_FUNCTION_INCREASE = 0, + COUNTER_COUNT_FUNCTION_DECREASE, + COUNTER_COUNT_FUNCTION_PULSE_DIRECTION, + COUNTER_COUNT_FUNCTION_QUADRATURE_X1_A, + COUNTER_COUNT_FUNCTION_QUADRATURE_X1_B, + COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A, + COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B, + COUNTER_COUNT_FUNCTION_QUADRATURE_X4 +}; + +/** + * struct counter_count - Counter Count node + * @id: unique ID used to identify Count + * @name: device-specific Count name; ideally, this should match + * the name as it appears in the datasheet documentation + * @function: index of current function mode + * @functions_list: array available function modes + * @num_functions: number of function modes specified in @functions_list + * @synapses: array of synapses for initialization + * @num_synapses: number of synapses specified in @synapses + * @ext: optional array of Counter Count extensions + * @num_ext: number of Counter Count extensions specified in @ext + * @priv: optional private data supplied by driver + */ +struct counter_count { + int id; + const char *name; + + size_t function; + const enum counter_count_function *functions_list; + size_t num_functions; + + struct counter_synapse *synapses; + size_t num_synapses; + + const struct counter_count_ext *ext; + size_t num_ext; + + void *priv; +}; + +/** + * struct counter_count_enum_ext - Count enum extension attribute + * @items: Array of strings + * @num_items: Number of items specified in @items + * @set: Set callback function; may be NULL + * @get: Get callback function; may be NULL + * + * The counter_count_enum_ext structure can be used to implement enum style + * Count extension attributes. Enum style attributes are those which have a set + * of strings that map to unsigned integer values. The Generic Counter Count + * enum extension helper code takes care of mapping between value and string, as + * well as generating a "_available" file which contains a list of all available + * items. The get callback is used to query the currently active item; the index + * of the item within the respective items array is returned via the 'item' + * parameter. The set callback is called when the attribute is updated; the + * 'item' parameter contains the index of the newly activated item within the + * respective items array. + */ +struct counter_count_enum_ext { + const char * const *items; + size_t num_items; + int (*get)(struct counter_device *counter, struct counter_count *count, + size_t *item); + int (*set)(struct counter_device *counter, struct counter_count *count, + size_t item); +}; + +/** + * COUNTER_COUNT_ENUM() - Initialize Count enum extension + * @_name: Attribute name + * @_e: Pointer to a counter_count_enum_ext structure + * + * This should usually be used together with COUNTER_COUNT_ENUM_AVAILABLE() + */ +#define COUNTER_COUNT_ENUM(_name, _e) \ +{ \ + .name = (_name), \ + .read = counter_count_enum_read, \ + .write = counter_count_enum_write, \ + .priv = (_e) \ +} + +/** + * COUNTER_COUNT_ENUM_AVAILABLE() - Initialize Count enum available extension + * @_name: Attribute name ("_available" will be appended to the name) + * @_e: Pointer to a counter_count_enum_ext structure + * + * Creates a read only attribute that lists all the available enum items in a + * newline separated list. This should usually be used together with + * COUNTER_COUNT_ENUM() + */ +#define COUNTER_COUNT_ENUM_AVAILABLE(_name, _e) \ +{ \ + .name = (_name "_available"), \ + .read = counter_count_enum_available_read, \ + .priv = (_e) \ +} + +/** + * struct counter_device_attr_group - internal container for attribute group + * @attr_group: Counter sysfs attributes group + * @attr_list: list to keep track of created Counter sysfs attributes + * @num_attr: number of Counter sysfs attributes + */ +struct counter_device_attr_group { + struct attribute_group attr_group; + struct list_head attr_list; + size_t num_attr; +}; + +/** + * struct counter_device_state - internal state container for a Counter device + * @id: unique ID used to identify the Counter + * @dev: internal device structure + * @groups_list: attribute groups list (for Signals, Counts, and ext) + * @num_groups: number of attribute groups containers + * @groups: Counter sysfs attribute groups (to populate @dev.groups) + */ +struct counter_device_state { + int id; + struct device dev; + struct counter_device_attr_group *groups_list; + size_t num_groups; + const struct attribute_group **groups; +}; + +/** + * struct counter_signal_read_value - Opaque Signal read value + * @buf: string representation of Signal read value + * @len: length of string in @buf + */ +struct counter_signal_read_value { + char *buf; + size_t len; +}; + +/** + * struct counter_count_read_value - Opaque Count read value + * @buf: string representation of Count read value + * @len: length of string in @buf + */ +struct counter_count_read_value { + char *buf; + size_t len; +}; + +/** + * struct counter_count_write_value - Opaque Count write value + * @buf: string representation of Count write value + */ +struct counter_count_write_value { + const char *buf; +}; + +/** + * struct counter_ops - Callbacks from driver + * @signal_read: optional read callback for Signal attribute. The read + * value of the respective Signal should be passed back via + * the val parameter. val points to an opaque type which + * should be set only by calling the + * counter_signal_read_value_set function from within the + * signal_read callback. + * @count_read: optional read callback for Count attribute. The read + * value of the respective Count should be passed back via + * the val parameter. val points to an opaque type which + * should be set only by calling the + * counter_count_read_value_set function from within the + * count_read callback. + * @count_write: optional write callback for Count attribute. The write + * value for the respective Count is passed in via the val + * parameter. val points to an opaque type which should be + * accessed only by calling the + * counter_count_write_value_get function. + * @function_get: function to get the current count function mode. Returns + * 0 on success and negative error code on error. The index + * of the respective Count's returned function mode should + * be passed back via the function parameter. + * @function_set: function to set the count function mode. function is the + * index of the requested function mode from the respective + * Count's functions_list array. + * @action_get: function to get the current action mode. Returns 0 on + * success and negative error code on error. The index of + * the respective Signal's returned action mode should be + * passed back via the action parameter. + * @action_set: function to set the action mode. action is the index of + * the requested action mode from the respective Synapse's + * actions_list array. + */ +struct counter_ops { + int (*signal_read)(struct counter_device *counter, + struct counter_signal *signal, + struct counter_signal_read_value *val); + int (*count_read)(struct counter_device *counter, + struct counter_count *count, + struct counter_count_read_value *val); + int (*count_write)(struct counter_device *counter, + struct counter_count *count, + struct counter_count_write_value *val); + int (*function_get)(struct counter_device *counter, + struct counter_count *count, size_t *function); + int (*function_set)(struct counter_device *counter, + struct counter_count *count, size_t function); + int (*action_get)(struct counter_device *counter, + struct counter_count *count, + struct counter_synapse *synapse, size_t *action); + int (*action_set)(struct counter_device *counter, + struct counter_count *count, + struct counter_synapse *synapse, size_t action); +}; + +/** + * struct counter_device_ext - Counter device extension + * @name: attribute name + * @read: read callback for this attribute; may be NULL + * @write: write callback for this attribute; may be NULL + * @priv: data private to the driver + */ +struct counter_device_ext { + const char *name; + ssize_t (*read)(struct counter_device *counter, void *priv, char *buf); + ssize_t (*write)(struct counter_device *counter, void *priv, + const char *buf, size_t len); + void *priv; +}; + +/** + * struct counter_device_enum_ext - Counter enum extension attribute + * @items: Array of strings + * @num_items: Number of items specified in @items + * @set: Set callback function; may be NULL + * @get: Get callback function; may be NULL + * + * The counter_device_enum_ext structure can be used to implement enum style + * Counter extension attributes. Enum style attributes are those which have a + * set of strings that map to unsigned integer values. The Generic Counter enum + * extension helper code takes care of mapping between value and string, as well + * as generating a "_available" file which contains a list of all available + * items. The get callback is used to query the currently active item; the index + * of the item within the respective items array is returned via the 'item' + * parameter. The set callback is called when the attribute is updated; the + * 'item' parameter contains the index of the newly activated item within the + * respective items array. + */ +struct counter_device_enum_ext { + const char * const *items; + size_t num_items; + int (*get)(struct counter_device *counter, size_t *item); + int (*set)(struct counter_device *counter, size_t item); +}; + +/** + * COUNTER_DEVICE_ENUM() - Initialize Counter enum extension + * @_name: Attribute name + * @_e: Pointer to a counter_device_enum_ext structure + * + * This should usually be used together with COUNTER_DEVICE_ENUM_AVAILABLE() + */ +#define COUNTER_DEVICE_ENUM(_name, _e) \ +{ \ + .name = (_name), \ + .read = counter_device_enum_read, \ + .write = counter_device_enum_write, \ + .priv = (_e) \ +} + +/** + * COUNTER_DEVICE_ENUM_AVAILABLE() - Initialize Counter enum available extension + * @_name: Attribute name ("_available" will be appended to the name) + * @_e: Pointer to a counter_device_enum_ext structure + * + * Creates a read only attribute that lists all the available enum items in a + * newline separated list. This should usually be used together with + * COUNTER_DEVICE_ENUM() + */ +#define COUNTER_DEVICE_ENUM_AVAILABLE(_name, _e) \ +{ \ + .name = (_name "_available"), \ + .read = counter_device_enum_available_read, \ + .priv = (_e) \ +} + +/** + * struct counter_device - Counter data structure + * @name: name of the device as it appears in the datasheet + * @parent: optional parent device providing the counters + * @device_state: internal device state container + * @ops: callbacks from driver + * @signals: array of Signals + * @num_signals: number of Signals specified in @signals + * @counts: array of Counts + * @num_counts: number of Counts specified in @counts + * @ext: optional array of Counter device extensions + * @num_ext: number of Counter device extensions specified in @ext + * @priv: optional private data supplied by driver + */ +struct counter_device { + const char *name; + struct device *parent; + struct counter_device_state *device_state; + + const struct counter_ops *ops; + + struct counter_signal *signals; + size_t num_signals; + struct counter_count *counts; + size_t num_counts; + + const struct counter_device_ext *ext; + size_t num_ext; + + void *priv; +}; + +enum counter_signal_level { + COUNTER_SIGNAL_LEVEL_LOW = 0, + COUNTER_SIGNAL_LEVEL_HIGH +}; + +enum counter_signal_value_type { + COUNTER_SIGNAL_LEVEL = 0 +}; + +enum counter_count_value_type { + COUNTER_COUNT_POSITION = 0, +}; + +void counter_signal_read_value_set(struct counter_signal_read_value *const val, + const enum counter_signal_value_type type, + void *const data); +void counter_count_read_value_set(struct counter_count_read_value *const val, + const enum counter_count_value_type type, + void *const data); +int counter_count_write_value_get(void *const data, + const enum counter_count_value_type type, + const struct counter_count_write_value *const val); + +int counter_register(struct counter_device *const counter); +void counter_unregister(struct counter_device *const counter); +int devm_counter_register(struct device *dev, + struct counter_device *const counter); +void devm_counter_unregister(struct device *dev, + struct counter_device *const counter); + +#endif /* _COUNTER_H_ */ diff --git a/include/linux/counter_enum.h b/include/linux/counter_enum.h new file mode 100644 index 000000000000..9f917298a88f --- /dev/null +++ b/include/linux/counter_enum.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Counter interface enum functions + * Copyright (C) 2018 William Breathitt Gray + */ +#ifndef _COUNTER_ENUM_H_ +#define _COUNTER_ENUM_H_ + +#include <linux/types.h> + +struct counter_device; +struct counter_signal; +struct counter_count; + +ssize_t counter_signal_enum_read(struct counter_device *counter, + struct counter_signal *signal, void *priv, + char *buf); +ssize_t counter_signal_enum_write(struct counter_device *counter, + struct counter_signal *signal, void *priv, + const char *buf, size_t len); + +ssize_t counter_signal_enum_available_read(struct counter_device *counter, + struct counter_signal *signal, + void *priv, char *buf); + +ssize_t counter_count_enum_read(struct counter_device *counter, + struct counter_count *count, void *priv, + char *buf); +ssize_t counter_count_enum_write(struct counter_device *counter, + struct counter_count *count, void *priv, + const char *buf, size_t len); + +ssize_t counter_count_enum_available_read(struct counter_device *counter, + struct counter_count *count, + void *priv, char *buf); + +ssize_t counter_device_enum_read(struct counter_device *counter, void *priv, + char *buf); +ssize_t counter_device_enum_write(struct counter_device *counter, void *priv, + const char *buf, size_t len); + +ssize_t counter_device_enum_available_read(struct counter_device *counter, + void *priv, char *buf); + +#endif /* _COUNTER_ENUM_H_ */ diff --git a/include/linux/fsl/ftm.h b/include/linux/fsl/ftm.h new file mode 100644 index 000000000000..d59011acf66c --- /dev/null +++ b/include/linux/fsl/ftm.h @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef __FSL_FTM_H__ +#define __FSL_FTM_H__ + +#define FTM_SC 0x0 /* Status And Control */ +#define FTM_CNT 0x4 /* Counter */ +#define FTM_MOD 0x8 /* Modulo */ + +#define FTM_CNTIN 0x4C /* Counter Initial Value */ +#define FTM_STATUS 0x50 /* Capture And Compare Status */ +#define FTM_MODE 0x54 /* Features Mode Selection */ +#define FTM_SYNC 0x58 /* Synchronization */ +#define FTM_OUTINIT 0x5C /* Initial State For Channels Output */ +#define FTM_OUTMASK 0x60 /* Output Mask */ +#define FTM_COMBINE 0x64 /* Function For Linked Channels */ +#define FTM_DEADTIME 0x68 /* Deadtime Insertion Control */ +#define FTM_EXTTRIG 0x6C /* FTM External Trigger */ +#define FTM_POL 0x70 /* Channels Polarity */ +#define FTM_FMS 0x74 /* Fault Mode Status */ +#define FTM_FILTER 0x78 /* Input Capture Filter Control */ +#define FTM_FLTCTRL 0x7C /* Fault Control */ +#define FTM_QDCTRL 0x80 /* Quadrature Decoder Control And Status */ +#define FTM_CONF 0x84 /* Configuration */ +#define FTM_FLTPOL 0x88 /* FTM Fault Input Polarity */ +#define FTM_SYNCONF 0x8C /* Synchronization Configuration */ +#define FTM_INVCTRL 0x90 /* FTM Inverting Control */ +#define FTM_SWOCTRL 0x94 /* FTM Software Output Control */ +#define FTM_PWMLOAD 0x98 /* FTM PWM Load */ + +#define FTM_SC_CLK_MASK_SHIFT 3 +#define FTM_SC_CLK_MASK (3 << FTM_SC_CLK_MASK_SHIFT) +#define FTM_SC_TOF 0x80 +#define FTM_SC_TOIE 0x40 +#define FTM_SC_CPWMS 0x20 +#define FTM_SC_CLKS 0x18 +#define FTM_SC_PS_1 0x0 +#define FTM_SC_PS_2 0x1 +#define FTM_SC_PS_4 0x2 +#define FTM_SC_PS_8 0x3 +#define FTM_SC_PS_16 0x4 +#define FTM_SC_PS_32 0x5 +#define FTM_SC_PS_64 0x6 +#define FTM_SC_PS_128 0x7 +#define FTM_SC_PS_MASK 0x7 + +#define FTM_MODE_FAULTIE 0x80 +#define FTM_MODE_FAULTM 0x60 +#define FTM_MODE_CAPTEST 0x10 +#define FTM_MODE_PWMSYNC 0x8 +#define FTM_MODE_WPDIS 0x4 +#define FTM_MODE_INIT 0x2 +#define FTM_MODE_FTMEN 0x1 + +/* NXP Errata: The PHAFLTREN and PHBFLTREN bits are tide to zero internally + * and these bits cannot be set. Flextimer cannot use Filter in + * Quadrature Decoder Mode. + * https://community.nxp.com/thread/467648#comment-1010319 + */ +#define FTM_QDCTRL_PHAFLTREN 0x80 +#define FTM_QDCTRL_PHBFLTREN 0x40 +#define FTM_QDCTRL_PHAPOL 0x20 +#define FTM_QDCTRL_PHBPOL 0x10 +#define FTM_QDCTRL_QUADMODE 0x8 +#define FTM_QDCTRL_QUADDIR 0x4 +#define FTM_QDCTRL_TOFDIR 0x2 +#define FTM_QDCTRL_QUADEN 0x1 + +#define FTM_FMS_FAULTF 0x80 +#define FTM_FMS_WPEN 0x40 +#define FTM_FMS_FAULTIN 0x10 +#define FTM_FMS_FAULTF3 0x8 +#define FTM_FMS_FAULTF2 0x4 +#define FTM_FMS_FAULTF1 0x2 +#define FTM_FMS_FAULTF0 0x1 + +#define FTM_CSC_BASE 0xC +#define FTM_CSC_MSB 0x20 +#define FTM_CSC_MSA 0x10 +#define FTM_CSC_ELSB 0x8 +#define FTM_CSC_ELSA 0x4 +#define FTM_CSC(_channel) (FTM_CSC_BASE + ((_channel) * 8)) + +#define FTM_CV_BASE 0x10 +#define FTM_CV(_channel) (FTM_CV_BASE + ((_channel) * 8)) + +#define FTM_PS_MAX 7 + +#endif diff --git a/include/linux/iio/adc/ad_sigma_delta.h b/include/linux/iio/adc/ad_sigma_delta.h index 7e84351fa2c0..6e9fb1932dde 100644 --- a/include/linux/iio/adc/ad_sigma_delta.h +++ b/include/linux/iio/adc/ad_sigma_delta.h @@ -69,6 +69,7 @@ struct ad_sigma_delta { bool irq_dis; bool bus_locked; + bool keep_cs_asserted; uint8_t comm; diff --git a/include/linux/iio/driver.h b/include/linux/iio/driver.h index 7dfb10ee2669..f54a7bcdefe3 100644 --- a/include/linux/iio/driver.h +++ b/include/linux/iio/driver.h @@ -11,6 +11,7 @@ #ifndef _IIO_INKERN_H_ #define _IIO_INKERN_H_ +struct iio_dev; struct iio_map; /** diff --git a/include/linux/iio/frequency/ad9523.h b/include/linux/iio/frequency/ad9523.h index 12ce3ee427fd..621b93c0bcf9 100644 --- a/include/linux/iio/frequency/ad9523.h +++ b/include/linux/iio/frequency/ad9523.h @@ -129,8 +129,8 @@ enum cpole1_capacitor { * @pll2_ndiv_b_cnt: PLL2 Feedback N-divider, B Counter, range 0..63. * @pll2_freq_doubler_en: PLL2 frequency doubler enable. * @pll2_r2_div: PLL2 R2 divider, range 0..31. - * @pll2_vco_diff_m1: VCO1 divider, range 3..5. - * @pll2_vco_diff_m2: VCO2 divider, range 3..5. + * @pll2_vco_div_m1: VCO1 divider, range 3..5. + * @pll2_vco_div_m2: VCO2 divider, range 3..5. * @rpole2: PLL2 loop filter Rpole resistor value. * @rzero: PLL2 loop filter Rzero resistor value. * @cpole1: PLL2 loop filter Cpole capacitor value. @@ -176,8 +176,8 @@ struct ad9523_platform_data { unsigned char pll2_ndiv_b_cnt; bool pll2_freq_doubler_en; unsigned char pll2_r2_div; - unsigned char pll2_vco_diff_m1; /* 3..5 */ - unsigned char pll2_vco_diff_m2; /* 3..5 */ + unsigned char pll2_vco_div_m1; /* 3..5 */ + unsigned char pll2_vco_div_m2; /* 3..5 */ /* Loop Filter PLL2 */ enum rpole2_resistor rpole2; diff --git a/include/linux/iio/gyro/itg3200.h b/include/linux/iio/gyro/itg3200.h index 2a820850f284..0a30fddccfb3 100644 --- a/include/linux/iio/gyro/itg3200.h +++ b/include/linux/iio/gyro/itg3200.h @@ -104,6 +104,7 @@ struct itg3200 { struct i2c_client *i2c; struct iio_trigger *trig; + struct iio_mount_matrix orientation; }; enum ITG3200_SCAN_INDEX { diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h index a74cb177dc6f..bb10c1bee301 100644 --- a/include/linux/iio/iio.h +++ b/include/linux/iio/iio.h @@ -130,8 +130,8 @@ struct iio_mount_matrix { ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv, const struct iio_chan_spec *chan, char *buf); -int of_iio_read_mount_matrix(const struct device *dev, const char *propname, - struct iio_mount_matrix *matrix); +int iio_read_mount_matrix(struct device *dev, const char *propname, + struct iio_mount_matrix *matrix); typedef const struct iio_mount_matrix * (iio_get_mount_matrix_t)(const struct iio_dev *indio_dev, diff --git a/include/linux/iio/imu/adis.h b/include/linux/iio/imu/adis.h index 360da7d18a3d..469a493f7ae0 100644 --- a/include/linux/iio/imu/adis.h +++ b/include/linux/iio/imu/adis.h @@ -21,6 +21,7 @@ #define ADIS_REG_PAGE_ID 0x00 struct adis; +struct adis_burst; /** * struct adis_data - ADIS chip variant specific data @@ -57,6 +58,7 @@ struct adis { struct iio_trigger *trig; const struct adis_data *data; + struct adis_burst *burst; struct mutex txrx_lock; struct spi_message msg; @@ -232,6 +234,18 @@ int adis_single_conversion(struct iio_dev *indio_dev, #ifdef CONFIG_IIO_ADIS_LIB_BUFFER +/** + * struct adis_burst - ADIS data for burst transfers + * @en burst mode enabled + * @reg_cmd register command that triggers burst + * @extra_len extra length to account in the SPI RX buffer + */ +struct adis_burst { + bool en; + unsigned int reg_cmd; + unsigned int extra_len; +}; + int adis_setup_buffer_and_trigger(struct adis *adis, struct iio_dev *indio_dev, irqreturn_t (*trigger_handler)(int, void *)); void adis_cleanup_buffer_and_trigger(struct adis *adis, diff --git a/include/linux/iio/timer/stm32-timer-trigger.h b/include/linux/iio/timer/stm32-timer-trigger.h index d68add80ab86..cbb7c7ae6c0c 100644 --- a/include/linux/iio/timer/stm32-timer-trigger.h +++ b/include/linux/iio/timer/stm32-timer-trigger.h @@ -73,6 +73,15 @@ #define TIM17_OC1 "tim17_oc1" +#if IS_REACHABLE(CONFIG_IIO_STM32_TIMER_TRIGGER) bool is_stm32_timer_trigger(struct iio_trigger *trig); - +#else +static inline bool is_stm32_timer_trigger(struct iio_trigger *trig) +{ +#if IS_ENABLED(CONFIG_IIO_STM32_TIMER_TRIGGER) + pr_warn_once("stm32-timer-trigger not linked in\n"); +#endif + return false; +} +#endif #endif diff --git a/include/linux/selection.h b/include/linux/selection.h index a8f5b97b216f..e2c1f96bf059 100644 --- a/include/linux/selection.h +++ b/include/linux/selection.h @@ -11,13 +11,14 @@ #include <linux/tiocl.h> #include <linux/vt_buffer.h> -struct tty_struct; - extern struct vc_data *sel_cons; struct tty_struct; extern void clear_selection(void); -extern int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty); +extern int set_selection_user(const struct tiocl_selection __user *sel, + struct tty_struct *tty); +extern int set_selection_kernel(struct tiocl_selection *v, + struct tty_struct *tty); extern int paste_selection(struct tty_struct *tty); extern int sel_loadlut(char __user *p); extern int mouse_reporting(void); |