mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
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 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.21 (GNU/Linux) iQIcBAABAgAGBQJSSJGeAAoJEFSFNJnE9BaIY7gP/i5Ld5glnnG88dtM5g7Cs7Ws utyKeWh1QxfbtRH8MDo8GfxKAszVeckG552A/iOfm0wvqJT1JIKRdUl2rMcFvfBS V0YFMKlJlXgfVhvy4X9NgfllrlGxAniFQ115l3JnPPhnEfr4IgWOt1K5dmK0kqhF Ztt9ukmsa2VctefYP5tcRh1Pw1rYdFndgkdZ64+fYjkAideMbWxgQdh91al1prBz wXTu43djnQimvkZLRQ0tX0/WQ9zs8H3bNm7TEgOqU8bbX785B8XQv6N6OFnqXT9S IjbZHniih8eU13gtno+yBR6OO0gYw20IxXmVRUUR/F94JT4KXaByGBrMz8Z5f+o0 OilkJjOdn/jH+Dd1XHJN7Pk8Wx6PxwxeENu3qVn7p1vg27OcpY0Ft2vcdecnE11j 7bP3HYLcxGxLCW0qYs6voK2SnvZAJBrw8MB4sdUAmykdn1xJ25wccQm6iMKTvTYI +AipHI3jpfllIC6Lj1IVhksAYhd7BlMK5sVH0sgWirLbqACSweRpbXCcRlSvguGY jEX5+Rf29QfYbcIsRlk52+n47FpVVOfIDjc0ygBGLovaE+FLorWUNIJjeM3f570D l2nwWjHUvnNFtA/NnBf4NLrwHqXzBX30Httk+6eISRJiyjr4ZEBAVpRt/luiWlqY bOEBICwy1sEzF4ymIAIa =KKlS -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
b4e8459947
7 changed files with 60 additions and 9 deletions
|
@ -177,6 +177,7 @@ config TI_ADC081C
|
|||
config TI_AM335X_ADC
|
||||
tristate "TI's AM335X ADC driver"
|
||||
depends on MFD_TI_AM335X_TSCADC
|
||||
select IIO_BUFFER
|
||||
select IIO_KFIFO_BUF
|
||||
help
|
||||
Say yes here to build support for Texas Instruments ADC
|
||||
|
|
|
@ -57,7 +57,7 @@ config AD5446
|
|||
Say yes here to build support for Analog Devices AD5300, AD5301, AD5310,
|
||||
AD5311, AD5320, AD5321, AD5444, AD5446, AD5450, AD5451, AD5452, AD5453,
|
||||
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
|
||||
module will be called ad5446.
|
||||
|
|
|
@ -330,6 +330,7 @@ enum ad5446_supported_spi_device_ids {
|
|||
ID_AD5601,
|
||||
ID_AD5611,
|
||||
ID_AD5621,
|
||||
ID_AD5641,
|
||||
ID_AD5620_2500,
|
||||
ID_AD5620_1250,
|
||||
ID_AD5640_2500,
|
||||
|
@ -392,6 +393,10 @@ static const struct ad5446_chip_info ad5446_spi_chip_info[] = {
|
|||
.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
|
||||
.write = ad5446_write,
|
||||
},
|
||||
[ID_AD5641] = {
|
||||
.channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
|
||||
.write = ad5446_write,
|
||||
},
|
||||
[ID_AD5620_2500] = {
|
||||
.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
|
||||
.int_vref_mv = 2500,
|
||||
|
@ -446,6 +451,7 @@ static const struct spi_device_id ad5446_spi_ids[] = {
|
|||
{"ad5601", ID_AD5601},
|
||||
{"ad5611", ID_AD5611},
|
||||
{"ad5621", ID_AD5621},
|
||||
{"ad5641", ID_AD5641},
|
||||
{"ad5620-2500", ID_AD5620_2500}, /* AD5620/40/60: */
|
||||
{"ad5620-1250", ID_AD5620_1250}, /* part numbers may look differently */
|
||||
{"ad5640-2500", ID_AD5640_2500},
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <linux/iio/sysfs.h>
|
||||
#include <linux/iio/trigger.h>
|
||||
#include <linux/iio/buffer.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <asm/unaligned.h>
|
||||
|
||||
#include <linux/iio/common/st_sensors.h>
|
||||
|
@ -313,6 +314,40 @@ static const struct iio_trigger_ops st_press_trigger_ops = {
|
|||
#define ST_PRESS_TRIGGER_OPS NULL
|
||||
#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,
|
||||
struct st_sensors_platform_data *plat_data)
|
||||
{
|
||||
|
@ -323,6 +358,8 @@ int st_press_common_probe(struct iio_dev *indio_dev,
|
|||
indio_dev->modes = INDIO_DIRECT_MODE;
|
||||
indio_dev->info = &press_info;
|
||||
|
||||
st_press_power_enable(indio_dev);
|
||||
|
||||
err = st_sensors_check_device_support(indio_dev,
|
||||
ARRAY_SIZE(st_press_sensors),
|
||||
st_press_sensors);
|
||||
|
@ -380,6 +417,8 @@ void st_press_common_remove(struct iio_dev *indio_dev)
|
|||
{
|
||||
struct st_sensor_data *pdata = iio_priv(indio_dev);
|
||||
|
||||
st_press_power_disable(indio_dev);
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
if (pdata->get_irq_data_ready(indio_dev) > 0)
|
||||
st_sensors_deallocate_trigger(indio_dev);
|
||||
|
|
|
@ -23,7 +23,7 @@ struct iio_sysfs_trig {
|
|||
};
|
||||
|
||||
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 ssize_t iio_sysfs_trig_add(struct device *dev,
|
||||
|
@ -135,7 +135,7 @@ static int iio_sysfs_trigger_probe(int id)
|
|||
struct iio_sysfs_trig *t;
|
||||
int ret;
|
||||
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)
|
||||
if (id == t->id) {
|
||||
foundit = true;
|
||||
|
@ -169,7 +169,7 @@ static int iio_sysfs_trigger_probe(int id)
|
|||
goto out2;
|
||||
list_add(&t->l, &iio_sysfs_trig_list);
|
||||
__module_get(THIS_MODULE);
|
||||
mutex_unlock(&iio_syfs_trig_list_mut);
|
||||
mutex_unlock(&iio_sysfs_trig_list_mut);
|
||||
return 0;
|
||||
|
||||
out2:
|
||||
|
@ -177,7 +177,7 @@ static int iio_sysfs_trigger_probe(int id)
|
|||
free_t:
|
||||
kfree(t);
|
||||
out1:
|
||||
mutex_unlock(&iio_syfs_trig_list_mut);
|
||||
mutex_unlock(&iio_sysfs_trig_list_mut);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -185,14 +185,14 @@ static int iio_sysfs_trigger_remove(int id)
|
|||
{
|
||||
bool foundit = false;
|
||||
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)
|
||||
if (id == t->id) {
|
||||
foundit = true;
|
||||
break;
|
||||
}
|
||||
if (!foundit) {
|
||||
mutex_unlock(&iio_syfs_trig_list_mut);
|
||||
mutex_unlock(&iio_sysfs_trig_list_mut);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ static int iio_sysfs_trigger_remove(int id)
|
|||
list_del(&t->l);
|
||||
kfree(t);
|
||||
module_put(THIS_MODULE);
|
||||
mutex_unlock(&iio_syfs_trig_list_mut);
|
||||
mutex_unlock(&iio_sysfs_trig_list_mut);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ static ssize_t iio_bfin_tmr_frequency_store(struct device *dev,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (val > 100000) {
|
||||
if (val > 100000)
|
||||
return -EINVAL;
|
||||
|
||||
enabled = get_enabled_gptimers() & st->t->bit;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/irqreturn.h>
|
||||
#include <linux/iio/trigger.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include <linux/platform_data/st_sensors_pdata.h>
|
||||
|
||||
|
@ -201,6 +202,8 @@ struct st_sensors {
|
|||
* @trig: The trigger in use by the core driver.
|
||||
* @sensor: Pointer to the current sensor struct in use.
|
||||
* @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).
|
||||
* @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
|
||||
* @buffer_data: Data used by buffer part.
|
||||
|
@ -216,6 +219,8 @@ struct st_sensor_data {
|
|||
struct iio_trigger *trig;
|
||||
struct st_sensors *sensor;
|
||||
struct st_sensor_fullscale_avl *current_fullscale;
|
||||
struct regulator *vdd;
|
||||
struct regulator *vdd_io;
|
||||
|
||||
bool enabled;
|
||||
bool multiread_bit;
|
||||
|
|
Loading…
Reference in a new issue