FAILED: patch "[PATCH] iio: light: rohm-bu27034: Fix infinite delay on error" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 8065a6c02f629187131f3136bedb26f9080e3cca
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026100659-encircle-snout-9f76@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 8065a6c02f629187131f3136bedb26f9080e3cca Mon Sep 17 00:00:00 2001
From: Matti Vaittinen <[email protected]>
Date: Wed, 2 Sep 2026 11:48:46 +0300
Subject: [PATCH] iio: light: rohm-bu27034: Fix infinite delay on error
When reading an integration-time fails, the code will use error code to compute the sleep time.
Fix this by using the smallest integration time as a default if reading fails.
drivers/iio/light/rohm-bu27034.c +36 -24
@@ -137,6 +137,7 @@ static const struct iio_gain_sel_pair bu27034_gains[] = {#define BU27034_MEAS_MODE_200MS 2#define BU27034_MEAS_MODE_400MS 4 +#define BU27034_INT_TIME_US_MIN (55 * USEC_PER_MSEC)static const struct iio_itime_sel_mul bu27034_itimes[] = {GAIN_SCALE_ITIME_US (400000 ,BU27034_MEAS_MODE_400MS ,8 ),GAIN_SCALE_ITIME_US (200000 ,BU27034_MEAS_MODE_200MS ,4 ),
@@ -296,7 +297,7 @@ static int bu27034_get_gain(struct bu27034_data *data, int chan, int *gain)return 0 ; } -static int bu27034_get_int_time (struct bu27034_data *data) +static int bu27034_get_int_time (struct bu27034_data *data,int *itime) {int ret, sel;
@@ -304,24 +305,30 @@ static int bu27034_get_int_time(struct bu27034_data *data)if (ret)return ret; -return iio_gts_find_int_time_by_sel (&data->gts, - sel &BU27034_MASK_MEAS_MODE ); + ret =iio_gts_find_int_time_by_sel (&data->gts, + sel &BU27034_MASK_MEAS_MODE ); +if (ret <0 ) +return ret; + + *itime = ret; + +return 0 ; }static int _bu27034_get_scale (struct bu27034_data *data,int channel,int *val,int *val2) { -int gain, ret; +int gain, itime, ret; ret =bu27034_get_gain (data, channel, &gain);if (ret)return ret; - ret =bu27034_get_int_time (data); -if (ret <0 ) + ret =bu27034_get_int_time (data, &itime); +if (ret)return ret; -return iio_gts_get_scale (&data->gts, gain, ret, val, val2); +return iio_gts_get_scale (&data->gts, gain, itime, val, val2); } static int bu27034_get_scale(struct bu27034_data *data, int channel, int *val,
@@ -397,12 +404,10 @@ static int bu27034_try_set_int_time(struct bu27034_data *data, int time_us)int ret, int_time_old, i;guard (mutex)(&data->mutex); - ret =bu27034_get_int_time (data); -if (ret <0 ) + ret =bu27034_get_int_time (data, &int_time_old); +if (ret)return ret; - int_time_old = ret; -if (!iio_gts_valid_time (&data->gts, time_us)) {dev_err (data->dev,"Unsupported integration time %u\n" , time_us);
@@ -841,7 +846,7 @@ static int bu27034_meas_set(struct bu27034_data *data, bool en)static int bu27034_get_single_result (struct bu27034_data *data,int chan,int *val) { -int ret; +int ret, itime;if (chan <BU27034_CHAN_DATA0 || chan >BU27034_CHAN_DATA1 )return -EINVAL ;
@@ -850,11 +855,11 @@ static int bu27034_get_single_result(struct bu27034_data *data, int chan,if (ret)return ret; - ret =bu27034_get_int_time (data); -if (ret <0 ) + ret =bu27034_get_int_time (data, &itime); +if (ret)return ret; -msleep (ret /1000 ); +msleep (itime /1000 );return bu27034_read_result (data, chan, val); }
@@ -904,12 +909,10 @@ static int bu27034_calc_mlux(struct bu27034_data *data, __le16 *res, int *val)if (ret)return ret; - ret =bu27034_get_int_time (data); -if (ret <0 ) + ret =bu27034_get_int_time (data, &meastime); +if (ret)return ret; - meastime = ret; - d1_d0_ratio_scaled = (unsigned int )ch1 * (unsigned int )gain0 *100 ; helper64 = (u64 )ch1 * (u64 )gain0 *100LLU ;
@@ -970,9 +973,9 @@ static int bu27034_read_raw(struct iio_dev *idev,switch (mask) {case IIO_CHAN_INFO_INT_TIME : *val =0 ; - *val2 =bu27034_get_int_time (data); -if (*val2 <0 ) -return *val2; + ret =bu27034_get_int_time (data, val2); +if (ret) +return ret;return IIO_VAL_INT_PLUS_MICRO ;
@@ -1157,11 +1160,20 @@ static int bu27034_buffer_thread(void *arg) {struct iio_dev *idev = arg;struct bu27034_data *data; -int wait_ms; +int wait_ms, ret; data =iio_priv (idev); - wait_ms =bu27034_get_int_time (data); +/* +* If reading the integration time fails, default to the minimum so we +* don't lose samples. This may waste CPU cycles, but as a hardening +* against theoretical, once-in-a-blue-moon error, this should be Ok. +*/ + wait_ms =BU27034_INT_TIME_US_MIN ; + ret =bu27034_get_int_time (data, &wait_ms); +if (ret) +dev_warn (data->dev,"Failed to get integration time\n" ); + wait_ms /=1000 ; wait_ms -=BU27034_MEAS_WAIT_PREMATURE_MS ;
Matti Vaittinen
maintainerHi dee Ho,
Quoted 5 lines · On 06/10/2026 10:47, [email protected] wrote:
The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
Ouch. I took a look at this, and I've screwed it up. I wrote and upstreamed the first version of this driver for a hardware that was later modified (in a non backwards compatible way). Because the original hardware was never mass-produced, I decided to just fix the driver to work with the new revision of the hardware - but I never added the fixes-tag.
I never realized is that the version of the driver that does not work with the new, mass produced hardware, went into stable (6.6). As a result of my bad decisions, the 6.6 still carries the driver for early hardware revision, and does not work with the sensor that is really produced.
I see two options to improve. First is to drop the whole driver from the 6.6 stable. It shouldn't break users because the driver does not work with the released hardware.
Second option is to backport all the patches which bring the support for released revision of the hardware + the fixes.
I am not sure which makes more sense. The 6.6 EOL is approaching, and I kind of hope it is no longer picked as a base for new projects using the sensor.
I can proceed with either of the options (send a patch dropping the driver from 6.6 stable, or backport all fixes to make it to work with the 6.6 stable) - do you think one of the options is better than the other?
Yours,
-- Matti
Signature · 5 lines
Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~
Greg KH
maintainerQuoted 24 lines · Matti Vaittinen
Hi dee Ho,
Quoted 5 lines · On 06/10/2026 10:47, [email protected] wrote:
The patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.Ouch. I took a look at this, and I've screwed it up. I wrote and upstreamed the first version of this driver for a hardware that was later modified (in a non backwards compatible way). Because the original hardware was never mass-produced, I decided to just fix the driver to work with the new revision of the hardware - but I never added the fixes-tag.
I never realized is that the version of the driver that does not work with the new, mass produced hardware, went into stable (6.6). As a result of my bad decisions, the 6.6 still carries the driver for early hardware revision, and does not work with the sensor that is really produced.
I see two options to improve. First is to drop the whole driver from the 6.6 stable. It shouldn't break users because the driver does not work with the released hardware.
Quoted 5 lines
Second option is to backport all the patches which bring the support for released revision of the hardware + the fixes.
I am not sure which makes more sense. The 6.6 EOL is approaching, and I kind of hope it is no longer picked as a base for new projects using the sensor.
The 6.6 EOL is still a ways away, let's just delete the driver entirely if you feel it's better that way. Deleting code is always good :)
thanks,
greg k-h
Matti Vaittinen
maintainerQuoted 9 lines · Greg KH
Quoted 8 lines · Matti Vaittinen
Hi dee Ho,
On 06/10/2026 10:47, [email protected] wrote:
I see two options to improve. First is to drop the whole driver from the 6.6 stable. It shouldn't break users because the driver does not work with the released hardware.
Quoted 8 lines
Quoted 5 lines
Second option is to backport all the patches which bring the support for released revision of the hardware + the fixes.
I am not sure which makes more sense. The 6.6 EOL is approaching, and I kind of hope it is no longer picked as a base for new projects using the sensor.
The 6.6 EOL is still a ways away, let's just delete the driver entirely if you feel it's better that way. Deleting code is always good :)
Deleting the broken version from 6.6 (while still keeping the working one in more recent releases) is definitely better than having a broken one there. I'll send a deletion patch for 6.6-stable next week when I'm back from Prague.
Thanks for the guidance!
Yours,
-- Matti
Signature · 5 lines
Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~
PATCH 1/1 iio: light: Drop ROHM BU27034
In reply to [email protected]From: Matti Vaittinen <[email protected]>
The ROHM BU27034 hardware gained major changes during the development. The driver which existed when Linux v6.6 was created, was written to work with the early development version of the sensor. This initial hardware revision was never released to wider audience.
When new revision of the hardware was later released, the Linux v6.6 driver was not compatible with it (although later Linux verisons have gotten a re-written driver which supports the produced and released sensor). Backporting the support for new sensor is somewhat risky, and since v6.6 EOL is expected to be in an year or so, it might be safer option to just drop the broken driver from v6.6 stable.
If you really need support for the BU27034ANUC on Linux v6.6, you should be able to do the backporting from never kernels. In any case, the driver that was included in v6.6 is NOT working so it is better to be dropped.
Drop driver which is not working with released hardware.
--- drivers/iio/light/Kconfig | 14 - drivers/iio/light/Makefile | 1 - drivers/iio/light/rohm-bu27034.c | 1528 ------------------------------ 3 files changed, 1543 deletions(-) delete mode 100644 drivers/iio/light/rohm-bu27034.c
drivers/iio/light/Kconfig +0 -14
@@ -305,20 +305,6 @@ config ROHM_BU27008 Typical application is adjusting LCD backlight of TVs, mobile phones and tablet PCs. -config ROHM_BU27034 - tristate "ROHM BU27034 ambient light sensor" - depends on I2C - select REGMAP_I2C - select IIO_GTS_HELPER - select IIO_BUFFER - select IIO_KFIFO_BUF - help - Enable support for the ROHM BU27034 ambient light sensor. ROHM BU27034 - is an ambient light sesnor with 3 channels and 3 photo diodes capable - of detecting a very wide range of illuminance. - Typical application is adjusting LCD and backlight power of TVs and - mobile phones. - config RPR0521 tristate "ROHM RPR0521 ALS and proximity sensor driver" depends on I2C
drivers/iio/light/Makefile +0 -1
@@ -40,7 +40,6 @@ obj-$(CONFIG_OPT3001) += opt3001.o obj-$(CONFIG_OPT4001) += opt4001.o obj-$(CONFIG_PA12203001) += pa12203001.o obj-$(CONFIG_ROHM_BU27008) += rohm-bu27008.o -obj-$(CONFIG_ROHM_BU27034) += rohm-bu27034.o obj-$(CONFIG_RPR0521) += rpr0521.o obj-$(CONFIG_SI1133) += si1133.o obj-$(CONFIG_SI1145) += si1145.o
drivers/iio/light/rohm-bu27034.c deleted +0 -1528
1,528 lines not on this page · raw message
Signature · 1 line
2.55.0
Re: [PATCH 6.6.y] iio: light: Drop ROHM BU27034
Quoted 4 lines
If you really need support for the BU27034ANUC on Linux v6.6, you should be able to do the backporting from never kernels. In any case, the driver that was included in v6.6 is NOT working so it is better to be dropped.
Queued for 6.6, thanks.
Signature · 2 lines
Thanks, Sasha