Re: [PATCH] ALSA: aloop: Mark paused device as inactive
On 03/26/2018 04:43 PM, Takashi Iwai wrote: > On Mon, 26 Mar 2018 07:24:49 +0200, > Robert Rosengren wrote: >> >> Show paused ALSA aloop device as inactive, i.e. the control >> "PCM Slave Active" set as false. Notification sent upon state change. >> >> This makes it possible for client capturing from aloop device to know if >> data is expected. Without it the client expects data even if playback >> is paused. >> >> Signed-off-by: Robert Rosengren <robe...@axis.com> > > The code change looks good, but just to be sure: > you've submitted from the address robert.roseng...@axis.com that is > different from the sign-off robe...@axis.com. Is this intentional? > The former is recorded as the author in git history. > > > thanks, > > Takashi > Sorry for the confusion. It is not intentional to use different though both are valid, apparently I have used the longer one in earlier patches to kernel so please change: Signed-off-by: Robert Rosengren <robert.roseng...@axis.com> Thanks for letting me know! Robert
Re: [PATCH] ALSA: aloop: Mark paused device as inactive
On 03/26/2018 04:43 PM, Takashi Iwai wrote: > On Mon, 26 Mar 2018 07:24:49 +0200, > Robert Rosengren wrote: >> >> Show paused ALSA aloop device as inactive, i.e. the control >> "PCM Slave Active" set as false. Notification sent upon state change. >> >> This makes it possible for client capturing from aloop device to know if >> data is expected. Without it the client expects data even if playback >> is paused. >> >> Signed-off-by: Robert Rosengren > > The code change looks good, but just to be sure: > you've submitted from the address robert.roseng...@axis.com that is > different from the sign-off robe...@axis.com. Is this intentional? > The former is recorded as the author in git history. > > > thanks, > > Takashi > Sorry for the confusion. It is not intentional to use different though both are valid, apparently I have used the longer one in earlier patches to kernel so please change: Signed-off-by: Robert Rosengren Thanks for letting me know! Robert
[PATCH] ALSA: aloop: Mark paused device as inactive
Show paused ALSA aloop device as inactive, i.e. the control "PCM Slave Active" set as false. Notification sent upon state change. This makes it possible for client capturing from aloop device to know if data is expected. Without it the client expects data even if playback is paused. Signed-off-by: Robert Rosengren <robe...@axis.com> --- sound/drivers/aloop.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 0333143a1fa7..5404ab11132d 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -291,6 +291,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) cable->pause |= stream; loopback_timer_stop(dpcm); spin_unlock(>lock); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + loopback_active_notify(dpcm); break; case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_RESUME: @@ -299,6 +301,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) cable->pause &= ~stream; loopback_timer_start(dpcm); spin_unlock(>lock); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + loopback_active_notify(dpcm); break; default: return -EINVAL; @@ -879,9 +883,11 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol, [kcontrol->id.subdevice][kcontrol->id.device ^ 1]; unsigned int val = 0; - if (cable != NULL) - val = (cable->running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? - 1 : 0; + if (cable != NULL) { + unsigned int running = cable->running ^ cable->pause; + + val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0; + } ucontrol->value.integer.value[0] = val; return 0; } -- 2.11.0
[PATCH] ALSA: aloop: Mark paused device as inactive
Show paused ALSA aloop device as inactive, i.e. the control "PCM Slave Active" set as false. Notification sent upon state change. This makes it possible for client capturing from aloop device to know if data is expected. Without it the client expects data even if playback is paused. Signed-off-by: Robert Rosengren --- sound/drivers/aloop.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 0333143a1fa7..5404ab11132d 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -291,6 +291,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) cable->pause |= stream; loopback_timer_stop(dpcm); spin_unlock(>lock); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + loopback_active_notify(dpcm); break; case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_RESUME: @@ -299,6 +301,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd) cable->pause &= ~stream; loopback_timer_start(dpcm); spin_unlock(>lock); + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + loopback_active_notify(dpcm); break; default: return -EINVAL; @@ -879,9 +883,11 @@ static int loopback_active_get(struct snd_kcontrol *kcontrol, [kcontrol->id.subdevice][kcontrol->id.device ^ 1]; unsigned int val = 0; - if (cable != NULL) - val = (cable->running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? - 1 : 0; + if (cable != NULL) { + unsigned int running = cable->running ^ cable->pause; + + val = (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) ? 1 : 0; + } ucontrol->value.integer.value[0] = val; return 0; } -- 2.11.0
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/31/2015 09:11 PM, Guenter Roeck wrote: On 01/29/2015 11:30 AM, Guenter Roeck wrote: On Thu, Jan 29, 2015 at 01:07:10PM +0100, Robert Rosengren wrote: Is your hardware big endian or little endian ? CONFIG_CPU_LITTLE_ENDIAN=y Hi Robert, I have another question: What is your i2c controller type ? Robert, I now tried both 3.15 and 3.19-rc6. Both kernels require the byte swap code. Agrees, no difference for me when trying with 3.15 and 3.18 version. The i2c is a bit-bang driver, specific for the hardware I am running on. The only reason I can imagine why you don't need it in your code would be that your i2c controller does not support i2c functionality but only SMBus. This would be the case, for example, with the i801 controller. So it would be quite helpful to know which controller your system uses to access the ads7828. Thanks, Guenter I tried your latest patch set (the 3 patches submitted last night) and it works fine for me. Great work! Please change my Cc-tag in the patches to Reviewed-by or Tested-by (I have done both, but one tag is enough). Thanks :-) BR, Robert -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/31/2015 09:11 PM, Guenter Roeck wrote: On 01/29/2015 11:30 AM, Guenter Roeck wrote: On Thu, Jan 29, 2015 at 01:07:10PM +0100, Robert Rosengren wrote: Is your hardware big endian or little endian ? CONFIG_CPU_LITTLE_ENDIAN=y Hi Robert, I have another question: What is your i2c controller type ? Robert, I now tried both 3.15 and 3.19-rc6. Both kernels require the byte swap code. Agrees, no difference for me when trying with 3.15 and 3.18 version. The i2c is a bit-bang driver, specific for the hardware I am running on. The only reason I can imagine why you don't need it in your code would be that your i2c controller does not support i2c functionality but only SMBus. This would be the case, for example, with the i801 controller. So it would be quite helpful to know which controller your system uses to access the ads7828. Thanks, Guenter I tried your latest patch set (the 3 patches submitted last night) and it works fine for me. Great work! Please change my Cc-tag in the patches to Reviewed-by or Tested-by (I have done both, but one tag is enough). Thanks :-) BR, Robert -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/29/2015 08:05 AM, Guenter Roeck wrote: Ah, don't bother then. I should hopefully get the samples in a couple of days. i2cdump was easily built, so here is the output: 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f 00: 1301 1301 1301 1301 1301 1301 1301 1301 08: 4101 6901 6a01 6901 6901 6901 6901 6901 10: 0200 0100 0100 0100 0100 0100 0100 0100 18: 0100 0100 0100 0100 0100 0100 0100 0100 20: 0200 0100 0100 0100 0100 0100 0100 0100 28: 0100 0100 0100 0100 0100 0100 0100 0100 30: 0200 0100 0100 0100 0100 0100 0100 0100 38: 0100 0100 0100 0100 0100 0100 0100 0100 40: 48: 50: 0200 0100 0100 0100 0100 0100 0100 0100 58: 0100 0100 0100 0100 0100 0100 0200 0100 60: 0100 0100 0100 0100 0100 0100 0100 0100 68: 0100 0100 0100 0100 0100 0100 0100 0100 70: 0200 0100 0100 0100 0100 0100 0100 0100 78: 0100 0100 0100 0100 0100 0100 0100 0100 80: 6501 2401 1701 1401 1301 1301 1301 1301 88: 4201 6901 6901 6901 6901 6901 6901 6901 90: 0200 0100 0100 0100 0100 0100 0100 0100 98: 0100 0100 0100 0100 0100 0100 0100 0100 a0: 6701 2501 1901 1601 1501 1501 1501 1501 a8: 4401 6c01 6c01 6c01 6c01 6c01 6c01 6c01 b0: 0200 0100 0100 0100 0100 0100 0100 0100 b8: 0100 0100 0100 0100 0100 0100 0100 0100 c0: 0200 0100 0100 0100 0100 0100 0100 0100 c8: 0100 0100 0100 0100 0100 0100 0100 0100 d0: 0200 0100 0100 0100 0100 0100 0100 0100 d8: 0100 0100 0100 0100 0100 0100 0100 0100 e0: 6701 2801 1b01 1701 1601 1501 1501 1501 e8: 4401 6c01 6c01 6c01 6c01 6c01 6c01 6c01 f0: 0200 0100 0100 0100 0100 0100 0100 0100 f8: 0100 0100 0100 0100 0100 0100 0100 0100 I checked the value at 0x84 (channel 0, and using single-ended and external reference). I got 222 when reading from corresponding sysfs, and 0x131 * lsb_resolution (806) / 1000 is 222 in decimal. So it seems as data above is correct. Is the data what you expected? Is your hardware big endian or little endian ? CONFIG_CPU_LITTLE_ENDIAN=y BR, Robert -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/29/2015 08:05 AM, Guenter Roeck wrote: Ah, don't bother then. I should hopefully get the samples in a couple of days. i2cdump was easily built, so here is the output: 0,8 1,9 2,a 3,b 4,c 5,d 6,e 7,f 00: 1301 1301 1301 1301 1301 1301 1301 1301 08: 4101 6901 6a01 6901 6901 6901 6901 6901 10: 0200 0100 0100 0100 0100 0100 0100 0100 18: 0100 0100 0100 0100 0100 0100 0100 0100 20: 0200 0100 0100 0100 0100 0100 0100 0100 28: 0100 0100 0100 0100 0100 0100 0100 0100 30: 0200 0100 0100 0100 0100 0100 0100 0100 38: 0100 0100 0100 0100 0100 0100 0100 0100 40: 48: 50: 0200 0100 0100 0100 0100 0100 0100 0100 58: 0100 0100 0100 0100 0100 0100 0200 0100 60: 0100 0100 0100 0100 0100 0100 0100 0100 68: 0100 0100 0100 0100 0100 0100 0100 0100 70: 0200 0100 0100 0100 0100 0100 0100 0100 78: 0100 0100 0100 0100 0100 0100 0100 0100 80: 6501 2401 1701 1401 1301 1301 1301 1301 88: 4201 6901 6901 6901 6901 6901 6901 6901 90: 0200 0100 0100 0100 0100 0100 0100 0100 98: 0100 0100 0100 0100 0100 0100 0100 0100 a0: 6701 2501 1901 1601 1501 1501 1501 1501 a8: 4401 6c01 6c01 6c01 6c01 6c01 6c01 6c01 b0: 0200 0100 0100 0100 0100 0100 0100 0100 b8: 0100 0100 0100 0100 0100 0100 0100 0100 c0: 0200 0100 0100 0100 0100 0100 0100 0100 c8: 0100 0100 0100 0100 0100 0100 0100 0100 d0: 0200 0100 0100 0100 0100 0100 0100 0100 d8: 0100 0100 0100 0100 0100 0100 0100 0100 e0: 6701 2801 1b01 1701 1601 1501 1501 1501 e8: 4401 6c01 6c01 6c01 6c01 6c01 6c01 6c01 f0: 0200 0100 0100 0100 0100 0100 0100 0100 f8: 0100 0100 0100 0100 0100 0100 0100 0100 I checked the value at 0x84 (channel 0, and using single-ended and external reference). I got 222 when reading from corresponding sysfs, and 0x131 * lsb_resolution (806) / 1000 is 222 in decimal. So it seems as data above is correct. Is the data what you expected? Is your hardware big endian or little endian ? CONFIG_CPU_LITTLE_ENDIAN=y BR, Robert -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/28/2015 03:50 PM, Guenter Roeck wrote: Can you possibly send me the output from i2cdump ? That might help figuring out what is going on. I don't have i2cdump (I suppose that you mean the lm-sensors tool) available for my hardware. I'll give it a go to compile it... BR, Robert -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/28/2015 03:50 PM, Guenter Roeck wrote: Can you possibly send me the output from i2cdump ? That might help figuring out what is going on. I don't have i2cdump (I suppose that you mean the lm-sensors tool) available for my hardware. I'll give it a go to compile it... BR, Robert -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
My previous mail got blocked by mailing lists for some reasons, so trying once more. I apologize if spamming. On 01/28/2015 07:18 AM, Robert Rosengren wrote: On 01/28/2015 05:06 AM, Guenter Roeck wrote: On 01/27/2015 02:34 PM, Jean Delvare wrote: >On Tue, 27 Jan 2015 12:05:53 -0800, Guenter Roeck wrote: >>On Tue, Jan 27, 2015 at 08:54:34PM +0100, Robert Rosengren wrote: >>>Guenter and Jean, >>> >>>To sum up, my problems was related my kernel and hardware configuration, and it now works. Many thanks for your input! >>> >>>However, the values retrieved from hwmon sysfs is not the same as before the regmap patch. Guenter, the byte swap for the regval retrieved by regmap_read. In what order is the bits returned from that function, because it seems as if I disabled that code I get values as I expect (i.e. before the regmap patch). >>> >>Trying to understand. Are you saying everything works as expected >>if you keep byte_swap set to false ? Yes it works as expected, i.e. I can get values from sysfs. The problems I experienced was actually due to moving from an old ads7828-implementation where specific i2c addresses where scanned from the driver, and I first missed to set the correct i2c address for the new driver in the board info. >> >>That might well be, though it might mean that regmap has a bug >>in how it treats i2c word read operations. I'll have to look into it >>some more. > >Remember that SMBus specifies that the LSB comes first (and i2c-core >implement things that way) while real I2C devices typically send the MSB >first. This has always caused confusion. This is why a lot of drivers >need byte-swapping. > regmap specifies "normal" i2c accesses as MSB first. When SMBus accesses are used, it specifies LSB first. I guess that means that regmap assumes the more common case of MSB first, meaning the driver would not need a byte swap since the chip reports data with MSB first. I just hope I interpret it correctly this time. There is also a configuration flag "val_format_endian" which can be set to REGMAP_ENDIAN_BIG or REGMAP_ENDIAN_LITTLE. Maybe that can be used as well if needed. Either case I'll wait for the samples before I send an updated version of the patch. Guenter I tested the driver on 3.15 version of the kernel. Having looked in the git log of regmap.c and regmap-i2c.c, there has been some endianess-related patches going into the kernel in newer versions. Maybe that is the reason for me seeing this problem? I will try to look into that further. I my test I only disabled following two lines of code + if (data->byte_swap) + regval = swab16(regval); BR, Robert -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
Guenter and Jean, To sum up, my problems was related my kernel and hardware configuration, and it now works. Many thanks for your input! However, the values retrieved from hwmon sysfs is not the same as before the regmap patch. Guenter, the byte swap for the regval retrieved by regmap_read. In what order is the bits returned from that function, because it seems as if I disabled that code I get values as I expect (i.e. before the regmap patch). BR, Robert > On 01/26/2015 11:59 PM, Robert Rosengren wrote: >> On 01/16/2015 07:30 PM, Guenter Roeck wrote: >>> I sent a couple of patches a minute ago which should take care of the issue. >>> Would be great if you can test it. >> I applied the v2 versions of the patches for a quick test, but it was not >> successful. Haven't done any further investigation on what the problem might >> be, but when trying to read the sysfs driver I get "read error: No such >> device or address". >> >> The sysfs path have moved with the REGMAP settings, from >> /sys/bus/i2c/devices//in0_input to >> /sys/bus/i2c/devices//hwmon/hwmon0/in0_input. >> >> Any ideas? Haven't had REGMAP configured in my kernel earlier, might it be >> some specific configuration I miss? >> > > Did you configure REGMAP ? That would now be necessary. > The "official" sysfs path would be /sys/class/hwmon/hwmonX (hwmon0 in your > case). > > Guenter -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/16/2015 07:30 PM, Guenter Roeck wrote: I sent a couple of patches a minute ago which should take care of the issue. Would be great if you can test it. I applied the v2 versions of the patches for a quick test, but it was not successful. Haven't done any further investigation on what the problem might be, but when trying to read the sysfs driver I get "read error: No such device or address". The sysfs path have moved with the REGMAP settings, from /sys/bus/i2c/devices//in0_input to /sys/bus/i2c/devices//hwmon/hwmon0/in0_input. Any ideas? Haven't had REGMAP configured in my kernel earlier, might it be some specific configuration I miss? BR, Robert -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On 01/16/2015 07:30 PM, Guenter Roeck wrote: I sent a couple of patches a minute ago which should take care of the issue. Would be great if you can test it. I applied the v2 versions of the patches for a quick test, but it was not successful. Haven't done any further investigation on what the problem might be, but when trying to read the sysfs driver I get read error: No such device or address. The sysfs path have moved with the REGMAP settings, from /sys/bus/i2c/devices/x/in0_input to /sys/bus/i2c/devices/x/hwmon/hwmon0/in0_input. Any ideas? Haven't had REGMAP configured in my kernel earlier, might it be some specific configuration I miss? BR, Robert -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
Guenter and Jean, To sum up, my problems was related my kernel and hardware configuration, and it now works. Many thanks for your input! However, the values retrieved from hwmon sysfs is not the same as before the regmap patch. Guenter, the byte swap for the regval retrieved by regmap_read. In what order is the bits returned from that function, because it seems as if I disabled that code I get values as I expect (i.e. before the regmap patch). BR, Robert On 01/26/2015 11:59 PM, Robert Rosengren wrote: On 01/16/2015 07:30 PM, Guenter Roeck wrote: I sent a couple of patches a minute ago which should take care of the issue. Would be great if you can test it. I applied the v2 versions of the patches for a quick test, but it was not successful. Haven't done any further investigation on what the problem might be, but when trying to read the sysfs driver I get read error: No such device or address. The sysfs path have moved with the REGMAP settings, from /sys/bus/i2c/devices/x/in0_input to /sys/bus/i2c/devices/x/hwmon/hwmon0/in0_input. Any ideas? Haven't had REGMAP configured in my kernel earlier, might it be some specific configuration I miss? Did you configure REGMAP ? That would now be necessary. The official sysfs path would be /sys/class/hwmon/hwmonX (hwmon0 in your case). Guenter -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
My previous mail got blocked by mailing lists for some reasons, so trying once more. I apologize if spamming. On 01/28/2015 07:18 AM, Robert Rosengren wrote: On 01/28/2015 05:06 AM, Guenter Roeck wrote: On 01/27/2015 02:34 PM, Jean Delvare wrote: On Tue, 27 Jan 2015 12:05:53 -0800, Guenter Roeck wrote: On Tue, Jan 27, 2015 at 08:54:34PM +0100, Robert Rosengren wrote: Guenter and Jean, To sum up, my problems was related my kernel and hardware configuration, and it now works. Many thanks for your input! However, the values retrieved from hwmon sysfs is not the same as before the regmap patch. Guenter, the byte swap for the regval retrieved by regmap_read. In what order is the bits returned from that function, because it seems as if I disabled that code I get values as I expect (i.e. before the regmap patch). Trying to understand. Are you saying everything works as expected if you keep byte_swap set to false ? Yes it works as expected, i.e. I can get values from sysfs. The problems I experienced was actually due to moving from an old ads7828-implementation where specific i2c addresses where scanned from the driver, and I first missed to set the correct i2c address for the new driver in the board info. That might well be, though it might mean that regmap has a bug in how it treats i2c word read operations. I'll have to look into it some more. Remember that SMBus specifies that the LSB comes first (and i2c-core implement things that way) while real I2C devices typically send the MSB first. This has always caused confusion. This is why a lot of drivers need byte-swapping. regmap specifies normal i2c accesses as MSB first. When SMBus accesses are used, it specifies LSB first. I guess that means that regmap assumes the more common case of MSB first, meaning the driver would not need a byte swap since the chip reports data with MSB first. I just hope I interpret it correctly this time. There is also a configuration flag val_format_endian which can be set to REGMAP_ENDIAN_BIG or REGMAP_ENDIAN_LITTLE. Maybe that can be used as well if needed. Either case I'll wait for the samples before I send an updated version of the patch. Guenter I tested the driver on 3.15 version of the kernel. Having looked in the git log of regmap.c and regmap-i2c.c, there has been some endianess-related patches going into the kernel in newer versions. Maybe that is the reason for me seeing this problem? I will try to look into that further. I my test I only disabled following two lines of code + if (data-byte_swap) + regval = swab16(regval); BR, Robert -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
SV: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
> On Fri, Jan 16, 2015 at 06:52:06AM -0800, Guenter Roeck wrote: > > I am basically fine with the patch, though I would prefer replacing > > the entire update handling and chip access with regmap. Would you be > > interested in doing that ? > > > I sent a couple of patches a minute ago which should take care of the issue. > Would be great if you can test it. > > Thanks, > Guenter OK, great. I will look into your patch next week, since I'm currently out of office. BR, Robert-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
SV: [lm-sensors] [PATCH] hwmon: (ads7828) Make sample interval configurable
On Fri, Jan 16, 2015 at 06:52:06AM -0800, Guenter Roeck wrote: I am basically fine with the patch, though I would prefer replacing the entire update handling and chip access with regmap. Would you be interested in doing that ? I sent a couple of patches a minute ago which should take care of the issue. Would be great if you can test it. Thanks, Guenter OK, great. I will look into your patch next week, since I'm currently out of office. BR, Robert-- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] hwmon: (ads7828) Make sample interval configurable
The default sample interval may be too slow for certain clients. This patch makes it configurable via the platform_data. Signed-off-by: Robert Rosengren Signed-off-by: Johan Adolfsson --- drivers/hwmon/ads7828.c | 11 ++- include/linux/platform_data/ads7828.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index a622d40..fd5eabf7 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c @@ -45,6 +45,9 @@ #define ADS7828_EXT_VREF_MV_MIN50 /* External vref min value 0.05V */ #define ADS7828_EXT_VREF_MV_MAX5250/* External vref max value 5.25V */ +/* Default sample interval */ +#define ADS7828_SAMPLE_INTERVAL (HZ + HZ / 2) + /* List of supported devices */ enum ads7828_chips { ads7828, ads7830 }; @@ -58,6 +61,7 @@ struct ads7828_data { bool diff_input;/* Differential input */ bool ext_vref; /* External voltage reference */ unsigned int vref_mv; /* voltage reference value */ + unsigned int sample_interval; /* sample interval */ u8 cmd_byte;/* Command byte without channel bits */ unsigned int lsb_resol; /* Resolution of the ADC sample LSB */ s32 (*read_channel)(const struct i2c_client *client, u8 command); @@ -77,7 +81,7 @@ static struct ads7828_data *ads7828_update_device(struct device *dev) mutex_lock(>update_lock); - if (time_after(jiffies, data->last_updated + HZ + HZ / 2) + if (time_after(jiffies, data->last_updated + data->sample_interval) || !data->valid) { unsigned int ch; dev_dbg(>dev, "Starting ads7828 update\n"); @@ -147,6 +151,8 @@ static int ads7828_probe(struct i2c_client *client, data->ext_vref = pdata->ext_vref; if (data->ext_vref) data->vref_mv = pdata->vref_mv; + if (pdata->sample_interval) + data->sample_interval = pdata->sample_interval; } /* Bound Vref with min/max values if it was provided */ @@ -157,6 +163,9 @@ static int ads7828_probe(struct i2c_client *client, else data->vref_mv = ADS7828_INT_VREF_MV; + if (!data->sample_interval) + data->sample_interval = ADS7828_SAMPLE_INTERVAL; + /* ADS7828 uses 12-bit samples, while ADS7830 is 8-bit */ if (id->driver_data == ads7828) { data->lsb_resol = DIV_ROUND_CLOSEST(data->vref_mv * 1000, 4096); diff --git a/include/linux/platform_data/ads7828.h b/include/linux/platform_data/ads7828.h index 3245f45..bdae0bb 100644 --- a/include/linux/platform_data/ads7828.h +++ b/include/linux/platform_data/ads7828.h @@ -19,11 +19,13 @@ * @diff_input:Differential input mode. * @ext_vref: Use an external voltage reference. * @vref_mv: Voltage reference value, if external. + * @sample_interval: Sample interval. */ struct ads7828_platform_data { bool diff_input; bool ext_vref; unsigned int vref_mv; + unsigned int sample_interval; }; #endif /* _PDATA_ADS7828_H */ -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] hwmon: (ads7828) Make sample interval configurable
The default sample interval may be too slow for certain clients. This patch makes it configurable via the platform_data. Signed-off-by: Robert Rosengren robert.roseng...@axis.com Signed-off-by: Johan Adolfsson johan.adolfs...@axis.com --- drivers/hwmon/ads7828.c | 11 ++- include/linux/platform_data/ads7828.h | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/hwmon/ads7828.c b/drivers/hwmon/ads7828.c index a622d40..fd5eabf7 100644 --- a/drivers/hwmon/ads7828.c +++ b/drivers/hwmon/ads7828.c @@ -45,6 +45,9 @@ #define ADS7828_EXT_VREF_MV_MIN50 /* External vref min value 0.05V */ #define ADS7828_EXT_VREF_MV_MAX5250/* External vref max value 5.25V */ +/* Default sample interval */ +#define ADS7828_SAMPLE_INTERVAL (HZ + HZ / 2) + /* List of supported devices */ enum ads7828_chips { ads7828, ads7830 }; @@ -58,6 +61,7 @@ struct ads7828_data { bool diff_input;/* Differential input */ bool ext_vref; /* External voltage reference */ unsigned int vref_mv; /* voltage reference value */ + unsigned int sample_interval; /* sample interval */ u8 cmd_byte;/* Command byte without channel bits */ unsigned int lsb_resol; /* Resolution of the ADC sample LSB */ s32 (*read_channel)(const struct i2c_client *client, u8 command); @@ -77,7 +81,7 @@ static struct ads7828_data *ads7828_update_device(struct device *dev) mutex_lock(data-update_lock); - if (time_after(jiffies, data-last_updated + HZ + HZ / 2) + if (time_after(jiffies, data-last_updated + data-sample_interval) || !data-valid) { unsigned int ch; dev_dbg(client-dev, Starting ads7828 update\n); @@ -147,6 +151,8 @@ static int ads7828_probe(struct i2c_client *client, data-ext_vref = pdata-ext_vref; if (data-ext_vref) data-vref_mv = pdata-vref_mv; + if (pdata-sample_interval) + data-sample_interval = pdata-sample_interval; } /* Bound Vref with min/max values if it was provided */ @@ -157,6 +163,9 @@ static int ads7828_probe(struct i2c_client *client, else data-vref_mv = ADS7828_INT_VREF_MV; + if (!data-sample_interval) + data-sample_interval = ADS7828_SAMPLE_INTERVAL; + /* ADS7828 uses 12-bit samples, while ADS7830 is 8-bit */ if (id-driver_data == ads7828) { data-lsb_resol = DIV_ROUND_CLOSEST(data-vref_mv * 1000, 4096); diff --git a/include/linux/platform_data/ads7828.h b/include/linux/platform_data/ads7828.h index 3245f45..bdae0bb 100644 --- a/include/linux/platform_data/ads7828.h +++ b/include/linux/platform_data/ads7828.h @@ -19,11 +19,13 @@ * @diff_input:Differential input mode. * @ext_vref: Use an external voltage reference. * @vref_mv: Voltage reference value, if external. + * @sample_interval: Sample interval. */ struct ads7828_platform_data { bool diff_input; bool ext_vref; unsigned int vref_mv; + unsigned int sample_interval; }; #endif /* _PDATA_ADS7828_H */ -- 2.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/