All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Schäfer" <fschaefer.oss@googlemail.com>
To: Mauro Carvalho Chehab <m.chehab@samsung.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH v4 13/22] [media] em28xx: initialize audio latter
Date: Tue, 07 Jan 2014 18:00:07 +0100	[thread overview]
Message-ID: <52CC3297.4020706@googlemail.com> (raw)
In-Reply-To: <20140105111750.353b5916@samsung.com>

Am 05.01.2014 14:17, schrieb Mauro Carvalho Chehab:
> Em Sun, 05 Jan 2014 12:29:11 +0100
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> Am 04.01.2014 11:55, schrieb Mauro Carvalho Chehab:
>>> Better to first write the GPIOs of the input mux, before initializing
>>> the audio.
>> Why are you making this change ?
>>
>>> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
>>> ---
>>>  drivers/media/usb/em28xx/em28xx-video.c | 40 ++++++++++++++++-----------------
>>>  1 file changed, 20 insertions(+), 20 deletions(-)
>>>
>>> diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
>>> index b767262c642b..328d724a13ea 100644
>>> --- a/drivers/media/usb/em28xx/em28xx-video.c
>>> +++ b/drivers/media/usb/em28xx/em28xx-video.c
>>> @@ -2291,26 +2291,6 @@ static int em28xx_v4l2_init(struct em28xx *dev)
>>>  	em28xx_tuner_setup(dev);
>>>  	em28xx_init_camera(dev);
>>>  
>>> -	/* Configure audio */
>>> -	ret = em28xx_audio_setup(dev);
>>> -	if (ret < 0) {
>>> -		em28xx_errdev("%s: Error while setting audio - error [%d]!\n",
>>> -			__func__, ret);
>>> -		goto err;
>>> -	}
>>> -	if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
>>> -		v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
>>> -			V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
>>> -		v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
>>> -			V4L2_CID_AUDIO_VOLUME, 0, 0x1f, 1, 0x1f);
>>> -	} else {
>>> -		/* install the em28xx notify callback */
>>> -		v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_MUTE),
>>> -				em28xx_ctrl_notify, dev);
>>> -		v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_VOLUME),
>>> -				em28xx_ctrl_notify, dev);
>>> -	}
>>> -
>>>  	/* wake i2c devices */
>>>  	em28xx_wake_i2c(dev);
>>>  
>>> @@ -2356,6 +2336,26 @@ static int em28xx_v4l2_init(struct em28xx *dev)
>>>  
>>>  	video_mux(dev, 0);
>>>  
>>> +	/* Configure audio */
>>> +	ret = em28xx_audio_setup(dev);
>>> +	if (ret < 0) {
>>> +		em28xx_errdev("%s: Error while setting audio - error [%d]!\n",
>>> +			__func__, ret);
>>> +		goto err;
>>> +	}
>>> +	if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
>>> +		v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
>>> +			V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
>>> +		v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
>>> +			V4L2_CID_AUDIO_VOLUME, 0, 0x1f, 1, 0x1f);
>>> +	} else {
>>> +		/* install the em28xx notify callback */
>>> +		v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_MUTE),
>>> +				em28xx_ctrl_notify, dev);
>>> +		v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_VOLUME),
>>> +				em28xx_ctrl_notify, dev);
>>> +	}
>>> +
>>>  	/* Audio defaults */
>>>  	dev->mute = 1;
>>>  	dev->volume = 0x1f;
>> Well, the v4l/core split didn't change the order.
>> And if the current order would be wrong, then you would also have to
>> call audio_setup() each time the user switches the input.
> Maybe this is needed anyway. Btw, there's a bug on xawtv: if you maximize
> a window, audio stops playing. I didn't have time yet to identify why.
>
>> So unless you are trying to fix a real bug, I wouldn't change it.
>> The current order is sane and we likely could never change it back later
>> without risking regressions...
> Sometimes, ac97 is not properly detected here with HVR-950. Not sure
> what happens. I need to do more tests. Perhaps it happens only on USB 3.0
> ports.
So you are making yet another change to fix a bug, although you even
haven't identified yet what the bug is ?

> In any case, it makes sense to first wake up I2C devices, then to set
> the video mux, before start probing for audio, as the audio setting
> may depend on the video mux settings.
>
You are ignoring what I said.

1.) If the current order would really be wrong, we would have bugs. But
we don't know any bugs caused by the current order.
2.) If you change the order, it is also necessary to wake up or even do
the whole setup again after each input switch (video_mux() call).
This patch misses this fix. So there is a chance that you are causing
regressions.
3.) We can always do this change later, but we likely can't revert it
anymore after a while (without retesting all device that have been added
in the meantime)

The whole gpio sequences stuff and its unknown effects on the
power/reset state of the subdevices has already turned em28xx
maintenance into a nightmare.
There is lots of problematic code which can never be fixed without
testing all ~100 devices.
Let's not walk needlessly into the same trap with yet another piece of code.



  reply	other threads:[~2014-01-07 16:59 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-04 10:55 [PATCH v4 00/22] em28xx: split analog part into a separate module Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 01/22] [media] em28xx: move some video-specific functions to em28xx-video Mauro Carvalho Chehab
2014-01-05 10:11   ` Frank Schäfer
2014-01-05 13:28     ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 02/22] [media] em28xx: some cosmetic changes Mauro Carvalho Chehab
2014-01-05 10:13   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 03/22] [media] em28xx: move analog-specific init to em28xx-video Mauro Carvalho Chehab
2014-01-05 10:26   ` Frank Schäfer
2014-01-05 14:40     ` Mauro Carvalho Chehab
2014-01-06 21:28       ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 04/22] [media] em28xx: make em28xx-video to be a separate module Mauro Carvalho Chehab
2014-01-05 10:47   ` Frank Schäfer
2014-01-05 12:56     ` Mauro Carvalho Chehab
2014-01-05 15:18       ` Mauro Carvalho Chehab
2014-01-06 21:35         ` Frank Schäfer
2014-01-06 17:38       ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 05/22] [media] em28xx: initialize analog I2C devices at the right place Mauro Carvalho Chehab
2014-01-05 10:48   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 06/22] [media] em28xx: add warn messages for timeout Mauro Carvalho Chehab
2014-01-05 10:51   ` Frank Schäfer
2014-01-05 13:05     ` Mauro Carvalho Chehab
2014-01-05 13:25     ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 07/22] [media] em28xx: improve extension information messages Mauro Carvalho Chehab
2014-01-05 10:55   ` Frank Schäfer
2014-01-05 13:08     ` Mauro Carvalho Chehab
2014-01-05 15:31       ` Mauro Carvalho Chehab
2014-01-06 17:44       ` Frank Schäfer
2014-01-06 18:17         ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 08/22] [media] em28xx: convert i2c wait completion logic to use jiffies Mauro Carvalho Chehab
2014-01-05 11:03   ` Frank Schäfer
2014-01-05 13:10     ` Mauro Carvalho Chehab
2014-01-06 17:48       ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 09/22] [media] tvp5150: make read operations atomic Mauro Carvalho Chehab
2014-01-05 11:07   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 10/22] [media] tuner-xc2028: remove unused code Mauro Carvalho Chehab
2014-01-05 11:07   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 11/22] [media] em28xx: check if a device has audio earlier Mauro Carvalho Chehab
2014-01-05 11:12   ` Frank Schäfer
2014-01-05 13:22     ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 12/22] [media] em28xx: properly implement AC97 wait code Mauro Carvalho Chehab
2014-01-05 11:19   ` Frank Schäfer
2014-01-05 13:20     ` Mauro Carvalho Chehab
2014-01-05 15:44       ` Mauro Carvalho Chehab
2014-01-07 16:50         ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 13/22] [media] em28xx: initialize audio latter Mauro Carvalho Chehab
2014-01-05 11:29   ` Frank Schäfer
2014-01-05 13:17     ` Mauro Carvalho Chehab
2014-01-07 17:00       ` Frank Schäfer [this message]
2014-01-08 14:29         ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 14/22] [media] em28xx: unify module version Mauro Carvalho Chehab
2014-01-05 11:33   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 15/22] [media] em28xx: Fix em28xx deplock Mauro Carvalho Chehab
2014-01-05 11:38   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 16/22] [media] em28xx: use a better value for I2C timeouts Mauro Carvalho Chehab
2014-01-05 20:38   ` Frank Schäfer
2014-01-05 20:57     ` Mauro Carvalho Chehab
2014-01-07 17:15       ` Frank Schäfer
2014-01-08 14:39         ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 17/22] [media] em28xx-i2c: Fix error code for I2C error transfers Mauro Carvalho Chehab
2014-01-05 20:40   ` Frank Schäfer
2014-01-06  9:55     ` Mauro Carvalho Chehab
2014-01-07 17:28       ` Frank Schäfer
2014-01-08 11:55         ` Mauro Carvalho Chehab
2014-01-08 19:37           ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 18/22] [media] em28xx: don't return -ENODEV for I2C xfer errors Mauro Carvalho Chehab
2014-01-05 20:49   ` Frank Schäfer
2014-01-06 10:37     ` Mauro Carvalho Chehab
2014-01-04 10:55 ` [PATCH v4 19/22] [media] em28xx: cleanup I2C debug messages Mauro Carvalho Chehab
2014-01-05 20:54   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 20/22] [media] em28xx: use usb_alloc_coherent() for audio Mauro Carvalho Chehab
2014-01-05 20:57   ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 21/22] [media] em28xx-audio: allocate URBs at device driver init Mauro Carvalho Chehab
2014-01-05 21:02   ` Frank Schäfer
2014-01-05 21:25     ` Mauro Carvalho Chehab
2014-01-06 16:25       ` Mauro Carvalho Chehab
2014-01-07 17:03       ` Frank Schäfer
2014-01-08 14:10         ` Mauro Carvalho Chehab
2014-01-08 19:14           ` Frank Schäfer
2014-01-04 10:55 ` [PATCH v4 22/22] [media] em28xx: retry read operation if it fails Mauro Carvalho Chehab
2014-01-05 21:06   ` Frank Schäfer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CC3297.4020706@googlemail.com \
    --to=fschaefer.oss@googlemail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.