Commit b4e84599 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'iio-for-3.13b' of...

Merge tag 'iio-for-3.13b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Second set of new functionality for IIO in the 3.13 cycle - with bug fixes for first set.

This is a small, mainly to get a couple of compile bug related fixes into
the tree ASAP.

New device support:
1) Add ad5446 dac support to the ad5641 driver.

New functionality and cleanups:
1) Optional power supply regulators for the st pressure sensors drivers using
   the new optional regulator interface.
2) Bit of tidying up of naming in the sysfs trigger.

Bug fixes from the previous series:
1) Missing select IIO_BUFFER for ti_am335x_adc
2) Drop a bonus bracket in iio-trig-bfin-timmer
parents cb9cfd7e 10a485c5
...@@ -177,6 +177,7 @@ config TI_ADC081C ...@@ -177,6 +177,7 @@ config TI_ADC081C
config TI_AM335X_ADC config TI_AM335X_ADC
tristate "TI's AM335X ADC driver" tristate "TI's AM335X ADC driver"
depends on MFD_TI_AM335X_TSCADC depends on MFD_TI_AM335X_TSCADC
select IIO_BUFFER
select IIO_KFIFO_BUF select IIO_KFIFO_BUF
help help
Say yes here to build support for Texas Instruments ADC Say yes here to build support for Texas Instruments ADC
......
...@@ -57,7 +57,7 @@ config AD5446 ...@@ -57,7 +57,7 @@ config AD5446
Say yes here to build support for Analog Devices AD5300, AD5301, AD5310, Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453, AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5602, AD5611, AD5612, AD5512A, AD5541A, AD5542A, AD5543, AD5553, AD5601, AD5602, AD5611, AD5612,
AD5620, AD5621, AD5622, AD5640, AD5660, AD5662 DACs. AD5620, AD5621, AD5622, AD5640, AD5641, AD5660, AD5662 DACs.
To compile this driver as a module, choose M here: the To compile this driver as a module, choose M here: the
module will be called ad5446. module will be called ad5446.
......
...@@ -330,6 +330,7 @@ enum ad5446_supported_spi_device_ids { ...@@ -330,6 +330,7 @@ enum ad5446_supported_spi_device_ids {
ID_AD5601, ID_AD5601,
ID_AD5611, ID_AD5611,
ID_AD5621, ID_AD5621,
ID_AD5641,
ID_AD5620_2500, ID_AD5620_2500,
ID_AD5620_1250, ID_AD5620_1250,
ID_AD5640_2500, ID_AD5640_2500,
...@@ -392,6 +393,10 @@ static const struct ad5446_chip_info ad5446_spi_chip_info[] = { ...@@ -392,6 +393,10 @@ static const struct ad5446_chip_info ad5446_spi_chip_info[] = {
.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
.write = ad5446_write, .write = ad5446_write,
}, },
[ID_AD5641] = {
.channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
.write = ad5446_write,
},
[ID_AD5620_2500] = { [ID_AD5620_2500] = {
.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2), .channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
.int_vref_mv = 2500, .int_vref_mv = 2500,
...@@ -446,6 +451,7 @@ static const struct spi_device_id ad5446_spi_ids[] = { ...@@ -446,6 +451,7 @@ static const struct spi_device_id ad5446_spi_ids[] = {
{"ad5601", ID_AD5601}, {"ad5601", ID_AD5601},
{"ad5611", ID_AD5611}, {"ad5611", ID_AD5611},
{"ad5621", ID_AD5621}, {"ad5621", ID_AD5621},
{"ad5641", ID_AD5641},
{"ad5620-2500", ID_AD5620_2500}, /* AD5620/40/60: */ {"ad5620-2500", ID_AD5620_2500}, /* AD5620/40/60: */
{"ad5620-1250", ID_AD5620_1250}, /* part numbers may look differently */ {"ad5620-1250", ID_AD5620_1250}, /* part numbers may look differently */
{"ad5640-2500", ID_AD5640_2500}, {"ad5640-2500", ID_AD5640_2500},
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <linux/iio/sysfs.h> #include <linux/iio/sysfs.h>
#include <linux/iio/trigger.h> #include <linux/iio/trigger.h>
#include <linux/iio/buffer.h> #include <linux/iio/buffer.h>
#include <linux/regulator/consumer.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include <linux/iio/common/st_sensors.h> #include <linux/iio/common/st_sensors.h>
...@@ -313,6 +314,40 @@ static const struct iio_trigger_ops st_press_trigger_ops = { ...@@ -313,6 +314,40 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
#define ST_PRESS_TRIGGER_OPS NULL #define ST_PRESS_TRIGGER_OPS NULL
#endif #endif
static void st_press_power_enable(struct iio_dev *indio_dev)
{
struct st_sensor_data *pdata = iio_priv(indio_dev);
int err;
/* Regulators not mandatory, but if requested we should enable them. */
pdata->vdd = devm_regulator_get_optional(&indio_dev->dev, "vdd");
if (!IS_ERR(pdata->vdd)) {
err = regulator_enable(pdata->vdd);
if (err != 0)
dev_warn(&indio_dev->dev,
"Failed to enable specified Vdd supply\n");
}
pdata->vdd_io = devm_regulator_get_optional(&indio_dev->dev, "vddio");
if (!IS_ERR(pdata->vdd_io)) {
err = regulator_enable(pdata->vdd_io);
if (err != 0)
dev_warn(&indio_dev->dev,
"Failed to enable specified Vdd_IO supply\n");
}
}
static void st_press_power_disable(struct iio_dev *indio_dev)
{
struct st_sensor_data *pdata = iio_priv(indio_dev);
if (!IS_ERR(pdata->vdd))
regulator_disable(pdata->vdd);
if (!IS_ERR(pdata->vdd_io))
regulator_disable(pdata->vdd_io);
}
int st_press_common_probe(struct iio_dev *indio_dev, int st_press_common_probe(struct iio_dev *indio_dev,
struct st_sensors_platform_data *plat_data) struct st_sensors_platform_data *plat_data)
{ {
...@@ -323,6 +358,8 @@ int st_press_common_probe(struct iio_dev *indio_dev, ...@@ -323,6 +358,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &press_info; indio_dev->info = &press_info;
st_press_power_enable(indio_dev);
err = st_sensors_check_device_support(indio_dev, err = st_sensors_check_device_support(indio_dev,
ARRAY_SIZE(st_press_sensors), ARRAY_SIZE(st_press_sensors),
st_press_sensors); st_press_sensors);
...@@ -380,6 +417,8 @@ void st_press_common_remove(struct iio_dev *indio_dev) ...@@ -380,6 +417,8 @@ void st_press_common_remove(struct iio_dev *indio_dev)
{ {
struct st_sensor_data *pdata = iio_priv(indio_dev); struct st_sensor_data *pdata = iio_priv(indio_dev);
st_press_power_disable(indio_dev);
iio_device_unregister(indio_dev); iio_device_unregister(indio_dev);
if (pdata->get_irq_data_ready(indio_dev) > 0) if (pdata->get_irq_data_ready(indio_dev) > 0)
st_sensors_deallocate_trigger(indio_dev); st_sensors_deallocate_trigger(indio_dev);
......
...@@ -23,7 +23,7 @@ struct iio_sysfs_trig { ...@@ -23,7 +23,7 @@ struct iio_sysfs_trig {
}; };
static LIST_HEAD(iio_sysfs_trig_list); static LIST_HEAD(iio_sysfs_trig_list);
static DEFINE_MUTEX(iio_syfs_trig_list_mut); static DEFINE_MUTEX(iio_sysfs_trig_list_mut);
static int iio_sysfs_trigger_probe(int id); static int iio_sysfs_trigger_probe(int id);
static ssize_t iio_sysfs_trig_add(struct device *dev, static ssize_t iio_sysfs_trig_add(struct device *dev,
...@@ -135,7 +135,7 @@ static int iio_sysfs_trigger_probe(int id) ...@@ -135,7 +135,7 @@ static int iio_sysfs_trigger_probe(int id)
struct iio_sysfs_trig *t; struct iio_sysfs_trig *t;
int ret; int ret;
bool foundit = false; bool foundit = false;
mutex_lock(&iio_syfs_trig_list_mut); mutex_lock(&iio_sysfs_trig_list_mut);
list_for_each_entry(t, &iio_sysfs_trig_list, l) list_for_each_entry(t, &iio_sysfs_trig_list, l)
if (id == t->id) { if (id == t->id) {
foundit = true; foundit = true;
...@@ -169,7 +169,7 @@ static int iio_sysfs_trigger_probe(int id) ...@@ -169,7 +169,7 @@ static int iio_sysfs_trigger_probe(int id)
goto out2; goto out2;
list_add(&t->l, &iio_sysfs_trig_list); list_add(&t->l, &iio_sysfs_trig_list);
__module_get(THIS_MODULE); __module_get(THIS_MODULE);
mutex_unlock(&iio_syfs_trig_list_mut); mutex_unlock(&iio_sysfs_trig_list_mut);
return 0; return 0;
out2: out2:
...@@ -177,7 +177,7 @@ static int iio_sysfs_trigger_probe(int id) ...@@ -177,7 +177,7 @@ static int iio_sysfs_trigger_probe(int id)
free_t: free_t:
kfree(t); kfree(t);
out1: out1:
mutex_unlock(&iio_syfs_trig_list_mut); mutex_unlock(&iio_sysfs_trig_list_mut);
return ret; return ret;
} }
...@@ -185,14 +185,14 @@ static int iio_sysfs_trigger_remove(int id) ...@@ -185,14 +185,14 @@ static int iio_sysfs_trigger_remove(int id)
{ {
bool foundit = false; bool foundit = false;
struct iio_sysfs_trig *t; struct iio_sysfs_trig *t;
mutex_lock(&iio_syfs_trig_list_mut); mutex_lock(&iio_sysfs_trig_list_mut);
list_for_each_entry(t, &iio_sysfs_trig_list, l) list_for_each_entry(t, &iio_sysfs_trig_list, l)
if (id == t->id) { if (id == t->id) {
foundit = true; foundit = true;
break; break;
} }
if (!foundit) { if (!foundit) {
mutex_unlock(&iio_syfs_trig_list_mut); mutex_unlock(&iio_sysfs_trig_list_mut);
return -EINVAL; return -EINVAL;
} }
...@@ -202,7 +202,7 @@ static int iio_sysfs_trigger_remove(int id) ...@@ -202,7 +202,7 @@ static int iio_sysfs_trigger_remove(int id)
list_del(&t->l); list_del(&t->l);
kfree(t); kfree(t);
module_put(THIS_MODULE); module_put(THIS_MODULE);
mutex_unlock(&iio_syfs_trig_list_mut); mutex_unlock(&iio_sysfs_trig_list_mut);
return 0; return 0;
} }
......
...@@ -91,7 +91,7 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev, ...@@ -91,7 +91,7 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
if (ret) if (ret)
return ret; return ret;
if (val > 100000) { if (val > 100000)
return -EINVAL; return -EINVAL;
enabled = get_enabled_gptimers() & st->t->bit; enabled = get_enabled_gptimers() & st->t->bit;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/irqreturn.h> #include <linux/irqreturn.h>
#include <linux/iio/trigger.h> #include <linux/iio/trigger.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/regulator/consumer.h>
#include <linux/platform_data/st_sensors_pdata.h> #include <linux/platform_data/st_sensors_pdata.h>
...@@ -201,6 +202,8 @@ struct st_sensors { ...@@ -201,6 +202,8 @@ struct st_sensors {
* @trig: The trigger in use by the core driver. * @trig: The trigger in use by the core driver.
* @sensor: Pointer to the current sensor struct in use. * @sensor: Pointer to the current sensor struct in use.
* @current_fullscale: Maximum range of measure by the sensor. * @current_fullscale: Maximum range of measure by the sensor.
* @vdd: Pointer to sensor's Vdd power supply
* @vdd_io: Pointer to sensor's Vdd-IO power supply
* @enabled: Status of the sensor (false->off, true->on). * @enabled: Status of the sensor (false->off, true->on).
* @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
* @buffer_data: Data used by buffer part. * @buffer_data: Data used by buffer part.
...@@ -216,6 +219,8 @@ struct st_sensor_data { ...@@ -216,6 +219,8 @@ struct st_sensor_data {
struct iio_trigger *trig; struct iio_trigger *trig;
struct st_sensors *sensor; struct st_sensors *sensor;
struct st_sensor_fullscale_avl *current_fullscale; struct st_sensor_fullscale_avl *current_fullscale;
struct regulator *vdd;
struct regulator *vdd_io;
bool enabled; bool enabled;
bool multiread_bit; bool multiread_bit;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment