Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3aab15af authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 3f97df91
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -983,7 +983,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
	cx23885_i2c_register(&dev->i2c_bus[1]);
	cx23885_i2c_register(&dev->i2c_bus[2]);
	cx23885_card_setup(dev);
	call_all(dev, core, s_power, 0);
	call_all(dev, tuner, standby);
	cx23885_ir_init(dev);

	if (dev->board == CX23885_BOARD_VIEWCAST_460E) {
+2 −2
Original line number Diff line number Diff line
@@ -2568,8 +2568,8 @@ static int dvb_register(struct cx23885_tsport *port)
		fe1->dvb.frontend->ops.ts_bus_ctrl = cx23885_dvb_bus_ctrl;
#endif

	/* Put the analog decoder in standby to keep it quiet */
	call_all(dev, core, s_power, 0);
	/* Put the tuner in standby to keep it quiet */
	call_all(dev, tuner, standby);

	if (fe0->dvb.frontend->ops.analog_ops.standby)
		fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend);
+1 −1
Original line number Diff line number Diff line
@@ -3592,7 +3592,7 @@ static void cx88_card_setup(struct cx88_core *core)
			ctl.fname);
		call_all(core, tuner, s_config, &xc2028_cfg);
	}
	call_all(core, core, s_power, 0);
	call_all(core, tuner, standby);
}

/* ------------------------------------------------------------------ */
+2 −2
Original line number Diff line number Diff line
@@ -1631,8 +1631,8 @@ static int dvb_register(struct cx8802_dev *dev)
	if (fe1)
		fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;

	/* Put the analog decoder in standby to keep it quiet */
	call_all(core, core, s_power, 0);
	/* Put the tuner in standby to keep it quiet */
	call_all(core, tuner, standby);

	/* register everything */
	res = vb2_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
+1 −1
Original line number Diff line number Diff line
@@ -1200,7 +1200,7 @@ static int video_release(struct file *file)
	saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0);
	saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);

	saa_call_all(dev, core, s_power, 0);
	saa_call_all(dev, tuner, standby);
	if (vdev->vfl_type == VFL_TYPE_RADIO)
		saa_call_all(dev, core, ioctl, SAA6588_CMD_CLOSE, &cmd);
	mutex_unlock(&dev->lock);
Loading