aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2009-10-05 09:48:17 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:41:03 -0500
commit622b828ab795580903e79acb33fb44f5c9ce7b0f (patch)
tree6bd14a6769bd4caefdb1583c661948041b8a31d3
parent7ef68e60d9435eb604a346babccb48000b94bc76 (diff)
V4L/DVB (13238): v4l2_subdev: rename tuner s_standby operation to core s_power
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>
-rw-r--r--drivers/media/video/au0828/au0828-video.c2
-rw-r--r--drivers/media/video/cx231xx/cx231xx-video.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-core.c2
-rw-r--r--drivers/media/video/cx23885/cx23885-dvb.c2
-rw-r--r--drivers/media/video/cx88/cx88-cards.c2
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c2
-rw-r--r--drivers/media/video/cx88/cx88-video.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c2
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-video.c2
-rw-r--r--drivers/media/video/tuner-core.c9
-rw-r--r--include/media/v4l2-subdev.h7
13 files changed, 21 insertions, 17 deletions
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c
index 51527d7b55a7..1485aee18d58 100644
--- a/drivers/media/video/au0828/au0828-video.c
+++ b/drivers/media/video/au0828/au0828-video.c
@@ -830,7 +830,7 @@ static int au0828_v4l2_close(struct file *filp)
830 au0828_uninit_isoc(dev); 830 au0828_uninit_isoc(dev);
831 831
832 /* Save some power by putting tuner to sleep */ 832 /* Save some power by putting tuner to sleep */
833 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_standby); 833 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
834 834
835 /* When close the device, set the usb intf0 into alt0 to free 835 /* When close the device, set the usb intf0 into alt0 to free
836 USB bandwidth */ 836 USB bandwidth */
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c
index 36503725d973..d095aa0d6d19 100644
--- a/drivers/media/video/cx231xx/cx231xx-video.c
+++ b/drivers/media/video/cx231xx/cx231xx-video.c
@@ -2106,7 +2106,7 @@ static int cx231xx_v4l2_close(struct file *filp)
2106 } 2106 }
2107 2107
2108 /* Save some power by putting tuner to sleep */ 2108 /* Save some power by putting tuner to sleep */
2109 call_all(dev, tuner, s_standby); 2109 call_all(dev, core, s_power, 0);
2110 2110
2111 /* do this before setting alternate! */ 2111 /* do this before setting alternate! */
2112 cx231xx_uninit_isoc(dev); 2112 cx231xx_uninit_isoc(dev);
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c
index d6e41db500ef..e34a4ec4a2cd 100644
--- a/drivers/media/video/cx23885/cx23885-core.c
+++ b/drivers/media/video/cx23885/cx23885-core.c
@@ -919,7 +919,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
919 cx23885_i2c_register(&dev->i2c_bus[1]); 919 cx23885_i2c_register(&dev->i2c_bus[1]);
920 cx23885_i2c_register(&dev->i2c_bus[2]); 920 cx23885_i2c_register(&dev->i2c_bus[2]);
921 cx23885_card_setup(dev); 921 cx23885_card_setup(dev);
922 call_all(dev, tuner, s_standby); 922 call_all(dev, core, s_power, 0);
923 cx23885_ir_init(dev); 923 cx23885_ir_init(dev);
924 924
925 if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) { 925 if (cx23885_boards[dev->board].porta == CX23885_ANALOG_VIDEO) {
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c
index 4d439f2c4abc..f4f046cd81a5 100644
--- a/drivers/media/video/cx23885/cx23885-dvb.c
+++ b/drivers/media/video/cx23885/cx23885-dvb.c
@@ -920,7 +920,7 @@ static int dvb_register(struct cx23885_tsport *port)
920 fe0->dvb.frontend->callback = cx23885_tuner_callback; 920 fe0->dvb.frontend->callback = cx23885_tuner_callback;
921 921
922 /* Put the analog decoder in standby to keep it quiet */ 922 /* Put the analog decoder in standby to keep it quiet */
923 call_all(dev, tuner, s_standby); 923 call_all(dev, core, s_power, 0);
924 924
925 if (fe0->dvb.frontend->ops.analog_ops.standby) 925 if (fe0->dvb.frontend->ops.analog_ops.standby)
926 fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend); 926 fe0->dvb.frontend->ops.analog_ops.standby(fe0->dvb.frontend);
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 33be6369871a..7330a2d70439 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -3267,7 +3267,7 @@ static void cx88_card_setup(struct cx88_core *core)
3267 ctl.fname); 3267 ctl.fname);
3268 call_all(core, tuner, s_config, &xc2028_cfg); 3268 call_all(core, tuner, s_config, &xc2028_cfg);
3269 } 3269 }
3270 call_all(core, tuner, s_standby); 3270 call_all(core, core, s_power, 0);
3271} 3271}
3272 3272
3273/* ------------------------------------------------------------------ */ 3273/* ------------------------------------------------------------------ */
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index d9e402b25b56..9df71d0244a8 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1170,7 +1170,7 @@ static int dvb_register(struct cx8802_dev *dev)
1170 fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl; 1170 fe1->dvb.frontend->ops.ts_bus_ctrl = cx88_dvb_bus_ctrl;
1171 1171
1172 /* Put the analog decoder in standby to keep it quiet */ 1172 /* Put the analog decoder in standby to keep it quiet */
1173 call_all(core, tuner, s_standby); 1173 call_all(core, core, s_power, 0);
1174 1174
1175 /* register everything */ 1175 /* register everything */
1176 return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, 1176 return videobuf_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 57e6b1241090..d7e8fcee559c 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -935,7 +935,7 @@ static int video_release(struct file *file)
935 935
936 mutex_lock(&dev->core->lock); 936 mutex_lock(&dev->core->lock);
937 if(atomic_dec_and_test(&dev->core->users)) 937 if(atomic_dec_and_test(&dev->core->users))
938 call_all(dev->core, tuner, s_standby); 938 call_all(dev->core, core, s_power, 0);
939 mutex_unlock(&dev->core->lock); 939 mutex_unlock(&dev->core->lock);
940 940
941 return 0; 941 return 0;
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 6c7cbbc59e1c..1e1937070738 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -2658,7 +2658,7 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2658 em28xx_init_extension(dev); 2658 em28xx_init_extension(dev);
2659 2659
2660 /* Save some power by putting tuner to sleep */ 2660 /* Save some power by putting tuner to sleep */
2661 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_standby); 2661 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
2662 2662
2663 return 0; 2663 return 0;
2664 2664
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 3a1dfb7726f8..fbe536f092f9 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -2225,7 +2225,7 @@ static int em28xx_v4l2_close(struct file *filp)
2225 } 2225 }
2226 2226
2227 /* Save some power by putting tuner to sleep */ 2227 /* Save some power by putting tuner to sleep */
2228 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_standby); 2228 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_power, 0);
2229 2229
2230 /* do this before setting alternate! */ 2230 /* do this before setting alternate! */
2231 em28xx_uninit_isoc(dev); 2231 em28xx_uninit_isoc(dev);
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index f87757fccc72..9a5df930885b 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1032,7 +1032,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
1032 saa7134_irq_video_signalchange(dev); 1032 saa7134_irq_video_signalchange(dev);
1033 1033
1034 if (TUNER_ABSENT != dev->tuner_type) 1034 if (TUNER_ABSENT != dev->tuner_type)
1035 saa_call_all(dev, tuner, s_standby); 1035 saa_call_all(dev, core, s_power, 0);
1036 1036
1037 /* register v4l devices */ 1037 /* register v4l devices */
1038 if (saa7134_no_overlay > 0) 1038 if (saa7134_no_overlay > 0)
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index da26f476a302..35f8daa3a359 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1499,7 +1499,7 @@ static int video_release(struct file *file)
1499 saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0); 1499 saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0);
1500 saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0); 1500 saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
1501 1501
1502 saa_call_all(dev, tuner, s_standby); 1502 saa_call_all(dev, core, s_power, 0);
1503 if (fh->radio) 1503 if (fh->radio)
1504 saa_call_all(dev, core, ioctl, RDS_CMD_CLOSE, &cmd); 1504 saa_call_all(dev, core, ioctl, RDS_CMD_CLOSE, &cmd);
1505 1505
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index aba92e2313d8..50f6db5cd50b 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -752,14 +752,17 @@ static int tuner_s_radio(struct v4l2_subdev *sd)
752 return 0; 752 return 0;
753} 753}
754 754
755static int tuner_s_standby(struct v4l2_subdev *sd) 755static int tuner_s_power(struct v4l2_subdev *sd, int on)
756{ 756{
757 struct tuner *t = to_tuner(sd); 757 struct tuner *t = to_tuner(sd);
758 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops; 758 struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
759 759
760 if (on)
761 return 0;
762
760 tuner_dbg("Putting tuner to sleep\n"); 763 tuner_dbg("Putting tuner to sleep\n");
761 764
762 if (check_mode(t, "s_standby") == -EINVAL) 765 if (check_mode(t, "s_power") == -EINVAL)
763 return 0; 766 return 0;
764 t->mode = T_STANDBY; 767 t->mode = T_STANDBY;
765 if (analog_ops->standby) 768 if (analog_ops->standby)
@@ -961,6 +964,7 @@ static int tuner_command(struct i2c_client *client, unsigned cmd, void *arg)
961static const struct v4l2_subdev_core_ops tuner_core_ops = { 964static const struct v4l2_subdev_core_ops tuner_core_ops = {
962 .log_status = tuner_log_status, 965 .log_status = tuner_log_status,
963 .s_std = tuner_s_std, 966 .s_std = tuner_s_std,
967 .s_power = tuner_s_power,
964}; 968};
965 969
966static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = { 970static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = {
@@ -971,7 +975,6 @@ static const struct v4l2_subdev_tuner_ops tuner_tuner_ops = {
971 .g_frequency = tuner_g_frequency, 975 .g_frequency = tuner_g_frequency,
972 .s_type_addr = tuner_s_type_addr, 976 .s_type_addr = tuner_s_type_addr,
973 .s_config = tuner_s_config, 977 .s_config = tuner_s_config,
974 .s_standby = tuner_s_standby,
975}; 978};
976 979
977static const struct v4l2_subdev_ops tuner_ops = { 980static const struct v4l2_subdev_ops tuner_ops = {
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index ecc2818938b3..88c13d6f7912 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -106,6 +106,9 @@ struct v4l2_decode_vbi_line {
106 106
107 s_gpio: set GPIO pins. Very simple right now, might need to be extended with 107 s_gpio: set GPIO pins. Very simple right now, might need to be extended with
108 a direction argument if needed. 108 a direction argument if needed.
109
110 s_power: puts subdevice in power saving mode (on == 0) or normal operation
111 mode (on == 1).
109 */ 112 */
110struct v4l2_subdev_core_ops { 113struct v4l2_subdev_core_ops {
111 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 114 int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip);
@@ -128,6 +131,7 @@ struct v4l2_subdev_core_ops {
128 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 131 int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
129 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 132 int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg);
130#endif 133#endif
134 int (*s_power)(struct v4l2_subdev *sd, int on);
131}; 135};
132 136
133/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. 137/* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio.
@@ -137,8 +141,6 @@ struct v4l2_subdev_core_ops {
137 s_type_addr: sets tuner type and its I2C addr. 141 s_type_addr: sets tuner type and its I2C addr.
138 142
139 s_config: sets tda9887 specific stuff, like port1, port2 and qss 143 s_config: sets tda9887 specific stuff, like port1, port2 and qss
140
141 s_standby: puts tuner on powersaving state, disabling it, except for i2c.
142 */ 144 */
143struct v4l2_subdev_tuner_ops { 145struct v4l2_subdev_tuner_ops {
144 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type); 146 int (*s_mode)(struct v4l2_subdev *sd, enum v4l2_tuner_type);
@@ -151,7 +153,6 @@ struct v4l2_subdev_tuner_ops {
151 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm); 153 int (*s_modulator)(struct v4l2_subdev *sd, struct v4l2_modulator *vm);
152 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type); 154 int (*s_type_addr)(struct v4l2_subdev *sd, struct tuner_setup *type);
153 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config); 155 int (*s_config)(struct v4l2_subdev *sd, const struct v4l2_priv_tun_config *config);
154 int (*s_standby)(struct v4l2_subdev *sd);
155}; 156};
156 157
157/* s_clock_freq: set the frequency (in Hz) of the audio clock output. 158/* s_clock_freq: set the frequency (in Hz) of the audio clock output.