Skip to content

Commit eefe101

Browse files
Andy WallsMauro Carvalho Chehab
authored andcommitted
V4L/DVB (10759): cx18: Convert GPIO connected functions to act as v4l2_subdevices
Convert GPIO line functions, such a audio routing and device resets, to v4l2_subdevices. This essentially completes the conversion of cx18 to the v4l2_device/v4l2_subdevice framework. No regression testing has taken place as of yet. Also an ivtv legacy bug with GPIO mux routing and going to/from radio mode was commented, but not fixed. Signed-off-by: Andy Walls <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent ff2a200 commit eefe101

File tree

12 files changed

+278
-123
lines changed

12 files changed

+278
-123
lines changed

drivers/media/video/cx18/cx18-cards.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static const struct cx18_card cx18_card_hvr1600_esmt = {
5656
.hw_audio_ctrl = CX18_HW_418_AV,
5757
.hw_muxer = CX18_HW_CS5345,
5858
.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
59-
CX18_HW_CS5345 | CX18_HW_DVB,
59+
CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
6060
.video_inputs = {
6161
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
6262
{ CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
@@ -102,7 +102,7 @@ static const struct cx18_card cx18_card_hvr1600_samsung = {
102102
.hw_audio_ctrl = CX18_HW_418_AV,
103103
.hw_muxer = CX18_HW_CS5345,
104104
.hw_all = CX18_HW_TVEEPROM | CX18_HW_418_AV | CX18_HW_TUNER |
105-
CX18_HW_CS5345 | CX18_HW_DVB,
105+
CX18_HW_CS5345 | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL,
106106
.video_inputs = {
107107
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE7 },
108108
{ CX18_CARD_INPUT_SVIDEO1, 1, CX18_AV_SVIDEO1 },
@@ -155,7 +155,7 @@ static const struct cx18_card cx18_card_h900 = {
155155
.comment = "Analog TV capture supported\n",
156156
.v4l2_capabilities = CX18_CAP_ENCODER,
157157
.hw_audio_ctrl = CX18_HW_418_AV,
158-
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER,
158+
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
159159
.video_inputs = {
160160
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
161161
{ CX18_CARD_INPUT_SVIDEO1, 1,
@@ -202,7 +202,7 @@ static const struct cx18_card cx18_card_mpc718 = {
202202
.comment = "Analog video capture works; some audio line in may not.\n",
203203
.v4l2_capabilities = CX18_CAP_ENCODER,
204204
.hw_audio_ctrl = CX18_HW_418_AV,
205-
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER,
205+
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
206206
.video_inputs = {
207207
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
208208
{ CX18_CARD_INPUT_SVIDEO1, 1,
@@ -252,8 +252,8 @@ static const struct cx18_card cx18_card_cnxt_raptor_pal = {
252252
.comment = "Analog TV capture supported\n",
253253
.v4l2_capabilities = CX18_CAP_ENCODER,
254254
.hw_audio_ctrl = CX18_HW_418_AV,
255-
.hw_muxer = CX18_HW_GPIO_AUDIO_MUX,
256-
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_AUDIO_MUX,
255+
.hw_muxer = CX18_HW_GPIO_MUX,
256+
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX,
257257
.video_inputs = {
258258
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
259259
{ CX18_CARD_INPUT_SVIDEO1, 1,
@@ -307,7 +307,7 @@ static const struct cx18_card cx18_card_toshiba_qosmio_dvbt = {
307307
"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
308308
.v4l2_capabilities = CX18_CAP_ENCODER,
309309
.hw_audio_ctrl = CX18_HW_418_AV,
310-
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER,
310+
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL,
311311
.video_inputs = {
312312
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE6 },
313313
{ CX18_CARD_INPUT_SVIDEO1, 1,
@@ -351,8 +351,9 @@ static const struct cx18_card cx18_card_leadtek_pvr2100 = {
351351
"\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n",
352352
.v4l2_capabilities = CX18_CAP_ENCODER,
353353
.hw_audio_ctrl = CX18_HW_418_AV,
354-
.hw_muxer = CX18_HW_GPIO_AUDIO_MUX,
355-
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_AUDIO_MUX,
354+
.hw_muxer = CX18_HW_GPIO_MUX,
355+
.hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_MUX |
356+
CX18_HW_GPIO_RESET_CTRL,
356357
.video_inputs = {
357358
{ CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 },
358359
{ CX18_CARD_INPUT_SVIDEO1, 1,

drivers/media/video/cx18/cx18-cards.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
#define CX18_HW_CS5345 (1 << 2)
2828
#define CX18_HW_DVB (1 << 3)
2929
#define CX18_HW_418_AV (1 << 4)
30-
#define CX18_HW_GPIO_AUDIO_MUX (1 << 5)
30+
#define CX18_HW_GPIO_MUX (1 << 5)
31+
#define CX18_HW_GPIO_RESET_CTRL (1 << 6)
3132

3233
/* video inputs */
3334
#define CX18_CARD_INPUT_VID_TUNER 1

drivers/media/video/cx18/cx18-controls.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@
2222
*/
2323

2424
#include "cx18-driver.h"
25-
#include "cx18-av-core.h"
2625
#include "cx18-cards.h"
2726
#include "cx18-ioctl.h"
2827
#include "cx18-audio.h"
29-
#include "cx18-i2c.h"
3028
#include "cx18-mailbox.h"
3129
#include "cx18-controls.h"
3230

drivers/media/video/cx18/cx18-driver.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,6 @@ static void cx18_init_subdevs(struct cx18 *cx)
684684
continue;
685685

686686
switch (device) {
687-
case CX18_HW_GPIO_AUDIO_MUX:
688687
case CX18_HW_DVB:
689688
case CX18_HW_TVEEPROM:
690689
/* These subordinate devices do not use probing */
@@ -695,6 +694,16 @@ static void cx18_init_subdevs(struct cx18 *cx)
695694
/* Just note that the card uses it (i.e. has analog) */
696695
cx->hw_flags |= device;
697696
break;
697+
case CX18_HW_GPIO_RESET_CTRL:
698+
/*
699+
* The Reset Controller gets probed and added to
700+
* hw_flags earlier for i2c adapter/bus initialization
701+
*/
702+
break;
703+
case CX18_HW_GPIO_MUX:
704+
if (cx18_gpio_register(cx, device) == 0)
705+
cx->hw_flags |= device;
706+
break;
698707
default:
699708
if (cx18_i2c_register(cx, i) == 0)
700709
cx->hw_flags |= device;
@@ -793,7 +802,6 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
793802
cx->scb = (struct cx18_scb __iomem *)(cx->enc_mem + SCB_OFFSET);
794803
cx18_init_scb(cx);
795804

796-
/* Initialize GPIO early so I2C device resets can be performed */
797805
cx18_gpio_init(cx);
798806

799807
/* Initialize integrated A/V decoder early to set PLLs, just in case */
@@ -802,9 +810,17 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
802810
CX18_ERR("Could not register A/V decoder subdevice\n");
803811
goto free_map;
804812
}
805-
/* Initialize the A/V decoder PLLs to sane defaults */
806813
cx18_call_hw(cx, CX18_HW_418_AV, core, init, (u32) CX18_AV_INIT_PLLS);
807814

815+
/* Initialize GPIO Reset Controller to do chip resets during i2c init */
816+
if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) {
817+
if (cx18_gpio_register(cx, CX18_HW_GPIO_RESET_CTRL) != 0)
818+
CX18_WARN("Could not register GPIO reset controller"
819+
"subdevice; proceeding anyway.\n");
820+
else
821+
cx->hw_flags |= CX18_HW_GPIO_RESET_CTRL;
822+
}
823+
808824
/* active i2c */
809825
CX18_DEBUG_INFO("activating i2c...\n");
810826
retval = init_cx18_i2c(cx);

drivers/media/video/cx18/cx18-driver.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ struct cx18 {
449449
struct pci_dev *pci_dev;
450450
struct v4l2_device v4l2_dev;
451451
struct v4l2_subdev *sd_av; /* A/V decoder/digitizer sub-device */
452-
struct v4l2_subdev *sd_extmux; /* External audio multiplexer sub-dev */
452+
struct v4l2_subdev *sd_extmux; /* External multiplexer sub-dev */
453453

454454
const struct cx18_card *card; /* card information */
455455
const char *card_name; /* full name of the card */
@@ -534,6 +534,8 @@ struct cx18 {
534534
u32 gpio_dir;
535535
u32 gpio_val;
536536
struct mutex gpio_lock;
537+
struct v4l2_subdev sd_gpiomux;
538+
struct v4l2_subdev sd_resetctrl;
537539

538540
/* v4l2 and User settings */
539541

0 commit comments

Comments
 (0)