platform/kernel/linux-rpi.git
13 months ago/dev/mem: make mem_class a static const structure
Ivan Orlov [Tue, 20 Jun 2023 14:37:55 +0000 (16:37 +0200)]
/dev/mem: make mem_class a static const structure

Now that the driver core allows for struct class to be in read-only
memory, move the mem_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Cc: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620143751.578239-13-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agochar: lp: make lp_class a static const structure
Ivan Orlov [Tue, 20 Jun 2023 14:37:54 +0000 (16:37 +0200)]
char: lp: make lp_class a static const structure

Now that the driver core allows for struct class to be in read-only
memory, move the lp_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Cc: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620143751.578239-12-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodsp56k: make dsp56k_class a static const structure
Ivan Orlov [Tue, 20 Jun 2023 14:37:53 +0000 (16:37 +0200)]
dsp56k: make dsp56k_class a static const structure

Now that the driver core allows for struct class to be in read-only
memory, move the dsp56k_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.

Cc: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620143751.578239-11-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agobsr: make bsr_class a static const structure
Ivan Orlov [Tue, 20 Jun 2023 14:37:52 +0000 (16:37 +0200)]
bsr: make bsr_class a static const structure

Now that the driver core allows for struct class to be in read-only
memory, move the bsr_class structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at boot time.

Cc: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20230620143751.578239-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agooradax: make 'cl' a static const structure
Ivan Orlov [Tue, 20 Jun 2023 18:34:47 +0000 (20:34 +0200)]
oradax: make 'cl' a static const structure

Now that the driver core allows for struct class to be in read-only
memory, move the 'cl' structure to be declared at build time
placing it into read-only memory, instead of having to be dynamically
allocated at load time.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: "Mike Rapoport (IBM)" <rppt@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Ivan Orlov <ivan.orlov0322@gmail.com>
Cc: sparclinux@vger.kernel.org
Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://lore.kernel.org/r/20230620183446.684061-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agoMerge tag 'coresight-next-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Wed, 21 Jun 2023 19:15:06 +0000 (21:15 +0200)]
Merge tag 'coresight-next-v6.5' of git://git./linux/kernel/git/coresight/linux into char-misc-next

Suzuki writes:

coresight: Updates for v6.5

CoreSight and hwtracing subsystem updates for v6.5 includes:

 - Fixes to the CTI module reference leaks. This involves,
   redesign of how the helper devices are tracked and CTI
   devices have been converted to helper devices.
 - Fix removal of the trctraceidr file from sysfs for ETMs.
 - Match all ETMv4 instances based on the ETMv4 architected
   registers and the CoreSight Component ID (CID), than having
   to add individual PIDs for CPUs.
 - Add support for Dummy CoreSight source and sink drivers.
 - Add James Clark as Reviewer for the CoreSight kernel drivers
 - Fixes to HiSilicon PCIe Tune and Trace Device driver

Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
* tag 'coresight-next-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/coresight/linux: (27 commits)
  hwtracing: hisi_ptt: Fix potential sleep in atomic context
  hwtracing: hisi_ptt: Advertise PERF_PMU_CAP_NO_EXCLUDE for PTT PMU
  hwtracing: hisi_ptt: Export available filters through sysfs
  hwtracing: hisi_ptt: Add support for dynamically updating the filter list
  hwtracing: hisi_ptt: Factor out filter allocation and release operation
  coresight: dummy: Update type of mode parameter in dummy_{sink,source}_enable()
  Documentation: trace: Add documentation for Coresight Dummy Trace
  dt-bindings: arm: Add support for Coresight dummy trace
  Coresight: Add coresight dummy driver
  MAINTAINERS: coresight: Add James Clark as Reviewer
  coresight: etm4x: Match all ETM4 instances based on DEVARCH and DEVTYPE
  coresight: etm4x: Make etm4_remove_dev() return void
  coresight: etm4x: Fix missing trctraceidr file in sysfs
  coresight: Fix CTI module refcount leak by making it a helper device
  coresight: Enable and disable helper devices adjacent to the path
  coresight: Refactor out buffer allocation function for ETR
  coresight: Make refcount a property of the connection
  coresight: Store in-connections as well as out-connections
  coresight: Simplify connection fixup mechanism
  coresight: Store pointers to connections rather than an array of them
  ...

13 months agoMerge tag 'icc-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc...
Greg Kroah-Hartman [Wed, 21 Jun 2023 19:12:43 +0000 (21:12 +0200)]
Merge tag 'icc-6.5-rc1' of git://git./linux/kernel/git/djakov/icc into char-misc-next

Georgi writes:

interconnect changes for 6.5

This pull request contains the interconnect changes for the 6.5-rc1 merge
window which is a mix of core and driver changes with the following highlights:

- Support for configuring QoS on the Qualcomm's RPM-based platforms, that
  required special handling of some interface (non-scaling) clocks.
- Support for clock-based interconnect providers for cases when clock
  corresponds to bus bandwidth. This is used to enable CPU cluster bandwidth
  scaling on MSM8996 platforms. One patch is touching a file in the clock
  subsystem that has been acked by the maintainer.

Core changes:
interconnect: add clk-based icc provider support
interconnect: icc-clk: fix modular build
interconnect: drop unused icc_get() interface

Driver changes:
interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks
interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks
interconnect: qcom: rpm: Drop unused parameters
interconnect: qcom: rpm: Set QoS registers only once
interconnect: qcom: rpm: Handle interface clocks
interconnect: qcom: icc-rpm: Enforce 2 or 0 bus clocks
interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore
interconnect: qcom: msm8996: Promote to core_initcall
interconnect: qcom: rpm: allocate enough data in probe()
dt-bindings: interconnect/msm8996-cbf: add defines to be used by CBF
clk: qcom: cbf-msm8996: scale CBF clock according to the CPUfreq
dt-bindings: interconnect: fsl,imx8m-noc: drop unneeded quotes

Signed-off-by: Georgi Djakov <djakov@kernel.org>
* tag 'icc-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/djakov/icc:
  dt-bindings: interconnect: fsl,imx8m-noc: drop unneeded quotes
  interconnect: icc-clk: fix modular build
  clk: qcom: cbf-msm8996: scale CBF clock according to the CPUfreq
  interconnect: drop unused icc_get() interface
  interconnect: qcom: rpm: allocate enough data in probe()
  interconnect: qcom: msm8996: Promote to core_initcall
  interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore
  interconnect: qcom: icc-rpm: Enforce 2 or 0 bus clocks
  interconnect: qcom: rpm: Handle interface clocks
  interconnect: add clk-based icc provider support
  dt-bindings: interconnect/msm8996-cbf: add defines to be used by CBF
  interconnect: qcom: rpm: Set QoS registers only once
  interconnect: qcom: rpm: Drop unused parameters
  interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks
  interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks

13 months agohwtracing: hisi_ptt: Fix potential sleep in atomic context
Yicong Yang [Wed, 21 Jun 2023 09:28:04 +0000 (17:28 +0800)]
hwtracing: hisi_ptt: Fix potential sleep in atomic context

We're using pci_irq_vector() to obtain the interrupt number and then
bind it to the CPU start perf under the protection of spinlock in
pmu::start(). pci_irq_vector() might sleep since [1] because it will
call msi_domain_get_virq() to get the MSI interrupt number and it
needs to acquire dev->msi.data->mutex. Getting a mutex will sleep on
contention. So use pci_irq_vector() in an atomic context is problematic.

This patch cached the interrupt number in the probe() and uses the
cached data instead to avoid potential sleep.

[1] commit 82ff8e6b78fc ("PCI/MSI: Use msi_get_virq() in pci_get_vector()")

Fixes: ff0de066b463 ("hwtracing: hisi_ptt: Add trace function support for HiSilicon PCIe Tune and Trace device")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230621092804.15120-6-yangyicong@huawei.com
13 months agohwtracing: hisi_ptt: Advertise PERF_PMU_CAP_NO_EXCLUDE for PTT PMU
Yicong Yang [Wed, 21 Jun 2023 09:28:03 +0000 (17:28 +0800)]
hwtracing: hisi_ptt: Advertise PERF_PMU_CAP_NO_EXCLUDE for PTT PMU

The PTT trace collects PCIe TLP headers from the PCIe link and don't
have the ability to exclude certain context. It doesn't support itrace
as well. So replace PERF_PMU_CAP_ITRACE with PERF_PMU_CAP_NO_EXCLUDE.
This will greatly save the storage of final data. Tested tracing idle
link for ~15s, without this patch we'll collect ~28.682MB data for
additional information and with this patch it reduced to ~0.226MB.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Tested-by: Junhao He <hejunhao3@huawei.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230621092804.15120-5-yangyicong@huawei.com
13 months agohwtracing: hisi_ptt: Export available filters through sysfs
Yicong Yang [Wed, 21 Jun 2023 09:28:02 +0000 (17:28 +0800)]
hwtracing: hisi_ptt: Export available filters through sysfs

The PTT can only filter the traced TLP headers by the Root Ports or the
Requester ID of the Endpoint, which are located on the same PCIe core of
the PTT device. The filter value used is derived from the BDF number of
the supported Root Port or the Endpoint. It's not friendly enough for the
users since it requires the user to be familiar enough with the platform
and calculate the filter value manually.

This patch export the available filters through sysfs. Each available
filters is presented as an individual file with the name of the BDF
number of the related PCIe device. The files are created under
$(PTT PMU dir)/available_root_port_filters and
$(PTT PMU dir)/available_requester_filters respectively. The filter
value can be known by reading the related file.

Then the users can easily know the available filters for trace and get
the filter values without calculating.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230621092804.15120-4-yangyicong@huawei.com
13 months agohwtracing: hisi_ptt: Add support for dynamically updating the filter list
Yicong Yang [Wed, 21 Jun 2023 09:28:01 +0000 (17:28 +0800)]
hwtracing: hisi_ptt: Add support for dynamically updating the filter list

The PCIe devices supported by the PTT trace can be removed/rescanned by
hotplug or through sysfs.  Add support for dynamically updating the
available filter list by registering a PCI bus notifier block. Then user
can always get latest information about available tracing filters and
driver can block the invalid filters of which related devices no longer
exist in the system.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230621092804.15120-3-yangyicong@huawei.com
13 months agohwtracing: hisi_ptt: Factor out filter allocation and release operation
Yicong Yang [Wed, 21 Jun 2023 09:28:00 +0000 (17:28 +0800)]
hwtracing: hisi_ptt: Factor out filter allocation and release operation

Factor out the allocation and release of filters. This will make it easier
to extend and manage the function of the filter.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230621092804.15120-2-yangyicong@huawei.com
13 months agosamples: pfsm: add CC_CAN_LINK dependency
Arnd Bergmann [Fri, 16 Jun 2023 14:50:10 +0000 (16:50 +0200)]
samples: pfsm: add CC_CAN_LINK dependency

When no libc for the target architecture is available, cross-compiling
the same cannot work:

samples/pfsm/pfsm-wakeup.c:12:10: fatal error: fcntl.h: No such file or directory

Fixes: 9e66fb5244953 ("samples: Add userspace example for TI TPS6594 PFSM")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230616145013.3889906-1-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agomisc: fastrpc: check return value of devm_kasprintf()
Claudiu Beznea [Thu, 15 Jun 2023 10:25:46 +0000 (13:25 +0300)]
misc: fastrpc: check return value of devm_kasprintf()

devm_kasprintf() returns a pointer to dynamically allocated memory.
Pointer could be NULL in case allocation fails. Check pointer validity.
Identified with coccinelle (kmerr.cocci script).

Fixes: 3abe3ab3cdab ("misc: fastrpc: add secure domain support")
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230615102546.581899-1-claudiu.beznea@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agoMerge tag 'extcon-next-for-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Mon, 19 Jun 2023 15:08:18 +0000 (17:08 +0200)]
Merge tag 'extcon-next-for-6.5' of git://git./linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon next for v6.5

Detailed description for this pull request:
1. Clean-up extcon core without any behavior changes
- Add extcon_alloc_cables/muex/groups to improve the readability
  of extcon_dev_register.

- Fix kernel doc of property and property capability fields to aovid warnings
  and add missing description of struct extcon_dev.

- Use DECLARE_BITMAP macro and sysfs_emit instead of sprintf

- Use device_match_of_node helper instead of accessing the .of_node

- Use ida_alloc/free to get the unique id for extcon device

2. Update extcon-usbc-tusb320.c to support usb_role_switch and accessory detection
- Add usb_role_switch support on extcon-usbsc-tusb320.

- Add additional accessory detection for audio/debug accessory
  and then pass the deteced accessory information to typec subsystem
  on extcon-usbsc-tusb320.c.

- Add the support of unregistration of typec port on both error handling
  and driver removal step on

3. Update extcon provider drivers (apx288/qcom-spmi-misc/palmas)
- Replace put_device with acpi_dev_put on extcon-axp288.c

- Use platform_get_irq_byname_optional for getting irq of
  usb_id and usb_vbus on extcon-qcom-spmi-misc.c.

- Remove unused of_gpio.h on extcon-palmas.c.

4. Fix the devicetree binding document
- Rename misc node name to 'usb-dect@900' on pm8941-misc.yam

- Fix usb-id and usb_vbus defintion on pm8941-misc.yaml

- Drop unneeded quotes from extcon-arizona.c devicetree documentation

* tag 'extcon-next-for-6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon: (26 commits)
  dt-bindings: extcon: wlf,arizona: drop unneeded quotes
  extcon: Switch i2c drivers back to use .probe()
  extcon: Drop unneeded assignments
  extcon: Use sizeof(*pointer) instead of sizeof(type)
  extcon: Use unique number for the extcon device ID
  extcon: Remove dup device name in the message and unneeded error check
  extcon: Use dev_of_node(dev) instead of dev->of_node
  extcon: Use device_match_of_node() helper
  extcon: Amend kernel documentation of struct extcon_dev
  extcon: Use sysfs_emit() to instead of sprintf()
  extcon: Use DECLARE_BITMAP() to declare bit arrays
  extcon: Fix kernel doc of property capability fields to avoid warnings
  extcon: Fix kernel doc of property fields to avoid warnings
  extcon: usbc-tusb320: add USB_ROLE_SWITCH dependency
  extcon: usbc-tusb320: add usb_role_switch support
  extcon: usbc-tusb320: add accessory detection support
  extcon: Add extcon_alloc_groups to simplify extcon register function
  extcon: Add extcon_alloc_muex to simplify extcon register function
  extcon: Add extcon_alloc_cables to simplify extcon register function
  extcon: Remove redundant null checking for class
  ...

13 months agocoresight: dummy: Update type of mode parameter in dummy_{sink,source}_enable()
Nathan Chancellor [Fri, 16 Jun 2023 16:41:30 +0000 (09:41 -0700)]
coresight: dummy: Update type of mode parameter in dummy_{sink,source}_enable()

Clang's kernel Control Flow Integrity (kCFI) is a compiler-based
security mitigation that ensures the target of an indirect function call
matches the expected type of the call and trapping if they do not match
exactly. The warning -Wincompatible-function-pointer-types-strict aims
to catch these issues at compile time, which reveals:

  drivers/hwtracing/coresight/coresight-dummy.c:53:12: error: incompatible function pointer types initializing 'int (*)(struct coresight_device *, struct perf_event *, enum cs_mode)' with an expression of type 'int (struct coresight_device *, struct perf_event *, u32)' (aka 'int (struct coresight_device *, struct perf_event *, unsigned int)') [-Werror,-Wincompatible-function-pointer-types-strict]
     53 |         .enable = dummy_source_enable,
        |                   ^~~~~~~~~~~~~~~~~~~
  drivers/hwtracing/coresight/coresight-dummy.c:62:12: error: incompatible function pointer types initializing 'int (*)(struct coresight_device *, enum cs_mode, void *)' with an expression of type 'int (struct coresight_device *, u32, void *)' (aka 'int (struct coresight_device *, unsigned int, void *)') [-Werror,-Wincompatible-function-pointer-types-strict]
     62 |         .enable = dummy_sink_enable,
        |                   ^~~~~~~~~~~~~~~~~
  2 errors generated.

Commit 9fa3682869d4 ("coresight: Use enum type for cs_mode wherever
possible") updated the type of the mode parameter in the prototype but
this driver was not introduced until commit 9d3ba0b6c056 ("Coresight:
Add coresight dummy driver") and 'int' is ABI compatible with 'enum
cs_mode', so there is no warning from regular
-Wincompatible-function-pointer-types.

Adjust the type of the mode parameter in the callback implementations in
the coresight dummy driver to match the prototype, clearing up the
warning and avoiding kCFI failures at runtime.

Fixes: 9d3ba0b6c056 ("Coresight: Add coresight dummy driver")
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230616-coresight-dummy-fix-kcfi-warnings-v1-1-c55c64f8f0f5@kernel.org
13 months agochar: xilinx_hwicap: Convert to platform remove callback returning void
Uwe Kleine-König [Mon, 5 Jun 2023 09:20:47 +0000 (11:20 +0200)]
char: xilinx_hwicap: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() is renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Michal Simek <michal.simek@amd.com>
Message-ID: <20230605092047.50472-3-u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agochar: xilinx_hwicap: Drop if block with always false condition
Uwe Kleine-König [Mon, 5 Jun 2023 09:20:46 +0000 (11:20 +0200)]
char: xilinx_hwicap: Drop if block with always false condition

hwicap_drv_remove() is only called for a device after hwicap_drv_probe()
returned 0. In that case dev_set_drvdata() was called (by hwicap_setup())
with a non-NULL value and so dev_get_drvdata() won't return NULL.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Michal Simek <michal.simek@amd.com>
Message-ID: <20230605092047.50472-2-u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agochar: xilinx_hwicap: Fold hwicap_remove() into only caller
Uwe Kleine-König [Mon, 5 Jun 2023 09:20:45 +0000 (11:20 +0200)]
char: xilinx_hwicap: Fold hwicap_remove() into only caller

hwicap_remove() is only called by hwicap_drv_remove(). Simplify by
unrolling the former into the latter function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Michal Simek <michal.simek@amd.com>
Message-ID: <20230605092047.50472-1-u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agobus: fsl-mc: don't assume child devices are all fsl-mc devices
Laurentiu Tudor [Tue, 13 Jun 2023 16:07:18 +0000 (19:07 +0300)]
bus: fsl-mc: don't assume child devices are all fsl-mc devices

Changes in VFIO caused a pseudo-device to be created as child of
fsl-mc devices causing a crash [1] when trying to bind a fsl-mc
device to VFIO. Fix this by checking the device type when enumerating
fsl-mc child devices.

[1]
Modules linked in:
Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
CPU: 6 PID: 1289 Comm: sh Not tainted 6.2.0-rc5-00047-g7c46948a6e9c #2
Hardware name: NXP Layerscape LX2160ARDB (DT)
pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : mc_send_command+0x24/0x1f0
lr : dprc_get_obj_region+0xfc/0x1c0
sp : ffff80000a88b900
x29: ffff80000a88b900 x28: ffff48a9429e1400 x27: 00000000000002b2
x26: ffff48a9429e1718 x25: 0000000000000000 x24: 0000000000000000
x23: ffffd59331ba3918 x22: ffffd59331ba3000 x21: 0000000000000000
x20: ffff80000a88b9b8 x19: 0000000000000000 x18: 0000000000000001
x17: 7270642f636d2d6c x16: 73662e3030303030 x15: ffffffffffffffff
x14: ffffd59330f1d668 x13: ffff48a8727dc389 x12: ffff48a8727dc386
x11: 0000000000000002 x10: 00008ceaf02f35d4 x9 : 0000000000000012
x8 : 0000000000000000 x7 : 0000000000000006 x6 : ffff80000a88bab0
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000a88b9e8
x2 : ffff80000a88b9e8 x1 : 0000000000000000 x0 : ffff48a945142b80
Call trace:
 mc_send_command+0x24/0x1f0
 dprc_get_obj_region+0xfc/0x1c0
 fsl_mc_device_add+0x340/0x590
 fsl_mc_obj_device_add+0xd0/0xf8
 dprc_scan_objects+0x1c4/0x340
 dprc_scan_container+0x38/0x60
 vfio_fsl_mc_probe+0x9c/0xf8
 fsl_mc_driver_probe+0x24/0x70
 really_probe+0xbc/0x2a8
 __driver_probe_device+0x78/0xe0
 device_driver_attach+0x30/0x68
 bind_store+0xa8/0x130
 drv_attr_store+0x24/0x38
 sysfs_kf_write+0x44/0x60
 kernfs_fop_write_iter+0x128/0x1b8
 vfs_write+0x334/0x448
 ksys_write+0x68/0xf0
 __arm64_sys_write+0x1c/0x28
 invoke_syscall+0x44/0x108
 el0_svc_common.constprop.1+0x94/0xf8
 do_el0_svc+0x38/0xb0
 el0_svc+0x20/0x50
 el0t_64_sync_handler+0x98/0xc0
 el0t_64_sync+0x174/0x178
Code: aa0103f4 a9025bf5 d5384100 b9400801 (79401260)
---[ end trace 0000000000000000 ]---

Fixes: 3c28a76124b2 ("vfio: Add struct device to vfio_device")
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Message-ID: <20230613160718.29500-1-laurentiu.tudor@nxp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agomisc: fastrpc: Create fastrpc scalar with correct buffer count
Ekansh Gupta [Wed, 14 Jun 2023 11:54:45 +0000 (17:24 +0530)]
misc: fastrpc: Create fastrpc scalar with correct buffer count

A process can spawn a PD on DSP with some attributes that can be
associated with the PD during spawn and run. The invocation
corresponding to the create request with attributes has total
4 buffers at the DSP side implementation. If this number is not
correct, the invocation is expected to fail on DSP. Added change
to use correct number of buffer count for creating fastrpc scalar.

Fixes: d73f71c7c6ee ("misc: fastrpc: Add support for create remote init process")
Cc: stable <stable@kernel.org>
Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
Message-ID: <1686743685-21715-1-git-send-email-quic_ekangupt@quicinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agofirmware: stratix10-svc: Fix a potential resource leak in svc_create_memory_pool()
Christophe JAILLET [Tue, 13 Jun 2023 21:15:21 +0000 (16:15 -0500)]
firmware: stratix10-svc: Fix a potential resource leak in svc_create_memory_pool()

svc_create_memory_pool() is only called from stratix10_svc_drv_probe().
Most of resources in the probe are managed, but not this memremap() call.

There is also no memunmap() call in the file.

So switch to devm_memremap() to avoid a resource leak.

Cc: stable@vger.kernel.org
Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
Link: https://lore.kernel.org/all/783e9dfbba34e28505c9efa8bba41f97fd0fa1dc.1686109400.git.christophe.jaillet@wanadoo.fr/
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
Message-ID: <20230613211521.16366-1-dinguyen@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: rmem: Use NVMEM_DEVID_AUTO
Phil Elwell [Sun, 11 Jun 2023 14:03:09 +0000 (15:03 +0100)]
nvmem: rmem: Use NVMEM_DEVID_AUTO

It is reasonable to declare multiple nvmem blocks. Unless a unique 'id'
is passed in for each block there may be name clashes.

Avoid this by using the magic token NVMEM_DEVID_AUTO.

Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem")
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
Reviewed-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-6-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agotest_firmware: return ENOMEM instead of ENOSPC on failed memory allocation
Mirsad Goran Todorovac [Tue, 6 Jun 2023 07:08:10 +0000 (09:08 +0200)]
test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation

In a couple of situations like

name = kstrndup(buf, count, GFP_KERNEL);
if (!name)
return -ENOSPC;

the error is not actually "No space left on device", but "Out of memory".

It is semantically correct to return -ENOMEM in all failed kstrndup()
and kzalloc() cases in this driver, as it is not a problem with disk
space, but with kernel memory allocator failing allocation.

The semantically correct should be:

        name = kstrndup(buf, count, GFP_KERNEL);
        if (!name)
                return -ENOMEM;

Cc: Dan Carpenter <error27@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: "Luis R. Rodriguez" <mcgrof@ruslug.rutgers.edu>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Brian Norris <briannorris@chromium.org>
Fixes: c92316bf8e948 ("test_firmware: add batched firmware tests")
Fixes: 0a8adf584759c ("test: add firmware_class loader test")
Fixes: 548193cba2a7d ("test_firmware: add support for firmware_request_platform")
Fixes: eb910947c82f9 ("test: firmware_class: add asynchronous request trigger")
Fixes: 061132d2b9c95 ("test_firmware: add test custom fallback trigger")
Fixes: 7feebfa487b92 ("test_firmware: add support for request_firmware_into_buf")
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Message-ID: <20230606070808.9300-1-mirsad.todorovac@alu.unizg.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agomux: adg792a: Switch back to use i2c_driver's .probe()
Uwe Kleine-König [Sun, 11 Jun 2023 20:47:37 +0000 (22:47 +0200)]
mux: adg792a: Switch back to use i2c_driver's .probe()

After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter")
convert back to (the new) .probe() to be able to eventually drop
.probe_new() from struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Peter Rosin <peda@axentia.se>
Message-ID: <20230611204737.828617-1-u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agopcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()
Armin Wolf [Fri, 12 May 2023 18:45:29 +0000 (20:45 +0200)]
pcmcia: rsrc_nonstatic: Fix memory leak in nonstatic_release_resource_db()

When nonstatic_release_resource_db() frees all resources associated
with an PCMCIA socket, it forgets to free socket_data too, causing
a memory leak observable with kmemleak:

unreferenced object 0xc28d1000 (size 64):
  comm "systemd-udevd", pid 297, jiffies 4294898478 (age 194.484s)
  hex dump (first 32 bytes):
    00 00 00 00 00 00 00 00 f0 85 0e c3 00 00 00 00  ................
    00 00 00 00 0c 10 8d c2 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<ffda4245>] __kmem_cache_alloc_node+0x2d7/0x4a0
    [<7e51f0c8>] kmalloc_trace+0x31/0xa4
    [<d52b4ca0>] nonstatic_init+0x24/0x1a4 [pcmcia_rsrc]
    [<a2f13e08>] pcmcia_register_socket+0x200/0x35c [pcmcia_core]
    [<a728be1b>] yenta_probe+0x4d8/0xa70 [yenta_socket]
    [<c48fac39>] pci_device_probe+0x99/0x194
    [<84b7c690>] really_probe+0x181/0x45c
    [<8060fe6e>] __driver_probe_device+0x75/0x1f4
    [<b9b76f43>] driver_probe_device+0x28/0xac
    [<648b766f>] __driver_attach+0xeb/0x1e4
    [<6e9659eb>] bus_for_each_dev+0x61/0xb4
    [<25a669f3>] driver_attach+0x1e/0x28
    [<d8671d6b>] bus_add_driver+0x102/0x20c
    [<df0d323c>] driver_register+0x5b/0x120
    [<942cd8a4>] __pci_register_driver+0x44/0x4c
    [<e536027e>] __UNIQUE_ID___addressable_cleanup_module188+0x1c/0xfffff000 [iTCO_vendor_support]

Fix this by freeing socket_data too.

Tested on a Acer Travelmate 4002WLMi by manually binding/unbinding
the yenta_cardbus driver (yenta_socket).

Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Message-ID: <20230512184529.5094-1-W_Armin@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: imx-ocotp: drop unneeded address/size-cells and children
Krzysztof Kozlowski [Sun, 11 Jun 2023 14:03:30 +0000 (15:03 +0100)]
dt-bindings: nvmem: imx-ocotp: drop unneeded address/size-cells and children

Referenced nvmem.yaml schema already defines address/size-cells and its
children, so remove redundant entries.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-27-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: core: add support for fixed cells *layout*
Rafał Miłecki [Sun, 11 Jun 2023 14:03:29 +0000 (15:03 +0100)]
nvmem: core: add support for fixed cells *layout*

This adds support for the "fixed-layout" NVMEM layout binding. It allows
defining NVMEM cells in a layout DT node named "nvmem-layout".

While NVMEM subsystem supports layout drivers it has been discussed that
"fixed-layout" may actually be supperted internally. It's because:
1. It's a very basic layout
2. It allows sharing code with legacy syntax parsing
3. It's safer for soc_device_match() due to -EPROBE_DEFER
4. This will make the syntax transition easier

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Michael Walle <michael@walle.cc>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-26-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: convert base example to use NVMEM fixed cells layout
Rafał Miłecki [Sun, 11 Jun 2023 14:03:28 +0000 (15:03 +0100)]
dt-bindings: nvmem: convert base example to use NVMEM fixed cells layout

With support for the "fixed-layout" binding it's possible and preferred
now to define fixed NVMEM cells in the layout node. Do that for the
example binding.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-25-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: layouts: add fixed-layout
Rafał Miłecki [Sun, 11 Jun 2023 14:03:27 +0000 (15:03 +0100)]
dt-bindings: nvmem: layouts: add fixed-layout

With the introduction of NVMEM layouts, new NVMEM content structures
should be defined as such. We should also try to convert / migrate
existing NVMEM content bindings to layouts.

This commit handles fixed NVMEM cells. So far they had to be defined
directly - as device subnodes. With this change it's allowed to put them
in the DT node named "nvmem-layout".

Having NVMEM cells in separated node is preferred as it draws a nice
line between NVMEM device and its content. It results in cleaner
bindings.

FWIW a very similar situation has happened to MTD devices and their
partitions: see commit 5d96ea42eb63 ("dt-bindings: mtd: Clarify all
partition subnodes").

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-24-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: mediatek: efuse: add support for mt7986
Frank Wunderlich [Sun, 11 Jun 2023 14:03:26 +0000 (15:03 +0100)]
dt-bindings: nvmem: mediatek: efuse: add support for mt7986

Add compatible string for mt7986 SoC.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-23-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: imx: support i.MX93 OCOTP
Peng Fan [Sun, 11 Jun 2023 14:03:25 +0000 (15:03 +0100)]
nvmem: imx: support i.MX93 OCOTP

Add i.MX93 OCOTP support. i.MX93 OCOTP has two parts: Fuse shadow
block(fsb) and fuse managed by ELE. The FSB part could be directly
accessed with MMIO, the ELE could only be accessed with ELE API.

Currently the ELE API is not ready, so NULL function callback is used,
but it was tested with downstream ELE API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-22-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: imx-ocotp: support i.MX93
Peng Fan [Sun, 11 Jun 2023 14:03:24 +0000 (15:03 +0100)]
dt-bindings: nvmem: imx-ocotp: support i.MX93

Add i.MX93 OCOTP support

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-21-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: zynqmp: Switch @xilinx.com emails to @amd.com
Michal Simek [Sun, 11 Jun 2023 14:03:23 +0000 (15:03 +0100)]
nvmem: zynqmp: Switch @xilinx.com emails to @amd.com

@xilinx.com is still working but better to switch to new amd.com after
AMD/Xilinx acquisition.

Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-20-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: sunplus,sp7021-ocotp: drop unneeded address/size-cells
Krzysztof Kozlowski [Sun, 11 Jun 2023 14:03:22 +0000 (15:03 +0100)]
dt-bindings: nvmem: sunplus,sp7021-ocotp: drop unneeded address/size-cells

Referenced nvmem.yaml schema already defines address/size-cells, so
remove redundant entries.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-19-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: socionext,uniphier-efuse: drop unneeded address/size-cells
Krzysztof Kozlowski [Sun, 11 Jun 2023 14:03:21 +0000 (15:03 +0100)]
dt-bindings: nvmem: socionext,uniphier-efuse: drop unneeded address/size-cells

Referenced nvmem.yaml schema already defines address/size-cells, so
remove redundant entries.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-18-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: qcom,spmi-sdam: drop unneeded address/size-cells
Krzysztof Kozlowski [Sun, 11 Jun 2023 14:03:20 +0000 (15:03 +0100)]
dt-bindings: nvmem: qcom,spmi-sdam: drop unneeded address/size-cells

Referenced nvmem.yaml schema already defines address/size-cells, so
remove redundant entries.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-17-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: qcom,qfprom: drop unneeded address/size-cells
Krzysztof Kozlowski [Sun, 11 Jun 2023 14:03:19 +0000 (15:03 +0100)]
dt-bindings: nvmem: qcom,qfprom: drop unneeded address/size-cells

Referenced nvmem.yaml schema already defines address/size-cells, so
remove redundant entries.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-16-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: mxs-ocotp: drop unneeded address/size-cells
Krzysztof Kozlowski [Sun, 11 Jun 2023 14:03:18 +0000 (15:03 +0100)]
dt-bindings: nvmem: mxs-ocotp: drop unneeded address/size-cells

Referenced nvmem.yaml schema already defines address/size-cells, so
remove redundant entries and use unevaluatedProperties: false.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-15-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: rockchip-otp: Add support for RK3588
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:17 +0000 (15:03 +0100)]
nvmem: rockchip-otp: Add support for RK3588

Add support for the OTP memory device found on the Rockchip RK3588 SoC.

While here, remove the unnecessary 'void *' casts in the OF device ID
table.

Co-developed-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tested-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-14-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: rockchip-otp: Improve probe error handling
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:16 +0000 (15:03 +0100)]
nvmem: rockchip-otp: Improve probe error handling

Enhance error handling in the probe function by making use of
dev_err_probe(), which ensures the error code is always printed, in
addition to the specified error message.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tested-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-13-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: rockchip-otp: Use devm_reset_control_array_get_exclusive()
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:15 +0000 (15:03 +0100)]
nvmem: rockchip-otp: Use devm_reset_control_array_get_exclusive()

In preparation to support new Rockchip OTP memory devices having
specific reset configurations, switch devm_reset_control_get() to
devm_reset_control_array_get_exclusive().

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tested-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-12-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: rockchip-otp: Generalize rockchip_otp_wait_status()
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:14 +0000 (15:03 +0100)]
nvmem: rockchip-otp: Generalize rockchip_otp_wait_status()

In preparation to support additional Rockchip OTP memory devices with
different register layout, generalize rockchip_otp_wait_status() to
accept a new parameter for specifying the offset of the status register.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tested-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-11-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: rockchip-otp: Add clks and reg_read to rockchip_data
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:13 +0000 (15:03 +0100)]
nvmem: rockchip-otp: Add clks and reg_read to rockchip_data

In preparation to support new Rockchip OTP memory devices with different
clock configurations and register layout, extend rockchip_data struct
with the related members: clks, num_clks, reg_read.

Additionally, to avoid managing redundant driver data, drop num_clks
member from rockchip_otp struct and update all references to point to
the equivalent member in rockchip_data.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Tested-by: Vincent Legoll <vincent.legoll@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-10-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: rockchip,otp: Add compatible for RK3588
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:12 +0000 (15:03 +0100)]
dt-bindings: nvmem: rockchip,otp: Add compatible for RK3588

Document the OTP memory found on Rockchip RK3588 SoC.

Since RK3588 uses different clocks & resets configurations than PX30 /
RK3308, provide the required changes in the binding to be able to handle
both variants.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-9-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: Convert rockchip-otp.txt to dt-schema
Cristian Ciocaltea [Sun, 11 Jun 2023 14:03:11 +0000 (15:03 +0100)]
dt-bindings: nvmem: Convert rockchip-otp.txt to dt-schema

Convert the Rockchip OTP memory bindings to dt-schema.

Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-8-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: rmem: Add raspberrypi,bootloader-public-key
Ivan T. Ivanov [Sun, 11 Jun 2023 14:03:10 +0000 (15:03 +0100)]
dt-bindings: nvmem: rmem: Add raspberrypi,bootloader-public-key

On RPi4 the bootloader[1] will copy the binary public key blob
(if present) into memory location specified by this node, for
use by the OS.

[1] https://www.raspberrypi.com/documentation/computers/configuration.html#nvmem-nodes

Signed-off-by: Ivan T. Ivanov <iivanov@suse.de>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-7-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: brcm_nvram: add .read_post_process() for MACs
Rafał Miłecki [Sun, 11 Jun 2023 14:03:08 +0000 (15:03 +0100)]
nvmem: brcm_nvram: add .read_post_process() for MACs

1. Parse ASCII MAC format into byte based
2. Calculate relative addresses based on index argument

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-5-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agodt-bindings: nvmem: brcm,nvram: add #nvmem-cell-cells for MACs
Rafał Miłecki [Sun, 11 Jun 2023 14:03:07 +0000 (15:03 +0100)]
dt-bindings: nvmem: brcm,nvram: add #nvmem-cell-cells for MACs

Broadcom's NVRAM contains MACs for Ethernet interfaces. Those MACs are
usually base addresses that are also used for calculating other MACs.

For example if a router vendor decided to use gmac0 it most likely
programmed NVRAM of each unit with a proper "et0macaddr" value. That is
a base.

Ethernet interface is usually connected to switch port. Switch usually
includes few LAN ports and a WAN port. MAC of WAN port gets calculated
as relative address to the interface one. Offset varies depending on
device model.

Wireless MACs may also need to be calculated using relevant offsets.

To support all those scenarios let MAC NVMEM cells be referenced with an
index specifying MAC offset. Disallow additionalProperties while at it.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-4-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: imx-ocotp: Reverse MAC addresses on all i.MX derivates
Alexander Stein [Sun, 11 Jun 2023 14:03:06 +0000 (15:03 +0100)]
nvmem: imx-ocotp: Reverse MAC addresses on all i.MX derivates

Not just i.MX8M, but all i.MX6/7 (and subtypes) need to reverse the
MAC address read from fuses. Exceptions are i.MX6SLL and i.MX7ULP which
do not support ethernet at all.

Fixes: d0221a780cbc ("nvmem: imx-ocotp: add support for post processing")
Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Tested-by: Richard Leitner <richard.leitner@skidata.com> # imx6q
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-3-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: imx-ocotp: set varaiable imx_ocotp_layout storage-class-specifier to static
Tom Rix [Sun, 11 Jun 2023 14:03:05 +0000 (15:03 +0100)]
nvmem: imx-ocotp: set varaiable imx_ocotp_layout storage-class-specifier to static

smatch reports
drivers/nvmem/imx-ocotp.c:599:21: warning: symbol
  'imx_ocotp_layout' was not declared. Should it be static?

This variable is only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Message-ID: <20230611140330.154222-2-srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agonvmem: sunplus-ocotp: release otp->clk before return
Yi Yingao [Tue, 9 May 2023 08:52:36 +0000 (16:52 +0800)]
nvmem: sunplus-ocotp: release otp->clk before return

Smatch reports:
drivers/nvmem/sunplus-ocotp.c:205 sp_ocotp_probe()
warn: 'otp->clk' from clk_prepare() not released on lines: 196.

In the function sp_ocotp_probe(struct platform_device *pdev), otp->clk may
not be released before return.

To fix this issue, using function clk_unprepare() to release otp->clk.

Fixes: 8747ec2e9762 ("nvmem: Add driver for OCOTP in Sunplus SP7021")
Signed-off-by: Yi Yingao <m202271736@hust.edu.cn>
Reviewed-by: Dongliang Mu <dzm91@hust.edu.cn>
Message-ID: <20230509085237.5917-1-m202271736@hust.edu.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agocdx: Replace custom mcdi logging with print_hex_dump_debug()
Abhijit Gangurde [Tue, 13 Jun 2023 08:43:18 +0000 (14:13 +0530)]
cdx: Replace custom mcdi logging with print_hex_dump_debug()

Replace custom mcdi logging for send and receive requests
with dynamic debug method print_hex_dump_debug().

Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Message-ID: <20230613084318.27996-1-abhijit.gangurde@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agocdx: fix driver managed dma support
Nipun Gupta [Mon, 5 Jun 2023 13:10:09 +0000 (18:40 +0530)]
cdx: fix driver managed dma support

The devices on cdx could be bound to drivers with the device
DMA managed by kernel drivers or user-space applications.
As multiple devices can be placed in the same IOMMU group, the
DMA on these devices must either be entirely under kernel control
or userspace control. Fix the CDX bus driver to acknowlege the
driver_managed_dma flag and call the appropriate iommu APIs.

Fixes: 2959ab247061 ("cdx: add the cdx bus driver")
Signed-off-by: Nipun Gupta <nipun.gupta@amd.com>
Reported-by: Alex Williamson <alex.williamson@redhat.com>
Closes: https://lore.kernel.org/lkml/20230524134831.28dc97e2.alex.williamson@redhat.com/
Reviewed-by: Nikhil Agarwal <nikhil.agarwal@amd.com>
Message-ID: <20230605131009.6869-1-nipun.gupta@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agosamples: Add userspace example for TI TPS6594 PFSM
Julien Panis [Thu, 11 May 2023 09:51:26 +0000 (11:51 +0200)]
samples: Add userspace example for TI TPS6594 PFSM

This patch adds an example showing how to use PFSM devices
from a userspace application. The PMIC is armed to be triggered
by a RTC alarm to execute state transition.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
Message-ID: <20230511095126.105104-7-jpanis@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agoDocumentation: Add TI TPS6594 PFSM
Julien Panis [Thu, 11 May 2023 09:51:25 +0000 (11:51 +0200)]
Documentation: Add TI TPS6594 PFSM

This patch adds documentation for the TPS6594 PFSM driver.

The PFSM controls the operational states of the TPS6594 PMIC.
Depending on the operational mode, some power domain networks
remain energized while others can be off.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
Message-ID: <20230511095126.105104-6-jpanis@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agomisc: tps6594-pfsm: Add driver for TI TPS6594 PFSM
Julien Panis [Thu, 11 May 2023 09:51:24 +0000 (11:51 +0200)]
misc: tps6594-pfsm: Add driver for TI TPS6594 PFSM

This PFSM controls the operational modes of the PMIC:
- STANDBY and LP_STANDBY,
- ACTIVE state,
- MCU_ONLY state,
- RETENTION state, with or without DDR and/or GPIO retention.
Depending on the current operational mode, some voltage domains
remain energized while others can be off.

This PFSM is also used to trigger a firmware update, and provides
R/W access to device registers.

See Documentation/misc-devices/tps6594-pfsm.rst for more
information.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
Message-ID: <20230511095126.105104-5-jpanis@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agomisc: tps6594-esm: Add driver for TI TPS6594 ESM
Julien Panis [Thu, 11 May 2023 09:51:23 +0000 (11:51 +0200)]
misc: tps6594-esm: Add driver for TI TPS6594 ESM

This patch adds support for TPS6594 ESM (Error Signal Monitor).
This device monitors the SoC error output signal at its nERR_SOC input pin.
In error condition, ESM toggles its nRSTOUT_SOC pin to reset the SoC.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
Message-ID: <20230511095126.105104-4-jpanis@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agoMerge tag 'ib-mfd-tps6594-core-v6.5' of git://git.kernel.org/pub/scm/linux/kernel...
Greg Kroah-Hartman [Thu, 15 Jun 2023 11:39:13 +0000 (13:39 +0200)]
Merge tag 'ib-mfd-tps6594-core-v6.5' of git://git./linux/kernel/git/lee/mfd into char-misc-next

Immutable branch containing TPS6594 core (MFD) support due for the v6.5 merge window

We want this due to patches requiring this mfd support.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tag 'ib-mfd-tps6594-core-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd:
  mfd: tps6594: Add driver for TI TPS6594 PMIC

13 months agoMerge tag 'counter-updates-for-6.5a' of git://git.kernel.org/pub/scm/linux/kernel...
Greg Kroah-Hartman [Thu, 15 Jun 2023 11:07:59 +0000 (13:07 +0200)]
Merge tag 'counter-updates-for-6.5a' of git://git./linux/kernel/git/wbg/counter into char-misc-next

William writes:

First set of Counter updates for the 6.5 cycle

Biggest changes in this set include the introduction of a new Intel 8254
interface library module and the refactoring of the existing 104-quad-8
modules to migrate it to the regmap API. Some other minor cleanups
touching tools/counter and stm32-timer-cnt are also present.

Changes
* 104-quad-8
  - Remove reference in Kconfig to 25-bit counter value
  - Utilize bitfield access macros
  - Refactor to buffer states for CMR, IOR, and IDR
  - Utilize helper functions to handle PR, FLAG and PSC
  - Migrate to the regmap API
* i8254
  - Introduce the Intel 8254 interface library module
* stm32-timer-cnt
  - Reset TIM_TISEL to its default value in probe
* tools/counter
  - Add .gitignore
  - Remove lingering 'include' directories on make clean

* tag 'counter-updates-for-6.5a' of git://git.kernel.org/pub/scm/linux/kernel/git/wbg/counter:
  counter: i8254: Introduce the Intel 8254 interface library module
  counter: 104-quad-8: Migrate to the regmap API
  counter: 104-quad-8: Utilize helper functions to handle PR, FLAG and PSC
  counter: 104-quad-8: Refactor to buffer states for CMR, IOR, and IDR
  counter: 104-quad-8: Utilize bitfield access macros
  tools/counter: Makefile: Remove lingering 'include' directories on make clean
  tools/counter: Add .gitignore
  counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe
  counter: 104-quad-8: Remove reference in Kconfig to 25-bit counter value

13 months agoMerge tag 'fpga-for-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga...
Greg Kroah-Hartman [Thu, 15 Jun 2023 11:06:25 +0000 (13:06 +0200)]
Merge tag 'fpga-for-6.5-rc1' of git://git./linux/kernel/git/fpga/linux-fpga into char-misc-next

Xu writes:

FPGA Manager changes for 6.5-rc1

DFL:

- Krzysztof's change constifies pointers to hwmon_channel_info

Xilinx:

- Alfonso's change ensures proper reprograming (xCAP) interface switch

All patches have been reviewed on the mailing list, and have been in the
last linux-next releases (as part of our for-next branch).

Signed-off-by: Xu Yilun <yilun.xu@intel.com>
* tag 'fpga-for-6.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/fpga/linux-fpga:
  fpga: zynq-fpga: Ensure proper xCAP interface switch
  fpga: dfl-fme: constify pointers to hwmon_channel_info

13 months agoMerge tag 'iio-for-6.5a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23...
Greg Kroah-Hartman [Thu, 15 Jun 2023 11:01:55 +0000 (13:01 +0200)]
Merge tag 'iio-for-6.5a' 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 the 6.5 cycle.

New device support
- honeywell,mprls0025pa
  * New driver and dt-bindings for this series of pressure sensors.
- invensense,mpu6050
  * Add support for ICM 20600 IMU (ID, bindings and device data).
- melexis,mlx90614
  * Add support for mlx90615 Infra Red Thermometer after driver cleanup
    and refactoring to support the differences in this device.
- renesas,x9250
  * New driver and bindings for this quad potentiometer.
- rockchip,saradc
  * Add support for RK3588. Also included is a bunch of refactoring and
    cleanup for that driver.
- rohm,bu27008
  * New driver bindings etc for this 5 photodiode color sensor.
- st,lsm9ds0/st,st-sensors
  * ID added for LSM303D accelerometer and magnetometer including ACPI binding.
- ti,opt4001
  * New driver and bindings for this ambient light sensor.

Features
- core
  * Introduce iio_validate_own_trigger() for cases where a driver can only
    consumer a trigger it registered (detected via same parent device).
    Use it in the kionix,kx022a driver and new rohm,by27008 driver.
- dynaimage,al3320a
  * ACPI binding CALS0001 seen on Lenovo Yoga Table 2 devices.
- kionix,kx002a
  * Enable asynchronous probe.
- rohm,bu27034
  * Enable asynchronous probe.
- ti,tmp006
  * Explicit support for DT including binding documentation.

Cleanups, minor fixes and misc improvements.
- treewide
  * Switch I2C drivers from probe_new() back to probe() - part of the
    long process of getting rid of a parameter from probe()
  * Various whitespace and typo fixes not otherwise called out.
- core
  * industrialio-buffer,Style cleanup.
  * Add documentation to extend_name field of struct iio_chan_spec to
    direct people using it towards the label infrastructure instead.
    extend_name was a design mistake a long time back so directly people
    away from it may be useful.
- adi,ad7606
  * Add HAS_IOPORT dependency to prepare for some Kconfig changes.
- bosch,bma400
  * Drop pointless print of ret in a dev_err_probe() message.
- invensense,icm42600
  * Rework timestamp handling to reduce jitter.
- mediatek,mt7986-auxdac
  * Add DT binding for this part.
- qcom,spmi-vadc
  * Allow for 1/16th prescaling used on a few devices.
  * Various changes to channel labeling and naming, including dropping
    use of fwnode_name which generates odd channel names. Small ABI
    change as a result, but not thought to be a problem for users of this
    platform.
- st,lsm6dsx
  * dt-binding: Use common schema for mount-matrix via a reference.
- st,stm32
  * Add a debug print for when legacy channel config is used.
- ti,palmas-adc
  * Drop unused i2c.h include.

* tag 'iio-for-6.5a' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (59 commits)
  dt-bindings: iio: rockchip: Fix 'oneOf' condition failed warning
  dt-bindings: iio: afe: voltage-divider: Spelling s/curcuit/circuit/
  dt-bindings: iio: adc: Add rockchip,rk3588-saradc string
  iio: adc: rockchip_saradc: Use dev_err_probe
  iio: adc: rockchip_saradc: Match alignment with open parenthesis
  iio: adc: rockchip_saradc: Use of_device_get_match_data
  iio: adc: rockchip_saradc: Make use of devm_clk_get_enabled
  iio: adc: rockchip_saradc: Add support for RK3588
  iio: adc: rockchip_saradc: Add callback functions
  iio: temperature: tmp006: Add OF device matching support
  dt-bindings: iio: temperature: Add support for tmp006
  staging: iio: Switch i2c drivers back to use .probe()
  iio: amplifiers: ad8366 Fix whitespace issue
  iio: imu: inv_icm42600: avoid frequent timestamp jitter
  MAINTAINERS: Add ROHM BU27008
  iio: light: ROHM BU27008 color sensor
  iio: kx022a: Use new iio_validate_own_trigger()
  iio: trigger: Add simple trigger_validation helper
  dt-bindings: iio: light: ROHM BU27008
  iio: mlx90614: Add MLX90615 support
  ...

13 months agoMerge tag 'iio-fixes-for-6.4b' of https://git.kernel.org/pub/scm/linux/kernel/git...
Greg Kroah-Hartman [Thu, 15 Jun 2023 11:01:02 +0000 (13:01 +0200)]
Merge tag 'iio-fixes-for-6.4b' of https://git./linux/kernel/git/jic23/iio into char-misc-next

Jonathan writes:

2nd set of IIO fixes for the 6.4 cycle.

Given how late this pull request is, I'm expecting these to get queued
up for the 6.5 merge window.

- adi,ad7192
  * Fix a null pointer as spi_set_drvdata() is no longer called.
  * Fix wrong check prior to using internal clock.
  * Fix dt-binding to make it clear the voltage reference is required.
- adi,ad74413
  * DIN_SINK should not be set for functions other than digital inputs.
    Enforce that in the driver.
- amlogic,meson-saradc
  * Fix clock divider mask length - affects only meson 8 family.
- freescale,fxls8962af
  * Fix endian type and shift of channels to match with default device setup.
  * Narrow errata handling to FXLS8962AF only as doesn't affect other devices
    supported by this driver.

* tag 'iio-fixes-for-6.4b' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio:
  meson saradc: fix clock divider mask length
  iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF
  iio: accel: fxls8962af: fixup buffer scan element type
  dt-bindings: iio: ad7192: Add mandatory reference voltage source
  iio: adc: ad7192: Fix internal/external clock selection
  iio: adc: ad7192: Fix null ad7192_state pointer access
  iio: addac: ad74413: don't set DIN_SINK for functions other than digital input

13 months agoDocumentation: trace: Add documentation for Coresight Dummy Trace
Hao Zhang [Fri, 2 Jun 2023 08:41:49 +0000 (16:41 +0800)]
Documentation: trace: Add documentation for Coresight Dummy Trace

Add documentation for Coresight Dummy Trace under trace/coresight.

Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Hao Zhang <quic_hazha@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230602084149.40031-4-quic_hazha@quicinc.com
13 months agodt-bindings: arm: Add support for Coresight dummy trace
Hao Zhang [Fri, 2 Jun 2023 08:41:48 +0000 (16:41 +0800)]
dt-bindings: arm: Add support for Coresight dummy trace

This patch add support for Coresight dummy source and dummy sink trace.

Signed-off-by: Hao Zhang <quic_hazha@quicinc.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230602084149.40031-3-quic_hazha@quicinc.com
13 months agoCoresight: Add coresight dummy driver
Hao Zhang [Fri, 2 Jun 2023 08:41:47 +0000 (16:41 +0800)]
Coresight: Add coresight dummy driver

Some Coresight devices that kernel don't have permission to access or
configure. For these devices, a dummy driver is needed to register them as
Coresight devices. The module may also be used to define components that
may not have any programming interfaces, so that paths can be created
in the driver. It provides Coresight API for operations on dummy devices,
such as enabling and disabling them. It also provides the Coresight dummy
sink/source paths for debugging.

Signed-off-by: Hao Zhang <quic_hazha@quicinc.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230602084149.40031-2-quic_hazha@quicinc.com
13 months agoMAINTAINERS: coresight: Add James Clark as Reviewer
Suzuki K Poulose [Thu, 8 Jun 2023 15:20:45 +0000 (16:20 +0100)]
MAINTAINERS: coresight: Add James Clark as Reviewer

James has made significant contributions to the CoreSight subsystem
both with code and reviews. Add James to the Reviewer for the subsystem.

Cc: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Acked-by: James Clark <james.clark@arm.com>
Link: https://lore.kernel.org/r/20230608152045.112349-1-suzuki.poulose@arm.com
13 months agodt-bindings: iio: rockchip: Fix 'oneOf' condition failed warning
Shreeya Patel [Sat, 10 Jun 2023 14:36:01 +0000 (20:06 +0530)]
dt-bindings: iio: rockchip: Fix 'oneOf' condition failed warning

rk3588-saradc isn't compatible with the rk3399-saradc variant,
hence, fix the following dtbs_check warning for 'oneOf' condition
failure.

DTC_CHK arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dtb
/home/shreeya/linux/arch/arm64/boot/dts/rockchip/rk3588-rock-5b.dtb:
saradc@fec10000: compatible: 'oneOf' conditional failed,
one must be fixed:
['rockchip,rk3588-saradc'] is too short
'rockchip,saradc' was expected
'rockchip,rk3066-tsadc' was expected
'rockchip,rk3399-saradc' was expected

Fixes: 2daf2ae9793d ("dt-bindings: iio: adc: Add rockchip,rk3588-saradc string")
Signed-off-by: Shreeya Patel <shreeya.patel@collabora.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/r/20230610143601.173307-1-shreeya.patel@collabora.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agomeson saradc: fix clock divider mask length
George Stark [Tue, 6 Jun 2023 16:53:57 +0000 (19:53 +0300)]
meson saradc: fix clock divider mask length

According to the datasheets of supported meson SoCs length of ADC_CLK_DIV
field is 6-bit. Although all supported SoCs have the register
with that field documented later SoCs use external clock rather than
ADC internal clock so this patch affects only meson8 family (S8* SoCs).

Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs")
Signed-off-by: George Stark <GNStark@sberdevices.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Link: https://lore.kernel.org/r/20230606165357.42417-1-gnstark@sberdevices.ru
Cc: <stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: iio: afe: voltage-divider: Spelling s/curcuit/circuit/
Geert Uytterhoeven [Tue, 6 Jun 2023 10:03:39 +0000 (12:03 +0200)]
dt-bindings: iio: afe: voltage-divider: Spelling s/curcuit/circuit/

Fix a misspelling of "circuit".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Peter Rosin <peda@axentia.se>
Link: https://lore.kernel.org/r/a8597e54b55dedc51025fe3073d25ef0d659d0dc.1686045793.git.geert+renesas@glider.be
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agodt-bindings: extcon: wlf,arizona: drop unneeded quotes
Krzysztof Kozlowski [Fri, 9 Jun 2023 14:07:40 +0000 (16:07 +0200)]
dt-bindings: extcon: wlf,arizona: drop unneeded quotes

Cleanup bindings dropping unneeded quotes. Once all these are fixed,
checking for this can be enabled in yamllint.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
13 months agoMerge branch 'icc-qos' into icc-next
Georgi Djakov [Sat, 10 Jun 2023 07:43:50 +0000 (10:43 +0300)]
Merge branch 'icc-qos' into icc-next

* icc-qos
  interconnect: qcom: rpm: Rename icc desc clocks to bus_blocks
  interconnect: qcom: rpm: Rename icc provider num_clocks to num_bus_clocks
  interconnect: qcom: rpm: Drop unused parameters
  interconnect: qcom: rpm: Set QoS registers only once
  interconnect: qcom: rpm: Handle interface clocks
  interconnect: qcom: icc-rpm: Enforce 2 or 0 bus clocks
  interconnect: qcom: rpm: Don't use clk_get_optional for bus clocks anymore
  interconnect: qcom: msm8996: Promote to core_initcall
  interconnect: qcom: rpm: allocate enough data in probe()

Link: https://lore.kernel.org/r/20230228-topic-qos-v8-0-ee696a2c15a9@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
13 months agoMerge branch 'icc-cbf' into icc-next
Georgi Djakov [Sat, 10 Jun 2023 07:43:20 +0000 (10:43 +0300)]
Merge branch 'icc-cbf' into icc-next

On MSM8996 two CPU clusters are interconnected using the Core Bus
Fabric (CBF). In order for the CPU clusters to function properly, it
should be clocked following the core's frequencies to provide adequate
bandwidth.

Register CBF as a clock (required for CPU to boot) and add a tiny
interconnect layer on top of it to let cpufreq/opp scale the CBF clock.

* icc-cbf
  dt-bindings: interconnect/msm8996-cbf: add defines to be used by CBF
  interconnect: add clk-based icc provider support
  clk: qcom: cbf-msm8996: scale CBF clock according to the CPUfreq
  interconnect: icc-clk: fix modular build

Link: https://lore.kernel.org/r/20230512001334.2983048-1-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
13 months agodt-bindings: interconnect: fsl,imx8m-noc: drop unneeded quotes
Krzysztof Kozlowski [Fri, 9 Jun 2023 14:07:32 +0000 (16:07 +0200)]
dt-bindings: interconnect: fsl,imx8m-noc: drop unneeded quotes

Cleanup bindings dropping unneeded quotes. Once all these are fixed,
checking for this can be enabled in yamllint.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230609140732.64828-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
13 months agointerconnect: icc-clk: fix modular build
Dmitry Baryshkov [Fri, 19 May 2023 23:01:22 +0000 (02:01 +0300)]
interconnect: icc-clk: fix modular build

Fix building interconnect-clk as a module:
- Add EXPORT_SYMBOL_GPL to the exported functions
- Add MODULE_DESCRIPTION/_LICENSE/_AUTHOR

Reported-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230519230122.3958816-1-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
13 months agoclk: qcom: cbf-msm8996: scale CBF clock according to the CPUfreq
Dmitry Baryshkov [Fri, 12 May 2023 00:13:33 +0000 (03:13 +0300)]
clk: qcom: cbf-msm8996: scale CBF clock according to the CPUfreq

Turn CBF into the interconnect provider. Scale CBF frequency (bandwidth)
according to CPU frequencies.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Tested-by: Yassine Oudjana <y.oudjana@protonmail.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Acked-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230512001334.2983048-4-dmitry.baryshkov@linaro.org
Signed-off-by: Georgi Djakov <djakov@kernel.org>
13 months agocounter: i8254: Introduce the Intel 8254 interface library module
William Breathitt Gray [Sun, 16 Apr 2023 17:36:53 +0000 (13:36 -0400)]
counter: i8254: Introduce the Intel 8254 interface library module

Exposes consumer library functions providing support for interfaces
compatible with the venerable Intel 8254 Programmable Interval Timer
(PIT).

The Intel 8254 PIT first appeared in the early 1980s and was used
initially in IBM PC compatibles. The popularity of the original Intel
825x family of chips led to many subsequent variants and clones of the
interface in various chips and integrated circuits. Although still
popular, interfaces compatible with the Intel 8254 PIT are nowdays
typically found embedded in larger VLSI processing chips and FPGA
components rather than as discrete ICs.

A CONFIG_I8254 Kconfig option is introduced by this patch. Modules
wanting access to these i8254 library functions should select this
Kconfig option, and import the I8254 symbol namespace.

Link: https://lore.kernel.org/r/f6fe32c2db9525d816ab1a01f45abad56c081652.1681665189.git.william.gray@linaro.org/
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
13 months agocoresight: etm4x: Match all ETM4 instances based on DEVARCH and DEVTYPE
Suzuki K Poulose [Mon, 5 Jun 2023 13:30:30 +0000 (14:30 +0100)]
coresight: etm4x: Match all ETM4 instances based on DEVARCH and DEVTYPE

Instead of adding the PIDs forever to the list for the new CPUs, let us detect
a component to be ETMv4 based on the CoreSight CID, DEVTYPE=PE_TRACE and
DEVARCH=ETMv4. This is already done for some of the ETMs. We can extend the PID
matching to match the PIDR2:JEDEC, BIT[3], which must be 1 (RAO) always.

Link: https://lkml.kernel.org/r/20230317030501.1811905-1-anshuman.khandual@arm.com
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: frowand.list@gmail.com
Cc: linux@armlinux.org.uk
Cc: Mike Leach <mike.leach@linaro.org>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
[ Fixed typo in the description RA0 => RAO ]
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230605133031.1827626-1-suzuki.poulose@arm.com
13 months agocoresight: etm4x: Make etm4_remove_dev() return void
Uwe Kleine-König [Thu, 18 May 2023 20:16:29 +0000 (22:16 +0200)]
coresight: etm4x: Make etm4_remove_dev() return void

etm4_remove_dev() returned zero unconditionally. Make it return void
instead, which makes it clear in the callers that there is no error to
handle. Simplify etm4_remove_platform_dev() accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230518201629.260672-1-u.kleine-koenig@pengutronix.de
13 months agofpga: zynq-fpga: Ensure proper xCAP interface switch
Alfonso Rodriguez [Mon, 5 Jun 2023 11:54:33 +0000 (17:24 +0530)]
fpga: zynq-fpga: Ensure proper xCAP interface switch

The Zynq platform has PCAP, ICAP and JTAG interfaces for configuring
programmable logic (PL). The existing driver implementation uses the
PCAP interface to configure the PL. Before switching the PL configuration
interface from PCAP to ICAP make sure that all outstanding Transactions
relevant to the PL configuration should be completed by the PCAP interface
otherwise it may lead to PL configuration issues.

This patch provides a required fix to ensure that all existing PL
transactions are completed before switching from PCAP to ICAP.

For detailed information relevant to PL configuration interfaces refer
Zynq 7000 TRM (section 6.5.1).
Link: https://docs.xilinx.com/v/u/en-US/ug585-Zynq-7000-TRM
Signed-off-by: Alfonso Rodriguez <alfonso.rodriguezm@upm.es>
Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
Acked-by: Xu Yilun <yilun.xu@intel.com>
Link: https://lore.kernel.org/r/20230605115433.186087-1-nava.kishore.manne@amd.com
Signed-off-by: Xu Yilun <yilun.xu@intel.com>
13 months agocoresight: etm4x: Fix missing trctraceidr file in sysfs
Mike Leach [Fri, 12 May 2023 13:30:54 +0000 (14:30 +0100)]
coresight: etm4x: Fix missing trctraceidr file in sysfs

The trace ID patchset adjusted the handling of the TRCTRACEIDR register
sysfs to allocate on read.

Although this was initally correct, the final version of the patch series
introduced an error which resulted in the mgmt/trctraceidr file in sysfs
not being visible.

This patch fixes that issue.

Fixes: df4871204e5d ("coresight: etm4x: Update ETM4 driver to use Trace ID API")
Reported-by: Junhao He <hejunhao3@huawei.com>
Link: https://lists.linaro.org/archives/list/coresight@lists.linaro.org/thread/KK3CVVMRHJWVUORKMFJRSXYCEDFKENQJ/
Signed-off-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230512133054.235073-1-mike.leach@linaro.org
13 months agoiio: accel: fxls8962af: errata bug only applicable for FXLS8962AF
Sean Nyekjaer [Mon, 5 Jun 2023 10:32:22 +0000 (12:32 +0200)]
iio: accel: fxls8962af: errata bug only applicable for FXLS8962AF

Remove special errata handling if FXLS8964AF is used.

Fixes: af959b7b96b8 ("iio: accel: fxls8962af: fix errata bug E3 - I2C burst reads")
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230605103223.1400980-2-sean@geanix.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agoiio: accel: fxls8962af: fixup buffer scan element type
Sean Nyekjaer [Mon, 5 Jun 2023 10:32:21 +0000 (12:32 +0200)]
iio: accel: fxls8962af: fixup buffer scan element type

Scan elements for x,y,z channels is little endian and requires no bit shifts.
LE vs. BE is controlled in register SENS_CONFIG2 and bit LE_BE, default
value is LE.

Fixes: a3e0b51884ee ("iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers")
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230605103223.1400980-1-sean@geanix.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
13 months agocoresight: Fix CTI module refcount leak by making it a helper device
James Clark [Tue, 25 Apr 2023 14:35:40 +0000 (15:35 +0100)]
coresight: Fix CTI module refcount leak by making it a helper device

The CTI module has some hard coded refcounting code that has a leak.
For example running perf and then trying to unload it fails:

  perf record -e cs_etm// -a -- ls
  rmmod coresight_cti

  rmmod: ERROR: Module coresight_cti is in use

The coresight core already handles references of devices in use, so by
making CTI a normal helper device, we get working refcounting for free.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-14-james.clark@arm.com
13 months agocoresight: Enable and disable helper devices adjacent to the path
James Clark [Tue, 25 Apr 2023 14:35:39 +0000 (15:35 +0100)]
coresight: Enable and disable helper devices adjacent to the path

Currently CATU is the only helper device, and its enable and disable
calls are hard coded. To allow more helper devices to be added in a
generic way, remove these hard coded calls and just enable and disable
all helper devices.

This has to apply to helpers adjacent to the path, because they will
never be in the path. CATU was already discovered in this way, so
there is no change there.

One change that is needed is for CATU to call back into ETR to allocate
the buffer. Because the enable call was previously hard coded, it was
done at a point where the buffer was already allocated, but this is no
longer the case.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-13-james.clark@arm.com
13 months agocoresight: Refactor out buffer allocation function for ETR
James Clark [Tue, 25 Apr 2023 14:35:38 +0000 (15:35 +0100)]
coresight: Refactor out buffer allocation function for ETR

When CATU is moved to the generic enable/disable path system in the
next commit, it will need to call into ETR and get it to pre-allocate
its buffer so add a function for it.

No functional changes

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-12-james.clark@arm.com
13 months agocoresight: Make refcount a property of the connection
James Clark [Tue, 25 Apr 2023 14:35:37 +0000 (15:35 +0100)]
coresight: Make refcount a property of the connection

This removes the need to do an additional lookup for the total number
of ports used and also removes the need to allocate an array of
refcounts which is just another representation of a connection array.

This was only used for link type devices, for regular devices a single
refcount on the coresight device is used.

There is a both an input and output refcount in case two link type
devices are connected together so that they don't overwrite each other's
counts.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-11-james.clark@arm.com
13 months agocoresight: Store in-connections as well as out-connections
James Clark [Tue, 25 Apr 2023 14:35:36 +0000 (15:35 +0100)]
coresight: Store in-connections as well as out-connections

This will allow CATU to get its associated ETR in a generic way where
currently the enable path has some hard coded searches which avoid
the need to store input connections.

This also means that the full search for connected devices on removal
can be replaced with a loop through only the input and output devices.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-10-james.clark@arm.com
13 months agocoresight: Simplify connection fixup mechanism
James Clark [Tue, 25 Apr 2023 14:35:35 +0000 (15:35 +0100)]
coresight: Simplify connection fixup mechanism

There is some duplication between coresight_fixup_device_conns() and
coresight_fixup_orphan_conns(). They both do the same thing except for
the fact that coresight_fixup_orphan_conns() can't handle iterating over
itself.

By making it able to handle fixing up it's own connections the other
function can be removed.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-9-james.clark@arm.com
13 months agocoresight: Store pointers to connections rather than an array of them
James Clark [Tue, 25 Apr 2023 14:35:34 +0000 (15:35 +0100)]
coresight: Store pointers to connections rather than an array of them

This will allow the same connection object to be referenced via the
input connection list in a later commit rather than duplicating them.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-8-james.clark@arm.com
13 months agocoresight: Dynamically add connections
James Clark [Tue, 25 Apr 2023 14:35:33 +0000 (15:35 +0100)]
coresight: Dynamically add connections

Add a function for adding connections dynamically. This also removes
the 1:1 mapping between port number and the index into the connections
array. The only place this mapping was used was in the warning for
duplicate output ports, which has been replaced by a search. Other
uses of the port number already use the port member variable.

Being able to dynamically add connections will allow other devices like
CTI to re-use the connection mechanism despite not having explicit
connections described in the DT.

The connections array is now no longer sparse, so child_fwnode doesn't
need to be checked as all connections have a target node. Because the
array is no longer sparse, the high in and out port numbers are required
for the refcount arrays. But these will also be removed in a later
commit when the refcount is made a property of the connection.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-7-james.clark@arm.com
13 months agocoresight: Rename connection members to make the direction explicit
James Clark [Tue, 25 Apr 2023 14:35:32 +0000 (15:35 +0100)]
coresight: Rename connection members to make the direction explicit

When input connections are added they will use the same connection
object as the output so parent and child could be misinterpreted. Making
the direction unambiguous in the names should improve readability.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-6-james.clark@arm.com
13 months agocoresight: Rename nr_outports to nr_outconns
James Clark [Tue, 25 Apr 2023 14:35:31 +0000 (15:35 +0100)]
coresight: Rename nr_outports to nr_outconns

Rename to avoid confusion between port number and the index in the
connection array. The port number is already stored in the connection,
and in a later commit the connection array will be appended to, so
the length of it will no longer reflect the number of ports.

No functional changes.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-5-james.clark@arm.com
13 months agocoresight: Change name of pdata->conns
James Clark [Tue, 25 Apr 2023 14:35:30 +0000 (15:35 +0100)]
coresight: Change name of pdata->conns

conns is actually for output connections. Change the name to make it
clearer and so that we can add input connections later.

No functional changes.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-4-james.clark@arm.com
13 months agocoresight: Use enum type for cs_mode wherever possible
James Clark [Tue, 25 Apr 2023 14:35:29 +0000 (15:35 +0100)]
coresight: Use enum type for cs_mode wherever possible

mode is stored as a local_t, but it is also passed around a lot as a
plain u32, so use the correct type wherever local_t isn't currently
used. This helps a little bit with readability.

Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-3-james.clark@arm.com
13 months agocoresight: Fix loss of connection info when a module is unloaded
James Clark [Tue, 25 Apr 2023 14:35:28 +0000 (15:35 +0100)]
coresight: Fix loss of connection info when a module is unloaded

child_fwnode should be a read only property based on the DT or ACPI. If
it's cleared on the parent device when a child is unloaded, then when
the child is loaded again the connection won't be remade.

child_dev should be cleared instead which signifies that the connection
should be remade when the child_fwnode registers a new coresight_device.

Similarly the reference count shouldn't be decremented as long as the
parent device exists. The correct place to drop the reference is in
coresight_release_platform_data() which is already done.

Reproducible on Juno with the following steps:

  # load all coresight modules.
  $ cd /sys/bus/coresight/devices/
  $ echo 1 > tmc_etr0/enable_sink
  $ echo 1 > etm0/enable_source
  # Works fine ^

  $ echo 0 > etm0/enable_source
  $ rmmod coresight-funnel
  $ modprobe coresight-funnel
  $ echo 1 > etm0/enable_source
  -bash: echo: write error: Invalid argument

Fixes: 37ea1ffddffa ("coresight: Use fwnode handle instead of device names")
Fixes: 2af89ebacf29 ("coresight: Clear the connection field properly")
Tested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Reviewed-by: Mike Leach <mike.leach@linaro.org>
Signed-off-by: James Clark <james.clark@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20230425143542.2305069-2-james.clark@arm.com
13 months agoMerge 6.4-rc5 into char-misc-next
Greg Kroah-Hartman [Mon, 5 Jun 2023 05:19:18 +0000 (07:19 +0200)]
Merge 6.4-rc5 into char-misc-next

We need the char/misc fixes in here as well for mergeing and testing.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
13 months agoLinux 6.4-rc5
Linus Torvalds [Sun, 4 Jun 2023 18:04:27 +0000 (14:04 -0400)]
Linux 6.4-rc5

13 months agoMerge tag 'irq_urgent_for_v6.4_rc5' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 4 Jun 2023 15:57:38 +0000 (11:57 -0400)]
Merge tag 'irq_urgent_for_v6.4_rc5' of git://git./linux/kernel/git/tip/tip

Pull irq fix from Borislav Petkov:

 - Fix open firmware quirks validation so that they don't get applied
   wrongly

* tag 'irq_urgent_for_v6.4_rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  irqchip/gic: Correctly validate OF quirk descriptors

13 months agoMerge tag 'media/v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Sun, 4 Jun 2023 13:10:43 +0000 (09:10 -0400)]
Merge tag 'media/v6.4-4' of git://git./linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
 "Some driver fixes:
   - a regression fix for the verisilicon driver
   - uvcvideo: don't expose unsupported video formats to userspace
   - camss-video: don't zero subdev format after init
   - mediatek: some fixes for 4K decoder formats
   - fix a Sphinx build warning (missing doc for client_caps)
   - some fixes for imx and atomisp staging drivers

  And two CEC core fixes:
   - don't set last_initiator if TX in progress
   - disable adapter in cec_devnode_unregister"

* tag 'media/v6.4-4' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  media: uvcvideo: Don't expose unsupported formats to userspace
  media: v4l2-subdev: Fix missing kerneldoc for client_caps
  media: staging: media: imx: initialize hs_settle to avoid warning
  media: v4l2-mc: Drop subdev check in v4l2_create_fwnode_links_to_pad()
  media: staging: media: atomisp: init high & low vars
  media: cec: core: don't set last_initiator if tx in progress
  media: cec: core: disable adapter in cec_devnode_unregister
  media: mediatek: vcodec: Only apply 4K frame sizes on decoder formats
  media: camss: camss-video: Don't zero subdev format again after initialization
  media: verisilicon: Additional fix for the crash when opening the driver