summaryrefslogtreecommitdiff
path: root/drivers/misc/gdsys_rxaui_ctrl.c
diff options
context:
space:
mode:
authorMario Six <mario.six@gdsys.cc>2019-01-28 09:47:41 +0100
committerMario Six <mario.six@gdsys.cc>2019-05-21 07:52:34 +0200
commitca0eab2dcfe5e742a2e663dc10829679879f7b98 (patch)
tree7d758f2fb3fae6607deb6ff720d985e51ad511fc /drivers/misc/gdsys_rxaui_ctrl.c
parent482c76e7c386da683e2fc5b6f939fc8d80a0f186 (diff)
gdsys_rxaui_ctrl: Return old state
Make the gdsys_rxaui_ctrl polarity setting function return the old state to comply with the API requirements. Signed-off-by: Mario Six <mario.six@gdsys.cc>
Diffstat (limited to 'drivers/misc/gdsys_rxaui_ctrl.c')
-rw-r--r--drivers/misc/gdsys_rxaui_ctrl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/misc/gdsys_rxaui_ctrl.c b/drivers/misc/gdsys_rxaui_ctrl.c
index 9a63c329bc..f2c955b13d 100644
--- a/drivers/misc/gdsys_rxaui_ctrl.c
+++ b/drivers/misc/gdsys_rxaui_ctrl.c
@@ -29,6 +29,7 @@ struct gdsys_rxaui_ctrl_regs {
struct gdsys_rxaui_ctrl_priv {
struct regmap *map;
+ bool state;
};
int gdsys_rxaui_set_polarity_inversion(struct udevice *dev, bool val)
@@ -36,6 +37,8 @@ int gdsys_rxaui_set_polarity_inversion(struct udevice *dev, bool val)
struct gdsys_rxaui_ctrl_priv *priv = dev_get_priv(dev);
u16 state;
+ priv->state = !priv->state;
+
rxaui_ctrl_get(priv->map, ctrl_1, &state);
if (val)
@@ -45,7 +48,7 @@ int gdsys_rxaui_set_polarity_inversion(struct udevice *dev, bool val)
rxaui_ctrl_set(priv->map, ctrl_1, state);
- return 0;
+ return !priv->state;
}
static const struct misc_ops gdsys_rxaui_ctrl_ops = {
@@ -58,6 +61,8 @@ int gdsys_rxaui_ctrl_probe(struct udevice *dev)
regmap_init_mem(dev, &priv->map);
+ priv->state = false;
+
return 0;
}