From 7d17f80911f9dfc533ceb3152e86ad476f460996 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 7 Feb 2023 09:04:32 +0100 Subject: [PATCH] 5.10-stable patches added patches: alsa-hda-realtek-add-acer-predator-ph315-54.patch efi-accept-version-2-of-memory-attributes-table.patch fbcon-check-font-dimension-limits.patch iio-adc-berlin2-adc-add-missing-of_node_put-in-error-path.patch iio-adc-twl6030-enable-measurements-of-vusb-vbat-and-others.patch iio-hid-fix-the-retval-in-accel_3d_capture_sample.patch iio-imu-fxos8700-fix-accel-measurement-range-selection.patch iio-imu-fxos8700-fix-failed-initialization-odr-mode-assignment.patch iio-imu-fxos8700-fix-imu-data-bits-returned-to-user-space.patch iio-imu-fxos8700-fix-incomplete-accel-and-magn-channels-readback.patch iio-imu-fxos8700-fix-incorrect-odr-mode-readback.patch iio-imu-fxos8700-fix-magn-sensor-scale-and-unit.patch iio-imu-fxos8700-fix-map-label-of-channel-type-to-magn-sensor.patch iio-imu-fxos8700-fix-swapped-accel-and-magn-channels-readback.patch iio-imu-fxos8700-remove-definition-fxos8700_ctrl_odr_min.patch net-qrtr-free-memory-on-error-path-in-radix_tree_insert.patch nvmem-qcom-spmi-sdam-fix-module-autoloading.patch parisc-fix-return-code-of-pdc_iodc_print.patch parisc-wire-up-ptrace_getregs-ptrace_setregs-for-compat-case.patch riscv-disable-generation-of-unwind-tables.patch watchdog-diag288_wdt-do-not-use-stack-buffers-for-hardware-data.patch watchdog-diag288_wdt-fix-__diag288-inline-assembly.patch --- ...a-realtek-add-acer-predator-ph315-54.patch | 32 ++++++ ...version-2-of-memory-attributes-table.patch | 32 ++++++ .../fbcon-check-font-dimension-limits.patch | 50 +++++++++ ...dd-missing-of_node_put-in-error-path.patch | 37 +++++++ ...measurements-of-vusb-vbat-and-others.patch | 70 ++++++++++++ ...he-retval-in-accel_3d_capture_sample.patch | 32 ++++++ ...ix-accel-measurement-range-selection.patch | 102 ++++++++++++++++++ ...d-initialization-odr-mode-assignment.patch | 40 +++++++ ...imu-data-bits-returned-to-user-space.patch | 73 +++++++++++++ ...ete-accel-and-magn-channels-readback.patch | 38 +++++++ ...8700-fix-incorrect-odr-mode-readback.patch | 71 ++++++++++++ ...s8700-fix-magn-sensor-scale-and-unit.patch | 56 ++++++++++ ...label-of-channel-type-to-magn-sensor.patch | 37 +++++++ ...ped-accel-and-magn-channels-readback.patch | 50 +++++++++ ...ove-definition-fxos8700_ctrl_odr_min.patch | 33 ++++++ ...y-on-error-path-in-radix_tree_insert.patch | 43 ++++++++ ...com-spmi-sdam-fix-module-autoloading.patch | 33 ++++++ ...sc-fix-return-code-of-pdc_iodc_print.patch | 47 ++++++++ ...tregs-ptrace_setregs-for-compat-case.patch | 64 +++++++++++ ...-disable-generation-of-unwind-tables.patch | 36 +++++++ queue-5.10/series | 22 ++++ ...-use-stack-buffers-for-hardware-data.patch | 50 +++++++++ ...88_wdt-fix-__diag288-inline-assembly.patch | 33 ++++++ 23 files changed, 1081 insertions(+) create mode 100644 queue-5.10/alsa-hda-realtek-add-acer-predator-ph315-54.patch create mode 100644 queue-5.10/efi-accept-version-2-of-memory-attributes-table.patch create mode 100644 queue-5.10/fbcon-check-font-dimension-limits.patch create mode 100644 queue-5.10/iio-adc-berlin2-adc-add-missing-of_node_put-in-error-path.patch create mode 100644 queue-5.10/iio-adc-twl6030-enable-measurements-of-vusb-vbat-and-others.patch create mode 100644 queue-5.10/iio-hid-fix-the-retval-in-accel_3d_capture_sample.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-accel-measurement-range-selection.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-failed-initialization-odr-mode-assignment.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-imu-data-bits-returned-to-user-space.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-incomplete-accel-and-magn-channels-readback.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-incorrect-odr-mode-readback.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-magn-sensor-scale-and-unit.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-map-label-of-channel-type-to-magn-sensor.patch create mode 100644 queue-5.10/iio-imu-fxos8700-fix-swapped-accel-and-magn-channels-readback.patch create mode 100644 queue-5.10/iio-imu-fxos8700-remove-definition-fxos8700_ctrl_odr_min.patch create mode 100644 queue-5.10/net-qrtr-free-memory-on-error-path-in-radix_tree_insert.patch create mode 100644 queue-5.10/nvmem-qcom-spmi-sdam-fix-module-autoloading.patch create mode 100644 queue-5.10/parisc-fix-return-code-of-pdc_iodc_print.patch create mode 100644 queue-5.10/parisc-wire-up-ptrace_getregs-ptrace_setregs-for-compat-case.patch create mode 100644 queue-5.10/riscv-disable-generation-of-unwind-tables.patch create mode 100644 queue-5.10/watchdog-diag288_wdt-do-not-use-stack-buffers-for-hardware-data.patch create mode 100644 queue-5.10/watchdog-diag288_wdt-fix-__diag288-inline-assembly.patch diff --git a/queue-5.10/alsa-hda-realtek-add-acer-predator-ph315-54.patch b/queue-5.10/alsa-hda-realtek-add-acer-predator-ph315-54.patch new file mode 100644 index 00000000000..16e5ed600ca --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-add-acer-predator-ph315-54.patch @@ -0,0 +1,32 @@ +From 6a28a25d358079b7d0d144689f850aecacf63cba Mon Sep 17 00:00:00 2001 +From: Victor Shyba +Date: Mon, 23 Jan 2023 19:21:29 -0300 +Subject: ALSA: hda/realtek: Add Acer Predator PH315-54 + +From: Victor Shyba + +commit 6a28a25d358079b7d0d144689f850aecacf63cba upstream. + +Same issue as SP513-54N: Headset microphone does not work without +ALC255_FIXUP_ACER_MIC_NO_PRESENCE fixup. + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=211853 +Cc: +Signed-off-by: Victor Shyba +Link: https://lore.kernel.org/r/20230123222129.17589-1-victor1984@riseup.net +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8811,6 +8811,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC), ++ SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), + SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X), + SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS), diff --git a/queue-5.10/efi-accept-version-2-of-memory-attributes-table.patch b/queue-5.10/efi-accept-version-2-of-memory-attributes-table.patch new file mode 100644 index 00000000000..b86a894936d --- /dev/null +++ b/queue-5.10/efi-accept-version-2-of-memory-attributes-table.patch @@ -0,0 +1,32 @@ +From 636ab417a7aec4ee993916e688eb5c5977570836 Mon Sep 17 00:00:00 2001 +From: Ard Biesheuvel +Date: Thu, 2 Feb 2023 18:30:06 +0100 +Subject: efi: Accept version 2 of memory attributes table + +From: Ard Biesheuvel + +commit 636ab417a7aec4ee993916e688eb5c5977570836 upstream. + +UEFI v2.10 introduces version 2 of the memory attributes table, which +turns the reserved field into a flags field, but is compatible with +version 1 in all other respects. So let's not complain about version 2 +if we encounter it. + +Cc: +Signed-off-by: Ard Biesheuvel +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/efi/memattr.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/firmware/efi/memattr.c ++++ b/drivers/firmware/efi/memattr.c +@@ -33,7 +33,7 @@ int __init efi_memattr_init(void) + return -ENOMEM; + } + +- if (tbl->version > 1) { ++ if (tbl->version > 2) { + pr_warn("Unexpected EFI Memory Attributes table version %d\n", + tbl->version); + goto unmap; diff --git a/queue-5.10/fbcon-check-font-dimension-limits.patch b/queue-5.10/fbcon-check-font-dimension-limits.patch new file mode 100644 index 00000000000..aa64211af4b --- /dev/null +++ b/queue-5.10/fbcon-check-font-dimension-limits.patch @@ -0,0 +1,50 @@ +From 2b09d5d364986f724f17001ccfe4126b9b43a0be Mon Sep 17 00:00:00 2001 +From: Samuel Thibault +Date: Sun, 29 Jan 2023 16:17:40 +0100 +Subject: fbcon: Check font dimension limits + +From: Samuel Thibault + +commit 2b09d5d364986f724f17001ccfe4126b9b43a0be upstream. + +blit_x and blit_y are u32, so fbcon currently cannot support fonts +larger than 32x32. + +The 32x32 case also needs shifting an unsigned int, to properly set bit +31, otherwise we get "UBSAN: shift-out-of-bounds in fbcon_set_font", +as reported on: + +http://lore.kernel.org/all/IA1PR07MB98308653E259A6F2CE94A4AFABCE9@IA1PR07MB9830.namprd07.prod.outlook.com +Kernel Branch: 6.2.0-rc5-next-20230124 +Kernel config: https://drive.google.com/file/d/1F-LszDAizEEH0ZX0HcSR06v5q8FPl2Uv/view?usp=sharing +Reproducer: https://drive.google.com/file/d/1mP1jcLBY7vWCNM60OMf-ogw-urQRjNrm/view?usp=sharing + +Reported-by: Sanan Hasanov +Signed-off-by: Samuel Thibault +Fixes: 2d2699d98492 ("fbcon: font setting should check limitation of driver") +Cc: stable@vger.kernel.org +Tested-by: Miko Larsson +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman +--- + drivers/video/fbdev/core/fbcon.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/drivers/video/fbdev/core/fbcon.c ++++ b/drivers/video/fbdev/core/fbcon.c +@@ -2513,9 +2513,12 @@ static int fbcon_set_font(struct vc_data + h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) + return -EINVAL; + ++ if (font->width > 32 || font->height > 32) ++ return -EINVAL; ++ + /* Make sure drawing engine can handle the font */ +- if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || +- !(info->pixmap.blit_y & (1 << (font->height - 1)))) ++ if (!(info->pixmap.blit_x & BIT(font->width - 1)) || ++ !(info->pixmap.blit_y & BIT(font->height - 1))) + return -EINVAL; + + /* Make sure driver can handle the font length */ diff --git a/queue-5.10/iio-adc-berlin2-adc-add-missing-of_node_put-in-error-path.patch b/queue-5.10/iio-adc-berlin2-adc-add-missing-of_node_put-in-error-path.patch new file mode 100644 index 00000000000..c480fb4a4cb --- /dev/null +++ b/queue-5.10/iio-adc-berlin2-adc-add-missing-of_node_put-in-error-path.patch @@ -0,0 +1,37 @@ +From cbd3a0153cd18a2cbef6bf3cf31bb406c3fc9f55 Mon Sep 17 00:00:00 2001 +From: Xiongfeng Wang +Date: Tue, 29 Nov 2022 10:03:16 +0800 +Subject: iio: adc: berlin2-adc: Add missing of_node_put() in error path + +From: Xiongfeng Wang + +commit cbd3a0153cd18a2cbef6bf3cf31bb406c3fc9f55 upstream. + +of_get_parent() will return a device_node pointer with refcount +incremented. We need to use of_node_put() on it when done. Add the +missing of_node_put() in the error path of berlin2_adc_probe(); + +Fixes: 70f1937911ca ("iio: adc: add support for Berlin") +Signed-off-by: Xiongfeng Wang +Link: https://lore.kernel.org/r/20221129020316.191731-1-wangxiongfeng2@huawei.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/berlin2-adc.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/iio/adc/berlin2-adc.c ++++ b/drivers/iio/adc/berlin2-adc.c +@@ -289,8 +289,10 @@ static int berlin2_adc_probe(struct plat + int ret; + + indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); +- if (!indio_dev) ++ if (!indio_dev) { ++ of_node_put(parent_np); + return -ENOMEM; ++ } + + priv = iio_priv(indio_dev); + platform_set_drvdata(pdev, indio_dev); diff --git a/queue-5.10/iio-adc-twl6030-enable-measurements-of-vusb-vbat-and-others.patch b/queue-5.10/iio-adc-twl6030-enable-measurements-of-vusb-vbat-and-others.patch new file mode 100644 index 00000000000..885ff4763ef --- /dev/null +++ b/queue-5.10/iio-adc-twl6030-enable-measurements-of-vusb-vbat-and-others.patch @@ -0,0 +1,70 @@ +From f804bd0dc28683a93a60f271aaefb2fc5b0853dd Mon Sep 17 00:00:00 2001 +From: Andreas Kemnade +Date: Thu, 1 Dec 2022 19:16:35 +0100 +Subject: iio:adc:twl6030: Enable measurements of VUSB, VBAT and others + +From: Andreas Kemnade + +commit f804bd0dc28683a93a60f271aaefb2fc5b0853dd upstream. + +Some inputs need to be wired up to produce proper measurements, +without this change only near zero values are reported. + +Signed-off-by: Andreas Kemnade +Fixes: 1696f36482e70 ("iio: twl6030-gpadc: TWL6030, TWL6032 GPADC driver") +Link: https://lore.kernel.org/r/20221201181635.3522962-1-andreas@kemnade.info +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/twl6030-gpadc.c | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + +--- a/drivers/iio/adc/twl6030-gpadc.c ++++ b/drivers/iio/adc/twl6030-gpadc.c +@@ -57,6 +57,18 @@ + #define TWL6030_GPADCS BIT(1) + #define TWL6030_GPADCR BIT(0) + ++#define USB_VBUS_CTRL_SET 0x04 ++#define USB_ID_CTRL_SET 0x06 ++ ++#define TWL6030_MISC1 0xE4 ++#define VBUS_MEAS 0x01 ++#define ID_MEAS 0x01 ++ ++#define VAC_MEAS 0x04 ++#define VBAT_MEAS 0x02 ++#define BB_MEAS 0x01 ++ ++ + /** + * struct twl6030_chnl_calib - channel calibration + * @gain: slope coefficient for ideal curve +@@ -927,6 +939,26 @@ static int twl6030_gpadc_probe(struct pl + return ret; + } + ++ ret = twl_i2c_write_u8(TWL_MODULE_USB, VBUS_MEAS, USB_VBUS_CTRL_SET); ++ if (ret < 0) { ++ dev_err(dev, "failed to wire up inputs\n"); ++ return ret; ++ } ++ ++ ret = twl_i2c_write_u8(TWL_MODULE_USB, ID_MEAS, USB_ID_CTRL_SET); ++ if (ret < 0) { ++ dev_err(dev, "failed to wire up inputs\n"); ++ return ret; ++ } ++ ++ ret = twl_i2c_write_u8(TWL6030_MODULE_ID0, ++ VBAT_MEAS | BB_MEAS | BB_MEAS, ++ TWL6030_MISC1); ++ if (ret < 0) { ++ dev_err(dev, "failed to wire up inputs\n"); ++ return ret; ++ } ++ + indio_dev->name = DRIVER_NAME; + indio_dev->info = &twl6030_gpadc_iio_info; + indio_dev->modes = INDIO_DIRECT_MODE; diff --git a/queue-5.10/iio-hid-fix-the-retval-in-accel_3d_capture_sample.patch b/queue-5.10/iio-hid-fix-the-retval-in-accel_3d_capture_sample.patch new file mode 100644 index 00000000000..bde27daf298 --- /dev/null +++ b/queue-5.10/iio-hid-fix-the-retval-in-accel_3d_capture_sample.patch @@ -0,0 +1,32 @@ +From f7b23d1c35d8b8de1425bdfccaefd01f3b7c9d1c Mon Sep 17 00:00:00 2001 +From: Dmitry Perchanov +Date: Wed, 11 Jan 2023 14:22:10 +0200 +Subject: iio: hid: fix the retval in accel_3d_capture_sample + +From: Dmitry Perchanov + +commit f7b23d1c35d8b8de1425bdfccaefd01f3b7c9d1c upstream. + +Return value should be zero for success. This was forgotten for timestamp +feature. Verified on RealSense cameras. + +Fixes: a96cd0f901ee ("iio: accel: hid-sensor-accel-3d: Add timestamp") +Signed-off-by: Dmitry Perchanov +Link: https://lore.kernel.org/r/a6dc426498221c81fa71045b41adf782ebd42136.camel@intel.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/accel/hid-sensor-accel-3d.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/iio/accel/hid-sensor-accel-3d.c ++++ b/drivers/iio/accel/hid-sensor-accel-3d.c +@@ -277,6 +277,7 @@ static int accel_3d_capture_sample(struc + hid_sensor_convert_timestamp( + &accel_state->common_attributes, + *(int64_t *)raw_data); ++ ret = 0; + break; + default: + break; diff --git a/queue-5.10/iio-imu-fxos8700-fix-accel-measurement-range-selection.patch b/queue-5.10/iio-imu-fxos8700-fix-accel-measurement-range-selection.patch new file mode 100644 index 00000000000..cfc8302fc60 --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-accel-measurement-range-selection.patch @@ -0,0 +1,102 @@ +From 9d61c1820598a5ea474576ed55318a6dadee37ed Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Thu, 8 Dec 2022 15:19:09 +0800 +Subject: iio: imu: fxos8700: fix ACCEL measurement range selection + +From: Carlos Song + +commit 9d61c1820598a5ea474576ed55318a6dadee37ed upstream. + +When device is in active mode, it fails to set an ACCEL full-scale +range(2g/4g/8g) in FXOS8700_XYZ_DATA_CFG. This is not align with the +datasheet, but it is a fxos8700 chip behavior. + +Keep the device in standby mode before setting ACCEL full-scale range +into FXOS8700_XYZ_DATA_CFG in chip initialization phase and setting +scale phase. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20221208071911.2405922-6-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 41 +++++++++++++++++++++++++++++++++------- + 1 file changed, 34 insertions(+), 7 deletions(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -345,7 +345,8 @@ static int fxos8700_set_active_mode(stru + static int fxos8700_set_scale(struct fxos8700_data *data, + enum fxos8700_sensor t, int uscale) + { +- int i; ++ int i, ret, val; ++ bool active_mode; + static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale); + struct device *dev = regmap_get_device(data->regmap); + +@@ -354,6 +355,25 @@ static int fxos8700_set_scale(struct fxo + return -EINVAL; + } + ++ /* ++ * When device is in active mode, it failed to set an ACCEL ++ * full-scale range(2g/4g/8g) in FXOS8700_XYZ_DATA_CFG. ++ * This is not align with the datasheet, but it is a fxos8700 ++ * chip behavier. Set the device in standby mode before setting ++ * an ACCEL full-scale range. ++ */ ++ ret = regmap_read(data->regmap, FXOS8700_CTRL_REG1, &val); ++ if (ret) ++ return ret; ++ ++ active_mode = val & FXOS8700_ACTIVE; ++ if (active_mode) { ++ ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, ++ val & ~FXOS8700_ACTIVE); ++ if (ret) ++ return ret; ++ } ++ + for (i = 0; i < scale_num; i++) + if (fxos8700_accel_scale[i].uscale == uscale) + break; +@@ -361,8 +381,12 @@ static int fxos8700_set_scale(struct fxo + if (i == scale_num) + return -EINVAL; + +- return regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, ++ ret = regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, + fxos8700_accel_scale[i].bits); ++ if (ret) ++ return ret; ++ return regmap_write(data->regmap, FXOS8700_CTRL_REG1, ++ active_mode); + } + + static int fxos8700_get_scale(struct fxos8700_data *data, +@@ -592,14 +616,17 @@ static int fxos8700_chip_init(struct fxo + if (ret) + return ret; + +- /* Max ODR (800Hz individual or 400Hz hybrid), active mode */ +- ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, +- FXOS8700_CTRL_ODR_MAX | FXOS8700_ACTIVE); ++ /* ++ * Set max full-scale range (+/-8G) for ACCEL sensor in chip ++ * initialization then activate the device. ++ */ ++ ret = regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, MODE_8G); + if (ret) + return ret; + +- /* Set for max full-scale range (+/-8G) */ +- return regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, MODE_8G); ++ /* Max ODR (800Hz individual or 400Hz hybrid), active mode */ ++ return regmap_write(data->regmap, FXOS8700_CTRL_REG1, ++ FXOS8700_CTRL_ODR_MAX | FXOS8700_ACTIVE); + } + + static void fxos8700_chip_uninit(void *data) diff --git a/queue-5.10/iio-imu-fxos8700-fix-failed-initialization-odr-mode-assignment.patch b/queue-5.10/iio-imu-fxos8700-fix-failed-initialization-odr-mode-assignment.patch new file mode 100644 index 00000000000..ed3826401ee --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-failed-initialization-odr-mode-assignment.patch @@ -0,0 +1,40 @@ +From eb6d8f8705bc19141bac81d8161461f9e256948a Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Wed, 18 Jan 2023 15:42:25 +0800 +Subject: iio: imu: fxos8700: fix failed initialization ODR mode assignment + +From: Carlos Song + +commit eb6d8f8705bc19141bac81d8161461f9e256948a upstream. + +The absence of correct offset leads a failed initialization ODR mode +assignment. + +Select MAX ODR mode as the initialization ODR mode by field mask and +FIELD_PREP. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20230118074227.1665098-3-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -664,8 +664,10 @@ static int fxos8700_chip_init(struct fxo + return ret; + + /* Max ODR (800Hz individual or 400Hz hybrid), active mode */ +- return regmap_write(data->regmap, FXOS8700_CTRL_REG1, +- FXOS8700_CTRL_ODR_MAX | FXOS8700_ACTIVE); ++ return regmap_update_bits(data->regmap, FXOS8700_CTRL_REG1, ++ FXOS8700_CTRL_ODR_MSK | FXOS8700_ACTIVE, ++ FIELD_PREP(FXOS8700_CTRL_ODR_MSK, FXOS8700_CTRL_ODR_MAX) | ++ FXOS8700_ACTIVE); + } + + static void fxos8700_chip_uninit(void *data) diff --git a/queue-5.10/iio-imu-fxos8700-fix-imu-data-bits-returned-to-user-space.patch b/queue-5.10/iio-imu-fxos8700-fix-imu-data-bits-returned-to-user-space.patch new file mode 100644 index 00000000000..574d962ae4b --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-imu-data-bits-returned-to-user-space.patch @@ -0,0 +1,73 @@ +From a53f945879c0cb9de3a4c05a665f5157884b5208 Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Thu, 8 Dec 2022 15:19:08 +0800 +Subject: iio: imu: fxos8700: fix IMU data bits returned to user space + +From: Carlos Song + +commit a53f945879c0cb9de3a4c05a665f5157884b5208 upstream. + +ACCEL output data registers contain the X-axis, Y-axis, and Z-axis +14-bit left-justified sample data and MAGN output data registers +contain the X-axis, Y-axis, and Z-axis 16-bit sample data. The ACCEL +raw register output data should be divided by 4 before sent to +userspace. + +Apply a 2 bits signed right shift to the raw data from ACCEL output +data register but keep that from MAGN sensor as the origin. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20221208071911.2405922-5-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 28 +++++++++++++++++++++++++++- + 1 file changed, 27 insertions(+), 1 deletion(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -418,6 +418,7 @@ static int fxos8700_get_data(struct fxos + int axis, int *val) + { + u8 base, reg; ++ s16 tmp; + int ret; + enum fxos8700_sensor type = fxos8700_to_sensor(chan_type); + +@@ -432,8 +433,33 @@ static int fxos8700_get_data(struct fxos + /* Convert axis to buffer index */ + reg = axis - IIO_MOD_X; + ++ /* ++ * Convert to native endianness. The accel data and magn data ++ * are signed, so a forced type conversion is needed. ++ */ ++ tmp = be16_to_cpu(data->buf[reg]); ++ ++ /* ++ * ACCEL output data registers contain the X-axis, Y-axis, and Z-axis ++ * 14-bit left-justified sample data and MAGN output data registers ++ * contain the X-axis, Y-axis, and Z-axis 16-bit sample data. Apply ++ * a signed 2 bits right shift to the readback raw data from ACCEL ++ * output data register and keep that from MAGN sensor as the origin. ++ * Value should be extended to 32 bit. ++ */ ++ switch (chan_type) { ++ case IIO_ACCEL: ++ tmp = tmp >> 2; ++ break; ++ case IIO_MAGN: ++ /* Nothing to do */ ++ break; ++ default: ++ return -EINVAL; ++ } ++ + /* Convert to native endianness */ +- *val = sign_extend32(be16_to_cpu(data->buf[reg]), 15); ++ *val = sign_extend32(tmp, 15); + + return 0; + } diff --git a/queue-5.10/iio-imu-fxos8700-fix-incomplete-accel-and-magn-channels-readback.patch b/queue-5.10/iio-imu-fxos8700-fix-incomplete-accel-and-magn-channels-readback.patch new file mode 100644 index 00000000000..baa4b240b71 --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-incomplete-accel-and-magn-channels-readback.patch @@ -0,0 +1,38 @@ +From 37a94d86d7050665d6d01378b2c916c28e454f10 Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Thu, 8 Dec 2022 15:19:07 +0800 +Subject: iio: imu: fxos8700: fix incomplete ACCEL and MAGN channels readback + +From: Carlos Song + +commit 37a94d86d7050665d6d01378b2c916c28e454f10 upstream. + +The length of ACCEL and MAGN 3-axis channels output data is 6 byte +individually. However block only read 3 bytes data into buffer from +ACCEL or MAGN output data registers every time. It causes an incomplete +ACCEL and MAGN channels readback. + +Set correct value count for regmap_bulk_read to get 6 bytes ACCEL and +MAGN channels readback. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20221208071911.2405922-4-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -425,7 +425,7 @@ static int fxos8700_get_data(struct fxos + + /* Block read 6 bytes of device output registers to avoid data loss */ + ret = regmap_bulk_read(data->regmap, base, data->buf, +- FXOS8700_DATA_BUF_SIZE); ++ sizeof(data->buf)); + if (ret) + return ret; + diff --git a/queue-5.10/iio-imu-fxos8700-fix-incorrect-odr-mode-readback.patch b/queue-5.10/iio-imu-fxos8700-fix-incorrect-odr-mode-readback.patch new file mode 100644 index 00000000000..16a8e0c6cf1 --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-incorrect-odr-mode-readback.patch @@ -0,0 +1,71 @@ +From 78ad6864e9e012cdba7c353d044d21ffcfd5f34b Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Wed, 18 Jan 2023 15:42:24 +0800 +Subject: iio: imu: fxos8700: fix incorrect ODR mode readback + +From: Carlos Song + +commit 78ad6864e9e012cdba7c353d044d21ffcfd5f34b upstream. + +The absence of a correct offset leads an incorrect ODR mode +readback after use a hexadecimal number to mark the value from +FXOS8700_CTRL_REG1. + +Get ODR mode by field mask and FIELD_GET clearly and conveniently. +And attach other additional fix for keeping the original code logic +and a good readability. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20230118074227.1665098-2-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -10,6 +10,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -144,9 +145,9 @@ + #define FXOS8700_NVM_DATA_BNK0 0xa7 + + /* Bit definitions for FXOS8700_CTRL_REG1 */ +-#define FXOS8700_CTRL_ODR_MSK 0x38 + #define FXOS8700_CTRL_ODR_MAX 0x00 + #define FXOS8700_CTRL_ODR_MIN GENMASK(4, 3) ++#define FXOS8700_CTRL_ODR_MSK GENMASK(5, 3) + + /* Bit definitions for FXOS8700_M_CTRL_REG1 */ + #define FXOS8700_HMS_MASK GENMASK(1, 0) +@@ -508,10 +509,9 @@ static int fxos8700_set_odr(struct fxos8 + if (i >= odr_num) + return -EINVAL; + +- return regmap_update_bits(data->regmap, +- FXOS8700_CTRL_REG1, +- FXOS8700_CTRL_ODR_MSK + FXOS8700_ACTIVE, +- fxos8700_odr[i].bits << 3 | active_mode); ++ val &= ~FXOS8700_CTRL_ODR_MSK; ++ val |= FIELD_PREP(FXOS8700_CTRL_ODR_MSK, fxos8700_odr[i].bits) | FXOS8700_ACTIVE; ++ return regmap_write(data->regmap, FXOS8700_CTRL_REG1, val); + } + + static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t, +@@ -524,7 +524,7 @@ static int fxos8700_get_odr(struct fxos8 + if (ret) + return ret; + +- val &= FXOS8700_CTRL_ODR_MSK; ++ val = FIELD_GET(FXOS8700_CTRL_ODR_MSK, val); + + for (i = 0; i < odr_num; i++) + if (val == fxos8700_odr[i].bits) diff --git a/queue-5.10/iio-imu-fxos8700-fix-magn-sensor-scale-and-unit.patch b/queue-5.10/iio-imu-fxos8700-fix-magn-sensor-scale-and-unit.patch new file mode 100644 index 00000000000..094096b2e67 --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-magn-sensor-scale-and-unit.patch @@ -0,0 +1,56 @@ +From 2acd031347f645871959a799238a7caf6803aa18 Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Wed, 18 Jan 2023 15:42:27 +0800 +Subject: iio: imu: fxos8700: fix MAGN sensor scale and unit + +From: Carlos Song + +commit 2acd031347f645871959a799238a7caf6803aa18 upstream. + ++/-1200uT is a MAGN sensor full measurement range. Magnetometer scale +is the magnetic sensitivity parameter. It is referenced as 0.1uT +according to datasheet and magnetometer channel unit is Gauss in +sysfs-bus-iio documentation. Gauss and uTesla unit conversion +relationship as follows: 0.1uT = 0.001Gs. + +Set magnetometer scale and available magnetometer scale as fixed 0.001Gs. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20230118074227.1665098-5-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -351,7 +351,7 @@ static int fxos8700_set_scale(struct fxo + struct device *dev = regmap_get_device(data->regmap); + + if (t == FXOS8700_MAGN) { +- dev_err(dev, "Magnetometer scale is locked at 1200uT\n"); ++ dev_err(dev, "Magnetometer scale is locked at 0.001Gs\n"); + return -EINVAL; + } + +@@ -396,7 +396,7 @@ static int fxos8700_get_scale(struct fxo + static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale); + + if (t == FXOS8700_MAGN) { +- *uscale = 1200; /* Magnetometer is locked at 1200uT */ ++ *uscale = 1000; /* Magnetometer is locked at 0.001Gs */ + return 0; + } + +@@ -588,7 +588,7 @@ static IIO_CONST_ATTR(in_accel_sampling_ + static IIO_CONST_ATTR(in_magn_sampling_frequency_available, + "1.5625 6.25 12.5 50 100 200 400 800"); + static IIO_CONST_ATTR(in_accel_scale_available, "0.000244 0.000488 0.000976"); +-static IIO_CONST_ATTR(in_magn_scale_available, "0.000001200"); ++static IIO_CONST_ATTR(in_magn_scale_available, "0.001000"); + + static struct attribute *fxos8700_attrs[] = { + &iio_const_attr_in_accel_sampling_frequency_available.dev_attr.attr, diff --git a/queue-5.10/iio-imu-fxos8700-fix-map-label-of-channel-type-to-magn-sensor.patch b/queue-5.10/iio-imu-fxos8700-fix-map-label-of-channel-type-to-magn-sensor.patch new file mode 100644 index 00000000000..76d293c26c7 --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-map-label-of-channel-type-to-magn-sensor.patch @@ -0,0 +1,37 @@ +From 429e1e8ec696e0e7a0742904e3dc2f83b7b23dfb Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Thu, 8 Dec 2022 15:19:05 +0800 +Subject: iio: imu: fxos8700: fix map label of channel type to MAGN sensor + +From: Carlos Song + +commit 429e1e8ec696e0e7a0742904e3dc2f83b7b23dfb upstream. + +FXOS8700 is an IMU sensor with ACCEL sensor and MAGN sensor. +Sensor type is indexed by corresponding channel type in a switch. +IIO_ANGL_VEL channel type mapped to MAGN sensor has caused confusion. + +Fix the mapping label of "IIO_MAGN" channel type instead of +"IIO_ANGL_VEL" channel type to MAGN sensor. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20221208071911.2405922-2-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -320,7 +320,7 @@ static enum fxos8700_sensor fxos8700_to_ + switch (iio_type) { + case IIO_ACCEL: + return FXOS8700_ACCEL; +- case IIO_ANGL_VEL: ++ case IIO_MAGN: + return FXOS8700_MAGN; + default: + return -EINVAL; diff --git a/queue-5.10/iio-imu-fxos8700-fix-swapped-accel-and-magn-channels-readback.patch b/queue-5.10/iio-imu-fxos8700-fix-swapped-accel-and-magn-channels-readback.patch new file mode 100644 index 00000000000..c335005989a --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-fix-swapped-accel-and-magn-channels-readback.patch @@ -0,0 +1,50 @@ +From c68b44bc7d9b1469774a1c985ee71d2cbc5ebef5 Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Thu, 8 Dec 2022 15:19:06 +0800 +Subject: iio: imu: fxos8700: fix swapped ACCEL and MAGN channels readback + +From: Carlos Song + +commit c68b44bc7d9b1469774a1c985ee71d2cbc5ebef5 upstream. + +Because ACCEL and MAGN channels data register base address is +swapped the accelerometer and magnetometer channels readback is +swapped. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20221208071911.2405922-3-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -420,9 +420,22 @@ static int fxos8700_get_data(struct fxos + u8 base, reg; + s16 tmp; + int ret; +- enum fxos8700_sensor type = fxos8700_to_sensor(chan_type); + +- base = type ? FXOS8700_OUT_X_MSB : FXOS8700_M_OUT_X_MSB; ++ /* ++ * Different register base addresses varies with channel types. ++ * This bug hasn't been noticed before because using an enum is ++ * really hard to read. Use an a switch statement to take over that. ++ */ ++ switch (chan_type) { ++ case IIO_ACCEL: ++ base = FXOS8700_OUT_X_MSB; ++ break; ++ case IIO_MAGN: ++ base = FXOS8700_M_OUT_X_MSB; ++ break; ++ default: ++ return -EINVAL; ++ } + + /* Block read 6 bytes of device output registers to avoid data loss */ + ret = regmap_bulk_read(data->regmap, base, data->buf, diff --git a/queue-5.10/iio-imu-fxos8700-remove-definition-fxos8700_ctrl_odr_min.patch b/queue-5.10/iio-imu-fxos8700-remove-definition-fxos8700_ctrl_odr_min.patch new file mode 100644 index 00000000000..e65526fb921 --- /dev/null +++ b/queue-5.10/iio-imu-fxos8700-remove-definition-fxos8700_ctrl_odr_min.patch @@ -0,0 +1,33 @@ +From ff5e2cd92ffda9a25ffa2cbdb3a0cf17650172a6 Mon Sep 17 00:00:00 2001 +From: Carlos Song +Date: Wed, 18 Jan 2023 15:42:26 +0800 +Subject: iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN + +From: Carlos Song + +commit ff5e2cd92ffda9a25ffa2cbdb3a0cf17650172a6 upstream. + +FXOS8700_CTRL_ODR_MIN is not used but value is probably wrong. + +Remove it for a good readability. + +Fixes: 84e5ddd5c46e ("iio: imu: Add support for the FXOS8700 IMU") +Signed-off-by: Carlos Song +Link: https://lore.kernel.org/r/20230118074227.1665098-4-carlos.song@nxp.com +Cc: +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/imu/fxos8700_core.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/iio/imu/fxos8700_core.c ++++ b/drivers/iio/imu/fxos8700_core.c +@@ -146,7 +146,6 @@ + + /* Bit definitions for FXOS8700_CTRL_REG1 */ + #define FXOS8700_CTRL_ODR_MAX 0x00 +-#define FXOS8700_CTRL_ODR_MIN GENMASK(4, 3) + #define FXOS8700_CTRL_ODR_MSK GENMASK(5, 3) + + /* Bit definitions for FXOS8700_M_CTRL_REG1 */ diff --git a/queue-5.10/net-qrtr-free-memory-on-error-path-in-radix_tree_insert.patch b/queue-5.10/net-qrtr-free-memory-on-error-path-in-radix_tree_insert.patch new file mode 100644 index 00000000000..c65e914a261 --- /dev/null +++ b/queue-5.10/net-qrtr-free-memory-on-error-path-in-radix_tree_insert.patch @@ -0,0 +1,43 @@ +From 29de68c2b32ce58d64dea496d281e25ad0f551bd Mon Sep 17 00:00:00 2001 +From: Natalia Petrova +Date: Wed, 25 Jan 2023 16:48:31 +0300 +Subject: net: qrtr: free memory on error path in radix_tree_insert() + +From: Natalia Petrova + +commit 29de68c2b32ce58d64dea496d281e25ad0f551bd upstream. + +Function radix_tree_insert() returns errors if the node hasn't +been initialized and added to the tree. + +"kfree(node)" and return value "NULL" of node_get() help +to avoid using unclear node in other calls. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Cc: # 5.7 +Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace") +Signed-off-by: Natalia Petrova +Reviewed-by: Simon Horman +Reviewed-by: Manivannan Sadhasivam +Link: https://lore.kernel.org/r/20230125134831.8090-1-n.petrova@fintech.ru +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/qrtr/ns.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/net/qrtr/ns.c ++++ b/net/qrtr/ns.c +@@ -83,7 +83,10 @@ static struct qrtr_node *node_get(unsign + + node->id = node_id; + +- radix_tree_insert(&nodes, node_id, node); ++ if (radix_tree_insert(&nodes, node_id, node)) { ++ kfree(node); ++ return NULL; ++ } + + return node; + } diff --git a/queue-5.10/nvmem-qcom-spmi-sdam-fix-module-autoloading.patch b/queue-5.10/nvmem-qcom-spmi-sdam-fix-module-autoloading.patch new file mode 100644 index 00000000000..9bccebc5ba6 --- /dev/null +++ b/queue-5.10/nvmem-qcom-spmi-sdam-fix-module-autoloading.patch @@ -0,0 +1,33 @@ +From 1ca7fca349316231bbaa68d16f819a08d683c5a7 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Fri, 27 Jan 2023 10:40:15 +0000 +Subject: nvmem: qcom-spmi-sdam: fix module autoloading + +From: Johan Hovold + +commit 1ca7fca349316231bbaa68d16f819a08d683c5a7 upstream. + +Add the missing module device table so that the driver can be autoloaded +when built as a module. + +Fixes: 40ce9798794f ("nvmem: add QTI SDAM driver") +Cc: stable@vger.kernel.org # 5.6 +Reviewed-by: Bjorn Andersson +Signed-off-by: Johan Hovold +Signed-off-by: Srinivas Kandagatla +Link: https://lore.kernel.org/r/20230127104015.23839-11-srinivas.kandagatla@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/nvmem/qcom-spmi-sdam.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/nvmem/qcom-spmi-sdam.c ++++ b/drivers/nvmem/qcom-spmi-sdam.c +@@ -166,6 +166,7 @@ static const struct of_device_id sdam_ma + { .compatible = "qcom,spmi-sdam" }, + {}, + }; ++MODULE_DEVICE_TABLE(of, sdam_match_table); + + static struct platform_driver sdam_driver = { + .driver = { diff --git a/queue-5.10/parisc-fix-return-code-of-pdc_iodc_print.patch b/queue-5.10/parisc-fix-return-code-of-pdc_iodc_print.patch new file mode 100644 index 00000000000..c7c3a5684c1 --- /dev/null +++ b/queue-5.10/parisc-fix-return-code-of-pdc_iodc_print.patch @@ -0,0 +1,47 @@ +From 5d1335dabb3c493a3d6d5b233953b6ac7b6c1ff2 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Mon, 19 Dec 2022 20:56:36 +0100 +Subject: parisc: Fix return code of pdc_iodc_print() + +From: Helge Deller + +commit 5d1335dabb3c493a3d6d5b233953b6ac7b6c1ff2 upstream. + +There is an off-by-one if the printed string includes a new-line +char. + +Cc: stable@vger.kernel.org +Signed-off-by: Helge Deller +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/kernel/firmware.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +--- a/arch/parisc/kernel/firmware.c ++++ b/arch/parisc/kernel/firmware.c +@@ -1230,7 +1230,7 @@ static char __attribute__((aligned(64))) + */ + int pdc_iodc_print(const unsigned char *str, unsigned count) + { +- unsigned int i; ++ unsigned int i, found = 0; + unsigned long flags; + + for (i = 0; i < count;) { +@@ -1239,6 +1239,7 @@ int pdc_iodc_print(const unsigned char * + iodc_dbuf[i+0] = '\r'; + iodc_dbuf[i+1] = '\n'; + i += 2; ++ found = 1; + goto print; + default: + iodc_dbuf[i] = str[i]; +@@ -1255,7 +1256,7 @@ print: + __pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0); + spin_unlock_irqrestore(&pdc_lock, flags); + +- return i; ++ return i - found; + } + + #if !defined(BOOTLOADER) diff --git a/queue-5.10/parisc-wire-up-ptrace_getregs-ptrace_setregs-for-compat-case.patch b/queue-5.10/parisc-wire-up-ptrace_getregs-ptrace_setregs-for-compat-case.patch new file mode 100644 index 00000000000..116d3c3ccb2 --- /dev/null +++ b/queue-5.10/parisc-wire-up-ptrace_getregs-ptrace_setregs-for-compat-case.patch @@ -0,0 +1,64 @@ +From 316f1f42b5cc1d95124c1f0387c867c1ba7b6d0e Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Wed, 1 Feb 2023 16:41:54 +0100 +Subject: parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case + +From: Helge Deller + +commit 316f1f42b5cc1d95124c1f0387c867c1ba7b6d0e upstream. + +Wire up the missing ptrace requests PTRACE_GETREGS, PTRACE_SETREGS, +PTRACE_GETFPREGS and PTRACE_SETFPREGS when running 32-bit applications +on 64-bit kernels. + +Signed-off-by: Helge Deller +Cc: stable@vger.kernel.org # 4.7+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/kernel/ptrace.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +--- a/arch/parisc/kernel/ptrace.c ++++ b/arch/parisc/kernel/ptrace.c +@@ -127,6 +127,12 @@ long arch_ptrace(struct task_struct *chi + unsigned long tmp; + long ret = -EIO; + ++ unsigned long user_regs_struct_size = sizeof(struct user_regs_struct); ++#ifdef CONFIG_64BIT ++ if (is_compat_task()) ++ user_regs_struct_size /= 2; ++#endif ++ + switch (request) { + + /* Read the word at location addr in the USER area. For ptraced +@@ -182,14 +188,14 @@ long arch_ptrace(struct task_struct *chi + return copy_regset_to_user(child, + task_user_regset_view(current), + REGSET_GENERAL, +- 0, sizeof(struct user_regs_struct), ++ 0, user_regs_struct_size, + datap); + + case PTRACE_SETREGS: /* Set all gp regs in the child. */ + return copy_regset_from_user(child, + task_user_regset_view(current), + REGSET_GENERAL, +- 0, sizeof(struct user_regs_struct), ++ 0, user_regs_struct_size, + datap); + + case PTRACE_GETFPREGS: /* Get the child FPU state. */ +@@ -303,6 +309,11 @@ long compat_arch_ptrace(struct task_stru + } + } + break; ++ case PTRACE_GETREGS: ++ case PTRACE_SETREGS: ++ case PTRACE_GETFPREGS: ++ case PTRACE_SETFPREGS: ++ return arch_ptrace(child, request, addr, data); + + default: + ret = compat_ptrace_request(child, request, addr, data); diff --git a/queue-5.10/riscv-disable-generation-of-unwind-tables.patch b/queue-5.10/riscv-disable-generation-of-unwind-tables.patch new file mode 100644 index 00000000000..cf3de0cf6c1 --- /dev/null +++ b/queue-5.10/riscv-disable-generation-of-unwind-tables.patch @@ -0,0 +1,36 @@ +From 2f394c0e7d1129a35156e492bc8f445fb20f43ac Mon Sep 17 00:00:00 2001 +From: Andreas Schwab +Date: Wed, 1 Feb 2023 10:29:45 +0100 +Subject: riscv: disable generation of unwind tables + +From: Andreas Schwab + +commit 2f394c0e7d1129a35156e492bc8f445fb20f43ac upstream. + +GCC 13 will enable -fasynchronous-unwind-tables by default on riscv. In +the kernel, we don't have any use for unwind tables yet, so disable them. +More importantly, the .eh_frame section brings relocations +(R_RISC_32_PCREL, R_RISCV_SET{6,8,16}, R_RISCV_SUB{6,8,16}) into modules +that we are not prepared to handle. + +Signed-off-by: Andreas Schwab +Link: https://lore.kernel.org/r/mvmzg9xybqu.fsf@suse.de +Cc: stable@vger.kernel.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/Makefile | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/riscv/Makefile ++++ b/arch/riscv/Makefile +@@ -74,6 +74,9 @@ ifeq ($(CONFIG_PERF_EVENTS),y) + KBUILD_CFLAGS += -fno-omit-frame-pointer + endif + ++# Avoid generating .eh_frame sections. ++KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables ++ + KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) + KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) + diff --git a/queue-5.10/series b/queue-5.10/series index b26f1a1172c..65862a87829 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -49,3 +49,25 @@ input-i8042-move-__initconst-to-fix-code-styling-war.patch input-i8042-merge-quirk-tables.patch input-i8042-add-tuxedo-devices-to-i8042-quirk-tables.patch input-i8042-add-clevo-pcx0dx-to-i8042-quirk-table.patch +fbcon-check-font-dimension-limits.patch +net-qrtr-free-memory-on-error-path-in-radix_tree_insert.patch +watchdog-diag288_wdt-do-not-use-stack-buffers-for-hardware-data.patch +watchdog-diag288_wdt-fix-__diag288-inline-assembly.patch +alsa-hda-realtek-add-acer-predator-ph315-54.patch +efi-accept-version-2-of-memory-attributes-table.patch +iio-hid-fix-the-retval-in-accel_3d_capture_sample.patch +iio-adc-berlin2-adc-add-missing-of_node_put-in-error-path.patch +iio-adc-twl6030-enable-measurements-of-vusb-vbat-and-others.patch +iio-imu-fxos8700-fix-accel-measurement-range-selection.patch +iio-imu-fxos8700-fix-incomplete-accel-and-magn-channels-readback.patch +iio-imu-fxos8700-fix-imu-data-bits-returned-to-user-space.patch +iio-imu-fxos8700-fix-map-label-of-channel-type-to-magn-sensor.patch +iio-imu-fxos8700-fix-swapped-accel-and-magn-channels-readback.patch +iio-imu-fxos8700-fix-incorrect-odr-mode-readback.patch +iio-imu-fxos8700-fix-failed-initialization-odr-mode-assignment.patch +iio-imu-fxos8700-remove-definition-fxos8700_ctrl_odr_min.patch +iio-imu-fxos8700-fix-magn-sensor-scale-and-unit.patch +nvmem-qcom-spmi-sdam-fix-module-autoloading.patch +parisc-fix-return-code-of-pdc_iodc_print.patch +parisc-wire-up-ptrace_getregs-ptrace_setregs-for-compat-case.patch +riscv-disable-generation-of-unwind-tables.patch diff --git a/queue-5.10/watchdog-diag288_wdt-do-not-use-stack-buffers-for-hardware-data.patch b/queue-5.10/watchdog-diag288_wdt-do-not-use-stack-buffers-for-hardware-data.patch new file mode 100644 index 00000000000..81be471aa8b --- /dev/null +++ b/queue-5.10/watchdog-diag288_wdt-do-not-use-stack-buffers-for-hardware-data.patch @@ -0,0 +1,50 @@ +From fe8973a3ad0905cb9ba2d42db42ed51de14737df Mon Sep 17 00:00:00 2001 +From: Alexander Egorenkov +Date: Fri, 27 Jan 2023 14:52:41 +0100 +Subject: watchdog: diag288_wdt: do not use stack buffers for hardware data + +From: Alexander Egorenkov + +commit fe8973a3ad0905cb9ba2d42db42ed51de14737df upstream. + +With CONFIG_VMAP_STACK=y the stack is allocated from the vmalloc space. +Data passed to a hardware or a hypervisor interface that +requires V=R can no longer be allocated on the stack. + +Use kmalloc() to get memory for a diag288 command. + +Signed-off-by: Alexander Egorenkov +Reviewed-by: Heiko Carstens +Cc: +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman +--- + drivers/watchdog/diag288_wdt.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +--- a/drivers/watchdog/diag288_wdt.c ++++ b/drivers/watchdog/diag288_wdt.c +@@ -272,12 +272,21 @@ static int __init diag288_init(void) + char ebc_begin[] = { + 194, 197, 199, 201, 213 + }; ++ char *ebc_cmd; + + watchdog_set_nowayout(&wdt_dev, nowayout_info); + + if (MACHINE_IS_VM) { +- if (__diag288_vm(WDT_FUNC_INIT, 15, +- ebc_begin, sizeof(ebc_begin)) != 0) { ++ ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL); ++ if (!ebc_cmd) { ++ pr_err("The watchdog cannot be initialized\n"); ++ return -ENOMEM; ++ } ++ memcpy(ebc_cmd, ebc_begin, sizeof(ebc_begin)); ++ ret = __diag288_vm(WDT_FUNC_INIT, 15, ++ ebc_cmd, sizeof(ebc_begin)); ++ kfree(ebc_cmd); ++ if (ret != 0) { + pr_err("The watchdog cannot be initialized\n"); + return -EINVAL; + } diff --git a/queue-5.10/watchdog-diag288_wdt-fix-__diag288-inline-assembly.patch b/queue-5.10/watchdog-diag288_wdt-fix-__diag288-inline-assembly.patch new file mode 100644 index 00000000000..18697b5ae91 --- /dev/null +++ b/queue-5.10/watchdog-diag288_wdt-fix-__diag288-inline-assembly.patch @@ -0,0 +1,33 @@ +From 32e40f9506b9e32917eb73154f93037b443124d1 Mon Sep 17 00:00:00 2001 +From: Alexander Egorenkov +Date: Fri, 27 Jan 2023 14:52:42 +0100 +Subject: watchdog: diag288_wdt: fix __diag288() inline assembly + +From: Alexander Egorenkov + +commit 32e40f9506b9e32917eb73154f93037b443124d1 upstream. + +The DIAG 288 statement consumes an EBCDIC string the address of which is +passed in a register. Use a "memory" clobber to tell the compiler that +memory is accessed within the inline assembly. + +Signed-off-by: Alexander Egorenkov +Reviewed-by: Heiko Carstens +Cc: +Signed-off-by: Heiko Carstens +Signed-off-by: Greg Kroah-Hartman +--- + drivers/watchdog/diag288_wdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/watchdog/diag288_wdt.c ++++ b/drivers/watchdog/diag288_wdt.c +@@ -86,7 +86,7 @@ static int __diag288(unsigned int func, + "1:\n" + EX_TABLE(0b, 1b) + : "+d" (err) : "d"(__func), "d"(__timeout), +- "d"(__action), "d"(__len) : "1", "cc"); ++ "d"(__action), "d"(__len) : "1", "cc", "memory"); + return err; + } + -- 2.47.3