platform/kernel/linux-rpi.git
2 years agoiio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Tue, 21 Jun 2022 20:26:49 +0000 (21:26 +0100)]
iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Zhiyong Tao <zhiyong.tao@mediatek.com>
Cc: Hui Liu <hui.liu@mediatek.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-7-jic23@kernel.org
2 years agoiio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Tue, 21 Jun 2022 20:26:48 +0000 (21:26 +0100)]
iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-6-jic23@kernel.org
2 years agoiio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Tue, 21 Jun 2022 20:26:47 +0000 (21:26 +0100)]
iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

In this case we only gain the ability to have the compiler drop the
struct dev_pm_ops because the callbacks are called from paths other
than suspend and resume.  In general the purpose of this new macro
is to allow automated removal of the callbacks as well, but that doesn't
apply here.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-5-jic23@kernel.org
2 years agoiio: adc: at91-sam5d2: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Tue, 21 Jun 2022 20:26:46 +0000 (21:26 +0100)]
iio: adc: at91-sam5d2: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Eugen Hristev <eugen.hristev@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-4-jic23@kernel.org
2 years agoiio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Tue, 21 Jun 2022 20:26:45 +0000 (21:26 +0100)]
iio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-3-jic23@kernel.org
2 years agoiio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()
Jonathan Cameron [Tue, 21 Jun 2022 20:26:44 +0000 (21:26 +0100)]
iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr()

Using these newer macros allows the compiler to remove the unused
structure and functions when !CONFIG_PM_SLEEP + removes the need to
mark pm functions __maybe_unused.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Paul Cercueil <paul@crapouillou.net>
Link: https://lore.kernel.org/r/20220621202719.13644-2-jic23@kernel.org
2 years agoiio: adc: ti-ads124s08: Drop unused parameter to ads124s_read()
Jonathan Cameron [Sun, 26 Jun 2022 15:38:28 +0000 (16:38 +0100)]
iio: adc: ti-ads124s08: Drop unused parameter to ads124s_read()

The channel number is never used in this call, so don't pass it in.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/20220626153828.589664-1-jic23@kernel.org
2 years agoiio: ABI: stm32-timer-trigger: Fuse unusual ABI into main doc.
Jonathan Cameron [Sun, 26 Jun 2022 16:55:10 +0000 (17:55 +0100)]
iio: ABI: stm32-timer-trigger: Fuse unusual ABI into main doc.

We can't duplicate the description of sampling_frequency. This device
has some unusual requirements which we solved by giving a
sampling_frequency of 0 special meaning. As such add a note
about this unusual usage to the main documentation.

Whilst I don't particularly like this resolution, it is the best
I could come up with given earlier discussion on this topic.

Link: https://lore.kernel.org/linux-iio/20210315101217.00002c50@Huawei.com/
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/20220626165511.602202-4-jic23@kernel.org
2 years agoiio: ABI: max31865: Drop in_filter_notch_centre_frequency as in main docs.
Jonathan Cameron [Sun, 26 Jun 2022 16:55:09 +0000 (17:55 +0100)]
iio: ABI: max31865: Drop in_filter_notch_centre_frequency as in main docs.

As this is the last element in the file, also delete the file.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Navin Sankar Velliangiri <navin@linumiz.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/20220626165511.602202-3-jic23@kernel.org
2 years agoiio: ABI: temperature: Unify documentation for thermocouple fault detection.
Jonathan Cameron [Sun, 26 Jun 2022 16:55:08 +0000 (17:55 +0100)]
iio: ABI: temperature: Unify documentation for thermocouple fault detection.

Kernel documentation for a given ABI element should not be duplicated
in multiple files, so pull them into one higher level documentation file.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Navin Sankar Velliangiri <navin@linumiz.com>
Cc: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link: https://lore.kernel.org/r/20220626165511.602202-2-jic23@kernel.org
2 years agoiio: Be consistent with allocation result tests.
Joe Simmons-Talbott [Mon, 18 Jul 2022 02:03:48 +0000 (22:03 -0400)]
iio: Be consistent with allocation result tests.

Make both allocation result tests use the same format

    if (!ptr)

Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com>
Link: https://lore.kernel.org/r/20220718020348.32047-1-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: Use parens with sizeof
Joe Simmons-Talbott [Sun, 17 Jul 2022 15:34:38 +0000 (11:34 -0400)]
iio: Use parens with sizeof

Prefer 'sizeof(var)' over 'sizeof var' as reported by checkpatch.pl.

Signed-off-by: Joe Simmons-Talbott <joetalbott@gmail.com>
Link: https://lore.kernel.org/r/20220717153438.10800-1-joetalbott@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: npcm: Add NPCM8XX support
Tomer Maimon [Wed, 13 Jul 2022 13:26:40 +0000 (16:26 +0300)]
iio: adc: npcm: Add NPCM8XX support

Adding ADC NPCM8XX support to NPCM ADC driver.
ADC NPCM8XX uses a different resolution and voltage reference.

As part of adding NPCM8XX support:
- Add NPCM8XX specific compatible string.
- Add data to handle architecture-specific ADC parameters.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Link: https://lore.kernel.org/r/20220713132640.215916-3-tmaimon77@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: adc: npcm: Add npcm845 compatible string
Tomer Maimon [Wed, 13 Jul 2022 13:26:39 +0000 (16:26 +0300)]
dt-bindings: iio: adc: npcm: Add npcm845 compatible string

Add a compatible string for Nuvoton BMC NPCM845 ADC.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220713132640.215916-2-tmaimon77@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: cros: Register FIFO callback after sensor is registered
Gwendal Grignou [Mon, 11 Jul 2022 14:47:16 +0000 (07:47 -0700)]
iio: cros: Register FIFO callback after sensor is registered

Instead of registering callback to process sensor events right at
initialization time, wait for the sensor to be register in the iio
subsystem.

Events can come at probe time (in case the kernel rebooted abruptly
without switching the sensor off for  instance), and be sent to IIO core
before the sensor is fully registered.

Fixes: aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO")
Reported-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20220711144716.642617-1-gwendal@chromium.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: test: rework Kconfig to support modules
Liam Beguin [Sun, 10 Jul 2022 01:31:09 +0000 (21:31 -0400)]
iio: test: rework Kconfig to support modules

Rework the IIO test Kconfig to support building KUnit tests as modules.
This lets users execute tests at runtime in addition to the usual
tools/testing/kunit/kunit.py script.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Link: https://lore.kernel.org/r/20220710013109.3349104-6-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: afe: rescale: export symbols used during testing
Liam Beguin [Sun, 10 Jul 2022 01:31:08 +0000 (21:31 -0400)]
iio: afe: rescale: export symbols used during testing

In preparation for module support, export symbols use during testing.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Link: https://lore.kernel.org/r/20220710013109.3349104-5-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: test: format: follow CONFIG_ naming convention
Liam Beguin [Sun, 10 Jul 2022 01:31:07 +0000 (21:31 -0400)]
iio: test: format: follow CONFIG_ naming convention

The KUnit documentation indicates that all KUnit Kconfig entries must
match CONFIG_<name>_KUNIT_TEST: where <name> is the name of the test
suite. Rename the IIO_TEST_FORMAT configuration accordingly.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Link: https://lore.kernel.org/r/20220710013109.3349104-4-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: test: format: add MODULE_* information
Liam Beguin [Sun, 10 Jul 2022 01:31:06 +0000 (21:31 -0400)]
iio: test: format: add MODULE_* information

In preparation for module support, add missing MODULE_* information.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Link: https://lore.kernel.org/r/20220710013109.3349104-3-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: test: rescale: add MODULE_* information
Liam Beguin [Sun, 10 Jul 2022 01:31:05 +0000 (21:31 -0400)]
iio: test: rescale: add MODULE_* information

In preparation for module support, add missing MODULE_* information.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
Link: https://lore.kernel.org/r/20220710013109.3349104-2-liambeguin@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: ad7949: Fix error message
Thorsten Scherer [Fri, 8 Jul 2022 20:17:20 +0000 (22:17 +0200)]
iio: adc: ad7949: Fix error message

Signed-off-by: Thorsten Scherer <t.scherer@eckelmann.de>
Reviewed-by: Liam Beguin <liambeguin@gmail.com>
Link: https://lore.kernel.org/r/20220708201720.16523-1-t.scherer@eckelmann.de
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: dac: cio-dac: Cleanup indexing for DAC writes
William Breathitt Gray [Thu, 7 Jul 2022 17:21:25 +0000 (13:21 -0400)]
iio: dac: cio-dac: Cleanup indexing for DAC writes

Simplify DAC write code by defining base member as u16 __iomem *; DAC
registers are 16-bit so this allows us to index each DAC channel
directly in a loop rather than calculating the offsets by multipling by
2 each time.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/d9dab6696af7eabb2d46f5cbc7871329f499c1c9.1657213745.git.william.gray@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: stx104: Implement and utilize register structures
William Breathitt Gray [Thu, 7 Jul 2022 17:21:24 +0000 (13:21 -0400)]
iio: adc: stx104: Implement and utilize register structures

Reduce magic numbers and improve code readability by implementing and
utilizing named register data structures.

Tested-by: Fred Eckert <Frede@cmslaser.com>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/8cb91d5b53e57b066120e42ea07000d6c7ef5543.1657213745.git.william.gray@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: magnetometer: rm3100: do not explicity set INDIO_BUFFER_TRIGGERED mode
Marcus Folkesson [Sat, 2 Jul 2022 08:50:05 +0000 (10:50 +0200)]
iio: magnetometer: rm3100: do not explicity set INDIO_BUFFER_TRIGGERED mode

The core sets INDIO_BUFFER_TRIGGERED as part of
devm_iio_triggered_buffer_setup().

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Link: https://lore.kernel.org/r/20220702085005.31666-1-marcus.folkesson@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: proximity: sx_common: Allow IIO core to take care of firmware node
Andy Shevchenko [Wed, 15 Jun 2022 11:47:46 +0000 (14:47 +0300)]
iio: proximity: sx_common: Allow IIO core to take care of firmware node

IIO core correctly will take care of firmware node if it's not set in
the driver. Drop ACPI and OF specifics from the driver and allow IIO
core to handle this.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220615114746.2767-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: proximity: sx_common: Don't use IIO device for properties
Andy Shevchenko [Wed, 15 Jun 2022 11:47:45 +0000 (14:47 +0300)]
iio: proximity: sx_common: Don't use IIO device for properties

It's not correct to use artificial device created by IIO core to
retrieve device properties. Even ->get_default_reg() callback
takes a simple struct device pointer which suggests it wants to
operate on the real device.

Correct this by replacing pointer to IIO device by a real device
pointer in the caller of ->get_default_reg().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Link: https://lore.kernel.org/r/20220615114746.2767-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: trigger: move trig->owner init to trigger allocate() stage
Dmitry Rokosov [Wed, 1 Jun 2022 17:48:32 +0000 (17:48 +0000)]
iio: trigger: move trig->owner init to trigger allocate() stage

To provide a new IIO trigger to the IIO core, usually driver executes the
following pipeline: allocate()/register()/get(). Before, IIO core assigned
trig->owner as a pointer to the module which registered this trigger at
the register() stage. But actually the trigger object is owned by the
module earlier, on the allocate() stage, when trigger object is
successfully allocated for the driver.

This patch moves trig->owner initialization from register()
stage of trigger initialization pipeline to allocate() stage to
eliminate all misunderstandings and time gaps between trigger object
creation and owner acquiring.

Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
Link: https://lore.kernel.org/r/20220601174837.20292-1-ddrokosov@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agodt-bindings: iio: adc: Add imx6ul & imx6sx compatibles
Alexander Stein [Mon, 13 Jun 2022 12:35:29 +0000 (14:35 +0200)]
dt-bindings: iio: adc: Add imx6ul & imx6sx compatibles

Both are already using the vf610 compatible.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220613123529.466528-1-alexander.stein@ew.tq-group.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMerge tag 'extcon-next-for-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Sat, 16 Jul 2022 05:24:37 +0000 (07:24 +0200)]
Merge tag 'extcon-next-for-5.20' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon next for v5.20

Detailed description for this pull request:
1. Add new connector type of both EXTCON_DISP_CVBS and EXTCON_DISP_EDP
- Add both EXTCON_DISP_CVBS for Composite Video Broadcast Signal[1] and
  EXTCON_DISP_EDP for Embedded Display Port[2].
  [1] https://en.wikipedia.org/wiki/Composite_video
  [2] https://en.wikipedia.org/wiki/DisplayPort#eDP

2. Fix the minor issues of extcon provider driver
- Drop unused remove function on extcon-fsa9480.c
- Remove extraneous space before a debug message on extcon-palmas.c
- Remove duplicate word in the comment
- Drop useless mask_invert flag on irqchip on extcon-sm5502.c
- Drop useless mask_invert flag on irqchip on extcon-rt8973a.c

* tag 'extcon-next-for-5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon:
  extcon: Add EXTCON_DISP_CVBS and EXTCON_DISP_EDP
  extcon: rt8973a: Drop useless mask_invert flag on irqchip
  extcon: sm5502: Drop useless mask_invert flag on irqchip
  extcon: Drop unexpected word "the" in the comments
  extcon: Remove extraneous space before a debug message
  extcon: fsa9480: Drop no-op remove function

2 years agoMerge tag 'icc-5.20-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov...
Greg Kroah-Hartman [Sat, 16 Jul 2022 05:22:21 +0000 (07:22 +0200)]
Merge tag 'icc-5.20-rc1-v2' of git://git./linux/kernel/git/djakov/icc into char-misc-next

Georgi writes:

interconnect changes for 5.20

Here are the interconnect changes for the 5.20-rc1 merge window consisting
of two new drivers, misc driver improvements and new device managed API.

 Core change:
- Add device managed bulk API

 Driver changes:
- New driver for NXP i.MX8MP platforms
- New driver for Qualcomm SM6350 platforms
- Multiple bucket support for Qualcomm RPM-based drivers.

Signed-off-by: Georgi Djakov <djakov@kernel.org>
* tag 'icc-5.20-rc1-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
  PM / devfreq: imx: Register i.MX8MP interconnect device
  interconnect: imx: Add platform driver for imx8mp
  interconnect: imx: configure NoC mode/prioriry/ext_control
  interconnect: imx: introduce imx_icc_provider
  interconnect: imx: set src node
  interconnect: imx: fix max_node_id
  interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values
  interconnect: qcom: icc-rpm: Support multiple buckets
  interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended()
  interconnect: qcom: Move qcom_icc_xlate_extended() to a common file
  dt-bindings: interconnect: Update property for icc-rpm path tag
  interconnect: icc-rpm: Set destination bandwidth as well as source bandwidth
  interconnect: qcom: msm8939: Use icc_sync_state
  interconnect: add device managed bulk API
  dt-bindings: interconnect: add fsl,imx8mp.h
  dt-bindings: interconnect: imx8m: Add bindings for imx8mp noc
  interconnect: qcom: Add SM6350 driver support
  dt-bindings: interconnect: Add Qualcomm SM6350 NoC support
  dt-bindings: interconnect: qcom: Split out rpmh-common bindings
  interconnect: qcom: icc-rpmh: Support child NoC device probe

2 years agofirmware: stratix10-svc: fix kernel-doc warning
Dinh Nguyen [Fri, 15 Jul 2022 15:03:49 +0000 (10:03 -0500)]
firmware: stratix10-svc: fix kernel-doc warning

include/linux/firmware/intel/stratix10-svc-client.h:55: warning: This comment
starts with '/**', but isn't a kernel-doc comment. Refer
Documentation/doc-guide/kernel-doc.rst
 * Flag bit for COMMAND_RECONFIG

Fixes: 4a4709d470e6 ("firmware: stratix10-svc: add new FCS commands")
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/20220715150349.2413994-1-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoMerge branch 'icc-rpm' into icc-next
Georgi Djakov [Fri, 15 Jul 2022 14:56:31 +0000 (17:56 +0300)]
Merge branch 'icc-rpm' into icc-next

This patch set is to support bucket in icc-rpm driver, so it implements
the similar mechanism in the icc-rpmh driver.

It uses interconnect path tag to indicate the bandwidth voting is for
which buckets, and there have three kinds of buckets: AWC, WAKE and
SLEEP, finally the wake and sleep bucket values are used to set the
corresponding clock (active and sleep clocks).  So far, we keep the AWC
bucket but doesn't really use it.

Link: https://lore.kernel.org/r/20220712015929.2789881-1-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agoMerge branch 'icc-imx8mp' into icc-next
Georgi Djakov [Fri, 15 Jul 2022 14:55:48 +0000 (17:55 +0300)]
Merge branch 'icc-imx8mp' into icc-next

This patchset is to support i.MX8MP NoC settings, i.MX8MP NoC initial
value after power up is invalid, need set a valid value after related
power domain up.

This patchset also includes two patch[1,2] during my development to enable
the ICC feature for i.MX8MP.

I not include ddrc DVFS in this patchset, ths patchset is only to
support NoC value mode/priority/ext_control being set to a valid value
that suggested by i.MX Chip Design Team. The value is same as NXP
downstream one inside Arm Trusted Firmware:
https://source.codeaurora.org/external/imx/imx-atf/tree/plat/imx/imx8m/i/gpc.c?h=lf_v2.4#n97

Link: https://lore.kernel.org/r/20220703091132.1412063-1-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agoPM / devfreq: imx: Register i.MX8MP interconnect device
Peng Fan [Sun, 3 Jul 2022 09:11:31 +0000 (17:11 +0800)]
PM / devfreq: imx: Register i.MX8MP interconnect device

Same to i.MX8MM/N/Q, register i.MX8MP interconnect device to make
i.MX8MP Interconnect driver work.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/r/20220703091132.1412063-10-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: imx: Add platform driver for imx8mp
Peng Fan [Sun, 3 Jul 2022 09:11:30 +0000 (17:11 +0800)]
interconnect: imx: Add platform driver for imx8mp

Add a platform driver for the i.MX8MP SoC describing bus topology, based
on internal documentation.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20220703091132.1412063-9-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: imx: configure NoC mode/prioriry/ext_control
Peng Fan [Sun, 3 Jul 2022 09:11:29 +0000 (17:11 +0800)]
interconnect: imx: configure NoC mode/prioriry/ext_control

Introduce imx_icc_noc_setting structure to describe a master port setting
Pass imx_icc_noc_setting as a parameter from specific driver
Set priority level, mode, ext control in imx_icc_node_set

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20220703091132.1412063-8-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: imx: introduce imx_icc_provider
Peng Fan [Sun, 3 Jul 2022 09:11:28 +0000 (17:11 +0800)]
interconnect: imx: introduce imx_icc_provider

Introduce imx_icc_provider as a wrapper of icc_provider to
add i.MX specific information.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20220703091132.1412063-7-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: imx: set src node
Peng Fan [Sun, 3 Jul 2022 09:11:27 +0000 (17:11 +0800)]
interconnect: imx: set src node

When set QoS for a icc path, only set dst icc node is not enough,
also need to set src icc node.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20220703091132.1412063-6-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: imx: fix max_node_id
Peng Fan [Sun, 3 Jul 2022 09:11:26 +0000 (17:11 +0800)]
interconnect: imx: fix max_node_id

max_node_id not equal to the ARRAY_SIZE of node array, need increase 1,
otherwise xlate will fail for the last entry. And rename max_node_id
to num_nodes to reflect the reality.

Fixes: f0d8048525d7d ("interconnect: Add imx core driver")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20220703091132.1412063-5-peng.fan@oss.nxp.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agoMerge tag 'soundwire-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul...
Greg Kroah-Hartman [Fri, 15 Jul 2022 05:31:59 +0000 (07:31 +0200)]
Merge tag 'soundwire-5.20-rc1' of git://git./linux/kernel/git/vkoul/soundwire into char-misc-next

Vinod writes:
 "soundwire updates for 5.20-rc1

   - Core: solve the driver bind/unbind problem and remove ops pointer
   - intel: runtime pm updates
   - qcom: audio clock gating updates and device status checks"

* tag 'soundwire-5.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/vkoul/soundwire:
  soundwire: qcom: Enable software clock gating requirement flag
  soundwire: qcom: Check device status before reading devid
  soundwire: qcom: Add flag for software clock gating check
  soundwire: qcom: Add support for controlling audio CGCR from HLOS
  soundwire: intel: use pm_runtime_resume() on component probe
  soundwire: peripheral: remove useless ops pointer
  soundwire: revisit driver bind/unbind and callbacks
  soundwire: bus_type: fix remove and shutdown support

2 years agoextcon: Add EXTCON_DISP_CVBS and EXTCON_DISP_EDP
Michael Wu [Fri, 8 Jul 2022 09:57:14 +0000 (17:57 +0800)]
extcon: Add EXTCON_DISP_CVBS and EXTCON_DISP_EDP

Add EXTCON_DISP_CVBS for Composite Video Broadcast Signal.
Add EXTCON_DISP_EDP for Embedded Display Port

[1] https://en.wikipedia.org/wiki/Composite_video
[2] https://en.wikipedia.org/wiki/DisplayPort#eDP

Signed-off-by: Michael Wu <michael@allwinnertech.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoextcon: rt8973a: Drop useless mask_invert flag on irqchip
Aidan MacDonald [Mon, 20 Jun 2022 20:06:32 +0000 (21:06 +0100)]
extcon: rt8973a: Drop useless mask_invert flag on irqchip

There's no need to set the flag explicitly to false, since that
is the default value from zero initialization.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoextcon: sm5502: Drop useless mask_invert flag on irqchip
Aidan MacDonald [Mon, 20 Jun 2022 20:06:31 +0000 (21:06 +0100)]
extcon: sm5502: Drop useless mask_invert flag on irqchip

There's no need to set the flag explicitly to false, since that
is the default value from zero initialization.

Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoextcon: Drop unexpected word "the" in the comments
Jiang Jian [Tue, 21 Jun 2022 11:50:03 +0000 (19:50 +0800)]
extcon: Drop unexpected word "the" in the comments

there is an unexpected word "the" in the comments that need to be dropped

file: ./drivers/extcon/extcon.c
line: 250

/* Find the the index of extcon cable in edev->supported_cable */
changed to
/* Find the index of extcon cable in edev->supported_cable */

Signed-off-by: Jiang Jian <jiangjian@cdjrlc.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoextcon: Remove extraneous space before a debug message
Colin Ian King [Sun, 19 Jun 2022 08:42:48 +0000 (09:42 +0100)]
extcon: Remove extraneous space before a debug message

There is an extreneous space before a dev_dbg message, remove it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoextcon: fsa9480: Drop no-op remove function
Uwe Kleine-König [Thu, 26 May 2022 13:07:54 +0000 (15:07 +0200)]
extcon: fsa9480: Drop no-op remove function

A remove callback that just returns 0 is equivalent to no callback at all
as can be seen in i2c_device_remove(). So simplify accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2 years agoMAINTAINERS: Update 104-QUAD-8 driver maintainers list
William Breathitt Gray [Thu, 14 Jul 2022 16:07:15 +0000 (12:07 -0400)]
MAINTAINERS: Update 104-QUAD-8 driver maintainers list

Syed Nayyar Waris is no longer available for 104-QUAD-8 driver
maintenance. William Breathitt Gray will continue as the 104-QUAD-8
driver maintainer.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/53ecbe49e48dd142fc19f6436fdbe5b8573c5f9c.1657813472.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agocounter: 104-quad-8: Implement and utilize register structures
William Breathitt Gray [Thu, 14 Jul 2022 16:07:14 +0000 (12:07 -0400)]
counter: 104-quad-8: Implement and utilize register structures

Reduce magic numbers and improve code readability by implementing and
utilizing named register data structures.

Link: https://lore.kernel.org/r/20220707171709.36010-1-william.gray@linaro.org/
Cc: Syed Nayyar Waris <syednwaris@gmail.com>
Tested-by: Fred Eckert <Frede@cmslaser.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/285fdc7c03892251f50bdbf2c28c19998243a6a3.1657813472.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agocounter: 104-quad-8: Utilize iomap interface
William Breathitt Gray [Thu, 14 Jul 2022 16:07:13 +0000 (12:07 -0400)]
counter: 104-quad-8: Utilize iomap interface

This driver doesn't need to access I/O ports directly via inb()/outb()
and friends. This patch abstracts such access by calling ioport_map()
to enable the use of more typical ioread8()/iowrite8() I/O memory
accessor calls.

Link: https://lore.kernel.org/r/861c003318dce3d2bef4061711643bb04f5ec14f.1652201921.git.william.gray@linaro.org
Cc: Syed Nayyar Waris <syednwaris@gmail.com>
Suggested-by: David Laight <David.Laight@ACULAB.COM>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/e971b897cacfac4cb2eca478f5533d2875f5cadd.1657813472.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoMAINTAINERS: Update info for William Breathitt Gray
William Breathitt Gray [Thu, 14 Jul 2022 16:07:12 +0000 (12:07 -0400)]
MAINTAINERS: Update info for William Breathitt Gray

A new job position bestowed a new email address and Counter subsystem
git tree for me.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Link: https://lore.kernel.org/r/694c2da1a01d1a3065239bf2c060018cb3308c34.1657813472.git.william.gray@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agofirmware: stratix10-svc: To support a command ATF Get Version
Ang Tien Sung [Mon, 11 Jul 2022 22:31:40 +0000 (17:31 -0500)]
firmware: stratix10-svc: To support a command ATF Get Version

We are to support a new SMC Command of hexadecimal 0x200 that returns
the ATF Firmware major and minor version.

Signed-off-by: Ang Tien Sung <tien.sung.ang@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-6-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agofirmware: stratix10-svc: extend svc to support RSU feature
Kah Jing Lee [Mon, 11 Jul 2022 22:31:39 +0000 (17:31 -0500)]
firmware: stratix10-svc: extend svc to support RSU feature

Extend Intel Stratix10 service layer driver to support new RSU
DCMF status reporting.

The status of each DCMF is reported. The currently used DCMF is used as
reference, while the other three are compared against it to determine if
they are corrupted.

DCMF = Decision Configuration Management Firmware
RSU = Remote System Update

Signed-off-by: Radu Bacrau <radu.bacrau@intel.com>
Signed-off-by: Ang Tien Sung <tien.sung.ang@intel.com>
Signed-off-by: Kah Jing Lee <kah.jing.lee@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-5-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agofirmware: stratix10-rsu: extend RSU driver to get DCMF status
Kah Jing Lee [Mon, 11 Jul 2022 22:31:38 +0000 (17:31 -0500)]
firmware: stratix10-rsu: extend RSU driver to get DCMF status

Extend RSU driver to get DCMF status.

The status of each DCMF is reported. The currently used DCMF is used as
reference, while the other three are compared against it to determine if
they are corrupted.

DCMF = Decision Configuration Management Firmware.
RSU = Remote System Update

Signed-off-by: Radu Bacrau <radu.bacrau@intel.com>
Signed-off-by: Kah Jing Lee <kah.jing.lee@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-4-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agofirmware: stratix10-svc: add new FCS commands
Ang Tien Sung [Mon, 11 Jul 2022 22:31:37 +0000 (17:31 -0500)]
firmware: stratix10-svc: add new FCS commands

Extending the fpga svc driver to support 6 new FPGA Crypto
Service(FCS) commands.
We are adding FCS SDOS data encryption and decryption,
random number generator, image validation request,
reading the data provision and certificate validation.

Signed-off-by: Ang Tien Sung <tien.sung.ang@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-3-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agofirmware: stratix10-svc: add FCS polling command
Ang Tien Sung [Mon, 11 Jul 2022 22:31:36 +0000 (17:31 -0500)]
firmware: stratix10-svc: add FCS polling command

Introduce a new SMC command INTEL_SIP_SMC_FUNCID_SERVICE_COMPLETED
that polls if a previous asynchronous command was completed. This
SMC command is used by the new FPGA Crypto Service (FCS).
A basic example is that the FCS sends an AES data encryption
call to the secure device manager(SDM) and waits for the completion
of the operation by continuously polling the results with the new
command.

Signed-off-by: Ang Tien Sung <tien.sung.ang@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-2-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agofirmware: stratix10-svc: Add support for FCS
Ang Tien Sung [Mon, 11 Jul 2022 22:31:35 +0000 (17:31 -0500)]
firmware: stratix10-svc: Add support for FCS

Extend Intel service layer driver to support FPGA Crypto service(FCS)
features on Intel Soc platforms. Adding an additional channel and FCS
platform driver ("intel_fcs") as part of the probe method.
FCS driver uses the driver to send crypto operations' commands to
the secure device manager(SDM) on Intel Soc platforms Stratix10 and
Agilex.

Signed-off-by: Ang Tien Sung <tien.sung.ang@intel.com>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Link: https://lore.kernel.org/r/20220711223140.2307945-1-dinguyen@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agomisc: Add a mechanism to detect stalls on guest vCPUs
Sebastian Ene [Mon, 11 Jul 2022 08:17:20 +0000 (08:17 +0000)]
misc: Add a mechanism to detect stalls on guest vCPUs

This driver creates per-cpu hrtimers which are required to do the
periodic 'pet' operation. On a conventional watchdog-core driver, the
userspace is responsible for delivering the 'pet' events by writing to
the particular /dev/watchdogN node. In this case we require a strong
thread affinity to be able to account for lost time on a per vCPU.

This part of the driver is the 'frontend' which is reponsible for
delivering the periodic 'pet' events, configuring the virtual peripheral
and listening for cpu hotplug events. The other part of the driver is
an emulated MMIO device which is part of the KVM virtual machine
monitor and this part accounts for lost time by looking at the
/proc/{}/task/{}/stat entries.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Will Deacon <will@kernel.org>
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Link: https://lore.kernel.org/r/20220711081720.2870509-3-sebastianene@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agodt-bindings: vcpu_stall_detector: Add qemu,vcpu-stall-detector compatible
Sebastian Ene [Mon, 11 Jul 2022 08:17:19 +0000 (08:17 +0000)]
dt-bindings: vcpu_stall_detector: Add qemu,vcpu-stall-detector compatible

The VCPU stall detection mechanism allows to configure the expiration
duration and the internal counter clock frequency measured in Hz.
Add these properties in the schema.

While this is a memory mapped virtual device, it is expected to be loaded
when the DT contains the compatible: "qemu,vcpu-stall-detector" node.
In a protected VM we trust the generated DT nodes and we don't rely on
the host to present the hardware peripherals.

Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Ene <sebastianene@google.com>
Link: https://lore.kernel.org/r/20220711081720.2870509-2-sebastianene@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agocxl: Fix a memory leak in an error handling path
Christophe JAILLET [Mon, 11 Jul 2022 19:14:48 +0000 (21:14 +0200)]
cxl: Fix a memory leak in an error handling path

A bitmap_zalloc() must be balanced by a corresponding bitmap_free() in the
error handling path of afu_allocate_irqs().

Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/ce5869418f5838187946eb6b11a52715a93ece3d.1657566849.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agocxl: Use the bitmap API to allocate bitmaps
Christophe JAILLET [Mon, 11 Jul 2022 19:14:38 +0000 (21:14 +0200)]
cxl: Use the bitmap API to allocate bitmaps

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Acked-by: Andrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/59010cc7c62443030c69cb1ce0b2b62c5d47e064.1657566849.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agomei: me: fix clang -Wformat warning
Justin Stitt [Fri, 8 Jul 2022 20:35:49 +0000 (13:35 -0700)]
mei: me: fix clang -Wformat warning

When building with Clang we encounter the following warning:
| drivers/misc/mei/hw-me.c:564:44: error: format specifies type 'unsigned
| short' but the argument has type 'int' [-Werror,-Wformat]
| dev_dbg(dev->dev, "empty slots = %hu.\n", empty_slots);

The format specifier used is `%hu` which specifies an unsigned short,
however, empty_slots is an int -- hence the warning.

Link: https://github.com/ClangBuiltLinux/linux/issues/378
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Justin Stitt <justinstitt@google.com>
Link: https://lore.kernel.org/r/20220708203549.3834790-1-justinstitt@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoeeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write()
Dan Carpenter [Fri, 8 Jul 2022 13:46:38 +0000 (16:46 +0300)]
eeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write()

The simple_write_to_buffer() function will return positive/success if it
is able to write a single byte anywhere within the buffer.  However that
potentially leaves a lot of the buffer uninitialized.

In this code it's better to return 0 if the offset is non-zero.  This
code is not written to support partial writes.  And then return -EFAULT
if the buffer is not completely initialized.

Fixes: cfad6425382e ("eeprom: Add IDT 89HPESx EEPROM/CSR driver")
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Ysg1Pu/nzSMe3r1q@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agoMerge tag 'iio-for-5.20a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 14 Jul 2022 13:04:49 +0000 (15:04 +0200)]
Merge tag 'iio-for-5.20a' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

IIO new device support, features and minor fixes for 5.20

Several on-running cleanup efforts dominate this time, plus the DMA
safety alignment issue identified due to improved understanding of
the restrictions as a result of Catalin Marinas' efforts in that area.

One immutable branch in here due to MFD and SPMI elements needed for
the qcom-rradc driver.

Device support
* bmi088
  - Add support for bmi085 (accelerometer part of IMU)
  - Add support for bmi090l (accelerometer part of IMU)
* mcp4922
  - Add support for single channel device MCP4921
* rzg2l-adc
  - Add compatible and minor tweaks to support RZ/G2UL ADC
* sca3300
  - Add support for scl3300 including refactoring driver to support
    multiple device types and cleanup noticed whilst working on driver.
* spmi-rradc
  - New driver for Qualcomm SPMI Round Robin ADC including necessary
    additional utility functions in SPMI core and related MFD driver.
* ti-dac55781
  - Add compatible for DAC121C081 which is very similar to existing parts.

Features
* core
  - Warn on iio_trigger_get() on an unregistered IIO trigger.
* bma400
  - Triggered buffer support
  - Activity and step counting
  - Misc driver improvements such as devm and header ordering
* cm32181
  - Add PM support.
* cros_ec
  - Sensor location support
* sx9324
  - Add precharge resistor setting
  - Add internal compensation resistor setting
  - Add CS idle/sleep mode.
* sx9360
  - Add precharge resistor setting
* vl53l0x
  - Handle reset GPIO, regulator and relax handling of irq type.

Cleanup and minor fixes:

Treewide changes
- Cleanup of error handling in remove functions in many drivers.
- Update dt-binding maintainers for a number of ADI bindings.
- Several sets of conversion of drivers from device tree specific to
  generic device properties. Includes fixing up various related
  header and Kconfig issues.
- Drop include of of.h from iio.h and fix up drivers that need to include
  it directly.
- More moves of clusters of drivers into appropriate IIO_XXX namespaces.
- Tree wide fix of a long running bug around DMA safety requirements.
  IIO was using __cacheline_aligned to pad iio_priv() structures. This
  worked for a long time by coincidence, but correct alignment is
  ARCH_KMALLOC_MINALIGN.  As there is activity around this area, introduce
  an IIO local IIO_DMA_MINALIGN to allow for changing it in one place rather
  than every driver in future. Note, there have been no reports of this
  bug in the wild, and it may not happen on any platforms supported by
  upstream, so no rush to backport these fixes.

Other cleanup
* core
  - Switch to ida_alloc()/free()
  - Drop unused iio_get_time_res()
  - Octal permissions and DEVICE_ATTR_* macros.
  - Cleanup bared unsigned usage.
* MAINTAINERS
  - Add include/dt-bindings/iio/ to the main IIO entry.
* ad5380
  - Comment syntax fix.
* ad74413r
  - Call to for_each_set_bit_from(), with from value as 0 replaced.
* ad7768-1
  - Drop explicit setting of INDIO_BUFFER_TRIGGERED as now done by the core.
* adxl345
  - Fix wrong address in dt-binding example.
* adxl367
  - Drop extra update of FIFO watermark.
* at91-sama5d2
  - Limit requested watermark to the hwfifo size.
* bmg160, bme680
  - Typos
* cio-dac
  - Switch to iomap rather than direct use of ioports
* kxsd9
  - Replace CONFIG_PM guards with new PM macros that let the compiler
    cleanly remove the unused code and structures when !CONFIG_PM
* lsm6dsx
  - Use new pm_sleep_ptr() and EXPORT_SIMPLE_DEV_PM_OPS(). Then move
    to Namespace.
* meson_saradc - general cleanup.
  - Avoid attaching resources to iio_dev->dev
  - Use same struct device for all error messages
  - Convert to dev_err_probe() and use local struct device *dev to
    reduce code complexity.
  - Use devm_clk_get_optional() instead of hand rolling.
  - Use regmap_read_poll_timeout() instead of hand rolling.
* mma7660
  - Drop ACPI_PTR() use that is unhelpful.
* mpu3050
  - Stop exporting symbols not used outside of module
  - Switch to new DEFINE_RUNTIME_DEV_PM_OPS() macro and move to Namespace.
* ping
  - Typo fix
* qcom-spmi-rradc
  - Typo fix
* sc27xx
  - Convert to generic struct u32_fract
* srf08
  - Drop a redundant check on !val
* st_lsm6dsx
  - Limit the requested watermark to the hwfifo size.
* stm32-adc
  - Use generic_handle_domain_irq() instead of opencoding.
  - Fix handling of ADC disable.
* stm32-dac
  - Use str_enabled_disable() instead of open coding.
* stx104
  - Switch to iomap rather than direct use of ioports
* tsc2046
  - Drop explicit setting of INDIO_BUFFER_TRIGGERED as now done by the core.
* tsl2563
  - Replace flush_scheduled_work() with cancel_delayed_work_sync()
  - Replace cancel_delayed_work() with cancel_delayed_work_sync()
* vl53l0x
  - Make the VDD regulator optional by allowing a dummy regulator.

* tag 'iio-for-5.20a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (244 commits)
  iio: adc: xilinx-xadc: Drop duplicate NULL check in xadc_parse_dt()
  iio: adc: xilinx-xadc: Make use of device properties
  iio: light: cm32181: Add PM support
  iio: adc: ad778-1: do not explicity set INDIO_BUFFER_TRIGGERED mode
  iio: adc: ti-tsc2046: do not explicity set INDIO_BUFFER_TRIGGERED mode
  iio: adc: stm32-adc: disable adc before calibration
  iio: adc: stm32-adc: make safe adc disable
  iio: dac: ad5380: align '*' each line and drop unneeded blank line
  iio: adc: qcom-spmi-rradc: Fix spelling mistake "coherrency" -> "coherency"
  iio: Don't use bare "unsigned"
  dt-bindings: iio: dac: mcp4922: expand for mcp4921 support
  iio: dac: mcp4922: add support to mcp4921
  iio: chemical: sps30: Move symbol exports into IIO_SPS30 namespace
  iio: pressure: bmp280: Move symbol exports to IIO_BMP280 namespace
  iio: imu: bmi160: Move exported symbols to IIO_BMI160 namespace
  iio: adc: stm32-adc: Use generic_handle_domain_irq()
  proximity: vl53l0x: Make VDD regulator actually optional
  MAINTAINERS: add include/dt-bindings/iio to IIO SUBSYSTEM AND DRIVERS
  dt-bindings: iio/accel: Fix adi,adxl345/6 example I2C address
  iio: gyro: bmg160: Fix typo in comment
  ...

2 years agoiio: adc: xilinx-xadc: Drop duplicate NULL check in xadc_parse_dt()
Andy Shevchenko [Tue, 31 May 2022 14:11:18 +0000 (17:11 +0300)]
iio: adc: xilinx-xadc: Drop duplicate NULL check in xadc_parse_dt()

The fwnode_for_each_child_node() is NULL-aware, no need to check
its parameters outside. Drop duplicate NULL check in xadc_parse_dt().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220531141118.64540-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoiio: adc: xilinx-xadc: Make use of device properties
Andy Shevchenko [Tue, 31 May 2022 14:11:17 +0000 (17:11 +0300)]
iio: adc: xilinx-xadc: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Add mod_devicetable.h include.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20220531141118.64540-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2 years agoMerge tag 'misc-habanalabs-next-2022-07-12' of https://git.kernel.org/pub/scm/linux...
Greg Kroah-Hartman [Tue, 12 Jul 2022 08:53:21 +0000 (10:53 +0200)]
Merge tag 'misc-habanalabs-next-2022-07-12' of https://git./linux/kernel/git/ogabbay/linux into char-misc-next

Oded writes:

This tag contains habanalabs driver changes for v5.20:

- Add Gaudi2 ASIC support. All the features required for Gaudi2 are included
  in this tag (except the networking aspect).

- Add more events to the eventfd support in the driver. With the new code, we
  expose three events that the user can register to get notification about them.

- re-factor soft reset code and replace its name to compute reset to better
  reflect the actual reset done in new ASICs

- Change the way Gaudi2 triggers an MSI-X interrupt due to h/w bug.

- Improve the code of the debugfs node that scrubs the device's memory.

- Add mechanism for better compatibility with older f/w versions

- Cleanup kernel log prints by moving some prints to debug and removing others.

- Many small bug fixes and minor changes.

* tag 'misc-habanalabs-next-2022-07-12' of https://git.kernel.org/pub/scm/linux/kernel/git/ogabbay/linux: (88 commits)
  habanalabs: move h/w dirty message to debug
  habanalabs: rename soft reset to compute reset
  habanalabs: add status of reset after device release
  habanalabs: fix update of is_in_soft_reset
  habanalabs: expose only valid debugfs nodes
  habanalabs/gaudi2: map virtual MSI-X doorbell memory for user
  habanalabs/gaudi2: modify decoder to use virtual MSI-X doorbell
  habanalabs/gaudi2: modify CS completion CQ to use virtual MSI-X doorbell
  habanalabs/gaudi2: replace defines for reserved sob/mob with enums
  habanalabs/gaudi2: configure virtual MSI-X doorbell interface
  habanalabs: add a value field to hl_fw_send_pci_access_msg()
  habanalabs: fixes to the poll-timeout macros
  habanalabs/gaudi2: use DIV_ROUND_UP_SECTOR_T instead of roundup
  habanalabs: initialize variable explicitly
  habanalabs: Use the bitmap API to allocate bitmaps
  habanalabs/gaudi2: remove unused defines
  habanalabs: make sure variable is set before used
  habanalabs: don't declare tmp twice in same function
  habanalabs: do not set max power on a secured device
  habanalabs/gaudi2: SM mask can only be 8-bit
  ...

2 years agodrivers: mcb: directly use ida_alloc()/free()
keliu [Tue, 12 Jul 2022 06:50:08 +0000 (23:50 -0700)]
drivers: mcb: directly use ida_alloc()/free()

Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .

Signed-off-by: keliu <liuke94@huawei.com>
Signed-off-by: Johannes Thumshirn <jth@kernel.org>
Link: https://lore.kernel.org/r/480676bee970da16bf1fa8565277240014395ba3.1657607743.git.johannes.thumshirn@wdc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 years agointerconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values
Leo Yan [Tue, 12 Jul 2022 01:59:29 +0000 (09:59 +0800)]
interconnect: qcom: icc-rpm: Set bandwidth and clock for bucket values

This commit uses buckets for support bandwidth and clock rates.  It
introduces a new function qcom_icc_bus_aggregate() to calculate the
aggregate average and peak bandwidths for every bucket, and also it
calculates the maximum value of aggregated average bandwidth across all
buckets.

The maximum aggregated average is used to calculate the final bandwidth
requests.  And we can set the clock rate per bucket, we use SLEEP bucket
as default bucket if a platform doesn't enable the interconnect path
tags in DT binding; otherwise, we use WAKE bucket to set active clock
and use SLEEP bucket for other clocks.  So far we don't use AMC bucket.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Link: https://lore.kernel.org/r/20220712015929.2789881-6-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: qcom: icc-rpm: Support multiple buckets
Leo Yan [Tue, 12 Jul 2022 01:59:28 +0000 (09:59 +0800)]
interconnect: qcom: icc-rpm: Support multiple buckets

The current interconnect rpm driver uses a single aggregate bandwidth to
calculate the clock rates for both active and sleep clocks; therefore,
it has no chance to separate bandwidth requests for these two kinds of
clocks.

This patch studies the implementation from interconnect rpmh driver to
support multiple buckets.  The rpmh driver provides three buckets for
AMC, WAKE, and SLEEP; this driver only needs to use WAKE and SLEEP
buckets, but we keep the same way with rpmh driver, this can allow us to
reuse the DT binding and avoid to define duplicated data structures.

This patch introduces two callbacks: qcom_icc_pre_bw_aggregate() is used
to clean up bucket values before aggregate bandwidth requests, and
qcom_icc_bw_aggregate() is to aggregate bandwidth for buckets.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Link: https://lore.kernel.org/r/20220712015929.2789881-5-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended()
Leo Yan [Tue, 12 Jul 2022 01:59:27 +0000 (09:59 +0800)]
interconnect: qcom: icc-rpm: Change to use qcom_icc_xlate_extended()

This commit changes to use callback qcom_icc_xlate_extended().  This
is a preparation for population path tags from the interconnect DT
binding, it doesn't introduce functionality change for the existed DT
binding without path tags.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220712015929.2789881-4-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agointerconnect: qcom: Move qcom_icc_xlate_extended() to a common file
Leo Yan [Tue, 12 Jul 2022 01:59:26 +0000 (09:59 +0800)]
interconnect: qcom: Move qcom_icc_xlate_extended() to a common file

since there have conflict between two headers icc-rpmh.h and icc-rpm.h,
the function qcom_icc_xlate_extended() is declared in icc-rpmh.h thus
it cannot be used by icc-rpm driver.

Move the function to a new common file icc-common.c so that allow it to
be called by multiple drivers.

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20220712015929.2789881-3-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agodt-bindings: interconnect: Update property for icc-rpm path tag
Leo Yan [Tue, 12 Jul 2022 01:59:25 +0000 (09:59 +0800)]
dt-bindings: interconnect: Update property for icc-rpm path tag

To support path tag in icc-rpm driver, the "#interconnect-cells"
property is updated as enumerate values: 1 or 2.  Setting to 1 means
it is compatible with old DT binding that interconnect path only
contains node id; if set to 2 for "#interconnect-cells" property, then
the second specifier is used as a tag (e.g. vote for which buckets).

Signed-off-by: Leo Yan <leo.yan@linaro.org>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220712015929.2789881-2-leo.yan@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
2 years agohabanalabs: move h/w dirty message to debug
Oded Gabbay [Sun, 10 Jul 2022 11:14:04 +0000 (14:14 +0300)]
habanalabs: move h/w dirty message to debug

H/W being dirty during initialization is completely expected in case
f/w tools are used before loading the driver. As it is not an error,
and as it doesn't give any meaningful information to the user,
no point of printing it.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: rename soft reset to compute reset
Oded Gabbay [Thu, 7 Jul 2022 09:00:24 +0000 (12:00 +0300)]
habanalabs: rename soft reset to compute reset

Doing compute reset can be the traditional inference soft reset
that is supported only in Goya.

Or it can be the new reset upon device release, which is supported
in Gaudi2 and above.

Therefore, wherever suitable, use the terminology of compute reset
instead of soft reset.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add status of reset after device release
Oded Gabbay [Thu, 7 Jul 2022 08:42:15 +0000 (11:42 +0300)]
habanalabs: add status of reset after device release

The user might want to know the device is in reset after device
release, which is not an erroneous event as a regular reset.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: fix update of is_in_soft_reset
Oded Gabbay [Thu, 7 Jul 2022 08:39:19 +0000 (11:39 +0300)]
habanalabs: fix update of is_in_soft_reset

reset_info.is_in_soft_reset should be updated both before in_reset
and inside the spin lock of the reset info structure.

The reasons are:

- When we are inside soft reset, it implies we are in reset. Therefore,
  if someone checks if we are in soft reset, he can deduce we are
  in reset, while the opposite is not correct and might be misleading.

- Both these flags are changed together so they must be changed
  inside the reset info spinlock.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: expose only valid debugfs nodes
Ofir Bitton [Thu, 30 Jun 2022 06:54:59 +0000 (09:54 +0300)]
habanalabs: expose only valid debugfs nodes

In case security is enabled on the device, some debugfs nodes will
fail. Hence, we do not expose them.

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/gaudi2: map virtual MSI-X doorbell memory for user
Tomer Tayar [Thu, 30 Jun 2022 19:05:51 +0000 (22:05 +0300)]
habanalabs/gaudi2: map virtual MSI-X doorbell memory for user

Upon the initialization of a user context, map the host memory page of
the virtual MSI-X doorbell in the device MMU.
A reserved VA is used for this purpose, so user can use it directly
without any allocation/map operation.

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/gaudi2: modify decoder to use virtual MSI-X doorbell
Tomer Tayar [Thu, 30 Jun 2022 08:22:54 +0000 (11:22 +0300)]
habanalabs/gaudi2: modify decoder to use virtual MSI-X doorbell

Modify the decoder wrapper blocks to generate interrupts using the
virtual MSI-X doorbell.

As a decoder wrapper block cannot write directly to HBW upon completion,
it writes instead to SOB which is monitored by a master monitor.
When resolved, this monitor will be the one to actually write to the
virtual MSI-X doorbell.

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/gaudi2: modify CS completion CQ to use virtual MSI-X doorbell
Tomer Tayar [Thu, 30 Jun 2022 15:40:59 +0000 (18:40 +0300)]
habanalabs/gaudi2: modify CS completion CQ to use virtual MSI-X doorbell

Modify the CQ which is used for CS completion, to use the virtual MSI-X
doorbell.

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/gaudi2: replace defines for reserved sob/mob with enums
Tomer Tayar [Wed, 29 Jun 2022 16:20:38 +0000 (19:20 +0300)]
habanalabs/gaudi2: replace defines for reserved sob/mob with enums

Following patches are going to add more reserved sync objects and
monitors.
To make the counting of these reserved resources simpler, replace the
existing RESERVED_* defines with enumerations.

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/gaudi2: configure virtual MSI-X doorbell interface
Tomer Tayar [Wed, 29 Jun 2022 13:37:55 +0000 (16:37 +0300)]
habanalabs/gaudi2: configure virtual MSI-X doorbell interface

Due to a watchdog timer in the LBW path, writes to the MSI-X doorbell
can return sporadic error responses.
To work-around this issue, a virtual MSI-X doorbell on the HBW path is
configured, using the MSI-X AXI slave interface in the PCIe controller.
Upon an access to a configured HBW host address, the controller will
generate MSI-X interrupt instead of treating the access as regular host
memory access.

This patch allocates the dedicate host memory page, and communicate the
address to F/W, so it will configure the relevant address match
registers in the controller, and will use this address to generate MSI-X
interrupts for F/W events.

Following patches will handle other initiators in the device, to move
them to use the virtual MSI-X doorbell.

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 a value field to hl_fw_send_pci_access_msg()
Tomer Tayar [Wed, 6 Jul 2022 07:20:54 +0000 (10:20 +0300)]
habanalabs: add a value field to hl_fw_send_pci_access_msg()

For gaudi2 we need to send a value to F/W as part of the
PCI_ACCESS packet.
As a preparation, modify hl_fw_send_pci_access_msg() to have a 'value'
field.

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: fixes to the poll-timeout macros
Ohad Sharabi [Mon, 4 Jul 2022 05:33:57 +0000 (08:33 +0300)]
habanalabs: fixes to the poll-timeout macros

- use conventional internal macro variables (double underscore prefix)
- adjust address casting
- on register poll using ELBI use ELBI read rather than BAR read on
  error condition
- remove unused macro

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/gaudi2: use DIV_ROUND_UP_SECTOR_T instead of roundup
Ohad Sharabi [Thu, 7 Jul 2022 13:03:14 +0000 (16:03 +0300)]
habanalabs/gaudi2: use DIV_ROUND_UP_SECTOR_T instead of roundup

roundup will create an error in 32-bit architectures as we use
64-bit variables.

Reported-by: kernel test robot <lkp@intel.com>
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: initialize variable explicitly
Oded Gabbay [Tue, 5 Jul 2022 08:04:56 +0000 (11:04 +0300)]
habanalabs: initialize variable explicitly

Fix warning of
"warning: ‘old_base’ may be used uninitialized in this function"

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: Use the bitmap API to allocate bitmaps
Christophe JAILLET [Sun, 3 Jul 2022 20:36:30 +0000 (22:36 +0200)]
habanalabs: Use the bitmap API to allocate bitmaps

Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.

It is less verbose and it improves the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs/gaudi2: remove unused defines
Oded Gabbay [Mon, 4 Jul 2022 09:05:30 +0000 (12:05 +0300)]
habanalabs/gaudi2: remove unused defines

There were some defines that are unused in the current upstreamed
code.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: make sure variable is set before used
Oded Gabbay [Mon, 4 Jul 2022 08:53:57 +0000 (11:53 +0300)]
habanalabs: make sure variable is set before used

timestamp could be unset in both _hl_interrupt_wait_ioctl() and
_hl_interrupt_wait_ioctl_user_addr() so it is better to explicitly
initialize it to 0 when declaring it.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: don't declare tmp twice in same function
Oded Gabbay [Mon, 4 Jul 2022 08:51:55 +0000 (11:51 +0300)]
habanalabs: don't declare tmp twice in same function

tmp is declared in the scope of the function cs_do_release() and
inside a block inside that function.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: do not set max power on a secured device
Ofir Bitton [Thu, 30 Jun 2022 11:37:03 +0000 (14:37 +0300)]
habanalabs: do not set max power on a secured device

Max power API is not supported in secured devices. Hence, we should
skip setting it during boot.

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/gaudi2: SM mask can only be 8-bit
Oded Gabbay [Thu, 30 Jun 2022 08:53:33 +0000 (11:53 +0300)]
habanalabs/gaudi2: SM mask can only be 8-bit

Otherwise, due to how we calculate it, we might fail in FIELD_PREP
checks.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs/gaudi2: remove unused variable
Oded Gabbay [Thu, 30 Jun 2022 08:07:59 +0000 (11:07 +0300)]
habanalabs/gaudi2: remove unused variable

glbl_sts_clr_val was set but never used

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: allow detection of unsupported f/w packets
Oded Gabbay [Thu, 30 Jun 2022 06:30:49 +0000 (09:30 +0300)]
habanalabs: allow detection of unsupported f/w packets

If we send a packet to the f/w, and that packet is unsupported, we
want to be able to identify this situation and possibly ignore this.

Therefore, if the f/w returned an error, we need to propagate it
to the callers in the result value, if those callers were interested
in it.

In addition, no point of printing the error code here because each
caller prints its own error with a specific message.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: save f/w preboot minor version
Sagiv Ozeri [Tue, 28 Jun 2022 10:25:48 +0000 (13:25 +0300)]
habanalabs: save f/w preboot minor version

We need this property for backward compatibility against the f/w.

Signed-off-by: Sagiv Ozeri <sozeri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
2 years agohabanalabs: add support for common decoder interrupts
Ofir Bitton [Tue, 28 Jun 2022 15:34:58 +0000 (18:34 +0300)]
habanalabs: add support for common decoder interrupts

User application should be able to get notification for any decoder
completion. Hence, we introduce a new interface in which a user
can wait for all current decoder pending interrupts.

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: naming refactor of user interrupt flow
Ofir Bitton [Tue, 28 Jun 2022 18:05:28 +0000 (21:05 +0300)]
habanalabs: naming refactor of user interrupt flow

Current naming convention can be misleading. Hence renaming some
variables and defines in order to be more explicit.

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 for preboot ready after hard reset
Ohad Sharabi [Tue, 28 Jun 2022 09:09:21 +0000 (12:09 +0300)]
habanalabs: wait for preboot ready after hard reset

Currently we are not waiting for preboot ready after hard reset.
This leads to a race in which COMMs protocol begins but will get no
response from the f/w.

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/gaudi2: reset device upon critical ECC event
Ofir Bitton [Tue, 28 Jun 2022 05:34:28 +0000 (08:34 +0300)]
habanalabs/gaudi2: reset device upon critical ECC event

Correctable ECC events are not fatal, but as they accumulate, the f/w
can decide that a hard-rest is required. This indication is
propagated to the host using the existing ECC event interface.

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: enable gaudi2 code in driver
Oded Gabbay [Mon, 27 Jun 2022 19:32:07 +0000 (22:32 +0300)]
habanalabs: enable gaudi2 code in driver

Enable the Gaudi2 ASIC code in the pci probe callback of the driver so
the driver will handle Gaudi2 ASICs.

Add the PCI ID to the PCI table and add the ASIC enum value to all
relevant places.

Fixup the device parameters initialization for Gaudi2.

Signed-off-by: Oded Gabbay <ogabbay@kernel.org>