[media] smiapp: Replace pll_flags quirk with more generic init quirk

The pll_flags quirk just returned the extra PLL flags the sensor required,
but the init quirk is far more versatile. It can be used to perform any
extra initialisation needed by the sensor, including allocating memory for
sensor specific struct and creating sensor specific new controls.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
Sakari Ailus 2014-10-03 11:38:32 -03:00 committed by Mauro Carvalho Chehab
parent 5313c00266
commit 0d825a1226
3 changed files with 13 additions and 4 deletions

View File

@ -2697,7 +2697,6 @@ static int smiapp_init(struct smiapp_sensor *sensor)
pll->bus_type = SMIAPP_PLL_BUS_TYPE_CSI2;
pll->csi2.lanes = sensor->platform_data->lanes;
pll->ext_clk_freq_hz = sensor->platform_data->ext_clk;
pll->flags = smiapp_call_quirk(sensor, pll_flags);
pll->scale_n = sensor->limits[SMIAPP_LIMIT_SCALER_N_MIN];
/* Profile 0 sensors have no separate OP clock branch. */
if (sensor->minfo.smiapp_profile == SMIAPP_PROFILE_0)
@ -2772,6 +2771,10 @@ static int smiapp_init(struct smiapp_sensor *sensor)
if (rval < 0)
goto out_cleanup;
rval = smiapp_call_quirk(sensor, init);
if (rval)
goto out_cleanup;
rval = smiapp_get_mbus_formats(sensor);
if (rval) {
rval = -ENODEV;

View File

@ -214,9 +214,11 @@ static int jt8ev1_post_streamoff(struct smiapp_sensor *sensor)
return smiapp_write_8(sensor, 0x3328, 0x80);
}
static unsigned long jt8ev1_pll_flags(struct smiapp_sensor *sensor)
static int jt8ev1_init(struct smiapp_sensor *sensor)
{
return SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE;
sensor->pll.flags |= SMIAPP_PLL_FLAG_OP_PIX_CLOCK_PER_LANE;
return 0;
}
const struct smiapp_quirk smiapp_jt8ev1_quirk = {
@ -224,7 +226,7 @@ const struct smiapp_quirk smiapp_jt8ev1_quirk = {
.post_poweron = jt8ev1_post_poweron,
.pre_streamon = jt8ev1_pre_streamon,
.post_streamoff = jt8ev1_post_streamoff,
.pll_flags = jt8ev1_pll_flags,
.init = jt8ev1_init,
};
static int tcm8500md_limits(struct smiapp_sensor *sensor)

View File

@ -29,6 +29,9 @@ struct smiapp_sensor;
* @post_poweron: Called always after the sensor has been fully powered on.
* @pre_streamon: Called just before streaming is enabled.
* @post_streamon: Called right after stopping streaming.
* @pll_flags: Return flags for the PLL calculator.
* @init: Quirk initialisation, called the last in probe(). This is
* also appropriate for adding sensor specific controls, for instance.
* @reg_access: Register access quirk. The quirk may divert the access
* to another register, or no register at all.
*
@ -47,6 +50,7 @@ struct smiapp_quirk {
int (*pre_streamon)(struct smiapp_sensor *sensor);
int (*post_streamoff)(struct smiapp_sensor *sensor);
unsigned long (*pll_flags)(struct smiapp_sensor *sensor);
int (*init)(struct smiapp_sensor *sensor);
int (*reg_access)(struct smiapp_sensor *sensor, bool write, u32 *reg,
u32 *val);
unsigned long flags;