media: cx25840: don't open-code cx25840_reset() inside cx25840_load_fw()
cx25840_load_fw() does the same thing as cx25840_reset(), only keeps "is_initialized" flag so any further invocation of this function besides the first one is a NOP. Let's just call cx25840_reset() directly from cx25840_load_fw() instead of open coding it there. While we are at it, let's also improve comments about cx25840_load_fw() so they are current and in the proper style (one of them even referred to a non-existing cx25840 init operation). Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
39cb46751e
commit
ccf7a31f1e
@ -1649,24 +1649,11 @@ static void log_audio_status(struct i2c_client *client)
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* This load_fw operation must be called to load the driver's firmware.
|
static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
|
||||||
Without this the audio standard detection will fail and you will
|
|
||||||
only get mono.
|
|
||||||
|
|
||||||
Since loading the firmware is often problematic when the driver is
|
|
||||||
compiled into the kernel I recommend postponing calling this function
|
|
||||||
until the first open of the video device. Another reason for
|
|
||||||
postponing it is that loading this firmware takes a long time (seconds)
|
|
||||||
due to the slow i2c bus speed. So it will speed up the boot process if
|
|
||||||
you can avoid loading the fw as long as the video device isn't used. */
|
|
||||||
static int cx25840_load_fw(struct v4l2_subdev *sd)
|
|
||||||
{
|
{
|
||||||
struct cx25840_state *state = to_state(sd);
|
struct cx25840_state *state = to_state(sd);
|
||||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
||||||
|
|
||||||
if (!state->is_initialized) {
|
|
||||||
/* initialize and load firmware */
|
|
||||||
state->is_initialized = 1;
|
|
||||||
if (is_cx2583x(state))
|
if (is_cx2583x(state))
|
||||||
cx25836_initialize(client);
|
cx25836_initialize(client);
|
||||||
else if (is_cx2388x(state))
|
else if (is_cx2388x(state))
|
||||||
@ -1675,6 +1662,33 @@ static int cx25840_load_fw(struct v4l2_subdev *sd)
|
|||||||
cx231xx_initialize(client);
|
cx231xx_initialize(client);
|
||||||
else
|
else
|
||||||
cx25840_initialize(client);
|
cx25840_initialize(client);
|
||||||
|
|
||||||
|
state->is_initialized = 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This load_fw operation must be called to load the driver's firmware.
|
||||||
|
* This will load the firmware on the first invocation (further ones are NOP).
|
||||||
|
* Without this the audio standard detection will fail and you will
|
||||||
|
* only get mono.
|
||||||
|
* Alternatively, you can call the reset operation instead of this one.
|
||||||
|
*
|
||||||
|
* Since loading the firmware is often problematic when the driver is
|
||||||
|
* compiled into the kernel I recommend postponing calling this function
|
||||||
|
* until the first open of the video device. Another reason for
|
||||||
|
* postponing it is that loading this firmware takes a long time (seconds)
|
||||||
|
* due to the slow i2c bus speed. So it will speed up the boot process if
|
||||||
|
* you can avoid loading the fw as long as the video device isn't used.
|
||||||
|
*/
|
||||||
|
static int cx25840_load_fw(struct v4l2_subdev *sd)
|
||||||
|
{
|
||||||
|
struct cx25840_state *state = to_state(sd);
|
||||||
|
|
||||||
|
if (!state->is_initialized) {
|
||||||
|
/* initialize and load firmware */
|
||||||
|
cx25840_reset(sd, 0);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1937,22 +1951,6 @@ static int cx25840_s_tuner(struct v4l2_subdev *sd, const struct v4l2_tuner *vt)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cx25840_reset(struct v4l2_subdev *sd, u32 val)
|
|
||||||
{
|
|
||||||
struct cx25840_state *state = to_state(sd);
|
|
||||||
struct i2c_client *client = v4l2_get_subdevdata(sd);
|
|
||||||
|
|
||||||
if (is_cx2583x(state))
|
|
||||||
cx25836_initialize(client);
|
|
||||||
else if (is_cx2388x(state))
|
|
||||||
cx23885_initialize(client);
|
|
||||||
else if (is_cx231xx(state))
|
|
||||||
cx231xx_initialize(client);
|
|
||||||
else
|
|
||||||
cx25840_initialize(client);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int cx25840_log_status(struct v4l2_subdev *sd)
|
static int cx25840_log_status(struct v4l2_subdev *sd)
|
||||||
{
|
{
|
||||||
struct cx25840_state *state = to_state(sd);
|
struct cx25840_state *state = to_state(sd);
|
||||||
|
@ -9,17 +9,23 @@
|
|||||||
#ifndef _CX25840_H_
|
#ifndef _CX25840_H_
|
||||||
#define _CX25840_H_
|
#define _CX25840_H_
|
||||||
|
|
||||||
/* Note that the cx25840 driver requires that the bridge driver calls the
|
/*
|
||||||
v4l2_subdev's init operation in order to load the driver's firmware.
|
* Note that the cx25840 driver requires that the bridge driver calls the
|
||||||
Without this the audio standard detection will fail and you will
|
* v4l2_subdev's load_fw operation in order to load the driver's firmware.
|
||||||
only get mono.
|
* This will load the firmware on the first invocation (further ones are NOP).
|
||||||
|
* Without this the audio standard detection will fail and you will
|
||||||
Since loading the firmware is often problematic when the driver is
|
* only get mono.
|
||||||
compiled into the kernel I recommend postponing calling this function
|
* Alternatively, you can call the reset operation (this can be done
|
||||||
until the first open of the video device. Another reason for
|
* multiple times if needed, each invocation will fully reinitialize
|
||||||
postponing it is that loading this firmware takes a long time (seconds)
|
* the device).
|
||||||
due to the slow i2c bus speed. So it will speed up the boot process if
|
*
|
||||||
you can avoid loading the fw as long as the video device isn't used. */
|
* Since loading the firmware is often problematic when the driver is
|
||||||
|
* compiled into the kernel I recommend postponing calling this function
|
||||||
|
* until the first open of the video device. Another reason for
|
||||||
|
* postponing it is that loading this firmware takes a long time (seconds)
|
||||||
|
* due to the slow i2c bus speed. So it will speed up the boot process if
|
||||||
|
* you can avoid loading the fw as long as the video device isn't used.
|
||||||
|
*/
|
||||||
|
|
||||||
enum cx25840_video_input {
|
enum cx25840_video_input {
|
||||||
/* Composite video inputs In1-In8 */
|
/* Composite video inputs In1-In8 */
|
||||||
|
Loading…
Reference in New Issue
Block a user