Skip to content

Commit

Permalink
Merge tag 'staging-5.12-rc4' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/gregkh/staging

Pull staging and IIO driver fixes from Greg KH:
 "Some small staging and IIO driver fixes:

   - MAINTAINERS changes for the move of the staging mailing list

   - comedi driver fixes to get request_irq() to work correctly

   - counter driver fixes for reported issues with iio devices

   - tiny iio driver fixes for reported issues.

  All of these have been in linux-next with no reported problems"

* tag 'staging-5.12-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: vt665x: fix alignment constraints
  staging: comedi: cb_pcidas64: fix request_irq() warn
  staging: comedi: cb_pcidas: fix request_irq() warn
  MAINTAINERS: move the staging subsystem to lists.linux.dev
  MAINTAINERS: move some real subsystems off of the staging mailing list
  iio: gyro: mpu3050: Fix error handling in mpu3050_trigger_handler
  iio: hid-sensor-temperature: Fix issues of timestamp channel
  iio: hid-sensor-humidity: Fix alignment issue of timestamp channel
  counter: stm32-timer-cnt: fix ceiling miss-alignment with reload register
  counter: stm32-timer-cnt: fix ceiling write max value
  counter: stm32-timer-cnt: Report count function when SLAVE_MODE_DISABLED
  iio: adc: ab8500-gpadc: Fix off by 10 to 3
  iio:adc:stm32-adc: Add HAS_IOMEM dependency
  iio: adis16400: Fix an error code in adis16400_initial_setup()
  iio: adc: adi-axi-adc: add proper Kconfig dependencies
  iio: adc: ad7949: fix wrong ADC result due to incorrect bit mask
  iio: hid-sensor-prox: Fix scale not correct issue
  iio:adc:qcom-spmi-vadc: add default scale to LR_MUX2_BAT_ID channel
  • Loading branch information
Linus Torvalds committed Mar 21, 2021
2 parents 3001c35 + 2cafd46 commit 1d4345e
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 48 deletions.
7 changes: 3 additions & 4 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ M: Joel Fernandes <joel@joelfernandes.org>
M: Christian Brauner <christian@brauner.io>
M: Hridya Valsaraju <hridya@google.com>
M: Suren Baghdasaryan <surenb@google.com>
L: devel@driverdev.osuosl.org
L: linux-kernel@vger.kernel.org
S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
F: drivers/android/
Expand Down Expand Up @@ -8116,7 +8116,6 @@ F: drivers/crypto/hisilicon/sec2/sec_main.c

HISILICON STAGING DRIVERS FOR HIKEY 960/970
M: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
L: devel@driverdev.osuosl.org
S: Maintained
F: drivers/staging/hikey9xx/

Expand Down Expand Up @@ -17040,7 +17039,7 @@ F: drivers/staging/vt665?/

STAGING SUBSYSTEM
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
L: devel@driverdev.osuosl.org
L: linux-staging@lists.linux.dev
S: Supported
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
F: drivers/staging/
Expand Down Expand Up @@ -19135,7 +19134,7 @@ VME SUBSYSTEM
M: Martyn Welch <martyn@welchs.me.uk>
M: Manohar Vanga <manohar.vanga@gmail.com>
M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
L: devel@driverdev.osuosl.org
L: linux-kernel@vger.kernel.org
S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
F: Documentation/driver-api/vme.rst
Expand Down
55 changes: 33 additions & 22 deletions drivers/counter/stm32-timer-cnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ struct stm32_timer_cnt {
struct counter_device counter;
struct regmap *regmap;
struct clk *clk;
u32 ceiling;
u32 max_arr;
bool enabled;
struct stm32_timer_regs bak;
};
Expand All @@ -44,13 +44,14 @@ struct stm32_timer_cnt {
* @STM32_COUNT_ENCODER_MODE_3: counts on both TI1FP1 and TI2FP2 edges
*/
enum stm32_count_function {
STM32_COUNT_SLAVE_MODE_DISABLED = -1,
STM32_COUNT_SLAVE_MODE_DISABLED,
STM32_COUNT_ENCODER_MODE_1,
STM32_COUNT_ENCODER_MODE_2,
STM32_COUNT_ENCODER_MODE_3,
};

static enum counter_count_function stm32_count_functions[] = {
[STM32_COUNT_SLAVE_MODE_DISABLED] = COUNTER_COUNT_FUNCTION_INCREASE,
[STM32_COUNT_ENCODER_MODE_1] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_A,
[STM32_COUNT_ENCODER_MODE_2] = COUNTER_COUNT_FUNCTION_QUADRATURE_X2_B,
[STM32_COUNT_ENCODER_MODE_3] = COUNTER_COUNT_FUNCTION_QUADRATURE_X4,
Expand All @@ -73,8 +74,10 @@ static int stm32_count_write(struct counter_device *counter,
const unsigned long val)
{
struct stm32_timer_cnt *const priv = counter->priv;
u32 ceiling;

if (val > priv->ceiling)
regmap_read(priv->regmap, TIM_ARR, &ceiling);
if (val > ceiling)
return -EINVAL;

return regmap_write(priv->regmap, TIM_CNT, val);
Expand All @@ -90,6 +93,9 @@ static int stm32_count_function_get(struct counter_device *counter,
regmap_read(priv->regmap, TIM_SMCR, &smcr);

switch (smcr & TIM_SMCR_SMS) {
case 0:
*function = STM32_COUNT_SLAVE_MODE_DISABLED;
return 0;
case 1:
*function = STM32_COUNT_ENCODER_MODE_1;
return 0;
Expand All @@ -99,9 +105,9 @@ static int stm32_count_function_get(struct counter_device *counter,
case 3:
*function = STM32_COUNT_ENCODER_MODE_3;
return 0;
default:
return -EINVAL;
}

return -EINVAL;
}

static int stm32_count_function_set(struct counter_device *counter,
Expand All @@ -112,6 +118,9 @@ static int stm32_count_function_set(struct counter_device *counter,
u32 cr1, sms;

switch (function) {
case STM32_COUNT_SLAVE_MODE_DISABLED:
sms = 0;
break;
case STM32_COUNT_ENCODER_MODE_1:
sms = 1;
break;
Expand All @@ -122,19 +131,14 @@ static int stm32_count_function_set(struct counter_device *counter,
sms = 3;
break;
default:
sms = 0;
break;
return -EINVAL;
}

/* Store enable status */
regmap_read(priv->regmap, TIM_CR1, &cr1);

regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_CEN, 0);

/* TIMx_ARR register shouldn't be buffered (ARPE=0) */
regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
regmap_write(priv->regmap, TIM_ARR, priv->ceiling);

regmap_update_bits(priv->regmap, TIM_SMCR, TIM_SMCR_SMS, sms);

/* Make sure that registers are updated */
Expand Down Expand Up @@ -185,11 +189,13 @@ static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
if (ret)
return ret;

if (ceiling > priv->max_arr)
return -ERANGE;

/* TIMx_ARR register shouldn't be buffered (ARPE=0) */
regmap_update_bits(priv->regmap, TIM_CR1, TIM_CR1_ARPE, 0);
regmap_write(priv->regmap, TIM_ARR, ceiling);

priv->ceiling = ceiling;
return len;
}

Expand Down Expand Up @@ -274,31 +280,36 @@ static int stm32_action_get(struct counter_device *counter,
size_t function;
int err;

/* Default action mode (e.g. STM32_COUNT_SLAVE_MODE_DISABLED) */
*action = STM32_SYNAPSE_ACTION_NONE;

err = stm32_count_function_get(counter, count, &function);
if (err)
return 0;
return err;

switch (function) {
case STM32_COUNT_SLAVE_MODE_DISABLED:
/* counts on internal clock when CEN=1 */
*action = STM32_SYNAPSE_ACTION_NONE;
return 0;
case STM32_COUNT_ENCODER_MODE_1:
/* counts up/down on TI1FP1 edge depending on TI2FP2 level */
if (synapse->signal->id == count->synapses[0].signal->id)
*action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
break;
else
*action = STM32_SYNAPSE_ACTION_NONE;
return 0;
case STM32_COUNT_ENCODER_MODE_2:
/* counts up/down on TI2FP2 edge depending on TI1FP1 level */
if (synapse->signal->id == count->synapses[1].signal->id)
*action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
break;
else
*action = STM32_SYNAPSE_ACTION_NONE;
return 0;
case STM32_COUNT_ENCODER_MODE_3:
/* counts up/down on both TI1FP1 and TI2FP2 edges */
*action = STM32_SYNAPSE_ACTION_BOTH_EDGES;
break;
return 0;
default:
return -EINVAL;
}

return 0;
}

static const struct counter_ops stm32_timer_cnt_ops = {
Expand Down Expand Up @@ -359,7 +370,7 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev)

priv->regmap = ddata->regmap;
priv->clk = ddata->clk;
priv->ceiling = ddata->max_arr;
priv->max_arr = ddata->max_arr;

priv->counter.name = dev_name(dev);
priv->counter.parent = dev;
Expand Down
3 changes: 3 additions & 0 deletions drivers/iio/adc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ config ADI_AXI_ADC
select IIO_BUFFER
select IIO_BUFFER_HW_CONSUMER
select IIO_BUFFER_DMAENGINE
depends on HAS_IOMEM
depends on OF
help
Say yes here to build support for Analog Devices Generic
AXI ADC IP core. The IP core is used for interfacing with
Expand Down Expand Up @@ -923,6 +925,7 @@ config STM32_ADC_CORE
depends on ARCH_STM32 || COMPILE_TEST
depends on OF
depends on REGULATOR
depends on HAS_IOMEM
select IIO_BUFFER
select MFD_STM32_TIMERS
select IIO_STM32_TIMER_TRIGGER
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/ab8500-gpadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ static int ab8500_gpadc_read_raw(struct iio_dev *indio_dev,
return processed;

/* Return millivolt or milliamps or millicentigrades */
*val = processed * 1000;
*val = processed;
return IIO_VAL_INT;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/ad7949.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static int ad7949_spi_read_channel(struct ad7949_adc_chip *ad7949_adc, int *val,
int ret;
int i;
int bits_per_word = ad7949_adc->resolution;
int mask = GENMASK(ad7949_adc->resolution, 0);
int mask = GENMASK(ad7949_adc->resolution - 1, 0);
struct spi_message msg;
struct spi_transfer tx[] = {
{
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/adc/qcom-spmi-vadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static const struct vadc_channels vadc_chans[] = {
VADC_CHAN_NO_SCALE(P_MUX16_1_3, 1)

VADC_CHAN_NO_SCALE(LR_MUX1_BAT_THERM, 0)
VADC_CHAN_NO_SCALE(LR_MUX2_BAT_ID, 0)
VADC_CHAN_VOLT(LR_MUX2_BAT_ID, 0, SCALE_DEFAULT)
VADC_CHAN_NO_SCALE(LR_MUX3_XO_THERM, 0)
VADC_CHAN_NO_SCALE(LR_MUX4_AMUX_THM1, 0)
VADC_CHAN_NO_SCALE(LR_MUX5_AMUX_THM2, 0)
Expand Down
2 changes: 2 additions & 0 deletions drivers/iio/gyro/mpu3050-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,8 @@ static irqreturn_t mpu3050_trigger_handler(int irq, void *p)
MPU3050_FIFO_R,
&fifo_values[offset],
toread);
if (ret)
goto out_trigger_unlock;

dev_dbg(mpu3050->dev,
"%04x %04x %04x %04x %04x\n",
Expand Down
12 changes: 7 additions & 5 deletions drivers/iio/humidity/hid-sensor-humidity.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
struct hid_humidity_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info humidity_attr;
s32 humidity_data;
struct {
s32 humidity_data;
u64 timestamp __aligned(8);
} scan;
int scale_pre_decml;
int scale_post_decml;
int scale_precision;
Expand Down Expand Up @@ -125,9 +128,8 @@ static int humidity_proc_event(struct hid_sensor_hub_device *hsdev,
struct hid_humidity_state *humid_st = iio_priv(indio_dev);

if (atomic_read(&humid_st->common_attributes.data_ready))
iio_push_to_buffers_with_timestamp(indio_dev,
&humid_st->humidity_data,
iio_get_time_ns(indio_dev));
iio_push_to_buffers_with_timestamp(indio_dev, &humid_st->scan,
iio_get_time_ns(indio_dev));

return 0;
}
Expand All @@ -142,7 +144,7 @@ static int humidity_capture_sample(struct hid_sensor_hub_device *hsdev,

switch (usage_id) {
case HID_USAGE_SENSOR_ATMOSPHERIC_HUMIDITY:
humid_st->humidity_data = *(s32 *)raw_data;
humid_st->scan.humidity_data = *(s32 *)raw_data;

return 0;
default:
Expand Down
3 changes: 1 addition & 2 deletions drivers/iio/imu/adis16400.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,7 @@ static int adis16400_initial_setup(struct iio_dev *indio_dev)
if (ret)
goto err_ret;

ret = sscanf(indio_dev->name, "adis%u\n", &device_id);
if (ret != 1) {
if (sscanf(indio_dev->name, "adis%u\n", &device_id) != 1) {
ret = -EINVAL;
goto err_ret;
}
Expand Down
13 changes: 11 additions & 2 deletions drivers/iio/light/hid-sensor-prox.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ struct prox_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info prox_attr;
u32 human_presence;
int scale_pre_decml;
int scale_post_decml;
int scale_precision;
};

/* Channel definitions */
Expand Down Expand Up @@ -93,8 +96,9 @@ static int prox_read_raw(struct iio_dev *indio_dev,
ret_type = IIO_VAL_INT;
break;
case IIO_CHAN_INFO_SCALE:
*val = prox_state->prox_attr.units;
ret_type = IIO_VAL_INT;
*val = prox_state->scale_pre_decml;
*val2 = prox_state->scale_post_decml;
ret_type = prox_state->scale_precision;
break;
case IIO_CHAN_INFO_OFFSET:
*val = hid_sensor_convert_exponent(
Expand Down Expand Up @@ -234,6 +238,11 @@ static int prox_parse_report(struct platform_device *pdev,
HID_USAGE_SENSOR_HUMAN_PRESENCE,
&st->common_attributes.sensitivity);

st->scale_precision = hid_sensor_format_scale(
hsdev->usage,
&st->prox_attr,
&st->scale_pre_decml, &st->scale_post_decml);

return ret;
}

Expand Down
14 changes: 8 additions & 6 deletions drivers/iio/temperature/hid-sensor-temperature.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
struct temperature_state {
struct hid_sensor_common common_attributes;
struct hid_sensor_hub_attribute_info temperature_attr;
s32 temperature_data;
struct {
s32 temperature_data;
u64 timestamp __aligned(8);
} scan;
int scale_pre_decml;
int scale_post_decml;
int scale_precision;
Expand All @@ -32,7 +35,7 @@ static const struct iio_chan_spec temperature_channels[] = {
BIT(IIO_CHAN_INFO_SAMP_FREQ) |
BIT(IIO_CHAN_INFO_HYSTERESIS),
},
IIO_CHAN_SOFT_TIMESTAMP(3),
IIO_CHAN_SOFT_TIMESTAMP(1),
};

/* Adjust channel real bits based on report descriptor */
Expand Down Expand Up @@ -123,9 +126,8 @@ static int temperature_proc_event(struct hid_sensor_hub_device *hsdev,
struct temperature_state *temp_st = iio_priv(indio_dev);

if (atomic_read(&temp_st->common_attributes.data_ready))
iio_push_to_buffers_with_timestamp(indio_dev,
&temp_st->temperature_data,
iio_get_time_ns(indio_dev));
iio_push_to_buffers_with_timestamp(indio_dev, &temp_st->scan,
iio_get_time_ns(indio_dev));

return 0;
}
Expand All @@ -140,7 +142,7 @@ static int temperature_capture_sample(struct hid_sensor_hub_device *hsdev,

switch (usage_id) {
case HID_USAGE_SENSOR_DATA_ENVIRONMENTAL_TEMPERATURE:
temp_st->temperature_data = *(s32 *)raw_data;
temp_st->scan.temperature_data = *(s32 *)raw_data;
return 0;
default:
return -EINVAL;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/cb_pcidas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
devpriv->amcc + AMCC_OP_REG_INTCSR);

ret = request_irq(pcidev->irq, cb_pcidas_interrupt, IRQF_SHARED,
dev->board_name, dev);
"cb_pcidas", dev);
if (ret) {
dev_dbg(dev->class_dev, "unable to allocate irq %d\n",
pcidev->irq);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/comedi/drivers/cb_pcidas64.c
Original file line number Diff line number Diff line change
Expand Up @@ -4035,7 +4035,7 @@ static int auto_attach(struct comedi_device *dev,
init_stc_registers(dev);

retval = request_irq(pcidev->irq, handle_interrupt, IRQF_SHARED,
dev->board_name, dev);
"cb_pcidas64", dev);
if (retval) {
dev_dbg(dev->class_dev, "unable to allocate irq %u\n",
pcidev->irq);
Expand Down
Loading

0 comments on commit 1d4345e

Please sign in to comment.