This legacy driver does no additional probing so the dev->board_name
will already be properly initialized by the comedi core before calling
the (*attach) function.
Remove the unnecessary initialization of dev->board_name and use it
when requesting the resources instead of the open-coded strings.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Introduce a helper function to handle the request_region() for legacy
comedi drivers.
As pointed out by Ian Abbott, legacy devices are configured manually
with the "comedi_config" program. The error messages are useful
diagnostics when trying to attach to these boards.
Providing a helper function allows consolidating the error messages
in the drivers and providing a consistent format for the errors.
This helper also sets the dev->iobase automatically for the driver
if the request_region() is successful.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This adds a config option USB_DWC2_DEBUG_PERIODIC that allows debugging
output be suppressed for periodic transfers. This helps when debugging
non-periodic transfers while there are also periodic transfers going on
(both to make the debug output less polluted and to prevent all CPU time
going to debug messages).
In addition, a debug message from dwc2_hcd_is_status_changed is removed
entirely, since it often floods the log regardless of periodic
transfers.
This driver is the only file that includes the am9513.h header and
nothing from that header is actually used. Using the macros provided
by am9513.h is a bit ugly due to having to predefine a number of
additional macros to handle the low-level I/O to the Am9513 device.
Just remove the header and the unused I/O helpers in the rti800
driver. If support for the am9513 is added later it wil be implemented
properly at that time.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: rti800: change return of rti800_ai_insn_read()
The comedi core expects the (*insn_read) functions to return the
number of data values actually read. Change the return from 'i'
to 'insn->n' to make this clearer.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: rti800: tidy up ai two's complement support
The analog input on this board can return data as either two's
complement or straight binary data. The format is selected by a
jumper of the board and enabled by the user as option[4] when
attaching to the board.
Replace the adc_coding enum with a simple bool to indicate that
the data is returned in two's complement form.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: rti800: tidy up CR_{CHAN,RANGE} usage
The insn->chanspec passed to the CR_{CHAN,RANGE} macros is an unsigned
int. For aesthetic reasons, put the result of the macros into an
unsigned int local var.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This board has two independent analog output channels. Each channel
has its own 12-bit D.A converter. Each channel can be set to output
a unipolar 10V or bipolar 10V signal. This selection is handled by
a jumper on the board and configured by the user with options[5] and
[7] passed during the attach of the board.
The two channels can also be configured with jumpers to use straight
binary or two's complement data. The user configures the data type
with options[6] and [8] when attaching.
Currently, this driver uses the dac0 selection, option[6], for both
channels. Fix the rti800_ao_insn_write() function to properly use
the configuration specified by the user.
Change the dac[01]_coding in the private data to a simple bool
array, dac_2comp.
Add some local vars to hold the registers offsets needed to write
to the DAC.
Only the last value written to the DAC needs to be cached for readback,
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: rti800: use arrays to hold the ai/ao ranges
The analog in/analog out ranges are selected by the user using options
passed during the legacy attach. Put the valid ranges into arrays and
use those instead of the switch () statements when initializing the
subdevice range information.
If the passed user option is not valid, set the range information to
range_unknown.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, move the boardinfo table near the struct
definition. Reformat the boardinfo in C99 format and add some
whitespace to help readability.
Rename the boardinfotable so it has namespace associated with
the driver.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: acl7225b: dev->irq is already '0'
This driver does not use interrupts and the dev->irq variable is
already set to '0' when then (*attach) function is called. Setting
it in the driver is unnecessary.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
For aesthetic reasons, move the boardinfo table near the struct
definition. Remove the unnecessary comments in the struct definition.
Reformat the boardinfo in C99 format and add some whitespace to
help readability.
Rename the boardinfo struct and the boardinfo table so they have
namespace associated with the driver.
Remove the ACL7225_SIZE and P16R16DIO_SIZE defines. They are only
used in the boardinfo table and the open-coded values provide the
information more clearly.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Philipp Zabel [Mon, 8 Apr 2013 16:04:38 +0000 (18:04 +0200)]
staging: drm/imx: Add support for Television Encoder (TVEv2)
This driver adds support for the Television Encoder integrated
on i.MX53 SoCs (TVEv2).
Currently only the VGA output mode is supported, which only uses
the TVDAC to generate RGB levels. HSYNC and VSYNC signals are
routed directly from the IPU signal generator pins through IOMUXC.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Philipp Zabel [Mon, 8 Apr 2013 16:04:35 +0000 (18:04 +0200)]
staging: drm/imx: Add support for VGA via TVE on i.MX53
This adds display interface timings for the Television Encoder
connected to IPU DI1 on i.MX53 and adds some configuration
glue code to select which IPU signal generators / pins are to
be used for HSYNC/VSYNC signals.
The default configuration is pin2/pin3 for hsync/vsync. The
VGA connector on i.MX53-QSB uses pin7/pin8, and the analog
part of the DVI-I connector on MBa53 connects to pin4/pin6.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The dev->board_name is now initialized by the comedi core before calling
the(*attach) or (*auto_attach) function in a driver. As long as the driver
does no additional probing, it's no longer necessary initialize the board_name.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: comedi_pci: dev->board_name is always valid
The dev->board_name is always initialized before calling the(*attach)
or (*auto_attach) function. It's no longer necessary to validate the
pointer in comedi_pci_enable().
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: drivers: dev->board_name is always valid
The dev->board_name is always initialized before calling the(*attach)
or (*auto_attach) function. The "BUG" check in comedi_device_postconfig()
is no longer necessary.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: drivers: set dev->board_name before attaching
The comedi (*attach) and (*auto_attach) functions are used to attach
legacy and PnP type devices to the comedi subsystem. If we can set the
dev->board_name before doing the attach, the drivers will not have to
worry about doing it.
Drivers that do additional probing can still change the dev->board_name
if necessary.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: drivers: rename 'comedi_dev' in comedi_auto_config()
The struct comedi_device pointer in this file, and the rest of the
comedi subsystem, is typically called 'dev'. Rename the local variable
'comedi_dev' in comedi_auto_config() for consistency.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
While removing, the device needs to unregister
the sensor from thermal framework. Before
calling the call back the driver needs to check
if the call back is registered. This patch
fix the check by checking the right callback.
staging: ti-soc-thermal: defer probe if cpufreq is not ready
When builtin compiled, there is a chance for this driver
be probed before cpufreq driver is up and running. In this
case, the cpucooling device can be wrong initialized.
Thus, this patch makes sure this driver is probed only
when cpufreq driver is ready. Whenever there is no
cpufreq driver registered, the probe will return -EPROBE_DEFER.
This patch removes out of the TODO list those already completed.
Here is the status and why they are removed:
on ti-bandgap.c:
-- Add support to hwmon: REMOVED, no need to have hwmon interfaces as
the control is done via thermal framework.
-- Test every exposed API to userland: DONE, via thermal fw APIs
By now, no specific API is exposed by this driver
-- Revisit data structures and simplify them: DONE, all
unused fields are flagged for future removal.
-- Once SCM-core api settles, update this driver accordingly: DONE,
the BG driver can exist without SCM driver by ioremapping its own
registers and doing its own locking.
on ti-thermal-common.c/ti-thermal.h:
-- Revisit trips and its definitions: DONE, for now there is no
need to change current definition. Alert based policy will be add
in future.
-- Revisit trending: DONE, OMAP5 history buffer support has been
implemented. Devices without history buffer will use thermal fw
trending capability.
on omap5-thermal.c
-- Add support for GPU cooling: REMOVED: this will not be part
of this driver. Must be done in a separated cooling device.
generally:
-- make checkpatch.pl and sparse happy: DONE, sparse remaining
warning is not an issue.
-- update documentation: DONE, kernel-doc for ti-bandgap is now
available.
Chen Gang [Sun, 7 Apr 2013 10:01:48 +0000 (18:01 +0800)]
Drivers: Staging: cxt1e1: strncpy issue, need set zero at the end.
need set '\0' at the end. or cause issue.
it is called by c4_ioctl in drivers/staging/cxt1e1/linux.c
all things need be initialized, before provide them to user mode.
so we can not use strlcpy instead of strncpy.
code style:
all contents of the file use 4 spaces instead of '\t',
so this patch has to follow, now.
Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: comedi: serial2002: fix different address space sparse warnings
The struct file_operations (*read) and (*write) operations expect the
buffer to be a __user space pointer.
Currently the (*write) operations in this driver cause this warning:
warning: incorrect type in argument 2 (different address spaces)
expected char const [noderef] <asn:1>*<noident>
got unsigned char [usertype] *buf
And the (*read) operations cause this warning:
warning: incorrect type in argument 2 (different address spaces)
expected char [noderef] <asn:1>*<noident>
got unsigned char *<noident>
Use __force to cast the buffer to a __user pointer to suppress the
warnings.
Consolidate the (*read) calls into a helper function, __tty_readb().
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 4 Apr 2013 13:59:18 +0000 (14:59 +0100)]
staging: comedi: add comedi_clear_board_dev()
Add local function `comedi_clear_board_dev()` as a safer alternative to
`comedi_clear_board_minor()` when we already have a pointer to a `struct
comedi_device`. It uses the board minor device number stored in the
`struct comedi_device` (which must have already been initialized) and
only clears the entry in `comedi_board_minor_table[]` if it points to
the specified `struct comedi_device`. Rather than returning the old
table entry, it returns `true` if the entry matched (and so has just
been cleared) and returns `false` otherwise.
Call `comedi_clear_board_dev()` instead of `comedi_clear_board_minor()`
in `comedi_unlocked_ioctl()` (in the code that frees a dynamically
allocated comedi device detached by the `COMEDI_DEVCONFIG` ioctl). That
ought to return `true` but check it just in case before freeing the
device. There is still a race condition here which needs to be dealt
with once we've implemented reference counting for `struct
comedi_device`s.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
`comedi_alloc_board_minor()` allocates and initializes a `struct
comedi_file_info` and a `struct comedi_device`, and assigns a board
minor device number (if there are any available), storing a pointer to
the allocated `struct comedi_file_info` in
`comedi_board_minor_table[minor]` where `minor` is the board minor
device number.
There is no longer anything useful in the `struct comedi_file_info`
apart from the pointer to the `struct comedi_device` that was allocated,
so the `struct comedi_file_info` is superfluous.
Change `comedi_board_minor_table[]` to hold pointers to the actual
`struct comedi_device`'s. `comedi_alloc_board_minor()` no longer needs
to allocate a `struct comedi_file_info`. Replace
`comedi_free_board_file_info()` with `comedi_free_board_dev()` with its
parameter pointing to the `struct comedi_device` to be freed (there is
no longer a `struct comedi_file_info` to be freed).
There are consequential changes to `comedi_dev_from_board_minor()`,
`comedi_clear_board_minor()` (which now returns a `struct comedi_device
*`), `comedi_free_board_minor()`, `comedi_release_hardware_device()` and
`comedi_unlocked_ioctl()` (when dealing with detachment of a dynamically
allocated comedi device by the `COMEDI_DEVCONFIG` ioctl).
`comedi_dev_from_file_info()` is no longer used as a result of the above
changes so remove it.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
`comedi_alloc_subdevice_minor()` allocates and initializes a `struct
comedi_file_info` and assigns a subdevice minor device number (if there
are any available), storing a pointer to the allocated `struct
comedi_file_info` in `comedi_subdevice_minor_table[i]` where `i` is the
array index corresponding to the subdevice minor device number (indexed
by subdevice minor device number minus `COMEDI_NUM_BOARD_MINORS`).
The information stored in the `struct comedi_file_info` can be derived
from the subdevice structure (`struct comedi_subdevice`) itself, so the
`struct comedi_file_info` is superfluous.
Change `comedi_subdevice_minor_table[]` to hold pointers to the actual
`struct comedi_subdevice`'s. `comedi_alloc_subdevice_minor()` no longer
needs to allocate a `struct comedi_file_info` and
`comedi_free_subdevice_info()` no longer has a `struct comedi_file_info`
to free.
Replace `comedi_file_info_from_minor()` with
`comedi_subdevice_from_minor()`, returning a (possibly NULL) pointer to
a `struct comedi_subdevice` from the table. This has knock-on effects
for `comedi_dev_from_subdevice_minor()`, `comedi_read_subdevice()` and
`comedi_write_subdevice()`. In particular, `comedi_read_subdevice()`
and `comedi_write_subdevice()` now need to check the subdevice flags to
see if the determine whether to override the comedi device's default
read/write subdevice.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 4 Apr 2013 13:59:12 +0000 (14:59 +0100)]
staging: comedi: refactor comedi_dev_from_minor()
Refactor `comedi_dev_from_minor()` to call one of two new functions
`comedi_dev_from_board_minor()` (for minor device numbers less than
`COMEDI_NUM_BOARD_MINORS`) or `comedi_dev_from_subdevice_minor()` (for
minor device numbers greater than or equal to `COMEDI_NUM_BOARD_MINORS`,
which are subdevice minor device numbers).
Remove `comedi_file_info_from_minor()` as it is no longer used.
This is a step towards removing `struct comedi_file_info`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 4 Apr 2013 13:59:11 +0000 (14:59 +0100)]
staging: comedi: reduce use of struct comedi_file_info
Since the parameters of `comedi_read_subdevice()` and
`comedi_write_subdevice()` have changed, there is no longer a need to
keep a local variable `struct comedi_file_info *info` hanging around in
the file operation functions and device attribute access functions.
Remove the variable from those function and replace the call sequence
`info = comedi_file_info_from_minor(minor)`, `dev =
comedi_dev_from_file_info(info)` with the simpler `dev =
comedi_dev_from_minor(minor)`.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
`comedi_read_subdevice()` and `comedi_write_subdevice()` currently take
a single parameter pointing to a `struct comedi_file_info`. I'm trying
to get rid of `struct comedi_file_info` so as part of that plan,
`comedi_read_subdevice()` and `comedi_write_subdevice()` need to change.
Change them to take two parameters: a pointer to a `struct
comedi_device` and a minor device number. If the minor device number is
a "board" minor device number (`minor < COMEDI_NUM_BOARD_MINORS`) we'll
always return the default read or write subdevice. If the minor device
number if a "subdevice" minor device number a different read or write
subdevice may be returned. In that case, use the subdevice minor device
number to look up the information about whether the default read or
write subdevice needs to be overridden.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ian Abbott [Thu, 4 Apr 2013 13:59:09 +0000 (14:59 +0100)]
staging: comedi: use minor device number in attribute functions
The comedi device attribute functions such as
`show_max_read_buffer_kb()` call `dev_get_drvdata()` to get a pointer to
a `struct comedi_file_info` from the private driver data field of class
device. Change them to use the minor device number to look up this
pointer value so they behave more like the file operation functions.
Check the pointer is non-NULL as the entry in the minor device table
could have been set to NULL. Note that there is still a race condition
in the use of this pointer value after acquiring the mutex which needs
to be dealt with once reference counting has been implemented for comedi
devices.
The calls to `dev_set_drvdata()` from `comedi_alloc_board_minor()` and
`comedi_alloc_subdevice_minor()` are no longer needed so remove them.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>