Commit 96a9319f authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: amplc_dio200: pass device to clock/gate config

Rename the clock and gate configuration functions for the '8254' counter
subdevices and pass in the pointers to the comedi device and comedi
subdevice.  This is just preparing the way for later changes.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dba949a1
...@@ -953,9 +953,12 @@ dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -953,9 +953,12 @@ dio200_subdev_8254_write(struct comedi_device *dev, struct comedi_subdevice *s,
* Set gate source for an '8254' counter subdevice channel. * Set gate source for an '8254' counter subdevice channel.
*/ */
static int static int
dio200_set_gate_src(struct dio200_subdev_8254 *subpriv, dio200_subdev_8254_set_gate_src(struct comedi_device *dev,
unsigned int counter_number, unsigned int gate_src) struct comedi_subdevice *s,
unsigned int counter_number,
unsigned int gate_src)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
unsigned char byte; unsigned char byte;
if (!subpriv->has_clk_gat_sce) if (!subpriv->has_clk_gat_sce)
...@@ -976,9 +979,12 @@ dio200_set_gate_src(struct dio200_subdev_8254 *subpriv, ...@@ -976,9 +979,12 @@ dio200_set_gate_src(struct dio200_subdev_8254 *subpriv,
* Get gate source for an '8254' counter subdevice channel. * Get gate source for an '8254' counter subdevice channel.
*/ */
static int static int
dio200_get_gate_src(struct dio200_subdev_8254 *subpriv, dio200_subdev_8254_get_gate_src(struct comedi_device *dev,
struct comedi_subdevice *s,
unsigned int counter_number) unsigned int counter_number)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
if (!subpriv->has_clk_gat_sce) if (!subpriv->has_clk_gat_sce)
return -1; return -1;
if (counter_number > 2) if (counter_number > 2)
...@@ -991,9 +997,12 @@ dio200_get_gate_src(struct dio200_subdev_8254 *subpriv, ...@@ -991,9 +997,12 @@ dio200_get_gate_src(struct dio200_subdev_8254 *subpriv,
* Set clock source for an '8254' counter subdevice channel. * Set clock source for an '8254' counter subdevice channel.
*/ */
static int static int
dio200_set_clock_src(struct dio200_subdev_8254 *subpriv, dio200_subdev_8254_set_clock_src(struct comedi_device *dev,
unsigned int counter_number, unsigned int clock_src) struct comedi_subdevice *s,
unsigned int counter_number,
unsigned int clock_src)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
unsigned char byte; unsigned char byte;
if (!subpriv->has_clk_gat_sce) if (!subpriv->has_clk_gat_sce)
...@@ -1014,9 +1023,12 @@ dio200_set_clock_src(struct dio200_subdev_8254 *subpriv, ...@@ -1014,9 +1023,12 @@ dio200_set_clock_src(struct dio200_subdev_8254 *subpriv,
* Get clock source for an '8254' counter subdevice channel. * Get clock source for an '8254' counter subdevice channel.
*/ */
static int static int
dio200_get_clock_src(struct dio200_subdev_8254 *subpriv, dio200_subdev_8254_get_clock_src(struct comedi_device *dev,
unsigned int counter_number, unsigned int *period_ns) struct comedi_subdevice *s,
unsigned int counter_number,
unsigned int *period_ns)
{ {
struct dio200_subdev_8254 *subpriv = s->private;
unsigned clock_src; unsigned clock_src;
if (!subpriv->has_clk_gat_sce) if (!subpriv->has_clk_gat_sce)
...@@ -1052,12 +1064,12 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1052,12 +1064,12 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s,
data[1] = i8254_status(subpriv->iobase, 0, chan); data[1] = i8254_status(subpriv->iobase, 0, chan);
break; break;
case INSN_CONFIG_SET_GATE_SRC: case INSN_CONFIG_SET_GATE_SRC:
ret = dio200_set_gate_src(subpriv, chan, data[2]); ret = dio200_subdev_8254_set_gate_src(dev, s, chan, data[2]);
if (ret < 0) if (ret < 0)
ret = -EINVAL; ret = -EINVAL;
break; break;
case INSN_CONFIG_GET_GATE_SRC: case INSN_CONFIG_GET_GATE_SRC:
ret = dio200_get_gate_src(subpriv, chan); ret = dio200_subdev_8254_get_gate_src(dev, s, chan);
if (ret < 0) { if (ret < 0) {
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -1065,12 +1077,12 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1065,12 +1077,12 @@ dio200_subdev_8254_config(struct comedi_device *dev, struct comedi_subdevice *s,
data[2] = ret; data[2] = ret;
break; break;
case INSN_CONFIG_SET_CLOCK_SRC: case INSN_CONFIG_SET_CLOCK_SRC:
ret = dio200_set_clock_src(subpriv, chan, data[1]); ret = dio200_subdev_8254_set_clock_src(dev, s, chan, data[1]);
if (ret < 0) if (ret < 0)
ret = -EINVAL; ret = -EINVAL;
break; break;
case INSN_CONFIG_GET_CLOCK_SRC: case INSN_CONFIG_GET_CLOCK_SRC:
ret = dio200_get_clock_src(subpriv, chan, &data[2]); ret = dio200_subdev_8254_get_clock_src(dev, s, chan, &data[2]);
if (ret < 0) { if (ret < 0) {
ret = -EINVAL; ret = -EINVAL;
break; break;
...@@ -1133,9 +1145,9 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s, ...@@ -1133,9 +1145,9 @@ dio200_subdev_8254_init(struct comedi_device *dev, struct comedi_subdevice *s,
I8254_MODE0 | I8254_BINARY); I8254_MODE0 | I8254_BINARY);
if (subpriv->has_clk_gat_sce) { if (subpriv->has_clk_gat_sce) {
/* Gate source 0 is VCC (logic 1). */ /* Gate source 0 is VCC (logic 1). */
dio200_set_gate_src(subpriv, chan, 0); dio200_subdev_8254_set_gate_src(dev, s, chan, 0);
/* Clock source 0 is the dedicated clock input. */ /* Clock source 0 is the dedicated clock input. */
dio200_set_clock_src(subpriv, chan, 0); dio200_subdev_8254_set_clock_src(dev, s, chan, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment