summaryrefslogtreecommitdiff
path: root/drivers/staging
AgeCommit message (Collapse)Author
2021-03-25staging: iio: ad9832: kernel-doc fixesMugilraj Dhavachelvan
Fixes a W=1 warning. -Added ``:`` to lock parameter in 'ad9832_state' description. -It's a reference comment so removed /** Signed-off-by: Mugilraj Dhavachelvan <dmugil2000@gmail.com> Link: https://lore.kernel.org/r/20210315133711.26860-1-dmugil2000@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-25staging: iio: ad9834: convert to device-managed functions in probeAlexandru Ardelean
This change converts the driver to use device-managed functions in the probe function. For the clock and regulator disable, some devm_add_action_or_reset() calls are required, and then devm_iio_device_register() function can be used register the IIO device. The final aim here would be for IIO to export only the device-managed functions of it's API. That's a long way to go and this a small step in that direction. Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210310095131.47476-1-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-25staging: iio: remove mention of defunct listBaruch Siach
The ADI device-drivers-devel list no longer exists. Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Link: https://lore.kernel.org/r/69b3e45e7666a1dd74a83df0b84ef8a63bf090ea.1614082343.git.baruch@tkos.co.il Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11iio: make use of devm_iio_kfifo_buffer_setup() helperAlexandru Ardelean
All drivers that already call devm_iio_kfifo_allocate() & iio_device_attach_buffer() are simple to convert to iio_device_attach_kfifo_buffer() in a single go. This change does that; the unwind order is preserved. What is important, is that the devm_iio_kfifo_buffer_setup() be called after the indio_dev->modes is assigned, to make sure that INDIO_BUFFER_SOFTWARE flag is set and not overridden by the assignment to indio_dev->modes. Also, the INDIO_BUFFER_SOFTWARE has been removed from the assignments of 'indio_dev->modes' because it is set by devm_iio_kfifo_buffer_setup(). Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>x Link: https://lore.kernel.org/r/20210215104043.91251-4-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-10staging: unisys: visornic: Fix repeated words in commentsKlemen Košir
This patch removes some repeated words in code comments. Signed-off-by: Klemen Košir <klemen.kosir@kream.io> Link: https://lore.kernel.org/r/20210303090134.16007-1-klemen.kosir@kream.io Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: unisys: visornic: enhance visornic to use channel_interruptSong Chen
visornic uses timer to check the response queue and drain it if needed periodically. On the other hand, visorbus provides periodic work to serve such request, therefore, timer should be replaced by channel_interrupt. Signed-off-by: Song Chen <chensong_2000@189.cn> Link: https://lore.kernel.org/r/1610439940-5590-1-git-send-email-chensong_2000@189.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging/greybus: eliminate use of NAME_SIZE for stringsKumar Kartikeya Dwivedi
Instead, depend on the size of the destination buffer for easier refactoring. Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com> Link: https://lore.kernel.org/r/20210221154258.119503-1-memxor@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8188eu: Replace one-element array with flexible-array in struct ↵Gustavo A. R. Silva
ndis_802_11_var_ie There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2]. Use flexible-array member in struct ndis_802_11_var_ie, instead of one-element array. Also, this helps with the ongoing efforts to enable -Warray-bounds by fixing the following warning: drivers/staging/rtl8188eu/core/rtw_wlan_util.c: In function ‘HT_caps_handler’: drivers/staging/rtl8188eu/core/rtw_wlan_util.c:665:65: warning: array subscript 2 is above array bounds of ‘u8[1]’ {aka ‘unsigned char[1]’} [-Warray-bounds] 665 | if ((pmlmeinfo->HT_caps.ampdu_params_info & 0x3) > (pIE->data[i] & 0x3)) | ~~~~~~~~~^~~ [1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/109 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://lore.kernel.org/r/20210304020228.GA45139@embeddedor Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: HalBtc8723b1Ant: remove useless typedef'sMarco Cesati
This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #24: FILE: hal/HalBtc8723b1Ant.h:24: +typedef enum _BT_INFO_SRC_8723B_1ANT { WARNING: do not add new typedefs #31: FILE: hal/HalBtc8723b1Ant.h:31: +typedef enum _BT_8723B_1ANT_BT_STATUS { WARNING: do not add new typedefs #41: FILE: hal/HalBtc8723b1Ant.h:41: +typedef enum _BT_8723B_1ANT_WIFI_STATUS { WARNING: do not add new typedefs #51: FILE: hal/HalBtc8723b1Ant.h:51: +typedef enum _BT_8723B_1ANT_COEX_ALGO { WARNING: do not add new typedefs #66: FILE: hal/HalBtc8723b1Ant.h:66: +typedef struct _COEX_DM_8723B_1ANT { WARNING: do not add new typedefs #121: FILE: hal/HalBtc8723b1Ant.h:121: +typedef struct _COEX_STA_8723B_1ANT { Signed-off-by: Marco Cesati <marco.cesati@gmail.com> Link: https://lore.kernel.org/r/20210305100146.30687-1-marco.cesati@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: HalBtc8723b2Ant: remove useless typedef'sMarco Cesati
This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #19: FILE: hal/HalBtc8723b2Ant.h:19: +typedef enum _BT_INFO_SRC_8723B_2ANT { WARNING: do not add new typedefs #26: FILE: hal/HalBtc8723b2Ant.h:26: +typedef enum _BT_8723B_2ANT_BT_STATUS { WARNING: do not add new typedefs #36: FILE: hal/HalBtc8723b2Ant.h:36: +typedef enum _BT_8723B_2ANT_COEX_ALGO { WARNING: do not add new typedefs #51: FILE: hal/HalBtc8723b2Ant.h:51: +typedef struct _COEX_DM_8723B_2ANT { WARNING: do not add new typedefs #104: FILE: hal/HalBtc8723b2Ant.h:104: +typedef struct _COEX_STA_8723B_2ANT { Signed-off-by: Marco Cesati <marco.cesati@gmail.com> Link: https://lore.kernel.org/r/20210305101151.13137-1-marco.cesati@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8723bs: remove duplicate pstat->hwaddr checkDenis Efremov
IS_MCAST(pstat->hwaddr) checked twice in a row in odm_RefreshRateAdaptiveMaskCE(). Remove the second check. Signed-off-by: Denis Efremov <efremov@linux.com> Link: https://lore.kernel.org/r/20210305155001.61951-1-efremov@linux.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8723bs: remove useless typedef's in HalPhyRf.hMarco Cesati
This commit fixes the following checkpatch.pl warnings: WARNING: do not add new typedefs #11: FILE: hal/HalPhyRf.h:11: +typedef enum _SPUR_CAL_METHOD { WARNING: do not add new typedefs #16: FILE: hal/HalPhyRf.h:16: +typedef enum _PWRTRACK_CONTROL_METHOD { WARNING: do not add new typedefs #27: FILE: hal/HalPhyRf.h:27: +typedef struct _TXPWRTRACK_CFG { Signed-off-by: Marco Cesati <marco.cesati@gmail.com> Link: https://lore.kernel.org/r/20210305144906.18850-1-marco.cesati@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8723bs: removed unused code blockFabio Aiuto
Removed conditional code block checked by unused CONFIG_TX_BCAST2UNI This patch does the cleaning required in TODO file: find and remove code blocks guarded by never set CONFIG_FOO defines Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com> Link: https://lore.kernel.org/r/20210305191713.GA2466@agape.jhs Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8188eu: rename parameters of odm_phy_status_query()Michael Straube
Rename parameters of odm_phy_status_query() to avoid camel case. pDM_Odm -> dm_odm pPhyInfo -> phy_info pPhyStatus -> phy_status pPktinfo -> pkt_info Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210306081133.1272-2-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8188eu: rename ODM_PhyStatusQuery()Michael Straube
Rename ODM_PhyStatusQuery() to odm_phy_status_query() to avoid camel case. Signed-off-by: Michael Straube <straube.linux@gmail.com> Link: https://lore.kernel.org/r/20210306081133.1272-1-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: vc04_services: vchiq_arm: fix error return code of ↵Jia-Ju Bai
vchiq_release_internal() and vchiq_use_internal() When arm_state is NULL, no error return code of vchiq_release_internal() and vchiq_use_internal() is assigned. To fix this bug, ret is assigned with VCHIQ_ERROR. Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Link: https://lore.kernel.org/r/20210306132245.16811-1-baijiaju1990@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: ralink-gdma: Check return code of device_resetGiovanni Gherdovich
The device_reset() function is marked as "__must_check", thus the static analysis tool "sparse" complains that in ralink-gdma its return value is ignored. Log a warning in case it returns an error. Signed-off-by: Giovanni Gherdovich <bobdc9664@seznam.cz> Link: https://lore.kernel.org/r/20210306141322.7516-1-bobdc9664@seznam.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: wimax: i2400m: fix some incorrect type warningsDarryl T. Agostinelli
Fix some "incorrect type in assignment" warnings reported by sparse in fw.c sparse warnings: wimax/i2400m/fw.c:266:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:266:25: warning: incorrect type in assignment (different base types) wimax/i2400m/fw.c:267:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:267:25: warning: incorrect type in assignment (different base types) wimax/i2400m/fw.c:268:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:268:25: warning: incorrect type in assignment (different base types) wimax/i2400m/fw.c:269:27: warning: cast to restricted __le32 wimax/i2400m/fw.c:269:25: warning: incorrect type in assignment (different base types) Signed-off-by: Darryl T. Agostinelli <dagostinelli@gmail.com> Link: https://lore.kernel.org/r/20210308144839.2364329-1-dagostinelli@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: wimax/i2400m: convert __le32 type to host byte-orderkarthik alapati
fix sparse type warning by converting __le32 types to host byte-order types before comparison Signed-off-by: karthik alapati <mail@karthek.com> Link: https://lore.kernel.org/r/87f93e091f736cb422f1d557fa5a2ac752f057a8.1613921277.git.mail@karthek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: wimax/i2400m: fix byte-order issuekarthik alapati
fix sparse byte-order warnings by converting host byte-order type to __le16 byte-order types before assigning to hdr.length Signed-off-by: karthik alapati <mail@karthek.com> Link: https://lore.kernel.org/r/0ae5c5c4c646506d8be871e7be5705542671a1d5.1613921277.git.mail@karthek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: remove redundant variable shadowingNikolay Kyx
In function rtl92e_start_adapter() automatic variable 'i' referenced only within certain loops, used as iteration counter. Control flow can't get into such loop w/o 'i = 0' assignment. It's redundant to shadow this variable by creating scope around loop. This patch fixes the following sparse warning: warning: symbol 'i' shadows an earlier one Signed-off-by: Nikolay Kyx <knv418@gmail.com> Link: https://lore.kernel.org/r/20210302133217.145994-1-knv418@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: reformat rx_ts_record structWilliam Durand
This change uses a space instead of tabs between the type and name of each member of the struct. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-10-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxLastFragNum to rx_last_frag_num in rx_ts_record ↵William Durand
struct Rename RxLastFragNum to rx_last_frag_num to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-9-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxLastSeqNum to rx_last_seq_num in rx_ts_record structWilliam Durand
Rename RxLastSeqNum to rx_last_seq_num to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-8-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxAdmittedBARecord to rx_admitted_ba_record in ↵William Durand
rx_ts_record struct Rename RxAdmittedBARecord to rx_admitted_ba_record to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-7-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxPktPendingTimer to rx_pkt_pending_timer in ↵William Durand
rx_ts_record struct Rename RxPktPendingTimer to rx_pkt_pending_timer to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-6-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxPendingPktList to rx_pending_pkt_list in ↵William Durand
rx_ts_record struct Rename RxPendingPktList to rx_pending_pkt_list to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-5-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq in ↵William Durand
rx_ts_record struct Rename RxTimeoutIndicateSeq to rx_timeout_indicate_seq to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-4-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename RxIndicateSeq to rx_indicate_seq in rx_ts_record ↵William Durand
struct Rename RxIndicateSeq to rx_indicate_seq to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-3-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8192e: rename TsCommonInfo to ts_common_info in rx_ts_record structWilliam Durand
Rename TsCommonInfo to ts_common_info to silence a checkpatch warning about CamelCase. Signed-off-by: William Durand <will+git@drnd.me> Link: https://lore.kernel.org/r/20210301215335.767-2-will+git@drnd.me Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8723bs: os_dep: Replace sprintf with scnprintfCandy Febriyanto
The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. In one block of the translate_scan function sprintf is only called once (it's not being used to concatenate strings) so there is no need to keep the pointer "p", remove it. Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Candy Febriyanto <cfebriyanto@gmail.com> Link: https://lore.kernel.org/r/d76c5f1db8dbf02ac0ab954b0971ce24e5a8b9bd.1614610197.git.cfebriyanto@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8723bs: hal: Replace sprintf with scnprintfCandy Febriyanto
The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. Also avoid unnecessarily passing "%s" on some of the function calls. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Candy Febriyanto <cfebriyanto@gmail.com> Link: https://lore.kernel.org/r/ed564fb9e325f757b2b937df37689d40b96d8831.1614610197.git.cfebriyanto@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: rtl8723bs: core: Replace sprintf with scnprintfCandy Febriyanto
The use of sprintf with format string here means that there is a risk that the writes will go out of bounds, replace it with scnprintf. In on_action_public_default the variable "cnt" isn't being used for anything meaningful so remove it. Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Candy Febriyanto <cfebriyanto@gmail.com> Link: https://lore.kernel.org/r/6c260641164d6856fc4447555fe739124cb27c19.1614610197.git.cfebriyanto@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: replace cap_* definitions with native kernel WLAN_CAPABILITY_*Ivan Safonov
cap_* definitions duplicate WLAN_CAPABILITY_*. Remove cap_* definitions, improve code consistency. Reviewed-by: Mike Ximing Chen <mike.ximing.chen@intel.com> Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-5-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: use IEEE80211_FCTL_* kernel definitionsIvan Safonov
_TO_DS_, _FROM_DS_, _MORE_FRAG_, _RETRY_, _PWRMGT_, _MORE_DATA_, _PRIVACY_, _ORDER_ definitions are duplicate IEEE80211_FCTL_* kernel definitions. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-4-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: remove unused definitions from wifi.hIvan Safonov
These definitions are not used and will not be useful in the future. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-3-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging:rtl8712: replace get_(d|s)a with ieee80211_get_(D|S)AIvan Safonov
get_da()/get_sa() duplicate native ieee80211_get_(D|S)A functions. Remove get_(d|s)a, use ieee80211_get_(D|S)A instead. Signed-off-by: Ivan Safonov <insafonov@gmail.com> Link: https://lore.kernel.org/r/20210227222236.581490-2-insafonov@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: fwserial: minor coding style fixLee Gibson
Fixes this checkpatch warning WARNING: Integer promotion: Using 'h' in '%04hx' is unnecessary Signed-off-by: Lee Gibson <leegib@gmail.com> Link: https://lore.kernel.org/r/20210226114800.316897-1-leegib@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: dt2814: Clear stale AI data on detachIan Abbott
When the Comedi "detach" handler is called, it is possible that an extra A/D conversion (triggered during termination of a Comedi asynchronous command) is still in progress. In that case, the FINISH bit in the Status register will eventually get set and there will be stale data waiting to be read from the A/D Data register. The interrupt handler will also be called if still connected at the time. That should all be mostly harmless, but it would be better to wait for any such conversion to complete and clear any stale data during the "detach". Add a custom "detach" handler `dt2814_detach()` to do that if an interrupt handler has been set up. (There is no need to do it if no interrupt handler was set up because Comedi asynchronous command support is disabled in that case.) Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210301165757.243065-7-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: dt2814: Remove struct dt2814_privateIan Abbott
The `ntrig` member of the `struct dt2814_private` pointed to by `dev->private` is no longer used as a counter to determine the end of acquisition for a Comedi asynchronous command. The other member `curadscan` is also unused. Remove the allocation of the private data during initialization and remove the definition of `struct dt2814_private` since they are no longer needed. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210301165757.243065-6-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: dt2814: Fix asynchronous command interrupt handlingIan Abbott
The support for asynchronous commands in this driver is currently broken. If interrupts are enabled, the interrupt handler is called at the end of every A/D conversion. A/D conversions could be due to software-triggered conversions resulting from Comedi `INSN_READ` instruction handling, or due to timer-trigger conversions enabled when a Comedi asynchronous command is set up. We only want the interrupt handler to read a sample from the A/D Data register for timer-triggered conversions, but currently it always reads the A/D Data register. Since the A/D Data register is read twice (to read a 12-bit value from an 8-bit register), that probably interferes with the reading for software-triggered conversions. The interrupt handler does not currently do anything with the data, it just ignores it. It should be written to the Comedi buffer if handling an asynchronous command. Other problems are that the driver has no Comedi `cancel` handler to call when the asynchronous command is being stopped manually, and it does not handle "infinite" acquisitions (when the command's `stop_src == TRIG_NONE`) properly. Change the interrupt handler to check the timer enable (ENB) bit to check the asynchronous command is active and return early if not enabled. Also check the error (ERR) and "conversion complete" (FINISH) bits, and return early if neither is set. Then the sample can be read from the A/D Data register to clear the ERR and FINISH bits. If the ERR bit was set, terminate the acquisition with an error, otherwise write the data to the Comedi buffer and check for end of acquisition. Replace the current check for end of acquisition, using the count of completed scans in `scans_done` (updated by calls to `comedi_buf_write_samples()`) when `stop_src == TRIG_COUNT`) and allowing "infinite" acquisitions when `stop_src == TRIG_NONE`. Add a `cancel` handler function `dt2814_ai_cancel()` that will be called when the end of acquisition event is processed and when the acquisition is stopped manually. It turns off the timer enable (ENB) bit in the Control register, leaving the current channel selected. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210301165757.243065-5-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: dt2814: Call dt2814_ai_clear() during initializationIan Abbott
The Comedi "attach" handler `dt2814_attach()` writes to the Control register to turn off the timer enable 'ENB' bit, which triggers a conversion. It then sleeps awhile and checks the Status register, returning an error if the ERR bit is set. However, the ERR bit could have been set due to the conversion being triggered while the A/D converter was busy (unlikely) or due to the conversion being triggered before some previous sample had been read from the A/D Data register. Replace the existing code with a call to `dt2814_ai_clear()` which waits for any conversion to finish and then clears any unread data or error condition. A non-zero return value from `dt2814_ai_clear()` indicates a time-out while waiting for the A/D converter to become non-busy. Return an error in that case. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210301165757.243065-4-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: dt2814: Don't wait for conversion in interrupt handlerIan Abbott
When the interrupt handler decides the final sample has been acquired, it turns off the timer enable (ENB) bit in the Command register. That triggers another A/D conversion. The interrupt handler currently waits for that to finish and then reads the resulting, unwanted sample. Since the functions for handling Comedi read instructions and for setting up asynchronous commands now call `dt2814_ai_clear()` to wait for and discard any spurious A/D conversion, let's remove that code from the interrupt handler. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210301165757.243065-3-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: comedi: dt2814: Clear stale AI data before operationIan Abbott
When performing a Comedi read instruction or setting up an asynchronous command on the AI subdevice, clear any stale data on the A/D registers by waiting for the Status register's BUSY bit to clear (if set) and then if the FINISH or ERR bit is set, reading the A/D Data register twice to clear the stale data. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://lore.kernel.org/r/20210301165757.243065-2-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: clocking-wizard: Remove the hardcoding of the clock outputsShubhrajyoti Datta
The number of output clocks are configurable in the hardware. Currently the driver registers the maximum number of outputs. Fix the same by registering only the outputs that are there. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/1614172241-17326-8-git-send-email-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: clocking-wizard: Add support for fractional supportShubhrajyoti Datta
Currently the set rate granularity is to integral divisors. Add support for the fractional divisors. Only the first output0 is fractional in the hardware. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/1614172241-17326-7-git-send-email-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: clocking-wizard: Add support for dynamic reconfigurationShubhrajyoti Datta
The patch adds support for dynamic reconfiguration of clock output rate. Output clocks are registered as dividers and set rate callback function is used for dynamic reconfiguration. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Co-developed-by: Chirag Parekh <chirag.parekh@xilinx.com> Link: https://lore.kernel.org/r/1614172241-17326-6-git-send-email-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: clocking-wizard: Allow changing of parent rate for single outputShubhrajyoti Datta
If there is only one output then allow changing of the parent rate. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/1614172241-17326-5-git-send-email-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: clocking-wizard: Update the fixed factor divisorsShubhrajyoti Datta
Update the fixed factor clock registration to register the divisors. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/1614172241-17326-4-git-send-email-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-10staging: clocking-wizard: Rename speed-grade to xlnx,speed-gradeShubhrajyoti Datta
Rename speed-grade to xlnx,speed-grade Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Link: https://lore.kernel.org/r/1614172241-17326-3-git-send-email-shubhrajyoti.datta@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>