summaryrefslogtreecommitdiffstats
path: root/drivers/media/tuners
diff options
context:
space:
mode:
authorHans Verkuil2018-02-21 08:49:25 +0100
committerMauro Carvalho Chehab2018-03-21 17:05:39 +0100
commit3aab15af9ad8fa8dc0399cb4b679d7cb85c20a56 (patch)
treeacd07cf67ae4ab9c752774d71a55489974359974 /drivers/media/tuners
parentmedia: vb2-core: vb2_ops: document non-interrupt-context calling (diff)
downloadkernel-qcow2-linux-3aab15af9ad8fa8dc0399cb4b679d7cb85c20a56.tar.gz
kernel-qcow2-linux-3aab15af9ad8fa8dc0399cb4b679d7cb85c20a56.tar.xz
kernel-qcow2-linux-3aab15af9ad8fa8dc0399cb4b679d7cb85c20a56.zip
media: add tuner standby op, use where needed
The v4l2_subdev core s_power op was used for two different things: power on/off sensors or video decoders/encoders and to put a tuner in standby (and only the tuner!). There is no 'tuner wakeup' op, that's done automatically when the tuner is accessed. The danger with calling (s_power, 0) to put a tuner into standby is that it is usually broadcast for all subdevs. So a video receiver subdev that supports s_power will also be powered off, and since there is no corresponding (s_power, 1) they will never be powered on again. In addition, this is specifically meant for tuners only since they draw the most current. This patch adds a new tuner op called 'standby' and replaces all calls to (core, s_power, 0) by (tuner, standby). This prevents confusion between the two uses of s_power. Note that there is no overlap: bridge drivers either just want to put the tuner into standby, or they deal with powering on/off sensors. Never both. This also makes it easier to replace s_power for the remaining bridge drivers with some PM code later. Whether we want something cleaner for tuners in the future is a separate topic. There is a lot of legacy code surrounding tuners, and I am very hesitant about making changes there. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/tuners')
-rw-r--r--drivers/media/tuners/e4000.c16
-rw-r--r--drivers/media/tuners/fc2580.c16
-rw-r--r--drivers/media/tuners/msi001.c19
3 files changed, 9 insertions, 42 deletions
diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c
index 564a000f503e..b5b9d87ba75c 100644
--- a/drivers/media/tuners/e4000.c
+++ b/drivers/media/tuners/e4000.c
@@ -293,28 +293,18 @@ static inline struct e4000_dev *e4000_subdev_to_dev(struct v4l2_subdev *sd)
return container_of(sd, struct e4000_dev, sd);
}
-static int e4000_s_power(struct v4l2_subdev *sd, int on)
+static int e4000_standby(struct v4l2_subdev *sd)
{
struct e4000_dev *dev = e4000_subdev_to_dev(sd);
- struct i2c_client *client = dev->client;
int ret;
- dev_dbg(&client->dev, "on=%d\n", on);
-
- if (on)
- ret = e4000_init(dev);
- else
- ret = e4000_sleep(dev);
+ ret = e4000_sleep(dev);
if (ret)
return ret;
return e4000_set_params(dev);
}
-static const struct v4l2_subdev_core_ops e4000_subdev_core_ops = {
- .s_power = e4000_s_power,
-};
-
static int e4000_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v)
{
struct e4000_dev *dev = e4000_subdev_to_dev(sd);
@@ -382,6 +372,7 @@ static int e4000_enum_freq_bands(struct v4l2_subdev *sd,
}
static const struct v4l2_subdev_tuner_ops e4000_subdev_tuner_ops = {
+ .standby = e4000_standby,
.g_tuner = e4000_g_tuner,
.s_tuner = e4000_s_tuner,
.g_frequency = e4000_g_frequency,
@@ -390,7 +381,6 @@ static const struct v4l2_subdev_tuner_ops e4000_subdev_tuner_ops = {
};
static const struct v4l2_subdev_ops e4000_subdev_ops = {
- .core = &e4000_subdev_core_ops,
.tuner = &e4000_subdev_tuner_ops,
};
diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c
index f4d4665de168..743184ae0d26 100644
--- a/drivers/media/tuners/fc2580.c
+++ b/drivers/media/tuners/fc2580.c
@@ -386,28 +386,18 @@ static inline struct fc2580_dev *fc2580_subdev_to_dev(struct v4l2_subdev *sd)
return container_of(sd, struct fc2580_dev, subdev);
}
-static int fc2580_s_power(struct v4l2_subdev *sd, int on)
+static int fc2580_standby(struct v4l2_subdev *sd)
{
struct fc2580_dev *dev = fc2580_subdev_to_dev(sd);
- struct i2c_client *client = dev->client;
int ret;
- dev_dbg(&client->dev, "on=%d\n", on);
-
- if (on)
- ret = fc2580_init(dev);
- else
- ret = fc2580_sleep(dev);
+ ret = fc2580_sleep(dev);
if (ret)
return ret;
return fc2580_set_params(dev);
}
-static const struct v4l2_subdev_core_ops fc2580_subdev_core_ops = {
- .s_power = fc2580_s_power,
-};
-
static int fc2580_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v)
{
struct fc2580_dev *dev = fc2580_subdev_to_dev(sd);
@@ -475,6 +465,7 @@ static int fc2580_enum_freq_bands(struct v4l2_subdev *sd,
}
static const struct v4l2_subdev_tuner_ops fc2580_subdev_tuner_ops = {
+ .standby = fc2580_standby,
.g_tuner = fc2580_g_tuner,
.s_tuner = fc2580_s_tuner,
.g_frequency = fc2580_g_frequency,
@@ -483,7 +474,6 @@ static const struct v4l2_subdev_tuner_ops fc2580_subdev_tuner_ops = {
};
static const struct v4l2_subdev_ops fc2580_subdev_ops = {
- .core = &fc2580_subdev_core_ops,
.tuner = &fc2580_subdev_tuner_ops,
};
diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c
index 3a12ef35682b..5de6ed728708 100644
--- a/drivers/media/tuners/msi001.c
+++ b/drivers/media/tuners/msi001.c
@@ -291,26 +291,13 @@ err:
return ret;
}
-static int msi001_s_power(struct v4l2_subdev *sd, int on)
+static int msi001_standby(struct v4l2_subdev *sd)
{
struct msi001_dev *dev = sd_to_msi001_dev(sd);
- struct spi_device *spi = dev->spi;
- int ret;
-
- dev_dbg(&spi->dev, "on=%d\n", on);
-
- if (on)
- ret = 0;
- else
- ret = msi001_wreg(dev, 0x000000);
- return ret;
+ return msi001_wreg(dev, 0x000000);
}
-static const struct v4l2_subdev_core_ops msi001_core_ops = {
- .s_power = msi001_s_power,
-};
-
static int msi001_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *v)
{
struct msi001_dev *dev = sd_to_msi001_dev(sd);
@@ -386,6 +373,7 @@ static int msi001_enum_freq_bands(struct v4l2_subdev *sd,
}
static const struct v4l2_subdev_tuner_ops msi001_tuner_ops = {
+ .standby = msi001_standby,
.g_tuner = msi001_g_tuner,
.s_tuner = msi001_s_tuner,
.g_frequency = msi001_g_frequency,
@@ -394,7 +382,6 @@ static const struct v4l2_subdev_tuner_ops msi001_tuner_ops = {
};
static const struct v4l2_subdev_ops msi001_ops = {
- .core = &msi001_core_ops,
.tuner = &msi001_tuner_ops,
};