Loading drivers/iio/adc/max1363.c +23 −9 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ struct max1363_chip_info { * @current_mode: the scan mode of this chip * @requestedmask: a valid requested set of channels * @reg: supply regulator * @lock lock to ensure state is consistent * @monitor_on: whether monitor mode is enabled * @monitor_speed: parameter corresponding to device monitor speed setting * @mask_high: bitmask for enabled high thresholds Loading @@ -169,6 +170,7 @@ struct max1363_state { const struct max1363_mode *current_mode; u32 requestedmask; struct regulator *reg; struct mutex lock; /* Using monitor modes and buffer at the same time is currently not supported */ Loading Loading @@ -364,7 +366,11 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, struct max1363_state *st = iio_priv(indio_dev); struct i2c_client *client = st->client; mutex_lock(&indio_dev->mlock); ret = iio_device_claim_direct_mode(indio_dev); if (ret) return ret; mutex_lock(&st->lock); /* * If monitor mode is enabled, the method for reading a single * channel will have to be rather different and has not yet Loading @@ -372,7 +378,7 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, * * Also, cannot read directly if buffered capture enabled. */ if (st->monitor_on || iio_buffer_enabled(indio_dev)) { if (st->monitor_on) { ret = -EBUSY; goto error_ret; } Loading Loading @@ -404,8 +410,10 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, data = rxbuf[0]; } *val = data; error_ret: mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); return ret; } Loading Loading @@ -705,9 +713,9 @@ static ssize_t max1363_monitor_store_freq(struct device *dev, if (!found) return -EINVAL; mutex_lock(&indio_dev->mlock); mutex_lock(&st->lock); st->monitor_speed = i; mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); return 0; } Loading Loading @@ -810,12 +818,12 @@ static int max1363_read_event_config(struct iio_dev *indio_dev, int val; int number = chan->channel; mutex_lock(&indio_dev->mlock); mutex_lock(&st->lock); if (dir == IIO_EV_DIR_FALLING) val = (1 << number) & st->mask_low; else val = (1 << number) & st->mask_high; mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); return val; } Loading Loading @@ -962,7 +970,11 @@ static int max1363_write_event_config(struct iio_dev *indio_dev, u16 unifiedmask; int number = chan->channel; mutex_lock(&indio_dev->mlock); ret = iio_device_claim_direct_mode(indio_dev); if (ret) return ret; mutex_lock(&st->lock); unifiedmask = st->mask_low | st->mask_high; if (dir == IIO_EV_DIR_FALLING) { Loading @@ -989,7 +1001,8 @@ static int max1363_write_event_config(struct iio_dev *indio_dev, max1363_monitor_mode_update(st, !!(st->mask_high | st->mask_low)); error_ret: mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); return ret; } Loading Loading @@ -1587,6 +1600,7 @@ static int max1363_probe(struct i2c_client *client, st = iio_priv(indio_dev); mutex_init(&st->lock); st->reg = devm_regulator_get(&client->dev, "vcc"); if (IS_ERR(st->reg)) { ret = PTR_ERR(st->reg); Loading Loading
drivers/iio/adc/max1363.c +23 −9 Original line number Diff line number Diff line Loading @@ -150,6 +150,7 @@ struct max1363_chip_info { * @current_mode: the scan mode of this chip * @requestedmask: a valid requested set of channels * @reg: supply regulator * @lock lock to ensure state is consistent * @monitor_on: whether monitor mode is enabled * @monitor_speed: parameter corresponding to device monitor speed setting * @mask_high: bitmask for enabled high thresholds Loading @@ -169,6 +170,7 @@ struct max1363_state { const struct max1363_mode *current_mode; u32 requestedmask; struct regulator *reg; struct mutex lock; /* Using monitor modes and buffer at the same time is currently not supported */ Loading Loading @@ -364,7 +366,11 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, struct max1363_state *st = iio_priv(indio_dev); struct i2c_client *client = st->client; mutex_lock(&indio_dev->mlock); ret = iio_device_claim_direct_mode(indio_dev); if (ret) return ret; mutex_lock(&st->lock); /* * If monitor mode is enabled, the method for reading a single * channel will have to be rather different and has not yet Loading @@ -372,7 +378,7 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, * * Also, cannot read directly if buffered capture enabled. */ if (st->monitor_on || iio_buffer_enabled(indio_dev)) { if (st->monitor_on) { ret = -EBUSY; goto error_ret; } Loading Loading @@ -404,8 +410,10 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, data = rxbuf[0]; } *val = data; error_ret: mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); return ret; } Loading Loading @@ -705,9 +713,9 @@ static ssize_t max1363_monitor_store_freq(struct device *dev, if (!found) return -EINVAL; mutex_lock(&indio_dev->mlock); mutex_lock(&st->lock); st->monitor_speed = i; mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); return 0; } Loading Loading @@ -810,12 +818,12 @@ static int max1363_read_event_config(struct iio_dev *indio_dev, int val; int number = chan->channel; mutex_lock(&indio_dev->mlock); mutex_lock(&st->lock); if (dir == IIO_EV_DIR_FALLING) val = (1 << number) & st->mask_low; else val = (1 << number) & st->mask_high; mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); return val; } Loading Loading @@ -962,7 +970,11 @@ static int max1363_write_event_config(struct iio_dev *indio_dev, u16 unifiedmask; int number = chan->channel; mutex_lock(&indio_dev->mlock); ret = iio_device_claim_direct_mode(indio_dev); if (ret) return ret; mutex_lock(&st->lock); unifiedmask = st->mask_low | st->mask_high; if (dir == IIO_EV_DIR_FALLING) { Loading @@ -989,7 +1001,8 @@ static int max1363_write_event_config(struct iio_dev *indio_dev, max1363_monitor_mode_update(st, !!(st->mask_high | st->mask_low)); error_ret: mutex_unlock(&indio_dev->mlock); mutex_unlock(&st->lock); iio_device_release_direct_mode(indio_dev); return ret; } Loading Loading @@ -1587,6 +1600,7 @@ static int max1363_probe(struct i2c_client *client, st = iio_priv(indio_dev); mutex_init(&st->lock); st->reg = devm_regulator_get(&client->dev, "vcc"); if (IS_ERR(st->reg)) { ret = PTR_ERR(st->reg); Loading