V4L/DVB (13238): v4l2_subdev: rename tuner s_standby operation to core s_power
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 5 Oct 2009 13:48:17 +0000 (10:48 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 5 Dec 2009 20:41:03 +0000 (18:41 -0200)
Upcoming I2C v4l2_subdev drivers need a way to control the subdevice
power state from the core. This use case is already partially covered by
the tuner s_standby operation, but no way to explicitly come back from
the standby state is available.

Rename the tuner s_standby operation to core s_power, and fix tuner
drivers accordingly. The tuner core will call s_power(0) instead of
s_standby(). No explicit call to s_power(1) is required for tuners as
they are supposed to wake up from standby automatically.

[mchehab@redhat.com: CodingStyle fix]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
13 files changed:
drivers/media/video/au0828/au0828-video.c
drivers/media/video/cx231xx/cx231xx-video.c
drivers/media/video/cx23885/cx23885-core.c
drivers/media/video/cx23885/cx23885-dvb.c
drivers/media/video/cx88/cx88-cards.c
drivers/media/video/cx88/cx88-dvb.c
drivers/media/video/cx88/cx88-video.c
drivers/media/video/em28xx/em28xx-cards.c
drivers/media/video/em28xx/em28xx-video.c
drivers/media/video/saa7134/saa7134-core.c
drivers/media/video/saa7134/saa7134-video.c
drivers/media/video/tuner-core.c
include/media/v4l2-subdev.h

index 51527d7b55a757124e546fa4842efbac67c48688..1485aee18d582c708c0c60b0579581bdbed2d3b1 100644 (file)
@@ -830,7 +830,7 @@ static int au0828_v4l2_close(struct file *filp)
                au0828_uninit_isoc(dev);
 
                /* Save some power by putting tuner to sleep */
-               v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_standby);
+               v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
 
                /* When close the device, set the usb intf0 into alt0 to free
                   USB bandwidth */
index 36503725d9735b064399ba25e5aa0bddab04b994..d095aa0d6d19f517cbeb3c4716d8b40438544d3a 100644 (file)
@@ -2106,7 +2106,7 @@ static int cx231xx_v4l2_close(struct file *filp)
                }
 
                /* Save some power by putting tuner to sleep */
-               call_all(dev, tuner, s_standby);
+               call_all(dev, core, s_power, 0);
 
                /* do this before setting alternate! */
                cx231xx_uninit_isoc(dev);
index d6e41db500ef9617b97c6af90ea21086eec577b1..e34a4ec4a2cdbcbd834cfc07b39af22da4736939 100644 (file)
@@ -919,7 +919,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, tuner, s_standby);
+       call_all(dev, core, s_power, 0);
        cx23885_ir_init(dev);
 
        if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) {
index 4d439f2c4abc4c1afc06157b0243b4f47316e5a7..f4f046cd81a5354df9d78e73e3bd100dd52a0b72 100644 (file)
@@ -920,7 +920,7 @@ static int dvb_register(struct cx23885_tsport *port)
        fe0->dvb.frontend->callback = cx23885_tuner_callback;
 
        /* Put the analog decoder in standby to keep it quiet */
-       call_all(dev, tuner, s_standby);
+       call_all(dev, core, s_power, 0);
 
        if (fe0->dvb.frontend->ops.analog_ops.standby)
                fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend);
index 33be6369871a67a10449d2b8a5d4e56cfcc4de1b..7330a2d704399adac3f08c387fa95c0dd7293fdd 100644 (file)
@@ -3267,7 +3267,7 @@ static void cx88_card_setup(struct cx88_core *core)
                            ctl.fname);
                call_all(core, tuner, s_config, &xc2028_cfg);
        }
-       call_all(core, tuner, s_standby);
+       call_all(core, core, s_power, 0);
 }
 
 /* ------------------------------------------------------------------ */
index d9e402b25b56a800840350eb8d5138b807d3c101..9df71d0244a862e9e5ceaded917ef5c3e9aea128 100644 (file)
@@ -1170,7 +1170,7 @@ static int dvb_register(struct cx8802_dev *dev)
                fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;
 
        /* Put the analog decoder in standby to keep it quiet */
-       call_all(core, tuner, s_standby);
+       call_all(core, core, s_power, 0);
 
        /* register everything */
        return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
index 57e6b1241090d7d0a149d9b3e9b4f17c2a6bcc1b..d7e8fcee559c04c4ff5d36a7840e6236924dd045 100644 (file)
@@ -935,7 +935,7 @@ static int video_release(struct file *file)
 
        mutex_lock(&dev->core->lock);
        if(atomic_dec_and_test(&dev->core->users))
-               call_all(dev->core, tuner, s_standby);
+               call_all(dev->core, core, s_power, 0);
        mutex_unlock(&dev->core->lock);
 
        return 0;
index 6c7cbbc59e1cf9c7a2871449f926969f4f30420b..1e1937070738ffe6f985ed34641a38d1989ac38f 100644 (file)
@@ -2658,7 +2658,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
        em28xx_init_extension(dev);
 
        /* Save some power by putting tuner to sleep */
-       v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_standby);
+       v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
 
        return 0;
 
index 3a1dfb7726f8d8919dd1ff9a08505d582de6f2b8..fbe536f092f9b7bfa58eb629e7011cbb42798ee3 100644 (file)
@@ -2225,7 +2225,7 @@ static int em28xx_v4l2_close(struct file *filp)
                }
 
                /* Save some power by putting tuner to sleep */
-               v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_standby);
+               v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
 
                /* do this before setting alternate! */
                em28xx_uninit_isoc(dev);
index f87757fccc72114bdafe8ad4454f8e9a3b49b20e..9a5df930885b7090cfe5116ad6394cd57176775c 100644 (file)
@@ -1032,7 +1032,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
        saa7134_irq_video_signalchange(dev);
 
        if (TUNER_ABSENT != dev->tuner_type)
-               saa_call_all(dev, tuner, s_standby);
+               saa_call_all(dev, core, s_power, 0);
 
        /* register v4l devices */
        if (saa7134_no_overlay > 0)
index da26f476a302f9282e37213e59ff5885e1ee2a28..35f8daa3a359cf6cf41a446170df31c1151aed7c 100644 (file)
@@ -1499,7 +1499,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, tuner, s_standby);
+       saa_call_all(dev, core, s_power, 0);
        if (fh->radio)
                saa_call_all(dev, core, ioctl, RDS_CMD_CLOSE, &cmd);
 
index aba92e2313d8aa496e6cbd9b538301ce0c5fe0e9..50f6db5cd50b3aa4d2d9eba3863ccd9ef07adeaa 100644 (file)
@@ -752,14 +752,17 @@ static int tuner_s_radio(struct v4l2_subdev *sd)
        return 0;
 }
 
-static int tuner_s_standby(struct v4l2_subdev *sd)
+static int tuner_s_power(struct v4l2_subdev *sd, int on)
 {
        struct tuner *t = to_tuner(sd);
        struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
 
+       if (on)
+               return 0;
+
        tuner_dbg("Putting tuner to sleep\n");
 
-       if (check_mode(t, "s_standby") == -EINVAL)
+       if (check_mode(t, "s_power") == -EINVAL)
                return 0;
        t->mode = T_STANDBY;
        if (analog_ops->standby)
@@ -961,6 +964,7 @@ static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg)
 static const struct v4l2_subdev_core_ops tuner_core_ops = {
        .log_status = tuner_log_status,
        .s_std = tuner_s_std,
+       .s_power = tuner_s_power,
 };
 
 static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = {
@@ -971,7 +975,6 @@ static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = {
        .g_frequency = tuner_g_frequency,
        .s_type_addr = tuner_s_type_addr,
        .s_config = tuner_s_config,
-       .s_standby = tuner_s_standby,
 };
 
 static const struct v4l2_subdev_ops tuner_ops = {
index ecc2818938b34d1d86d142c28f489b51c49ecd74..88c13d6f791271e7da0123edc67813f93153fb17 100644 (file)
@@ -106,6 +106,9 @@ struct v4l2_decode_vbi_line {
 
    s_gpio: set GPIO pins. Very simple right now, might need to be extended with
        a direction argument if needed.
+
+   s_power: puts subdevice in power saving mode (on == 0) or normal operation
+       mode (on == 1).
  */
 struct v4l2_subdev_core_ops {
        int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
@@ -128,6 +131,7 @@ struct v4l2_subdev_core_ops {
        int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
        int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
 #endif
+       int (*s_power)(struct v4l2_subdev *sd, int on);
 };
 
 /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -137,8 +141,6 @@ struct v4l2_subdev_core_ops {
    s_type_addr: sets tuner type and its I2C addr.
 
    s_config: sets tda9887 specific stuff, like port1, port2 and qss
-
-   s_standby: puts tuner on powersaving state, disabling it, except for i2c.
  */
 struct v4l2_subdev_tuner_ops {
        int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
@@ -151,7 +153,6 @@ struct v4l2_subdev_tuner_ops {
        int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
        int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
        int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
-       int (*s_standby)(struct v4l2_subdev *sd);
 };
 
 /* s_clock_freq: set the frequency (in Hz) of the audio clock output.