Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit aa444bd2 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'iio-fixes-for-4.14b' of...

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

Jonathan writes:

Second set of IIO fixes for the 4.14 cycle.

* ade7759
  - Fix a signed extension bug.
* as3935
  - The default noise and watch dog settings were such that the device
    was unusuable in most applications.  Add device tree parameters to
    allow it to be configured to something that will actually work.
* at91-sama5d2 adc
  - Fix handling of legacy device trees that don't provide the new
    trigger edge property.
* dln2-adc
  - Fix a missing Kconfig dependency on IIO_TRIGGERED_BUFFER.
* dummy driver
  - Add a missing break so that writing in_voltage0_thresh_rising_en
    doesn't always result in an error.
* zpa2326
  - Drop a test for an always true condition so that gcc won't spit out
    and unused variable warning.
parents 8a5776a5 ca4c3023
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -14,3 +14,11 @@ Description:
		Show or set the gain boost of the amp, from 0-31 range.
		18 = indoors (default)
		14 = outdoors

What		/sys/bus/iio/devices/iio:deviceX/noise_level_tripped
Date:		May 2017
KernelVersion:	4.13
Contact:	Matt Ranostay <matt.ranostay@konsulko.com>
Description:
		When 1 the noise level is over the trip level and not reporting
		valid data
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,10 @@ Optional properties:
	- ams,tuning-capacitor-pf: Calibration tuning capacitor stepping
	  value 0 - 120pF. This will require using the calibration data from
	  the manufacturer.
	- ams,nflwdth: Set the noise and watchdog threshold register on
	  startup. This will need to set according to the noise from the
	  MCU board, and possibly the local environment. Refer to the
	  datasheet for the threshold settings.

Example:

@@ -27,4 +31,5 @@ as3935@0 {
	interrupt-parent = <&gpio1>;
	interrupts = <16 1>;
	ams,tuning-capacitor-pf = <80>;
	ams,nflwdth = <0x44>;
};
+2 −0
Original line number Diff line number Diff line
@@ -243,6 +243,8 @@ config DA9150_GPADC
config DLN2_ADC
	tristate "Diolan DLN-2 ADC driver support"
	depends on MFD_DLN2
	select IIO_BUFFER
	select IIO_TRIGGERED_BUFFER
	help
	  Say yes here to build support for Diolan DLN-2 ADC.

+29 −16
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ struct at91_adc_trigger {
	char				*name;
	unsigned int			trgmod_value;
	unsigned int			edge_type;
	bool				hw_trig;
};

struct at91_adc_state {
@@ -254,16 +255,25 @@ static const struct at91_adc_trigger at91_adc_trigger_list[] = {
		.name = "external_rising",
		.trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_RISE,
		.edge_type = IRQ_TYPE_EDGE_RISING,
		.hw_trig = true,
	},
	{
		.name = "external_falling",
		.trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_FALL,
		.edge_type = IRQ_TYPE_EDGE_FALLING,
		.hw_trig = true,
	},
	{
		.name = "external_any",
		.trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_EXT_TRIG_ANY,
		.edge_type = IRQ_TYPE_EDGE_BOTH,
		.hw_trig = true,
	},
	{
		.name = "software",
		.trgmod_value = AT91_SAMA5D2_TRGR_TRGMOD_NO_TRIGGER,
		.edge_type = IRQ_TYPE_NONE,
		.hw_trig = false,
	},
};

@@ -597,7 +607,7 @@ static int at91_adc_probe(struct platform_device *pdev)
	struct at91_adc_state *st;
	struct resource	*res;
	int ret, i;
	u32 edge_type;
	u32 edge_type = IRQ_TYPE_NONE;

	indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*st));
	if (!indio_dev)
@@ -641,14 +651,14 @@ static int at91_adc_probe(struct platform_device *pdev)
	ret = of_property_read_u32(pdev->dev.of_node,
				   "atmel,trigger-edge-type", &edge_type);
	if (ret) {
		dev_err(&pdev->dev,
			"invalid or missing value for atmel,trigger-edge-type\n");
		return ret;
		dev_dbg(&pdev->dev,
			"atmel,trigger-edge-type not specified, only software trigger available\n");
	}

	st->selected_trig = NULL;

	for (i = 0; i < AT91_SAMA5D2_HW_TRIG_CNT; i++)
	/* find the right trigger, or no trigger at all */
	for (i = 0; i < AT91_SAMA5D2_HW_TRIG_CNT + 1; i++)
		if (at91_adc_trigger_list[i].edge_type == edge_type) {
			st->selected_trig = &at91_adc_trigger_list[i];
			break;
@@ -717,6 +727,7 @@ static int at91_adc_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, indio_dev);

	if (st->selected_trig->hw_trig) {
		ret = at91_adc_buffer_init(indio_dev);
		if (ret < 0) {
			dev_err(&pdev->dev, "couldn't initialize the buffer.\n");
@@ -728,11 +739,13 @@ static int at91_adc_probe(struct platform_device *pdev)
			dev_err(&pdev->dev, "couldn't setup the triggers.\n");
			goto per_clk_disable_unprepare;
		}
	}

	ret = iio_device_register(indio_dev);
	if (ret < 0)
		goto per_clk_disable_unprepare;

	if (st->selected_trig->hw_trig)
		dev_info(&pdev->dev, "setting up trigger as %s\n",
			 st->selected_trig->name);

+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ int iio_simple_dummy_write_event_config(struct iio_dev *indio_dev,
				st->event_en = state;
			else
				return -EINVAL;
			break;
		default:
			return -EINVAL;
		}
Loading