Devicetree
 help / color / mirror / Atom feed
* Re: [PATCH 04/10] staging: iio: tsl2583: remove redundant power_state sysfs attribute
From: Jonathan Cameron @ 2016-10-30 17:51 UTC (permalink / raw)
  To: Brian Masney, linux-iio
  Cc: devel, devicetree, lars, gregkh, linux-kernel, robh+dt, pmeerw,
	knaack.h, Mark.Rutland
In-Reply-To: <1477648821-3786-5-git-send-email-masneyb@onstation.org>

On 28/10/16 11:00, Brian Masney wrote:
> IIO devices have a /sys/bus/iio/devices/iio:deviceX/power/ directory
> that allows viewing and controling various power parameters. The tsl2583
> driver also has an additional custom sysfs attribute named power_state
> that is not needed. This patch removes the redundant power_state sysfs
> attribute.
> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
Applied. etc.
> ---
>  drivers/staging/iio/light/tsl2583.c | 31 -------------------------------
>  1 file changed, 31 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index 47fd373..f8ccb4d 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -511,33 +511,6 @@ static int taos_chip_off(struct iio_dev *indio_dev)
>  
>  /* Sysfs Interface Functions */
>  
> -static ssize_t taos_power_state_show(struct device *dev,
> -				     struct device_attribute *attr, char *buf)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -
> -	return sprintf(buf, "%d\n", chip->taos_chip_status);
> -}
> -
> -static ssize_t taos_power_state_store(struct device *dev,
> -				      struct device_attribute *attr,
> -				      const char *buf, size_t len)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	int value;
> -
> -	if (kstrtoint(buf, 0, &value))
> -		return -EINVAL;
> -
> -	if (!value)
> -		taos_chip_off(indio_dev);
> -	else
> -		taos_chip_on(indio_dev);
> -
> -	return len;
> -}
> -
>  static ssize_t taos_gain_show(struct device *dev,
>  			      struct device_attribute *attr, char *buf)
>  {
> @@ -785,9 +758,6 @@ static ssize_t taos_luxtable_store(struct device *dev,
>  	return len;
>  }
>  
> -static DEVICE_ATTR(power_state, S_IRUGO | S_IWUSR,
> -		taos_power_state_show, taos_power_state_store);
> -
>  static DEVICE_ATTR(illuminance0_calibscale, S_IRUGO | S_IWUSR,
>  		taos_gain_show, taos_gain_store);
>  static DEVICE_ATTR(illuminance0_calibscale_available, S_IRUGO,
> @@ -810,7 +780,6 @@ static DEVICE_ATTR(illuminance0_lux_table, S_IRUGO | S_IWUSR,
>  		taos_luxtable_show, taos_luxtable_store);
>  
>  static struct attribute *sysfs_attrs_ctrl[] = {
> -	&dev_attr_power_state.attr,
>  	&dev_attr_illuminance0_calibscale.attr,			/* Gain  */
>  	&dev_attr_illuminance0_calibscale_available.attr,
>  	&dev_attr_illuminance0_integration_time.attr,	/* I time*/
> 

^ permalink raw reply

* Re: [PATCH 05/10] staging: iio: tsl2583: check return values from taos_chip_{on,off}
From: Jonathan Cameron @ 2016-10-30 17:54 UTC (permalink / raw)
  To: Brian Masney, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	knaack.h-Mmb7MZpHnFY, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark.Rutland-5wv7dgnIgG8
In-Reply-To: <1477648821-3786-6-git-send-email-masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>

On 28/10/16 11:00, Brian Masney wrote:
> The return value from taos_chip_on() and taos_chip_off() was not
> checked in taos_luxtable_store() and taos_probe(). This patch adds
> proper error checking to these function calls.
> 
> Signed-off-by: Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>
This does raise the question of whether we should have a remove that turns
the device off, but that's a separate issue!
I don't however like the jumping to a single exit point.
That should have been done in the later patch where you add locking rather
than here.

I'll take it anyway though on the basis the ugliness doesn't last long.

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index f8ccb4d..e975bba 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -727,7 +727,7 @@ static ssize_t taos_luxtable_store(struct device *dev,
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
>  	int value[ARRAY_SIZE(taos_device_lux) * 3 + 1];
> -	int n;
> +	int n, ret = -EINVAL;
>  
>  	get_options(buf, ARRAY_SIZE(value), value);
>  
> @@ -739,23 +739,31 @@ static ssize_t taos_luxtable_store(struct device *dev,
>  	n = value[0];
>  	if ((n % 3) || n < 6 || n > ((ARRAY_SIZE(taos_device_lux) - 1) * 3)) {
>  		dev_info(dev, "LUX TABLE INPUT ERROR 1 Value[0]=%d\n", n);
> -		return -EINVAL;
> +		goto done;
>  	}
>  	if ((value[(n - 2)] | value[(n - 1)] | value[n]) != 0) {
>  		dev_info(dev, "LUX TABLE INPUT ERROR 2 Value[0]=%d\n", n);
> -		return -EINVAL;
> +		goto done;
>  	}
>  
> -	if (chip->taos_chip_status == TSL258X_CHIP_WORKING)
> -		taos_chip_off(indio_dev);
> +	if (chip->taos_chip_status == TSL258X_CHIP_WORKING) {
> +		ret = taos_chip_off(indio_dev);
> +		if (ret < 0)
> +			goto done;
> +	}
>  
>  	/* Zero out the table */
>  	memset(taos_device_lux, 0, sizeof(taos_device_lux));
>  	memcpy(taos_device_lux, &value[1], (value[0] * 4));
>  
> -	taos_chip_on(indio_dev);
> +	ret = taos_chip_on(indio_dev);
> +	if (ret < 0)
> +		goto done;
>  
> -	return len;
> +	ret = len;
> +
> +done:
> +	return ret;
>  }
>  
>  static DEVICE_ATTR(illuminance0_calibscale, S_IRUGO | S_IWUSR,
> @@ -883,7 +891,9 @@ static int taos_probe(struct i2c_client *clientp,
>  	taos_defaults(chip);
>  
>  	/* Make sure the chip is on */
> -	taos_chip_on(indio_dev);
> +	ret = taos_chip_on(indio_dev);
> +	if (ret < 0)
> +		return ret;
>  
>  	dev_info(&clientp->dev, "Light sensor found.\n");
>  	return 0;
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 06/10] staging: iio: tsl2583: convert to use iio_chan_spec and {read,write}_raw
From: Jonathan Cameron @ 2016-10-30 18:04 UTC (permalink / raw)
  To: Brian Masney, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	knaack.h-Mmb7MZpHnFY, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark.Rutland-5wv7dgnIgG8, Jon Brenner
In-Reply-To: <1477648821-3786-7-git-send-email-masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>

On 28/10/16 11:00, Brian Masney wrote:
> The tsl2583 driver directly creates sysfs attributes that should instead
> be created by the IIO core on behalf of the driver. This patch adds the
> iio_chan_spec array, the relevant info_mask elements and the read_raw()
> and write_raw() functions to take advantage of features provided by the
> IIO core. These sysfs attributes were migrated with this patch:
> illuminance0_input, illuminance0_calibbias,
> illuminance0_integration_time. This also exposes the raw values read
> from the two channels on the sensor.
> 
> With this change, these four sysfs entries have their prefix changed
> from illuminance0_ to in_illuminance_. This is deemed to be acceptable
> since none of the IIO light drivers in mainline use the illuminance0_
> prefix, however 8 of the IIO light drivers in mainline use the
> in_illuminance_ prefix.
Yeah, ABI was previously broken.  We made this change a long time ago
before anything actually moved out of staging.  Possible we'll break
some userspace code, but that's the advantage of being in staging
- no guarantees on ABI remaining the same!

Hmm... I think you also fixed the units of integration time which we
should probably mention.

I'll add a note - applied to the togreg branch of iio.git and pushed out
as testing. Jon if you get a chance, this is the first one with major
changes.

Thanks,

Jonathan
> 
> Signed-off-by: Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>
> ---
>  drivers/staging/iio/light/tsl2583.c | 236 ++++++++++++++++++++++--------------
>  1 file changed, 143 insertions(+), 93 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index e975bba..6a61a86 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -211,28 +211,23 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>  	u32 ch0lux = 0;
>  	u32 ch1lux = 0;
>  
> -	if (mutex_trylock(&chip->als_mutex) == 0) {
> -		dev_info(&chip->client->dev, "taos_get_lux device is busy\n");
> -		return chip->als_cur_info.lux; /* busy, so return LAST VALUE */
> -	}
> -
>  	if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
>  		/* device is not enabled */
>  		dev_err(&chip->client->dev, "taos_get_lux device is not enabled\n");
>  		ret = -EBUSY;
> -		goto out_unlock;
> +		goto done;
>  	}
>  
>  	ret = taos_i2c_read(chip->client, (TSL258X_CMD_REG), &buf[0], 1);
>  	if (ret < 0) {
>  		dev_err(&chip->client->dev, "taos_get_lux failed to read CMD_REG\n");
> -		goto out_unlock;
> +		goto done;
>  	}
>  	/* is data new & valid */
>  	if (!(buf[0] & TSL258X_STA_ADC_INTR)) {
>  		dev_err(&chip->client->dev, "taos_get_lux data not valid\n");
>  		ret = chip->als_cur_info.lux; /* return LAST VALUE */
> -		goto out_unlock;
> +		goto done;
>  	}
>  
>  	for (i = 0; i < 4; i++) {
> @@ -243,7 +238,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>  			dev_err(&chip->client->dev,
>  				"taos_get_lux failed to read register %x\n",
>  				reg);
> -			goto out_unlock;
> +			goto done;
>  		}
>  	}
>  
> @@ -259,7 +254,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>  		dev_err(&chip->client->dev,
>  			"taos_i2c_write_command failed in taos_get_lux, err = %d\n",
>  			ret);
> -		goto out_unlock; /* have no data, so return failure */
> +		goto done; /* have no data, so return failure */
>  	}
>  
>  	/* extract ALS/lux data */
> @@ -276,7 +271,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>  		/* have no data, so return LAST VALUE */
>  		ret = 0;
>  		chip->als_cur_info.lux = 0;
> -		goto out_unlock;
> +		goto done;
>  	}
>  	/* calculate ratio */
>  	ratio = (ch1 << 15) / ch0;
> @@ -302,7 +297,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>  		dev_dbg(&chip->client->dev, "No Data - Return last value\n");
>  		ret = 0;
>  		chip->als_cur_info.lux = 0;
> -		goto out_unlock;
> +		goto done;
>  	}
>  
>  	/* adjust for active time scale */
> @@ -334,8 +329,7 @@ static int taos_get_lux(struct iio_dev *indio_dev)
>  	chip->als_cur_info.lux = lux;
>  	ret = lux;
>  
> -out_unlock:
> -	mutex_unlock(&chip->als_mutex);
> +done:
>  	return ret;
>  }
>  
> @@ -575,69 +569,12 @@ static ssize_t taos_gain_available_show(struct device *dev,
>  	return sprintf(buf, "%s\n", "1 8 16 111");
>  }
>  
> -static ssize_t taos_als_time_show(struct device *dev,
> -				  struct device_attribute *attr, char *buf)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -
> -	return sprintf(buf, "%d\n", chip->taos_settings.als_time);
> -}
> -
> -static ssize_t taos_als_time_store(struct device *dev,
> -				   struct device_attribute *attr,
> -				   const char *buf, size_t len)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -	int value;
> -
> -	if (kstrtoint(buf, 0, &value))
> -		return -EINVAL;
> -
> -	if ((value < 50) || (value > 650))
> -		return -EINVAL;
> -
> -	if (value % 50)
> -		return -EINVAL;
> -
> -	chip->taos_settings.als_time = value;
> -
> -	return len;
> -}
> -
>  static ssize_t taos_als_time_available_show(struct device *dev,
>  					    struct device_attribute *attr,
>  					    char *buf)
>  {
>  	return sprintf(buf, "%s\n",
> -		"50 100 150 200 250 300 350 400 450 500 550 600 650");
> -}
> -
> -static ssize_t taos_als_trim_show(struct device *dev,
> -				  struct device_attribute *attr, char *buf)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -
> -	return sprintf(buf, "%d\n", chip->taos_settings.als_gain_trim);
> -}
> -
> -static ssize_t taos_als_trim_store(struct device *dev,
> -				   struct device_attribute *attr,
> -				   const char *buf, size_t len)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -	int value;
> -
> -	if (kstrtoint(buf, 0, &value))
> -		return -EINVAL;
> -
> -	if (value)
> -		chip->taos_settings.als_gain_trim = value;
> -
> -	return len;
> +		"0.000050 0.000100 0.000150 0.000200 0.000250 0.000300 0.000350 0.000400 0.000450 0.000500 0.000550 0.000600 0.000650");
>  }
>  
>  static ssize_t taos_als_cal_target_show(struct device *dev,
> @@ -667,18 +604,6 @@ static ssize_t taos_als_cal_target_store(struct device *dev,
>  	return len;
>  }
>  
> -static ssize_t taos_lux_show(struct device *dev, struct device_attribute *attr,
> -			     char *buf)
> -{
> -	int ret;
> -
> -	ret = taos_get_lux(dev_to_iio_dev(dev));
> -	if (ret < 0)
> -		return ret;
> -
> -	return sprintf(buf, "%d\n", ret);
> -}
> -
>  static ssize_t taos_do_calibrate(struct device *dev,
>  				 struct device_attribute *attr,
>  				 const char *buf, size_t len)
> @@ -771,18 +696,12 @@ static DEVICE_ATTR(illuminance0_calibscale, S_IRUGO | S_IWUSR,
>  static DEVICE_ATTR(illuminance0_calibscale_available, S_IRUGO,
>  		taos_gain_available_show, NULL);
>  
> -static DEVICE_ATTR(illuminance0_integration_time, S_IRUGO | S_IWUSR,
> -		taos_als_time_show, taos_als_time_store);
>  static DEVICE_ATTR(illuminance0_integration_time_available, S_IRUGO,
>  		taos_als_time_available_show, NULL);
>  
> -static DEVICE_ATTR(illuminance0_calibbias, S_IRUGO | S_IWUSR,
> -		taos_als_trim_show, taos_als_trim_store);
> -
>  static DEVICE_ATTR(illuminance0_input_target, S_IRUGO | S_IWUSR,
>  		taos_als_cal_target_show, taos_als_cal_target_store);
>  
> -static DEVICE_ATTR(illuminance0_input, S_IRUGO, taos_lux_show, NULL);
>  static DEVICE_ATTR(illuminance0_calibrate, S_IWUSR, NULL, taos_do_calibrate);
>  static DEVICE_ATTR(illuminance0_lux_table, S_IRUGO | S_IWUSR,
>  		taos_luxtable_show, taos_luxtable_store);
> @@ -790,11 +709,8 @@ static DEVICE_ATTR(illuminance0_lux_table, S_IRUGO | S_IWUSR,
>  static struct attribute *sysfs_attrs_ctrl[] = {
>  	&dev_attr_illuminance0_calibscale.attr,			/* Gain  */
>  	&dev_attr_illuminance0_calibscale_available.attr,
> -	&dev_attr_illuminance0_integration_time.attr,	/* I time*/
>  	&dev_attr_illuminance0_integration_time_available.attr,
> -	&dev_attr_illuminance0_calibbias.attr,			/* trim  */
>  	&dev_attr_illuminance0_input_target.attr,
> -	&dev_attr_illuminance0_input.attr,
>  	&dev_attr_illuminance0_calibrate.attr,
>  	&dev_attr_illuminance0_lux_table.attr,
>  	NULL
> @@ -810,9 +726,141 @@ static int taos_tsl258x_device(unsigned char *bufp)
>  	return ((bufp[TSL258X_CHIPID] & 0xf0) == 0x90);
>  }
>  
> +static const struct iio_chan_spec tsl2583_channels[] = {
> +	{
> +		.type = IIO_LIGHT,
> +		.modified = 1,
> +		.channel2 = IIO_MOD_LIGHT_IR,
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> +	},
> +	{
> +		.type = IIO_LIGHT,
> +		.modified = 1,
> +		.channel2 = IIO_MOD_LIGHT_BOTH,
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> +	},
> +	{
> +		.type = IIO_LIGHT,
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
> +				      BIT(IIO_CHAN_INFO_CALIBBIAS) |
> +				      BIT(IIO_CHAN_INFO_INT_TIME),
> +	},
> +};
> +
> +static int tsl2583_read_raw(struct iio_dev *indio_dev,
> +			    struct iio_chan_spec const *chan,
> +			    int *val, int *val2, long mask)
> +{
> +	struct tsl2583_chip *chip = iio_priv(indio_dev);
> +	int ret = -EINVAL;
> + 	
> +	mutex_lock(&chip->als_mutex);
> +
> +	if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
> +		ret = -EBUSY;
> +		goto read_done;
> +	}
> +
> +	switch (mask) {
> +	case IIO_CHAN_INFO_RAW:
> +		if (chan->type == IIO_LIGHT) {
> +			ret = taos_get_lux(indio_dev);
> +			if (ret < 0)
> +				goto read_done;
> +
> +			/*
> +			 * From page 20 of the TSL2581, TSL2583 data
> +			 * sheet (TAOS134 − MARCH 2011):
> +			 *
> +			 * One of the photodiodes (channel 0) is
> +			 * sensitive to both visible and infrared light,
> +			 * while the second photodiode (channel 1) is
> +			 * sensitive primarily to infrared light.
> +			 */
> +			if (chan->channel2 == IIO_MOD_LIGHT_BOTH)
> +				*val = chip->als_cur_info.als_ch0;
> +			else
> +				*val = chip->als_cur_info.als_ch1;
> +
> +			ret = IIO_VAL_INT;
> +		}
> +		break;
> +	case IIO_CHAN_INFO_PROCESSED:
> +		if (chan->type == IIO_LIGHT) {
> +			ret = taos_get_lux(indio_dev);
> +			if (ret < 0)
> +				goto read_done;
> +
> +			*val = ret;
> +			ret = IIO_VAL_INT;
> +		}
> +		break;
> +	case IIO_CHAN_INFO_CALIBBIAS:
> +		if (chan->type == IIO_LIGHT) {
> +			*val = chip->taos_settings.als_gain_trim;
> +			ret = IIO_VAL_INT;
> +		}
> +		break;
> +	case IIO_CHAN_INFO_INT_TIME:
> +		if (chan->type == IIO_LIGHT) {
> +			*val = 0;
> +			*val2 = chip->taos_settings.als_time;
> +			ret = IIO_VAL_INT_PLUS_MICRO;
> +		}
> +		break;
> +	default:
> +		break;
> +	}
> +
> +read_done:
> +	mutex_unlock(&chip->als_mutex);
> +
> +	return ret;
> +}
> +
> +static int tsl2583_write_raw(struct iio_dev *indio_dev,
> +			     struct iio_chan_spec const *chan,
> +			     int val, int val2, long mask)
> +{
> +	struct tsl2583_chip *chip = iio_priv(indio_dev);
> +	int ret = -EINVAL;
> +
> +	mutex_lock(&chip->als_mutex);
> +
> +	if (chip->taos_chip_status != TSL258X_CHIP_WORKING) {
> +		ret = -EBUSY;
> +		goto write_done;
> +	}
> +
> +	switch (mask) {
> +	case IIO_CHAN_INFO_CALIBBIAS:
> +		if (chan->type == IIO_LIGHT) {
> +			chip->taos_settings.als_gain_trim = val;
> +			ret = 0;
> +		}
> +		break;
> +	case IIO_CHAN_INFO_INT_TIME:
> +		if (chan->type == IIO_LIGHT && !val && val2 >= 50 &&
> +		    val2 <= 650 && !(val2 % 50)) {
> +			chip->taos_settings.als_time = val2;
> +			ret = 0;
> +		}
> +		break;
> +	default:
> +		break;
> +	}
> +
> +write_done:
> +	mutex_unlock(&chip->als_mutex);
> +
> +	return ret;
> +}
> +
>  static const struct iio_info tsl2583_info = {
>  	.attrs = &tsl2583_attribute_group,
>  	.driver_module = THIS_MODULE,
> +	.read_raw = tsl2583_read_raw,
> +	.write_raw = tsl2583_write_raw,
>  };
>  
>  /*
> @@ -878,6 +926,8 @@ static int taos_probe(struct i2c_client *clientp,
>  	}
>  
>  	indio_dev->info = &tsl2583_info;
> +	indio_dev->channels = tsl2583_channels;
> +	indio_dev->num_channels = ARRAY_SIZE(tsl2583_channels);
>  	indio_dev->dev.parent = &clientp->dev;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  	indio_dev->name = chip->client->name;
> 

^ permalink raw reply

* Re: [PATCH v3 6/8] iio: dpot-dac: DAC driver based on a digital potentiometer
From: Peter Rosin @ 2016-10-30 18:36 UTC (permalink / raw)
  To: Peter Meerwald-Stadler, Jonathan Cameron
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Hartmut Knaack,
	Lars-Peter Clausen, Rob Herring, Mark Rutland,
	linux-iio-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <alpine.DEB.2.02.1610301628400.32031-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>

On 2016-10-30 16:32, Peter Meerwald-Stadler wrote:
> On Sun, 30 Oct 2016, Jonathan Cameron wrote:
> 
>> On 23/10/16 23:39, Peter Rosin wrote:
>>> It is assumed that the dpot is used as a voltage divider between the
>>> current dpot wiper setting and the maximum resistance of the dpot. The
>>> divided voltage is provided by a vref regulator.
>>>
>>>                   .------.
>>>    .-----------.  |      |
>>>    | vref      |--'    .---.
>>>    | regulator |--.    |   |
>>>    '-----------'  |    | d |
>>>                   |    | p |
>>>                   |    | o |  wiper
>>>                   |    | t |<---------+
>>>                   |    |   |
>>>                   |    '---'       dac output voltage
>>>                   |      |
>>>                   '------+------------+
>>>
>>> Signed-off-by: Peter Rosin <peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
>> Only a trivial suggestion to drop the devinfo about max ohms now it's
>> exposed (effectively) via the dpot driver. (really minor though so don't bother
>> respinning for that!)
>>
>> Jonathan
>>> ---
>>>  .../ABI/testing/sysfs-bus-iio-dac-dpot-dac         |   8 +
>>>  MAINTAINERS                                        |   2 +
>>>  drivers/iio/dac/Kconfig                            |  10 +
>>>  drivers/iio/dac/Makefile                           |   1 +
>>>  drivers/iio/dac/dpot-dac.c                         | 267 +++++++++++++++++++++
>>>  5 files changed, 288 insertions(+)
>>>  create mode 100644 Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac
>>>  create mode 100644 drivers/iio/dac/dpot-dac.c
>>>
>>> diff --git a/Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac b/Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac
>>> new file mode 100644
>>> index 000000000000..580e93f373f6
>>> --- /dev/null
>>> +++ b/Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac
>>> @@ -0,0 +1,8 @@
>>> +What:		/sys/bus/iio/devices/iio:deviceX/out_voltageY_raw_available
>>> +Date:		October 2016
>>> +KernelVersion:	4.9
>>> +Contact:	Peter Rosin <peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
>>> +Description:
>>> +		The range of available values represented as the minimum value,
>>> +		the step and the maximum value, all enclosed in square brackets.
>>> +		Example: [0 1 256]
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index 6218010128dc..d7375f45ff0f 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -6115,7 +6115,9 @@ IIO DIGITAL POTENTIOMETER DAC
>>>  M:	Peter Rosin <peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
>>>  L:	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>>  S:	Maintained
>>> +F:	Documentation/ABI/testing/sysfs-bus-iio-dac-dpot-dac
>>>  F:	Documentation/devicetree/bindings/iio/dac/dpot-dac.txt
>>> +F:	drivers/iio/dac/dpot-dac.c
>>>  
>>>  IIO SUBSYSTEM AND DRIVERS
>>>  M:	Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>>> diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
>>> index 120b24478469..d3084028905b 100644
>>> --- a/drivers/iio/dac/Kconfig
>>> +++ b/drivers/iio/dac/Kconfig
>>> @@ -200,6 +200,16 @@ config AD8801
>>>  	  To compile this driver as a module choose M here: the module will be called
>>>  	  ad8801.
>>>  
>>> +config DPOT_DAC
>>> +	tristate "DAC emulation using a DPOT"
>>> +	depends on OF
>>> +	help
>>> +	  Say yes here to build support for DAC emulation using a digital
>>> +	  potentiometer.
>>> +
>>> +	  To compile this driver as a module, choose M here: the module will be
>>> +	  called dpot-dac.
>>> +
>>>  config LPC18XX_DAC
>>>  	tristate "NXP LPC18xx DAC driver"
>>>  	depends on ARCH_LPC18XX || COMPILE_TEST
>>> diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile
>>> index 27642bbf75f2..f01bf4a99867 100644
>>> --- a/drivers/iio/dac/Makefile
>>> +++ b/drivers/iio/dac/Makefile
>>> @@ -22,6 +22,7 @@ obj-$(CONFIG_AD5686) += ad5686.o
>>>  obj-$(CONFIG_AD7303) += ad7303.o
>>>  obj-$(CONFIG_AD8801) += ad8801.o
>>>  obj-$(CONFIG_CIO_DAC) += cio-dac.o
>>> +obj-$(CONFIG_DPOT_DAC) += dpot-dac.o
>>>  obj-$(CONFIG_LPC18XX_DAC) += lpc18xx_dac.o
>>>  obj-$(CONFIG_M62332) += m62332.o
>>>  obj-$(CONFIG_MAX517) += max517.o
>>> diff --git a/drivers/iio/dac/dpot-dac.c b/drivers/iio/dac/dpot-dac.c
>>> new file mode 100644
>>> index 000000000000..f227a211d34d
>>> --- /dev/null
>>> +++ b/drivers/iio/dac/dpot-dac.c
>>> @@ -0,0 +1,267 @@
>>> +/*
>>> + * IIO DAC emulation driver using a digital potentiometer
>>> + *
>>> + * Copyright (C) 2016 Axentia Technologies AB
>>> + *
>>> + * Author: Peter Rosin <peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify
>>> + * it under the terms of the GNU General Public License version 2 as
>>> + * published by the Free Software Foundation.
>>> + */
>>> +
>>> +/*
>>> + * It is assumed that the dpot is used as a voltage divider between the
>>> + * current dpot wiper setting and the maximum resistance of the dpot. The
>>> + * divided voltage is provided by a vref regulator.
>>> + *
>>> + *                   .------.
>>> + *    .-----------.  |      |
>>> + *    | vref      |--'    .---.
>>> + *    | regulator |--.    |   |
>>> + *    '-----------'  |    | d |
>>> + *                   |    | p |
>>> + *                   |    | o |  wiper
>>> + *                   |    | t |<---------+
>>> + *                   |    |   |
>>> + *                   |    '---'       dac output voltage
>>> + *                   |      |
>>> + *                   '------+------------+
>>> + */
>>> +
>>> +#include <linux/err.h>
>>> +#include <linux/iio/consumer.h>
>>> +#include <linux/iio/iio.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of.h>
>>> +#include <linux/platform_device.h>
>>> +#include <linux/regulator/consumer.h>
>>> +
>>> +struct dpot_dac {
>>> +	struct regulator *vref;
>>> +	struct iio_channel *dpot;
>>> +	u32 max_ohms;
>>> +};
>>> +
>>> +static const struct iio_chan_spec dpot_dac_iio_channel = {
>>> +	.type = IIO_VOLTAGE,
>>> +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW)
>>> +			    | BIT(IIO_CHAN_INFO_SCALE),
>>> +	.info_mask_separate_available = BIT(IIO_CHAN_INFO_RAW),
>>> +	.output = 1,
>>> +	.indexed = 1,
>>> +};
>>> +
>>> +static int dpot_dac_read_raw(struct iio_dev *indio_dev,
>>> +			     struct iio_chan_spec const *chan,
>>> +			     int *val, int *val2, long mask)
>>> +{
>>> +	struct dpot_dac *dac = iio_priv(indio_dev);
>>> +	int ret;
>>> +	unsigned long long tmp;
>>> +
>>> +	switch (mask) {
>>> +	case IIO_CHAN_INFO_RAW:
>>> +		return iio_read_channel_raw(dac->dpot, val);
>>> +
>>> +	case IIO_CHAN_INFO_SCALE:
>>> +		ret = iio_read_channel_scale(dac->dpot, val, val2);
>>> +		switch (ret) {
>>> +		case IIO_VAL_FRACTIONAL_LOG2:
>>> +			tmp = *val * 1000000000LL;
>>> +			do_div(tmp, dac->max_ohms);
>>> +			tmp *= regulator_get_voltage(dac->vref) / 1000;
>>> +			do_div(tmp, 1000000000LL);
>>> +			*val = tmp;
>>> +			return ret;
>>> +		case IIO_VAL_INT:
>>> +			/*
>>> +			 * Convert integer scale to fractional scale by
>>> +			 * setting the denominator (val2) to one...
>>> +			 */
>>> +			*val2 = 1;
>>> +			ret = IIO_VAL_FRACTIONAL;
>>> +			/* ...and fall through. */
>>> +		case IIO_VAL_FRACTIONAL:
>>> +			*val *= regulator_get_voltage(dac->vref) / 1000;
>>> +			*val2 *= dac->max_ohms;
>>> +			break;
>>> +		}
>>> +
>>> +		return ret;
>>> +	}
>>> +
>>> +	return -EINVAL;
>>> +}
>>> +
>>> +static int dpot_dac_read_avail(struct iio_dev *indio_dev,
>>> +			       struct iio_chan_spec const *chan,
>>> +			       const int **vals, int *type, int *length,
>>> +			       long mask)
>>> +{
>>> +	struct dpot_dac *dac = iio_priv(indio_dev);
>>> +
>>> +	switch (mask) {
>>> +	case IIO_CHAN_INFO_RAW:
>>> +		return iio_read_avail_channel_raw(dac->dpot,
>>> +						  vals, type, length);
>>> +	}
>>> +
>>> +	return -EINVAL;
>>> +}
>>> +
>>> +static int dpot_dac_write_raw(struct iio_dev *indio_dev,
>>> +			      struct iio_chan_spec const *chan,
>>> +			      int val, int val2, long mask)
>>> +{
>>> +	struct dpot_dac *dac = iio_priv(indio_dev);
>>> +
>>> +	switch (mask) {
>>> +	case IIO_CHAN_INFO_RAW:
>>> +		return iio_write_channel_raw(dac->dpot, val);
>>> +	}
>>> +
>>> +	return -EINVAL;
>>> +}
>>> +
>>> +static const struct iio_info dpot_dac_info = {
>>> +	.read_raw = dpot_dac_read_raw,
>>> +	.read_avail = dpot_dac_read_avail,
>>> +	.write_raw = dpot_dac_write_raw,
>>> +	.driver_module = THIS_MODULE,
>>> +};
>>> +
>>> +static int dpot_dac_channel_max_ohms(struct iio_dev *indio_dev)
>>> +{
>>> +	struct device *dev = &indio_dev->dev;
>>> +	struct dpot_dac *dac = iio_priv(indio_dev);
>>> +	unsigned long long tmp;
>>> +	int ret;
>>> +	int val;
>>> +	int val2;
>>> +	int max;
>>> +
>>> +	ret = iio_read_max_channel_raw(dac->dpot, &max);
>>> +	if (ret < 0) {
>>> +		dev_err(dev, "dpot does not indicate its raw maximum value\n");
>>> +		return ret;
>>> +	}
>>> +
>>> +	switch (iio_read_channel_scale(dac->dpot, &val, &val2)) {
>>> +	case IIO_VAL_INT:
>>> +		return max * val;
>>> +	case IIO_VAL_FRACTIONAL:
>>> +		tmp = (unsigned long long)max * val;
>>> +		do_div(tmp, val2);
>>> +		return tmp;
>>> +	case IIO_VAL_FRACTIONAL_LOG2:
>>> +		tmp = (s64)val * 1000000000LL * max >> val2;
> 
> (s64) necessary?
> or rather unsigned long long?

Fuck it, I'll just remove that case completely. I don't care about
weird fractional-log2-shit that'll probably overflow anyway. Happy?

>>> +		do_div(tmp, 1000000000LL);
>>> +		return tmp;
>>> +	default:
>>> +		dev_err(dev, "dpot has a scale that is too weird\n");
>>> +	}
>>> +
>>> +	return -EINVAL;
>>> +}
>>> +
>>> +static int dpot_dac_probe(struct platform_device *pdev)
>>> +{
>>> +	struct device *dev = &pdev->dev;
>>> +	struct iio_dev *indio_dev;
>>> +	struct dpot_dac *dac;
>>> +	enum iio_chan_type type;
>>> +	int ret;
>>> +
>>> +	indio_dev = devm_iio_device_alloc(dev, sizeof(*dac));
>>> +	if (!indio_dev)
>>> +		return -ENOMEM;
>>> +
>>> +	platform_set_drvdata(pdev, indio_dev);
>>> +	dac = iio_priv(indio_dev);
>>> +
>>> +	indio_dev->name = dev_name(dev);
>>> +	indio_dev->dev.parent = dev;
>>> +	indio_dev->info = &dpot_dac_info;
>>> +	indio_dev->modes = INDIO_DIRECT_MODE;
>>> +	indio_dev->channels = &dpot_dac_iio_channel;
>>> +	indio_dev->num_channels = 1;
>>> +
>>> +	dac->vref = devm_regulator_get(dev, "vref");
>>> +	if (IS_ERR(dac->vref)) {
>>> +		if (PTR_ERR(dac->dpot) != -EPROBE_DEFER)
>>> +			dev_err(&pdev->dev, "failed to get vref regulator\n");
>>> +		return PTR_ERR(dac->vref);
>>> +	}
>>> +
>>> +	dac->dpot = devm_iio_channel_get(dev, "dpot");
>>> +	if (IS_ERR(dac->dpot)) {
>>> +		if (PTR_ERR(dac->dpot) != -EPROBE_DEFER)
>>> +			dev_err(dev, "failed to get dpot input channel\n");
>>> +		return PTR_ERR(dac->dpot);
>>> +	}
>>> +
>>> +	ret = iio_get_channel_type(dac->dpot, &type);
>>> +	if (ret < 0)
>>> +		return ret;
>>> +
>>> +	if (type != IIO_RESISTANCE) {
>>> +		dev_err(dev, "dpot is of the wrong type\n");
>>> +		return -EINVAL;
>>> +	}
>>> +
>>> +	ret = dpot_dac_channel_max_ohms(indio_dev);
>>> +	if (ret < 0)
>>> +		return ret;
>>> +	dac->max_ohms = ret;
>>> +	dev_info(dev, "dpot max is %d\n", dac->max_ohms);
>> Given we can query this (indirectly) from the dpot itself, I'd drop this now.
> 
> max_ohms is u32, so this should be %u not %d?

You're right, but that dev_info is about to be killed anyway,
as requested by Jonathan.

Cheers,
Peter

>>
>>> +
>>> +	ret = regulator_enable(dac->vref);
>>> +	if (ret) {
>>> +		dev_err(dev, "failed to enable the vref regulator\n");
>>> +		return ret;
>>> +	}
>>> +
>>> +	ret = iio_device_register(indio_dev);
>>> +	if (ret) {
>>> +		dev_err(dev, "failed to register iio device\n");
>>> +		goto disable_reg;
>>> +	}
>>> +
>>> +	return 0;
>>> +
>>> +disable_reg:
>>> +	regulator_disable(dac->vref);
>>> +	return ret;
>>> +}
>>> +
>>> +static int dpot_dac_remove(struct platform_device *pdev)
>>> +{
>>> +	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>>> +	struct dpot_dac *dac = iio_priv(indio_dev);
>>> +
>>> +	iio_device_unregister(indio_dev);
>>> +	regulator_disable(dac->vref);
>>> +
>>> +	return 0;
>>> +}
>>> +
>>> +static const struct of_device_id dpot_dac_match[] = {
>>> +	{ .compatible = "dpot-dac" },
>>> +	{ /* sentinel */ }
>>> +};
>>> +MODULE_DEVICE_TABLE(of, dpot_dac_match);
>>> +
>>> +static struct platform_driver dpot_dac_driver = {
>>> +	.probe = dpot_dac_probe,
>>> +	.remove = dpot_dac_remove,
>>> +	.driver = {
>>> +		.name = "iio-dpot-dac",
>>> +		.of_match_table = dpot_dac_match,
>>> +	},
>>> +};
>>> +module_platform_driver(dpot_dac_driver);
>>> +
>>> +MODULE_DESCRIPTION("DAC emulation driver using a digital potentiometer");
>>> +MODULE_AUTHOR("Peter Rosin <peda-koto5C5qi+TLoDKTGw+V6w@public.gmane.org>");
>>> +MODULE_LICENSE("GPL v2");
>>>
>>
> 

^ permalink raw reply

* Re: [PATCH 07/10] staging: iio: tsl2583: convert illuminance0_calibscale sysfs attr to use iio_chan_spec
From: Jonathan Cameron @ 2016-10-30 18:37 UTC (permalink / raw)
  To: Brian Masney, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	knaack.h-Mmb7MZpHnFY, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark.Rutland-5wv7dgnIgG8
In-Reply-To: <1477648821-3786-8-git-send-email-masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>

On 28/10/16 11:00, Brian Masney wrote:
> The illuminance0_calibscale sysfs attribute is not currently created by
> the IIO core. This patch adds the appropriate mask to iio_chan_spec,
> along with the appropriate data handling in the read_raw() and
> write_raw() functions, so that the sysfs attribute is created by the IIO
> core. With this change, this sysfs entry will have its prefix changed
> from illuminance0_ to in_illuminance_.
> 
> Signed-off-by: Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>
Hmm. Could probably have computed the mean on the fly but fine as is.

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 89 +++++++++++--------------------------
>  1 file changed, 25 insertions(+), 64 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index 6a61a86..bfff6ca 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -124,14 +124,15 @@ static struct taos_lux taos_device_lux[11] = {
>  struct gainadj {
>  	s16 ch0;
>  	s16 ch1;
> +	s16 mean;
>  };
>  
>  /* Index = (0 - 3) Used to validate the gain selection index */
>  static const struct gainadj gainadj[] = {
> -	{ 1, 1 },
> -	{ 8, 8 },
> -	{ 16, 16 },
> -	{ 107, 115 }
> +	{ 1, 1, 1 },
> +	{ 8, 8, 8 },
> +	{ 16, 16, 16 },
> +	{ 107, 115, 111 }
>  };
>  
>  /*
> @@ -505,63 +506,6 @@ static int taos_chip_off(struct iio_dev *indio_dev)
>  
>  /* Sysfs Interface Functions */
>  
> -static ssize_t taos_gain_show(struct device *dev,
> -			      struct device_attribute *attr, char *buf)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -	char gain[4] = {0};
> -
> -	switch (chip->taos_settings.als_gain) {
> -	case 0:
> -		strcpy(gain, "001");
> -		break;
> -	case 1:
> -		strcpy(gain, "008");
> -		break;
> -	case 2:
> -		strcpy(gain, "016");
> -		break;
> -	case 3:
> -		strcpy(gain, "111");
> -		break;
> -	}
> -
> -	return sprintf(buf, "%s\n", gain);
> -}
> -
> -static ssize_t taos_gain_store(struct device *dev,
> -			       struct device_attribute *attr,
> -			       const char *buf, size_t len)
> -{
> -	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> -	struct tsl2583_chip *chip = iio_priv(indio_dev);
> -	int value;
> -
> -	if (kstrtoint(buf, 0, &value))
> -		return -EINVAL;
> -
> -	switch (value) {
> -	case 1:
> -		chip->taos_settings.als_gain = 0;
> -		break;
> -	case 8:
> -		chip->taos_settings.als_gain = 1;
> -		break;
> -	case 16:
> -		chip->taos_settings.als_gain = 2;
> -		break;
> -	case 111:
> -		chip->taos_settings.als_gain = 3;
> -		break;
> -	default:
> -		dev_err(dev, "Invalid Gain Index (must be 1,8,16,111)\n");
> -		return -1;
> -	}
> -
> -	return len;
> -}
> -
>  static ssize_t taos_gain_available_show(struct device *dev,
>  					struct device_attribute *attr,
>  					char *buf)
> @@ -691,8 +635,6 @@ static ssize_t taos_luxtable_store(struct device *dev,
>  	return ret;
>  }
>  
> -static DEVICE_ATTR(illuminance0_calibscale, S_IRUGO | S_IWUSR,
> -		taos_gain_show, taos_gain_store);
>  static DEVICE_ATTR(illuminance0_calibscale_available, S_IRUGO,
>  		taos_gain_available_show, NULL);
>  
> @@ -707,7 +649,6 @@ static DEVICE_ATTR(illuminance0_lux_table, S_IRUGO | S_IWUSR,
>  		taos_luxtable_show, taos_luxtable_store);
>  
>  static struct attribute *sysfs_attrs_ctrl[] = {
> -	&dev_attr_illuminance0_calibscale.attr,			/* Gain  */
>  	&dev_attr_illuminance0_calibscale_available.attr,
>  	&dev_attr_illuminance0_integration_time_available.attr,
>  	&dev_attr_illuminance0_input_target.attr,
> @@ -743,6 +684,7 @@ static const struct iio_chan_spec tsl2583_channels[] = {
>  		.type = IIO_LIGHT,
>  		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
>  				      BIT(IIO_CHAN_INFO_CALIBBIAS) |
> +				      BIT(IIO_CHAN_INFO_CALIBSCALE) |
>  				      BIT(IIO_CHAN_INFO_INT_TIME),
>  	},
>  };
> @@ -801,6 +743,12 @@ static int tsl2583_read_raw(struct iio_dev *indio_dev,
>  			ret = IIO_VAL_INT;
>  		}
>  		break;
> +	case IIO_CHAN_INFO_CALIBSCALE:
> +		if (chan->type == IIO_LIGHT) {
> +			*val = gainadj[chip->taos_settings.als_gain].mean;
> +			ret = IIO_VAL_INT;
> +		}
> +		break;
>  	case IIO_CHAN_INFO_INT_TIME:
>  		if (chan->type == IIO_LIGHT) {
>  			*val = 0;
> @@ -839,6 +787,19 @@ static int tsl2583_write_raw(struct iio_dev *indio_dev,
>  			ret = 0;
>  		}
>  		break;
> +	case IIO_CHAN_INFO_CALIBSCALE:
> +		if (chan->type == IIO_LIGHT) {
> +			int i;
> +
> +			for (i = 0; i < ARRAY_SIZE(gainadj); i++) {
> +				if (gainadj[i].mean == val) {
> +					chip->taos_settings.als_gain = i;
> +					ret = 0;
> +					break;
> +				}
> +			}
> +		}
> +		break;
>  	case IIO_CHAN_INFO_INT_TIME:
>  		if (chan->type == IIO_LIGHT && !val && val2 >= 50 &&
>  		    val2 <= 650 && !(val2 % 50)) {
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 08/10] staging: iio: tsl2583: use IIO_*_ATTR* macros to create sysfs entries
From: Jonathan Cameron @ 2016-10-30 18:38 UTC (permalink / raw)
  To: Brian Masney, linux-iio-u79uwXL29TY76Z2rM5mHXA
  Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	knaack.h-Mmb7MZpHnFY, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark.Rutland-5wv7dgnIgG8
In-Reply-To: <1477648821-3786-9-git-send-email-masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>

On 28/10/16 11:00, Brian Masney wrote:
> Use the IIO_CONST_ATTR, IIO_DEVICE_ATTR_RW, and IIO_DEVICE_ATTR_WO
> macros for creating the in_illuminance_calibscale_available,
> in_illuminance_integration_time_available, in_illuminance_input_target,
> in_illuminance_calibrate, and in_illuminance_lux_table sysfs entries.
> Previously these sysfs entries were prefixed with illuminance0_, however
> they are now prefixed with in_illuminance_ to make these sysfs entries
> consistent with how the IIO core is creating the other sysfs entries.
> 
> Signed-off-by: Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>
Applied.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 73 ++++++++++++++-----------------------
>  1 file changed, 27 insertions(+), 46 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index bfff6ca..1462374 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -29,6 +29,7 @@
>  #include <linux/slab.h>
>  #include <linux/module.h>
>  #include <linux/iio/iio.h>
> +#include <linux/iio/sysfs.h>
>  
>  #define TSL258X_MAX_DEVICE_REGS		32
>  
> @@ -506,24 +507,9 @@ static int taos_chip_off(struct iio_dev *indio_dev)
>  
>  /* Sysfs Interface Functions */
>  
> -static ssize_t taos_gain_available_show(struct device *dev,
> -					struct device_attribute *attr,
> -					char *buf)
> -{
> -	return sprintf(buf, "%s\n", "1 8 16 111");
> -}
> -
> -static ssize_t taos_als_time_available_show(struct device *dev,
> -					    struct device_attribute *attr,
> -					    char *buf)
> -{
> -	return sprintf(buf, "%s\n",
> -		"0.000050 0.000100 0.000150 0.000200 0.000250 0.000300 0.000350 0.000400 0.000450 0.000500 0.000550 0.000600 0.000650");
> -}
> -
> -static ssize_t taos_als_cal_target_show(struct device *dev,
> -					struct device_attribute *attr,
> -					char *buf)
> +static ssize_t in_illuminance_input_target_show(struct device *dev,
> +						struct device_attribute *attr,
> +						char *buf)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> @@ -531,9 +517,9 @@ static ssize_t taos_als_cal_target_show(struct device *dev,
>  	return sprintf(buf, "%d\n", chip->taos_settings.als_cal_target);
>  }
>  
> -static ssize_t taos_als_cal_target_store(struct device *dev,
> -					 struct device_attribute *attr,
> -					 const char *buf, size_t len)
> +static ssize_t in_illuminance_input_target_store(struct device *dev,
> +						 struct device_attribute *attr,
> +						 const char *buf, size_t len)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> @@ -548,9 +534,9 @@ static ssize_t taos_als_cal_target_store(struct device *dev,
>  	return len;
>  }
>  
> -static ssize_t taos_do_calibrate(struct device *dev,
> -				 struct device_attribute *attr,
> -				 const char *buf, size_t len)
> +static ssize_t in_illuminance_calibrate_store(struct device *dev,
> +					      struct device_attribute *attr,
> +					      const char *buf, size_t len)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	int value;
> @@ -564,8 +550,9 @@ static ssize_t taos_do_calibrate(struct device *dev,
>  	return len;
>  }
>  
> -static ssize_t taos_luxtable_show(struct device *dev,
> -				  struct device_attribute *attr, char *buf)
> +static ssize_t in_illuminance_lux_table_show(struct device *dev,
> +					     struct device_attribute *attr,
> +					     char *buf)
>  {
>  	int i;
>  	int offset = 0;
> @@ -589,9 +576,9 @@ static ssize_t taos_luxtable_show(struct device *dev,
>  	return offset;
>  }
>  
> -static ssize_t taos_luxtable_store(struct device *dev,
> -				   struct device_attribute *attr,
> -				   const char *buf, size_t len)
> +static ssize_t in_illuminance_lux_table_store(struct device *dev,
> +					      struct device_attribute *attr,
> +					      const char *buf, size_t len)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> @@ -635,25 +622,19 @@ static ssize_t taos_luxtable_store(struct device *dev,
>  	return ret;
>  }
>  
> -static DEVICE_ATTR(illuminance0_calibscale_available, S_IRUGO,
> -		taos_gain_available_show, NULL);
> -
> -static DEVICE_ATTR(illuminance0_integration_time_available, S_IRUGO,
> -		taos_als_time_available_show, NULL);
> -
> -static DEVICE_ATTR(illuminance0_input_target, S_IRUGO | S_IWUSR,
> -		taos_als_cal_target_show, taos_als_cal_target_store);
> -
> -static DEVICE_ATTR(illuminance0_calibrate, S_IWUSR, NULL, taos_do_calibrate);
> -static DEVICE_ATTR(illuminance0_lux_table, S_IRUGO | S_IWUSR,
> -		taos_luxtable_show, taos_luxtable_store);
> +static IIO_CONST_ATTR(in_illuminance_calibscale_available, "1 8 16 111");
> +static IIO_CONST_ATTR(in_illuminance_integration_time_available,
> +		      "0.000050 0.000100 0.000150 0.000200 0.000250 0.000300 0.000350 0.000400 0.000450 0.000500 0.000550 0.000600 0.000650");
> +static IIO_DEVICE_ATTR_RW(in_illuminance_input_target, 0);
> +static IIO_DEVICE_ATTR_WO(in_illuminance_calibrate, 0);
> +static IIO_DEVICE_ATTR_RW(in_illuminance_lux_table, 0);
>  
>  static struct attribute *sysfs_attrs_ctrl[] = {
> -	&dev_attr_illuminance0_calibscale_available.attr,
> -	&dev_attr_illuminance0_integration_time_available.attr,
> -	&dev_attr_illuminance0_input_target.attr,
> -	&dev_attr_illuminance0_calibrate.attr,
> -	&dev_attr_illuminance0_lux_table.attr,
> +	&iio_const_attr_in_illuminance_calibscale_available.dev_attr.attr,
> +	&iio_const_attr_in_illuminance_integration_time_available.dev_attr.attr,
> +	&iio_dev_attr_in_illuminance_input_target.dev_attr.attr,
> +	&iio_dev_attr_in_illuminance_calibrate.dev_attr.attr,
> +	&iio_dev_attr_in_illuminance_lux_table.dev_attr.attr,
>  	NULL
>  };
>  
> 

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] clk: cdce925: add support for CDCE913, CDCE937, and CDCE949
From: Mike Looijmans @ 2016-10-30 18:39 UTC (permalink / raw)
  To: Akinobu Mita, linux-clk-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Michael Turquette, Stephen Boyd
In-Reply-To: <1477848637-5151-1-git-send-email-akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Looks okay to me. I can test it on our boards (with the 925 chip) to 
make sure there wasn't any regression, if you like.

On 30-10-2016 18:30, Akinobu Mita wrote:
> The CDCE925 is a member of the CDCE(L)9xx programmable clock generator
> family.  There are also CDCE913, CDCE937, CDCE949 which have different
> number of PLLs and outputs.
>
> The clk-cdce925 driver supports only CDCE925 in the family.  This adds
> support for the CDCE913, CDCE937, CDCE949, too.
>
> Signed-off-by: Akinobu Mita <akinobu.mita-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org>
> Cc: Michael Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
>   .../devicetree/bindings/clock/ti,cdce925.txt       |  15 ++-
>   drivers/clk/Kconfig                                |  11 ++-
>   drivers/clk/clk-cdce925.c                          | 106 ++++++++++++++++-----
>   3 files changed, 99 insertions(+), 33 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/clock/ti,cdce925.txt b/Documentation/devicetree/bindings/clock/ti,cdce925.txt
> index 4c7669a..0d01f2d 100644
> --- a/Documentation/devicetree/bindings/clock/ti,cdce925.txt
> +++ b/Documentation/devicetree/bindings/clock/ti,cdce925.txt
> @@ -1,15 +1,22 @@
> -Binding for TO CDCE925 programmable I2C clock synthesizers.
> +Binding for TI CDCE913/925/937/949 programmable I2C clock synthesizers.
>
>   Reference
>   This binding uses the common clock binding[1].
>
>   [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
> -[2] http://www.ti.com/product/cdce925
> +[2] http://www.ti.com/product/cdce913
> +[3] http://www.ti.com/product/cdce925
> +[4] http://www.ti.com/product/cdce937
> +[5] http://www.ti.com/product/cdce949
>
>   The driver provides clock sources for each output Y1 through Y5.
>
>   Required properties:
> - - compatible: Shall be "ti,cdce925"
> + - compatible: Shall be one of the following:
> +	- "ti,cdce913": 1-PLL, 3 Outputs
> +	- "ti,cdce925": 2-PLL, 5 Outputs
> +	- "ti,cdce937": 3-PLL, 7 Outputs
> +	- "ti,cdce949": 4-PLL, 9 Outputs
>    - reg: I2C device address.
>    - clocks: Points to a fixed parent clock that provides the input frequency.
>    - #clock-cells: From common clock bindings: Shall be 1.
> @@ -18,7 +25,7 @@ Optional properties:
>    - xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a
>                    board, or to compensate for external influences.
>
> -For both PLL1 and PLL2 an optional child node can be used to specify spread
> +For all PLL1, PLL2, ... an optional child node can be used to specify spread
>   spectrum clocking parameters for a board.
>     - spread-spectrum: SSC mode as defined in the data sheet.
>     - spread-spectrum-center: Use "centered" mode instead of "max" mode. When
> diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig
> index e99a42f..bc0a6e6 100644
> --- a/drivers/clk/Kconfig
> +++ b/drivers/clk/Kconfig
> @@ -104,16 +104,17 @@ config COMMON_CLK_CDCE706
>   	  This driver supports TI CDCE706 programmable 3-PLL clock synthesizer.
>
>   config COMMON_CLK_CDCE925
> -	tristate "Clock driver for TI CDCE925 devices"
> +	tristate "Clock driver for TI CDCE913/925/937/949 devices"
>   	depends on I2C
>   	depends on OF
>   	select REGMAP_I2C
>   	help
>   	---help---
> -	  This driver supports the TI CDCE925 programmable clock synthesizer.
> -	  The chip contains two PLLs with spread-spectrum clocking support and
> -	  five output dividers. The driver only supports the following setup,
> -	  and uses a fixed setting for the output muxes.
> +	  This driver supports the TI CDCE913/925/937/949 programmable clock
> +	  synthesizer. Each chip has different number of PLLs and outputs.
> +	  For example, the CDCE925 contains two PLLs with spread-spectrum
> +	  clocking support and five output dividers. The driver only supports
> +	  the following setup, and uses a fixed setting for the output muxes.
>   	  Y1 is derived from the input clock
>   	  Y2 and Y3 derive from PLL1
>   	  Y4 and Y5 derive from PLL2
> diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c
> index b8459c1..fbac08d 100644
> --- a/drivers/clk/clk-cdce925.c
> +++ b/drivers/clk/clk-cdce925.c
> @@ -1,8 +1,8 @@
>   /*
> - * Driver for TI Dual PLL CDCE925 clock synthesizer
> + * Driver for TI Multi PLL CDCE913/925/937/949 clock synthesizer
>    *
> - * This driver always connects the Y1 to the input clock, Y2/Y3 to PLL1
> - * and Y4/Y5 to PLL2. PLL frequency is set on a first-come-first-serve
> + * This driver always connects the Y1 to the input clock, Y2/Y3 to PLL1,
> + * Y4/Y5 to PLL2, and so on. PLL frequency is set on a first-come-first-serve
>    * basis. Clients can directly request any frequency that the chip can
>    * deliver using the standard clk framework. In addition, the device can
>    * be configured and activated via the devicetree.
> @@ -19,11 +19,32 @@
>   #include <linux/slab.h>
>   #include <linux/gcd.h>
>
> -/* The chip has 2 PLLs which can be routed through dividers to 5 outputs.
> +/* Each chip has different number of PLLs and outputs, for example:
> + * The CECE925 has 2 PLLs which can be routed through dividers to 5 outputs.
>    * Model this as 2 PLL clocks which are parents to the outputs.
>    */
> -#define NUMBER_OF_PLLS	2
> -#define NUMBER_OF_OUTPUTS	5
> +
> +enum {
> +	CDCE913,
> +	CDCE925,
> +	CDCE937,
> +	CDCE949,
> +};
> +
> +struct clk_cdce925_chip_info {
> +	int num_plls;
> +	int num_outputs;
> +};
> +
> +static const struct clk_cdce925_chip_info clk_cdce925_chip_info_tbl[] = {
> +	[CDCE913] = { .num_plls = 1, .num_outputs = 3 },
> +	[CDCE925] = { .num_plls = 2, .num_outputs = 5 },
> +	[CDCE937] = { .num_plls = 3, .num_outputs = 7 },
> +	[CDCE949] = { .num_plls = 4, .num_outputs = 9 },
> +};
> +
> +#define MAX_NUMBER_OF_PLLS	4
> +#define MAX_NUMBER_OF_OUTPUTS	9
>
>   #define CDCE925_REG_GLOBAL1	0x01
>   #define CDCE925_REG_Y1SPIPDIVH	0x02
> @@ -43,7 +64,7 @@ struct clk_cdce925_output {
>   	struct clk_hw hw;
>   	struct clk_cdce925_chip *chip;
>   	u8 index;
> -	u16 pdiv; /* 1..127 for Y2-Y5; 1..1023 for Y1 */
> +	u16 pdiv; /* 1..127 for Y2-Y9; 1..1023 for Y1 */
>   };
>   #define to_clk_cdce925_output(_hw) \
>   	container_of(_hw, struct clk_cdce925_output, hw)
> @@ -60,8 +81,9 @@ struct clk_cdce925_pll {
>   struct clk_cdce925_chip {
>   	struct regmap *regmap;
>   	struct i2c_client *i2c_client;
> -	struct clk_cdce925_pll pll[NUMBER_OF_PLLS];
> -	struct clk_cdce925_output clk[NUMBER_OF_OUTPUTS];
> +	const struct clk_cdce925_chip_info *chip_info;
> +	struct clk_cdce925_pll pll[MAX_NUMBER_OF_PLLS];
> +	struct clk_cdce925_output clk[MAX_NUMBER_OF_OUTPUTS];
>   };
>
>   /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
> @@ -284,6 +306,18 @@ static void cdce925_clk_set_pdiv(struct clk_cdce925_output *data, u16 pdiv)
>   	case 4:
>   		regmap_update_bits(data->chip->regmap, 0x27, 0x7F, pdiv);
>   		break;
> +	case 5:
> +		regmap_update_bits(data->chip->regmap, 0x36, 0x7F, pdiv);
> +		break;
> +	case 6:
> +		regmap_update_bits(data->chip->regmap, 0x37, 0x7F, pdiv);
> +		break;
> +	case 7:
> +		regmap_update_bits(data->chip->regmap, 0x46, 0x7F, pdiv);
> +		break;
> +	case 8:
> +		regmap_update_bits(data->chip->regmap, 0x47, 0x7F, pdiv);
> +		break;
>   	}
>   }
>
> @@ -302,6 +336,14 @@ static void cdce925_clk_activate(struct clk_cdce925_output *data)
>   	case 4:
>   		regmap_update_bits(data->chip->regmap, 0x24, 0x03, 0x03);
>   		break;
> +	case 5:
> +	case 6:
> +		regmap_update_bits(data->chip->regmap, 0x34, 0x03, 0x03);
> +		break;
> +	case 7:
> +	case 8:
> +		regmap_update_bits(data->chip->regmap, 0x44, 0x03, 0x03);
> +		break;
>   	}
>   }
>
> @@ -474,15 +516,6 @@ static const struct clk_ops cdce925_clk_y1_ops = {
>   	.set_rate = cdce925_clk_y1_set_rate,
>   };
>
> -
> -static struct regmap_config cdce925_regmap_config = {
> -	.name = "configuration0",
> -	.reg_bits = 8,
> -	.val_bits = 8,
> -	.cache_type = REGCACHE_RBTREE,
> -	.max_register = 0x2F,
> -};
> -
>   #define CDCE925_I2C_COMMAND_BLOCK_TRANSFER	0x00
>   #define CDCE925_I2C_COMMAND_BYTE_TRANSFER	0x80
>
> @@ -582,13 +615,19 @@ static int cdce925_probe(struct i2c_client *client,
>   	struct clk_cdce925_chip *data;
>   	struct device_node *node = client->dev.of_node;
>   	const char *parent_name;
> -	const char *pll_clk_name[NUMBER_OF_PLLS] = {NULL,};
> +	const char *pll_clk_name[MAX_NUMBER_OF_PLLS] = {NULL,};
>   	struct clk_init_data init;
>   	u32 value;
>   	int i;
>   	int err;
>   	struct device_node *np_output;
>   	char child_name[6];
> +	struct regmap_config cdce925_regmap_config = {
> +		.name = "configuration0",
> +		.reg_bits = 8,
> +		.val_bits = 8,
> +		.cache_type = REGCACHE_RBTREE,
> +	};
>
>   	dev_dbg(&client->dev, "%s\n", __func__);
>   	data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
> @@ -596,6 +635,9 @@ static int cdce925_probe(struct i2c_client *client,
>   		return -ENOMEM;
>
>   	data->i2c_client = client;
> +	data->chip_info = &clk_cdce925_chip_info_tbl[id->driver_data];
> +	cdce925_regmap_config.max_register = CDCE925_OFFSET_PLL	+
> +		data->chip_info->num_plls * 0x10 - 1;
>   	data->regmap = devm_regmap_init(&client->dev, &regmap_cdce925_bus,
>   			&client->dev, &cdce925_regmap_config);
>   	if (IS_ERR(data->regmap)) {
> @@ -626,7 +668,7 @@ static int cdce925_probe(struct i2c_client *client,
>   	init.num_parents = parent_name ? 1 : 0;
>
>   	/* Register PLL clocks */
> -	for (i = 0; i < NUMBER_OF_PLLS; ++i) {
> +	for (i = 0; i < data->chip_info->num_plls; ++i) {
>   		pll_clk_name[i] = kasprintf(GFP_KERNEL, "%s.pll%d",
>   			client->dev.of_node->name, i);
>   		init.name = pll_clk_name[i];
> @@ -684,7 +726,7 @@ static int cdce925_probe(struct i2c_client *client,
>   	init.ops = &cdce925_clk_ops;
>   	init.flags = CLK_SET_RATE_PARENT;
>   	init.num_parents = 1;
> -	for (i = 1; i < NUMBER_OF_OUTPUTS; ++i) {
> +	for (i = 1; i < data->chip_info->num_outputs; ++i) {
>   		init.name = kasprintf(GFP_KERNEL, "%s.Y%d",
>   			client->dev.of_node->name, i+1);
>   		data->clk[i].chip = data;
> @@ -702,6 +744,16 @@ static int cdce925_probe(struct i2c_client *client,
>   			/* Mux Y4/5 to PLL2 */
>   			init.parent_names = &pll_clk_name[1];
>   			break;
> +		case 5:
> +		case 6:
> +			/* Mux Y6/7 to PLL3 */
> +			init.parent_names = &pll_clk_name[2];
> +			break;
> +		case 7:
> +		case 8:
> +			/* Mux Y8/9 to PLL4 */
> +			init.parent_names = &pll_clk_name[3];
> +			break;
>   		}
>   		err = devm_clk_hw_register(&client->dev, &data->clk[i].hw);
>   		kfree(init.name); /* clock framework made a copy of the name */
> @@ -720,7 +772,7 @@ static int cdce925_probe(struct i2c_client *client,
>   	err = 0;
>
>   error:
> -	for (i = 0; i < NUMBER_OF_PLLS; ++i)
> +	for (i = 0; i < data->chip_info->num_plls; ++i)
>   		/* clock framework made a copy of the name */
>   		kfree(pll_clk_name[i]);
>
> @@ -728,13 +780,19 @@ static int cdce925_probe(struct i2c_client *client,
>   }
>
>   static const struct i2c_device_id cdce925_id[] = {
> -	{ "cdce925", 0 },
> +	{ "cdce913", CDCE913 },
> +	{ "cdce925", CDCE925 },
> +	{ "cdce937", CDCE937 },
> +	{ "cdce949", CDCE949 },
>   	{ }
>   };
>   MODULE_DEVICE_TABLE(i2c, cdce925_id);
>
>   static const struct of_device_id clk_cdce925_of_match[] = {
> +	{ .compatible = "ti,cdce913" },
>   	{ .compatible = "ti,cdce925" },
> +	{ .compatible = "ti,cdce937" },
> +	{ .compatible = "ti,cdce949" },
>   	{ },
>   };
>   MODULE_DEVICE_TABLE(of, clk_cdce925_of_match);
> @@ -750,5 +808,5 @@ static struct i2c_driver cdce925_driver = {
>   module_i2c_driver(cdce925_driver);
>
>   MODULE_AUTHOR("Mike Looijmans <mike.looijmans-Oq418RWZeHk@public.gmane.org>");
> -MODULE_DESCRIPTION("cdce925 driver");
> +MODULE_DESCRIPTION("TI CDCE913/925/937/949 driver");
>   MODULE_LICENSE("GPL");
>


-- 
Mike Looijmans


Kind regards,

Mike Looijmans
System Expert

TOPIC Products
Materiaalweg 4, NL-5681 RJ Best
Postbus 440, NL-5680 AK Best
Telefoon: +31 (0) 499 33 69 79
E-mail: mike.looijmans-yhtFebqMsb9it5bFGTN0CAC/G2K4zDHf@public.gmane.org
Website: www.topicproducts.com

Please consider the environment before printing this e-mail





--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 09/10] staging: iio: tsl2583: add error code to sysfs store functions
From: Jonathan Cameron @ 2016-10-30 18:39 UTC (permalink / raw)
  To: Brian Masney, linux-iio
  Cc: devel, devicetree, lars, gregkh, linux-kernel, robh+dt, pmeerw,
	knaack.h, Mark.Rutland
In-Reply-To: <1477648821-3786-10-git-send-email-masneyb@onstation.org>

On 28/10/16 11:00, Brian Masney wrote:
> in_illuminance_input_target_store() and in_illuminance_calibrate_store()
> validated the data from userspace, however it would not return an
> error code to userspace if an invalid value was passed in. This patch
> changes these functions so that they return -EINVAL if invalid data is
> passed in.
> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
Applied thanks.

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index 1462374..98afa5b 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -525,11 +525,10 @@ static ssize_t in_illuminance_input_target_store(struct device *dev,
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
>  	int value;
>  
> -	if (kstrtoint(buf, 0, &value))
> +	if (kstrtoint(buf, 0, &value) || !value)
>  		return -EINVAL;
>  
> -	if (value)
> -		chip->taos_settings.als_cal_target = value;
> +	chip->taos_settings.als_cal_target = value;
>  
>  	return len;
>  }
> @@ -541,11 +540,10 @@ static ssize_t in_illuminance_calibrate_store(struct device *dev,
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	int value;
>  
> -	if (kstrtoint(buf, 0, &value))
> +	if (kstrtoint(buf, 0, &value) || value != 1)
>  		return -EINVAL;
>  
> -	if (value == 1)
> -		taos_als_calibrate(indio_dev);
> +	taos_als_calibrate(indio_dev);
>  
>  	return len;
>  }
> 

^ permalink raw reply

* Re: [PATCH 10/10] staging: iio: tsl2583: add locking to sysfs attributes
From: Jonathan Cameron @ 2016-10-30 18:43 UTC (permalink / raw)
  To: Brian Masney, linux-iio
  Cc: devel, devicetree, lars, gregkh, linux-kernel, robh+dt, pmeerw,
	knaack.h, Mark.Rutland
In-Reply-To: <1477648821-3786-11-git-send-email-masneyb@onstation.org>

On 28/10/16 11:00, Brian Masney wrote:
> in_illuminance_input_target_show(), in_illuminance_input_target_store(),
> in_illuminance_calibrate_store(), and in_illuminance_lux_table_store()
> accesses data from the tsl2583_chip struct. Some of these fields can be
> modified by other parts of the driver concurrently. This patch adds the
> mutex locking to these sysfs attributes.
> 
> Signed-off-by: Brian Masney <masneyb@onstation.org>
Applied to the togreg branch of iio.git and pushed out as testing for the
autobuilders to play with it.

Some elements of this were probably a little over paranoid but in theory
you might get a wrong reading (compared to what the hardware is set to) so
fair enough.

Good patch set.

Thanks,

Jonathan
> ---
>  drivers/staging/iio/light/tsl2583.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c
> index 98afa5b..49b19f5 100644
> --- a/drivers/staging/iio/light/tsl2583.c
> +++ b/drivers/staging/iio/light/tsl2583.c
> @@ -513,8 +513,13 @@ static ssize_t in_illuminance_input_target_show(struct device *dev,
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
>  	struct tsl2583_chip *chip = iio_priv(indio_dev);
> +	int ret;
> +
> +	mutex_lock(&chip->als_mutex);
> +	ret = sprintf(buf, "%d\n", chip->taos_settings.als_cal_target);
> +	mutex_unlock(&chip->als_mutex);
>  
> -	return sprintf(buf, "%d\n", chip->taos_settings.als_cal_target);
> +	return ret;
>  }
>  
>  static ssize_t in_illuminance_input_target_store(struct device *dev,
> @@ -528,7 +533,9 @@ static ssize_t in_illuminance_input_target_store(struct device *dev,
>  	if (kstrtoint(buf, 0, &value) || !value)
>  		return -EINVAL;
>  
> +	mutex_lock(&chip->als_mutex);
>  	chip->taos_settings.als_cal_target = value;
> +	mutex_unlock(&chip->als_mutex);
>  
>  	return len;
>  }
> @@ -538,12 +545,15 @@ static ssize_t in_illuminance_calibrate_store(struct device *dev,
>  					      const char *buf, size_t len)
>  {
>  	struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> +	struct tsl2583_chip *chip = iio_priv(indio_dev);
>  	int value;
>  
>  	if (kstrtoint(buf, 0, &value) || value != 1)
>  		return -EINVAL;
>  
> +	mutex_lock(&chip->als_mutex);
>  	taos_als_calibrate(indio_dev);
> +	mutex_unlock(&chip->als_mutex);
>  
>  	return len;
>  }
> @@ -583,6 +593,8 @@ static ssize_t in_illuminance_lux_table_store(struct device *dev,
>  	int value[ARRAY_SIZE(taos_device_lux) * 3 + 1];
>  	int n, ret = -EINVAL;
>  
> +	mutex_lock(&chip->als_mutex);
> +
>  	get_options(buf, ARRAY_SIZE(value), value);
>  
>  	/* We now have an array of ints starting at value[1], and
> @@ -617,6 +629,8 @@ static ssize_t in_illuminance_lux_table_store(struct device *dev,
>  	ret = len;
>  
>  done:
> +	mutex_unlock(&chip->als_mutex);
> +
>  	return ret;
>  }
>  
> 

^ permalink raw reply

* Re: [PATCH v4 2/2] fpga: Add support for Lattice iCE40 FPGAs
From: Geert Uytterhoeven @ 2016-10-30 19:25 UTC (permalink / raw)
  To: Joel Holdsworth
  Cc: atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx,
	moritz.fischer-+aYTwkv1SeIAvxtiuMwx3w,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-spi
In-Reply-To: <1477776746-3678-2-git-send-email-joel-IJEoVVyKhCJXvIrf17iDB/XRex20P6io@public.gmane.org>

On Sat, Oct 29, 2016 at 11:32 PM, Joel Holdsworth
<joel-IJEoVVyKhCJXvIrf17iDB/XRex20P6io@public.gmane.org> wrote:
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/fpga/lattice-ice40-fpga-mgr.txt
> @@ -0,0 +1,23 @@

> +- cdone-gpio:          GPIO connected to CDONE pin
> +- creset_b-gpio:       GPIO connected to CRESET_B pin. Note that CRESET_B is
> +                       treated as an active-low output because the signal is
> +                       treated as an enable signal, rather than a reset. This
> +                       is necessary because the FPGA will enter Master SPI
> +                       mode and drive SCK with a clock signal, potentially
> +                       jamming other devices on the bus, unless CRESET_B is
> +                       held high until the firmware is loaded.

Plural, please, like in the previous version, cfr.
Documentation/devicetree/bindings/gpio/gpio.txt:
"GPIO properties should be named "[<name>-]gpios", with <name> being the purpose
 of this GPIO for the device. While a non-existent <name> is considered valid
 for compatibility reasons (resolving to the "gpios" property), it is
not allowed
 for new bindings. Also, GPIO properties named "[<name>-]gpio" are valid and old
 bindings use it, but are only supported for compatibility reasons and
should not
 be used for newer bindings since it has been deprecated."

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 07/10] staging: iio: tsl2583: convert illuminance0_calibscale sysfs attr to use iio_chan_spec
From: Brian Masney @ 2016-10-30 20:04 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	knaack.h-Mmb7MZpHnFY, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark.Rutland-5wv7dgnIgG8
In-Reply-To: <a0fc532f-f034-d817-00f6-a28ec60daf6a-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

On Sun, Oct 30, 2016 at 06:37:40PM +0000, Jonathan Cameron wrote:
> On 28/10/16 11:00, Brian Masney wrote:
> > The illuminance0_calibscale sysfs attribute is not currently created by
> > the IIO core. This patch adds the appropriate mask to iio_chan_spec,
> > along with the appropriate data handling in the read_raw() and
> > write_raw() functions, so that the sysfs attribute is created by the IIO
> > core. With this change, this sysfs entry will have its prefix changed
> > from illuminance0_ to in_illuminance_.
> > 
> > Signed-off-by: Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>
> Hmm. Could probably have computed the mean on the fly but fine as is.

Hi Jonathan,
   Thanks for your feedback. I'll have another patch set ready for you
by next weekend with my next round of cleanups to that driver. I'll
change this so that it calculates the mean on the fly unless I hear
otherwise from you.

Brian

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 07/10] staging: iio: tsl2583: convert illuminance0_calibscale sysfs attr to use iio_chan_spec
From: Jonathan Cameron @ 2016-10-30 20:29 UTC (permalink / raw)
  To: Brian Masney, Jonathan Cameron
  Cc: linux-iio-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	lars-Qo5EllUWu/uELgA04lAiVw, pmeerw-jW+XmwGofnusTnJN9+BGXg,
	knaack.h-Mmb7MZpHnFY, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	Mark.Rutland-5wv7dgnIgG8
In-Reply-To: <20161030200409.GA14808-+HJwobWzVoXN2ZRhSsNpr3G1qET/BF4J@public.gmane.org>



On 30 October 2016 20:04:09 GMT+00:00, Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org> wrote:
>On Sun, Oct 30, 2016 at 06:37:40PM +0000, Jonathan Cameron wrote:
>> On 28/10/16 11:00, Brian Masney wrote:
>> > The illuminance0_calibscale sysfs attribute is not currently
>created by
>> > the IIO core. This patch adds the appropriate mask to
>iio_chan_spec,
>> > along with the appropriate data handling in the read_raw() and
>> > write_raw() functions, so that the sysfs attribute is created by
>the IIO
>> > core. With this change, this sysfs entry will have its prefix
>changed
>> > from illuminance0_ to in_illuminance_.
>> > 
>> > Signed-off-by: Brian Masney <masneyb-1iNe0GrtECGEi8DpZVb4nw@public.gmane.org>
>> Hmm. Could probably have computed the mean on the fly but fine as is.
>
>Hi Jonathan,
>   Thanks for your feedback. I'll have another patch set ready for you
>by next weekend with my next round of cleanups to that driver. I'll
>change this so that it calculates the mean on the fly unless I hear
>otherwise from you.

I don't worry about the mean change. Not worth changing to my mind.

J
>
>Brian
>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-iio" in
>the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

^ permalink raw reply

* Re: [PATCH v5 1/7] drm: sunxi: Add a basic DRM driver for Allwinner DE2
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: devicetree, alsa-devel, Liam Girdwood, dri-devel, linux-sunxi,
	Mark Brown, Maxime Ripard, linux-arm-kernel
In-Reply-To: <20161025161441.6b248efe9229bd80e3f7a33c@free.fr>

On Tue, Oct 25, 2016 at 04:14:41PM +0200, Jean-Francois Moine wrote:
> On Mon, 24 Oct 2016 16:04:19 +0200
> Maxime Ripard <maxime.ripard@free-electrons.com> wrote:
> 
> > Hi,
> 
> Hi Maxime,
> 
> > On Fri, Oct 21, 2016 at 09:26:18AM +0200, Jean-Francois Moine wrote:
> > > Allwinner's recent SoCs, as A64, A83T and H3, contain a new display
> > > engine, DE2.
> > > This patch adds a DRM video driver for this device.
> > > 
> > > Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> > 
> > Output from checkpatch:
> > total: 0 errors, 20 warnings, 83 checks, 1799 lines checked
> > 
> > > ---
> > >  .../bindings/display/sunxi/sunxi-de2.txt           |  83 +++
> > >  drivers/gpu/drm/Kconfig                            |   2 +
> > >  drivers/gpu/drm/Makefile                           |   1 +
> > >  drivers/gpu/drm/sunxi/Kconfig                      |  21 +
> > >  drivers/gpu/drm/sunxi/Makefile                     |   7 +
> > >  drivers/gpu/drm/sunxi/de2_crtc.c                   | 475 +++++++++++++++++
> > >  drivers/gpu/drm/sunxi/de2_crtc.h                   |  63 +++
> > >  drivers/gpu/drm/sunxi/de2_de.c                     | 591 +++++++++++++++++++++
> > >  drivers/gpu/drm/sunxi/de2_drm.h                    |  47 ++
> > >  drivers/gpu/drm/sunxi/de2_drv.c                    | 378 +++++++++++++
> > >  drivers/gpu/drm/sunxi/de2_plane.c                  | 119 +++++
> > >  11 files changed, 1787 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt
> > >  create mode 100644 drivers/gpu/drm/sunxi/Kconfig
> > >  create mode 100644 drivers/gpu/drm/sunxi/Makefile
> > >  create mode 100644 drivers/gpu/drm/sunxi/de2_crtc.c
> > >  create mode 100644 drivers/gpu/drm/sunxi/de2_crtc.h
> > >  create mode 100644 drivers/gpu/drm/sunxi/de2_de.c
> > >  create mode 100644 drivers/gpu/drm/sunxi/de2_drm.h
> > >  create mode 100644 drivers/gpu/drm/sunxi/de2_drv.c
> > >  create mode 100644 drivers/gpu/drm/sunxi/de2_plane.c
> > > 
> > > diff --git a/Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt b/Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt
> > > new file mode 100644
> > > index 0000000..f9cd67a
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt

[...]

> > > +
> > > +- resets: phandle to the reset of the device
> > > +
> > > +- ports: phandle's to the LCD ports
> > 
> > Please use the OF graph.
> 
> These ports are references to the graph of nodes. See
> 	http://www.kernelhub.org/?msg=911825&p=2

I think what Maxime means is describe the DE to LCD connection with OF 
graph, not just a phandle.

Rob
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply

* Re: [PATCH v5 1/7] drm: sunxi: Add a basic DRM driver for Allwinner DE2
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: devicetree, alsa-devel, Liam Girdwood, dri-devel, linux-sunxi,
	Mark Brown, Maxime Ripard, linux-arm-kernel
In-Reply-To: <8afc5e020c5767face34fe3a9ab300ce9e67ba00.1477142934.git.moinejf@free.fr>

On Fri, Oct 21, 2016 at 09:26:18AM +0200, Jean-Francois Moine wrote:
> Allwinner's recent SoCs, as A64, A83T and H3, contain a new display
> engine, DE2.
> This patch adds a DRM video driver for this device.
> 
> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> ---
>  .../bindings/display/sunxi/sunxi-de2.txt           |  83 +++
>  drivers/gpu/drm/Kconfig                            |   2 +
>  drivers/gpu/drm/Makefile                           |   1 +
>  drivers/gpu/drm/sunxi/Kconfig                      |  21 +
>  drivers/gpu/drm/sunxi/Makefile                     |   7 +
>  drivers/gpu/drm/sunxi/de2_crtc.c                   | 475 +++++++++++++++++
>  drivers/gpu/drm/sunxi/de2_crtc.h                   |  63 +++
>  drivers/gpu/drm/sunxi/de2_de.c                     | 591 +++++++++++++++++++++
>  drivers/gpu/drm/sunxi/de2_drm.h                    |  47 ++
>  drivers/gpu/drm/sunxi/de2_drv.c                    | 378 +++++++++++++
>  drivers/gpu/drm/sunxi/de2_plane.c                  | 119 +++++
>  11 files changed, 1787 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt
>  create mode 100644 drivers/gpu/drm/sunxi/Kconfig
>  create mode 100644 drivers/gpu/drm/sunxi/Makefile
>  create mode 100644 drivers/gpu/drm/sunxi/de2_crtc.c
>  create mode 100644 drivers/gpu/drm/sunxi/de2_crtc.h
>  create mode 100644 drivers/gpu/drm/sunxi/de2_de.c
>  create mode 100644 drivers/gpu/drm/sunxi/de2_drm.h
>  create mode 100644 drivers/gpu/drm/sunxi/de2_drv.c
>  create mode 100644 drivers/gpu/drm/sunxi/de2_plane.c
> 
> diff --git a/Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt b/Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt
> new file mode 100644
> index 0000000..f9cd67a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/sunxi/sunxi-de2.txt

> +	hdmi: hdmi@01ee0000 {
> +		...
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		port {
> +			type = "video";

This is proposed, but not an accepted property. Please drop.

> +			hdmi_ep: endpoint {
> +				remote-endpoint = <&lcd0_ep>;
> +			};
> +		};
> +	};
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply

* Re: [PATCH v5 3/7] drm: sunxi: add DE2 HDMI support
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Jean-Francois Moine
  Cc: Dave Airlie, Liam Girdwood, Mark Brown, Maxime Ripard,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw
In-Reply-To: <36bd5454897c8ab77749e0294e4a4ecc2450dd12.1477142934.git.moinejf-GANU6spQydw@public.gmane.org>

On Fri, Oct 21, 2016 at 10:08:06AM +0200, Jean-Francois Moine wrote:
> This patch adds a HDMI driver to the DE2 based Allwinner's SoCs
> as A83T and H3.
> Audio and video are supported.
> 
> Signed-off-by: Jean-Francois Moine <moinejf-GANU6spQydw@public.gmane.org>
> ---
>  .../devicetree/bindings/display/sunxi/hdmi.txt     |  52 ++
>  drivers/gpu/drm/sunxi/Kconfig                      |   8 +
>  drivers/gpu/drm/sunxi/Makefile                     |   2 +
>  drivers/gpu/drm/sunxi/de2_hdmi.c                   | 396 +++++++++
>  drivers/gpu/drm/sunxi/de2_hdmi.h                   |  40 +
>  drivers/gpu/drm/sunxi/de2_hdmi_io.c                | 927 +++++++++++++++++++++
>  drivers/gpu/drm/sunxi/de2_hdmi_io.h                |  25 +
>  7 files changed, 1450 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/display/sunxi/hdmi.txt
>  create mode 100644 drivers/gpu/drm/sunxi/de2_hdmi.c
>  create mode 100644 drivers/gpu/drm/sunxi/de2_hdmi.h
>  create mode 100644 drivers/gpu/drm/sunxi/de2_hdmi_io.c
>  create mode 100644 drivers/gpu/drm/sunxi/de2_hdmi_io.h
> 
> diff --git a/Documentation/devicetree/bindings/display/sunxi/hdmi.txt b/Documentation/devicetree/bindings/display/sunxi/hdmi.txt
> new file mode 100644
> index 0000000..0558c07
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/display/sunxi/hdmi.txt
> @@ -0,0 +1,52 @@
> +Allwinner HDMI Transmitter
> +==========================
> +
> +The Allwinner HDMI transmitters are included in the SoCs.
> +They support audio and video.
> +
> +Required properties:
> + - #address-cells : should be <1>
> + - #size-cells : should be <0>
> + - compatible : should be
> +		"allwinner,sun8i-a83t-hdmi" or
> +		"allwinner,sun8i-h3-hdmi"
> + - clocks : phandles to the HDMI clocks as described in
> +	Documentation/devicetree/bindings/clock/clock-bindings.txt
> + - clock-names : must be
> +		"gate" : bus gate
> +		"clock" : streaming clock
> +		"ddc-clock" : DDC clock
> + - resets : One or two phandles to the HDMI resets
> + - reset-names : must be
> +		"hdmi0" and "hdmi1"
> +
> +Required nodes:
> + - port: Audio and video input port nodes with endpoint definitions
> +	as defined in Documentation/devicetree/bindings/graph.txt.

Please define which port number is audio and which is video.

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] net: stmmac: Add OXNAS Glue Driver
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: peppe.cavallaro-qxv4g6HH51o, alexandre.torgue-qxv4g6HH51o,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-oxnas-Xt5XgHjqiBU06sgRBLv0+0B+6BGkLq7r,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161021084445.24989-1-narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>

On Fri, Oct 21, 2016 at 10:44:45AM +0200, Neil Armstrong wrote:
> Add Synopsys Designware MAC Glue layer for the Oxford Semiconductor OX820.
> 
> Signed-off-by: Neil Armstrong <narmstrong-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>
> ---
>  .../devicetree/bindings/net/oxnas-dwmac.txt        |  44 +++++

It's preferred that bindings are a separate patch.

>  drivers/net/ethernet/stmicro/stmmac/Kconfig        |  11 ++
>  drivers/net/ethernet/stmicro/stmmac/Makefile       |   1 +
>  drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c  | 219 +++++++++++++++++++++
>  4 files changed, 275 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/oxnas-dwmac.txt
>  create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-oxnas.c
> 
> Changes since RFC at https://patchwork.kernel.org/patch/9387257 :
>  - Drop init/exit callbacks
>  - Implement proper remove and PM callback
>  - Call init from probe
>  - Disable/Unprepare clock if stmmac probe fails
> 
> diff --git a/Documentation/devicetree/bindings/net/oxnas-dwmac.txt b/Documentation/devicetree/bindings/net/oxnas-dwmac.txt
> new file mode 100644
> index 0000000..5d2696c
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/oxnas-dwmac.txt
> @@ -0,0 +1,44 @@
> +* Oxford Semiconductor OXNAS DWMAC Ethernet controller
> +
> +The device inherits all the properties of the dwmac/stmmac devices
> +described in the file stmmac.txt in the current directory with the
> +following changes.
> +
> +Required properties on all platforms:
> +
> +- compatible:	Depending on the platform this should be one of:
> +			- "oxsemi,ox820-dwmac"
> +		Additionally "snps,dwmac" and any applicable more
> +		detailed version number described in net/stmmac.txt
> +		should be used.

You should be explicit what version applies to ox820. "snps,dwmac" 
should probably be deprecated IMO. There are so many variations of DW 
h/w.

> +
> +- reg:	The first register range should be the one of the DWMAC
> +	controller.

This is worded like there's a 2nd range?

> +
> +- clocks: Should contain phandles to the following clocks
> +- clock-names:	Should contain the following:
> +		- "stmmaceth" - see stmmac.txt
> +		- "gmac" - peripheral gate clock
> +
> +- oxsemi,sys-ctrl: a phandle to the system controller syscon node
> +
> +Example :
> +
> +etha: ethernet@40400000 {
> +	compatible = "oxsemi,ox820-dwmac", "snps,dwmac";
> +	reg = <0x40400000 0x2000>;
> +	interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>,
> +		     <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>;
> +	interrupt-names = "macirq", "eth_wake_irq";
> +	mac-address = [000000000000]; /* Filled in by U-Boot */
> +	phy-mode = "rgmii";
> +
> +	clocks = <&stdclk CLK_820_ETHA>, <&gmacclk>;
> +	clock-names = "gmac", "stmmaceth";
> +	resets = <&reset RESET_MAC>;
> +
> +	/* Regmap for sys registers */
> +	oxsemi,sys-ctrl = <&sys>;
> +
> +	status = "disabled";
> +};
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v2 4/9] regulator: lp873x: Add support for populating input supply
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Lokesh Vutla
  Cc: Tony Lindgren, Linux OMAP Mailing List, Tero Kristo, Sekhar Nori,
	Nishanth Menon, Device Tree Mailing List, Linux ARM Mailing List,
	Lee Jones, Keerthy
In-Reply-To: <20161021103841.8044-5-lokeshvutla-l0cyMroinI0@public.gmane.org>

On Fri, Oct 21, 2016 at 04:08:36PM +0530, Lokesh Vutla wrote:
> In order to have a proper topology of regulators for a platform, each
> registering regulator needs to populate supply_name field for identifying
> its supply's name. Add supply_name field for lp873x regulators.
> 
> Cc: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Cc: Keerthy <j-keerthy-l0cyMroinI0@public.gmane.org>
> Signed-off-by: Lokesh Vutla <lokeshvutla-l0cyMroinI0@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/mfd/lp873x.txt | 8 ++++++++
>  drivers/regulator/lp873x-regulator.c             | 1 +
>  2 files changed, 9 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/lp873x.txt b/Documentation/devicetree/bindings/mfd/lp873x.txt
> index 52766c2..998837a 100644
> --- a/Documentation/devicetree/bindings/mfd/lp873x.txt
> +++ b/Documentation/devicetree/bindings/mfd/lp873x.txt
> @@ -7,6 +7,9 @@ Required properties:
>    - #gpio-cells:	Should be two.  The first cell is the pin number and
>  			the second cell is used to specify flags.
>  			See ../gpio/gpio.txt for more information.
> +  - xxx-in-supply:	Phandle to parent supply node of each regulator
> +			populated under regulators node. xxx should match
> +			the supply_name populated in driver.

The driver is irrelevant. This should reference a list in this document.

>    - regulators:	List of child nodes that specify the regulator
>  			initialization data.
>  Example:
> @@ -17,6 +20,11 @@ pmic: lp8733@60 {
>  	gpio-controller;
>  	#gpio-cells = <2>;
>  
> +	buck0-in-supply = <&vsys_3v3>;
> +	buck1-in-supply = <&vsys_3v3>;
> +	ldo0-in-supply = <&vsys_3v3>;
> +	ldo1-in-supply = <&vsys_3v3>;
> +
>  	regulators {
>  		lp8733_buck0: buck0 {
>  			regulator-name = "lp8733-buck0";
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH 1/3] Documentation: dt: Add TI SCI clock driver
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Tero Kristo
  Cc: linux-clk, mturquette, sboyd, ssantosh, nm, linux-arm-kernel,
	devicetree
In-Reply-To: <1477053961-27128-2-git-send-email-t-kristo@ti.com>

On Fri, Oct 21, 2016 at 03:45:59PM +0300, Tero Kristo wrote:
> Add a clock implementation, TI SCI clock, that will hook to the common
> clock framework, and allow each clock to be controlled via TI SCI
> protocol.
> 
> Signed-off-by: Tero Kristo <t-kristo@ti.com>
> ---
>  .../devicetree/bindings/clock/ti,sci-clk.txt       | 37 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 38 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/clock/ti,sci-clk.txt
> 
> diff --git a/Documentation/devicetree/bindings/clock/ti,sci-clk.txt b/Documentation/devicetree/bindings/clock/ti,sci-clk.txt
> new file mode 100644
> index 0000000..bfc3ca4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/clock/ti,sci-clk.txt
> @@ -0,0 +1,37 @@
> +Texas Instruments TI-SCI Clocks
> +===============================
> +
> +All clocks on Texas Instruments' SoCs that contain a System Controller,
> +are only controlled by this entity. Communication between a host processor
> +running an OS and the System Controller happens through a protocol known
> +as TI-SCI[1]. This clock implementation plugs into the common clock
> +framework and makes use of the TI-SCI protocol on clock API requests.
> +
> +[1] Documentation/devicetree/bindings/arm/keystone/ti,sci.txt
> +
> +Required properties:
> +-------------------
> +- compatible: Must be "ti,k2g-sci-clk"
> +- #clock-cells: Shall be 2.
> +  In clock consumers, this cell represents the device ID and clock ID
> +  exposed by the PM firmware. The assignments can be found in the header
> +  files <dt-bindings/genpd/<soc>.h> (which covers the device IDs) and
> +  <dt-bindings/clock/<soc>.h> (which covers the clock IDs), where <soc>
> +  is the SoC involved, for example 'k2g'.
> +
> +Examples:
> +--------
> +
> +pmmc: pmmc {
> +	compatible = "ti,k2g-sci";
> +
> +	k2g_clks: k2g_clks {

Use "clocks" for node name instead.
 
> +		compatible = "ti,k2g-sci-clk";

I'm starting to think all these child nodes for SCI are pointless. Is 
there any reason why the parent node can't be the clock provider (along 
with all the other providers it acks as)?

> +		#clock-cells = <2>;
> +	};
> +};
> +
> +uart0: serial@2530c00 {
> +	compatible = "ns16550a";
> +	clocks = <&k2g_clks K2G_DEV_UART0 0>;
> +};

^ permalink raw reply

* Re: [PATCH v4 01/23] reset: Add renesas,rst DT bindings
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: devicetree, Stephen Boyd, Michael Turquette, Magnus Damm,
	linux-kernel, linux-renesas-soc, Simon Horman, Philipp Zabel,
	linux-arm-kernel
In-Reply-To: <1477055857-17936-2-git-send-email-geert+renesas@glider.be>

On Fri, Oct 21, 2016 at 03:17:15PM +0200, Geert Uytterhoeven wrote:
> Add DT bindings for the Renesas R-Car Reset Controller (R-Car Gen1
> RESET/WDT and R-Car Gen2/Gen3 and RZ/G RST).
> 
> As the features provided by the hardware module differ a lot across the
> various SoC families and members, only SoC-specific compatible values
> are defined.
> 
> For now we use the RST only for providing access to the state of the
> mode pins, which is needed by the clock driver.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Acked-by: Magnus Damm <damm+renesas@opensource.se>
> Acked-by: Dirk Behme <dirk.behme@de.bosch.com>
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
> v4:
>   - Add Acked-by,
>   - Fix comma and period in list,
>   - Add RZ/G1M and RZ/G1E,
> 
> v3:
>   - Clarify current usage,
>   - Use "renesas,<soctype>-rst" instead of "renesas,rst-<soctype>",
>   - Drop "syscon" compatible value,
>   - Add R-Car M3-W,
>   - Add R-Car Gen1,
> 
> v2:
>   - Add Acked-by.
> ---
>  .../devicetree/bindings/reset/renesas,rst.txt      | 37 ++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/reset/renesas,rst.txt

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply

* Re: [PATCH] dt-bindings: video: exynos7-decon: Remove obsolete samsung,power-domain property
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: devicetree, linux-samsung-soc, Seung-Woo Kim, linux-kernel,
	dri-devel, Javier Martinez Canillas, Kyungmin Park, Kukjin Kim,
	linux-arm-kernel
In-Reply-To: <1477058754-13866-1-git-send-email-krzk@kernel.org>

On Fri, Oct 21, 2016 at 05:05:54PM +0300, Krzysztof Kozlowski wrote:
> The samsung,power-domain property is obsolete since commit 0da658704136
> ("ARM: dts: convert to generic power domain bindings for exynos DT").
> Replace it with generic one.
> 
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  Documentation/devicetree/bindings/display/exynos/exynos7-decon.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

You didn't send this To me, so I assume someone else is applying it.

Acked-by: Rob Herring <robh@kernel.org>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply

* Re: [RFC PATCH 01/13] pinctrl: meson: Add GXL pinctrl definitions
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: khilman, carlo, linus.walleij, linux-gpio, devicetree,
	linux-arm-kernel, linux-amlogic, linux-kernel, netdev
In-Reply-To: <1477060838-14164-2-git-send-email-narmstrong@baylibre.com>

On Fri, Oct 21, 2016 at 04:40:26PM +0200, Neil Armstrong wrote:
> Add support for the Amlogic Meson GXL SoC, this is a partially complete
> definition only based on the Amlogic Vendor tree.
> 
> This definition differs a lot from the GXBB and needs a separate entry.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  .../devicetree/bindings/pinctrl/meson,pinctrl.txt  |   2 +

Acked-by: Rob Herring <robh@kernel.org>

>  drivers/pinctrl/meson/Makefile                     |   3 +-
>  drivers/pinctrl/meson/pinctrl-meson-gxl.c          | 589 +++++++++++++++++++++
>  drivers/pinctrl/meson/pinctrl-meson.c              |   8 +
>  drivers/pinctrl/meson/pinctrl-meson.h              |   2 +
>  include/dt-bindings/gpio/meson-gxl-gpio.h          | 131 +++++
>  6 files changed, 734 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/pinctrl/meson/pinctrl-meson-gxl.c
>  create mode 100644 include/dt-bindings/gpio/meson-gxl-gpio.h

^ permalink raw reply

* Re: [PATCH 5/5] irqchip: st: Remove obsolete platforms from dt binding doc
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: patrice.chotard
  Cc: linux-arm-kernel, linux-kernel, kernel, devicetree, peter.griffin,
	lee.jones, tglx, jason, marc.zyngier
In-Reply-To: <1477065443-10668-6-git-send-email-patrice.chotard@st.com>

On Fri, Oct 21, 2016 at 05:57:23PM +0200, patrice.chotard@st.com wrote:
> From: Patrice Chotard <patrice.chotard@st.com>
> 
> STiH415/6 SoC support is being removed from the kernel.
> This patch updates the sti irchip and removes
> references to these obsolete platforms.
> 
> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
> Cc: <tglx@linutronix.de>
> Cc: <jason@lakedaemon.net>
> Cc: <marc.zyngier@arm.com>
> ---
>  .../devicetree/bindings/interrupt-controller/st,sti-irq-syscfg.txt  | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply

* Re: [PATCH v2] sh-sci: document R8A7743/5 support
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, mark.rutland-5wv7dgnIgG8,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4258682.UW6HhKP1CC-gHKXc3Y1Z8zGSmamagVegGFoWSdPRAKMAL8bYrjMMd8@public.gmane.org>

On Fri, Oct 21, 2016 at 11:00:43PM +0300, Sergei Shtylyov wrote:
> Renesas RZ/G SoC also have the SCIF, SCIFA, SCIFB, and HSCIF ports and
> they  seem compatible with the R-Car gen2 SoC  in this respect...
> Document RZ/G1[ME] (also known as R8A774[35]) SoC bindings.
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
> Acked-by: Simon Horman <horms+renesas-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>
> Acked-by: Geert Uytterhoeven <geert+renesas-gXvu3+zWzMSzQB+pC5nmwQ@public.gmane.org>
> 
> ---
> This patch is against the 'tty-next' branch of GregKH's 'tty.git' repo.
> 
> Changes in version 2:
> - removed the RZ/G  family specific bindings, renamed the patch;
> - added Simon's and Geert's ACKs.
> 
>  Documentation/devicetree/bindings/serial/renesas,sci-serial.txt |    8 ++++++++
>  1 file changed, 8 insertions(+)

Acked-by: Rob Herring <robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH v6] mwifiex: parse device tree node for PCIe
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Rajat Jain
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Xinming Hu, Amitkumar Karwar,
	Brian Norris, Kalle Valo, rajatxjain-Re5JQEeQqe8AvxtiuMwx3w
In-Reply-To: <1477084869-15612-1-git-send-email-rajatja-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>

On Fri, Oct 21, 2016 at 02:21:09PM -0700, Rajat Jain wrote:
> From: Xinming Hu <huxm-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> 
> This patch derives device tree node from pcie bus layer framework, and
> fixes a minor memory leak in mwifiex_pcie_probe() (in failure path).
> Device tree bindings file has been renamed(marvell-sd8xxx.txt ->
> marvell-8xxx.txt) to accommodate PCIe changes.
> 
> Signed-off-by: Xinming Hu <huxm-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Amitkumar Karwar <akarwar-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>
> Signed-off-by: Rajat Jain <rajatja-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
> Reviewed-by: Brian Norris <briannorris-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
> ---
> v2: Included vendor and product IDs in compatible strings for PCIe
> chipsets(Rob Herring)
> v3: Patch is created using -M option so that it will only include diff of
> original and renamed files(Rob Herring)
> Resend v3: Resending the patch because I missed to include device tree mailing
> while sending v3.
> v4: Fix error handling, also move-on even if no device tree node is present.
> v5: Update commit log to include memory leak, return -EINVAL instead of -1.
> v6: Remove an unnecessary error print, fix typo in commit log
> 
>  .../{marvell-sd8xxx.txt => marvell-8xxx.txt}       |  8 +++--
>  drivers/net/wireless/marvell/mwifiex/pcie.c        | 36 +++++++++++++++++++---
>  drivers/net/wireless/marvell/mwifiex/sta_cmd.c     |  3 +-
>  3 files changed, 39 insertions(+), 8 deletions(-)
>  rename Documentation/devicetree/bindings/net/wireless/{marvell-sd8xxx.txt => marvell-8xxx.txt} (91%)
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt b/Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt
> similarity index 91%
> rename from Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
> rename to Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt
> index c421aba..dfe5f8e 100644
> --- a/Documentation/devicetree/bindings/net/wireless/marvell-sd8xxx.txt
> +++ b/Documentation/devicetree/bindings/net/wireless/marvell-8xxx.txt
> @@ -1,8 +1,8 @@
> -Marvell 8897/8997 (sd8897/sd8997) SDIO devices
> +Marvell 8897/8997 (sd8897/sd8997/pcie8997) SDIO/PCIE devices
>  ------
>  
> -This node provides properties for controlling the marvell sdio wireless device.
> -The node is expected to be specified as a child node to the SDIO controller that
> +This node provides properties for controlling the marvell sdio/pcie wireless device.

s/marvell/Marvell/
s/sdio\/pcie/SDIO\/PCIE/

> +The node is expected to be specified as a child node to the SDIO/PCIE controller that
>  connects the device to the system.
>  
>  Required properties:
> @@ -10,6 +10,8 @@ Required properties:
>    - compatible : should be one of the following:
>  	* "marvell,sd8897"
>  	* "marvell,sd8997"
> +	* "pci11ab,2b42"
> +	* "pci1b4b,2b42"

I think I already said this, but you have the vendor and product IDs 
reversed.

Rob

^ permalink raw reply

* Re: [PATCH v2 3/3] clocksource: Add clockevent support to NPS400 driver
From: Rob Herring @ 2016-10-30 20:41 UTC (permalink / raw)
  To: Noam Camus; +Cc: mark.rutland, daniel.lezcano, tglx, devicetree, linux-kernel
In-Reply-To: <1477224748-25223-4-git-send-email-noamca@mellanox.com>

On Sun, Oct 23, 2016 at 03:12:28PM +0300, Noam Camus wrote:
> From: Noam Camus <noamca@mellanox.com>
> 
> Till now we used clockevent from generic ARC driver.
> This was enough as long as we worked with simple multicore SoC.
> When we are working with multithread SoC each HW thread can be
> scheduled to receive timer interrupt using timer mask register.
> This patch will provide a way to control clock events per HW thread.
> 
> The design idea is that for each core there is dedicated regirtser
> (TSI) serving all 16 HW threads.
> The register is a bitmask with one bit for each HW thread.
> When HW thread wants that next expiration of timer interrupt will
> hit it then the proper bit should be set in this dedicated register.
> When timer expires all HW threads within this core which their bit
> is set at the TSI register will be interrupted.
> 
> Driver can be used from device tree by:
> compatible = "ezchip,nps400-timer0" <-- for clocksource
> compatible = "ezchip,nps400-timer1" <-- for clockevent
> 
> Note that name convention for timer0/timer1 was taken from legacy
> ARC design. This design is our base before adding HW threads.
> 
> Signed-off-by: Noam Camus <noamca@mellanox.com>
> 
> Change-Id: Ib351e6fc7a6b691293040ae655f202f3cc2c1298
> ---
>  .../bindings/timer/ezchip,nps400-timer.txt         |   15 --
>  .../bindings/timer/ezchip,nps400-timer0.txt        |   17 ++
>  .../bindings/timer/ezchip,nps400-timer1.txt        |   15 ++

For the binding,

Acked-by: Rob Herring <robh@kernel.org>

However, one issue below...

>  drivers/clocksource/timer-nps.c                    |  220 +++++++++++++++++++-
>  include/linux/cpuhotplug.h                         |    1 +
>  5 files changed, 248 insertions(+), 20 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/timer/ezchip,nps400-timer.txt
>  create mode 100644 Documentation/devicetree/bindings/timer/ezchip,nps400-timer0.txt
>  create mode 100644 Documentation/devicetree/bindings/timer/ezchip,nps400-timer1.txt


> diff --git a/drivers/clocksource/timer-nps.c b/drivers/clocksource/timer-nps.c
> index 6156e54..0757328 100644
> --- a/drivers/clocksource/timer-nps.c
> +++ b/drivers/clocksource/timer-nps.c
> @@ -46,7 +46,7 @@
>  /* This array is per cluster of CPUs (Each NPS400 cluster got 256 CPUs) */
>  static void *nps_msu_reg_low_addr[NPS_CLUSTER_NUM] __read_mostly;
>  
> -static unsigned long nps_timer_rate;
> +static unsigned long nps_timer1_freq;
>  static int nps_get_timer_clk(struct device_node *node,
>  			     unsigned long *timer_freq,
>  			     struct clk *clk)
> @@ -87,10 +87,10 @@ static int __init nps_setup_clocksource(struct device_node *node)
>  			nps_host_reg((cluster << NPS_CLUSTER_OFFSET),
>  				 NPS_MSU_BLKID, NPS_MSU_TICK_LOW);
>  
> -	nps_get_timer_clk(node, &nps_timer_rate, clk);
> +	nps_get_timer_clk(node, &nps_timer1_freq, clk);
>  
> -	ret = clocksource_mmio_init(nps_msu_reg_low_addr, "EZnps-tick",
> -				    nps_timer_rate, 301, 32, nps_clksrc_read);
> +	ret = clocksource_mmio_init(nps_msu_reg_low_addr, "nps-tick",
> +				    nps_timer1_freq, 301, 32, nps_clksrc_read);
>  	if (ret) {
>  		pr_err("Couldn't register clock source.\n");
>  		clk_disable_unprepare(clk);
> @@ -99,5 +99,215 @@ static int __init nps_setup_clocksource(struct device_node *node)
>  	return ret;
>  }
>  
> -CLOCKSOURCE_OF_DECLARE(ezchip_nps400_clksrc, "ezchip,nps400-timer",
> +CLOCKSOURCE_OF_DECLARE(ezchip_nps400_clksrc, "ezchip,nps400-timer1",
>  		       nps_setup_clocksource);

You should keep the old string here for backwards compatiblity.

Rob

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox