Re: [PATCH 05/10] added media specific (MS) TCP drivers
On 2014-11-03 at 21:42:52 +0100, Stephanie Wallick stephanie.s.wall...@intel.com wrote: This is where we handle media specific packets and transport. The MS driver interfaces with a media agnostic (MA) driver via a series of transfer pairs. Transfer pairs consist of a set of functions to pass MA USB packets back and forth between MA and MS drivers. There is one transfer pair per device endpoint and one transfer pair for control/management traffic. When the MA driver needs to send an MA USB packet, it hands the packet off to the MS layer where the packet is converted into an MS form and sent via TCP over the underlying ethernet or wireless medium. When the MS driver receives a packet, it converts it into an MA USB packet and hands it off the the MA driver for handling. In addition, the MS driver provides an interface to inititate connection events. Because there are no physical MA USB ports in an MA USB host, the host must be notified via software when a device is connected. Lastly, the MS driver contains a number of ioctl functions that are used by a utility to adjust medium-related driver parameters and connect or disconnect the MA USB host and device drivers. Signed-off-by: Sean O. Stalley sean.stal...@intel.com Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com --- drivers/staging/mausb/drivers/mausb_ioctl.c | 373 +++ drivers/staging/mausb/drivers/mausb_ioctl.h | 99 + drivers/staging/mausb/drivers/mausb_msapi.c | 110 ++ drivers/staging/mausb/drivers/mausb_msapi.h | 232 drivers/staging/mausb/drivers/mausb_tcp-device.c | 147 drivers/staging/mausb/drivers/mausb_tcp-host.c | 144 drivers/staging/mausb/drivers/mausb_tcp.c| 446 +++ drivers/staging/mausb/drivers/mausb_tcp.h| 129 +++ 8 files changed, 1680 insertions(+) create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.c create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.h create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.c create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.h create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-device.c create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-host.c create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.c create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.h diff --git a/drivers/staging/mausb/drivers/mausb_ioctl.c b/drivers/staging/mausb/drivers/mausb_ioctl.c new file mode 100644 index 000..0c6c6bd --- /dev/null +++ b/drivers/staging/mausb/drivers/mausb_ioctl.c [...] +/** + * This function is used to send a message to the user, in other words, the + * calling process. It basically copies the message one byte at a time. + * + * @msg: The message to be sent to the user. + * @buffer: The buffer in which to put the message. This buffer was given to + * us to fill. + */ +void to_user(char *msg, long unsigned int buffer) +{ + int length = (int)strlen(msg); + int bytes = 0; + + while (length *msg) { + put_user(*(msg++), (char *)buffer++); + length--; + bytes++; + } Any reason not to use copy_to_user here? That way, access_ok would only need to be executed once for the whole range. In any case, the return value of put_user/copy_to_user will need to be checked. + + put_user('\0', (char *)buffer + bytes); +} [...] +/** + * This function is used to read from the device file. From the perspective of + * the device, the user is reading information from us. This is one of the + * entry points to this module. + * + * @file:The device file. We don't use it directly, but it's passed in. + * @buffer: The buffer to put the message into. + * @length: The max length to be read. + * @offset: File offset, which we don't use but it is passed in nontheless. + */ +static ssize_t mausb_read(struct file *file, char __user *buffer, + size_t length, loff_t *offset) +{ + int bytes_read = 0; + + if (*message_point == 0) + return 0; + while (length *message_point) { + put_user(*(message_point++), buffer++); + length--; + bytes_read++; + } See comment for to_user above. Why not use copy_to_user? + + return bytes_read; +} + +/** + * This function is used to write to the device file. From the perspective of + * the device, the user is writing information to us. This is one of the + * entry points to this module. + * + * @file:The device file. We don't use it directly, but it's passed in. + * @buffer: The buffer that holds the message. + * @length: The length of the message to be written. + * @offset: File offset, which we don't use but it is passed in nontheless. + */ +static ssize_t mausb_write(struct file *file, const char __user *buffer, +
Re: [PATCH 00/10] MA USB drivers cover letter
[added linux-...@vger.kernel.org Cc] Stephanie Wallick stephanie.s.wall...@intel.com writes: Media Agnostic (MA) USB enables the USB protocol to be used over a wide range of physical media. MA USB is a relatively new protocol and is currently unsupported in the Linux kernel. This patch set adds the following drivers with the following capabilities: 1) MA USB Host: - provides functionality of a USB Host Controller. - implements MA USB protocol for a MA USB host. - provides MA USB packet transport over TCP 2) MA USB Device: - provides functionality of a USB Device Controller. - implements MA USB protocol for a MA USB device. - provides MA USB packet transport over TCP Nice. But don't you think this deserves the attention of the linux-usb mailing list? Yes, Greg's attention is of course good to have too :-) But I believe this is of interest to more people, who might not read everything on linux-kernel. Has there been any thought/discussion about the relationship to the existing usbip drivers, which just moved out of staging? Is a usbip userspace compatibility layer feasible sometime in the future? Bjørn ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: media: lirc: replace dev_err by pr_err
On Tue, Nov 04, 2014 at 02:13:19AM +0200, Aya Mahfouz wrote: This patch replaces dev_err by pr_err since the value of ir is NULL when the message is displayed. Signed-off-by: Aya Mahfouz mahfouz.saif.elya...@gmail.com --- drivers/staging/media/lirc/lirc_zilog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/lirc/lirc_zilog.c b/drivers/staging/media/lirc/lirc_zilog.c index 11a7cb1..ecdd71e 100644 --- a/drivers/staging/media/lirc/lirc_zilog.c +++ b/drivers/staging/media/lirc/lirc_zilog.c @@ -1633,7 +1633,7 @@ out_put_xx: out_put_ir: put_ir_device(ir, true); out_no_ir: - dev_err(ir-l.dev, %s: probing IR %s on %s (i2c-%d) failed with %d\n, + pr_err(%s: probing IR %s on %s (i2c-%d) failed with %d\n, hi, instead of ir-l.dev , can you please try dev_err like this : dev_err(client-dev, %s: probing IR %s on %s (i2c-%d) failed with %d\n, __func__, tx_probe ? Tx : Rx, adap-name, adap-nr, ret); thanks sudip __func__, tx_probe ? Tx : Rx, adap-name, adap-nr, ret); mutex_unlock(ir_devices_lock); -- 1.9.3 -- 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/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/15] staging: media: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h
The v4l2-mediabus.h header is now deprecated and should be replaced with v4l2-mbus.h. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/staging/media/omap4iss/iss_csi2.c | 2 +- drivers/staging/media/omap4iss/iss_video.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index b72e530..f47e4e5 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -13,7 +13,7 @@ #include linux/delay.h #include media/v4l2-common.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/mm.h #include iss.h diff --git a/drivers/staging/media/omap4iss/iss_video.h b/drivers/staging/media/omap4iss/iss_video.h index cc8146b..a028b51 100644 --- a/drivers/staging/media/omap4iss/iss_video.h +++ b/drivers/staging/media/omap4iss/iss_video.h @@ -14,7 +14,7 @@ #ifndef OMAP4_ISS_VIDEO_H #define OMAP4_ISS_VIDEO_H -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include media/media-entity.h #include media/v4l2-dev.h #include media/v4l2-fh.h -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/15] [media] v4l: Forbid usage of V4L2_MBUS_FMT definitions inside the kernel
Place v4l2_mbus_pixelcode in a #ifndef __KERNEL__ section so that kernel users don't have access to these definitions. We have to keep this definition for user-space users even though they're encouraged to move to the new media_bus_format enum. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- include/uapi/linux/v4l2-mediabus.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h index 9fbe891..5a3e797 100644 --- a/include/uapi/linux/v4l2-mediabus.h +++ b/include/uapi/linux/v4l2-mediabus.h @@ -15,6 +15,7 @@ #include linux/videodev2.h #include linux/media-bus-format.h +#ifndef __KERNEL__ #define MEDIA_BUS_TO_V4L2_MBUS(x) V4L2_MBUS_FMT_ ## x = MEDIA_BUS_FMT_ ## x enum v4l2_mbus_pixelcode { @@ -102,6 +103,7 @@ enum v4l2_mbus_pixelcode { MEDIA_BUS_TO_V4L2_MBUS(AHSV_1X32), }; +#endif /* __KERNEL__ */ /** * struct v4l2_mbus_framefmt - frame format on the media bus -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/15] gpu: ipu-v3: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h
The v4l2-mediabus.h header is now deprecated and should be replaced with v4l2-mbus.h. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/gpu/ipu-v3/ipu-csi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c index 752cdd2..8aea0de 100644 --- a/drivers/gpu/ipu-v3/ipu-csi.c +++ b/drivers/gpu/ipu-v3/ipu-csi.c @@ -21,7 +21,7 @@ #include linux/err.h #include linux/platform_device.h #include linux/videodev2.h -#include uapi/linux/v4l2-mediabus.h +#include uapi/linux/v4l2-mbus.h #include linux/clk.h #include linux/clk-provider.h #include linux/clkdev.h -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/15] [media] Deprecate v4l2_mbus_pixelcode
The v4l2_mbus_pixelcode enum (or its values) should be replaced by the media_bus_format enum. Keep this enum in v4l2-mediabus.h and create a new header containing the v4l2_mbus_framefmt struct definition (which is not deprecated) so that we can add a #warning statement in v4l2-mediabus.h and hopefully encourage users to move to the new definitions. Replace inclusion of v4l2-mediabus.h with v4l2-mbus.h in all common headers and update the documentation Makefile to parse v4l2-mbus.h instead of v4l2-mediabus.h. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- Documentation/DocBook/media/Makefile | 2 +- include/media/v4l2-mediabus.h| 2 +- include/uapi/linux/Kbuild| 1 + include/uapi/linux/v4l2-mbus.h | 35 +++ include/uapi/linux/v4l2-mediabus.h | 26 -- include/uapi/linux/v4l2-subdev.h | 2 +- 6 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 include/uapi/linux/v4l2-mbus.h diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 181b7f4..30a22fa 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -99,7 +99,7 @@ STRUCTS = \ $(shell perl -ne 'print $$1 if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/video.h) \ $(shell perl -ne 'print $$1 if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media.h) \ $(shell perl -ne 'print $$1 if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \ - $(shell perl -ne 'print $$1 if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mediabus.h) + $(shell perl -ne 'print $$1 if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mbus.h) ERRORS = \ E2BIG \ diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 4915621..fc6bdd3 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h @@ -11,7 +11,7 @@ #ifndef V4L2_MEDIABUS_H #define V4L2_MEDIABUS_H -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h /* Parallel flags */ /* diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index b2c23f8..7b72720 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -408,6 +408,7 @@ header-y += uvcvideo.h header-y += v4l2-common.h header-y += v4l2-controls.h header-y += v4l2-dv-timings.h +header-y += v4l2-mbus.h header-y += v4l2-mediabus.h header-y += v4l2-subdev.h header-y += veth.h diff --git a/include/uapi/linux/v4l2-mbus.h b/include/uapi/linux/v4l2-mbus.h new file mode 100644 index 000..2778c6e --- /dev/null +++ b/include/uapi/linux/v4l2-mbus.h @@ -0,0 +1,35 @@ +/* + * Media Bus API header + * + * Copyright (C) 2009, Guennadi Liakhovetski g.liakhovet...@gmx.de + * + * 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. + */ + +#ifndef __LINUX_V4L2_MBUS_H +#define __LINUX_V4L2_MBUS_H + +#include linux/types.h +#include linux/videodev2.h +#include linux/media-bus-format.h + +/** + * struct v4l2_mbus_framefmt - frame format on the media bus + * @width: frame width + * @height:frame height + * @code: data format code (from enum media_bus_format) + * @field: used interlacing type (from enum v4l2_field) + * @colorspace:colorspace of the data (from enum v4l2_colorspace) + */ +struct v4l2_mbus_framefmt { + __u32 width; + __u32 height; + __u32 code; + __u32 field; + __u32 colorspace; + __u32 reserved[7]; +}; + +#endif diff --git a/include/uapi/linux/v4l2-mediabus.h b/include/uapi/linux/v4l2-mediabus.h index 5a3e797..a587eac 100644 --- a/include/uapi/linux/v4l2-mediabus.h +++ b/include/uapi/linux/v4l2-mediabus.h @@ -10,12 +10,12 @@ #ifndef __LINUX_V4L2_MEDIABUS_H #define __LINUX_V4L2_MEDIABUS_H +#ifndef __KERNEL__ -#include linux/types.h -#include linux/videodev2.h -#include linux/media-bus-format.h +#warning Use v4l2-mbus.h instead of v4l2-mediabus.h + +#include linux/v4l2-mbus.h -#ifndef __KERNEL__ #define MEDIA_BUS_TO_V4L2_MBUS(x) V4L2_MBUS_FMT_ ## x = MEDIA_BUS_FMT_ ## x enum v4l2_mbus_pixelcode { @@ -104,22 +104,4 @@ enum v4l2_mbus_pixelcode { MEDIA_BUS_TO_V4L2_MBUS(AHSV_1X32), }; #endif /* __KERNEL__ */ - -/** - * struct v4l2_mbus_framefmt - frame format on the media bus - * @width: frame width - * @height:frame height - * @code: data format code (from enum v4l2_mbus_pixelcode) - * @field: used interlacing type (from enum v4l2_field) - * @colorspace:colorspace of the data (from enum v4l2_colorspace) - */ -struct v4l2_mbus_framefmt { - __u32 width; - __u32
[PATCH 03/15] [media] Make use of the new media_bus_format definitions
Replace references to the v4l2_mbus_pixelcode enum with the new media_bus_format enum in all common headers. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- include/media/v4l2-mediabus.h| 2 +- include/media/v4l2-subdev.h | 2 +- include/uapi/linux/v4l2-subdev.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h index 395c4a9..4915621 100644 --- a/include/media/v4l2-mediabus.h +++ b/include/media/v4l2-mediabus.h @@ -98,7 +98,7 @@ static inline void v4l2_fill_pix_format(struct v4l2_pix_format *pix_fmt, static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt, const struct v4l2_pix_format *pix_fmt, - enum v4l2_mbus_pixelcode code) + enum media_bus_format code) { mbus_fmt-width = pix_fmt-width; mbus_fmt-height = pix_fmt-height; diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index d746572..9af5932 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -341,7 +341,7 @@ struct v4l2_subdev_video_ops { int (*query_dv_timings)(struct v4l2_subdev *sd, struct v4l2_dv_timings *timings); int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, -enum v4l2_mbus_pixelcode *code); +enum media_bus_format *code); int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, struct v4l2_frmsizeenum *fsize); int (*g_mbus_fmt)(struct v4l2_subdev *sd, diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h index a619cdd..7f44f04 100644 --- a/include/uapi/linux/v4l2-subdev.h +++ b/include/uapi/linux/v4l2-subdev.h @@ -68,7 +68,7 @@ struct v4l2_subdev_crop { * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration * @pad: pad number, as reported by the media API * @index: format index during enumeration - * @code: format code (from enum v4l2_mbus_pixelcode) + * @code: format code (from enum media_bus_format) */ struct v4l2_subdev_mbus_code_enum { __u32 pad; @@ -81,7 +81,7 @@ struct v4l2_subdev_mbus_code_enum { * struct v4l2_subdev_frame_size_enum - Media bus format enumeration * @pad: pad number, as reported by the media API * @index: format index during enumeration - * @code: format code (from enum v4l2_mbus_pixelcode) + * @code: format code (from enum media_bus_format) */ struct v4l2_subdev_frame_size_enum { __u32 index; @@ -109,7 +109,7 @@ struct v4l2_subdev_frame_interval { * struct v4l2_subdev_frame_interval_enum - Frame interval enumeration * @pad: pad number, as reported by the media API * @index: frame interval index during enumeration - * @code: format code (from enum v4l2_mbus_pixelcode) + * @code: format code (from enum media_bus_format) * @width: frame width in pixels * @height: frame height in pixels * @interval: frame interval in seconds -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/15] [media] Make mediabus format subsystem neutral
Hello, This patch series prepares the use of media bus formats outside of the V4L2 subsytem (my final goal is to use it in the Atmel HLCDC DRM driver where I have to configure my DPI/RGB bus according to the connected display). The series first defines a new enum with a neutral name (media_bus_format), and then replace all references to the old enum and its values within the kernel. It also deprecates the v4l2_mbus_pixelcode enum and the v4l2-mediabus.h header. Kernel users can't use the v4l2_mbus_pixelcode enum anymore and new user-space users are encouraged to move to the media_bus_format enum and include v4l2-mbus.h. Hans, I'm not sure this is exactly what you had in mind for v4l2_mbus_pixelcode deprecation. If you agree with this approach, and think it is worth it, I can reorder the series and squash the last 4 patches into previous ones (patches 4, 9, 6 and 8) Best Regards, Boris Boris Brezillon (15): [media] Move mediabus format definition to a more standard place [media] v4l: Update subdev-formats doc with new MEDIA_BUS_FMT values [media] Make use of the new media_bus_format definitions [media] i2c: Make use of media_bus_format enum [media] pci: Make use of media_bus_format enum [media] platform: Make use of media_bus_format enum [media] usb: Make use of media_bus_format enum staging: media: Make use of media_bus_format enum gpu: ipu-v3: Make use of media_bus_format enum [media] v4l: Forbid usage of V4L2_MBUS_FMT definitions inside the kernel [media] Deprecate v4l2_mbus_pixelcode [media] i2c: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h gpu: ipu-v3: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h [media] platform: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h staging: media: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h Documentation/DocBook/media/Makefile | 4 +- Documentation/DocBook/media/v4l/subdev-formats.xml | 308 ++--- Documentation/video4linux/soc-camera.txt | 2 +- arch/arm/mach-davinci/board-dm355-evm.c| 2 +- arch/arm/mach-davinci/board-dm365-evm.c| 4 +- arch/arm/mach-davinci/dm355.c | 6 +- arch/arm/mach-davinci/dm365.c | 6 +- arch/arm/mach-shmobile/board-mackerel.c| 2 +- arch/sh/boards/mach-ap325rxa/setup.c | 2 +- drivers/gpu/ipu-v3/ipu-csi.c | 68 ++--- drivers/media/i2c/adv7170.c| 16 +- drivers/media/i2c/adv7175.c| 16 +- drivers/media/i2c/adv7180.c| 6 +- drivers/media/i2c/adv7183.c| 6 +- drivers/media/i2c/adv7604.c| 72 ++--- drivers/media/i2c/adv7842.c| 6 +- drivers/media/i2c/ak881x.c | 8 +- drivers/media/i2c/cx25840/cx25840-core.c | 2 +- drivers/media/i2c/m5mols/m5mols_core.c | 6 +- drivers/media/i2c/ml86v7667.c | 6 +- drivers/media/i2c/mt9m032.c| 8 +- drivers/media/i2c/mt9p031.c| 8 +- drivers/media/i2c/mt9t001.c| 10 +- drivers/media/i2c/mt9v011.c| 6 +- drivers/media/i2c/mt9v032.c| 14 +- drivers/media/i2c/noon010pc30.c| 12 +- drivers/media/i2c/ov7670.c | 16 +- drivers/media/i2c/ov9650.c | 10 +- drivers/media/i2c/s5c73m3/s5c73m3.h| 6 +- drivers/media/i2c/s5k4ecgx.c | 4 +- drivers/media/i2c/s5k5baf.c| 14 +- drivers/media/i2c/s5k6a3.c | 2 +- drivers/media/i2c/s5k6aa.c | 8 +- drivers/media/i2c/saa6752hs.c | 6 +- drivers/media/i2c/saa7115.c| 2 +- drivers/media/i2c/saa717x.c| 2 +- drivers/media/i2c/smiapp/smiapp-core.c | 34 +-- drivers/media/i2c/soc_camera/imx074.c | 10 +- drivers/media/i2c/soc_camera/mt9m001.c | 14 +- drivers/media/i2c/soc_camera/mt9m111.c | 72 ++--- drivers/media/i2c/soc_camera/mt9t031.c | 12 +- drivers/media/i2c/soc_camera/mt9t112.c | 24 +- drivers/media/i2c/soc_camera/mt9v022.c | 26 +- drivers/media/i2c/soc_camera/ov2640.c | 56 ++-- drivers/media/i2c/soc_camera/ov5642.c | 10 +- drivers/media/i2c/soc_camera/ov6650.c | 60 ++-- drivers/media/i2c/soc_camera/ov772x.c | 22 +- drivers/media/i2c/soc_camera/ov9640.c | 42 +-- drivers/media/i2c/soc_camera/ov9740.c | 14 +- drivers/media/i2c/soc_camera/rj54n1cb0c.c | 56 ++-- drivers/media/i2c/soc_camera/tw9910.c | 12 +- drivers/media/i2c/sr030pc30.c
[PATCH 14/15] [media] platform: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h
The v4l2-mediabus.h header is now deprecated and should be replaced with v4l2-mbus.h. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/media/platform/omap3isp/ispcsi2.c | 2 +- drivers/media/platform/omap3isp/ispvideo.h | 2 +- drivers/media/platform/vsp1/vsp1_video.c | 2 +- include/media/soc_mediabus.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/omap3isp/ispcsi2.c b/drivers/media/platform/omap3isp/ispcsi2.c index 995a268..64acb66 100644 --- a/drivers/media/platform/omap3isp/ispcsi2.c +++ b/drivers/media/platform/omap3isp/ispcsi2.c @@ -15,7 +15,7 @@ */ #include linux/delay.h #include media/v4l2-common.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/mm.h #include isp.h diff --git a/drivers/media/platform/omap3isp/ispvideo.h b/drivers/media/platform/omap3isp/ispvideo.h index 9de3de5..7738d27 100644 --- a/drivers/media/platform/omap3isp/ispvideo.h +++ b/drivers/media/platform/omap3isp/ispvideo.h @@ -16,7 +16,7 @@ #ifndef OMAP3_ISP_VIDEO_H #define OMAP3_ISP_VIDEO_H -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include media/media-entity.h #include media/v4l2-dev.h #include media/v4l2-fh.h diff --git a/drivers/media/platform/vsp1/vsp1_video.c b/drivers/media/platform/vsp1/vsp1_video.c index d91f19a..bb3af00 100644 --- a/drivers/media/platform/vsp1/vsp1_video.c +++ b/drivers/media/platform/vsp1/vsp1_video.c @@ -16,7 +16,7 @@ #include linux/mutex.h #include linux/sched.h #include linux/slab.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/videodev2.h #include media/media-entity.h diff --git a/include/media/soc_mediabus.h b/include/media/soc_mediabus.h index 9d8e7a1..e357182 100644 --- a/include/media/soc_mediabus.h +++ b/include/media/soc_mediabus.h @@ -12,7 +12,7 @@ #define SOC_MEDIABUS_H #include linux/videodev2.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h /** * enum soc_mbus_packing - data packing types on the media-bus -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/15] [media] usb: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in all usb drivers. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/media/usb/cx231xx/cx231xx-417.c | 2 +- drivers/media/usb/cx231xx/cx231xx-video.c | 4 ++-- drivers/media/usb/em28xx/em28xx-camera.c | 2 +- drivers/media/usb/go7007/go7007-v4l2.c| 2 +- drivers/media/usb/pvrusb2/pvrusb2-hdw.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c index 459bb0e..95653ba 100644 --- a/drivers/media/usb/cx231xx/cx231xx-417.c +++ b/drivers/media/usb/cx231xx/cx231xx-417.c @@ -1878,7 +1878,7 @@ static int cx231xx_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val) /* fix videodecoder resolution */ fmt.width = cxhdl-width / (is_mpeg1 ? 2 : 1); fmt.height = cxhdl-height; - fmt.code = V4L2_MBUS_FMT_FIXED; + fmt.code = MEDIA_BUS_FMT_FIXED; v4l2_subdev_call(dev-sd_cx25840, video, s_mbus_fmt, fmt); return 0; } diff --git a/drivers/media/usb/cx231xx/cx231xx-video.c b/drivers/media/usb/cx231xx/cx231xx-video.c index 3b3ada6..989d527 100644 --- a/drivers/media/usb/cx231xx/cx231xx-video.c +++ b/drivers/media/usb/cx231xx/cx231xx-video.c @@ -967,7 +967,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, dev-height = f-fmt.pix.height; dev-format = fmt; - v4l2_fill_mbus_format(mbus_fmt, f-fmt.pix, V4L2_MBUS_FMT_FIXED); + v4l2_fill_mbus_format(mbus_fmt, f-fmt.pix, MEDIA_BUS_FMT_FIXED); call_all(dev, video, s_mbus_fmt, mbus_fmt); v4l2_fill_pix_format(f-fmt.pix, mbus_fmt); @@ -1012,7 +1012,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm) resolution (since a standard change effects things like the number of lines in VACT, etc) */ memset(mbus_fmt, 0, sizeof(mbus_fmt)); - mbus_fmt.code = V4L2_MBUS_FMT_FIXED; + mbus_fmt.code = MEDIA_BUS_FMT_FIXED; mbus_fmt.width = dev-width; mbus_fmt.height = dev-height; call_all(dev, video, s_mbus_fmt, mbus_fmt); diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c index 6d2ea9a..38cf6c8 100644 --- a/drivers/media/usb/em28xx/em28xx-camera.c +++ b/drivers/media/usb/em28xx/em28xx-camera.c @@ -430,7 +430,7 @@ int em28xx_init_camera(struct em28xx *dev) break; } - fmt.code = V4L2_MBUS_FMT_YUYV8_2X8; + fmt.code = MEDIA_BUS_FMT_YUYV8_2X8; fmt.width = 640; fmt.height = 480; v4l2_subdev_call(subdev, video, s_mbus_fmt, fmt); diff --git a/drivers/media/usb/go7007/go7007-v4l2.c b/drivers/media/usb/go7007/go7007-v4l2.c index ec799b4..d6bf982 100644 --- a/drivers/media/usb/go7007/go7007-v4l2.c +++ b/drivers/media/usb/go7007/go7007-v4l2.c @@ -252,7 +252,7 @@ static int set_capture_size(struct go7007 *go, struct v4l2_format *fmt, int try) if (go-board_info-sensor_flags GO7007_SENSOR_SCALING) { struct v4l2_mbus_framefmt mbus_fmt; - mbus_fmt.code = V4L2_MBUS_FMT_FIXED; + mbus_fmt.code = MEDIA_BUS_FMT_FIXED; mbus_fmt.width = fmt ? fmt-fmt.pix.width : width; mbus_fmt.height = height; go-encoder_h_halve = 0; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index 9623b62..2fd9b5e 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2966,7 +2966,7 @@ static void pvr2_subdev_update(struct pvr2_hdw *hdw) memset(fmt, 0, sizeof(fmt)); fmt.width = hdw-res_hor_val; fmt.height = hdw-res_ver_val; - fmt.code = V4L2_MBUS_FMT_FIXED; + fmt.code = MEDIA_BUS_FMT_FIXED; pvr2_trace(PVR2_TRACE_CHIPS, subdev v4l2 set_size(%dx%d), fmt.width, fmt.height); v4l2_device_call_all(hdw-v4l2_dev, 0, video, s_mbus_fmt, fmt); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/15] [media] pci: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Replace all references to the old definition in pci drivers. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/media/pci/cx18/cx18-av-core.c | 2 +- drivers/media/pci/cx18/cx18-controls.c | 2 +- drivers/media/pci/cx18/cx18-ioctl.c | 2 +- drivers/media/pci/cx23885/cx23885-video.c | 2 +- drivers/media/pci/ivtv/ivtv-controls.c | 2 +- drivers/media/pci/ivtv/ivtv-ioctl.c | 2 +- drivers/media/pci/saa7134/saa7134-empress.c | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/pci/cx18/cx18-av-core.c b/drivers/media/pci/cx18/cx18-av-core.c index 2d3afe0..4c6ce21 100644 --- a/drivers/media/pci/cx18/cx18-av-core.c +++ b/drivers/media/pci/cx18/cx18-av-core.c @@ -952,7 +952,7 @@ static int cx18_av_s_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt int HSC, VSC, Vsrc, Hsrc, filter, Vlines; int is_50Hz = !(state-std V4L2_STD_525_60); - if (fmt-code != V4L2_MBUS_FMT_FIXED) + if (fmt-code != MEDIA_BUS_FMT_FIXED) return -EINVAL; fmt-field = V4L2_FIELD_INTERLACED; diff --git a/drivers/media/pci/cx18/cx18-controls.c b/drivers/media/pci/cx18/cx18-controls.c index 282a3d2..4aeb7c6 100644 --- a/drivers/media/pci/cx18/cx18-controls.c +++ b/drivers/media/pci/cx18/cx18-controls.c @@ -98,7 +98,7 @@ static int cx18_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val) /* fix videodecoder resolution */ fmt.width = cxhdl-width / (is_mpeg1 ? 2 : 1); fmt.height = cxhdl-height; - fmt.code = V4L2_MBUS_FMT_FIXED; + fmt.code = MEDIA_BUS_FMT_FIXED; v4l2_subdev_call(cx-sd_av, video, s_mbus_fmt, fmt); return 0; } diff --git a/drivers/media/pci/cx18/cx18-ioctl.c b/drivers/media/pci/cx18/cx18-ioctl.c index 6f2b590..71963db 100644 --- a/drivers/media/pci/cx18/cx18-ioctl.c +++ b/drivers/media/pci/cx18/cx18-ioctl.c @@ -294,7 +294,7 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh, mbus_fmt.width = cx-cxhdl.width = w; mbus_fmt.height = cx-cxhdl.height = h; - mbus_fmt.code = V4L2_MBUS_FMT_FIXED; + mbus_fmt.code = MEDIA_BUS_FMT_FIXED; v4l2_subdev_call(cx-sd_av, video, s_mbus_fmt, mbus_fmt); return cx18_g_fmt_vid_cap(file, fh, fmt); } diff --git a/drivers/media/pci/cx23885/cx23885-video.c b/drivers/media/pci/cx23885/cx23885-video.c index 682a4f9..091f5db 100644 --- a/drivers/media/pci/cx23885/cx23885-video.c +++ b/drivers/media/pci/cx23885/cx23885-video.c @@ -608,7 +608,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, dev-field = f-fmt.pix.field; dprintk(2, %s() width=%d height=%d field=%d\n, __func__, dev-width, dev-height, dev-field); - v4l2_fill_mbus_format(mbus_fmt, f-fmt.pix, V4L2_MBUS_FMT_FIXED); + v4l2_fill_mbus_format(mbus_fmt, f-fmt.pix, MEDIA_BUS_FMT_FIXED); call_all(dev, video, s_mbus_fmt, mbus_fmt); v4l2_fill_pix_format(f-fmt.pix, mbus_fmt); /* s_mbus_fmt overwrites f-fmt.pix.field, restore it */ diff --git a/drivers/media/pci/ivtv/ivtv-controls.c b/drivers/media/pci/ivtv/ivtv-controls.c index 2b0ab26..ccf548c 100644 --- a/drivers/media/pci/ivtv/ivtv-controls.c +++ b/drivers/media/pci/ivtv/ivtv-controls.c @@ -69,7 +69,7 @@ static int ivtv_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val) /* fix videodecoder resolution */ fmt.width = cxhdl-width / (is_mpeg1 ? 2 : 1); fmt.height = cxhdl-height; - fmt.code = V4L2_MBUS_FMT_FIXED; + fmt.code = MEDIA_BUS_FMT_FIXED; v4l2_subdev_call(itv-sd_video, video, s_mbus_fmt, fmt); return 0; } diff --git a/drivers/media/pci/ivtv/ivtv-ioctl.c b/drivers/media/pci/ivtv/ivtv-ioctl.c index 3e0cb77..4d8ee18 100644 --- a/drivers/media/pci/ivtv/ivtv-ioctl.c +++ b/drivers/media/pci/ivtv/ivtv-ioctl.c @@ -595,7 +595,7 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f fmt-fmt.pix.width /= 2; mbus_fmt.width = fmt-fmt.pix.width; mbus_fmt.height = h; - mbus_fmt.code = V4L2_MBUS_FMT_FIXED; + mbus_fmt.code = MEDIA_BUS_FMT_FIXED; v4l2_subdev_call(itv-sd_video, video, s_mbus_fmt, mbus_fmt); return ivtv_g_fmt_vid_cap(file, fh, fmt); } diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index e4ea85f..8b3bb78 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c @@ -140,7 +140,7 @@ static int empress_s_fmt_vid_cap(struct file *file, void *priv, struct saa7134_dev *dev = video_drvdata(file); struct v4l2_mbus_framefmt mbus_fmt; - v4l2_fill_mbus_format(mbus_fmt,
[PATCH 01/15] [media] Move mediabus format definition to a more standard place
Rename mediabus formats and move the enum into a separate header file so that it can be used by DRM/KMS subsystem without any reference to the V4L2 subsystem. Old V4L2_MBUS_FMT_ definitions are now referencing MEDIA_BUS_FMT_ value. Acked-by: Guennadi Liakhovetski g.liakhovet...@gmx.de Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- include/uapi/linux/Kbuild | 1 + include/uapi/linux/media-bus-format.h | 126 +++ include/uapi/linux/v4l2-mediabus.h| 184 +++--- 3 files changed, 206 insertions(+), 105 deletions(-) create mode 100644 include/uapi/linux/media-bus-format.h diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index b70237e..b2c23f8 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -414,6 +414,7 @@ header-y += veth.h header-y += vfio.h header-y += vhost.h header-y += videodev2.h +header-y += media-bus-format.h header-y += virtio_9p.h header-y += virtio_balloon.h header-y += virtio_blk.h diff --git a/include/uapi/linux/media-bus-format.h b/include/uapi/linux/media-bus-format.h new file mode 100644 index 000..2a826e9 --- /dev/null +++ b/include/uapi/linux/media-bus-format.h @@ -0,0 +1,126 @@ +/* + * Media Bus API header + * + * Copyright (C) 2009, Guennadi Liakhovetski g.liakhovet...@gmx.de + * + * 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. + */ + +#ifndef __LINUX_MEDIA_BUS_FORMAT_H +#define __LINUX_MEDIA_BUS_FORMAT_H + +/* + * These bus formats uniquely identify data formats on the data bus. Format 0 + * is reserved, MEDIA_BUS_FMT_FIXED shall be used by host-client pairs, where + * the data format is fixed. Additionally, 2X8 means that one pixel is + * transferred in two 8-bit samples, BE or LE specify in which order those + * samples are transferred over the bus: LE means that the least significant + * bits are transferred first, BE means that the most significant bits are + * transferred first, and PADHI and PADLO define which bits - low or high, + * in the incomplete high byte, are filled with padding bits. + * + * The bus formats are grouped by type, bus_width, bits per component, samples + * per pixel and order of subsamples. Numerical values are sorted using generic + * numerical sort order (8 thus comes before 10). + * + * As their value can't change when a new bus format is inserted in the + * enumeration, the bus formats are explicitly given a numerical value. The next + * free values for each category are listed below, update them when inserting + * new pixel codes. + */ +enum media_bus_format { + MEDIA_BUS_FMT_FIXED = 0x0001, + + /* RGB - next is 0x100e */ + MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE = 0x1001, + MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE = 0x1002, + MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE = 0x1003, + MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE = 0x1004, + MEDIA_BUS_FMT_BGR565_2X8_BE = 0x1005, + MEDIA_BUS_FMT_BGR565_2X8_LE = 0x1006, + MEDIA_BUS_FMT_RGB565_2X8_BE = 0x1007, + MEDIA_BUS_FMT_RGB565_2X8_LE = 0x1008, + MEDIA_BUS_FMT_RGB666_1X18 = 0x1009, + MEDIA_BUS_FMT_RGB888_1X24 = 0x100a, + MEDIA_BUS_FMT_RGB888_2X12_BE = 0x100b, + MEDIA_BUS_FMT_RGB888_2X12_LE = 0x100c, + MEDIA_BUS_FMT_ARGB_1X32 = 0x100d, + + /* YUV (including grey) - next is 0x2024 */ + MEDIA_BUS_FMT_Y8_1X8 = 0x2001, + MEDIA_BUS_FMT_UV8_1X8 = 0x2015, + MEDIA_BUS_FMT_UYVY8_1_5X8 = 0x2002, + MEDIA_BUS_FMT_VYUY8_1_5X8 = 0x2003, + MEDIA_BUS_FMT_YUYV8_1_5X8 = 0x2004, + MEDIA_BUS_FMT_YVYU8_1_5X8 = 0x2005, + MEDIA_BUS_FMT_UYVY8_2X8 = 0x2006, + MEDIA_BUS_FMT_VYUY8_2X8 = 0x2007, + MEDIA_BUS_FMT_YUYV8_2X8 = 0x2008, + MEDIA_BUS_FMT_YVYU8_2X8 = 0x2009, + MEDIA_BUS_FMT_Y10_1X10 = 0x200a, + MEDIA_BUS_FMT_UYVY10_2X10 = 0x2018, + MEDIA_BUS_FMT_VYUY10_2X10 = 0x2019, + MEDIA_BUS_FMT_YUYV10_2X10 = 0x200b, + MEDIA_BUS_FMT_YVYU10_2X10 = 0x200c, + MEDIA_BUS_FMT_Y12_1X12 = 0x2013, + MEDIA_BUS_FMT_UYVY8_1X16 = 0x200f, + MEDIA_BUS_FMT_VYUY8_1X16 = 0x2010, + MEDIA_BUS_FMT_YUYV8_1X16 = 0x2011, + MEDIA_BUS_FMT_YVYU8_1X16 = 0x2012, + MEDIA_BUS_FMT_YDYUYDYV8_1X16 = 0x2014, + MEDIA_BUS_FMT_UYVY10_1X20 = 0x201a, + MEDIA_BUS_FMT_VYUY10_1X20 = 0x201b, + MEDIA_BUS_FMT_YUYV10_1X20 = 0x200d, + MEDIA_BUS_FMT_YVYU10_1X20 = 0x200e, + MEDIA_BUS_FMT_YUV10_1X30 = 0x2016, + MEDIA_BUS_FMT_AYUV8_1X32 = 0x2017, + MEDIA_BUS_FMT_UYVY12_2X12 = 0x201c, + MEDIA_BUS_FMT_VYUY12_2X12 = 0x201d, + MEDIA_BUS_FMT_YUYV12_2X12 = 0x201e, + MEDIA_BUS_FMT_YVYU12_2X12 = 0x201f, + MEDIA_BUS_FMT_UYVY12_1X24 = 0x2020, + MEDIA_BUS_FMT_VYUY12_1X24 = 0x2021, + MEDIA_BUS_FMT_YUYV12_1X24 = 0x2022, + MEDIA_BUS_FMT_YVYU12_1X24 =
[PATCH 09/15] gpu: ipu-v3: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in the ipu-v3 driver. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/gpu/ipu-v3/ipu-csi.c | 66 ++-- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c index d6f56471..752cdd2 100644 --- a/drivers/gpu/ipu-v3/ipu-csi.c +++ b/drivers/gpu/ipu-v3/ipu-csi.c @@ -227,83 +227,83 @@ static int ipu_csi_set_testgen_mclk(struct ipu_csi *csi, u32 pixel_clk, static int mbus_code_to_bus_cfg(struct ipu_csi_bus_config *cfg, u32 mbus_code) { switch (mbus_code) { - case V4L2_MBUS_FMT_BGR565_2X8_BE: - case V4L2_MBUS_FMT_BGR565_2X8_LE: - case V4L2_MBUS_FMT_RGB565_2X8_BE: - case V4L2_MBUS_FMT_RGB565_2X8_LE: + case MEDIA_BUS_FMT_BGR565_2X8_BE: + case MEDIA_BUS_FMT_BGR565_2X8_LE: + case MEDIA_BUS_FMT_RGB565_2X8_BE: + case MEDIA_BUS_FMT_RGB565_2X8_LE: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_RGB565; cfg-mipi_dt = MIPI_DT_RGB565; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE: - case V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE: + case MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE: + case MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_RGB444; cfg-mipi_dt = MIPI_DT_RGB444; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE: - case V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE: + case MEDIA_BUS_FMT_RGB555_2X8_PADHI_BE: + case MEDIA_BUS_FMT_RGB555_2X8_PADHI_LE: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_RGB555; cfg-mipi_dt = MIPI_DT_RGB555; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_YUV422_UYVY; cfg-mipi_dt = MIPI_DT_YUV422; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_YUYV8_2X8: + case MEDIA_BUS_FMT_YUYV8_2X8: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_YUV422_YUYV; cfg-mipi_dt = MIPI_DT_YUV422; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_UYVY8_1X16: + case MEDIA_BUS_FMT_UYVY8_1X16: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_YUV422_UYVY; cfg-mipi_dt = MIPI_DT_YUV422; cfg-data_width = IPU_CSI_DATA_WIDTH_16; break; - case V4L2_MBUS_FMT_YUYV8_1X16: + case MEDIA_BUS_FMT_YUYV8_1X16: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_YUV422_YUYV; cfg-mipi_dt = MIPI_DT_YUV422; cfg-data_width = IPU_CSI_DATA_WIDTH_16; break; - case V4L2_MBUS_FMT_SBGGR8_1X8: - case V4L2_MBUS_FMT_SGBRG8_1X8: - case V4L2_MBUS_FMT_SGRBG8_1X8: - case V4L2_MBUS_FMT_SRGGB8_1X8: + case MEDIA_BUS_FMT_SBGGR8_1X8: + case MEDIA_BUS_FMT_SGBRG8_1X8: + case MEDIA_BUS_FMT_SGRBG8_1X8: + case MEDIA_BUS_FMT_SRGGB8_1X8: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER; cfg-mipi_dt = MIPI_DT_RAW8; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8: - case V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8: - case V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8: - case V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8: - case V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE: - case V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE: - case V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE: - case V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE: + case MEDIA_BUS_FMT_SBGGR10_DPCM8_1X8: + case MEDIA_BUS_FMT_SGBRG10_DPCM8_1X8: + case MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8: + case MEDIA_BUS_FMT_SRGGB10_DPCM8_1X8: + case MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_BE: + case MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE: + case MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_BE: + case MEDIA_BUS_FMT_SBGGR10_2X8_PADLO_LE: cfg-data_fmt = CSI_SENS_CONF_DATA_FMT_BAYER; cfg-mipi_dt = MIPI_DT_RAW10; cfg-data_width = IPU_CSI_DATA_WIDTH_8; break; - case V4L2_MBUS_FMT_SBGGR10_1X10: - case V4L2_MBUS_FMT_SGBRG10_1X10: - case V4L2_MBUS_FMT_SGRBG10_1X10: - case V4L2_MBUS_FMT_SRGGB10_1X10: + case MEDIA_BUS_FMT_SBGGR10_1X10: + case MEDIA_BUS_FMT_SGBRG10_1X10: + case MEDIA_BUS_FMT_SGRBG10_1X10: + case MEDIA_BUS_FMT_SRGGB10_1X10: cfg-data_fmt =
[PATCH 12/15] [media] i2c: Replace v4l2-mediabus.h inclusion with v4l2-mbus.h
The v4l2-mediabus.h header is now deprecated and should be replaced with v4l2-mbus.h. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/media/i2c/mt9m032.c | 2 +- drivers/media/i2c/mt9t001.c | 2 +- drivers/media/i2c/mt9v032.c | 2 +- drivers/media/i2c/smiapp/smiapp-core.c| 2 +- drivers/media/i2c/soc_camera/imx074.c | 2 +- drivers/media/i2c/soc_camera/mt9m111.c| 2 +- drivers/media/i2c/soc_camera/mt9t031.c| 2 +- drivers/media/i2c/soc_camera/mt9t112.c| 2 +- drivers/media/i2c/soc_camera/ov2640.c | 2 +- drivers/media/i2c/soc_camera/ov5642.c | 2 +- drivers/media/i2c/soc_camera/ov6650.c | 2 +- drivers/media/i2c/soc_camera/ov772x.c | 2 +- drivers/media/i2c/soc_camera/ov9640.c | 2 +- drivers/media/i2c/soc_camera/ov9740.c | 2 +- drivers/media/i2c/soc_camera/rj54n1cb0c.c | 2 +- drivers/media/i2c/soc_camera/tw9910.c | 2 +- drivers/media/i2c/tvp514x.c | 2 +- 17 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c index 45b3fca..502b23f 100644 --- a/drivers/media/i2c/mt9m032.c +++ b/drivers/media/i2c/mt9m032.c @@ -28,7 +28,7 @@ #include linux/module.h #include linux/mutex.h #include linux/slab.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include media/media-entity.h #include media/mt9m032.h diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c index d9e9889..f1053f9 100644 --- a/drivers/media/i2c/mt9t001.c +++ b/drivers/media/i2c/mt9t001.c @@ -19,7 +19,7 @@ #include linux/regulator/consumer.h #include linux/slab.h #include linux/videodev2.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include media/mt9t001.h #include media/v4l2-ctrls.h diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c index 93687c1..e0c944a 100644 --- a/drivers/media/i2c/mt9v032.c +++ b/drivers/media/i2c/mt9v032.c @@ -20,7 +20,7 @@ #include linux/regmap.h #include linux/slab.h #include linux/videodev2.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/module.h #include media/mt9v032.h diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 82d2e0a..8ccb7fa 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c @@ -34,7 +34,7 @@ #include linux/regulator/consumer.h #include linux/slab.h #include linux/smiapp.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include media/v4l2-device.h #include smiapp.h diff --git a/drivers/media/i2c/soc_camera/imx074.c b/drivers/media/i2c/soc_camera/imx074.c index f9c0474..48892a1 100644 --- a/drivers/media/i2c/soc_camera/imx074.c +++ b/drivers/media/i2c/soc_camera/imx074.c @@ -12,7 +12,7 @@ #include linux/delay.h #include linux/i2c.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/slab.h #include linux/videodev2.h #include linux/module.h diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index d140c7a..2b1179f 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -13,7 +13,7 @@ #include linux/log2.h #include linux/gpio.h #include linux/delay.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/module.h #include media/soc_camera.h diff --git a/drivers/media/i2c/soc_camera/mt9t031.c b/drivers/media/i2c/soc_camera/mt9t031.c index 13177ca..d6b1503 100644 --- a/drivers/media/i2c/soc_camera/mt9t031.c +++ b/drivers/media/i2c/soc_camera/mt9t031.c @@ -13,7 +13,7 @@ #include linux/log2.h #include linux/pm.h #include linux/slab.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/videodev2.h #include linux/module.h diff --git a/drivers/media/i2c/soc_camera/mt9t112.c b/drivers/media/i2c/soc_camera/mt9t112.c index 6ef9665..59396de 100644 --- a/drivers/media/i2c/soc_camera/mt9t112.c +++ b/drivers/media/i2c/soc_camera/mt9t112.c @@ -22,7 +22,7 @@ #include linux/init.h #include linux/module.h #include linux/slab.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/videodev2.h #include media/mt9t112.h diff --git a/drivers/media/i2c/soc_camera/ov2640.c b/drivers/media/i2c/soc_camera/ov2640.c index bc3ca24..dcc6fa8 100644 --- a/drivers/media/i2c/soc_camera/ov2640.c +++ b/drivers/media/i2c/soc_camera/ov2640.c @@ -18,7 +18,7 @@ #include linux/i2c.h #include linux/slab.h #include linux/delay.h -#include linux/v4l2-mediabus.h +#include linux/v4l2-mbus.h #include linux/videodev2.h #include media/soc_camera.h diff --git a/drivers/media/i2c/soc_camera/ov5642.c b/drivers/media/i2c/soc_camera/ov5642.c index 5f43e03..73111bd 100644 --- a/drivers/media/i2c/soc_camera/ov5642.c +++ b/drivers/media/i2c/soc_camera/ov5642.c @@ -21,7 +21,7 @@ #include linux/slab.h #include linux/videodev2.h
[PATCH 02/15] [media] v4l: Update subdev-formats doc with new MEDIA_BUS_FMT values
In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Update the v4l documentation accordingly. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- Documentation/DocBook/media/Makefile | 2 +- Documentation/DocBook/media/v4l/subdev-formats.xml | 308 ++--- include/uapi/linux/v4l2-mediabus.h | 2 + 3 files changed, 157 insertions(+), 155 deletions(-) diff --git a/Documentation/DocBook/media/Makefile b/Documentation/DocBook/media/Makefile index 8bf7c61..181b7f4 100644 --- a/Documentation/DocBook/media/Makefile +++ b/Documentation/DocBook/media/Makefile @@ -86,7 +86,7 @@ ENUMS = \ $(shell perl -ne 'print $$1 if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/net.h) \ $(shell perl -ne 'print $$1 if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/video.h) \ $(shell perl -ne 'print $$1 if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media.h) \ - $(shell perl -ne 'print $$1 if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mediabus.h) \ + $(shell perl -ne 'print $$1 if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media-bus-format.h) \ $(shell perl -ne 'print $$1 if /^enum\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-subdev.h) STRUCTS = \ diff --git a/Documentation/DocBook/media/v4l/subdev-formats.xml b/Documentation/DocBook/media/v4l/subdev-formats.xml index b2d5a03..18730b9 100644 --- a/Documentation/DocBook/media/v4l/subdev-formats.xml +++ b/Documentation/DocBook/media/v4l/subdev-formats.xml @@ -86,7 +86,7 @@ green and 5-bit blue values padded on the high bit, transferred as 2 8-bit samples per pixel with the most significant bits (padding, red and half of the green value) transferred first will be named - constantV4L2_MBUS_FMT_RGB555_2X8_PADHI_BE/constant. + constantMEDIA_BUS_FMT_RGB555_2X8_PADHI_BE/constant. /para paraThe following tables list existing packed RGB formats./para @@ -176,8 +176,8 @@ /row /thead tbody valign=top - row id=V4L2-MBUS-FMT-RGB444-2X8-PADHI-BE - entryV4L2_MBUS_FMT_RGB444_2X8_PADHI_BE/entry + row id=MEDIA-BUS-FMT-RGB444-2X8-PADHI-BE + entryMEDIA_BUS_FMT_RGB444_2X8_PADHI_BE/entry entry0x1001/entry entry/entry dash-ent-24; @@ -204,8 +204,8 @@ entrybsubscript1/subscript/entry entrybsubscript0/subscript/entry /row - row id=V4L2-MBUS-FMT-RGB444-2X8-PADHI-LE - entryV4L2_MBUS_FMT_RGB444_2X8_PADHI_LE/entry + row id=MEDIA-BUS-FMT-RGB444-2X8-PADHI-LE + entryMEDIA_BUS_FMT_RGB444_2X8_PADHI_LE/entry entry0x1002/entry entry/entry dash-ent-24; @@ -232,8 +232,8 @@ entryrsubscript1/subscript/entry entryrsubscript0/subscript/entry /row - row id=V4L2-MBUS-FMT-RGB555-2X8-PADHI-BE - entryV4L2_MBUS_FMT_RGB555_2X8_PADHI_BE/entry + row id=MEDIA-BUS-FMT-RGB555-2X8-PADHI-BE + entryMEDIA_BUS_FMT_RGB555_2X8_PADHI_BE/entry entry0x1003/entry entry/entry dash-ent-24; @@ -260,8 +260,8 @@ entrybsubscript1/subscript/entry entrybsubscript0/subscript/entry /row - row id=V4L2-MBUS-FMT-RGB555-2X8-PADHI-LE - entryV4L2_MBUS_FMT_RGB555_2X8_PADHI_LE/entry + row id=MEDIA-BUS-FMT-RGB555-2X8-PADHI-LE + entryMEDIA_BUS_FMT_RGB555_2X8_PADHI_LE/entry entry0x1004/entry entry/entry dash-ent-24; @@ -288,8 +288,8 @@ entrygsubscript4/subscript/entry entrygsubscript3/subscript/entry /row - row id=V4L2-MBUS-FMT-BGR565-2X8-BE - entryV4L2_MBUS_FMT_BGR565_2X8_BE/entry + row id=MEDIA-BUS-FMT-BGR565-2X8-BE + entryMEDIA_BUS_FMT_BGR565_2X8_BE/entry entry0x1005/entry entry/entry dash-ent-24; @@ -316,8 +316,8 @@ entryrsubscript1/subscript/entry entryrsubscript0/subscript/entry /row - row id=V4L2-MBUS-FMT-BGR565-2X8-LE - entryV4L2_MBUS_FMT_BGR565_2X8_LE/entry + row id=MEDIA-BUS-FMT-BGR565-2X8-LE + entryMEDIA_BUS_FMT_BGR565_2X8_LE/entry entry0x1006/entry entry/entry dash-ent-24; @@ -344,8 +344,8 @@ entrygsubscript4/subscript/entry entrygsubscript3/subscript/entry /row - row id=V4L2-MBUS-FMT-RGB565-2X8-BE - entryV4L2_MBUS_FMT_RGB565_2X8_BE/entry + row
[PATCH 08/15] staging: media: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in all media drivers residing in staging. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/staging/media/davinci_vpfe/dm365_ipipe.c | 18 ++-- .../staging/media/davinci_vpfe/dm365_ipipe_hw.c| 26 +++--- drivers/staging/media/davinci_vpfe/dm365_ipipeif.c | 100 ++--- drivers/staging/media/davinci_vpfe/dm365_isif.c| 90 +-- drivers/staging/media/davinci_vpfe/dm365_resizer.c | 96 ++-- .../staging/media/davinci_vpfe/vpfe_mc_capture.c | 18 ++-- drivers/staging/media/omap4iss/iss_csi2.c | 62 ++--- drivers/staging/media/omap4iss/iss_ipipe.c | 16 ++-- drivers/staging/media/omap4iss/iss_ipipeif.c | 28 +++--- drivers/staging/media/omap4iss/iss_resizer.c | 26 +++--- drivers/staging/media/omap4iss/iss_video.c | 78 drivers/staging/media/omap4iss/iss_video.h | 10 +-- 12 files changed, 284 insertions(+), 284 deletions(-) diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c index bdc7f00..704fa20 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe.c @@ -37,15 +37,15 @@ /* ipipe input format's */ static const unsigned int ipipe_input_fmts[] = { - V4L2_MBUS_FMT_UYVY8_2X8, - V4L2_MBUS_FMT_SGRBG12_1X12, - V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, - V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8, + MEDIA_BUS_FMT_UYVY8_2X8, + MEDIA_BUS_FMT_SGRBG12_1X12, + MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8, + MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8, }; /* ipipe output format's */ static const unsigned int ipipe_output_fmts[] = { - V4L2_MBUS_FMT_UYVY8_2X8, + MEDIA_BUS_FMT_UYVY8_2X8, }; static int ipipe_validate_lutdpc_params(struct vpfe_ipipe_lutdpc *lutdpc) @@ -1457,7 +1457,7 @@ ipipe_try_format(struct vpfe_ipipe_device *ipipe, /* If not found, use SBGGR10 as default */ if (i = ARRAY_SIZE(ipipe_input_fmts)) - fmt-code = V4L2_MBUS_FMT_SGRBG12_1X12; + fmt-code = MEDIA_BUS_FMT_SGRBG12_1X12; } else if (pad == IPIPE_PAD_SOURCE) { for (i = 0; i ARRAY_SIZE(ipipe_output_fmts); i++) if (fmt-code == ipipe_output_fmts[i]) @@ -1465,7 +1465,7 @@ ipipe_try_format(struct vpfe_ipipe_device *ipipe, /* If not found, use UYVY as default */ if (i = ARRAY_SIZE(ipipe_output_fmts)) - fmt-code = V4L2_MBUS_FMT_UYVY8_2X8; + fmt-code = MEDIA_BUS_FMT_UYVY8_2X8; } fmt-width = clamp_t(u32, fmt-width, MIN_OUT_HEIGHT, max_out_width); @@ -1642,7 +1642,7 @@ ipipe_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) memset(format, 0, sizeof(format)); format.pad = IPIPE_PAD_SINK; format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; - format.format.code = V4L2_MBUS_FMT_SGRBG12_1X12; + format.format.code = MEDIA_BUS_FMT_SGRBG12_1X12; format.format.width = IPIPE_MAX_OUTPUT_WIDTH_A; format.format.height = IPIPE_MAX_OUTPUT_HEIGHT_A; ipipe_set_format(sd, fh, format); @@ -1650,7 +1650,7 @@ ipipe_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) memset(format, 0, sizeof(format)); format.pad = IPIPE_PAD_SOURCE; format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; - format.format.code = V4L2_MBUS_FMT_UYVY8_2X8; + format.format.code = MEDIA_BUS_FMT_UYVY8_2X8; format.format.width = IPIPE_MAX_OUTPUT_WIDTH_A; format.format.height = IPIPE_MAX_OUTPUT_HEIGHT_A; ipipe_set_format(sd, fh, format); diff --git a/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c b/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c index b2daf5e..4a0895b2 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c +++ b/drivers/staging/media/davinci_vpfe/dm365_ipipe_hw.c @@ -196,12 +196,12 @@ ipipe_setup_resizer(void *__iomem rsz_base, struct resizer_params *params) rsz_set_rsz_regs(rsz_base, RSZ_B, params); } -static u32 ipipe_get_color_pat(enum v4l2_mbus_pixelcode pix) +static u32 ipipe_get_color_pat(enum media_bus_format pix) { switch (pix) { - case V4L2_MBUS_FMT_SGRBG10_ALAW8_1X8: - case V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8: - case V4L2_MBUS_FMT_SGRBG12_1X12: + case MEDIA_BUS_FMT_SGRBG10_ALAW8_1X8: + case MEDIA_BUS_FMT_SGRBG10_DPCM8_1X8: + case MEDIA_BUS_FMT_SGRBG12_1X12: return ipipe_sgrbg_pattern; default: @@ -211,23 +211,23 @@ static u32
[PATCH 04/15] [media] i2c: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've moved media bus definitions to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Replace all references to the old definitions in i2c drivers. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- drivers/media/i2c/adv7170.c | 16 +++ drivers/media/i2c/adv7175.c | 16 +++ drivers/media/i2c/adv7180.c | 6 +-- drivers/media/i2c/adv7183.c | 6 +-- drivers/media/i2c/adv7604.c | 72 +++ drivers/media/i2c/adv7842.c | 6 +-- drivers/media/i2c/ak881x.c| 8 ++-- drivers/media/i2c/cx25840/cx25840-core.c | 2 +- drivers/media/i2c/m5mols/m5mols_core.c| 6 +-- drivers/media/i2c/ml86v7667.c | 6 +-- drivers/media/i2c/mt9m032.c | 6 +-- drivers/media/i2c/mt9p031.c | 8 ++-- drivers/media/i2c/mt9t001.c | 8 ++-- drivers/media/i2c/mt9v011.c | 6 +-- drivers/media/i2c/mt9v032.c | 12 +++--- drivers/media/i2c/noon010pc30.c | 12 +++--- drivers/media/i2c/ov7670.c| 16 +++ drivers/media/i2c/ov9650.c| 10 ++--- drivers/media/i2c/s5c73m3/s5c73m3.h | 6 +-- drivers/media/i2c/s5k4ecgx.c | 4 +- drivers/media/i2c/s5k5baf.c | 14 +++--- drivers/media/i2c/s5k6a3.c| 2 +- drivers/media/i2c/s5k6aa.c| 8 ++-- drivers/media/i2c/saa6752hs.c | 6 +-- drivers/media/i2c/saa7115.c | 2 +- drivers/media/i2c/saa717x.c | 2 +- drivers/media/i2c/smiapp/smiapp-core.c| 32 +++--- drivers/media/i2c/soc_camera/imx074.c | 8 ++-- drivers/media/i2c/soc_camera/mt9m001.c| 14 +++--- drivers/media/i2c/soc_camera/mt9m111.c| 70 +++--- drivers/media/i2c/soc_camera/mt9t031.c| 10 ++--- drivers/media/i2c/soc_camera/mt9t112.c| 22 +- drivers/media/i2c/soc_camera/mt9v022.c| 26 +-- drivers/media/i2c/soc_camera/ov2640.c | 54 +++ drivers/media/i2c/soc_camera/ov5642.c | 8 ++-- drivers/media/i2c/soc_camera/ov6650.c | 58 - drivers/media/i2c/soc_camera/ov772x.c | 20 - drivers/media/i2c/soc_camera/ov9640.c | 40 - drivers/media/i2c/soc_camera/ov9740.c | 12 +++--- drivers/media/i2c/soc_camera/rj54n1cb0c.c | 54 +++ drivers/media/i2c/soc_camera/tw9910.c | 10 ++--- drivers/media/i2c/sr030pc30.c | 14 +++--- drivers/media/i2c/tvp514x.c | 12 +++--- drivers/media/i2c/tvp5150.c | 6 +-- drivers/media/i2c/tvp7002.c | 10 ++--- drivers/media/i2c/vs6624.c| 18 46 files changed, 382 insertions(+), 382 deletions(-) diff --git a/drivers/media/i2c/adv7170.c b/drivers/media/i2c/adv7170.c index 04bb297..0f6c852 100644 --- a/drivers/media/i2c/adv7170.c +++ b/drivers/media/i2c/adv7170.c @@ -63,9 +63,9 @@ static inline struct adv7170 *to_adv7170(struct v4l2_subdev *sd) static char *inputs[] = { pass_through, play_back }; -static enum v4l2_mbus_pixelcode adv7170_codes[] = { - V4L2_MBUS_FMT_UYVY8_2X8, - V4L2_MBUS_FMT_UYVY8_1X16, +static enum media_bus_format adv7170_codes[] = { + MEDIA_BUS_FMT_UYVY8_2X8, + MEDIA_BUS_FMT_UYVY8_1X16, }; /* --- */ @@ -263,7 +263,7 @@ static int adv7170_s_routing(struct v4l2_subdev *sd, } static int adv7170_enum_fmt(struct v4l2_subdev *sd, unsigned int index, - enum v4l2_mbus_pixelcode *code) + enum media_bus_format *code) { if (index = ARRAY_SIZE(adv7170_codes)) return -EINVAL; @@ -278,9 +278,9 @@ static int adv7170_g_fmt(struct v4l2_subdev *sd, u8 val = adv7170_read(sd, 0x7); if ((val 0x40) == (1 6)) - mf-code = V4L2_MBUS_FMT_UYVY8_1X16; + mf-code = MEDIA_BUS_FMT_UYVY8_1X16; else - mf-code = V4L2_MBUS_FMT_UYVY8_2X8; + mf-code = MEDIA_BUS_FMT_UYVY8_2X8; mf-colorspace = V4L2_COLORSPACE_SMPTE170M; mf-width = 0; @@ -297,11 +297,11 @@ static int adv7170_s_fmt(struct v4l2_subdev *sd, int ret; switch (mf-code) { - case V4L2_MBUS_FMT_UYVY8_2X8: + case MEDIA_BUS_FMT_UYVY8_2X8: val = ~0x40; break; - case V4L2_MBUS_FMT_UYVY8_1X16: + case MEDIA_BUS_FMT_UYVY8_1X16: val |= 0x40; break; diff --git a/drivers/media/i2c/adv7175.c b/drivers/media/i2c/adv7175.c index b88f3b3..3a7c461 100644 --- a/drivers/media/i2c/adv7175.c +++ b/drivers/media/i2c/adv7175.c @@ -60,9
[PATCH 06/15] [media] platform: Make use of media_bus_format enum
In order to have subsytem agnostic media bus format definitions we've moved media bus definition to include/uapi/linux/media-bus-format.h and prefixed enum values with MEDIA_BUS_FMT instead of V4L2_MBUS_FMT. Reference new definitions in all platform drivers. Signed-off-by: Boris Brezillon boris.brezil...@free-electrons.com --- Documentation/video4linux/soc-camera.txt | 2 +- arch/arm/mach-davinci/board-dm355-evm.c| 2 +- arch/arm/mach-davinci/board-dm365-evm.c| 4 +- arch/arm/mach-davinci/dm355.c | 6 +- arch/arm/mach-davinci/dm365.c | 6 +- arch/arm/mach-shmobile/board-mackerel.c| 2 +- arch/sh/boards/mach-ap325rxa/setup.c | 2 +- drivers/media/platform/blackfin/bfin_capture.c | 14 +-- drivers/media/platform/davinci/vpbe.c | 2 +- drivers/media/platform/davinci/vpfe_capture.c | 4 +- drivers/media/platform/exynos-gsc/gsc-core.c | 8 +- drivers/media/platform/exynos-gsc/gsc-core.h | 2 +- drivers/media/platform/exynos4-is/fimc-capture.c | 2 +- drivers/media/platform/exynos4-is/fimc-core.c | 14 +-- drivers/media/platform/exynos4-is/fimc-core.h | 4 +- drivers/media/platform/exynos4-is/fimc-isp.c | 16 +-- drivers/media/platform/exynos4-is/fimc-lite-reg.c | 26 ++--- drivers/media/platform/exynos4-is/fimc-lite.c | 14 +-- drivers/media/platform/exynos4-is/fimc-reg.c | 14 +-- drivers/media/platform/exynos4-is/mipi-csis.c | 14 +-- drivers/media/platform/marvell-ccic/mcam-core.c| 22 ++-- drivers/media/platform/marvell-ccic/mcam-core.h| 2 +- drivers/media/platform/omap3isp/ispccdc.c | 112 ++--- drivers/media/platform/omap3isp/ispccp2.c | 18 ++-- drivers/media/platform/omap3isp/ispcsi2.c | 42 drivers/media/platform/omap3isp/isppreview.c | 58 +-- drivers/media/platform/omap3isp/ispresizer.c | 18 ++-- drivers/media/platform/omap3isp/ispvideo.c | 94 - drivers/media/platform/omap3isp/ispvideo.h | 10 +- drivers/media/platform/s3c-camif/camif-capture.c | 10 +- drivers/media/platform/s3c-camif/camif-regs.c | 8 +- drivers/media/platform/s5p-tv/hdmi_drv.c | 2 +- drivers/media/platform/s5p-tv/sdo_drv.c| 2 +- drivers/media/platform/sh_vou.c| 8 +- drivers/media/platform/soc_camera/atmel-isi.c | 22 ++-- drivers/media/platform/soc_camera/mx2_camera.c | 24 ++--- drivers/media/platform/soc_camera/mx3_camera.c | 6 +- drivers/media/platform/soc_camera/omap1_camera.c | 36 +++ drivers/media/platform/soc_camera/pxa_camera.c | 16 +-- drivers/media/platform/soc_camera/rcar_vin.c | 14 +-- .../platform/soc_camera/sh_mobile_ceu_camera.c | 20 ++-- drivers/media/platform/soc_camera/sh_mobile_csi2.c | 38 +++ drivers/media/platform/soc_camera/soc_camera.c | 2 +- .../platform/soc_camera/soc_camera_platform.c | 2 +- drivers/media/platform/soc_camera/soc_mediabus.c | 78 +++--- drivers/media/platform/via-camera.c| 8 +- drivers/media/platform/vsp1/vsp1_bru.c | 14 +-- drivers/media/platform/vsp1/vsp1_hsit.c| 12 +-- drivers/media/platform/vsp1/vsp1_lif.c | 10 +- drivers/media/platform/vsp1/vsp1_lut.c | 14 +-- drivers/media/platform/vsp1/vsp1_rwpf.c| 10 +- drivers/media/platform/vsp1/vsp1_sru.c | 12 +-- drivers/media/platform/vsp1/vsp1_uds.c | 10 +- drivers/media/platform/vsp1/vsp1_video.c | 42 include/media/davinci/vpbe.h | 2 +- include/media/davinci/vpbe_venc.h | 4 +- include/media/exynos-fimc.h| 2 +- include/media/soc_camera.h | 2 +- include/media/soc_mediabus.h | 6 +- 59 files changed, 485 insertions(+), 485 deletions(-) diff --git a/Documentation/video4linux/soc-camera.txt b/Documentation/video4linux/soc-camera.txt index daa9e2a..84f41cf 100644 --- a/Documentation/video4linux/soc-camera.txt +++ b/Documentation/video4linux/soc-camera.txt @@ -151,7 +151,7 @@ they are transferred over a media bus. Soc-camera provides support to conveniently manage these formats. A table of standard transformations is maintained by soc-camera core, which describes, what FOURCC pixel format will be obtained, if a media-bus pixel format is stored in memory according to -certain rules. E.g. if V4L2_MBUS_FMT_YUYV8_2X8 data is sampled with 8 bits per +certain rules. E.g. if MEDIA_BUS_FMT_YUYV8_2X8 data is sampled with 8 bits per sample and stored in memory in the little-endian order with no gaps between bytes, data in memory will represent the V4L2_PIX_FMT_YUYV FOURCC format. These standard transformations will be used by
Re: [PATCH 01/15] [media] Move mediabus format definition to a more standard place
On 11/04/14 11:20, Hans Verkuil wrote: Hi Boris, On 11/04/14 10:54, Boris Brezillon wrote: Rename mediabus formats and move the enum into a separate header file so that it can be used by DRM/KMS subsystem without any reference to the V4L2 subsystem. Old V4L2_MBUS_FMT_ definitions are now referencing MEDIA_BUS_FMT_ value. I missed earlier that v4l2-mediabus.h contained a struct as well, so it can't be deprecated and neither can a #warning be added. The best approach, I think, is to use a macro in media-bus-format.h that will either define just the MEDIA_BUS value when compiled in the kernel, or define both MEDIA_BUS and V4L2_MBUS values when compiled for userspace. E.g. something like this: #ifdef __KERNEL__ #define MEDIA_BUS_FMT_ENTRY(name, val) MEDIA_BUS_FMT_ # name = val #else /* Keep V4L2_MBUS_FMT for backwards compatibility */ #define MEDIA_BUS_FMT_ENTRY(name, val) \ MEDIA_BUS_FMT_ # name = val, \ V4L2_MBUS_FMT_ # name = val #endif And v4l2-mediabus.h needs this as well: #ifndef __KERNEL__ /* For backwards compatibility */ #define v4l2_mbus_pixelcode media_bus_format #endif Regards, Hans ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 01/15] [media] Move mediabus format definition to a more standard place
Hi Hans, On Tue, 04 Nov 2014 11:20:40 +0100 Hans Verkuil hansv...@cisco.com wrote: Hi Boris, On 11/04/14 10:54, Boris Brezillon wrote: Rename mediabus formats and move the enum into a separate header file so that it can be used by DRM/KMS subsystem without any reference to the V4L2 subsystem. Old V4L2_MBUS_FMT_ definitions are now referencing MEDIA_BUS_FMT_ value. I missed earlier that v4l2-mediabus.h contained a struct as well, so it can't be deprecated and neither can a #warning be added. The best approach, I think, is to use a macro in media-bus-format.h that will either define just the MEDIA_BUS value when compiled in the kernel, or define both MEDIA_BUS and V4L2_MBUS values when compiled for userspace. E.g. something like this: #ifdef __KERNEL__ #define MEDIA_BUS_FMT_ENTRY(name, val) MEDIA_BUS_FMT_ # name = val #else /* Keep V4L2_MBUS_FMT for backwards compatibility */ #define MEDIA_BUS_FMT_ENTRY(name, val) \ MEDIA_BUS_FMT_ # name = val, \ V4L2_MBUS_FMT_ # name = val #endif Okay, but this means we keep adding V4L2_MBUS_FMT_ definitions even for new formats (which definitely doesn't encourage people to move on). Moreover, we add a V4L2 prefix in what was supposed to be a subsystem neutral header. Anyway, these are just nitpicks, and if you prefer this approach I'll rework my series :-). An alternative approach is to have v4l2-mediabus.h include media-bus-format.h, put #ifndef __KERNEL__ around the enum v4l2_mbus_pixelcode and add a big comment there that applications should use the defines from media-bus-format.h and that this enum is frozen (i.e. new values are only added to media-bus-format.h). But I think I like the macro idea best. As you wish, my only intent is to use those bus format definitions in a DRM driver :-). Thanks, Boris -- Boris Brezillon, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] staging: imx-drm: remove old FSF address from license text
Linux already includes a copy of the GPL, checkpatch compains about the address. Remove it from the license text. Signed-off-by: Philipp Zabel p.za...@pengutronix.de --- drivers/staging/imx-drm/imx-ldb.c | 5 - drivers/staging/imx-drm/imx-tve.c | 5 - drivers/staging/imx-drm/ipuv3-crtc.c | 5 - drivers/staging/imx-drm/parallel-display.c | 5 - 4 files changed, 20 deletions(-) diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index 4662e00..4caa8bf 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include linux/module.h diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c index f22b2ac..5c436f7 100644 --- a/drivers/staging/imx-drm/imx-tve.c +++ b/drivers/staging/imx-drm/imx-tve.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include linux/clk.h diff --git a/drivers/staging/imx-drm/ipuv3-crtc.c b/drivers/staging/imx-drm/ipuv3-crtc.c index 11e84a2..ebee59c 100644 --- a/drivers/staging/imx-drm/ipuv3-crtc.c +++ b/drivers/staging/imx-drm/ipuv3-crtc.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include linux/component.h #include linux/module.h diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index 015a454..2bc6d05 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c @@ -11,11 +11,6 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. */ #include linux/component.h -- 2.1.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3] MAINTAINERS: add maintainer for i.MX DRM driver
Add myself as the maintainer of the i.MX DRM driver. Signed-off-by: Philipp Zabel p.za...@pengutronix.de --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index df2aecf..ddf191d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3183,6 +3183,13 @@ F: drivers/gpu/drm/exynos/ F: include/drm/exynos* F: include/uapi/drm/exynos* +DRM DRIVERS FOR FREESCALE IMX +M: Philipp Zabel p.za...@pengutronix.de +L: dri-de...@lists.freedesktop.org +S: Maintained +F: drivers/gpu/drm/imx/ +F: Documentation/devicetree/bindings/drm/imx/ + DRM DRIVERS FOR NVIDIA TEGRA M: Thierry Reding thierry.red...@gmail.com M: Terje Bergström tbergst...@nvidia.com -- 2.1.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] drm: imx: Move imx-drm driver out of staging
The imx-drm driver was put into staging mostly for the following reasons, all of which have been addressed or superseded: - convert the irq driver to use linear irq domains - work out the device tree bindings, this lead to the common of_graph bindings being used - factor out common helper functions, this mostly resulted in the component framework and drm of_graph helpers. Before adding new fixes, and certainly before adding new features, move it into its proper place below drivers/gpu/drm. Signed-off-by: Philipp Zabel p.za...@pengutronix.de --- Since this patch is generated with --find-renames, it should be applied on top of the staging-next branch of the staging tree, or at least after commit f582d9a8b955 (drivers: staging: imx-drm driver cleanup). --- .../{staging/imx-drm = drm/imx}/fsl-imx-drm.txt| 0 .../bindings/{staging/imx-drm = drm/imx}/hdmi.txt | 0 .../bindings/{staging/imx-drm = drm/imx}/ldb.txt | 0 drivers/gpu/drm/Kconfig | 2 ++ drivers/gpu/drm/Makefile| 1 + drivers/{staging/imx-drm = gpu/drm/imx}/Kconfig| 0 drivers/{staging/imx-drm = gpu/drm/imx}/Makefile | 0 drivers/{staging/imx-drm = gpu/drm/imx}/imx-drm-core.c | 0 drivers/{staging/imx-drm = gpu/drm/imx}/imx-drm.h | 0 drivers/{staging/imx-drm = gpu/drm/imx}/imx-hdmi.c | 0 drivers/{staging/imx-drm = gpu/drm/imx}/imx-hdmi.h | 0 drivers/{staging/imx-drm = gpu/drm/imx}/imx-ldb.c | 0 drivers/{staging/imx-drm = gpu/drm/imx}/imx-tve.c | 0 drivers/{staging/imx-drm = gpu/drm/imx}/ipuv3-crtc.c | 0 drivers/{staging/imx-drm = gpu/drm/imx}/ipuv3-plane.c | 0 drivers/{staging/imx-drm = gpu/drm/imx}/ipuv3-plane.h | 0 .../{staging/imx-drm = gpu/drm/imx}/parallel-display.c | 0 drivers/staging/Kconfig | 2 -- drivers/staging/Makefile| 1 - drivers/staging/imx-drm/TODO| 17 - 20 files changed, 3 insertions(+), 20 deletions(-) rename Documentation/devicetree/bindings/{staging/imx-drm = drm/imx}/fsl-imx-drm.txt (100%) rename Documentation/devicetree/bindings/{staging/imx-drm = drm/imx}/hdmi.txt (100%) rename Documentation/devicetree/bindings/{staging/imx-drm = drm/imx}/ldb.txt (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/Kconfig (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/Makefile (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/imx-drm-core.c (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/imx-drm.h (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/imx-hdmi.c (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/imx-hdmi.h (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/imx-ldb.c (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/imx-tve.c (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/ipuv3-crtc.c (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/ipuv3-plane.c (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/ipuv3-plane.h (100%) rename drivers/{staging/imx-drm = gpu/drm/imx}/parallel-display.c (100%) delete mode 100644 drivers/staging/imx-drm/TODO diff --git a/Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt b/Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt similarity index 100% rename from Documentation/devicetree/bindings/staging/imx-drm/fsl-imx-drm.txt rename to Documentation/devicetree/bindings/drm/imx/fsl-imx-drm.txt diff --git a/Documentation/devicetree/bindings/staging/imx-drm/hdmi.txt b/Documentation/devicetree/bindings/drm/imx/hdmi.txt similarity index 100% rename from Documentation/devicetree/bindings/staging/imx-drm/hdmi.txt rename to Documentation/devicetree/bindings/drm/imx/hdmi.txt diff --git a/Documentation/devicetree/bindings/staging/imx-drm/ldb.txt b/Documentation/devicetree/bindings/drm/imx/ldb.txt similarity index 100% rename from Documentation/devicetree/bindings/staging/imx-drm/ldb.txt rename to Documentation/devicetree/bindings/drm/imx/ldb.txt diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index e3b4b0f..8e2d0c9 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -200,3 +200,5 @@ source drivers/gpu/drm/tegra/Kconfig source drivers/gpu/drm/panel/Kconfig source drivers/gpu/drm/sti/Kconfig + +source drivers/gpu/drm/imx/Kconfig diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index 9292a76..3829bb1 100644 --- a/drivers/gpu/drm/Makefile +++ b/drivers/gpu/drm/Makefile @@ -62,6 +62,7 @@ obj-$(CONFIG_DRM_BOCHS) += bochs/ obj-$(CONFIG_DRM_MSM) += msm/ obj-$(CONFIG_DRM_TEGRA) += tegra/ obj-$(CONFIG_DRM_STI) += sti/ +obj-$(CONFIG_DRM_IMX) += imx/ obj-y += i2c/ obj-y += panel/ obj-y += bridge/ diff --git a/drivers/staging/imx-drm/Kconfig b/drivers/gpu/drm/imx/Kconfig similarity index 100% rename from drivers/staging/imx-drm/Kconfig rename to
Re: [PATCH 2/3] drm: imx: Move imx-drm driver out of staging
Am Dienstag, den 04.11.2014, 11:52 +0100 schrieb Philipp Zabel: The imx-drm driver was put into staging mostly for the following reasons, all of which have been addressed or superseded: - convert the irq driver to use linear irq domains - work out the device tree bindings, this lead to the common of_graph bindings being used - factor out common helper functions, this mostly resulted in the component framework and drm of_graph helpers. Before adding new fixes, and certainly before adding new features, move it into its proper place below drivers/gpu/drm. Signed-off-by: Philipp Zabel p.za...@pengutronix.de --- Since this patch is generated with --find-renames, it should be applied on top of the staging-next branch of the staging tree, or at least after commit f582d9a8b955 (drivers: staging: imx-drm driver cleanup). The full commit as also available at: git://git.pengutronix.de/git/pza/linux.git topic/imx-drm-destaging regards Philipp ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 01/15] [media] Move mediabus format definition to a more standard place
Well, I gave two alternatives :-) Both are fine as far as I am concerned, but it would be nice to hear what others think. Regards, Hans On 11/04/14 11:45, Boris Brezillon wrote: Hi Hans, On Tue, 04 Nov 2014 11:20:40 +0100 Hans Verkuil hansv...@cisco.com wrote: Hi Boris, On 11/04/14 10:54, Boris Brezillon wrote: Rename mediabus formats and move the enum into a separate header file so that it can be used by DRM/KMS subsystem without any reference to the V4L2 subsystem. Old V4L2_MBUS_FMT_ definitions are now referencing MEDIA_BUS_FMT_ value. I missed earlier that v4l2-mediabus.h contained a struct as well, so it can't be deprecated and neither can a #warning be added. The best approach, I think, is to use a macro in media-bus-format.h that will either define just the MEDIA_BUS value when compiled in the kernel, or define both MEDIA_BUS and V4L2_MBUS values when compiled for userspace. E.g. something like this: #ifdef __KERNEL__ #define MEDIA_BUS_FMT_ENTRY(name, val) MEDIA_BUS_FMT_ # name = val #else /* Keep V4L2_MBUS_FMT for backwards compatibility */ #define MEDIA_BUS_FMT_ENTRY(name, val) \ MEDIA_BUS_FMT_ # name = val, \ V4L2_MBUS_FMT_ # name = val #endif Okay, but this means we keep adding V4L2_MBUS_FMT_ definitions even for new formats (which definitely doesn't encourage people to move on). Moreover, we add a V4L2 prefix in what was supposed to be a subsystem neutral header. Anyway, these are just nitpicks, and if you prefer this approach I'll rework my series :-). An alternative approach is to have v4l2-mediabus.h include media-bus-format.h, put #ifndef __KERNEL__ around the enum v4l2_mbus_pixelcode and add a big comment there that applications should use the defines from media-bus-format.h and that this enum is frozen (i.e. new values are only added to media-bus-format.h). But I think I like the macro idea best. As you wish, my only intent is to use those bus format definitions in a DRM driver :-). Thanks, Boris ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] MAINTAINERS: add maintainer for i.MX DRM driver
On Tue, Nov 4, 2014 at 6:52 PM, Philipp Zabel p.za...@pengutronix.de wrote: Add myself as the maintainer of the i.MX DRM driver. Signed-off-by: Philipp Zabel p.za...@pengutronix.de Acked-by: Shawn Guo shawn@linaro.org --- MAINTAINERS | 7 +++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index df2aecf..ddf191d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3183,6 +3183,13 @@ F: drivers/gpu/drm/exynos/ F: include/drm/exynos* F: include/uapi/drm/exynos* +DRM DRIVERS FOR FREESCALE IMX +M: Philipp Zabel p.za...@pengutronix.de +L: dri-de...@lists.freedesktop.org +S: Maintained +F: drivers/gpu/drm/imx/ +F: Documentation/devicetree/bindings/drm/imx/ + DRM DRIVERS FOR NVIDIA TEGRA M: Thierry Reding thierry.red...@gmail.com M: Terje Bergström tbergst...@nvidia.com -- 2.1.1 ___ dri-devel mailing list dri-de...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] make imx hdmi publicly used by dw hdmi compatible platform
From: Andy yan andy@rock-chips.com We found freescale imx6 and rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly difference, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only access by word), 4K support(imx6 doesn't support 4k, but rk3288 does). To reuse the imx-hdmi driver, we do this patch set: patch (1): split out imx-soc code from imx-hdmi to dw_hdmi-imx.c patch (2): move imx-hdmi to bridge/, and rename to dw-hdmi to make this driver indepent of drm-imx . And we will add rockchip platform specific code dw_hdmi-rockchip.c later, this is depend on drm-rockchip. Andy Yan (1): imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi Andy yan (1): move imx-hdmi to bridge/dw-hdmi drivers/gpu/drm/bridge/Kconfig|5 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/dw_hdmi.c | 1651 ++ drivers/gpu/drm/bridge/dw_hdmi.h | 1032 +++ drivers/staging/imx-drm/Kconfig |1 + drivers/staging/imx-drm/Makefile |2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 214 drivers/staging/imx-drm/imx-hdmi.c| 1767 - drivers/staging/imx-drm/imx-hdmi.h| 1032 --- include/drm/bridge/dw_hdmi.h | 114 +++ 10 files changed, 3019 insertions(+), 2800 deletions(-) create mode 100644 drivers/gpu/drm/bridge/dw_hdmi.c create mode 100644 drivers/gpu/drm/bridge/dw_hdmi.h create mode 100644 drivers/staging/imx-drm/dw_hdmi-imx.c delete mode 100644 drivers/staging/imx-drm/imx-hdmi.c delete mode 100644 drivers/staging/imx-drm/imx-hdmi.h create mode 100644 include/drm/bridge/dw_hdmi.h -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] tools: hv: introduce -n/--no-daemon option
KY Srinivasan k...@microsoft.com writes: -Original Message- From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] Sent: Wednesday, October 22, 2014 9:07 AM To: KY Srinivasan; Haiyang Zhang; de...@linuxdriverproject.org Cc: linux-ker...@vger.kernel.org Subject: [PATCH] tools: hv: introduce -n/--no-daemon option All tools/hv daemons do mandatory daemon() on startup. However, no pidfile is created, this make it difficult for an init system to track such daemons. Modern linux distros use systemd as their init system. It can handle the daemonizing by itself, however, it requires a daemon to stay in foreground for that. Some distros already carry distro-specific patch for hv tools which switches off daemon(). Introduce -n/--no-daemon option for all 3 daemons in hv/tools. Parse options with getopt() to make this part easily expandable. Signed-off-by: Vitaly Kuznetsov vkuzn...@redhat.com You may want to include Greg KH in the to list. For some reason he's missing on the get_maintainer.pl output for all Hyper-V parts. Greg, will you pick this up or do I need to resend? Signed-off-by: K. Y. Srinivasan k...@microsoft.com Thanks! --- tools/hv/hv_fcopy_daemon.c | 33 +++- - tools/hv/hv_kvp_daemon.c | 34 -- tools/hv/hv_vss_daemon.c | 33 +++-- 3 files changed, 94 insertions(+), 6 deletions(-) diff --git a/tools/hv/hv_fcopy_daemon.c b/tools/hv/hv_fcopy_daemon.c index 8f96b3e..f437d73 100644 --- a/tools/hv/hv_fcopy_daemon.c +++ b/tools/hv/hv_fcopy_daemon.c @@ -33,6 +33,7 @@ #include sys/stat.h #include fcntl.h #include dirent.h +#include getopt.h static int target_fd; static char target_fname[W_MAX_PATH]; @@ -126,15 +127,43 @@ static int hv_copy_cancel(void) } -int main(void) +void print_usage(char *argv[]) +{ +fprintf(stderr, Usage: %s [options]\n +Options are:\n + -n, --no-daemonstay in foreground, don't daemonize\n + -h, --help print this help\n, argv[0]); +} + +int main(int argc, char *argv[]) { int fd, fcopy_fd, len; int error; +int daemonize = 1, long_index = 0, opt; int version = FCOPY_CURRENT_VERSION; char *buffer[4096 * 2]; struct hv_fcopy_hdr *in_msg; -if (daemon(1, 0)) { +static struct option long_options[] = { +{help,no_argument, 0, 'h' }, +{no-daemon, no_argument, 0, 'n' }, +{0, 0, 0, 0 } +}; + +while ((opt = getopt_long(argc, argv, hn, long_options, + long_index)) != -1) { +switch (opt) { +case 'n': +daemonize = 0; +break; +case 'h': +default: +print_usage(argv); +exit(EXIT_FAILURE); +} +} + +if (daemonize daemon(1, 0)) { syslog(LOG_ERR, daemon() failed; error: %s, strerror(errno)); exit(EXIT_FAILURE); } diff --git a/tools/hv/hv_kvp_daemon.c b/tools/hv/hv_kvp_daemon.c index 4088b81..22b0764 100644 --- a/tools/hv/hv_kvp_daemon.c +++ b/tools/hv/hv_kvp_daemon.c @@ -43,6 +43,7 @@ #include fcntl.h #include dirent.h #include net/if.h +#include getopt.h /* * KVP protocol: The user mode component first registers with the @@ - 1417,7 +1418,15 @@ netlink_send(int fd, struct cn_msg *msg) return sendmsg(fd, message, 0); } -int main(void) +void print_usage(char *argv[]) +{ +fprintf(stderr, Usage: %s [options]\n +Options are:\n + -n, --no-daemonstay in foreground, don't daemonize\n + -h, --help print this help\n, argv[0]); +} + +int main(int argc, char *argv[]) { int fd, len, nl_group; int error; @@ -1435,9 +1444,30 @@ int main(void) struct hv_kvp_ipaddr_value *kvp_ip_val; char *kvp_recv_buffer; size_t kvp_recv_buffer_len; +int daemonize = 1, long_index = 0, opt; + +static struct option long_options[] = { +{help,no_argument, 0, 'h' }, +{no-daemon, no_argument, 0, 'n' }, +{0, 0, 0, 0 } +}; + +while ((opt = getopt_long(argc, argv, hn, long_options, + long_index)) != -1) { +switch (opt) { +case 'n': +daemonize = 0; +break; +case 'h': +default: +print_usage(argv); +exit(EXIT_FAILURE); +} +} -if (daemon(1, 0)) +if (daemonize daemon(1, 0)) return 1; + openlog(KVP, 0, LOG_USER); syslog(LOG_INFO, KVP starting; pid is:%d, getpid()); diff --git
Re: [PATCH 2/2] move imx-hdmi to bridge/dw-hdmi
Hi, On 04/11/14 13:39, Andy Yan wrote: From: Andy yan andy@rock-chips.com the original imx hdmi driver is under staging/imx-drm, which depends on imx-drm, so move the imx hdmi drvier out to drm/bridge and rename imx-hdmi to dw-hdmi Change-Id: I5f417372f256aa26cd00a3cd0160741680afd39d --- drivers/gpu/drm/bridge/Kconfig|5 + drivers/gpu/drm/bridge/Makefile |1 + drivers/gpu/drm/bridge/dw_hdmi.c | 1651 + drivers/gpu/drm/bridge/dw_hdmi.h | 1032 + drivers/staging/imx-drm/Kconfig |1 + drivers/staging/imx-drm/Makefile |2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 66 +- drivers/staging/imx-drm/imx-hdmi.c| 1651 - drivers/staging/imx-drm/imx-hdmi.h| 1032 - include/drm/bridge/dw_hdmi.h | 26 +- 10 files changed, 2737 insertions(+), 2730 deletions(-) create mode 100644 drivers/gpu/drm/bridge/dw_hdmi.c create mode 100644 drivers/gpu/drm/bridge/dw_hdmi.h delete mode 100644 drivers/staging/imx-drm/imx-hdmi.c delete mode 100644 drivers/staging/imx-drm/imx-hdmi.h Could you try generating this patch with the -M option? git format-patch should then understand its a rename. Then it should generate a smaller patch that is possible to review easily. Thanks ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi
imx6 and rockchip rk3288 and JZ4780 (Ingenic Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly difference, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width), 4K support(imx6 doesn't support 4k, but rk3288 does), clk useage,and the crtc mux configuration is also platform specific. To reuse the imx hdmi driver, split the platform specific code out to dw_hdmi-imx.c. Change-Id: I85e8d08754052b118423729a01c6d17bf485f383 --- drivers/staging/imx-drm/Makefile | 2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 214 ++ drivers/staging/imx-drm/imx-hdmi.c| 726 ++ include/drm/bridge/dw_hdmi.h | 114 ++ 4 files changed, 634 insertions(+), 422 deletions(-) create mode 100644 drivers/staging/imx-drm/dw_hdmi-imx.c create mode 100644 include/drm/bridge/dw_hdmi.h diff --git a/drivers/staging/imx-drm/Makefile b/drivers/staging/imx-drm/Makefile index 582c438..809027d 100644 --- a/drivers/staging/imx-drm/Makefile +++ b/drivers/staging/imx-drm/Makefile @@ -9,4 +9,4 @@ obj-$(CONFIG_DRM_IMX_LDB) += imx-ldb.o imx-ipuv3-crtc-objs := ipuv3-crtc.o ipuv3-plane.o obj-$(CONFIG_DRM_IMX_IPUV3)+= imx-ipuv3-crtc.o -obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o +obj-$(CONFIG_DRM_IMX_HDMI) += imx-hdmi.o dw_hdmi-imx.o diff --git a/drivers/staging/imx-drm/dw_hdmi-imx.c b/drivers/staging/imx-drm/dw_hdmi-imx.c new file mode 100644 index 000..71ac859 --- /dev/null +++ b/drivers/staging/imx-drm/dw_hdmi-imx.c @@ -0,0 +1,214 @@ +/* + * 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. + */ +#include linux/module.h +#include linux/platform_device.h +#include linux/mfd/syscon.h +#include linux/mfd/syscon/imx6q-iomuxc-gpr.h +#include drm/bridge/dw_hdmi.h +#include video/imx-ipu-v3.h +#include linux/regmap.h +#include linux/clk.h + +#include imx-drm.h + +struct imx_hdmi_priv { + struct device *dev; + struct clk *isfr_clk; + struct clk *iahb_clk; + struct regmap *regmap; +}; + +static const struct mpll_config imx_mpll_cfg[] = { + { + 4525, { + { 0x01e0, 0x }, + { 0x21e1, 0x }, + { 0x41e2, 0x } + }, + }, { + 9250, { + { 0x0140, 0x0005 }, + { 0x2141, 0x0005 }, + { 0x4142, 0x0005 }, + }, + }, { + 14850, { + { 0x00a0, 0x000a }, + { 0x20a1, 0x000a }, + { 0x40a2, 0x000a }, + }, + }, { + ~0UL, { + { 0x00a0, 0x000a }, + { 0x2001, 0x000f }, + { 0x4002, 0x000f }, + }, + } +}; + +static const struct curr_ctrl imx_cur_ctr[] = { + /* pixelclk bpp8bpp10 bpp12 */ + { + 5400, { 0x091c, 0x091c, 0x06dc }, + }, { + 5840, { 0x091c, 0x06dc, 0x06dc }, + }, { + 7200, { 0x06dc, 0x06dc, 0x091c }, + }, { + 7425, { 0x06dc, 0x0b5c, 0x091c }, + }, { + 11880, { 0x091c, 0x091c, 0x06dc }, + }, { + 21600, { 0x06dc, 0x0b5c, 0x091c }, + } +}; + +static int imx_hdmi_parse_dt(struct imx_hdmi_priv *hdmi) +{ + struct device_node *np = hdmi-dev-of_node; + + hdmi-regmap = syscon_regmap_lookup_by_phandle(np, gpr); + if (IS_ERR(hdmi-regmap)) { + dev_err(hdmi-dev, Unable to get gpr\n); + return PTR_ERR(hdmi-regmap); + } + + hdmi-isfr_clk = devm_clk_get(hdmi-dev, isfr); + if (IS_ERR(hdmi-isfr_clk)) { + dev_err(hdmi-dev, Unable to get HDMI isfr clk\n); + return PTR_ERR(hdmi-isfr_clk); + } + + hdmi-iahb_clk = devm_clk_get(hdmi-dev, iahb); + if (IS_ERR(hdmi-iahb_clk)) { + dev_err(hdmi-dev, Unable to get HDMI iahb clk\n); + return PTR_ERR(hdmi-iahb_clk); + } + + return 0; +} + +static void *imx_hdmi_imx_setup(struct platform_device *pdev) +{ + struct imx_hdmi_priv *hdmi; + int ret; + + hdmi = devm_kzalloc(pdev-dev, sizeof(*hdmi), GFP_KERNEL); + if (!hdmi) + return ERR_PTR(-ENOMEM); + hdmi-dev = pdev-dev; + + ret = imx_hdmi_parse_dt(hdmi); + if (ret 0) + return ERR_PTR(ret); + ret = clk_prepare_enable(hdmi-isfr_clk); + if (ret) { + dev_err(hdmi-dev, + Cannot enable HDMI isfr clock: %d\n, ret); + return ERR_PTR(ret); + } + + ret = clk_prepare_enable(hdmi-iahb_clk); + if (ret) { +
Re: [PATCH 1/2] imx-drm: imx-hdmi: split imx soc specific code from imx-hdmi
Hi Andy, On 04/11/14 13:33, Andy Yan wrote: imx6 and rockchip rk3288 and JZ4780 (Ingenic Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly difference, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width), 4K support(imx6 doesn't support 4k, but rk3288 does), clk useage,and the crtc mux configuration is also platform specific. To reuse the imx hdmi driver, split the platform specific code out to dw_hdmi-imx.c. Change-Id: I85e8d08754052b118423729a01c6d17bf485f383 --- drivers/staging/imx-drm/Makefile | 2 +- drivers/staging/imx-drm/dw_hdmi-imx.c | 214 ++ drivers/staging/imx-drm/imx-hdmi.c| 726 ++ include/drm/bridge/dw_hdmi.h | 114 ++ 4 files changed, 634 insertions(+), 422 deletions(-) create mode 100644 drivers/staging/imx-drm/dw_hdmi-imx.c create mode 100644 include/drm/bridge/dw_hdmi.h This one patch does too much to be reviewed easily. One patch is supposed to modify/add one thing at a time in the kernel. Separating platform specific code from imx-drm/imx-hdmi is one thing. Adding support for multi-byte register access is something different. i.e. Something like. 1/3 split platform specific code out. 2/3 move/rename imx-hdmi outside the folder 3/3 add support for multi byte register width access. If there are other things that are not directly relevant to the patch, it goes in a different patch. Bug fixes are also separate. This should result in readable patches that can be reviewed easily. The maintainers might be able to guide on how to further split the patches if necessary. Cheers, ZubairLK ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/2] make imx hdmi publicly used by dw hdmi compatible platform
On Tue, Nov 04, 2014 at 09:33:10PM +0800, Andy Yan wrote: From: Andy yan andy@rock-chips.com We found freescale imx6 and rockchip rk3288 and Ingenic JZ4780 (Xburst/MIPS) use the interface compatible Designware HDMI IP, but they also have some lightly difference, such as phy pll configuration, register width(imx hdmi register is one byte, but rk3288 is 4 bytes width and can only access by word), 4K support(imx6 doesn't support 4k, but rk3288 does). To reuse the imx-hdmi driver, we do this patch set: patch (1): split out imx-soc code from imx-hdmi to dw_hdmi-imx.c patch (2): move imx-hdmi to bridge/, and rename to dw-hdmi to make this driver indepent of drm-imx . And we will add rockchip platform specific code dw_hdmi-rockchip.c later, this is depend on drm-rockchip. Great - I fully agree that this needs to be renamed as it is a Designware IP. Should it be moved into bridge/ ? It isn't implemented as a DRM bridge driver at present, so this seems illogical. Is the longer term plan to convert it to be a DRM bridge? Secondly, if you want HDMI audio support, you may find the patches I maintain for the SolidRun devices useful, which add this as a standard ALSA device. I also have CEC support for it as well. If you're interested, I'll email those. -- FTTC broadband for 0.8mile line: currently at 9.5Mbps down 400kbps up according to speedtest.net. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] move imx-hdmi to bridge/dw-hdmi
On Tue, Nov 04, 2014 at 09:39:58PM +0800, Andy Yan wrote: From: Andy yan andy@rock-chips.com the original imx hdmi driver is under staging/imx-drm, which depends on imx-drm, so move the imx hdmi drvier out to drm/bridge and rename imx-hdmi to dw-hdmi Change-Id: I5f417372f256aa26cd00a3cd0160741680afd39d Never include this line in a public patch, it means nothing to us, sorry... ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] drm: imx: Move imx-drm driver out of staging
Hi Philipp, Just a flyby question On 04/11/14 10:52, Philipp Zabel wrote: The imx-drm driver was put into staging mostly for the following reasons, all of which have been addressed or superseded: - convert the irq driver to use linear irq domains - work out the device tree bindings, this lead to the common of_graph bindings being used Afaics Steve's patches introduce some non-backward compatible changes to the DT bindings (s/port/crtc/). Shouldn't those be discussed/resolved prior to pushing the driver out of staging ? Cheers, Emil ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/15] staging: unisys: fix spacing in periodic_work.c
Get rid of all extraneous blank lines in periodic_work.c. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/periodic_work.c | 16 1 file changed, 16 deletions(-) diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 3dd1c04..73c31f7 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -25,8 +25,6 @@ #define MYDRVNAME periodic_work - - struct periodic_work { rwlock_t lock; struct delayed_work work; @@ -39,8 +37,6 @@ struct periodic_work { const char *devnam; }; - - static void periodic_work_func(struct work_struct *work) { struct periodic_work *pw; @@ -49,8 +45,6 @@ static void periodic_work_func(struct work_struct *work) (*pw-workfunc)(pw-workfuncarg); } - - struct periodic_work *visor_periodic_work_create(ulong jiffy_interval, struct workqueue_struct *workqueue, void (*workfunc)(void *), @@ -73,16 +67,12 @@ struct periodic_work *visor_periodic_work_create(ulong jiffy_interval, } EXPORT_SYMBOL_GPL(visor_periodic_work_create); - - void visor_periodic_work_destroy(struct periodic_work *pw) { kfree(pw); } EXPORT_SYMBOL_GPL(visor_periodic_work_destroy); - - /** Call this from your periodic work worker function to schedule the next * call. * If this function returns FALSE, there was a failure and the @@ -112,8 +102,6 @@ unlock: } EXPORT_SYMBOL_GPL(visor_periodic_work_nextperiod); - - /** This function returns TRUE iff new periodic work was actually started. * If this function returns FALSE, then no work was started * (either because it was already started, or because of a failure). @@ -145,13 +133,9 @@ BOOL visor_periodic_work_start(struct periodic_work *pw) unlock: write_unlock(pw-lock); return rc; - } EXPORT_SYMBOL_GPL(visor_periodic_work_start); - - - /** This function returns TRUE iff your call actually stopped the periodic * work. * -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/15] staging: unisys: fix line over 80 characters in mapit()
The error output in mapit() in memregion_direct.c has variables past the 80 character limit. Move them to the next line, but the string constant will still go past the limit, and that's okay. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/memregion_direct.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index b5cbf83..37770aa 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -109,7 +109,8 @@ mapit(struct memregion *memregion) memregion-requested = FALSE; if (!request_mem_region(physaddr, nbytes, MYDRVNAME)) - ERRDRV(cannot reserve channel memory @0x%lx for 0x%lx-- no big deal, physaddr, nbytes); + ERRDRV(cannot reserve channel memory @0x%lx for 0x%lx-- no big deal, + physaddr, nbytes); else memregion-requested = TRUE; memregion-mapped = ioremap_cache(physaddr, nbytes); -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/15] staging: unisys: remove extra blank lines in memregion_direct.c
Get rid of the extra blank lines in this file. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/memregion_direct.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index f4182d4..b5cbf83 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -101,7 +101,6 @@ visor_memregion_create_overlapped(struct memregion *parent, ulong offset, } EXPORT_SYMBOL_GPL(visor_memregion_create_overlapped); - static BOOL mapit(struct memregion *memregion) { @@ -177,7 +176,6 @@ visor_memregion_resize(struct memregion *memregion, ulong newsize) } EXPORT_SYMBOL_GPL(visor_memregion_resize); - static int memregion_readwrite(BOOL is_write, struct memregion *memregion, ulong offset, -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/15] staging: unisys: add comment to spinlock in struct charqueue
Add a comment to the charqueue's spinlock to explain that it is a lock for the structure. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/charqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index 1ce7003..46582f1 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -28,7 +28,7 @@ struct charqueue { int alloc_size; int nslots; - spinlock_t lock; + spinlock_t lock; /*read/write lock for this structure*/ int head, tail; unsigned char buf[0]; }; -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/15] staging: unisys: fix sizeof() in visor_memregion_create_overlapped()
Use the variable name rather than the type in the sizeof() call in this function. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/memregion_direct.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 37770aa..26faad4 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -86,7 +86,7 @@ visor_memregion_create_overlapped(struct memregion *parent, ulong offset, __func__, offset, nbytes); return NULL; } - memregion = kzalloc(sizeof(struct memregion), GFP_KERNEL|__GFP_NORETRY); + memregion = kzalloc(sizeof(*memregion), GFP_KERNEL|__GFP_NORETRY); if (memregion == NULL) { ERRDRV(%s allocation failed, __func__); return NULL; -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/15] staging: unisys: fix line spacing in charqueue.c
Clean up the extraneous blank lines in charqueue.c. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/charqueue.c | 16 1 file changed, 16 deletions(-) diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index 22241c7..cdc9cc3 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -25,8 +25,6 @@ #define IS_EMPTY(charqueue) (charqueue-head == charqueue-tail) - - struct CHARQUEUE_Tag { int alloc_size; int nslots; @@ -35,8 +33,6 @@ struct CHARQUEUE_Tag { unsigned char buf[0]; }; - - CHARQUEUE *visor_charqueue_create(ulong nslots) { int alloc_size = sizeof(CHARQUEUE) + nslots + 1; @@ -55,8 +51,6 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) } EXPORT_SYMBOL_GPL(visor_charqueue_create); - - void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) { int alloc_slots = charqueue-nslots+1; /* 1 slot is always empty */ @@ -71,8 +65,6 @@ void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) } EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); - - BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) { BOOL b; @@ -84,8 +76,6 @@ BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) } EXPORT_SYMBOL_GPL(visor_charqueue_is_empty); - - static int charqueue_dequeue_1(CHARQUEUE *charqueue) { int alloc_slots = charqueue-nslots + 1; /* 1 slot is always empty */ @@ -96,8 +86,6 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue) return charqueue-buf[charqueue-tail]; } - - int charqueue_dequeue(CHARQUEUE *charqueue) { int rc; @@ -108,8 +96,6 @@ int charqueue_dequeue(CHARQUEUE *charqueue) return rc; } - - int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) { int rc, counter = 0, c; @@ -132,8 +118,6 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) } EXPORT_SYMBOL_GPL(visor_charqueue_dequeue_n); - - void visor_charqueue_destroy(CHARQUEUE *charqueue) { if (charqueue == NULL) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/15] staging: unisys: refactor visorutil_spar_detect()
Fix the declaration line so it is just one single line, and add the missing brackets on the else clause in the if statement. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/visorkmodutils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index 69ed4b1..3ab990b 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c @@ -36,8 +36,7 @@ int unisys_spar_platform; EXPORT_SYMBOL_GPL(unisys_spar_platform); -static __init uint32_t -visorutil_spar_detect(void) +static __init uint32_t visorutil_spar_detect(void) { unsigned int eax, ebx, ecx, edx; @@ -47,8 +46,9 @@ visorutil_spar_detect(void) return (ebx == UNISYS_SPAR_ID_EBX) (ecx == UNISYS_SPAR_ID_ECX) (edx == UNISYS_SPAR_ID_EDX); - } else + } else { return 0; + } } static __init int -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/15] staging: unisys: fix bracketing in visor_periodic_work_stop()
The last if statement in this function is missing brackets on the else clause. Add them. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/periodic_work.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorutil/periodic_work.c b/drivers/staging/unisys/visorutil/periodic_work.c index 73c31f7..0908bf9 100644 --- a/drivers/staging/unisys/visorutil/periodic_work.c +++ b/drivers/staging/unisys/visorutil/periodic_work.c @@ -207,8 +207,9 @@ BOOL visor_periodic_work_stop(struct periodic_work *pw) */ SLEEPJIFFIES(10); write_lock(pw-lock); - } else + } else { pw-want_to_stop = FALSE; + } } write_unlock(pw-lock); return stopped_something; -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/15] staging: unisys: refactor visor_memregion_create()
Fix the sizeof() so it uses the variable name rather than the type, fix the argument alignment to the kzalloc(), and rename the goto label. Away = cleanup Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/memregion_direct.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 73228d2..3f1f313 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -41,8 +41,8 @@ struct memregion * visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) { struct memregion *rc = NULL; - struct memregion *memregion = kzalloc(sizeof(struct memregion), - GFP_KERNEL | __GFP_NORETRY); + struct memregion *memregion = kzalloc(sizeof(*memregion), + GFP_KERNEL | __GFP_NORETRY); if (memregion == NULL) { ERRDRV(visor_memregion_create allocation failed); return NULL; @@ -52,10 +52,10 @@ visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes) memregion-overlapped = FALSE; if (!mapit(memregion)) { rc = NULL; - goto Away; + goto cleanup; } rc = memregion; -Away: +cleanup: if (rc == NULL) { if (memregion != NULL) { visor_memregion_destroy(memregion); -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/15] staging: unisys: refactor visorutil_mod_init()
Fix the function name declaration so it is just one line, and add the missing brackets to the else clause in the if statement. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/visorkmodutils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index 3ab990b..556e264 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c @@ -51,14 +51,14 @@ static __init uint32_t visorutil_spar_detect(void) } } -static __init int -visorutil_mod_init(void) +static __init int visorutil_mod_init(void) { if (visorutil_spar_detect()) { unisys_spar_platform = TRUE; return 0; - } else + } else { return -ENODEV; + } } static __exit void -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/15] staging: unisys: cleanup in visorutil
Fix warnings, errors, and strict checks in the visorutil directory. Benjamin Romer (15): staging: unisys: fix line spacing in charqueue.c staging: unisys: refactor CHARQUEUE staging: unisys: split double assignment in visor_charqueue_create() staging: unisys: add comment to spinlock in struct charqueue staging: unisys: remove typedef for MEMREGION staging: unisys: refactor visor_memregion_create() staging: unisys: remove unnecessary spaces in casts in memregion_direct.c staging: unisys: remove extra blank lines in memregion_direct.c staging: unisys: fix line over 80 characters in mapit() staging: unisys: fix sizeof() in visor_memregion_create_overlapped() staging: unisys: fix spacing in periodic_work.c staging: unisys: fix bracketing in visor_periodic_work_stop() staging: unisys: fix spacing in visorkmodutils.c staging: unisys: refactor visorutil_spar_detect() staging: unisys: refactor visorutil_mod_init() drivers/staging/unisys/visorchannel/visorchannel.h | 2 +- .../unisys/visorchannel/visorchannel_funcs.c | 6 +-- drivers/staging/unisys/visorchipset/parser.c | 2 +- drivers/staging/unisys/visorutil/charqueue.c | 42 ++-- drivers/staging/unisys/visorutil/charqueue.h | 17 --- drivers/staging/unisys/visorutil/memregion.h | 28 +-- .../staging/unisys/visorutil/memregion_direct.c| 58 +++--- drivers/staging/unisys/visorutil/periodic_work.c | 19 +-- drivers/staging/unisys/visorutil/visorkmodutils.c | 16 +++--- 9 files changed, 79 insertions(+), 111 deletions(-) -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/15] staging: unisys: remove typedef for MEMREGION
Remove the typedef for this structure and just use struct memregion instead. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorchannel/visorchannel.h | 2 +- .../unisys/visorchannel/visorchannel_funcs.c | 6 ++-- drivers/staging/unisys/visorchipset/parser.c | 2 +- drivers/staging/unisys/visorutil/memregion.h | 28 +++ .../staging/unisys/visorutil/memregion_direct.c| 41 +++--- 5 files changed, 40 insertions(+), 39 deletions(-) diff --git a/drivers/staging/unisys/visorchannel/visorchannel.h b/drivers/staging/unisys/visorchannel/visorchannel.h index 9a4d7b6..5061edf 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel.h +++ b/drivers/staging/unisys/visorchannel/visorchannel.h @@ -66,7 +66,7 @@ char *visorchannel_id(VISORCHANNEL *channel, char *s); char *visorchannel_zoneid(VISORCHANNEL *channel, char *s); u64 visorchannel_get_clientpartition(VISORCHANNEL *channel); uuid_le visorchannel_get_uuid(VISORCHANNEL *channel); -MEMREGION *visorchannel_get_memregion(VISORCHANNEL *channel); +struct memregion *visorchannel_get_memregion(VISORCHANNEL *channel); char *visorchannel_uuid_id(uuid_le *guid, char *s); void visorchannel_debug(VISORCHANNEL *channel, int nQueues, struct seq_file *seq, u32 off); diff --git a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c index 5fbd5ad..a50251a 100644 --- a/drivers/staging/unisys/visorchannel/visorchannel_funcs.c +++ b/drivers/staging/unisys/visorchannel/visorchannel_funcs.c @@ -29,7 +29,7 @@ #define MYDRVNAME visorchannel struct VISORCHANNEL_Tag { - MEMREGION *memregion; /* from visor_memregion_create() */ + struct memregion *memregion;/* from visor_memregion_create() */ struct channel_header chan_hdr; uuid_le guid; ulong size; @@ -212,7 +212,7 @@ visorchannel_get_uuid(VISORCHANNEL *channel) } EXPORT_SYMBOL_GPL(visorchannel_get_uuid); -MEMREGION * +struct memregion * visorchannel_get_memregion(VISORCHANNEL *channel) { return channel-memregion; @@ -565,7 +565,7 @@ visorchannel_debug(VISORCHANNEL *channel, int nQueues, { HOSTADDRESS addr = 0; ulong nbytes = 0, nbytes_region = 0; - MEMREGION *memregion = NULL; + struct memregion *memregion = NULL; struct channel_header hdr; struct channel_header *phdr = hdr; int i = 0; diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c index 6c2eac0..9edbd3b 100644 --- a/drivers/staging/unisys/visorchipset/parser.c +++ b/drivers/staging/unisys/visorchipset/parser.c @@ -47,7 +47,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL isLocal, int allocbytes = sizeof(PARSER_CONTEXT) + bytes; PARSER_CONTEXT *rc = NULL; PARSER_CONTEXT *ctx = NULL; - MEMREGION *rgn = NULL; + struct memregion *rgn = NULL; struct spar_controlvm_parameters_header *phdr = NULL; if (tryAgain) diff --git a/drivers/staging/unisys/visorutil/memregion.h b/drivers/staging/unisys/visorutil/memregion.h index f4a65d2..0c3eebc 100644 --- a/drivers/staging/unisys/visorutil/memregion.h +++ b/drivers/staging/unisys/visorutil/memregion.h @@ -20,24 +20,24 @@ #include timskmod.h -/* MEMREGION is an opaque structure to users. +/* struct memregion is an opaque structure to users. * Fields are declared only in the implementation .c files. */ -typedef struct MEMREGION_Tag MEMREGION; +struct memregion; -MEMREGION *visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes); -MEMREGION *visor_memregion_create_overlapped(MEMREGION *parent, -ulong offset, ulong nbytes); -int visor_memregion_resize(MEMREGION *memregion, ulong newsize); -int visor_memregion_read(MEMREGION *memregion, - ulong offset, void *dest, ulong nbytes); -int visor_memregion_write(MEMREGION *memregion, +struct memregion *visor_memregion_create(HOSTADDRESS physaddr, ulong nbytes); +struct memregion *visor_memregion_create_overlapped(struct memregion *parent, + ulong offset, ulong nbytes); +int visor_memregion_resize(struct memregion *memregion, ulong newsize); +int visor_memregion_read(struct memregion *memregion, +ulong offset, void *dest, ulong nbytes); +int visor_memregion_write(struct memregion *memregion, ulong offset, void *src, ulong nbytes); -void visor_memregion_destroy(MEMREGION *memregion); -HOSTADDRESS visor_memregion_get_physaddr(MEMREGION *memregion); -ulong visor_memregion_get_nbytes(MEMREGION *memregion); -void memregion_dump(MEMREGION *memregion, char *s, +void visor_memregion_destroy(struct memregion *memregion); +HOSTADDRESS visor_memregion_get_physaddr(struct memregion *memregion); +ulong visor_memregion_get_nbytes(struct memregion
[PATCH 02/15] staging: unisys: refactor CHARQUEUE
Remove the typedef and just use struct charqueue instead. Update all references. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/charqueue.c | 21 +++-- drivers/staging/unisys/visorutil/charqueue.h | 17 + 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index cdc9cc3..7861e73 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -25,7 +25,7 @@ #define IS_EMPTY(charqueue) (charqueue-head == charqueue-tail) -struct CHARQUEUE_Tag { +struct charqueue { int alloc_size; int nslots; spinlock_t lock; @@ -33,10 +33,10 @@ struct CHARQUEUE_Tag { unsigned char buf[0]; }; -CHARQUEUE *visor_charqueue_create(ulong nslots) +struct charqueue *visor_charqueue_create(ulong nslots) { - int alloc_size = sizeof(CHARQUEUE) + nslots + 1; - CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); + int alloc_size = sizeof(struct charqueue) + nslots + 1; + struct charqueue *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY); if (cq == NULL) { ERRDRV(visor_charqueue_create allocation failed (alloc_size=%d), @@ -51,7 +51,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots) } EXPORT_SYMBOL_GPL(visor_charqueue_create); -void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) +void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c) { int alloc_slots = charqueue-nslots+1; /* 1 slot is always empty */ @@ -65,7 +65,7 @@ void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c) } EXPORT_SYMBOL_GPL(visor_charqueue_enqueue); -BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) +BOOL visor_charqueue_is_empty(struct charqueue *charqueue) { BOOL b; @@ -76,7 +76,7 @@ BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue) } EXPORT_SYMBOL_GPL(visor_charqueue_is_empty); -static int charqueue_dequeue_1(CHARQUEUE *charqueue) +static int charqueue_dequeue_1(struct charqueue *charqueue) { int alloc_slots = charqueue-nslots + 1; /* 1 slot is always empty */ @@ -86,7 +86,7 @@ static int charqueue_dequeue_1(CHARQUEUE *charqueue) return charqueue-buf[charqueue-tail]; } -int charqueue_dequeue(CHARQUEUE *charqueue) +int charqueue_dequeue(struct charqueue *charqueue) { int rc; @@ -96,7 +96,8 @@ int charqueue_dequeue(CHARQUEUE *charqueue) return rc; } -int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) +int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf, + int n) { int rc, counter = 0, c; @@ -118,7 +119,7 @@ int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n) } EXPORT_SYMBOL_GPL(visor_charqueue_dequeue_n); -void visor_charqueue_destroy(CHARQUEUE *charqueue) +void visor_charqueue_destroy(struct charqueue *charqueue) { if (charqueue == NULL) return; diff --git a/drivers/staging/unisys/visorutil/charqueue.h b/drivers/staging/unisys/visorutil/charqueue.h index d6f1658..56c1f79 100644 --- a/drivers/staging/unisys/visorutil/charqueue.h +++ b/drivers/staging/unisys/visorutil/charqueue.h @@ -21,17 +21,18 @@ #include uniklog.h #include timskmod.h -/* CHARQUEUE is an opaque structure to users. +/* struct charqueue is an opaque structure to users. * Fields are declared only in the implementation .c files. */ -typedef struct CHARQUEUE_Tag CHARQUEUE; +struct charqueue; -CHARQUEUE *visor_charqueue_create(ulong nslots); -void visor_charqueue_enqueue(CHARQUEUE *charqueue, unsigned char c); -int charqueue_dequeue(CHARQUEUE *charqueue); -int visor_charqueue_dequeue_n(CHARQUEUE *charqueue, unsigned char *buf, int n); -BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue); -void visor_charqueue_destroy(CHARQUEUE *charqueue); +struct charqueue *visor_charqueue_create(ulong nslots); +void visor_charqueue_enqueue(struct charqueue *charqueue, unsigned char c); +int charqueue_dequeue(struct charqueue *charqueue); +int visor_charqueue_dequeue_n(struct charqueue *charqueue, unsigned char *buf, + int n); +BOOL visor_charqueue_is_empty(struct charqueue *charqueue); +void visor_charqueue_destroy(struct charqueue *charqueue); #endif -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/15] staging: unisys: split double assignment in visor_charqueue_create()
Split up the doubled assignment in visor_charqueue_create() into two separate assignments. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/charqueue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorutil/charqueue.c b/drivers/staging/unisys/visorutil/charqueue.c index 7861e73..1ce7003 100644 --- a/drivers/staging/unisys/visorutil/charqueue.c +++ b/drivers/staging/unisys/visorutil/charqueue.c @@ -45,7 +45,8 @@ struct charqueue *visor_charqueue_create(ulong nslots) } cq-alloc_size = alloc_size; cq-nslots = nslots; - cq-head = cq-tail = 0; + cq-head = 0; + cq-tail = 0; spin_lock_init(cq-lock); return cq; } -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/15] staging: unisys: fix spacing in visorkmodutils.c
Remove all the extraneous blank lines from visorkmodutils.c. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/visorkmodutils.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index 64b135d..69ed4b1 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c @@ -49,12 +49,8 @@ visorutil_spar_detect(void) (edx == UNISYS_SPAR_ID_EDX); } else return 0; - } - - - static __init int visorutil_mod_init(void) { -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/15] staging: unisys: remove unnecessary spaces in casts in memregion_direct.c
Get rid of all extra spaces between casts and their targets in this file. Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com --- drivers/staging/unisys/visorutil/memregion_direct.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorutil/memregion_direct.c b/drivers/staging/unisys/visorutil/memregion_direct.c index 3f1f313..f4182d4 100644 --- a/drivers/staging/unisys/visorutil/memregion_direct.c +++ b/drivers/staging/unisys/visorutil/memregion_direct.c @@ -94,7 +94,7 @@ visor_memregion_create_overlapped(struct memregion *parent, ulong offset, memregion-physaddr = parent-physaddr + offset; memregion-nbytes = nbytes; - memregion-mapped = ((u8 __iomem *) (parent-mapped)) + offset; + memregion-mapped = ((u8 __iomem *)(parent-mapped)) + offset; memregion-requested = FALSE; memregion-overlapped = TRUE; return memregion; @@ -105,7 +105,7 @@ EXPORT_SYMBOL_GPL(visor_memregion_create_overlapped); static BOOL mapit(struct memregion *memregion) { - ulong physaddr = (ulong) (memregion-physaddr); + ulong physaddr = (ulong)(memregion-physaddr); ulong nbytes = memregion-nbytes; memregion-requested = FALSE; @@ -130,7 +130,7 @@ unmapit(struct memregion *memregion) memregion-mapped = NULL; } if (memregion-requested) { - release_mem_region((ulong) (memregion-physaddr), + release_mem_region((ulong)(memregion-physaddr), memregion-nbytes); memregion-requested = FALSE; } -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] Drivers: hv: vmbus: Fix a race condition when unregistering a device
-Original Message- From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] Sent: Tuesday, November 4, 2014 4:40 AM To: KY Srinivasan; Haiyang Zhang Cc: Greg Kroah-Hartman; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org Subject: [PATCH] Drivers: hv: vmbus: Fix a race condition when unregistering a device When build with Debug the following crash is sometimes observed: Call Trace: [812b9600] string+0x40/0x100 [812bb038] vsnprintf+0x218/0x5e0 [810baf7d] ? trace_hardirqs_off+0xd/0x10 [812bb4c1] vscnprintf+0x11/0x30 [8107a2f0] vprintk+0xd0/0x5c0 [a0051ea0] ? vmbus_process_rescind_offer+0x0/0x110 [hv_vmbus] [8155c71c] printk+0x41/0x45 [a004ebac] vmbus_device_unregister+0x2c/0x40 [hv_vmbus] [a0051ecb] vmbus_process_rescind_offer+0x2b/0x110 [hv_vmbus] ... This happens due to the following race: between 'if (channel-device_obj)' check in vmbus_process_rescind_offer() and pr_debug() in vmbus_device_unregister() the device can disappear. Fix the issue by taking an additional reference to the device before proceeding to vmbus_device_unregister(). Thank you. Signed-off-by: Vitaly Kuznetsov vkuzn...@redhat.com Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/hv/channel_mgmt.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index a2d1a96..d36ce68 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -216,9 +216,16 @@ static void vmbus_process_rescind_offer(struct work_struct *work) unsigned long flags; struct vmbus_channel *primary_channel; struct vmbus_channel_relid_released msg; + struct device *dev; + + if (channel-device_obj) { + dev = get_device(channel-device_obj-device); + if (dev) { + vmbus_device_unregister(channel-device_obj); + put_device(dev); + } + } - if (channel-device_obj) - vmbus_device_unregister(channel-device_obj); memset(msg, 0, sizeof(struct vmbus_channel_relid_released)); msg.child_relid = channel-offermsg.child_relid; msg.header.msgtype = CHANNELMSG_RELID_RELEASED; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/18] staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_sample_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/usbduxsigma.c | 30 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 9ee6e0a..31b2806 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -166,7 +166,6 @@ struct usbduxsigma_private { /* number of samples to acquire */ int ai_sample_count; - int ao_sample_count; /* time between samples in units of the timer */ unsigned int ai_timer; unsigned int ao_timer; @@ -358,12 +357,10 @@ static void usbduxsigma_ao_handle_urb(struct comedi_device *dev, if (devpriv-ao_counter == 0) { devpriv-ao_counter = devpriv-ao_timer; - if (cmd-stop_src == TRIG_COUNT) { - devpriv-ao_sample_count--; - if (devpriv-ao_sample_count 0) { - async-events |= COMEDI_CB_EOA; - return; - } + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) { + async-events |= COMEDI_CB_EOA; + return; } /* transmit data to the USB bus */ @@ -952,25 +949,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev, if (devpriv-ao_timer 1) err |= -EINVAL; - if (cmd-stop_src == TRIG_COUNT) { - /* not continuous, use counter */ - if (high_speed) { - /* high speed also scans everything at once */ - devpriv-ao_sample_count = cmd-stop_arg * - cmd-scan_end_arg; - } else { - /* -* There's no scan as the scan has been -* handled inside the FX2. Data arrives as -* one packet. -*/ - devpriv-ao_sample_count = cmd-stop_arg; - } - } else { - /* continuous acquisition */ - devpriv-ao_sample_count = 0; - } - if (err) return 4; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/18] staging: comedi: addi_apci_2032: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'stop_count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi_apci_2032.c | 17 + 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index fb20c5e..eebf4f1 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -47,7 +47,6 @@ struct apci2032_int_private { spinlock_t spinlock; - unsigned int stop_count; bool active; unsigned char enabled_isns; }; @@ -148,7 +147,6 @@ static int apci2032_int_cmd(struct comedi_device *dev, spin_lock_irqsave(subpriv-spinlock, flags); subpriv-enabled_isns = enabled_isns; - subpriv-stop_count = cmd-stop_arg; subpriv-active = true; outl(enabled_isns, dev-iobase + APCI2032_INT_CTRL_REG); @@ -211,16 +209,11 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) bits |= (1 i); } - if (comedi_buf_write_samples(s, bits, 1)) { - if (cmd-stop_src == TRIG_COUNT - subpriv-stop_count 0) { - subpriv-stop_count--; - if (subpriv-stop_count == 0) { - /* end of acquisition */ - s-async-events |= COMEDI_CB_EOA; - } - } - } + comedi_buf_write_samples(s, bits, 1); + + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) + s-async-events |= COMEDI_CB_EOA; } spin_unlock(subpriv-spinlock); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/18] staging: comedi: pcmuio: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'stop_count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcmuio.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c index 18c2ac2..0f5483b 100644 --- a/drivers/staging/comedi/drivers/pcmuio.c +++ b/drivers/staging/comedi/drivers/pcmuio.c @@ -130,7 +130,6 @@ struct pcmuio_asic { spinlock_t pagelock;/* protects the page registers */ spinlock_t spinlock;/* protects member variables */ unsigned int enabled_mask; - unsigned int stop_count; unsigned int active:1; }; @@ -338,14 +337,9 @@ static void pcmuio_handle_intr_subdev(struct comedi_device *dev, comedi_buf_write_samples(s, val, 1); - /* Check for end of acquisition. */ - if (cmd-stop_src == TRIG_COUNT) { - if (chip-stop_count 0) { - chip-stop_count--; - if (chip-stop_count == 0) - s-async-events |= COMEDI_CB_EOA; - } - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) + s-async-events |= COMEDI_CB_EOA; done: spin_unlock_irqrestore(chip-spinlock, flags); @@ -474,8 +468,6 @@ static int pcmuio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) spin_lock_irqsave(chip-spinlock, flags); chip-active = 1; - chip-stop_count = cmd-stop_arg; - /* Set up start of acquisition. */ if (cmd-start_src == TRIG_INT) s-async-inttrig = pcmuio_inttrig_start_intr; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/18] staging: comedi: das800: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/das800.c | 31 --- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c index 55bc494..e5bdc24 100644 --- a/drivers/staging/comedi/drivers/das800.c +++ b/drivers/staging/comedi/drivers/das800.c @@ -219,7 +219,6 @@ static const struct das800_board das800_boards[] = { }; struct das800_private { - unsigned int count; /* number of data points left to be taken */ unsigned int divisor1; /* counter 1 value for timed conversions */ unsigned int divisor2; /* counter 2 value for timed conversions */ unsigned int do_bits; /* digital output bits */ @@ -286,9 +285,6 @@ static void das800_set_frequency(struct comedi_device *dev) static int das800_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - struct das800_private *devpriv = dev-private; - - devpriv-count = 0; das800_disable(dev); return 0; } @@ -399,7 +395,6 @@ static int das800_ai_do_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { const struct das800_board *thisboard = dev-board_ptr; - struct das800_private *devpriv = dev-private; struct comedi_async *async = s-async; struct comedi_cmd *cmd = async-cmd; unsigned int gain = CR_RANGE(cmd-chanlist[0]); @@ -422,11 +417,6 @@ static int das800_ai_do_cmd(struct comedi_device *dev, gain = 0xf; outb(gain, dev-iobase + DAS800_GAIN); - if (cmd-stop_src == TRIG_COUNT) - devpriv-count = cmd-stop_arg * cmd-chanlist_len; - else/* TRIG_NONE */ - devpriv-count = 0; - /* enable auto channel scan, send interrupts on end of conversion * and set clock source to internal or external */ @@ -509,11 +499,13 @@ static irqreturn_t das800_interrupt(int irq, void *d) if (s-maxdata == 0x0fff) val = 4; /* 12-bit sample */ - /* if there are more data points to collect */ - if (cmd-stop_src == TRIG_NONE || devpriv-count 0) { - val = s-maxdata; - comedi_buf_write_samples(s, val, 1); - devpriv-count--; + val = s-maxdata; + comedi_buf_write_samples(s, val, 1); + + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) { + async-events |= COMEDI_CB_EOA; + break; } } @@ -524,9 +516,11 @@ static irqreturn_t das800_interrupt(int irq, void *d) return IRQ_HANDLED; } - if (cmd-stop_src == TRIG_NONE || devpriv-count 0) { - /* Re-enable card's interrupt. -* We already have spinlock, so indirect addressing is safe */ + if (!(async-events COMEDI_CB_CANCEL_MASK)) { + /* +* Re-enable card's interrupt. +* We already have spinlock, so indirect addressing is safe +*/ das800_ind_write(dev, CONTROL1_INTE | devpriv-do_bits, CONTROL1); spin_unlock_irqrestore(dev-spinlock, irq_flags); @@ -534,7 +528,6 @@ static irqreturn_t das800_interrupt(int irq, void *d) /* otherwise, stop taking data */ spin_unlock_irqrestore(dev-spinlock, irq_flags); das800_disable(dev); - async-events |= COMEDI_CB_EOA; } comedi_handle_events(dev, s); return IRQ_HANDLED; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/18] staging: comedi: adv_pci1710: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/adv_pci1710.c | 26 +- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c index 107a0f1..d02df7d 100644 --- a/drivers/staging/comedi/drivers/adv_pci1710.c +++ b/drivers/staging/comedi/drivers/adv_pci1710.c @@ -298,7 +298,6 @@ static const struct boardtype boardtypes[] = { struct pci1710_private { unsigned int CntrlReg; /* Control register */ - unsigned int ai_act_scan; /* how many scans we finished */ unsigned char ai_et; unsigned int ai_et_CntrlReg; unsigned int ai_et_MuxVal; @@ -730,15 +729,12 @@ static int pci171x_ai_cancel(struct comedi_device *dev, break; } - devpriv-ai_act_scan = 0; - return 0; } static void pci1710_handle_every_sample(struct comedi_device *dev, struct comedi_subdevice *s) { - struct pci1710_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; unsigned int status; unsigned int val; @@ -772,14 +768,10 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, val = s-maxdata; comedi_buf_write_samples(s, val, 1); - if (s-async-cur_chan == 0) { /* one scan done */ - devpriv-ai_act_scan++; - if (cmd-stop_src == TRIG_COUNT - devpriv-ai_act_scan = cmd-stop_arg) { - /* all data sampled */ - s-async-events |= COMEDI_CB_EOA; - break; - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) { + s-async-events |= COMEDI_CB_EOA; + break; } } @@ -794,7 +786,6 @@ static void pci1710_handle_every_sample(struct comedi_device *dev, static int move_block_from_fifo(struct comedi_device *dev, struct comedi_subdevice *s, int n, int turn) { - struct pci1710_private *devpriv = dev-private; unsigned int val; int ret; int i; @@ -810,9 +801,6 @@ static int move_block_from_fifo(struct comedi_device *dev, val = s-maxdata; comedi_buf_write_samples(s, val, 1); - - if (s-async-cur_chan == 0) - devpriv-ai_act_scan++; } return 0; } @@ -821,7 +809,6 @@ static void pci1710_handle_fifo(struct comedi_device *dev, struct comedi_subdevice *s) { const struct boardtype *this_board = dev-board_ptr; - struct pci1710_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; unsigned int nsamples; unsigned int m; @@ -855,8 +842,7 @@ static void pci1710_handle_fifo(struct comedi_device *dev, } if (cmd-stop_src == TRIG_COUNT - devpriv-ai_act_scan = cmd-stop_arg) { - /* all data sampled */ + s-async-scans_done = cmd-stop_arg) { s-async-events |= COMEDI_CB_EOA; comedi_handle_events(dev, s); return; @@ -921,8 +907,6 @@ static int pci171x_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) outb(0, dev-iobase + PCI171x_CLRFIFO); outb(0, dev-iobase + PCI171x_CLRINT); - devpriv-ai_act_scan = 0; - devpriv-CntrlReg = Control_CNT0; if ((cmd-flags CMDF_WAKE_EOS) == 0) devpriv-CntrlReg |= Control_ONEFH; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/18] staging: comedi: usbdux: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_sample_count' and use the comedi_async 'scans_done' member to detect the analog input end-of-acquisition. Move the EOA check so it happens after adding the samples from the current urb to the async buffer. This prevents the unnecessary resubmit of the urb when the EOA occurs. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/usbdux.c | 22 -- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 7782015..4737dbf 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -202,8 +202,6 @@ struct usbdux_private { unsigned int ao_cmd_running:1; unsigned int pwm_cmd_running:1; - /* number of samples to acquire */ - int ai_sample_count; /* time between samples in units of the timer */ unsigned int ai_timer; unsigned int ao_timer; @@ -263,14 +261,6 @@ static void usbduxsub_ai_handle_urb(struct comedi_device *dev, if (devpriv-ai_counter == 0) { devpriv-ai_counter = devpriv-ai_timer; - if (cmd-stop_src == TRIG_COUNT) { - devpriv-ai_sample_count--; - if (devpriv-ai_sample_count 0) { - async-events |= COMEDI_CB_EOA; - return; - } - } - /* get the data from the USB bus and hand it over to comedi */ for (i = 0; i cmd-chanlist_len; i++) { unsigned int range = CR_RANGE(cmd-chanlist[i]); @@ -284,6 +274,10 @@ static void usbduxsub_ai_handle_urb(struct comedi_device *dev, if (!comedi_buf_write_samples(s, val, 1)) return; } + + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) + async-events |= COMEDI_CB_EOA; } /* if command is still running, resubmit urb */ @@ -732,14 +726,6 @@ static int usbdux_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv-ai_counter = devpriv-ai_timer; - if (cmd-stop_src == TRIG_COUNT) { - /* data arrives as one packet */ - devpriv-ai_sample_count = cmd-stop_arg; - } else { - /* continous acquisition */ - devpriv-ai_sample_count = 0; - } - if (cmd-start_src == TRIG_NOW) { /* enable this acquisition operation */ devpriv-ai_cmd_running = 1; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/18] staging: comedi: pcl816: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcl816.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 7cdb798..73deb4b 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c @@ -122,7 +122,6 @@ struct pcl816_private { int next_dma_buf; /* which DMA buffer will be used next round */ long dma_runs_to_end; /* how many we must permorm DMA transfer to end of record */ unsigned long last_dma_run; /* how many bytes we must transfer on last DMA page */ - int ai_act_scan;/* how many scans we finished */ unsigned int ai_poll_ptr; /* how many sampes transfer poll */ unsigned int divisor1; unsigned int divisor2; @@ -286,15 +285,10 @@ static int pcl816_ai_eoc(struct comedi_device *dev, static bool pcl816_ai_next_chan(struct comedi_device *dev, struct comedi_subdevice *s) { - struct pcl816_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; - if (s-async-cur_chan == 0) - devpriv-ai_act_scan++; - if (cmd-stop_src == TRIG_COUNT - devpriv-ai_act_scan = cmd-stop_arg) { - /* all data sampled */ + s-async-scans_done = cmd-stop_arg) { s-async-events |= COMEDI_CB_EOA; return false; } @@ -504,7 +498,6 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) pcl816_ai_setup_chanlist(dev, cmd-chanlist, seglen); udelay(1); - devpriv-ai_act_scan = 0; devpriv-ai_cmd_running = 1; devpriv-ai_poll_ptr = 0; devpriv-ai_cmd_canceled = 0; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/18] staging: comedi: pcl711: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ntrig' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcl711.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c index 48a79b8..93fa4b8 100644 --- a/drivers/staging/comedi/drivers/pcl711.c +++ b/drivers/staging/comedi/drivers/pcl711.c @@ -156,7 +156,6 @@ static const struct pcl711_board boardtypes[] = { }; struct pcl711_private { - unsigned int ntrig; unsigned int divisor1; unsigned int divisor2; }; @@ -199,7 +198,6 @@ static int pcl711_ai_cancel(struct comedi_device *dev, static irqreturn_t pcl711_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct pcl711_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; struct comedi_cmd *cmd = s-async-cmd; unsigned int data; @@ -213,10 +211,12 @@ static irqreturn_t pcl711_interrupt(int irq, void *d) outb(PCL711_INT_STAT_CLR, dev-iobase + PCL711_INT_STAT_REG); - if (comedi_buf_write_samples(s, data, 1)) { - if (cmd-stop_src == TRIG_COUNT !(--devpriv-ntrig)) - s-async-events |= COMEDI_CB_EOA; - } + comedi_buf_write_samples(s, data, 1); + + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) + s-async-events |= COMEDI_CB_EOA; + comedi_handle_events(dev, s); return IRQ_HANDLED; @@ -369,14 +369,10 @@ static void pcl711_ai_load_counters(struct comedi_device *dev) static int pcl711_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { - struct pcl711_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; pcl711_set_changain(dev, s, cmd-chanlist[0]); - if (cmd-stop_src == TRIG_COUNT) - devpriv-ntrig = cmd-stop_arg; - if (cmd-scan_begin_src == TRIG_TIMER) { pcl711_ai_load_counters(dev); outb(PCL711_INT_STAT_CLR, dev-iobase + PCL711_INT_STAT_REG); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/18] staging: comedi: pcl818: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcl818.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index d219e04..f1e0f36 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -313,7 +313,6 @@ struct pcl818_private { unsigned long last_dma_run; /* how many bytes we must transfer on last DMA page */ unsigned int ns_min;/* manimal allowed delay between samples (in us) for actual card */ int i8253_osc_base; /* 1/frequency of on board oscilator in ns */ - int ai_act_scan;/* how many scans we finished */ unsigned int act_chanlist[16]; /* MUX setting for actual AI operations */ unsigned int act_chanlist_len; /* how long is actual MUX list */ unsigned int act_chanlist_pos; /* actual position in MUX list */ @@ -524,11 +523,8 @@ static bool pcl818_ai_next_chan(struct comedi_device *dev, if (devpriv-act_chanlist_pos = devpriv-act_chanlist_len) devpriv-act_chanlist_pos = 0; - if (s-async-cur_chan == 0) - devpriv-ai_act_scan--; - - if (cmd-stop_src == TRIG_COUNT devpriv-ai_act_scan == 0) { - /* all data sampled */ + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) { s-async-events |= COMEDI_CB_EOA; return false; } @@ -635,6 +631,7 @@ static irqreturn_t pcl818_interrupt(int irq, void *d) struct comedi_device *dev = d; struct pcl818_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; + struct comedi_cmd *cmd = s-async-cmd; if (!dev-attached || !devpriv-ai_cmd_running) { pcl818_ai_clear_eoc(dev); @@ -648,7 +645,7 @@ static irqreturn_t pcl818_interrupt(int irq, void *d) * being reprogrammed while a DMA transfer is in * progress. */ - devpriv-ai_act_scan = 0; + s-async-scans_done = cmd-stop_arg; s-cancel(dev, s); return IRQ_HANDLED; } @@ -822,7 +819,6 @@ static int pcl818_ai_cmd(struct comedi_device *dev, pcl818_ai_setup_chanlist(dev, cmd-chanlist, seglen); devpriv-ai_data_len = s-async-prealloc_bufsz; - devpriv-ai_act_scan = cmd-stop_arg; devpriv-ai_cmd_running = 1; devpriv-ai_cmd_canceled = 0; devpriv-act_chanlist_pos = 0; @@ -865,7 +861,8 @@ static int pcl818_ai_cancel(struct comedi_device *dev, if (devpriv-dma) { if (cmd-stop_src == TRIG_NONE || - (cmd-stop_src == TRIG_COUNT devpriv-ai_act_scan 0)) { + (cmd-stop_src == TRIG_COUNT +s-async-scans_done cmd-stop_arg)) { if (!devpriv-ai_cmd_canceled) { /* * Wait for running dma transfer to end, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/18] staging: comedi: pcl818: remove private data member 'ai_act_chan'
This member of the private data is set to '0' but never used. Remove it. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcl818.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c index dc2715a..d219e04 100644 --- a/drivers/staging/comedi/drivers/pcl818.c +++ b/drivers/staging/comedi/drivers/pcl818.c @@ -314,7 +314,6 @@ struct pcl818_private { unsigned int ns_min;/* manimal allowed delay between samples (in us) for actual card */ int i8253_osc_base; /* 1/frequency of on board oscilator in ns */ int ai_act_scan;/* how many scans we finished */ - int ai_act_chan;/* actual position in actual scan */ unsigned int act_chanlist[16]; /* MUX setting for actual AI operations */ unsigned int act_chanlist_len; /* how long is actual MUX list */ unsigned int act_chanlist_pos; /* actual position in MUX list */ @@ -824,7 +823,6 @@ static int pcl818_ai_cmd(struct comedi_device *dev, devpriv-ai_data_len = s-async-prealloc_bufsz; devpriv-ai_act_scan = cmd-stop_arg; - devpriv-ai_act_chan = 0; devpriv-ai_cmd_running = 1; devpriv-ai_cmd_canceled = 0; devpriv-act_chanlist_pos = 0; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/18] staging: comedi: amplc_dio200_common: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'stopcount' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/amplc_dio200_common.c | 14 +++--- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index c306226..26aad70 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -120,7 +120,6 @@ struct dio200_subdev_intr { unsigned int ofs; unsigned int valid_isns; unsigned int enabled_isns; - unsigned int stopcount; bool active:1; }; @@ -256,7 +255,6 @@ static void dio200_read_scan_intr(struct comedi_device *dev, struct comedi_subdevice *s, unsigned int triggered) { - struct dio200_subdev_intr *subpriv = s-private; struct comedi_cmd *cmd = s-async-cmd; unsigned short val; unsigned int n, ch; @@ -270,14 +268,9 @@ static void dio200_read_scan_intr(struct comedi_device *dev, comedi_buf_write_samples(s, val, 1); - /* Check for end of acquisition. */ - if (cmd-stop_src == TRIG_COUNT) { - if (subpriv-stopcount 0) { - subpriv-stopcount--; - if (subpriv-stopcount == 0) - s-async-events |= COMEDI_CB_EOA; - } - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) + s-async-events |= COMEDI_CB_EOA; } static int dio200_handle_read_intr(struct comedi_device *dev, @@ -424,7 +417,6 @@ static int dio200_subdev_intr_cmd(struct comedi_device *dev, spin_lock_irqsave(subpriv-spinlock, flags); subpriv-active = true; - subpriv-stopcount = cmd-stop_arg; if (cmd-start_src == TRIG_INT) s-async-inttrig = dio200_inttrig_start_intr; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/18] staging: comedi: pcl812: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_act_scan' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcl812.c | 9 + 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcl812.c b/drivers/staging/comedi/drivers/pcl812.c index b13e9fb..c3499aa 100644 --- a/drivers/staging/comedi/drivers/pcl812.c +++ b/drivers/staging/comedi/drivers/pcl812.c @@ -512,7 +512,6 @@ struct pcl812_private { unsigned int last_ai_chanspec; unsigned char mode_reg_int; /* there is stored INT number for some card */ unsigned int ai_poll_ptr; /* how many sampes transfer poll */ - unsigned int ai_act_scan; /* how many scans we finished */ unsigned int dmapages; unsigned int hwdmasize; unsigned long dmabuf[2];/* PTR to DMA buf */ @@ -807,7 +806,6 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv-ai_dma = 0; } - devpriv-ai_act_scan = 0; devpriv-ai_poll_ptr = 0; /* don't we want wake up every scan? */ @@ -840,15 +838,10 @@ static int pcl812_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) static bool pcl812_ai_next_chan(struct comedi_device *dev, struct comedi_subdevice *s) { - struct pcl812_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; - if (s-async-cur_chan == 0) - devpriv-ai_act_scan++; - if (cmd-stop_src == TRIG_COUNT - devpriv-ai_act_scan = cmd-stop_arg) { - /* all data sampled */ + s-async-scans_done = cmd-stop_arg) { s-async-events |= COMEDI_CB_EOA; return false; } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/18] staging: comedi: pcmmio: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/pcmmio.c | 12 +++- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c index df47967..985fabd 100644 --- a/drivers/staging/comedi/drivers/pcmmio.c +++ b/drivers/staging/comedi/drivers/pcmmio.c @@ -190,7 +190,6 @@ struct pcmmio_private { spinlock_t pagelock;/* protects the page registers */ spinlock_t spinlock;/* protects the member variables */ unsigned int enabled_mask; - unsigned int stop_count; unsigned int active:1; }; @@ -358,12 +357,9 @@ static void pcmmio_handle_dio_intr(struct comedi_device *dev, comedi_buf_write_samples(s, val, 1); - /* Check for end of acquisition. */ - if (cmd-stop_src == TRIG_COUNT devpriv-stop_count 0) { - devpriv-stop_count--; - if (devpriv-stop_count == 0) - s-async-events |= COMEDI_CB_EOA; - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) + s-async-events |= COMEDI_CB_EOA; done: spin_unlock_irqrestore(devpriv-spinlock, flags); @@ -468,8 +464,6 @@ static int pcmmio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) spin_lock_irqsave(devpriv-spinlock, flags); devpriv-active = 1; - devpriv-stop_count = cmd-stop_arg; - /* Set up start of acquisition. */ if (cmd-start_src == TRIG_INT) s-async-inttrig = pcmmio_inttrig_start_intr; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/18] staging: comedi: make core track the number of scans
The comedi drivers that support async commands with a cmd-stop_src of TRIG_COUNT currently have a private data member that is used to count the number of scans completed in order to detect the end of acquisition for the command. This series addes a new member, 'scans_done', to comedi_async and makes the core automatically count the completed scans. The comedi drivers that do simple scan counting are then converted to use the new member. H Hartley Sweeten (18): staging: comedi: comedidev.h: add 'scans_done' member to comedi_async staging: comedi: addi_apci_2032: use comedi_async 'scans_done' to detect EOA staging: comedi: amplc_dio200_common: use comedi_async 'scans_done' to detect EOA staging: comedi: pcl711: use comedi_async 'scans_done' to detect EOA staging: comedi: pcl812: use comedi_async 'scans_done' to detect EOA staging: comedi: pcl816: use comedi_async 'scans_done' to detect EOA staging: comedi: pcl818: remove private data member 'ai_act_chan' staging: comedi: pcl818: use comedi_async 'scans_done' to detect EOA staging: comedi: adv_pci1710: use comedi_async 'scans_done' to detect EOA staging: comedi: pcmmio: use comedi_async 'scans_done' to detect EOA staging: comedi: pcmuio: use comedi_async 'scans_done' to detect EOA staging: comedi: s626: use comedi_async 'scans_done' to detect EOA staging: comedi: usbdux: use comedi_async 'scans_done' to detect AO EOA staging: comedi: usbdux: use comedi_async 'scans_done' to detect AI EOA staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AO EOA staging: comedi: usbduxsigma: use comedi_async 'scans_done' to detect AI EOA staging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA staging: comedi: das800: use comedi_async 'scans_done' to detect EOA drivers/staging/comedi/comedi_buf.c| 1 + drivers/staging/comedi/comedidev.h | 2 + drivers/staging/comedi/drivers.c | 1 + .../comedi/drivers/addi-data/hwdrv_apci3120.c | 34 +++--- drivers/staging/comedi/drivers/addi_apci_2032.c| 17 +++ drivers/staging/comedi/drivers/addi_apci_3120.c| 1 - drivers/staging/comedi/drivers/adv_pci1710.c | 26 +++ .../staging/comedi/drivers/amplc_dio200_common.c | 14 ++ drivers/staging/comedi/drivers/das800.c| 31 + drivers/staging/comedi/drivers/pcl711.c| 16 +++ drivers/staging/comedi/drivers/pcl812.c| 9 +--- drivers/staging/comedi/drivers/pcl816.c| 9 +--- drivers/staging/comedi/drivers/pcl818.c| 17 +++ drivers/staging/comedi/drivers/pcmmio.c| 12 ++--- drivers/staging/comedi/drivers/pcmuio.c| 14 ++ drivers/staging/comedi/drivers/s626.c | 15 +-- drivers/staging/comedi/drivers/usbdux.c| 51 - drivers/staging/comedi/drivers/usbduxsigma.c | 52 -- 18 files changed, 73 insertions(+), 249 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/18] staging: comedi: usbdux: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_sample_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/usbdux.c | 29 - 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 40f5cd0..7782015 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -204,7 +204,6 @@ struct usbdux_private { /* number of samples to acquire */ int ai_sample_count; - int ao_sample_count; /* time between samples in units of the timer */ unsigned int ai_timer; unsigned int ao_timer; @@ -397,12 +396,10 @@ static void usbduxsub_ao_handle_urb(struct comedi_device *dev, if (devpriv-ao_counter == 0) { devpriv-ao_counter = devpriv-ao_timer; - if (cmd-stop_src == TRIG_COUNT) { - devpriv-ao_sample_count--; - if (devpriv-ao_sample_count 0) { - async-events |= COMEDI_CB_EOA; - return; - } + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) { + async-events |= COMEDI_CB_EOA; + return; } /* transmit data to the USB bus */ @@ -1011,24 +1008,6 @@ static int usbdux_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) devpriv-ao_counter = devpriv-ao_timer; - if (cmd-stop_src == TRIG_COUNT) { - /* not continuous */ - /* counter */ - /* high speed also scans everything at once */ - if (0) {/* (devpriv-high_speed) */ - devpriv-ao_sample_count = cmd-stop_arg * - cmd-scan_end_arg; - } else { - /* there's no scan as the scan has been */ - /* perf inside the FX2 */ - /* data arrives as one packet */ - devpriv-ao_sample_count = cmd-stop_arg; - } - } else { - /* continous acquisition */ - devpriv-ao_sample_count = 0; - } - if (cmd-start_src == TRIG_NOW) { /* enable this acquisition operation */ devpriv-ao_cmd_running = 1; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 17/18] staging: comedi: addi_apci_3120: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_AiActualScan' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. The function v_APCI3120_InterruptDmaMoveBlock16bit() is then just a wrapper for comedi_buf_write_samples(). Remove it. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 34 -- drivers/staging/comedi/drivers/addi_apci_3120.c| 1 - 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 91707663..c64799e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -628,7 +628,6 @@ static int apci3120_cancel(struct comedi_device *dev, /* Flush FIFO */ inb(dev-iobase + APCI3120_RESET_FIFO); inw(dev-iobase + APCI3120_RD_STATUS); - devpriv-ui_AiActualScan = 0; devpriv-ui_DmaActualBuffer = 0; devpriv-ai_running = 0; @@ -756,7 +755,6 @@ static int apci3120_cyclic_ai(int mode, inb(dev-iobase + APCI3120_RESET_FIFO); /* END JK 07.05.04: Comparison between WIN32 and Linux driver */ - devpriv-ui_AiActualScan = 0; devpriv-ui_DmaActualBuffer = 0; /* value for timer2 minus -2 has to be done */ @@ -1157,23 +1155,6 @@ static int apci3120_ai_cmd(struct comedi_device *dev, } /* - * This function copies the data from DMA buffer to the Comedi buffer. - */ -static void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, - struct comedi_subdevice *s, - unsigned short *dma_buffer, - unsigned int num_samples) -{ - struct apci3120_private *devpriv = dev-private; - struct comedi_cmd *cmd = s-async-cmd; - - devpriv-ui_AiActualScan += - (s-async-cur_chan + num_samples) / cmd-scan_end_arg; - - comedi_buf_write_samples(s, dma_buffer, num_samples); -} - -/* * This is a handler for the DMA interrupt. * This function copies the data to Comedi Buffer. * For continuous DMA it reinitializes the DMA operation. @@ -1245,18 +1226,16 @@ static void apci3120_interrupt_dma(int irq, void *d) } if (samplesinbuf) { - v_APCI3120_InterruptDmaMoveBlock16bit(dev, s, dmabuf-virt, - samplesinbuf); + comedi_buf_write_samples(s, dmabuf-virt, samplesinbuf); if (!(cmd-flags CMDF_WAKE_EOS)) s-async-events |= COMEDI_CB_EOS; } - if (cmd-stop_src == TRIG_COUNT) - if (devpriv-ui_AiActualScan = cmd-stop_arg) { - /* all data sampled */ - s-async-events |= COMEDI_CB_EOA; - return; - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) { + s-async-events |= COMEDI_CB_EOA; + return; + } if (devpriv-b_DmaDoubleBuffer) { /* switch dma buffers */ devpriv-ui_DmaActualBuffer = 1 - devpriv-ui_DmaActualBuffer; @@ -1386,7 +1365,6 @@ static irqreturn_t apci3120_interrupt(int irq, void *d) if (devpriv-ai_running) { ui_Check = 0; apci3120_interrupt_handle_eos(dev); - devpriv-ui_AiActualScan++; devpriv-b_ModeSelectRegister = devpriv- b_ModeSelectRegister | diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index e8da15c..056b3bf 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -55,7 +55,6 @@ struct apci3120_dmabuf { struct apci3120_private { unsigned long amcc; unsigned long addon; - unsigned int ui_AiActualScan; unsigned int ui_AiNbrofChannels; unsigned int ui_AiChannelList[32]; unsigned int ui_AiReadData[32]; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/13] staging: comedi: amplc_pci224: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ao_stop_count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Use the helper function comedi_nscans_left() to determine the number of scans available in the async buffer or left in the command. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/amplc_pci224.c | 43 --- 1 file changed, 12 insertions(+), 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c index 342779f..a896f01 100644 --- a/drivers/staging/comedi/drivers/amplc_pci224.c +++ b/drivers/staging/comedi/drivers/amplc_pci224.c @@ -381,7 +381,6 @@ struct pci224_private { unsigned short daccon; unsigned int cached_div1; unsigned int cached_div2; - unsigned int ao_stop_count; unsigned short ao_enab; /* max 16 channels so 'short' will do */ unsigned char intsce; }; @@ -514,26 +513,18 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, { struct pci224_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; - unsigned int num_scans; + unsigned int num_scans = comedi_nscans_left(s, 0); unsigned int room; unsigned short dacstat; unsigned int i, n; - /* Determine number of scans available in buffer. */ - num_scans = comedi_buf_read_n_available(s) / comedi_bytes_per_scan(s); - if (cmd-stop_src == TRIG_COUNT) { - /* Fixed number of scans. */ - if (num_scans devpriv-ao_stop_count) - num_scans = devpriv-ao_stop_count; - } - /* Determine how much room is in the FIFO (in samples). */ dacstat = inw(dev-iobase + PCI224_DACCON); switch (dacstat PCI224_DACCON_FIFOFL_MASK) { case PCI224_DACCON_FIFOFL_EMPTY: room = PCI224_FIFO_ROOM_EMPTY; if (cmd-stop_src == TRIG_COUNT - devpriv-ao_stop_count == 0) { + s-async-scans_done = cmd-stop_arg) { /* FIFO empty at end of counted acquisition. */ s-async-events |= COMEDI_CB_EOA; comedi_handle_events(dev, s); @@ -574,18 +565,16 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev, dev-iobase + PCI224_DACDATA); } } - if (cmd-stop_src == TRIG_COUNT) { - devpriv-ao_stop_count -= num_scans; - if (devpriv-ao_stop_count == 0) { - /* -* Change FIFO interrupt trigger level to wait -* until FIFO is empty. -*/ - devpriv-daccon = COMBINE(devpriv-daccon, - PCI224_DACCON_FIFOINTR_EMPTY, - PCI224_DACCON_FIFOINTR_MASK); - outw(devpriv-daccon, dev-iobase + PCI224_DACCON); - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) { + /* +* Change FIFO interrupt trigger level to wait +* until FIFO is empty. +*/ + devpriv-daccon = COMBINE(devpriv-daccon, + PCI224_DACCON_FIFOINTR_EMPTY, + PCI224_DACCON_FIFOINTR_MASK); + outw(devpriv-daccon, dev-iobase + PCI224_DACCON); } if ((devpriv-daccon PCI224_DACCON_TRIG_MASK) == PCI224_DACCON_TRIG_NONE) { @@ -907,14 +896,6 @@ static int pci224_ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (cmd-scan_begin_src == TRIG_TIMER) pci224_ao_start_pacer(dev, s); - /* -* Sort out end of acquisition. -*/ - if (cmd-stop_src == TRIG_COUNT) - devpriv-ao_stop_count = cmd-stop_arg; - else/* TRIG_EXT | TRIG_NONE */ - devpriv-ao_stop_count = 0; - spin_lock_irqsave(devpriv-ao_spinlock, flags); if (cmd-start_src == TRIG_INT) { s-async-inttrig = pci224_ao_inttrig_start; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/13] staging: comedi: convert more drivers to use 'scans_done'
This series converts the remaining comedi drivers to use the comedi_async 'scans_done' member to count the number of scans completed when counting scans with a cmd-stop_src of TRIG_COUNT. H Hartley Sweeten (13): staging: comedi: drivers: introduce comedi_nscans_left() staging: comedi: amplc_pci224: use comedi_async 'scans_done' to detect EOA staging: comedi: comedi_test: use comedi_async 'scans_done' to detect EOA staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AO EOA staging: comedi: drivers: introduce comedi_nsamples_left() staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AI EOA staging: comedi: usbduxfast: use comedi_async 'scans_done' to detect AI EOA staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AI EOA staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AO EOA staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AI EOA staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AO EOA staging: comedi: quatech_daqp_cs: use comedi_async 'scans_done' to detect EOA staging: comedi: das1800: use comedi_async 'scans_done' to detect EOA drivers/staging/comedi/comedidev.h | 4 + drivers/staging/comedi/drivers.c | 71 +++ drivers/staging/comedi/drivers/amplc_pci224.c| 43 +++-- drivers/staging/comedi/drivers/amplc_pci230.c| 110 --- drivers/staging/comedi/drivers/cb_pcidas.c | 43 +++-- drivers/staging/comedi/drivers/cb_pcidas64.c | 95 +--- drivers/staging/comedi/drivers/comedi_test.c | 17 +--- drivers/staging/comedi/drivers/das1800.c | 52 --- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 27 +++--- drivers/staging/comedi/drivers/usbduxfast.c | 19 ++-- 10 files changed, 197 insertions(+), 284 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/13] staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Use the comedi_nsamples_left() helper to get the number of samples to actually read from the async buffer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/cb_pcidas64.c | 40 +++- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 375bfbb..05da5b3 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1085,8 +1085,6 @@ struct pcidas64_private { dma_addr_t ao_dma_desc_bus_addr; /* keeps track of buffer where the next ao sample should go */ unsigned int ao_dma_index; - /* number of analog output samples remaining */ - unsigned long ao_count; unsigned int hw_revision; /* stc chip hardware revision number */ /* last bits sent to INTR_ENABLE_REG register */ unsigned int intr_enable_bits; @@ -2848,22 +2846,6 @@ static int last_ao_dma_load_completed(struct comedi_device *dev) return 1; } -static int ao_stopped_by_error(struct comedi_device *dev, - const struct comedi_cmd *cmd) -{ - struct pcidas64_private *devpriv = dev-private; - - if (cmd-stop_src == TRIG_NONE) - return 1; - if (cmd-stop_src == TRIG_COUNT) { - if (devpriv-ao_count) - return 1; - if (last_ao_dma_load_completed(dev) == 0) - return 1; - } - return 0; -} - static inline int ao_dma_needs_restart(struct comedi_device *dev, unsigned short dma_status) { @@ -2894,20 +2876,13 @@ static unsigned int cb_pcidas64_ao_fill_buffer(struct comedi_device *dev, unsigned short *dest, unsigned int max_bytes) { - struct pcidas64_private *devpriv = dev-private; - struct comedi_cmd *cmd = s-async-cmd; unsigned int nsamples = comedi_bytes_to_samples(s, max_bytes); unsigned int actual_bytes; - if (cmd-stop_src == TRIG_COUNT devpriv-ao_count nsamples) - nsamples = devpriv-ao_count; - + nsamples = comedi_nsamples_left(s, nsamples); actual_bytes = comedi_buf_read_samples(s, dest, nsamples); - nsamples = comedi_bytes_to_samples(s, actual_bytes); - if (cmd-stop_src == TRIG_COUNT) - devpriv-ao_count -= nsamples; - return nsamples; + return comedi_bytes_to_samples(s, actual_bytes); } static unsigned int load_ao_dma_buffer(struct comedi_device *dev, @@ -3006,8 +2981,11 @@ static void handle_ao_interrupt(struct comedi_device *dev, } if ((status DAC_DONE_BIT)) { - async-events |= COMEDI_CB_EOA; - if (ao_stopped_by_error(dev, cmd)) + if ((cmd-stop_src == TRIG_COUNT +async-scans_done = cmd-stop_arg) || + last_ao_dma_load_completed(dev)) + async-events |= COMEDI_CB_EOA; + else async-events |= COMEDI_CB_ERROR; } comedi_handle_events(dev, s); @@ -3202,7 +3180,8 @@ static int prep_ao_dma(struct comedi_device *dev, const struct comedi_cmd *cmd) devpriv-main_iobase + DAC_FIFO_REG); } - if (cmd-stop_src == TRIG_COUNT devpriv-ao_count == 0) + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) return 0; nbytes = load_ao_dma_buffer(dev, cmd); @@ -3267,7 +3246,6 @@ static int ao_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writew(0x0, devpriv-main_iobase + DAC_CONTROL0_REG); devpriv-ao_dma_index = 0; - devpriv-ao_count = cmd-stop_arg * cmd-chanlist_len; set_dac_select_reg(dev, cmd); set_dac_interval_regs(dev, cmd); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/13] staging: comedi: drivers: introduce comedi_nscans_left()
Introduce a helper function to determine the number of scans left in the async command. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/comedidev.h | 2 ++ drivers/staging/comedi/drivers.c | 39 ++ 2 files changed, 41 insertions(+) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index bff5a58..e3ef5cc 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -516,6 +516,8 @@ int comedi_dio_insn_config(struct comedi_device *, struct comedi_subdevice *, unsigned int comedi_dio_update_state(struct comedi_subdevice *, unsigned int *data); unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s); +unsigned int comedi_nscans_left(struct comedi_subdevice *s, + unsigned int nscans); void comedi_inc_scan_progress(struct comedi_subdevice *s, unsigned int num_bytes); diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 4fc992b..a0bd48e 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -328,6 +328,45 @@ unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s) EXPORT_SYMBOL_GPL(comedi_bytes_per_scan); /** + * comedi_nscans_left - return the number of scans left in the command + * @s: comedi_subdevice struct + * @nscans: the expected number of scans + * + * If nscans is 0, the number of scans available in the async buffer will be + * used. Otherwise the expected number of scans will be used. + * + * If the async command has a stop_src of TRIG_COUNT, the nscans will be + * checked against the number of scans left in the command. + * + * The return value will then be either the expected number of scans or the + * number of scans remaining in the command. + */ +unsigned int comedi_nscans_left(struct comedi_subdevice *s, + unsigned int nscans) +{ + struct comedi_async *async = s-async; + struct comedi_cmd *cmd = async-cmd; + + if (nscans == 0) { + unsigned int nbytes = comedi_buf_read_n_available(s); + + nscans = comedi_bytes_to_samples(s, nbytes); + } + + if (cmd-stop_src == TRIG_COUNT) { + unsigned int scans_left = 0; + + if (async-scans_done cmd-stop_arg) + scans_left = cmd-stop_arg - async-scans_done; + + if (nscans scans_left) + nscans = scans_left; + } + return nscans; +} +EXPORT_SYMBOL_GPL(comedi_nscans_left); + +/** * comedi_inc_scan_progress - update scan progress in asynchronous command * @s: comedi_subdevice struct * @num_bytes: amount of data in bytes to increment scan progress -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/13] staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'count' and use the comedi_async 'scans_done' member to detect the analog input end-of-acquisition. Use the comedi_nsamples_left() helper to get the number of samples to actually add to the async buffer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/cb_pcidas.c | 21 +++-- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 1c38cd5..e211ef8 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -346,8 +346,6 @@ struct cb_pcidas_private { /* divisors of master clock for analog input pacing */ unsigned int divisor1; unsigned int divisor2; - /* number of analog input samples remaining */ - unsigned int count; /* bits to write to registers */ unsigned int adc_fifo_bits; unsigned int s5933_intcsr_bits; @@ -976,9 +974,6 @@ static int cb_pcidas_ai_cmd(struct comedi_device *dev, if (cmd-scan_begin_src == TRIG_TIMER || cmd-convert_src == TRIG_TIMER) cb_pcidas_ai_load_counters(dev); - /* set number of conversions */ - if (cmd-stop_src == TRIG_COUNT) - devpriv-count = cmd-chanlist_len * cmd-stop_arg; /* enable interrupts */ spin_lock_irqsave(dev-spinlock, flags); devpriv-adc_fifo_bits |= INTE; @@ -1352,17 +1347,15 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) /* if fifo half-full */ if (status ADHFI) { /* read data */ - num_samples = half_fifo; - if (cmd-stop_src == TRIG_COUNT - num_samples devpriv-count) { - num_samples = devpriv-count; - } + num_samples = comedi_nsamples_left(s, half_fifo); insw(devpriv-adc_fifo + ADCDATA, devpriv-ai_buffer, num_samples); comedi_buf_write_samples(s, devpriv-ai_buffer, num_samples); - devpriv-count -= num_samples; - if (cmd-stop_src == TRIG_COUNT devpriv-count == 0) + + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) async-events |= COMEDI_CB_EOA; + /* clear half-full interrupt latch */ spin_lock_irqsave(dev-spinlock, flags); outw(devpriv-adc_fifo_bits | INT, @@ -1379,9 +1372,9 @@ static irqreturn_t cb_pcidas_interrupt(int irq, void *d) break; val = inw(devpriv-adc_fifo); comedi_buf_write_samples(s, val, 1); + if (cmd-stop_src == TRIG_COUNT - --devpriv-count == 0) { - /* end of acquisition */ + async-scans_done = cmd-stop_arg) { async-events |= COMEDI_CB_EOA; break; } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/13] staging: comedi: cb_pcidas64: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Use the comedi_nsamples_left() helper to get the number of samples to actually add to the async buffer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/cb_pcidas64.c | 55 +++- 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index d7b61ba..375bfbb 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -1065,8 +1065,6 @@ struct pcidas64_private { /* local address (used by dma controller) */ uint32_t local0_iobase; uint32_t local1_iobase; - /* number of analog input samples remaining */ - unsigned int ai_count; /* dma buffers for analog input */ uint16_t *ai_buffer[MAX_AI_DMA_RING_COUNT]; /* physical addresses of ai dma buffers */ @@ -2199,10 +2197,6 @@ static void setup_sample_counters(struct comedi_device *dev, { struct pcidas64_private *devpriv = dev-private; - if (cmd-stop_src == TRIG_COUNT) { - /* set software count */ - devpriv-ai_count = cmd-stop_arg * cmd-chanlist_len; - } /* load hardware conversion counter */ if (use_hw_sample_counter(cmd)) { writew(cmd-stop_arg 0x, @@ -2642,8 +2636,6 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) { struct pcidas64_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; - struct comedi_async *async = s-async; - struct comedi_cmd *cmd = async-cmd; unsigned int i; uint16_t prepost_bits; int read_segment, read_index, write_segment, write_index; @@ -2672,22 +2664,16 @@ static void pio_drain_ai_fifo_16(struct comedi_device *dev) devpriv-ai_fifo_segment_length - read_index; else num_samples = write_index - read_index; - - if (cmd-stop_src == TRIG_COUNT) { - if (devpriv-ai_count == 0) - break; - if (num_samples devpriv-ai_count) - num_samples = devpriv-ai_count; - - devpriv-ai_count -= num_samples; - } - if (num_samples 0) { dev_err(dev-class_dev, cb_pcidas64: bug! num_samples 0\n); break; } + num_samples = comedi_nsamples_left(s, num_samples); + if (num_samples == 0) + break; + for (i = 0; i num_samples; i++) { unsigned short val; @@ -2707,29 +2693,23 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) { struct pcidas64_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; - struct comedi_async *async = s-async; - struct comedi_cmd *cmd = async-cmd; + unsigned int nsamples; unsigned int i; - unsigned int max_transfer = 10; uint32_t fifo_data; int write_code = readw(devpriv-main_iobase + ADC_WRITE_PNTR_REG) 0x7fff; int read_code = readw(devpriv-main_iobase + ADC_READ_PNTR_REG) 0x7fff; - if (cmd-stop_src == TRIG_COUNT) { - if (max_transfer devpriv-ai_count) - max_transfer = devpriv-ai_count; - - } - for (i = 0; read_code != write_code i max_transfer;) { + nsamples = comedi_nsamples_left(s, 10); + for (i = 0; read_code != write_code i nsamples;) { unsigned short val; fifo_data = readl(dev-mmio + ADC_FIFO_REG); val = fifo_data 0x; comedi_buf_write_samples(s, val, 1); i++; - if (i max_transfer) { + if (i nsamples) { val = (fifo_data 16) 0x; comedi_buf_write_samples(s, val, 1); i++; @@ -2737,7 +2717,6 @@ static void pio_drain_ai_fifo_32(struct comedi_device *dev) read_code = readw(devpriv-main_iobase + ADC_READ_PNTR_REG) 0x7fff; } - devpriv-ai_count -= i; } /* empty fifo */ @@ -2755,8 +2734,7 @@ static void drain_dma_buffers(struct comedi_device *dev, unsigned int channel) { const struct pcidas64_board *thisboard = dev-board_ptr; struct pcidas64_private *devpriv = dev-private; - struct comedi_async *async = dev-read_subdev-async; - struct comedi_cmd
[PATCH 05/13] staging: comedi: drivers: introduce comedi_nsamples_left()
Introduce a helper function to calculate the number of samples remaining when the cmd-stop_src is TRIG_COUNT. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/comedidev.h | 2 ++ drivers/staging/comedi/drivers.c | 32 2 files changed, 34 insertions(+) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index e3ef5cc..a80cdfc 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -518,6 +518,8 @@ unsigned int comedi_dio_update_state(struct comedi_subdevice *, unsigned int comedi_bytes_per_scan(struct comedi_subdevice *s); unsigned int comedi_nscans_left(struct comedi_subdevice *s, unsigned int nscans); +unsigned int comedi_nsamples_left(struct comedi_subdevice *s, + unsigned int nsamples); void comedi_inc_scan_progress(struct comedi_subdevice *s, unsigned int num_bytes); diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index a0bd48e..978010f 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -367,6 +367,38 @@ unsigned int comedi_nscans_left(struct comedi_subdevice *s, EXPORT_SYMBOL_GPL(comedi_nscans_left); /** + * comedi_nsamples_left - return the number of samples left in the command + * @s: comedi_subdevice struct + * @nsamples: the expected number of samples + * + * Returns the expected number of samples of the number of samples remaining + * in the command. + */ +unsigned int comedi_nsamples_left(struct comedi_subdevice *s, + unsigned int nsamples) +{ + struct comedi_async *async = s-async; + struct comedi_cmd *cmd = async-cmd; + + if (cmd-stop_src == TRIG_COUNT) { + /* +1 to force comedi_nscans_left() to return the scans left */ + unsigned int nscans = (nsamples / cmd-scan_end_arg) + 1; + unsigned int scans_left = comedi_nscans_left(s, nscans); + unsigned long long samples_left = 0; + + if (scans_left) { + samples_left = ((unsigned long long)scans_left * + cmd-scan_end_arg) - async-cur_chan; + } + + if (samples_left nsamples) + nsamples = samples_left; + } + return nsamples; +} +EXPORT_SYMBOL_GPL(comedi_nsamples_left); + +/** * comedi_inc_scan_progress - update scan progress in asynchronous command * @s: comedi_subdevice struct * @num_bytes: amount of data in bytes to increment scan progress -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/13] staging: comedi: quatech_daqp_cs: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/quatech_daqp_cs.c | 27 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index 0630df3..f77485b 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -65,8 +65,6 @@ struct daqp_private { enum { semaphore, buffer } interrupt_mode; struct completion eos; - - int count; }; /* The DAQP communicates with the system through a 16 byte I/O window. */ @@ -194,6 +192,7 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) struct comedi_device *dev = dev_id; struct daqp_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; + struct comedi_cmd *cmd = s-async-cmd; int loop_limit = 1; int status; @@ -227,12 +226,10 @@ static enum irqreturn daqp_interrupt(int irq, void *dev_id) * and stop conversion if zero */ - if (devpriv-count 0) { - devpriv-count--; - if (devpriv-count == 0) { - s-async-events |= COMEDI_CB_EOA; - break; - } + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) { + s-async-events |= COMEDI_CB_EOA; + break; } if ((loop_limit--) = 0) @@ -573,12 +570,16 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) */ if (cmd-stop_src == TRIG_COUNT) { - devpriv-count = cmd-stop_arg * cmd-scan_end_arg; - threshold = 2 * devpriv-count; - while (threshold DAQP_FIFO_SIZE * 3 / 4) - threshold /= 2; + unsigned long long nsamples; + unsigned long long nbytes; + + nsamples = (unsigned long long)cmd-stop_arg * + cmd-scan_end_arg; + nbytes = nsamples * comedi_bytes_per_sample(s); + while (nbytes DAQP_FIFO_SIZE * 3 / 4) + nbytes /= 2; + threshold = nbytes; } else { - devpriv-count = -1; threshold = DAQP_FIFO_SIZE / 2; } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/13] staging: comedi: comedi_test: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'ai_count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Use the helper function comedi_nscans_left() to check if the number of scans left in the command. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/comedi_test.c | 17 ++--- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_test.c b/drivers/staging/comedi/drivers/comedi_test.c index 1b1399b..e56525a 100644 --- a/drivers/staging/comedi/drivers/comedi_test.c +++ b/drivers/staging/comedi/drivers/comedi_test.c @@ -68,7 +68,6 @@ struct waveform_private { unsigned long usec_period; /* waveform period in microseconds */ unsigned long usec_current; /* current time (mod waveform period) */ unsigned long usec_remainder; /* usec since last scan */ - unsigned long ai_count; /* number of conversions remaining */ unsigned long state_bits; unsigned int scan_period; /* scan period in usec */ unsigned int convert_period;/* conversion period in usec */ @@ -178,7 +177,6 @@ static void waveform_ai_interrupt(unsigned long arg) unsigned long elapsed_time; unsigned int num_scans; ktime_t now; - bool stopping = false; /* check command is still active */ if (!test_bit(WAVEFORM_AI_RUNNING, devpriv-state_bits)) @@ -193,16 +191,7 @@ static void waveform_ai_interrupt(unsigned long arg) devpriv-usec_remainder = (devpriv-usec_remainder + elapsed_time) % devpriv-scan_period; - if (cmd-stop_src == TRIG_COUNT) { - unsigned int remaining = cmd-stop_arg - devpriv-ai_count; - - if (num_scans = remaining) { - /* about to finish */ - num_scans = remaining; - stopping = true; - } - } - + num_scans = comedi_nscans_left(s, num_scans); for (i = 0; i num_scans; i++) { for (j = 0; j cmd-chanlist_len; j++) { unsigned short sample; @@ -216,11 +205,10 @@ static void waveform_ai_interrupt(unsigned long arg) } } - devpriv-ai_count += i; devpriv-usec_current += elapsed_time; devpriv-usec_current %= devpriv-usec_period; - if (stopping) + if (cmd-stop_src == TRIG_COUNT async-scans_done = cmd-stop_arg) async-events |= COMEDI_CB_EOA; else mod_timer(devpriv-timer, jiffies + 1); @@ -317,7 +305,6 @@ static int waveform_ai_cmd(struct comedi_device *dev, return -1; } - devpriv-ai_count = 0; devpriv-scan_period = cmd-scan_begin_arg / nano_per_micro; if (cmd-convert_src == TRIG_NOW) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/13] staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ai_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Use the helper function comedi_nscans_left() to get the number of scans in the async buffer of left in the command. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/amplc_pci230.c | 57 +-- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index a46fffd..5f4b6750 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -491,7 +491,6 @@ struct pci230_private { spinlock_t ao_stop_spinlock;/* Spin lock for stopping AO command */ unsigned long daqio;/* PCI230's DAQ I/O space */ unsigned int ai_scan_count; /* Number of AI scans remaining */ - unsigned int ao_scan_count; /* Number of AO scans remaining. */ int intr_cpuid; /* ID of CPU running ISR */ unsigned short hwver; /* Hardware version (for '+' models) */ unsigned short adccon; /* ADCCON register value */ @@ -1073,13 +1072,12 @@ static void pci230_ao_stop(struct comedi_device *dev, static void pci230_handle_ao_nofifo(struct comedi_device *dev, struct comedi_subdevice *s) { - struct pci230_private *devpriv = dev-private; struct comedi_async *async = s-async; struct comedi_cmd *cmd = async-cmd; unsigned short data; int i; - if (cmd-stop_src == TRIG_COUNT devpriv-ao_scan_count == 0) + if (cmd-stop_src == TRIG_COUNT async-scans_done = cmd-stop_arg) return; for (i = 0; i cmd-chanlist_len; i++) { @@ -1093,13 +1091,8 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev, s-readback[chan] = data; } - if (cmd-stop_src == TRIG_COUNT) { - devpriv-ao_scan_count--; - if (devpriv-ao_scan_count == 0) { - /* End of acquisition. */ - async-events |= COMEDI_CB_EOA; - } - } + if (cmd-stop_src == TRIG_COUNT async-scans_done = cmd-stop_arg) + async-events |= COMEDI_CB_EOA; } /* @@ -1112,7 +1105,7 @@ static bool pci230_handle_ao_fifo(struct comedi_device *dev, struct pci230_private *devpriv = dev-private; struct comedi_async *async = s-async; struct comedi_cmd *cmd = async-cmd; - unsigned int num_scans; + unsigned int num_scans = comedi_nscans_left(s, 0); unsigned int room; unsigned short dacstat; unsigned int i, n; @@ -1120,17 +1113,10 @@ static bool pci230_handle_ao_fifo(struct comedi_device *dev, /* Get DAC FIFO status. */ dacstat = inw(devpriv-daqio + PCI230_DACCON); - /* Determine number of scans available in buffer. */ - num_scans = comedi_buf_read_n_available(s) / comedi_bytes_per_scan(s); - if (cmd-stop_src == TRIG_COUNT) { - /* Fixed number of scans. */ - if (num_scans devpriv-ao_scan_count) - num_scans = devpriv-ao_scan_count; - if (devpriv-ao_scan_count == 0) { - /* End of acquisition. */ - events |= COMEDI_CB_EOA; - } - } + + if (cmd-stop_src == TRIG_COUNT num_scans == 0) + events |= COMEDI_CB_EOA; + if (events == 0) { /* Check for FIFO underrun. */ if (dacstat PCI230P2_DAC_FIFO_UNDERRUN_LATCHED) { @@ -1175,21 +1161,16 @@ static bool pci230_handle_ao_fifo(struct comedi_device *dev, } } - if (cmd-stop_src == TRIG_COUNT) { - devpriv-ao_scan_count -= num_scans; - if (devpriv-ao_scan_count == 0) { - /* -* All data for the command has been written -* to FIFO. Set FIFO interrupt trigger level -* to 'empty'. -*/ - devpriv-daccon = - (devpriv-daccon -~PCI230P2_DAC_INT_FIFO_MASK) | - PCI230P2_DAC_INT_FIFO_EMPTY; - outw(devpriv-daccon, -devpriv-daqio + PCI230_DACCON); - } + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) { + /* +* All data for the command has been written +
[PATCH 13/13] staging: comedi: das1800: use comedi_async 'scans_done' to detect EOA
Remove the private data member 'count' and use the comedi_async 'scans_done' member to detect the end-of-acquisition. Use the comedi_nsamples_left() helper to get the number of samples to actually add to the async buffer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/das1800.c | 52 +++- 1 file changed, 18 insertions(+), 34 deletions(-) diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c index 03b1ff9..be825d2 100644 --- a/drivers/staging/comedi/drivers/das1800.c +++ b/drivers/staging/comedi/drivers/das1800.c @@ -421,7 +421,6 @@ static const struct das1800_board das1800_boards[] = { }; struct das1800_private { - unsigned int count; /* number of data points left to be taken */ unsigned int divisor1; /* value to load into board's counter 1 for timed conversions */ unsigned int divisor2; /* value to load into board's counter 2 for timed conversions */ int irq_dma_bits; /* bits for control register b */ @@ -479,41 +478,33 @@ static void das1800_handle_fifo_half_full(struct comedi_device *dev, struct comedi_subdevice *s) { struct das1800_private *devpriv = dev-private; - int numPoints = 0; /* number of points to read */ - struct comedi_cmd *cmd = s-async-cmd; + unsigned int nsamples = comedi_nsamples_left(s, FIFO_SIZE / 2); - numPoints = FIFO_SIZE / 2; - /* if we only need some of the points */ - if (cmd-stop_src == TRIG_COUNT devpriv-count numPoints) - numPoints = devpriv-count; - insw(dev-iobase + DAS1800_FIFO, devpriv-ai_buf0, numPoints); - munge_data(dev, devpriv-ai_buf0, numPoints); - comedi_buf_write_samples(s, devpriv-ai_buf0, numPoints); - if (cmd-stop_src == TRIG_COUNT) - devpriv-count -= numPoints; + insw(dev-iobase + DAS1800_FIFO, devpriv-ai_buf0, nsamples); + munge_data(dev, devpriv-ai_buf0, nsamples); + comedi_buf_write_samples(s, devpriv-ai_buf0, nsamples); } static void das1800_handle_fifo_not_empty(struct comedi_device *dev, struct comedi_subdevice *s) { - struct das1800_private *devpriv = dev-private; + struct comedi_cmd *cmd = s-async-cmd; unsigned short dpnt; int unipolar; - struct comedi_cmd *cmd = s-async-cmd; unipolar = inb(dev-iobase + DAS1800_CONTROL_C) UB; while (inb(dev-iobase + DAS1800_STATUS) FNE) { - if (cmd-stop_src == TRIG_COUNT devpriv-count == 0) - break; dpnt = inw(dev-iobase + DAS1800_FIFO); /* convert to unsigned type if we are in a bipolar mode */ if (!unipolar) ; dpnt = munge_bipolar_sample(dev, dpnt); comedi_buf_write_samples(s, dpnt, 1); - if (cmd-stop_src == TRIG_COUNT) - devpriv-count--; + + if (cmd-stop_src == TRIG_COUNT + s-async-scans_done = cmd-stop_arg) + break; } } @@ -524,8 +515,8 @@ static void das1800_flush_dma_channel(struct comedi_device *dev, unsigned int channel, uint16_t *buffer) { struct das1800_private *devpriv = dev-private; - unsigned int num_bytes, num_samples; - struct comedi_cmd *cmd = s-async-cmd; + unsigned int nbytes; + unsigned int nsamples; disable_dma(channel); @@ -534,17 +525,12 @@ static void das1800_flush_dma_channel(struct comedi_device *dev, clear_dma_ff(channel); /* figure out how many points to read */ - num_bytes = devpriv-dma_transfer_size - get_dma_residue(channel); - num_samples = comedi_bytes_to_samples(s, num_bytes); - - /* if we only need some of the points */ - if (cmd-stop_src == TRIG_COUNT devpriv-count num_samples) - num_samples = devpriv-count; + nbytes = devpriv-dma_transfer_size - get_dma_residue(channel); + nsamples = comedi_bytes_to_samples(s, nbytes); + nsamples = comedi_nsamples_left(s, nsamples); - munge_data(dev, buffer, num_samples); - comedi_buf_write_samples(s, buffer, num_samples); - if (cmd-stop_src == TRIG_COUNT) - devpriv-count -= num_samples; + munge_data(dev, buffer, nsamples); + comedi_buf_write_samples(s, buffer, nsamples); } /* flushes remaining data from board when external trigger has stopped acquisition @@ -668,7 +654,8 @@ static void das1800_ai_handler(struct comedi_device *dev) else das1800_handle_fifo_not_empty(dev, s); async-events |= COMEDI_CB_EOA; - } else if
[PATCH 06/13] staging: comedi: amplc_pci230: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_scan_count' and use the comedi_async 'scans_done' member to detect the analog input end-of-acquisition. Use the comedi_nsamples_left() helper to work out the number of 'wake' samples in pci230_ai_update_fifo_trigger_level() and the number of 'todo' samples actually added to the async buffer in pci230_handle_ai(). Remove the unnecessary COMEDI_CB_OVERFLOW event for the hardware FIFO overflow error. The COMEDI_CB_ERROR event will terminate the command. comedi_buf_write_samples() can fail if the async buffer does not have room for the sample. The it will set the COMEDI_CB_OVERFLOW event and return 0. Detect this and quit trying to read and add more samples. The event will terminate the command. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/amplc_pci230.c | 53 +-- 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 5f4b6750..fb0b70f 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -490,7 +490,6 @@ struct pci230_private { spinlock_t ai_stop_spinlock;/* Spin lock for stopping AI command */ spinlock_t ao_stop_spinlock;/* Spin lock for stopping AO command */ unsigned long daqio;/* PCI230's DAQ I/O space */ - unsigned int ai_scan_count; /* Number of AI scans remaining */ int intr_cpuid; /* ID of CPU running ISR */ unsigned short hwver; /* Hardware version (for '+' models) */ unsigned short adccon; /* ADCCON register value */ @@ -1720,19 +1719,15 @@ static void pci230_ai_update_fifo_trigger_level(struct comedi_device *dev, { struct pci230_private *devpriv = dev-private; struct comedi_cmd *cmd = s-async-cmd; - unsigned int scanlen = cmd-scan_end_arg; unsigned int wake; unsigned short triglev; unsigned short adccon; if (cmd-flags CMDF_WAKE_EOS) - wake = scanlen - s-async-cur_chan; - else if (cmd-stop_src != TRIG_COUNT || -devpriv-ai_scan_count = PCI230_ADC_FIFOLEVEL_HALFFULL || -scanlen = PCI230_ADC_FIFOLEVEL_HALFFULL) - wake = PCI230_ADC_FIFOLEVEL_HALFFULL; + wake = cmd-scan_end_arg - s-async-cur_chan; else - wake = devpriv-ai_scan_count * scanlen - s-async-cur_chan; + wake = comedi_nsamples_left(s, PCI230_ADC_FIFOLEVEL_HALFFULL); + if (wake = PCI230_ADC_FIFOLEVEL_HALFFULL) { triglev = PCI230_ADC_INT_FIFO_HALF; } else if (wake 1 devpriv-hwver 0) { @@ -2025,8 +2020,6 @@ static void pci230_handle_ai(struct comedi_device *dev, struct pci230_private *devpriv = dev-private; struct comedi_async *async = s-async; struct comedi_cmd *cmd = async-cmd; - unsigned int scanlen = cmd-scan_end_arg; - unsigned int events = 0; unsigned int status_fifo; unsigned int i; unsigned int todo; @@ -2034,20 +2027,10 @@ static void pci230_handle_ai(struct comedi_device *dev, unsigned short val; /* Determine number of samples to read. */ - if (cmd-stop_src != TRIG_COUNT) { - todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } else if (devpriv-ai_scan_count == 0) { - todo = 0; - } else if (devpriv-ai_scan_count PCI230_ADC_FIFOLEVEL_HALFFULL || - scanlen PCI230_ADC_FIFOLEVEL_HALFFULL) { - todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } else { - todo = devpriv-ai_scan_count * scanlen - async-cur_chan; - if (todo PCI230_ADC_FIFOLEVEL_HALFFULL) - todo = PCI230_ADC_FIFOLEVEL_HALFFULL; - } + todo = comedi_nsamples_left(s, PCI230_ADC_FIFOLEVEL_HALFFULL); if (todo == 0) return; + fifoamount = 0; for (i = 0; i todo; i++) { if (fifoamount == 0) { @@ -2059,7 +2042,7 @@ static void pci230_handle_ai(struct comedi_device *dev, * unnoticed by the caller. */ dev_err(dev-class_dev, AI FIFO overrun\n); - events |= COMEDI_CB_OVERFLOW | COMEDI_CB_ERROR; + async-events |= COMEDI_CB_ERROR; break; } else if (status_fifo PCI230_ADC_FIFO_EMPTY) { /* FIFO empty. */ @@ -2080,21 +2063,21 @@ static void pci230_handle_ai(struct comedi_device *dev, } val = pci230_ai_read(dev); - comedi_buf_write_samples(s, val, 1); + if
[PATCH 09/13] staging: comedi: cb_pcidas: use comedi_async 'scans_done' to detect AO EOA
Remove the private data member 'ao_count' and use the comedi_async 'scans_done' member to detect the analog output end-of-acquisition. Use the comedi_nsamples_left() helper to get the number of samples to actually read from the async buffer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/cb_pcidas.c | 22 ++ 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index e211ef8..10c67fe 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -356,8 +356,6 @@ struct cb_pcidas_private { /* divisors of master clock for analog output pacing */ unsigned int ao_divisor1; unsigned int ao_divisor2; - /* number of analog output samples remaining */ - unsigned int ao_count; unsigned int caldac_value[NUM_CHANNELS_8800]; unsigned int trimpot_value[NUM_CHANNELS_8402]; unsigned int dac08_value; @@ -1134,17 +1132,12 @@ static void cb_pcidas_ao_load_fifo(struct comedi_device *dev, unsigned int nsamples) { struct cb_pcidas_private *devpriv = dev-private; - struct comedi_cmd *cmd = s-async-cmd; unsigned int nbytes; - if (cmd-stop_src == TRIG_COUNT devpriv-ao_count nsamples) - nsamples = devpriv-ao_count; - + nsamples = comedi_nsamples_left(s, nsamples); nbytes = comedi_buf_read_samples(s, devpriv-ao_buffer, nsamples); - nsamples = comedi_bytes_to_samples(s, nbytes); - if (cmd-stop_src == TRIG_COUNT) - devpriv-ao_count -= nsamples; + nsamples = comedi_bytes_to_samples(s, nbytes); outsw(devpriv-ao_registers + DACDATA, devpriv-ao_buffer, nsamples); } @@ -1226,9 +1219,6 @@ static int cb_pcidas_ao_cmd(struct comedi_device *dev, if (cmd-scan_begin_src == TRIG_TIMER) cb_pcidas_ao_load_counters(dev); - /* set number of conversions */ - if (cmd-stop_src == TRIG_COUNT) - devpriv-ao_count = cmd-chanlist_len * cmd-stop_arg; /* set pacer source */ spin_lock_irqsave(dev-spinlock, flags); switch (cmd-scan_begin_src) { @@ -1286,13 +1276,13 @@ static void handle_ao_interrupt(struct comedi_device *dev, unsigned int status) devpriv-control_status + INT_ADCFIFO); spin_unlock_irqrestore(dev-spinlock, flags); if (inw(devpriv-ao_registers + DAC_CSR) DAC_EMPTY) { - if (cmd-stop_src == TRIG_NONE || - (cmd-stop_src == TRIG_COUNT - devpriv-ao_count)) { + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) { + async-events |= COMEDI_CB_EOA; + } else { dev_err(dev-class_dev, dac fifo underflow\n); async-events |= COMEDI_CB_ERROR; } - async-events |= COMEDI_CB_EOA; } } else if (status DAHFI) { cb_pcidas_ao_load_fifo(dev, s, thisboard-fifo_size / 2); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/13] staging: comedi: usbduxfast: use comedi_async 'scans_done' to detect AI EOA
Remove the private data member 'ai_sample_count' and use the comedi_async 'scans_done' member to detect the analog input end-of-acquisition. Use the comedi_nsamples_left() helper to get the number of samples to actually add to the async buffer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/usbduxfast.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index 5de76ab..ddc4cb9 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -161,7 +161,6 @@ struct usbduxfast_private { uint8_t *duxbuf; int8_t *inbuf; short int ai_cmd_running; /* asynchronous command is running */ - long int ai_sample_count; /* number of samples to acquire */ int ignore; /* counter which ignores the first buffers */ struct semaphore sem; @@ -251,15 +250,12 @@ static void usbduxfast_ai_handle_urb(struct comedi_device *dev, unsigned int nsamples; nsamples = comedi_bytes_to_samples(s, urb-actual_length); - if (cmd-stop_src == TRIG_COUNT) { - if (devpriv-ai_sample_count nsamples) { - nsamples = devpriv-ai_sample_count; - async-events |= COMEDI_CB_EOA; - } - devpriv-ai_sample_count -= nsamples; - } - + nsamples = comedi_nsamples_left(s, nsamples); comedi_buf_write_samples(s, urb-transfer_buffer, nsamples); + + if (cmd-stop_src == TRIG_COUNT + async-scans_done = cmd-stop_arg) + async-events |= COMEDI_CB_EOA; } /* if command is still running, resubmit urb for BULK transfer */ @@ -788,11 +784,6 @@ static int usbduxfast_ai_cmd(struct comedi_device *dev, return result; } - if (cmd-stop_src == TRIG_COUNT) - devpriv-ai_sample_count = cmd-stop_arg * cmd-scan_end_arg; - else/* TRIG_NONE */ - devpriv-ai_sample_count = 0; - if ((cmd-start_src == TRIG_NOW) || (cmd-start_src == TRIG_EXT)) { /* enable this acquisition operation */ devpriv-ai_cmd_running = 1; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] drm: imx: Move imx-drm driver out of staging
Am Dienstag, den 04.11.2014, 16:19 + schrieb Emil Velikov: Hi Philipp, Just a flyby question On 04/11/14 10:52, Philipp Zabel wrote: The imx-drm driver was put into staging mostly for the following reasons, all of which have been addressed or superseded: - convert the irq driver to use linear irq domains - work out the device tree bindings, this lead to the common of_graph bindings being used Afaics Steve's patches introduce some non-backward compatible changes to the DT bindings (s/port/crtc/). Shouldn't those be discussed/resolved prior to pushing the driver out of staging ? Those binding changes are backwards. We moved away from mentioning crtcs in the device tree earlier, as those are most definitely not a property of the hardware. The two output ports of the IPU in the device tree correspond to the physical output signals of the two DIs, not to the crtcs, which are a linux specific abstraction, more closely related to parts of the DP and DC units. What is exactly represented by each crtc could be changed in the code without affecting the device tree bindings. In hardware, it is possible to link both of the DC/DP output channels to either DI dynamically. The driver could be changed to stop associating each crtc with a fixed DI, and select the appropriate DI automatically for a given crtc - encoder pair. In my opinion the time for non-backward compatible changes has passed anyway. That being said, if a case is to be made for device tree changes, it should be discussed before the move. regards Philipp ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] [media] solo6x10: don't turn off/on encoder interrupt in processing loop
2014-11-03 19:15 GMT+04:00 Hans Verkuil hverk...@xs4all.nl: Hi Andrey, On 10/29/2014 05:03 PM, Andrey Utkin wrote: The used approach actually cannot prevent new encoder interrupt to appear, because interrupt handler can execute in different thread, and in current implementation there is still race condition regarding this. I don't understand what you mean with 'interrupt handler can execute in different thread'. Can you elaborate? Note that I do think that this change makes sense, but I do like to have a better explanation. Hi Hans, thanks for response. I'm not proficient in linux kernel, so it's hard to make sure and strict statements regarding this. In the commit justification I mean that solo_ring_thread(), which is edited, runs in a thread started with kthread_run(). Interrupt hander is executed on random kernel thread (whichever is currently running, is it correct?). So temporarily disabling interrupts from video encoders by writing to special register cannot be used for processing serialization, for fixation of state or anything useful at all, thus it should be removed from code. Is it clear now? Please feel free to push the patch with edited description, even without resubmission from me. -- Andrey Utkin ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 004/108] staging: comedi: addi_apci_3120: introduce apci3120_timer_read()
Introduce a helper function to select a timer and read a value from it. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 45 -- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index ea825c7..7335a64 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -220,6 +220,29 @@ static void apci3120_timer_write(struct comedi_device *dev, } } +static unsigned int apci3120_timer_read(struct comedi_device *dev, + unsigned int timer) +{ + struct apci3120_private *devpriv = dev-private; + unsigned int val; + + /* read 16-bit value from timer (lower 16-bits of timer 2) */ + outb(((devpriv-do_bits) 0xF0) | +APCI3120_CTR0_TIMER_SEL(timer), +dev-iobase + APCI3120_TIMER_CRT0); + val = inw(dev-iobase + APCI3120_TIMER_VALUE); + + if (timer == 2) { + /* read upper 16-bits from timer 2 */ + outb(((devpriv-do_bits) 0xF0) | +APCI3120_CTR0_TIMER_SEL(timer + 1), +dev-iobase + APCI3120_TIMER_CRT0); + val |= (inw(dev-iobase + APCI3120_TIMER_VALUE) 16); + } + + return val; +} + static int apci3120_ai_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -1626,32 +1649,14 @@ static int apci3120_read_insn_timer(struct comedi_device *dev, unsigned int *data) { struct apci3120_private *devpriv = dev-private; - unsigned char b_Tmp; - unsigned short us_TmpValue, us_TmpValue_2, us_StatusValue; + unsigned short us_StatusValue; if ((devpriv-b_Timer2Mode != APCI3120_WATCHDOG) (devpriv-b_Timer2Mode != APCI3120_TIMER)) { dev_err(dev-class_dev, timer2 not configured\n); } if (devpriv-b_Timer2Mode == APCI3120_TIMER) { - - /* Read the LOW unsigned short of Timer 2 register */ - b_Tmp = ((devpriv-do_bits) 0xF0) | - APCI3120_SELECT_TIMER_2_LOW_WORD; - outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); - - us_TmpValue = inw(dev-iobase + APCI3120_TIMER_VALUE); - - /* Read the HIGH unsigned short of Timer 2 register */ - b_Tmp = ((devpriv-do_bits) 0xF0) | - APCI3120_SELECT_TIMER_2_HIGH_WORD; - outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); - - us_TmpValue_2 = inw(dev-iobase + APCI3120_TIMER_VALUE); - - /* combining both words */ - data[0] = (unsigned int) ((us_TmpValue) | ((us_TmpValue_2) 16)); - + data[0] = apci3120_timer_read(dev, 2); } else {/* Read watch dog status */ us_StatusValue = inw(dev-iobase + APCI3120_RD_STATUS); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 007/108] staging: comedi: addi_apci_3120: rename APCI3120_TIMER_VALUE
For aesthetics, rename this register offset. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 9 - drivers/staging/comedi/drivers/addi_apci_3120.c | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 6eaf62a..c9b416e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -149,7 +149,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY #define APCI3120_TIMER_CRT10x0c -#define APCI3120_TIMER_VALUE 0x04 #define APCI3120_TIMER_STATUS_REGISTER 0x0d #define APCI3120_RD_STATUS 0x02 #define APCI3120_WR_ADDRESS0x00 @@ -191,14 +190,14 @@ static void apci3120_timer_write(struct comedi_device *dev, outb(APCI3120_CTR0_DO_BITS(devpriv-do_bits) | APCI3120_CTR0_TIMER_SEL(timer), dev-iobase + APCI3120_CTR0_REG); - outw(val 0x, dev-iobase + APCI3120_TIMER_VALUE); + outw(val 0x, dev-iobase + APCI3120_TIMER_REG); if (timer == 2) { /* write upper 16-bits to timer 2 */ outb(APCI3120_CTR0_DO_BITS(devpriv-do_bits) | APCI3120_CTR0_TIMER_SEL(timer + 1), dev-iobase + APCI3120_CTR0_REG); - outw((val 16) 0x, dev-iobase + APCI3120_TIMER_VALUE); + outw((val 16) 0x, dev-iobase + APCI3120_TIMER_REG); } } @@ -212,14 +211,14 @@ static unsigned int apci3120_timer_read(struct comedi_device *dev, outb(APCI3120_CTR0_DO_BITS(devpriv-do_bits) | APCI3120_CTR0_TIMER_SEL(timer), dev-iobase + APCI3120_CTR0_REG); - val = inw(dev-iobase + APCI3120_TIMER_VALUE); + val = inw(dev-iobase + APCI3120_TIMER_REG); if (timer == 2) { /* read upper 16-bits from timer 2 */ outb(APCI3120_CTR0_DO_BITS(devpriv-do_bits) | APCI3120_CTR0_TIMER_SEL(timer + 1), dev-iobase + APCI3120_CTR0_REG); - val |= (inw(dev-iobase + APCI3120_TIMER_VALUE) 16); + val |= (inw(dev-iobase + APCI3120_TIMER_REG) 16); } return val; diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 51637e1..f431e54 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -16,6 +16,7 @@ * PCI BAR 1 register map (dev-iobase) */ #define APCI3120_STATUS_TO_VERSION(x) (((x) 4) 0xf) +#define APCI3120_TIMER_REG 0x04 #define APCI3120_AO_REG(x) (0x08 + (((x) / 4) * 2)) #define APCI3120_AO_MUX(x) (((x) 0x3) 14) #define APCI3120_AO_DATA(x)((x) 0) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 000/108] staging: comedi: addi_apci_3120: cleanup driver
Following is the big cleanup series for the ADDI-DATA APCI-3120 driver. Quick summary of the cleanup: * Removes all the CamelCase * Cleans up the register map defines * Fixes the Analog Input subdevice * Fixes the async command support for the Analog Input subdevice * Cleans up all the timer support code * Cleans up the DMA support code * Removes the included addi-data/hwdrv_apci3120.c source file * Removes all the cruft H Hartley Sweeten (108): staging: comedi: addi_apci_3120: introduce apci3120_ns_to_timer() staging: comedi: addi_apci_3120: rename private data 'b_DigitalOutputRegister' staging: comedi: addi_apci_3120: introduce apci3120_timer_write() staging: comedi: addi_apci_3120: introduce apci3120_timer_read() staging: comedi: addi_apci_3120: tidy up CTR0 register defines staging: comedi: addi_apci_3120: fix counter and external interrupt disable staging: comedi: addi_apci_3120: rename APCI3120_TIMER_VALUE staging: comedi: addi_apci_3120: rename private data 'b_TimerSelectMode' staging: comedi: addi_apci_3120: tidy up timer_mode masking staging: comedi: addi_apci_3120: introduce apci3120_timer_set_mode() staging: comedi: addi_apci_3120: move timer helpers to main driver source staging: comedi: addi_apci_3120: rename private data 'us_OutputRegister' staging: comedi: addi_apci_3120: tidy up devpriv-ctrl use staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER[012] staging: comedi: addi_apci_3120: tidy up APCI3120_ENABLE_TIMER[012] staging: comedi: addi_apci_3120: rename APCI3120_ENABLE_EXT_TRIGGER staging: comedi: addi_apci_3120: tidy up apci3120_exttrig_{enable,disable}() staging: comedi: addi_apci_3120: introduce apci3120_timer_enable() staging: comedi: addi_apci_3120: fix timer 2 disable in apci3120_write_insn_timer() staging: comedi: addi_apci_3120: rename APCI3120_WR_ADDRESS staging: comedi: addi_apci_3120: move apci3120_timer_enable() to driver source staging: comedi: addi_apci_3120: move apci3120_exttrig_enable() to driver source staging: comedi: addi_apci_3120: introduce apci3120_clr_timer2_interrupt() staging: comedi: addi_apci_3120: remove unnecessary reset of the scan sequence staging: comedi: addi_apci_3120: tidy up scan chanlist programming staging: comedi: addi_apci_3120: remove 'check' param from apci3120_setup_chan_list() staging: comedi: addi_apci_3120: introduce apci3120_ai_reset_fifo() staging: comedi: addi_apci_3120: move ai range table to driver source staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_ALL_INTERRUPT_WITHOUT_TIMER staging: comedi: addi_apci_3120: properly disable interrupts in apci3120_cancel() staging: comedi: addi_apci_3120: rename private data 'b_ModeSelectRegister' staging: comedi: addi_apci_3120: remove unnecessary devpriv-mode masking staging: comedi: addi_apci_3120: remove devpriv-mode '0xef' magic value staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_COUNTER staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_WATCHDOG staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_INT staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOC_INT staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOS_INT staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_SCAN staging: comedi: addi_apci_3120: define the enable bits in the mode register staging: comedi: addi_apci_3120: define the timer 2 operation bits staging: comedi: addi_apci_3120: define the timer 2 clock select bits staging: comedi: addi_apci_3120: rename APCI3120_WRITE_MODE_SELECT staging: comedi: addi_apci_3120: remove scanning from ai (*insn_read) staging: comedi: addi_apci_3120: remove private data 'ui_EocEosConversionTime' staging: comedi: addi_apci_3120: remove interrupt support from ai (*insn_read) staging: comedi: addi_apci_3120: remove apci3120_ai_insn_config() staging: comedi: addi_apci_3120: remove private data 'ui_AiReadData' staging: comedi: addi_apci_3120: fix apci3120_ai_insn_read() staging: comedi: addi_apci_3120: absorb apci3120_interrupt_handle_eos() staging: comedi: addi_apci_3120: remove private data 'ui_AiNbrofChannels' staging: comedi: addi_apci_3120: remove private data 'ui_AiChannelList' staging: comedi: addi_apci_3120: rename APCI3120_RD_STATUS staging: comedi: addi_apci_3120: define status register bits staging: comedi: addi_apci_3120: remove private data 'ai_running' staging: comedi: addi_apci_3120: move apci3120_do_insn_bits() to driver source staging: comedi: addi_apci_3120: move apci3120_di_insn_bits() to driver source staging: comedi: addi_apci_3120: move apci3120_ao_insn_write() to driver source staging: comedi: addi_apci_3120: move apci3120_ai_insn_read() to driver source staging: comedi: addi_apci_3120: remove check in apci3120_setup_chan_list() staging: comedi: addi_apci_3120: move apci3120_set_chanlist() to driver source staging: comedi: addi_apci_3120: factor DMA setup out
[PATCH 019/108] staging: comedi: addi_apci_3120: fix timer 2 disable in apci3120_write_insn_timer()
The wrong define is being used to disable the gate to stop timer 2 in this function. Use the apci3120_timer_enable() helper to properly disable the timer. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 8da1db5..3aa4bbe 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1404,9 +1404,7 @@ static int apci3120_write_insn_timer(struct comedi_device *dev, outb(devpriv-b_ModeSelectRegister, dev-iobase + APCI3120_WRITE_MODE_SELECT); - /* Reset Gate 2 */ - devpriv-ctrl = APCI3120_DISABLE_TIMER_INT; - outw(devpriv-ctrl, dev-iobase + APCI3120_WR_ADDRESS); + apci3120_timer_enable(dev, 2, false); /* Reset FC_TIMER BIT */ inb(dev-iobase + APCI3120_TIMER_STATUS_REGISTER); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 002/108] staging: comedi: addi_apci_3120: rename private data 'b_DigitalOutputRegister'
Rename this CamelCase member of the private data. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 50 -- drivers/staging/comedi/drivers/addi_apci_3120.c| 2 +- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 960002d..9fca58c 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -391,8 +391,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, dev-iobase + APCI3120_WR_ADDRESS); /* Select Timer 0 */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); @@ -449,8 +448,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, dev-iobase + APCI3120_TIMER_CRT1); /* Select Timer 0 */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); @@ -767,8 +765,7 @@ static int apci3120_cyclic_ai(int mode, dev-iobase + APCI3120_TIMER_CRT1); /* Select Timer 0 */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); /* Set the conversion time */ @@ -784,8 +781,7 @@ static int apci3120_cyclic_ai(int mode, dev-iobase + APCI3120_TIMER_CRT1); /* Select Timer 1 */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_1_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); /* Set the conversion time */ @@ -799,8 +795,7 @@ static int apci3120_cyclic_ai(int mode, dev-iobase + APCI3120_TIMER_CRT1); /* Select Timer 0 */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_0_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); @@ -859,16 +854,14 @@ static int apci3120_cyclic_ai(int mode, dev-iobase + APCI3120_TIMER_CRT1); /* Writing LOW unsigned short */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); outw(ui_TimerValue2 0x, dev-iobase + APCI3120_TIMER_VALUE); /* Writing HIGH unsigned short */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); outw((ui_TimerValue2 16) 0x, @@ -1487,15 +1480,13 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, */ /* Writing LOW unsigned short */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_2_LOW_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); outw(divisor 0x, dev-iobase + APCI3120_TIMER_VALUE); /* Writing HIGH unsigned short */ - b_Tmp = ((devpriv- - b_DigitalOutputRegister) 0xF0) | + b_Tmp = ((devpriv-do_bits) 0xF0) | APCI3120_SELECT_TIMER_2_HIGH_WORD; outb(b_Tmp, dev-iobase + APCI3120_TIMER_CRT0); outw((divisor 16)
[PATCH 021/108] staging: comedi: addi_apci_3120: move apci3120_timer_enable() to driver source
Move this helper function from the included source file into the main driver source file. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 12 drivers/staging/comedi/drivers/addi_apci_3120.c | 12 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 184bff4..30e1298 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -155,18 +155,6 @@ static const struct comedi_lrange range_apci3120_ai = { } }; -static void apci3120_timer_enable(struct comedi_device *dev, - unsigned int timer, bool enable) -{ - struct apci3120_private *devpriv = dev-private; - - if (enable) - devpriv-ctrl |= APCI3120_CTRL_GATE(timer); - else - devpriv-ctrl = ~APCI3120_CTRL_GATE(timer); - outw(devpriv-ctrl, dev-iobase + APCI3120_CTRL_REG); -} - static int apci3120_ai_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 014a014..7bfb320 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -208,6 +208,18 @@ static void apci3120_timer_set_mode(struct comedi_device *dev, outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_MODE_REG); } +static void apci3120_timer_enable(struct comedi_device *dev, + unsigned int timer, bool enable) +{ + struct apci3120_private *devpriv = dev-private; + + if (enable) + devpriv-ctrl |= APCI3120_CTRL_GATE(timer); + else + devpriv-ctrl = ~APCI3120_CTRL_GATE(timer); + outw(devpriv-ctrl, dev-iobase + APCI3120_CTRL_REG); +} + #include addi-data/hwdrv_apci3120.c static void apci3120_dma_alloc(struct comedi_device *dev) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 017/108] staging: comedi: addi_apci_3120: tidy up apci3120_exttrig_{enable, disable}()
Merge these two functions and use an 'enable' parameter to determine if the external trigger needs to be enabled or disabled. This function always succeeds and the callers don't check the return. Change the return type to void. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 23 -- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 7770468..30606c9 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -477,22 +477,15 @@ static int apci3120_reset(struct comedi_device *dev) return 0; } -static int apci3120_exttrig_enable(struct comedi_device *dev) +static void apci3120_exttrig_enable(struct comedi_device *dev, bool enable) { struct apci3120_private *devpriv = dev-private; - devpriv-ctrl |= APCI3120_CTRL_EXT_TRIG; - outw(devpriv-ctrl, dev-iobase + APCI3120_WR_ADDRESS); - return 0; -} - -static int apci3120_exttrig_disable(struct comedi_device *dev) -{ - struct apci3120_private *devpriv = dev-private; - - devpriv-ctrl = ~APCI3120_CTRL_EXT_TRIG; + if (enable) + devpriv-ctrl |= APCI3120_CTRL_EXT_TRIG; + else + devpriv-ctrl = ~APCI3120_CTRL_EXT_TRIG; outw(devpriv-ctrl, dev-iobase + APCI3120_WR_ADDRESS); - return 0; } static int apci3120_cancel(struct comedi_device *dev, @@ -649,7 +642,8 @@ static int apci3120_cyclic_ai(int mode, } if (devpriv-b_ExttrigEnable == APCI3120_ENABLE) - apci3120_exttrig_enable(dev); /* activate EXT trigger */ + apci3120_exttrig_enable(dev, true); + switch (mode) { case 1: /* init timer0 in mode 2 */ @@ -1114,8 +1108,7 @@ static irqreturn_t apci3120_interrupt(int irq, void *d) int_daq = (int_daq 12) 0xF; if (devpriv-b_ExttrigEnable == APCI3120_ENABLE) { - /* Disable ext trigger */ - apci3120_exttrig_disable(dev); + apci3120_exttrig_enable(dev, false); devpriv-b_ExttrigEnable = APCI3120_DISABLE; } /* clear the timer 2 interrupt */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 037/108] staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_EOC_INT
For aesthetics, remove this define and just use ~APCI3120_ENABLE_EOC_INT. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 31920b6..545bc90 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -91,7 +91,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY #define APCI3120_DISABLE_EOS_INT (~APCI3120_ENABLE_EOS_INT) #define APCI3120_ENABLE_EOC_INT0x1 -#define APCI3120_DISABLE_EOC_INT (~APCI3120_ENABLE_EOC_INT) /* status register bits */ #define APCI3120_EOC 0x8000 @@ -968,7 +967,7 @@ static irqreturn_t apci3120_interrupt(int irq, void *d) send_sig(SIGIO, devpriv-tsk_Current, 0); /* send signal to the sample */ } else { /* Disable EOC Interrupt */ - devpriv-mode = APCI3120_DISABLE_EOC_INT; + devpriv-mode = ~APCI3120_ENABLE_EOC_INT; outb(devpriv-mode, dev-iobase + APCI3120_WRITE_MODE_SELECT); } @@ -1096,7 +1095,7 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, ~APCI3120_ENABLE_TIMER_COUNTER; /* Disable Eoc and Eos Interrupts */ - devpriv-mode = APCI3120_DISABLE_EOC_INT APCI3120_DISABLE_EOS_INT; + devpriv-mode = ~APCI3120_ENABLE_EOC_INT APCI3120_DISABLE_EOS_INT; outb(devpriv-mode, dev-iobase + APCI3120_WRITE_MODE_SELECT); if (data[0] == APCI3120_TIMER) {/* initialize timer */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 081/108] staging: comedi: addi_apci_3120: move DMA init code to apci3120_init_dma()
Move the common code used to initialize DMA to apci3120_init_dma(). This follows the programming procedure described in the APCI-3120 documentation. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 99 ++ 1 file changed, 27 insertions(+), 72 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 474b600..78d3597 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -193,11 +193,33 @@ static int apci3120_ai_cmdtest(struct comedi_device *dev, static void apci3120_init_dma(struct comedi_device *dev, struct apci3120_dmabuf *dmabuf) { + struct apci3120_private *devpriv = dev-private; + + /* AMCC - enable transfer count and reset A2P FIFO */ + outl(AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO, +devpriv-amcc + AMCC_OP_REG_AGCSTS); + + /* Add-On - enable transfer count and reset A2P FIFO */ + apci3120_addon_write(dev, AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO, +AMCC_OP_REG_AGCSTS); + + /* AMCC - enable transfers and reset A2P flags */ + outl(RESET_A2P_FLAGS | EN_A2P_TRANSFERS, +devpriv-amcc + AMCC_OP_REG_MCSR); + /* Add-On - DMA start address */ apci3120_addon_write(dev, dmabuf-hw, AMCC_OP_REG_AMWAR); /* Add-On - Number of acquisitions */ apci3120_addon_write(dev, dmabuf-use_size, AMCC_OP_REG_AMWTC); + + /* AMCC - enable write complete (DMA) and set FIFO advance */ + outl(APCI3120_FIFO_ADVANCE_ON_BYTE_2 | AINT_WRITE_COMPL, +devpriv-amcc + AMCC_OP_REG_INTCSR); + + /* Add-On - enable DMA */ + outw(APCI3120_ADDON_CTRL_AMWEN_ENA | APCI3120_ADDON_CTRL_A2P_FIFO_ENA, +devpriv-addon + APCI3120_ADDON_CTRL_REG); } static void apci3120_setup_dma(struct comedi_device *dev, @@ -248,35 +270,7 @@ static void apci3120_setup_dma(struct comedi_device *dev, dmabuf0-use_size = dmalen0; dmabuf1-use_size = dmalen1; - /* Initialize DMA */ - - /* AMCC- enable transfer count and reset A2P FIFO */ - outl(AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO, -devpriv-amcc + AMCC_OP_REG_AGCSTS); - - /* Add-On - enable transfer count and reset A2P FIFO */ - apci3120_addon_write(dev, AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO, -AMCC_OP_REG_AGCSTS); - - /* AMCC - enable transfers and reset A2P flags */ - outl(RESET_A2P_FLAGS | EN_A2P_TRANSFERS, -devpriv-amcc + AMCC_OP_REG_MCSR); - apci3120_init_dma(dev, dmabuf0); - - /* AMCC- reset A2P flags */ - outl(RESET_A2P_FLAGS, devpriv-amcc + AMCC_OP_REG_MCSR); - - /* AMCC - enable write complete (DMA) and set FIFO advance */ - outl(APCI3120_FIFO_ADVANCE_ON_BYTE_2 | AINT_WRITE_COMPL, -devpriv-amcc + AMCC_OP_REG_INTCSR); - - /* Add-On - enable DMA */ - outw(APCI3120_ADDON_CTRL_AMWEN_ENA | APCI3120_ADDON_CTRL_A2P_FIFO_ENA, -devpriv-addon + APCI3120_ADDON_CTRL_REG); - - /* AMCC- reset A2P flags */ - outl(RESET_A2P_FLAGS, devpriv-amcc + AMCC_OP_REG_MCSR); } static int apci3120_ai_cmd(struct comedi_device *dev, @@ -386,33 +380,16 @@ static void apci3120_interrupt_dma(int irq, void *d) return; } samplesinbuf = samplesinbuf 1; /* number of received samples */ + if (devpriv-b_DmaDoubleBuffer) { - /* switch DMA buffers if is used double buffering */ struct apci3120_dmabuf *next_dmabuf; next_dmabuf = devpriv-dmabuf[1 - devpriv-ui_DmaActualBuffer]; - /* AMCC - enable transfer count and reset A2P FIFO */ - outl(AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO, -devpriv-amcc + AMCC_OP_REG_AGCSTS); - - /* Add-On - enable transfer count and reset A2P FIFO */ - apci3120_addon_write(dev, -AGCSTS_TC_ENABLE | AGCSTS_RESET_A2P_FIFO, -AMCC_OP_REG_AGCSTS); - + /* start DMA on next buffer */ apci3120_init_dma(dev, next_dmabuf); - - /* Add-On - enable DMA */ - outw(APCI3120_ADDON_CTRL_AMWEN_ENA | -APCI3120_ADDON_CTRL_A2P_FIFO_ENA, -devpriv-addon + APCI3120_ADDON_CTRL_REG); - - /* AMCC - enable write complete (DMA) and set FIFO advance */ - outl(APCI3120_FIFO_ADVANCE_ON_BYTE_2 | AINT_WRITE_COMPL, -devpriv-amcc + AMCC_OP_REG_INTCSR); - } + if (samplesinbuf) { comedi_buf_write_samples(s,
[PATCH 085/108] staging: comedi: addi_apci_3120: rename private data 'b_DmaDoubleBuffer'
Rename this CamelCase member of the private data and convert it to a bit-field. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 4 ++-- drivers/staging/comedi/drivers/addi_apci_3120.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 8327e2c..0275506 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -360,7 +360,7 @@ static void apci3120_interrupt_dma(int irq, void *d) } samplesinbuf = samplesinbuf 1; /* number of received samples */ - if (devpriv-b_DmaDoubleBuffer) { + if (devpriv-use_double_buffer) { struct apci3120_dmabuf *next_dmabuf; next_dmabuf = devpriv-dmabuf[1 - devpriv-ui_DmaActualBuffer]; @@ -381,7 +381,7 @@ static void apci3120_interrupt_dma(int irq, void *d) return; } - if (devpriv-b_DmaDoubleBuffer) { + if (devpriv-use_double_buffer) { /* switch dma buffers for next interrupt */ devpriv-ui_DmaActualBuffer = 1 - devpriv-ui_DmaActualBuffer; } else { diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 00caa10..f768845 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -130,7 +130,7 @@ struct apci3120_private { unsigned long addon; unsigned int osc_base; unsigned int use_dma:1; - unsigned char b_DmaDoubleBuffer; + unsigned int use_double_buffer:1; unsigned int ui_DmaActualBuffer; struct apci3120_dmabuf dmabuf[2]; unsigned char do_bits; @@ -469,7 +469,7 @@ static void apci3120_dma_alloc(struct comedi_device *dev) if (i == 0) devpriv-use_dma = 1; if (i == 1) - devpriv-b_DmaDoubleBuffer = 1; + devpriv-use_double_buffer = 1; } } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 034/108] staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_TIMER_COUNTER
For aesthetics, remove this define and just use ~APCI3120_ENABLE_TIMER_COUNTER. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index f351b50..3eb53f1 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -115,7 +115,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY #define APCI3120_ENABLE_WATCHDOG 0x20 #define APCI3120_DISABLE_WATCHDOG (~APCI3120_ENABLE_WATCHDOG) #define APCI3120_ENABLE_TIMER_COUNTER 0x10 -#define APCI3120_DISABLE_TIMER_COUNTER (~APCI3120_ENABLE_TIMER_COUNTER) #define APCI3120_FC_TIMER 0x1000 #define APCI3120_TIMER2_SELECT_EOS 0xc0 @@ -1096,7 +1095,7 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, /* Disable TIMER Interrupt */ devpriv-mode = APCI3120_DISABLE_TIMER_INT -APCI3120_DISABLE_TIMER_COUNTER; +~APCI3120_ENABLE_TIMER_COUNTER; /* Disable Eoc and Eos Interrupts */ devpriv-mode = APCI3120_DISABLE_EOC_INT APCI3120_DISABLE_EOS_INT; @@ -1193,7 +1192,7 @@ static int apci3120_write_insn_timer(struct comedi_device *dev, case APCI3120_STOP: if (devpriv-b_Timer2Mode == APCI3120_TIMER) { /* Disable timer */ - devpriv-mode = APCI3120_DISABLE_TIMER_COUNTER; + devpriv-mode = ~APCI3120_ENABLE_TIMER_COUNTER; } else { /* Disable WatchDog */ devpriv-mode = APCI3120_DISABLE_WATCHDOG; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 052/108] staging: comedi: addi_apci_3120: remove private data 'ui_AiChannelList'
This member of the private data is no longer used. Remove it. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi_apci_3120.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 2eb7ab5..9ff6580 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -113,7 +113,6 @@ struct apci3120_private { unsigned long amcc; unsigned long addon; unsigned int osc_base; - unsigned int ui_AiChannelList[32]; unsigned short us_UseDma; unsigned char b_DmaDoubleBuffer; unsigned int ui_DmaActualBuffer; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 047/108] staging: comedi: addi_apci_3120: remove apci3120_ai_insn_config()
This function does not follow the comedi API for (*insn_config) functions. It's also no long needed. Just remove it. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 15 --- drivers/staging/comedi/drivers/addi_apci_3120.c | 1 - 2 files changed, 16 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 40ff942..5d15aca 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -104,21 +104,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY #define APCI3120_COUNTER 3 -static int apci3120_ai_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct apci3120_private *devpriv = dev-private; - - if (data[0] != APCI3120_EOC_MODE) - return -1; - - devpriv-b_InterruptMode = APCI3120_EOC_MODE; - - return insn-n; -} - static int apci3120_setup_chan_list(struct comedi_device *dev, struct comedi_subdevice *s, int n_chan, unsigned int *chanlist) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index e7564ad..572d545 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -381,7 +381,6 @@ static int apci3120_auto_attach(struct comedi_device *dev, s-n_chan = 16; s-maxdata = this_board-ai_is_16bit ? 0x : 0x0fff; s-range_table = apci3120_ai_range; - s-insn_config = apci3120_ai_insn_config; s-insn_read= apci3120_ai_insn_read; if (0 /* dev-irq */) { dev-read_subdev = s; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 008/108] staging: comedi: addi_apci_3120: rename private data 'b_TimerSelectMode'
Rename this CamelCase member of the private data and tidy up the mask/set of its bits. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 70 +- drivers/staging/comedi/drivers/addi_apci_3120.c| 2 +- 2 files changed, 28 insertions(+), 44 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index c9b416e..546c4c3 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -344,7 +344,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, ns = devpriv-ui_EocEosConversionTime; /* Clear software registers */ - devpriv-b_TimerSelectMode = 0; + devpriv-timer_mode = 0; devpriv-b_ModeSelectRegister = 0; devpriv-us_OutputRegister = 0; @@ -373,11 +373,9 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, return -EINVAL; /* Initialize Timer 0 mode 4 */ - devpriv-b_TimerSelectMode = - (devpriv- - b_TimerSelectMode 0xFC) | - APCI3120_TIMER_0_MODE_4; - outb(devpriv-b_TimerSelectMode, + devpriv-timer_mode = 0xfc; + devpriv-timer_mode |= APCI3120_TIMER_0_MODE_4; + outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); /* Reset the scan bit and Disables the EOS, DMA, EOC interrupt */ @@ -458,11 +456,9 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, return -EINVAL; /* Initialize Timer 0 mode 2 */ - devpriv-b_TimerSelectMode = - (devpriv- - b_TimerSelectMode 0xFC) | - APCI3120_TIMER_0_MODE_2; - outb(devpriv-b_TimerSelectMode, + devpriv-timer_mode = 0xfc; + devpriv-timer_mode |= APCI3120_TIMER_0_MODE_2; + outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); /* Set the conversion time */ @@ -720,7 +716,7 @@ static int apci3120_cyclic_ai(int mode, devpriv-ai_running = 1; /* clear software registers */ - devpriv-b_TimerSelectMode = 0; + devpriv-timer_mode = 0; devpriv-us_OutputRegister = 0; devpriv-b_ModeSelectRegister = 0; @@ -759,11 +755,9 @@ static int apci3120_cyclic_ai(int mode, switch (mode) { case 1: /* init timer0 in mode 2 */ - devpriv-b_TimerSelectMode = - (devpriv- - b_TimerSelectMode 0xFC) | APCI3120_TIMER_0_MODE_2; - outb(devpriv-b_TimerSelectMode, - dev-iobase + APCI3120_TIMER_CRT1); + devpriv-timer_mode = 0xfc; + devpriv-timer_mode |= APCI3120_TIMER_0_MODE_2; + outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); /* Set the conversion time */ apci3120_timer_write(dev, 0, divisor0); @@ -771,21 +765,17 @@ static int apci3120_cyclic_ai(int mode, case 2: /* init timer1 in mode 2 */ - devpriv-b_TimerSelectMode = - (devpriv- - b_TimerSelectMode 0xF3) | APCI3120_TIMER_1_MODE_2; - outb(devpriv-b_TimerSelectMode, - dev-iobase + APCI3120_TIMER_CRT1); + devpriv-timer_mode = 0xf3; + devpriv-timer_mode |= APCI3120_TIMER_1_MODE_2; + outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); /* Set the scan begin time */ apci3120_timer_write(dev, 1, divisor1); /* init timer0 in mode 2 */ - devpriv-b_TimerSelectMode = - (devpriv- - b_TimerSelectMode 0xFC) | APCI3120_TIMER_0_MODE_2; - outb(devpriv-b_TimerSelectMode, - dev-iobase + APCI3120_TIMER_CRT1); + devpriv-timer_mode = 0xfc; + devpriv-timer_mode |= APCI3120_TIMER_0_MODE_2; + outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); /* Set the conversion time */ apci3120_timer_write(dev, 0, divisor0); @@ -834,12 +824,10 @@ static int apci3120_cyclic_ai(int mode, dev-iobase + APCI3120_WRITE_MODE_SELECT); /* (1) Init
[PATCH 009/108] staging: comedi: addi_apci_3120: tidy up timer_mode masking
Define a macro that returns the mask of the timer_mode bits for a given timer. Use the macro to remove the magic values used to clear the bits. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- .../staging/comedi/drivers/addi-data/hwdrv_apci3120.c| 16 drivers/staging/comedi/drivers/addi_apci_3120.c | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index 546c4c3..a876ada 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -373,7 +373,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, return -EINVAL; /* Initialize Timer 0 mode 4 */ - devpriv-timer_mode = 0xfc; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(0); devpriv-timer_mode |= APCI3120_TIMER_0_MODE_4; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -456,7 +456,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, return -EINVAL; /* Initialize Timer 0 mode 2 */ - devpriv-timer_mode = 0xfc; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(0); devpriv-timer_mode |= APCI3120_TIMER_0_MODE_2; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -755,7 +755,7 @@ static int apci3120_cyclic_ai(int mode, switch (mode) { case 1: /* init timer0 in mode 2 */ - devpriv-timer_mode = 0xfc; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(0); devpriv-timer_mode |= APCI3120_TIMER_0_MODE_2; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -765,7 +765,7 @@ static int apci3120_cyclic_ai(int mode, case 2: /* init timer1 in mode 2 */ - devpriv-timer_mode = 0xf3; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(1); devpriv-timer_mode |= APCI3120_TIMER_1_MODE_2; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -773,7 +773,7 @@ static int apci3120_cyclic_ai(int mode, apci3120_timer_write(dev, 1, divisor1); /* init timer0 in mode 2 */ - devpriv-timer_mode = 0xfc; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(0); devpriv-timer_mode |= APCI3120_TIMER_0_MODE_2; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -824,7 +824,7 @@ static int apci3120_cyclic_ai(int mode, dev-iobase + APCI3120_WRITE_MODE_SELECT); /* (1) Init timer 2 in mode 0 and write timer value */ - devpriv-timer_mode = 0x0f; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(2); devpriv-timer_mode |= APCI3120_TIMER_2_MODE_0; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -1422,7 +1422,7 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, dev-iobase + APCI3120_WRITE_MODE_SELECT); if (data[0] == APCI3120_TIMER) {/* initialize timer */ /* Set the Timer 2 in mode 2(Timer) */ - devpriv-timer_mode = 0x0f; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(2); devpriv-timer_mode |= APCI3120_TIMER_2_MODE_2; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); @@ -1435,7 +1435,7 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, } else {/* Initialize Watch dog */ /* Set the Timer 2 in mode 5(Watchdog) */ - devpriv-timer_mode = 0x0f; + devpriv-timer_mode = ~APCI3120_TIMER_MODE_MASK(2); devpriv-timer_mode |= APCI3120_TIMER_2_MODE_5; outb(devpriv-timer_mode, dev-iobase + APCI3120_TIMER_CRT1); diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 6882f8e..999add3 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -20,6 +20,7 @@ #define APCI3120_AO_REG(x) (0x08 + (((x) / 4) * 2)) #define APCI3120_AO_MUX(x) (((x) 0x3) 14) #define APCI3120_AO_DATA(x)((x) 0) +#define APCI3120_TIMER_MODE_MASK(_t) (3 ((_t) * 2))
[PATCH 039/108] staging: comedi: addi_apci_3120: remove APCI3120_DISABLE_SCAN
This define is not used in the driver. Remove it. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index a71b70f..d2d0ef4 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -86,7 +86,6 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY /* nWrMode_Select */ #define APCI3120_ENABLE_SCAN 0x8 -#define APCI3120_DISABLE_SCAN (~APCI3120_ENABLE_SCAN) #define APCI3120_ENABLE_EOS_INT0x2 #define APCI3120_ENABLE_EOC_INT0x1 -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel