platform/kernel/linux-starfive.git
2 years agoMerge tag 'soundwire-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
Greg Kroah-Hartman [Thu, 30 Dec 2021 13:00:44 +0000 (14:00 +0100)]
Merge tag 'soundwire-5.17-rc1' of git://git./linux/kernel/git/vkoul/soundwire into char-misc-next

Vinod writes:

soundwire updates for 5.17-rc1

 - Remove redundant version number read in qcom driver

* tag 'soundwire-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: qcom: remove redundant version number read

2 years agoMerge tag 'iio-for-5.17b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 29 Dec 2021 18:29:20 +0000 (19:29 +0100)]
Merge tag 'iio-for-5.17b' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

2nd set of new device support etc for IIO in the 5.17 cycle.

A small additional set of things that just missed the previous
pull request and have mostly been through plenty of review before the
holiday period began (or are trivial).  I've not taken some other series
on the list to allow for more eyes after the holiday period.

New device support
* adi,admv1013
  - New driver for this wideband microwave upconverter including dt-bindings
    and some device specific ABI due to the need to describe phase calibrations
    of a differential channel on both i and q phases. Previously we could
    do differential or i/q but not both on the same channel. The driver
    ABI uses a workaround for core support which will do until we know if
    this is a common requirement for which a more generic solution is
    needed.

MAINTAINERS:
* Add Haibo Chen as a maintainer for various NXP SoC ADCs.

Minor cleanup:
* sunrise_co2
  - Make sure an uninitialized value isn't used to set *val in read_raw().
    Not a real bug, but a compiler or reviewer can't tell that based
    on what they can see locally.

* tag 'iio-for-5.17b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  iio: chemical: sunrise_co2: set val parameter only on success
  dt-bindings:iio:adc: update the maintainer of vf610-adc
  MAINTAINERS: add imx7d/imx6sx/imx6ul/imx8qxp and vf610 adc maintainer
  Documentation:ABI:testing:admv1013: add ABI docs
  dt-bindings: iio: frequency: add admv1013 doc
  iio: frequency: admv1013: add support for ADMV1013

2 years agocxl: use default_groups in kobj_type
Greg Kroah-Hartman [Tue, 28 Dec 2021 13:13:50 +0000 (14:13 +0100)]
cxl: use default_groups in kobj_type

There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.  Move the cxl code to use default_groups field which has been the
preferred way since aa30f47cf666 ("kobject: Add support for default
attribute groups to kobj_type") so that we can soon get rid of the
obsolete default_attrs field.

Cc: Frederic Barrat <fbarrat@linux.ibm.com>
Cc: Andrew Donnellan <ajd@linux.ibm.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20211228131350.249532-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoUIO: use default_groups in kobj_type
Greg Kroah-Hartman [Tue, 28 Dec 2021 13:13:19 +0000 (14:13 +0100)]
UIO: use default_groups in kobj_type

There are currently 2 ways to create a set of sysfs files for a
kobj_type, through the default_attrs field, and the default_groups
field.  Move the UIO code to use default_groups field which has been the
preferred way since aa30f47cf666 ("kobject: Add support for default
attribute groups to kobj_type") so that we can soon get rid of the
obsolete default_attrs field.

Link: https://lore.kernel.org/r/20211228131319.249324-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoiio: chemical: sunrise_co2: set val parameter only on success
Tom Rix [Fri, 24 Dec 2021 15:08:33 +0000 (07:08 -0800)]
iio: chemical: sunrise_co2: set val parameter only on success

Clang static analysis reports this representative warning

sunrise_co2.c:410:9: warning: Assigned value is garbage or undefined
  *val = value;
       ^ ~~~~~

The ealier call to sunrise_read_word can fail without setting
value.  So defer setting val until we know the read was successful.

Fixes: c397894e24f1 ("iio: chemical: Add Senseair Sunrise 006-0-007 driver")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20211224150833.3278236-1-trix@redhat.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agomei: cleanup status before client dma setup call
Alexander Usyskin [Thu, 23 Dec 2021 09:47:05 +0000 (11:47 +0200)]
mei: cleanup status before client dma setup call

The upper layer may retry call to mei_cl_dma_alloc_and_map(),
in that case the client status may be non-zero after the previous call
and the wait condition will be true immediately.
Set cl->status to zero to allow waiting for an actual result
from the firmware.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20211223094705.204624-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agomei: add POWERING_DOWN into device state print
Alexander Usyskin [Thu, 23 Dec 2021 09:47:04 +0000 (11:47 +0200)]
mei: add POWERING_DOWN into device state print

The POWERING_DOWN state string was missing from
the device states list, add it.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20211223094705.204624-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoMerge tag 'misc-habanalabs-next-2021-12-27' of https://git.kernel.org/pub/scm/linux...
Greg Kroah-Hartman [Mon, 27 Dec 2021 09:28:13 +0000 (10:28 +0100)]
Merge tag 'misc-habanalabs-next-2021-12-27' of https://git./linux/kernel/git/ogabbay/linux into char-misc-next

Oded writes:

This tag contains habanalabs driver changes for v5.17:

- Support reset-during-reset. In case the f/w notifies the driver
  that the f/w is going to reset the device, the driver should
  support that even if it is in the middle of doing another
  reset

- Support events from f/w that arrive during device resets.
  These events would be ignored which is bad as critical errors
  would not be reported and treated by the driver.

- Don't kill processes that hold the control device open during
  hard-reset of the device. The control device operations can't
  crash if done during hard-reset. And usually, only monitoring
  applications are using the control device, so killing them
  defies their purpose.

- Fix handling of hwmon nodes when working with legacy f/w

- Change the compute context pointer to be boolean. This pointer
  was abused by multiple code paths that wanted fast access to
  the compute context structure.

- Add uapi to fetch historical errors. This is necessary as errors
  sometimes result in hard-reset where the user application is
  being terminated.

- Optimize GAUDI's MMU cache invalidation.

- Add support for loading the latest f/w.

- Add uapi to fetch HBM replacement and pending rows information.

- Multiple bug fixes to the reset code.

- Multiple bug fixes for Multi-CS ioctl code.

- Multiple bug fixes for wait-for-interrupt ioctl code.

- Many small bug fixes and cleanups.

* tag 'misc-habanalabs-next-2021-12-27' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (70 commits)
  habanalabs: support hard-reset scheduling during soft-reset
  habanalabs: add a lock to protect multiple reset variables
  habanalabs: refactor reset information variables
  habanalabs: handle skip multi-CS if handling not done
  habanalabs: add CPU-CP packet for engine core ASID cfg
  habanalabs: replace some -ENOTTY with -EINVAL
  habanalabs: fix comments according to kernel-doc
  habanalabs: fix endianness when reading cpld version
  habanalabs: change wait_for_interrupt implementation
  habanalabs: prevent wait if CS in multi-CS list completed
  habanalabs: modify cpu boot status error print
  habanalabs: clean MMU headers definitions
  habanalabs: expose soft reset sysfs nodes for inference ASIC
  habanalabs: sysfs support for two infineon versions
  habanalabs: keep control device alive during hard reset
  habanalabs: fix hwmon handling for legacy f/w
  habanalabs: add current PI value to cpu packets
  habanalabs: remove in_debug check in device open
  habanalabs: return correct clock throttling period
  habanalabs: wait again for multi-CS if no CS completed
  ...

2 years agoMerge tag 'extcon-next-for-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Mon, 27 Dec 2021 09:27:01 +0000 (10:27 +0100)]
Merge tag 'extcon-next-for-5.17' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon next for v5.17

Detailed description for this pull request:
1. Remove duplicate code in extcon_set_state_sync() in extcon core
2. Fix non-kernel-doc comment for extcon-usb-gpio.c

* tag 'extcon-next-for-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
  extcon: Deduplicate code in extcon_set_state_sync()
  extcon: usb-gpio: fix a non-kernel-doc comment

2 years agoMerge tag 'icc-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov...
Greg Kroah-Hartman [Mon, 27 Dec 2021 09:23:35 +0000 (10:23 +0100)]
Merge tag 'icc-5.17-rc1' of git://git./linux/kernel/git/djakov/icc into char-misc-next

Georgi writes:

interconnect changes for 5.17

Here are the interconnect changes for the 5.17-rc1 merge window
consisting of new drivers, minor changes and fixes.

New drivers:
 - New driver for MSM8996 platforms
 - New driver for SC7280 EPSS L3 hardware
 - New driver for QCM2290 platforms
 - New driver for SM8450 platforms

Driver changes:
 - dt-bindings: interconnect: Combine SDM660 bindings into RPM schema
 - icc-rpm: Add support for bus power domain
 - icc-rpm: Use NOC_QOS_MODE_INVALID for qos_mode check
 - icc-rpm: Define ICC device type
 - icc-rpm: Add QNOC type QoS support
 - icc-rpm: Support child NoC device probe
 - icc-rpm: Prevent integer overflow in rate
 - icc-rpmh: Add BCMs to commit list in pre_aggregate

Signed-off-by: Georgi Djakov <djakov@kernel.org>
* tag 'icc-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
  interconnect: qcom: Add QCM2290 driver support
  dt-bindings: interconnect: Add Qualcomm QCM2290 NoC support
  interconnect: icc-rpm: Support child NoC device probe
  interconnect: icc-rpm: Add QNOC type QoS support
  interconnect: icc-rpm: Define ICC device type
  interconnect: qcom: Add SM8450 interconnect provider driver
  dt-bindings: interconnect: Add Qualcomm SM8450 DT bindings
  interconnect: qcom: rpm: Prevent integer overflow in rate
  interconnect: icc-rpm: Use NOC_QOS_MODE_INVALID for qos_mode check
  interconnect: qcom: icc-rpmh: Add BCMs to commit list in pre_aggregate
  interconnect: qcom: Add MSM8996 interconnect provider driver
  dt-bindings: interconnect: Add Qualcomm MSM8996 DT bindings
  interconnect: icc-rpm: Add support for bus power domain
  dt-bindings: interconnect: Combine SDM660 bindings into RPM schema
  interconnect: qcom: Add EPSS L3 support on SC7280
  dt-bindings: interconnect: Add EPSS L3 DT binding on SC7280

2 years agohabanalabs: support hard-reset scheduling during soft-reset
Ofir Bitton [Tue, 23 Nov 2021 14:34:28 +0000 (16:34 +0200)]
habanalabs: support hard-reset scheduling during soft-reset

As hard-reset can be requested during soft-reset, driver must allow
it or else critical events received during soft-reset will be
ignored.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add a lock to protect multiple reset variables
Ofir Bitton [Tue, 23 Nov 2021 13:15:22 +0000 (15:15 +0200)]
habanalabs: add a lock to protect multiple reset variables

Atomic operations during reset are replaced by a spinlock in order
to have the ability to protect more than a single variable.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: refactor reset information variables
Ofir Bitton [Tue, 23 Nov 2021 13:15:22 +0000 (15:15 +0200)]
habanalabs: refactor reset information variables

Unify variables related to device reset, which will help us to
add some new reset functionality in future patches.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: handle skip multi-CS if handling not done
Ohad Sharabi [Mon, 20 Dec 2021 11:30:35 +0000 (13:30 +0200)]
habanalabs: handle skip multi-CS if handling not done

This patch fixes issue in which we have timeout for multi-CS although
the CS in the list actually completed.

Example scenario (the two threads marked as WAIT for the thread that
handles the wait_for_multi_cs and CMPL as the thread that signal
completion for both CS and multi-CS):
1. Submit CS with sequence X
2. [WAIT]: call wait_for_multi_cs with single CS X
3. [CMPL]: CS X do invoke complete_all for both CS and multi-CS
           (multi_cs_completion_done still false)
4. [WAIT]: enter poll_fences, reinit the completion and find the CS
           as completed when asking on the fence but multi_cs_done is
   still false it returns that no CS actually completed
5. [CMPL]: set multi_cs_handling_done as true
6. [WAIT]: wait for completion but no CS to awake the wait context
           and hence wait till timeout

Solution: if CS detected as completed in poll_fences but multi_cs_done
          is still false invoke complete_all to the multi-CS completion
  and so it will not go to sleep in wait_for_completion but
  rather will have a "second chance" to wait for
  multi_cs_completion_done.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add CPU-CP packet for engine core ASID cfg
Tomer Tayar [Thu, 16 Dec 2021 14:31:18 +0000 (16:31 +0200)]
habanalabs: add CPU-CP packet for engine core ASID cfg

In some cases the driver cannot configure ASID of some engines due to
the security level of the relevant registers.
For this a new CPU-CP packet is introduced, which will allow the driver
to ask the F/W to do this configuration instead.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: replace some -ENOTTY with -EINVAL
Oded Gabbay [Sun, 19 Dec 2021 14:06:59 +0000 (16:06 +0200)]
habanalabs: replace some -ENOTTY with -EINVAL

-ENOTTY is returned in case of error in the ioctl arguments themselves,
such as function that doesn't exists.

In all other cases, where the error is in the arguments of the custom
data structures that we define that are passed in the various ioctls,
we need to return -EINVAL.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix comments according to kernel-doc
Ofir Bitton [Sun, 19 Dec 2021 09:38:01 +0000 (11:38 +0200)]
habanalabs: fix comments according to kernel-doc

Fix missing fields, descriptions not according to kernel-doc style.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix endianness when reading cpld version
Ofir Bitton [Wed, 15 Dec 2021 12:48:27 +0000 (14:48 +0200)]
habanalabs: fix endianness when reading cpld version

Current sysfs implementation does not take endianness into
consideration when dumping the cpld version.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: change wait_for_interrupt implementation
farah kassabri [Tue, 2 Nov 2021 09:34:18 +0000 (11:34 +0200)]
habanalabs: change wait_for_interrupt implementation

Currently the cq counters are allocated in userspace memory,
and mapped by the driver to the device address space.

A new requirement that is part of new future API related to this one,
requires that cq counters will be allocated in kernel memory.

We leverage the existing cb_create API with KERNEL_MAPPED flag set to
allocate this memory.

That way we gain two things:
1. The memory cannot be freed while in use since it's protected
by refcount in driver.

2. No need to wake up the user thread upon each interrupt from CQ,
because the kernel has direct access to the counter. Therefore,
it can make comparison with the target value in the interrupt
handler and wake up the user thread only if the counter reaches the
target value. This is instead of waking the thread up to copy counter
value from user then go sleep again if target value wasn't reached.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: prevent wait if CS in multi-CS list completed
Ohad Sharabi [Tue, 7 Dec 2021 12:30:20 +0000 (14:30 +0200)]
habanalabs: prevent wait if CS in multi-CS list completed

By the original design we assumed that if we "miss" multi CS completion
it is of no severe consequence as we'll just call wait_for_multi_cs
again.

Sequence of events for such scenario:
1. user submit CS with sequence N
2. user calls wait for multi-CS with only CS #N in the list
3. the multi CS call starts with poll of the CSs but find that none
   completed (while CS #N did not completed yet)
4. now, multi CS #N complete but multi CS CTX was not yet created for
   the above multi-CS. so, attempt to complete multi-CS fails (as no
   multi CS CTX exist)
5. wait_for_multi_cs call now does init_wait_multi_cs_completion (and
   for this create the multi-CS CTX)
6. wait_for_multi_cs wits on completion but will not get one as CS #N
   already completed

To fix the issue we initialize the multi-CS CTX prior polling the
fences.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: modify cpu boot status error print
Ofir Bitton [Mon, 13 Dec 2021 13:43:06 +0000 (15:43 +0200)]
habanalabs: modify cpu boot status error print

As BTL can be replaced by ROM we should modify relevant error print.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: clean MMU headers definitions
Ohad Sharabi [Wed, 8 Dec 2021 07:06:03 +0000 (09:06 +0200)]
habanalabs: clean MMU headers definitions

During the MMU development the MMU header files were left with unclean
definitions:

- MMU "version specific" definitions that were left in the mmu_general
  file
- unused definitions

This patch attempts, where possible, to keep definitions that can serve
multiple MMU versions (but that are not tightly bound with specific MMU
arch) in the mmu_general header file (e.g. different definitions for
number of HOPs).

Otherwise, move MMU version specific definitions (e.g. HOPs masks and
shifts) to the specific MMU version file.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: expose soft reset sysfs nodes for inference ASIC
Ofir Bitton [Sun, 12 Dec 2021 15:46:21 +0000 (17:46 +0200)]
habanalabs: expose soft reset sysfs nodes for inference ASIC

As we allow soft-reset to be performed only on inference devices,
having the sysfs nodes may cause a confusion. Hence, we remove those
nodes on training ASICs.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: sysfs support for two infineon versions
Ofir Bitton [Wed, 8 Dec 2021 13:00:10 +0000 (15:00 +0200)]
habanalabs: sysfs support for two infineon versions

Currently sysfs support dumping a single infineon version, in
future asics we will have two infineon versions.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: keep control device alive during hard reset
Dani Liberman [Wed, 8 Dec 2021 07:52:03 +0000 (09:52 +0200)]
habanalabs: keep control device alive during hard reset

Need to allow user retrieve data during reset and afterwards without
the need to reopen the device.
Did it by seperating the user peocesses list into two lists:
1. fpriv_list which contains list of user processes that opened
   the device (currently only one).
2. fpriv_ctrl_list which contains list of user processes that opened
   the control device. This processes in this list shall not be
   killed during reset, only when the device is suddenly removed from
   PCI chain.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix hwmon handling for legacy f/w
Oded Gabbay [Sun, 12 Dec 2021 14:40:24 +0000 (16:40 +0200)]
habanalabs: fix hwmon handling for legacy f/w

In legacy f/w that use old hwmon.h file, the values of the hwmon
enums are different than the values that are in newer kernels (5.6
and above).

Therefore, to support working with those f/w, we need to do some
fixup before registering with the hwmon subsystem and also when
calling the functions that communicate with the f/w to retrieve
sensors information.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add current PI value to cpu packets
Ofir Bitton [Wed, 8 Dec 2021 19:46:29 +0000 (21:46 +0200)]
habanalabs: add current PI value to cpu packets

In order to increase cpucp messaging reliability we will add
the current PI value to the descriptor sent to F/W.
F/W will wait for the PI value as an indication of a valid packet.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: remove in_debug check in device open
Oded Gabbay [Wed, 8 Dec 2021 14:25:07 +0000 (16:25 +0200)]
habanalabs: remove in_debug check in device open

The driver supports only a single user anyway, so there is no point
in checking whether we are in_debug state when a user tries to open
the device, because if we are in_debug, it means a user is already
using the device.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: return correct clock throttling period
Ofir Bitton [Tue, 7 Dec 2021 09:20:46 +0000 (11:20 +0200)]
habanalabs: return correct clock throttling period

Current clock throttling period returned from driver was wrong due
to wrong time comparison.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: wait again for multi-CS if no CS completed
Ohad Sharabi [Wed, 1 Dec 2021 08:52:27 +0000 (10:52 +0200)]
habanalabs: wait again for multi-CS if no CS completed

The original multi-CS design assumption that stream masters are used
exclusively (i.e. multi-CS with set of stream master QIDs will not get
completed by CS not from the multi-CS set) is inaccurate.

Thus multi-CS behavior is now modified not to treat such case as an
error.

Instead, if we have multi-CS completion but we detect that no CS from
the list is actually completed we will do another multi-CS wait (with
modified timeout).

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: remove compute context pointer
Oded Gabbay [Tue, 30 Nov 2021 21:08:21 +0000 (23:08 +0200)]
habanalabs: remove compute context pointer

It was an error to save the compute context's pointer in the device
structure, as it allowed its use without proper ref-cnt.

Change the variable to a flag that only indicates whether there is
an active compute context. Code that needs the pointer will now
be forced to use proper internal APIs to get the pointer.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add helper to get compute context
Oded Gabbay [Tue, 30 Nov 2021 21:02:21 +0000 (23:02 +0200)]
habanalabs: add helper to get compute context

There are multiple places where the code needs to get the context's
pointer and increment its ref cnt. This is the proper way instead
of using the compute context pointer in the device structure.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix etr asid configuration
Oded Gabbay [Tue, 30 Nov 2021 20:32:13 +0000 (22:32 +0200)]
habanalabs: fix etr asid configuration

Pass the user's context pointer into the etr configuration function
to extract its ASID.

Using the compute_ctx pointer is an error as it is just an indication
of whether a user has opened the compute device.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: save ctx inside encaps signal
Oded Gabbay [Tue, 30 Nov 2021 13:28:23 +0000 (15:28 +0200)]
habanalabs: save ctx inside encaps signal

Compute context pointer in hdev shouldn't be used for fetching the
context's pointer.

If an object needs the context's pointer, it should get it while
incrementing its kref, and when the object is released, put it.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: remove redundant check on ctx_fini
Oded Gabbay [Tue, 30 Nov 2021 15:04:13 +0000 (17:04 +0200)]
habanalabs: remove redundant check on ctx_fini

The driver supports only a single context. Therefore, no need to check
if the user context that is closed is the compute context. The user
context, if exists, is always the compute context.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: free signal handle on failure
Oded Gabbay [Tue, 30 Nov 2021 12:54:53 +0000 (14:54 +0200)]
habanalabs: free signal handle on failure

Fix a bug where in case of failure to allocate idr, the handle's
memory wasn't freed as part of the error handling code.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add missing kernel-doc comments for hl_device fields
Tomer Tayar [Mon, 29 Nov 2021 09:20:27 +0000 (11:20 +0200)]
habanalabs: add missing kernel-doc comments for hl_device fields

Add missing kernel-doc comments for the "last_error" and
"stream_master_qid_arr" fields of the "hl_device" structure".

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: pass reset flags to reset thread
Tomer Tayar [Mon, 22 Nov 2021 10:29:22 +0000 (12:29 +0200)]
habanalabs: pass reset flags to reset thread

The reset flags used by the reset thread are currently a mix of
hard-coded values and a specific flag which is passed from the context
that initiates the reset.
To make it easier to pass more flags in future from this context to the
reset thread, modify it to pass all the original reset flags to the
thread.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: enable access to info ioctl during hard reset
Dani Liberman [Mon, 22 Nov 2021 19:47:30 +0000 (21:47 +0200)]
habanalabs: enable access to info ioctl during hard reset

Because info ioctl is used to retrieve data, some of its opcodes may be
used during hard reset.
Other ioctls should be blocked while device is not operational.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add SOB information to signal submission uAPI
Dani Liberman [Tue, 9 Nov 2021 09:33:28 +0000 (11:33 +0200)]
habanalabs: add SOB information to signal submission uAPI

For debug purpose, add SOB address and SOB initial counter value
before current submission to uAPI output.

Using SOB address and initial counter, user can calculate how much of
the submmision has been completed.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: skip read fw errors if dynamic descriptor invalid
Ohad Sharabi [Mon, 22 Nov 2021 10:23:51 +0000 (12:23 +0200)]
habanalabs: skip read fw errors if dynamic descriptor invalid

Reporting FW errors involves reading of the error registers.

In case we have a corrupted FW descriptor we cannot do that since the
dynamic scratchpad is potentially corrupted as well and may cause kernel
crush when attempting access to a corrupted register offset.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: handle events during soft-reset
Ofir Bitton [Sun, 21 Nov 2021 14:02:32 +0000 (16:02 +0200)]
habanalabs: handle events during soft-reset

Driver should handle events during soft-reset as F/W is not
going through reset and it keeps sending events towards host.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: change misleading IRQ warning during reset
Ofir Bitton [Thu, 18 Nov 2021 06:46:15 +0000 (08:46 +0200)]
habanalabs: change misleading IRQ warning during reset

Currently we dump the physical IRQ line index in host if an event
is received during reset. This ID is confusing as it means nothing
to the user.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add power information type to POWER_GET packet
Tomer Tayar [Thu, 18 Nov 2021 08:44:05 +0000 (10:44 +0200)]
habanalabs: add power information type to POWER_GET packet

In new f/w versions, it is required to explicitly indicate the power
information type when querying the F/W for power info.
When getting the current power level it should be set to power_input.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add more info ioctls support during reset
Ofir Bitton [Mon, 15 Nov 2021 17:36:25 +0000 (19:36 +0200)]
habanalabs: add more info ioctls support during reset

Some info ioctls can be served even if the device is disabled or
in reset. Hence, we enable more info ioctls during reset, as these
ioctls do not require any H/W nor F/W communication.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix race condition in multi CS completion
Dani Liberman [Wed, 17 Nov 2021 07:59:10 +0000 (09:59 +0200)]
habanalabs: fix race condition in multi CS completion

Race example scenario:
1. User have 2 threads that waits on multi CS:
   - thread_0 waits on QID 0 and uses multi CS context 0.
   - thread_1 waits on QID 1 and uses multi CS context 1.
2. thread_1 got completion and release multi CS context 1.
3. CS related to multi CS of thread_0 starts executing
   complete_multi_cs function, the first iteration of the loop
   completes the multi CS of thread_0, hence multi CS context 0
   is released.
4. thread_1 waits on QID 1 and uses multi CS context 0.
5. thread_0 waits on QID 0 and uses multi CS context 1.
6. The second iterattion of the loop (from step 3) starts, which
   means, start checking multi CS context 1:
   - multi CS contetxt is being used by thread_0 waiting on QID 0.
   - The fence of the CS (still CS from step 3) has QID map the same
     as the multi CS context 1.
   - multi CS context 1 (thread_0) gets completion on CS that triggered
     already thread_0 (with multi CS context 0) and is no longer
     being waited on.

Fixed by exiting the loop in complete_multi_cs after getting completion

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: move device boot warnings to the correct location
Ofir Bitton [Tue, 16 Nov 2021 13:48:42 +0000 (15:48 +0200)]
habanalabs: move device boot warnings to the correct location

As device boot warnings clears the indication from the error mask,
they must be located together before the unknown error validation.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs/gaudi: return EPERM on non hard-reset
Oded Gabbay [Tue, 16 Nov 2021 08:30:26 +0000 (10:30 +0200)]
habanalabs/gaudi: return EPERM on non hard-reset

GAUDI supports only hard-reset. Therefore, this function should
return an error of operation not permitted.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: rename late init after reset function
Oded Gabbay [Tue, 16 Nov 2021 07:59:32 +0000 (09:59 +0200)]
habanalabs: rename late init after reset function

The ASIC-specific soft_reset_late_init() is now called after either
soft-reset or reset-upon-device-release. Therefore, it needs a more
appropriate name.

No need to split it to two functions, as an ASIC either supports
soft-reset or reset-upon-device-release.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix soft reset accounting
Oded Gabbay [Tue, 16 Nov 2021 07:46:02 +0000 (09:46 +0200)]
habanalabs: fix soft reset accounting

Reset upon device release is not a soft-reset from user/system point
of view. As such, we shouldn't count that reset in the statistics we
gather and expose to the monitoring applications.

We also shouldn't print soft-reset when doing the reset upon device
release.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: Move frequency change thread to goya_late_init
Rajaravi Krishna Katta [Thu, 5 Aug 2021 07:24:16 +0000 (10:24 +0300)]
habanalabs: Move frequency change thread to goya_late_init

Changing the frequency automatically is only done in Goya. In future
ASICs this is done inside the firmware. Therefore, move the common code
into the Goya specific files.

Main changes as part of the commit are:
    1. The thread for setting frequency is moved from device_late_init
       to goya_late_init
    2. hl_device_set_frequency is removed from hl_device_open as it is
       not relevant for other ASICs and for Goya it is taken care by
       the thread
    3. hl_device_set_frequency is renamed as goya_set_frequency

Signed-off-by: Rajaravi Krishna Katta <rkatta@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: abort reset on invalid request
Oded Gabbay [Mon, 15 Nov 2021 15:13:37 +0000 (17:13 +0200)]
habanalabs: abort reset on invalid request

Hard-reset is mutually exclusive with reset-on-device-release.
Therefore, if such a request arrives to the reset function, abort
the reset and return an error to the callee.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix possible deadlock in cache invl failure
Ofir Bitton [Tue, 9 Nov 2021 11:12:38 +0000 (13:12 +0200)]
habanalabs: fix possible deadlock in cache invl failure

Currently there is a deadlock in driver in scenarios where MMU
cache invalidation fails. The issue is basically device reset
being performed without releasing the MMU mutex.
The solution is to skip device reset as it is not necessary.
In addition we introduce a slight code refactor that prints the
invalidation error from a single location.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: skip PLL freq fetch
Ohad Sharabi [Sun, 14 Nov 2021 07:37:33 +0000 (09:37 +0200)]
habanalabs: skip PLL freq fetch

Getting the used PLL index with which to send the CPUPU packet relies on
the CPUCP info packet.

In case CPU queues are not enabled getting the PLL index will issue an
error and in some ASICs will also fail the driver load.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: align debugfs documentation to alphabetical order
Tomer Tayar [Sun, 14 Nov 2021 07:29:48 +0000 (09:29 +0200)]
habanalabs: align debugfs documentation to alphabetical order

Move an entry in the debugfs documentation to align with the
alphabetical order which is kept this file.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: prevent false heartbeat message
Oded Gabbay [Sat, 13 Nov 2021 15:58:43 +0000 (17:58 +0200)]
habanalabs: prevent false heartbeat message

If a device reset has started, there is a chance that the heartbeat
function will fail because the device is disabled at the beginning
of the reset function.

In that case, we don't want the error message to appear in the log.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add support for fetching historic errors
Dani Liberman [Wed, 3 Nov 2021 08:09:59 +0000 (10:09 +0200)]
habanalabs: add support for fetching historic errors

A new uAPI is added for debug purposes of the user-space to retrieve
errors related data from previous session (before device reset was
performed).

Inforamtion is filled when a razwi or CS timeout happens and can
contain one of the following:

1. Retrieve timestamp of last time the device was opened and razwi or
   CS timeout happened.
2. Retrieve information about last CS timeout.
3. Retrieve information about last razwi error.

This information doesn't contain user data, so no danger of data
leakage between users.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: handle device TPM boot error as warning
Ofir Bitton [Wed, 10 Nov 2021 09:41:43 +0000 (11:41 +0200)]
habanalabs: handle device TPM boot error as warning

AS TPM error indication is not fatal, driver should dump a warning
and continue booting.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: debugfs support for larger I2C transactions
Ofir Bitton [Tue, 12 Oct 2021 17:52:46 +0000 (20:52 +0300)]
habanalabs: debugfs support for larger I2C transactions

I2C debugfs support is limited to 1 byte. We extend functionality
to more than 1 byte by using one of the pad fields as a length.
No backward compatibility issues as new F/W versions will treat 0
length as a 1 byte length transaction.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: make hdev creation code more readable
Oded Gabbay [Thu, 4 Nov 2021 07:48:22 +0000 (09:48 +0200)]
habanalabs: make hdev creation code more readable

Divide the code into 3 different parts:
- Copy kernel parameters
- Setting device behaivor per asic
- Fixup of various device parameters according to the device behaivor.

In addition, remove non-relevant code for upstream (simulator support).

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add new opcodes for INFO IOCTL
farah kassabri [Sun, 24 Oct 2021 16:02:32 +0000 (19:02 +0300)]
habanalabs: add new opcodes for INFO IOCTL

Add implementation for new opcodes in the INFO IOCTL:
1. Retrieve the replaced DRAM rows from f/w.
2. Retrieve the pending DRAM rows from f/w.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: refactor wait-for-user-interrupt function
Bharat Jauhari [Wed, 8 Sep 2021 14:32:54 +0000 (17:32 +0300)]
habanalabs: refactor wait-for-user-interrupt function

Refactor the wait-for-user-interrupt routine to make it more
generic for re-use for other user exposed h/w interfaces in future
ASICs.

Signed-off-by: Bharat Jauhari <bjauhari@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs/gaudi: Fix collective wait bug
farah kassabri [Wed, 3 Nov 2021 11:15:55 +0000 (13:15 +0200)]
habanalabs/gaudi: Fix collective wait bug

In Signaling-From-Graph case, the driver didn't set the hw_sob pointer
at the right place, which is needed for the cs completion
check prior to start sending all the master/slaves jobs to device.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: expand clock throttling information uAPI
Ofir Bitton [Mon, 25 Oct 2021 06:47:04 +0000 (09:47 +0300)]
habanalabs: expand clock throttling information uAPI

In addition to the clock throttling reason, user should be able
to obtain also the start time and the duration of the throttling
event.

Signed-off-by: Ofir Bitton <obitton@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: change wait for interrupt timeout to 64 bit
Dani Liberman [Thu, 14 Oct 2021 19:38:41 +0000 (22:38 +0300)]
habanalabs: change wait for interrupt timeout to 64 bit

In order to increase maximum wait-for-interrupt timeout, change it
to 64 bit variable. This wait is used only by newer ASICs, so no
problem in changing this interface at this time.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: rename reset flags
Bharat Jauhari [Thu, 16 Sep 2021 11:00:38 +0000 (14:00 +0300)]
habanalabs: rename reset flags

Rename reset flags for better readability as compared to
HL_RESET_CAUSE* enum shared with the f/w.

Signed-off-by: Bharat Jauhari <bjauhari@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add dedicated message towards f/w to set power
Rajaravi Krishna Katta [Tue, 26 Oct 2021 11:11:06 +0000 (14:11 +0300)]
habanalabs: add dedicated message towards f/w to set power

CPUCP_PACKET_POWER_GET packet type was used for both
hl_get_power() and hl_set_power().

To align with other sensor functions hl_set_power()
should use CPUCP_PACKET_POWER_SET.

This packet will only be used with newer ASICs, so need to add
a compatibility flag to the asic properties to indicate whether to use
this packet or the GET packet.

Signed-off-by: Rajaravi Krishna Katta <rkatta@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: handle abort scenario for user interrupt
Bharat Jauhari [Wed, 8 Sep 2021 14:16:51 +0000 (17:16 +0300)]
habanalabs: handle abort scenario for user interrupt

In case of device reset, the driver does a force trigger on all waiting
users to release them from waiting. However, the driver does not handle
error scenario while waiting.

hl_interrupt_wait_ioctl() now exits the wait in case of an error with
abort status.

Signed-off-by: Bharat Jauhari <bjauhari@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: don't clear previous f/w indications
Ohad Sharabi [Tue, 26 Oct 2021 07:42:24 +0000 (10:42 +0300)]
habanalabs: don't clear previous f/w indications

Once we read indication of whether f/w is doing the reset, we don't
want to clear it, until the next time we read this indication.

Otherwise, we might be in a state of wrong indication.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: use variable poll interval for fw loading
Ohad Sharabi [Tue, 26 Oct 2021 12:33:23 +0000 (15:33 +0300)]
habanalabs: use variable poll interval for fw loading

Using a variable poll interval for fw loading allows us to support
much slower environments (emulation) while changing only a single
line in the code, instead of choosing a different interval in each
function that polls.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: adding indication of boot fit loaded
Ohad Sharabi [Thu, 21 Oct 2021 08:24:41 +0000 (11:24 +0300)]
habanalabs: adding indication of boot fit loaded

Up until now the driver stored indication if Linux was loaded on the
device CPU. This was needed in order to coordinate some tasks that are
performed by the Linux.

In future ASICs, many of those tasks will be performed by the boot
fit, so now we need the same indication of boot fit load status.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: partly skip cache flush when in PMMU map flow
Yuri Nudelman [Mon, 25 Oct 2021 08:37:25 +0000 (11:37 +0300)]
habanalabs: partly skip cache flush when in PMMU map flow

The PCI MMU cache is two layered. The upper layer, memcache, uses cache
lines, the bottom layer doesn't.

Hence, after PMMU map operation we have to invalidate memcache, to avoid
the situation where the new entry is already in the cache due to its
cache line being fully in the cache.

However, we do not have to invalidate the lower cache, and here we can
optimize, since cache invalidation is time consuming.

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add enum mmu_op_flags
Yuri Nudelman [Thu, 30 Sep 2021 12:52:25 +0000 (15:52 +0300)]
habanalabs: add enum mmu_op_flags

The enum vm_type was abused, used once as a value (indication
memory type for map) and once as a flag (for cache invalidation).
This makes it hard to add new and still keep it meaningful, hence it
is better to split into one enum for values and one for flags.

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: make last_mask an MMU property
Yuri Nudelman [Thu, 21 Oct 2021 12:08:51 +0000 (15:08 +0300)]
habanalabs: make last_mask an MMU property

Currently LAST_MASK is a global, but really it is an MMU implementation
specific. We need this change for future ASICs.

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: wrong VA size calculation
Yuri Nudelman [Thu, 14 Oct 2021 07:33:27 +0000 (10:33 +0300)]
habanalabs: wrong VA size calculation

VA blocks are currently stored in an inconsistent way. Sometimes block
end is inclusive, sometimes exclusive. This leads to wrong size
calculations in certain cases, plus could lead to a segmentation fault
in case mapping process fails in the middle and we try to roll it back.
Need to make this consistent - start inclusive till end inclusive.

For example, the regions table may now look like this:
    0x0000 - 0x1fff : allocated
    0x2000 - 0x2fff : free
    0x3000 - 0x3fff : allocated

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs/gaudi: fix debugfs dma channel selection
Guy Zadicario [Tue, 12 Oct 2021 07:30:28 +0000 (10:30 +0300)]
habanalabs/gaudi: fix debugfs dma channel selection

Do not use a dma channel for debugfs requested transfer if it's
QM is not idle.

Signed-off-by: Guy Zadicario <gzadicario@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: revise and document use of boot status flags
Ohad Sharabi [Sun, 17 Oct 2021 06:00:43 +0000 (09:00 +0300)]
habanalabs: revise and document use of boot status flags

The boot status flag "SRAM available" can be set by f/w Linux (in the
general case) or by f/w uboot (in some specific debug scenario) but
never by f/w preboot.

Hence, when polling the boot status flags in the preboot stage we do not
want to poll on "SRAM Avialable".

The special case in which uboot set this flag is when we are running
special debug scenario without Linux. In this case, at some point during
the boot, the uboot relocates its code to the DRAM and then set the
specified flag.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: print va_range in vm node debugfs
Yuri Nudelman [Thu, 14 Oct 2021 09:10:31 +0000 (12:10 +0300)]
habanalabs: print va_range in vm node debugfs

VA range info could assist in debugging VA allocation bugs.

Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs/gaudi: recover from CPU WD event
Oded Gabbay [Thu, 21 Oct 2021 11:02:40 +0000 (14:02 +0300)]
habanalabs/gaudi: recover from CPU WD event

There are rare cases where the device CPU's watchdog has expired and as
a result, the watchdog reset has happened and the CPU will now move to
running its preboot f/w.

When that happens, the driver will only know that a heartbeat failure
occurred. As a result, the driver will send a message to the CPU's main
f/w asking it to reset the device, but because the CPU is now running
preboot, it won't respond and the re-initialization process will later
fail when trying to load the f/w.

The solution is to send the request to the preboot as well, only if the
reset was caused because of HB failure.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: modify wait for boot fit in dynamic FW load
Ohad Sharabi [Sun, 17 Oct 2021 05:40:28 +0000 (08:40 +0300)]
habanalabs: modify wait for boot fit in dynamic FW load

In the dynamic FW load protocol the boot status is updated to
"Ready to Boot" once uboot is active.

Polling on other boot status values is a residue of code duplication
from the static protocol and should be removed.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agoextcon: Deduplicate code in extcon_set_state_sync()
Alexander Stein [Tue, 23 Nov 2021 14:53:01 +0000 (15:53 +0100)]
extcon: Deduplicate code in extcon_set_state_sync()

Finding the cable index and checking for changed status is also done
in extcon_set_state(). So calling extcon_set_state_sync() will do these
checks twice. Remove them and use these checks from extcon_set_state().

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoextcon: usb-gpio: fix a non-kernel-doc comment
Randy Dunlap [Mon, 15 Nov 2021 03:05:36 +0000 (19:05 -0800)]
extcon: usb-gpio: fix a non-kernel-doc comment

Do not use "/**" to begin a non-kernel-doc comment.
Fixes this build warning:

drivers/extcon/extcon-usb-gpio.c:23:
warning: expecting prototype for drivers/extcon/extcon-usb-gpio.c().

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agodt-bindings:iio:adc: update the maintainer of vf610-adc
Haibo Chen [Tue, 21 Dec 2021 07:50:00 +0000 (15:50 +0800)]
dt-bindings:iio:adc: update the maintainer of vf610-adc

Drop Fugang Duan as the vf610-adc maintainer, and add my self as
the maintainer.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/1640073000-32629-2-git-send-email-haibo.chen@nxp.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMAINTAINERS: add imx7d/imx6sx/imx6ul/imx8qxp and vf610 adc maintainer
Haibo Chen [Tue, 21 Dec 2021 07:49:59 +0000 (15:49 +0800)]
MAINTAINERS: add imx7d/imx6sx/imx6ul/imx8qxp and vf610 adc maintainer

Add myself as imx7d/imx6sx/imx6ul/imx8qxp and vf610 adc maintainer.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Cai Huoqing <cai.huoqing@linux.dev>
Link: https://lore.kernel.org/r/1640073000-32629-1-git-send-email-haibo.chen@nxp.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoDocumentation:ABI:testing:admv1013: add ABI docs
Antoniu Miclaus [Tue, 21 Dec 2021 11:22:06 +0000 (13:22 +0200)]
Documentation:ABI:testing:admv1013: add ABI docs

Add documentation for the use of the Local Oscillator Feedthrough Offset
calibration.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20211221112206.97066-3-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: frequency: add admv1013 doc
Antoniu Miclaus [Tue, 21 Dec 2021 11:22:05 +0000 (13:22 +0200)]
dt-bindings: iio: frequency: add admv1013 doc

Add device tree bindings for the ADMV1013 Upconverter.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211221112206.97066-2-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: frequency: admv1013: add support for ADMV1013
Antoniu Miclaus [Tue, 21 Dec 2021 11:22:04 +0000 (13:22 +0200)]
iio: frequency: admv1013: add support for ADMV1013

The ADMV1013 is a wideband, microwave upconverter optimized
for point to point microwave radio designs operating in the
24 GHz to 44 GHz radio frequency (RF) range.

Datasheet:
https://www.analog.com/media/en/technical-documentation/data-sheets/ADMV1013.pdf

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Link: https://lore.kernel.org/r/20211221112206.97066-1-antoniu.miclaus@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMerge tag 'iio-for-5.17a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Wed, 22 Dec 2021 11:33:01 +0000 (12:33 +0100)]
Merge tag 'iio-for-5.17a' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

1st set of IIO new device support, features and cleanup for 5.17

Includes some fixes that were either late breaking, low priority or
complex enough to not be good to rush in late in the cycle.

Tree rebased today to fix up some trivial issues + pull in a fix that
was previously on the fixes-togreg branch. Vast majority have been
in linux-next for some time now.

New device support
* adi,ad7293
  - New driver and bindings for this Power Amplifier drain current
    controller.  A complex device with various related monitoring functions.
* adi,ad75513R
  - New driver and bindings for this combined ADC and DAC device.
  - A few follow up fixes.
* adi,admv8818
  - New driver (and type) for this 2-18GHz filter device. Includes
    bindings and ABI documentation to allow clk_notifier based auto
    adjustment of the filters in appropriate applications.
* liteon,ltr501
  - Support for the ltr303.  ID and chip specific info table.
* xilinx,ams
  - New generic firmware function fwnode_iomap() as used in this driver.
  - New driver and bindings for this ADC and on-chip sensors as found
    in various Xilinx devices.

Core
* Introduced IIO_VAL_INT_64 which uses val and val2 in IIO callbacks to
  form a 64 bit integer when higher precision needed.
* Allow IIO_ENUM_AVAILABLE to be used with different shared values.
* Fix a long term issue with scheduling whilst atomic when iio_trig_poll()
  is called but no trigger consumers are actually enabled and hence the
  trigger may be reenabled from the interrupt handler.  Seen in the wild
  on the tsc2046.
* Mark iio_device_type const.
* buffer: Use a separate index variable to simplify code.
* buffer-dma: Clear out unused struct iio_buffer_block
* buffer-dmaengine: Switch to cheaper round_down() as power of 2 values.

Tests/tools
* format_value
  - Check against NULL returns from allocations in tests.
  - Add IIO_VAL_INT_64 test case.
* event_monitor
  - Flush the output after event to given more consistent latency
    when tool output piped to other programs.

Driver Features
* axp20x
  - Add support for NTC thermistor channel and document TS pin binding.
* arm,scmi
  - Add reading of raw channel values (using IIO_VAL_INT_64)
* liteon,ltr501
  - Add proximity-near-level support and dt-binding.

Tree wide cleanup
* Remove no-op trigger ops from multiple drivers.
* Stop using dev_get_drvdata() on the iio_dev->dev in various drivers
  and then stop assigning it to allow this to be used for other purposes.
  We can always get to the indio_dev using dev_to_iio_dev() which is
  a container_of() based approach. Also cleanup up some related unnecessary
  convoluted cases.
  - atmel,at91-sam5d2
  - nxp,imx7d
  - meas,ms5611
  - st,st_sensors
* Where available (or easy to introduce) use the scan_type.* values
  in place of a second copy for read_raw and similar paths.
  - adi,ad7266
  - bosch,bma220
  - fsl,mac3110
  - fsl,mma7455
  - fsl,mpl3115
  - kionix,kcjk-1013
  - sensortek,stk8ba50
  - sensortek,stk8312
  - ti,adc12138
  - ti,ads1015
  - vti,sca3000
  - xilinx,xadc-core
* Switch drives over to generic firmware properties including appropriate
  header changes to avoid including of.h
  - Various DACs had false CONFIG_OF dependencies.
  - dpot-dac
  - envelope-detector
  - adi,ad5755
  - adi,ad5758
  - capella,cm3605
  - maxim,max9611
  - microchip,mcp41010
  - microchip,mcp3911
  - ti,adc12138
* Trivial clang warning fixes for W=1 warnings.

Driver specific cleanup and minor fixes
* adi,ad7606
  - Comment fixes.
* ams,ad3935
  - Drop pointless cast to the same type.
* atmel,at91-sama5d2
  - Fix wrong cast of iio_dev->dev to platform_device that happened to
    be harmless.
* fsl,mma7660
  - Stop i2c remove() function returning an error code. Part of a rework
    to eventually stop returning anything from these.
* fsl,mma8452
  - Use correct type for local irqreturn_t.
* nxp,imx8mq
  - Maintainer email address update.
* nxp,lpc18xx_adc
  - Ensure clk_prepare_enable() called before clk_get_rate().
  - Switch of.h for mod_devicetable.h to reflect no of specific functions,
    just the id table.
* renesas,rzg2l
  - Drop a dev_err() that just duplicates error printed in platform_get_irq()
* sgx,vz89x
  - Drop pointless cast.
* st,lsm6dsx
  - Make it possible to disable the sensorhub from DT to avoid a corner
    case where the address of a slave device many be accidentally modified.
* st,stm32-adc
  - Stop leaking an of_node in an error path.
* st,stmp2
   - Avoid wrong sized type for bit field which could result in
     over-reading (harmless). Precursor to enabling -Warray-bounds.
* ti,adc081c
  - Put back some ACPI support for non standards compliant ADC081C
    ID because it is known to be in the wild on some Aaeon boards.
* ti,ads8688
  - Cleanup redundant local ret variable assignment.
* ti,ina2xx-adc
  - Use helper macro kthread_run() to replace some boilerplate.
  - Avoid double reference counting.
  - Drop pointless cast.
* xilinx,xadc
  - Make the IRQ optional as not always wired to the host system.

* tag 'iio-for-5.17a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (103 commits)
  iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
  iio:addac:ad74413r: Fix uninitialized ret in a path that won't be hit.
  MAINTAINERS: Add maintainer for xilinx-ams
  dt-bindings: iio: adc: Add Xilinx AMS binding documentation
  iio: adc: Add Xilinx AMS driver
  device property: Add fwnode_iomap()
  iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
  iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops.
  iio:dummy: Drop set but unused variable len.
  iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum conversion.
  iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.
  iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum conversion.
  iio:dac:mcp4725: Suppress clang W=1 warning about pointer to enum conversion.
  iio:amplifiers:hmc425a: Suppress clang W=1 warning about pointer to enum conversion.
  iio:adc:ti-ads1015: Suppress clang W=1 warning about pointer to enum conversion.
  iio:adc:rcar: Suppress clang W=1 warning about pointer to enum conversion.
  iio:adc:ina2xx-adc: Suppress clang W=1 warning about pointer to enum conversion.
  iio:accel:bma180: Suppress clang W=1 warning about pointer to enum conversion.
  drivers:iio:dac: Add AD3552R driver support
  dt-bindings: iio: dac: Add adi,ad3552r.yaml
  ...

2 years agoiio: adc: ti-adc081c: Partial revert of removal of ACPI IDs
Jonathan Cameron [Sun, 5 Dec 2021 17:27:28 +0000 (17:27 +0000)]
iio: adc: ti-adc081c: Partial revert of removal of ACPI IDs

Unfortuanately a non standards compliant ACPI ID is known to be
in the wild on some AAEON boards.

Partly revert the removal of these IDs so that ADC081C will again
work + add a comment to that affect for future reference.

Whilst here use generic firmware properties rather than the ACPI
specific handling previously found in this driver.

Reported-by: Kunyang Fan <Kunyang_Fan@aaeon.com.tw>
Fixes: c458b7ca3fd0 ("iio:adc:ti-adc081c: Drop ACPI ids that seem very unlikely to be official.")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Tested-by: Kunyang Fan <Kunyang_Fan@aaeon.com.tw> #UP-extremei11
Link: https://lore.kernel.org/r/20211205172728.2826512-1-jic23@kernel.org
Cc: <Stable@vger.kernel.org>
2 years agoiio:addac:ad74413r: Fix uninitialized ret in a path that won't be hit.
Jonathan Cameron [Mon, 20 Dec 2021 16:47:26 +0000 (16:47 +0000)]
iio:addac:ad74413r: Fix uninitialized ret in a path that won't be hit.

I don't believe it's possible to hit this, because we drop
out of __iio_update_buffers() earlier in the event of an empty
list.  However, that is not visible to the compiler so lets
return an error if we do hit the loop with an empty bitmask.

Fixes: 5d97d9e9a703 ("iio: addac: ad74413r: fix off by one in ad74413r_parse_channel_config()")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Cosmin Tanislav <cosmin.tanislav@analog.com>
Link: https://lore.kernel.org/r/20211220164726.3136307-1-jic23@kernel.org
2 years agoMAINTAINERS: Add maintainer for xilinx-ams
Anand Ashok Dumbre [Fri, 3 Dec 2021 21:23:58 +0000 (21:23 +0000)]
MAINTAINERS: Add maintainer for xilinx-ams

Add maintaner entry for xilinx-ams driver.

Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
Link: https://lore.kernel.org/r/20211203212358.31444-6-anand.ashok.dumbre@xilinx.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: adc: Add Xilinx AMS binding documentation
Anand Ashok Dumbre [Fri, 3 Dec 2021 21:23:57 +0000 (21:23 +0000)]
dt-bindings: iio: adc: Add Xilinx AMS binding documentation

Xilinx AMS have several ADC channels that can be used for measurement of
different voltages and temperatures. Document the same in the bindings.

Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20211203212358.31444-5-anand.ashok.dumbre@xilinx.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: Add Xilinx AMS driver
Anand Ashok Dumbre [Fri, 3 Dec 2021 21:23:56 +0000 (21:23 +0000)]
iio: adc: Add Xilinx AMS driver

The AMS includes an ADC as well as on-chip sensors that can be used to
sample external voltages and monitor on-die operating conditions, such
as temperature and supply voltage levels. The AMS has two SYSMON blocks.
PL-SYSMON block is capable of monitoring off chip voltage and
temperature.

PL-SYSMON block has DRP, JTAG and I2C interface to enable monitoring
from an external master. Out of these interfaces currently only DRP is
supported. Other block PS-SYSMON is memory mapped to PS.

The AMS can use internal channels to monitor voltage and temperature as
well as one primary and up to 16 auxiliary channels for measuring
external voltages.

The voltage and temperature monitoring channels also have event capability
which allows to generate an interrupt when their value falls below or
raises above a set threshold.

Co-developed-by: Manish Narani <manish.narani@xilinx.com>
Signed-off-by: Manish Narani <manish.narani@xilinx.com>
Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
Link: https://lore.kernel.org/r/20211203212358.31444-4-anand.ashok.dumbre@xilinx.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodevice property: Add fwnode_iomap()
Anand Ashok Dumbre [Fri, 3 Dec 2021 21:23:54 +0000 (21:23 +0000)]
device property: Add fwnode_iomap()

This patch introduces a new helper routine - fwnode_iomap(), which
allows to map the memory mapped IO for a given device node.

This implementation does not cover the ACPI case and may be expanded
in the future. The main purpose here is to be able to develop resource
provider agnostic drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/20211203212358.31444-2-anand.ashok.dumbre@xilinx.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.
Jonathan Cameron [Sun, 28 Nov 2021 17:24:45 +0000 (17:24 +0000)]
iio:accel:kxcjk-1013: Mark struct __maybe_unused to avoid warning.

This structure is only used in PM ops, so may not be used depending
on build configuration.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211128172445.2616166-13-jic23@kernel.org
2 years agoiio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops.
Jonathan Cameron [Sun, 28 Nov 2021 17:24:44 +0000 (17:24 +0000)]
iio:accel:bmc150: Mark structure __maybe_unused as only needed with for pm ops.

If CONFIG_PM not set then clang warns this structure is unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211128172445.2616166-12-jic23@kernel.org
2 years agoiio:dummy: Drop set but unused variable len.
Jonathan Cameron [Sun, 28 Nov 2021 17:24:43 +0000 (17:24 +0000)]
iio:dummy: Drop set but unused variable len.

Not sure what the thinking was here, as lost to history, but the
variable is clearly not used so get rid of it.

Warning seen with clang W=1 tests (may be present with other compilers
and build options).

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211128172445.2616166-11-jic23@kernel.org
2 years agoiio:magn:ak8975: Suppress clang W=1 warning about pointer to enum conversion.
Jonathan Cameron [Sun, 28 Nov 2021 17:24:42 +0000 (17:24 +0000)]
iio:magn:ak8975: Suppress clang W=1 warning about pointer to enum conversion.

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Jonathan Albrieux <jonathan.albrieux@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211128172445.2616166-10-jic23@kernel.org
2 years agoiio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.
Jonathan Cameron [Sun, 28 Nov 2021 17:24:41 +0000 (17:24 +0000)]
iio:imu:inv_mpu6050: Suppress clang W=1 warning about pointer to enum conversion.

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Baptiste Mansuy <bmansuy@invensense.com>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211128172445.2616166-9-jic23@kernel.org
2 years agoiio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum conversion.
Jonathan Cameron [Sun, 28 Nov 2021 17:24:40 +0000 (17:24 +0000)]
iio:imu:inv_icm42600: Suppress clang W=1 warning about pointer to enum conversion.

Cast to a uintptr_t rather than directly to the enum.

As per the discussion in below linked media patch.

Link: https://lore.kernel.org/linux-media/CAK8P3a2ez6nEw4d+Mqa3XXAz0RFTZHunqqRj6sCt7Y_Eqqs0rw@mail.gmail.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20211128172445.2616166-8-jic23@kernel.org