162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci   cx231xx-pcb-config.c - driver for Conexant
462306a36Sopenharmony_ci		Cx23100/101/102 USB video capture devices
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci   Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#include "cx231xx.h"
1162306a36Sopenharmony_ci#include "cx231xx-conf-reg.h"
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cistatic unsigned int pcb_debug;
1462306a36Sopenharmony_cimodule_param(pcb_debug, int, 0644);
1562306a36Sopenharmony_ciMODULE_PARM_DESC(pcb_debug, "enable pcb config debug messages [video]");
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci/******************************************************************************/
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cistatic struct pcb_config cx231xx_Scenario[] = {
2062306a36Sopenharmony_ci	{
2162306a36Sopenharmony_ci	 INDEX_SELFPOWER_DIGITAL_ONLY,	/* index */
2262306a36Sopenharmony_ci	 USB_SELF_POWER,	/* power_type */
2362306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
2462306a36Sopenharmony_ci	 MOD_DIGITAL,		/* mode */
2562306a36Sopenharmony_ci	 SOURCE_TS_BDA,		/* ts1_source, digital tv only */
2662306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts2_source  */
2762306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* analog source */
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci	 0,			/* digital_index  */
3062306a36Sopenharmony_ci	 0,			/* analog index */
3162306a36Sopenharmony_ci	 0,			/* dif_index   */
3262306a36Sopenharmony_ci	 0,			/* external_index */
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci	 1,			/* only one configuration */
3562306a36Sopenharmony_ci	 {
3662306a36Sopenharmony_ci	  {
3762306a36Sopenharmony_ci	   0,			/* config index */
3862306a36Sopenharmony_ci	   {
3962306a36Sopenharmony_ci	    0,			/* interrupt ep index */
4062306a36Sopenharmony_ci	    1,			/* ts1 index */
4162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
4262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* AUDIO */
4362306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VIDEO */
4462306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
4562306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
4662306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
4762306a36Sopenharmony_ci	    }
4862306a36Sopenharmony_ci	   ,
4962306a36Sopenharmony_ci	   }
5062306a36Sopenharmony_ci	  ,
5162306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
5262306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
5362306a36Sopenharmony_ci			   NOT_SUPPORTED}
5462306a36Sopenharmony_ci	   }
5562306a36Sopenharmony_ci	  ,
5662306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
5762306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
5862306a36Sopenharmony_ci			   NOT_SUPPORTED}
5962306a36Sopenharmony_ci	   }
6062306a36Sopenharmony_ci	  }
6162306a36Sopenharmony_ci	 ,
6262306a36Sopenharmony_ci	 /* full-speed config */
6362306a36Sopenharmony_ci	 {
6462306a36Sopenharmony_ci	  {
6562306a36Sopenharmony_ci	   0,			/* config index */
6662306a36Sopenharmony_ci	   {
6762306a36Sopenharmony_ci	    0,			/* interrupt ep index */
6862306a36Sopenharmony_ci	    1,			/* ts1 index */
6962306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
7062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* AUDIO */
7162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VIDEO */
7262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
7362306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
7462306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
7562306a36Sopenharmony_ci	    }
7662306a36Sopenharmony_ci	   }
7762306a36Sopenharmony_ci	  ,
7862306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
7962306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
8062306a36Sopenharmony_ci			   NOT_SUPPORTED}
8162306a36Sopenharmony_ci	   }
8262306a36Sopenharmony_ci	  ,
8362306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
8462306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
8562306a36Sopenharmony_ci			   NOT_SUPPORTED}
8662306a36Sopenharmony_ci	   }
8762306a36Sopenharmony_ci	  }
8862306a36Sopenharmony_ci	 }
8962306a36Sopenharmony_ci	,
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci	{
9262306a36Sopenharmony_ci	 INDEX_SELFPOWER_DUAL_DIGITAL,	/* index */
9362306a36Sopenharmony_ci	 USB_SELF_POWER,	/* power_type */
9462306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
9562306a36Sopenharmony_ci	 MOD_DIGITAL,		/* mode */
9662306a36Sopenharmony_ci	 SOURCE_TS_BDA,		/* ts1_source, digital tv only */
9762306a36Sopenharmony_ci	 0,			/* ts2_source,need update from register */
9862306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* analog source */
9962306a36Sopenharmony_ci	 0,			/* digital_index  */
10062306a36Sopenharmony_ci	 0,			/* analog index */
10162306a36Sopenharmony_ci	 0,			/* dif_index */
10262306a36Sopenharmony_ci	 0,			/* external_index */
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci	 1,			/* only one configuration */
10562306a36Sopenharmony_ci	 {
10662306a36Sopenharmony_ci	  {
10762306a36Sopenharmony_ci	   0,			/* config index */
10862306a36Sopenharmony_ci	   {
10962306a36Sopenharmony_ci	    0,			/* interrupt ep index */
11062306a36Sopenharmony_ci	    1,			/* ts1 index */
11162306a36Sopenharmony_ci	    2,			/* TS2 index */
11262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* AUDIO */
11362306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VIDEO */
11462306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
11562306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
11662306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
11762306a36Sopenharmony_ci	    }
11862306a36Sopenharmony_ci	   }
11962306a36Sopenharmony_ci	  ,
12062306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
12162306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
12262306a36Sopenharmony_ci			   NOT_SUPPORTED}
12362306a36Sopenharmony_ci	   }
12462306a36Sopenharmony_ci	  ,
12562306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
12662306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
12762306a36Sopenharmony_ci			   NOT_SUPPORTED}
12862306a36Sopenharmony_ci	   }
12962306a36Sopenharmony_ci	  }
13062306a36Sopenharmony_ci	 ,
13162306a36Sopenharmony_ci	 /* full-speed */
13262306a36Sopenharmony_ci	 {
13362306a36Sopenharmony_ci	  {
13462306a36Sopenharmony_ci	   0,			/* config index */
13562306a36Sopenharmony_ci	   {
13662306a36Sopenharmony_ci	    0,			/* interrupt ep index */
13762306a36Sopenharmony_ci	    1,			/* ts1 index */
13862306a36Sopenharmony_ci	    2,			/* TS2 index */
13962306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* AUDIO */
14062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VIDEO */
14162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
14262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
14362306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
14462306a36Sopenharmony_ci	    }
14562306a36Sopenharmony_ci	   }
14662306a36Sopenharmony_ci	  ,
14762306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
14862306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
14962306a36Sopenharmony_ci			   NOT_SUPPORTED}
15062306a36Sopenharmony_ci	   }
15162306a36Sopenharmony_ci	  ,
15262306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
15362306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
15462306a36Sopenharmony_ci			   NOT_SUPPORTED}
15562306a36Sopenharmony_ci	   }
15662306a36Sopenharmony_ci	  }
15762306a36Sopenharmony_ci	 }
15862306a36Sopenharmony_ci	,
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ci	{
16162306a36Sopenharmony_ci	 INDEX_SELFPOWER_ANALOG_ONLY,	/* index */
16262306a36Sopenharmony_ci	 USB_SELF_POWER,	/* power_type */
16362306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
16462306a36Sopenharmony_ci	 MOD_ANALOG | MOD_DIF | MOD_EXTERNAL,	/* mode ,analog tv only */
16562306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts1_source, NOT SUPPORT */
16662306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts2_source,NOT SUPPORT */
16762306a36Sopenharmony_ci	 0,			/* analog source, need update */
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci	 0,			/* digital_index  */
17062306a36Sopenharmony_ci	 0,			/* analog index */
17162306a36Sopenharmony_ci	 0,			/* dif_index */
17262306a36Sopenharmony_ci	 0,			/* external_index */
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci	 1,			/* only one configuration */
17562306a36Sopenharmony_ci	 {
17662306a36Sopenharmony_ci	  {
17762306a36Sopenharmony_ci	   0,			/* config index */
17862306a36Sopenharmony_ci	   {
17962306a36Sopenharmony_ci	    0,			/* interrupt ep index */
18062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* ts1 index */
18162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
18262306a36Sopenharmony_ci	    1,			/* AUDIO */
18362306a36Sopenharmony_ci	    2,			/* VIDEO */
18462306a36Sopenharmony_ci	    3,			/* VANC */
18562306a36Sopenharmony_ci	    4,			/* HANC */
18662306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
18762306a36Sopenharmony_ci	    }
18862306a36Sopenharmony_ci	   }
18962306a36Sopenharmony_ci	  ,
19062306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
19162306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
19262306a36Sopenharmony_ci			   NOT_SUPPORTED}
19362306a36Sopenharmony_ci	   }
19462306a36Sopenharmony_ci	  ,
19562306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
19662306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
19762306a36Sopenharmony_ci			   NOT_SUPPORTED}
19862306a36Sopenharmony_ci	   }
19962306a36Sopenharmony_ci	  }
20062306a36Sopenharmony_ci	 ,
20162306a36Sopenharmony_ci	 /* full-speed */
20262306a36Sopenharmony_ci	 {
20362306a36Sopenharmony_ci	  {
20462306a36Sopenharmony_ci	   0,			/* config index */
20562306a36Sopenharmony_ci	   {
20662306a36Sopenharmony_ci	    0,			/* interrupt ep index */
20762306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* ts1 index */
20862306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
20962306a36Sopenharmony_ci	    1,			/* AUDIO */
21062306a36Sopenharmony_ci	    2,			/* VIDEO */
21162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
21262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
21362306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
21462306a36Sopenharmony_ci	    }
21562306a36Sopenharmony_ci	   }
21662306a36Sopenharmony_ci	  ,
21762306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
21862306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
21962306a36Sopenharmony_ci			   NOT_SUPPORTED}
22062306a36Sopenharmony_ci	   }
22162306a36Sopenharmony_ci	  ,
22262306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
22362306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
22462306a36Sopenharmony_ci			   NOT_SUPPORTED}
22562306a36Sopenharmony_ci	   }
22662306a36Sopenharmony_ci	  }
22762306a36Sopenharmony_ci	 }
22862306a36Sopenharmony_ci	,
22962306a36Sopenharmony_ci
23062306a36Sopenharmony_ci	{
23162306a36Sopenharmony_ci	 INDEX_SELFPOWER_DUAL,	/* index */
23262306a36Sopenharmony_ci	 USB_SELF_POWER,	/* power_type */
23362306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
23462306a36Sopenharmony_ci	 /* mode ,analog tv and digital path */
23562306a36Sopenharmony_ci	 MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
23662306a36Sopenharmony_ci	 0,			/* ts1_source,will update in register */
23762306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts2_source,NOT SUPPORT */
23862306a36Sopenharmony_ci	 0,			/* analog source need update */
23962306a36Sopenharmony_ci	 0,			/* digital_index  */
24062306a36Sopenharmony_ci	 0,			/* analog index */
24162306a36Sopenharmony_ci	 0,			/* dif_index */
24262306a36Sopenharmony_ci	 0,			/* external_index */
24362306a36Sopenharmony_ci	 1,			/* only one configuration */
24462306a36Sopenharmony_ci	 {
24562306a36Sopenharmony_ci	  {
24662306a36Sopenharmony_ci	   0,			/* config index */
24762306a36Sopenharmony_ci	   {
24862306a36Sopenharmony_ci	    0,			/* interrupt ep index */
24962306a36Sopenharmony_ci	    1,			/* ts1 index */
25062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
25162306a36Sopenharmony_ci	    2,			/* AUDIO */
25262306a36Sopenharmony_ci	    3,			/* VIDEO */
25362306a36Sopenharmony_ci	    4,			/* VANC */
25462306a36Sopenharmony_ci	    5,			/* HANC */
25562306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
25662306a36Sopenharmony_ci	    }
25762306a36Sopenharmony_ci	   }
25862306a36Sopenharmony_ci	  ,
25962306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
26062306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
26162306a36Sopenharmony_ci			   NOT_SUPPORTED}
26262306a36Sopenharmony_ci	   }
26362306a36Sopenharmony_ci	  ,
26462306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
26562306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
26662306a36Sopenharmony_ci			   NOT_SUPPORTED}
26762306a36Sopenharmony_ci	   }
26862306a36Sopenharmony_ci	  }
26962306a36Sopenharmony_ci	 ,
27062306a36Sopenharmony_ci	 /* full-speed */
27162306a36Sopenharmony_ci	 {
27262306a36Sopenharmony_ci	  {
27362306a36Sopenharmony_ci	   0,			/* config index */
27462306a36Sopenharmony_ci	   {
27562306a36Sopenharmony_ci	    0,			/* interrupt ep index */
27662306a36Sopenharmony_ci	    1,			/* ts1 index */
27762306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
27862306a36Sopenharmony_ci	    2,			/* AUDIO */
27962306a36Sopenharmony_ci	    3,			/* VIDEO */
28062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
28162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
28262306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
28362306a36Sopenharmony_ci	    }
28462306a36Sopenharmony_ci	   }
28562306a36Sopenharmony_ci	  ,
28662306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
28762306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
28862306a36Sopenharmony_ci			   NOT_SUPPORTED}
28962306a36Sopenharmony_ci	   }
29062306a36Sopenharmony_ci	  ,
29162306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
29262306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
29362306a36Sopenharmony_ci			   NOT_SUPPORTED}
29462306a36Sopenharmony_ci	   }
29562306a36Sopenharmony_ci	  }
29662306a36Sopenharmony_ci	 }
29762306a36Sopenharmony_ci	,
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci	{
30062306a36Sopenharmony_ci	 INDEX_SELFPOWER_TRIPLE,	/* index */
30162306a36Sopenharmony_ci	 USB_SELF_POWER,	/* power_type */
30262306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
30362306a36Sopenharmony_ci	 /* mode ,analog tv and digital path */
30462306a36Sopenharmony_ci	 MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
30562306a36Sopenharmony_ci	 0,			/* ts1_source, update in register */
30662306a36Sopenharmony_ci	 0,			/* ts2_source,update in register */
30762306a36Sopenharmony_ci	 0,			/* analog source, need update */
30862306a36Sopenharmony_ci
30962306a36Sopenharmony_ci	 0,			/* digital_index  */
31062306a36Sopenharmony_ci	 0,			/* analog index */
31162306a36Sopenharmony_ci	 0,			/* dif_index */
31262306a36Sopenharmony_ci	 0,			/* external_index */
31362306a36Sopenharmony_ci	 1,			/* only one configuration */
31462306a36Sopenharmony_ci	 {
31562306a36Sopenharmony_ci	  {
31662306a36Sopenharmony_ci	   0,			/* config index */
31762306a36Sopenharmony_ci	   {
31862306a36Sopenharmony_ci	    0,			/* interrupt ep index */
31962306a36Sopenharmony_ci	    1,			/* ts1 index */
32062306a36Sopenharmony_ci	    2,			/* TS2 index */
32162306a36Sopenharmony_ci	    3,			/* AUDIO */
32262306a36Sopenharmony_ci	    4,			/* VIDEO */
32362306a36Sopenharmony_ci	    5,			/* VANC */
32462306a36Sopenharmony_ci	    6,			/* HANC */
32562306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
32662306a36Sopenharmony_ci	    }
32762306a36Sopenharmony_ci	   }
32862306a36Sopenharmony_ci	  ,
32962306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
33062306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
33162306a36Sopenharmony_ci			   NOT_SUPPORTED}
33262306a36Sopenharmony_ci	   }
33362306a36Sopenharmony_ci	  ,
33462306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
33562306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
33662306a36Sopenharmony_ci			   NOT_SUPPORTED}
33762306a36Sopenharmony_ci	   }
33862306a36Sopenharmony_ci	  }
33962306a36Sopenharmony_ci	 ,
34062306a36Sopenharmony_ci	 /* full-speed */
34162306a36Sopenharmony_ci	 {
34262306a36Sopenharmony_ci	  {
34362306a36Sopenharmony_ci	   0,			/* config index */
34462306a36Sopenharmony_ci	   {
34562306a36Sopenharmony_ci	    0,			/* interrupt ep index */
34662306a36Sopenharmony_ci	    1,			/* ts1 index */
34762306a36Sopenharmony_ci	    2,			/* TS2 index */
34862306a36Sopenharmony_ci	    3,			/* AUDIO */
34962306a36Sopenharmony_ci	    4,			/* VIDEO */
35062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
35162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
35262306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
35362306a36Sopenharmony_ci	    }
35462306a36Sopenharmony_ci	   }
35562306a36Sopenharmony_ci	  ,
35662306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
35762306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
35862306a36Sopenharmony_ci			   NOT_SUPPORTED}
35962306a36Sopenharmony_ci	   }
36062306a36Sopenharmony_ci	  ,
36162306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
36262306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
36362306a36Sopenharmony_ci			   NOT_SUPPORTED}
36462306a36Sopenharmony_ci	   }
36562306a36Sopenharmony_ci	  }
36662306a36Sopenharmony_ci	 }
36762306a36Sopenharmony_ci	,
36862306a36Sopenharmony_ci
36962306a36Sopenharmony_ci	{
37062306a36Sopenharmony_ci	 INDEX_SELFPOWER_COMPRESSOR,	/* index */
37162306a36Sopenharmony_ci	 USB_SELF_POWER,	/* power_type */
37262306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
37362306a36Sopenharmony_ci	 /* mode ,analog tv AND DIGITAL path */
37462306a36Sopenharmony_ci	 MOD_ANALOG | MOD_DIF | MOD_DIGITAL | MOD_EXTERNAL,
37562306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts1_source, disable */
37662306a36Sopenharmony_ci	 SOURCE_TS_BDA,		/* ts2_source */
37762306a36Sopenharmony_ci	 0,			/* analog source,need update */
37862306a36Sopenharmony_ci	 0,			/* digital_index  */
37962306a36Sopenharmony_ci	 0,			/* analog index */
38062306a36Sopenharmony_ci	 0,			/* dif_index */
38162306a36Sopenharmony_ci	 0,			/* external_index */
38262306a36Sopenharmony_ci	 1,			/* only one configuration */
38362306a36Sopenharmony_ci	 {
38462306a36Sopenharmony_ci	  {
38562306a36Sopenharmony_ci	   0,			/* config index */
38662306a36Sopenharmony_ci	   {
38762306a36Sopenharmony_ci	    0,			/* interrupt ep index */
38862306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* ts1 index */
38962306a36Sopenharmony_ci	    1,			/* TS2 index */
39062306a36Sopenharmony_ci	    2,			/* AUDIO */
39162306a36Sopenharmony_ci	    3,			/* VIDEO */
39262306a36Sopenharmony_ci	    4,			/* VANC */
39362306a36Sopenharmony_ci	    5,			/* HANC */
39462306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
39562306a36Sopenharmony_ci	    }
39662306a36Sopenharmony_ci	   }
39762306a36Sopenharmony_ci	  ,
39862306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
39962306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
40062306a36Sopenharmony_ci			   NOT_SUPPORTED}
40162306a36Sopenharmony_ci	   }
40262306a36Sopenharmony_ci	  ,
40362306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
40462306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
40562306a36Sopenharmony_ci			   NOT_SUPPORTED}
40662306a36Sopenharmony_ci	   }
40762306a36Sopenharmony_ci	  }
40862306a36Sopenharmony_ci	 ,
40962306a36Sopenharmony_ci	 /* full-speed  */
41062306a36Sopenharmony_ci	 {
41162306a36Sopenharmony_ci	  {
41262306a36Sopenharmony_ci	   0,			/* config index */
41362306a36Sopenharmony_ci	   {
41462306a36Sopenharmony_ci	    0,			/* interrupt ep index */
41562306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* ts1 index */
41662306a36Sopenharmony_ci	    1,			/* TS2 index */
41762306a36Sopenharmony_ci	    2,			/* AUDIO */
41862306a36Sopenharmony_ci	    3,			/* VIDEO */
41962306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
42062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
42162306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
42262306a36Sopenharmony_ci	    }
42362306a36Sopenharmony_ci	   }
42462306a36Sopenharmony_ci	  ,
42562306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
42662306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
42762306a36Sopenharmony_ci			   NOT_SUPPORTED}
42862306a36Sopenharmony_ci	   }
42962306a36Sopenharmony_ci	  ,
43062306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
43162306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
43262306a36Sopenharmony_ci			   NOT_SUPPORTED}
43362306a36Sopenharmony_ci	   }
43462306a36Sopenharmony_ci	  }
43562306a36Sopenharmony_ci	 }
43662306a36Sopenharmony_ci	,
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci	{
43962306a36Sopenharmony_ci	 INDEX_BUSPOWER_DIGITAL_ONLY,	/* index */
44062306a36Sopenharmony_ci	 USB_BUS_POWER,		/* power_type */
44162306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
44262306a36Sopenharmony_ci	 MOD_DIGITAL,		/* mode ,analog tv AND DIGITAL path */
44362306a36Sopenharmony_ci	 SOURCE_TS_BDA,		/* ts1_source, disable */
44462306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts2_source */
44562306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* analog source */
44662306a36Sopenharmony_ci
44762306a36Sopenharmony_ci	 0,			/* digital_index  */
44862306a36Sopenharmony_ci	 0,			/* analog index */
44962306a36Sopenharmony_ci	 0,			/* dif_index */
45062306a36Sopenharmony_ci	 0,			/* external_index */
45162306a36Sopenharmony_ci
45262306a36Sopenharmony_ci	 1,			/* only one configuration */
45362306a36Sopenharmony_ci	 {
45462306a36Sopenharmony_ci	  {
45562306a36Sopenharmony_ci	   0,			/* config index */
45662306a36Sopenharmony_ci	   {
45762306a36Sopenharmony_ci	    0,			/* interrupt ep index  = 2 */
45862306a36Sopenharmony_ci	    1,			/* ts1 index */
45962306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
46062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* AUDIO */
46162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VIDEO */
46262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
46362306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
46462306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
46562306a36Sopenharmony_ci	    }
46662306a36Sopenharmony_ci	   }
46762306a36Sopenharmony_ci	  ,
46862306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
46962306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
47062306a36Sopenharmony_ci			   NOT_SUPPORTED}
47162306a36Sopenharmony_ci	   }
47262306a36Sopenharmony_ci	  ,
47362306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
47462306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
47562306a36Sopenharmony_ci			   NOT_SUPPORTED}
47662306a36Sopenharmony_ci	   }
47762306a36Sopenharmony_ci	  }
47862306a36Sopenharmony_ci	 ,
47962306a36Sopenharmony_ci	 /* full-speed */
48062306a36Sopenharmony_ci	 {
48162306a36Sopenharmony_ci	  {
48262306a36Sopenharmony_ci	   0,			/* config index */
48362306a36Sopenharmony_ci	   {
48462306a36Sopenharmony_ci	    0,			/* interrupt ep index  = 2 */
48562306a36Sopenharmony_ci	    1,			/* ts1 index */
48662306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
48762306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* AUDIO */
48862306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VIDEO */
48962306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
49062306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
49162306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
49262306a36Sopenharmony_ci	    }
49362306a36Sopenharmony_ci	   }
49462306a36Sopenharmony_ci	  ,
49562306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
49662306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
49762306a36Sopenharmony_ci			   NOT_SUPPORTED}
49862306a36Sopenharmony_ci	   }
49962306a36Sopenharmony_ci	  ,
50062306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
50162306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
50262306a36Sopenharmony_ci			   NOT_SUPPORTED}
50362306a36Sopenharmony_ci	   }
50462306a36Sopenharmony_ci	  }
50562306a36Sopenharmony_ci	 }
50662306a36Sopenharmony_ci	,
50762306a36Sopenharmony_ci	{
50862306a36Sopenharmony_ci	 INDEX_BUSPOWER_ANALOG_ONLY,	/* index */
50962306a36Sopenharmony_ci	 USB_BUS_POWER,		/* power_type */
51062306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
51162306a36Sopenharmony_ci	 MOD_ANALOG,		/* mode ,analog tv AND DIGITAL path */
51262306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts1_source, disable */
51362306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts2_source */
51462306a36Sopenharmony_ci	 SOURCE_ANALOG,		/* analog source--analog */
51562306a36Sopenharmony_ci	 0,			/* digital_index  */
51662306a36Sopenharmony_ci	 0,			/* analog index */
51762306a36Sopenharmony_ci	 0,			/* dif_index */
51862306a36Sopenharmony_ci	 0,			/* external_index */
51962306a36Sopenharmony_ci	 1,			/* only one configuration */
52062306a36Sopenharmony_ci	 {
52162306a36Sopenharmony_ci	  {
52262306a36Sopenharmony_ci	   0,			/* config index */
52362306a36Sopenharmony_ci	   {
52462306a36Sopenharmony_ci	    0,			/* interrupt ep index */
52562306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* ts1 index */
52662306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
52762306a36Sopenharmony_ci	    1,			/* AUDIO */
52862306a36Sopenharmony_ci	    2,			/* VIDEO */
52962306a36Sopenharmony_ci	    3,			/* VANC */
53062306a36Sopenharmony_ci	    4,			/* HANC */
53162306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
53262306a36Sopenharmony_ci	    }
53362306a36Sopenharmony_ci	   }
53462306a36Sopenharmony_ci	  ,
53562306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
53662306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
53762306a36Sopenharmony_ci			   NOT_SUPPORTED}
53862306a36Sopenharmony_ci	   }
53962306a36Sopenharmony_ci	  ,
54062306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
54162306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
54262306a36Sopenharmony_ci			   NOT_SUPPORTED}
54362306a36Sopenharmony_ci	   }
54462306a36Sopenharmony_ci	  }
54562306a36Sopenharmony_ci	 ,
54662306a36Sopenharmony_ci	 {			/* full-speed */
54762306a36Sopenharmony_ci	  {
54862306a36Sopenharmony_ci	   0,			/* config index */
54962306a36Sopenharmony_ci	   {
55062306a36Sopenharmony_ci	    0,			/* interrupt ep index */
55162306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* ts1 index */
55262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
55362306a36Sopenharmony_ci	    1,			/* AUDIO */
55462306a36Sopenharmony_ci	    2,			/* VIDEO */
55562306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
55662306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
55762306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
55862306a36Sopenharmony_ci	    }
55962306a36Sopenharmony_ci	   }
56062306a36Sopenharmony_ci	  ,
56162306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
56262306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
56362306a36Sopenharmony_ci			   NOT_SUPPORTED}
56462306a36Sopenharmony_ci	   }
56562306a36Sopenharmony_ci	  ,
56662306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
56762306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
56862306a36Sopenharmony_ci			   NOT_SUPPORTED}
56962306a36Sopenharmony_ci	   }
57062306a36Sopenharmony_ci	  }
57162306a36Sopenharmony_ci	 }
57262306a36Sopenharmony_ci	,
57362306a36Sopenharmony_ci	{
57462306a36Sopenharmony_ci	 INDEX_BUSPOWER_DIF_ONLY,	/* index */
57562306a36Sopenharmony_ci	 USB_BUS_POWER,		/* power_type */
57662306a36Sopenharmony_ci	 0,			/* speed , not decide yet */
57762306a36Sopenharmony_ci	 /* mode ,analog tv AND DIGITAL path */
57862306a36Sopenharmony_ci	 MOD_DIF | MOD_ANALOG | MOD_DIGITAL | MOD_EXTERNAL,
57962306a36Sopenharmony_ci	 SOURCE_TS_BDA,		/* ts1_source, disable */
58062306a36Sopenharmony_ci	 NOT_SUPPORTED,		/* ts2_source */
58162306a36Sopenharmony_ci	 SOURCE_DIF | SOURCE_ANALOG | SOURCE_EXTERNAL,	/* analog source, dif */
58262306a36Sopenharmony_ci	 0,			/* digital_index  */
58362306a36Sopenharmony_ci	 0,			/* analog index */
58462306a36Sopenharmony_ci	 0,			/* dif_index */
58562306a36Sopenharmony_ci	 0,			/* external_index */
58662306a36Sopenharmony_ci	 1,			/* only one configuration */
58762306a36Sopenharmony_ci	 {
58862306a36Sopenharmony_ci	  {
58962306a36Sopenharmony_ci	   0,			/* config index */
59062306a36Sopenharmony_ci	   {
59162306a36Sopenharmony_ci	    0,			/* interrupt ep index */
59262306a36Sopenharmony_ci	    1,			/* ts1 index */
59362306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
59462306a36Sopenharmony_ci	    2,			/* AUDIO */
59562306a36Sopenharmony_ci	    3,			/* VIDEO */
59662306a36Sopenharmony_ci	    4,			/* VANC */
59762306a36Sopenharmony_ci	    5,			/* HANC */
59862306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
59962306a36Sopenharmony_ci	    }
60062306a36Sopenharmony_ci	   }
60162306a36Sopenharmony_ci	  ,
60262306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
60362306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
60462306a36Sopenharmony_ci			   NOT_SUPPORTED}
60562306a36Sopenharmony_ci	   }
60662306a36Sopenharmony_ci	  ,
60762306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
60862306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
60962306a36Sopenharmony_ci			   NOT_SUPPORTED}
61062306a36Sopenharmony_ci	   }
61162306a36Sopenharmony_ci	  }
61262306a36Sopenharmony_ci	 ,
61362306a36Sopenharmony_ci	 {			/* full speed */
61462306a36Sopenharmony_ci	  {
61562306a36Sopenharmony_ci	   0,			/* config index */
61662306a36Sopenharmony_ci	   {
61762306a36Sopenharmony_ci	    0,			/* interrupt ep index */
61862306a36Sopenharmony_ci	    1,			/* ts1 index */
61962306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* TS2 index */
62062306a36Sopenharmony_ci	    2,			/* AUDIO */
62162306a36Sopenharmony_ci	    3,			/* VIDEO */
62262306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* VANC */
62362306a36Sopenharmony_ci	    NOT_SUPPORTED,	/* HANC */
62462306a36Sopenharmony_ci	    NOT_SUPPORTED	/* ir_index */
62562306a36Sopenharmony_ci	    }
62662306a36Sopenharmony_ci	   }
62762306a36Sopenharmony_ci	  ,
62862306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
62962306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
63062306a36Sopenharmony_ci			   NOT_SUPPORTED}
63162306a36Sopenharmony_ci	   }
63262306a36Sopenharmony_ci	  ,
63362306a36Sopenharmony_ci	  {NOT_SUPPORTED, {NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
63462306a36Sopenharmony_ci			   NOT_SUPPORTED, NOT_SUPPORTED, NOT_SUPPORTED,
63562306a36Sopenharmony_ci			   NOT_SUPPORTED}
63662306a36Sopenharmony_ci	   }
63762306a36Sopenharmony_ci	  }
63862306a36Sopenharmony_ci	 }
63962306a36Sopenharmony_ci	,
64062306a36Sopenharmony_ci
64162306a36Sopenharmony_ci};
64262306a36Sopenharmony_ci
64362306a36Sopenharmony_ci/*****************************************************************/
64462306a36Sopenharmony_ci
64562306a36Sopenharmony_ciint initialize_cx231xx(struct cx231xx *dev)
64662306a36Sopenharmony_ci{
64762306a36Sopenharmony_ci	int retval;
64862306a36Sopenharmony_ci	u32 config_info = 0;
64962306a36Sopenharmony_ci	struct pcb_config *p_pcb_info;
65062306a36Sopenharmony_ci	u8 usb_speed = 1;	/* from register,1--HS, 0--FS  */
65162306a36Sopenharmony_ci	u8 data[4] = { 0, 0, 0, 0 };
65262306a36Sopenharmony_ci	u32 ts1_source = 0;
65362306a36Sopenharmony_ci	u32 ts2_source = 0;
65462306a36Sopenharmony_ci	u32 analog_source = 0;
65562306a36Sopenharmony_ci	u8 _current_scenario_idx = 0xff;
65662306a36Sopenharmony_ci
65762306a36Sopenharmony_ci	ts1_source = SOURCE_TS_BDA;
65862306a36Sopenharmony_ci	ts2_source = SOURCE_TS_BDA;
65962306a36Sopenharmony_ci
66062306a36Sopenharmony_ci	/* read board config register to find out which
66162306a36Sopenharmony_ci	pcb config it is related to */
66262306a36Sopenharmony_ci	retval = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, BOARD_CFG_STAT,
66362306a36Sopenharmony_ci				       data, 4);
66462306a36Sopenharmony_ci	if (retval < 0)
66562306a36Sopenharmony_ci		return retval;
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci	config_info = le32_to_cpu(*((__le32 *)data));
66862306a36Sopenharmony_ci	usb_speed = (u8) (config_info & 0x1);
66962306a36Sopenharmony_ci
67062306a36Sopenharmony_ci	/* Verify this device belongs to Bus power or Self power device */
67162306a36Sopenharmony_ci	if (config_info & BUS_POWER) {	/* bus-power */
67262306a36Sopenharmony_ci		switch (config_info & BUSPOWER_MASK) {
67362306a36Sopenharmony_ci		case TS1_PORT | BUS_POWER:
67462306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY].speed =
67562306a36Sopenharmony_ci			    usb_speed;
67662306a36Sopenharmony_ci			p_pcb_info =
67762306a36Sopenharmony_ci			    &cx231xx_Scenario[INDEX_BUSPOWER_DIGITAL_ONLY];
67862306a36Sopenharmony_ci			_current_scenario_idx = INDEX_BUSPOWER_DIGITAL_ONLY;
67962306a36Sopenharmony_ci			break;
68062306a36Sopenharmony_ci		case AVDEC_ENABLE | BUS_POWER:
68162306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY].speed =
68262306a36Sopenharmony_ci			    usb_speed;
68362306a36Sopenharmony_ci			p_pcb_info =
68462306a36Sopenharmony_ci			    &cx231xx_Scenario[INDEX_BUSPOWER_ANALOG_ONLY];
68562306a36Sopenharmony_ci			_current_scenario_idx = INDEX_BUSPOWER_ANALOG_ONLY;
68662306a36Sopenharmony_ci			break;
68762306a36Sopenharmony_ci		case AVDEC_ENABLE | BUS_POWER | TS1_PORT:
68862306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY].speed =
68962306a36Sopenharmony_ci			    usb_speed;
69062306a36Sopenharmony_ci			p_pcb_info = &cx231xx_Scenario[INDEX_BUSPOWER_DIF_ONLY];
69162306a36Sopenharmony_ci			_current_scenario_idx = INDEX_BUSPOWER_DIF_ONLY;
69262306a36Sopenharmony_ci			break;
69362306a36Sopenharmony_ci		default:
69462306a36Sopenharmony_ci			dev_err(dev->dev,
69562306a36Sopenharmony_ci				"bad config in buspower!!!!\nconfig_info=%x\n",
69662306a36Sopenharmony_ci				config_info & BUSPOWER_MASK);
69762306a36Sopenharmony_ci			return 1;
69862306a36Sopenharmony_ci		}
69962306a36Sopenharmony_ci	} else {		/* self-power */
70062306a36Sopenharmony_ci
70162306a36Sopenharmony_ci		switch (config_info & SELFPOWER_MASK) {
70262306a36Sopenharmony_ci		case TS1_PORT | SELF_POWER:
70362306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY].speed =
70462306a36Sopenharmony_ci			    usb_speed;
70562306a36Sopenharmony_ci			p_pcb_info =
70662306a36Sopenharmony_ci			    &cx231xx_Scenario[INDEX_SELFPOWER_DIGITAL_ONLY];
70762306a36Sopenharmony_ci			_current_scenario_idx = INDEX_SELFPOWER_DIGITAL_ONLY;
70862306a36Sopenharmony_ci			break;
70962306a36Sopenharmony_ci		case TS1_TS2_PORT | SELF_POWER:
71062306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].speed =
71162306a36Sopenharmony_ci			    usb_speed;
71262306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL].
71362306a36Sopenharmony_ci			    ts2_source = ts2_source;
71462306a36Sopenharmony_ci			p_pcb_info =
71562306a36Sopenharmony_ci			    &cx231xx_Scenario[INDEX_SELFPOWER_DUAL_DIGITAL];
71662306a36Sopenharmony_ci			_current_scenario_idx = INDEX_SELFPOWER_DUAL_DIGITAL;
71762306a36Sopenharmony_ci			break;
71862306a36Sopenharmony_ci		case AVDEC_ENABLE | SELF_POWER:
71962306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].speed =
72062306a36Sopenharmony_ci			    usb_speed;
72162306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY].
72262306a36Sopenharmony_ci			    analog_source = analog_source;
72362306a36Sopenharmony_ci			p_pcb_info =
72462306a36Sopenharmony_ci			    &cx231xx_Scenario[INDEX_SELFPOWER_ANALOG_ONLY];
72562306a36Sopenharmony_ci			_current_scenario_idx = INDEX_SELFPOWER_ANALOG_ONLY;
72662306a36Sopenharmony_ci			break;
72762306a36Sopenharmony_ci		case AVDEC_ENABLE | TS1_PORT | SELF_POWER:
72862306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_DUAL].speed =
72962306a36Sopenharmony_ci			    usb_speed;
73062306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_DUAL].ts1_source =
73162306a36Sopenharmony_ci			    ts1_source;
73262306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_DUAL].analog_source =
73362306a36Sopenharmony_ci			    analog_source;
73462306a36Sopenharmony_ci			p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_DUAL];
73562306a36Sopenharmony_ci			_current_scenario_idx = INDEX_SELFPOWER_DUAL;
73662306a36Sopenharmony_ci			break;
73762306a36Sopenharmony_ci		case AVDEC_ENABLE | TS1_TS2_PORT | SELF_POWER:
73862306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].speed =
73962306a36Sopenharmony_ci			    usb_speed;
74062306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts1_source =
74162306a36Sopenharmony_ci			    ts1_source;
74262306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].ts2_source =
74362306a36Sopenharmony_ci			    ts2_source;
74462306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE].analog_source =
74562306a36Sopenharmony_ci			    analog_source;
74662306a36Sopenharmony_ci			p_pcb_info = &cx231xx_Scenario[INDEX_SELFPOWER_TRIPLE];
74762306a36Sopenharmony_ci			_current_scenario_idx = INDEX_SELFPOWER_TRIPLE;
74862306a36Sopenharmony_ci			break;
74962306a36Sopenharmony_ci		case AVDEC_ENABLE | TS1VIP_TS2_PORT | SELF_POWER:
75062306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].speed =
75162306a36Sopenharmony_ci			    usb_speed;
75262306a36Sopenharmony_ci			cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR].
75362306a36Sopenharmony_ci			    analog_source = analog_source;
75462306a36Sopenharmony_ci			p_pcb_info =
75562306a36Sopenharmony_ci			    &cx231xx_Scenario[INDEX_SELFPOWER_COMPRESSOR];
75662306a36Sopenharmony_ci			_current_scenario_idx = INDEX_SELFPOWER_COMPRESSOR;
75762306a36Sopenharmony_ci			break;
75862306a36Sopenharmony_ci		default:
75962306a36Sopenharmony_ci			dev_err(dev->dev,
76062306a36Sopenharmony_ci				"bad scenario!!!!!\nconfig_info=%x\n",
76162306a36Sopenharmony_ci				config_info & SELFPOWER_MASK);
76262306a36Sopenharmony_ci			return -ENODEV;
76362306a36Sopenharmony_ci		}
76462306a36Sopenharmony_ci	}
76562306a36Sopenharmony_ci
76662306a36Sopenharmony_ci	dev->current_scenario_idx = _current_scenario_idx;
76762306a36Sopenharmony_ci
76862306a36Sopenharmony_ci	memcpy(&dev->current_pcb_config, p_pcb_info,
76962306a36Sopenharmony_ci		   sizeof(struct pcb_config));
77062306a36Sopenharmony_ci
77162306a36Sopenharmony_ci	if (pcb_debug) {
77262306a36Sopenharmony_ci		dev_info(dev->dev,
77362306a36Sopenharmony_ci			 "SC(0x00) register = 0x%x\n", config_info);
77462306a36Sopenharmony_ci		dev_info(dev->dev,
77562306a36Sopenharmony_ci			 "scenario %d\n",
77662306a36Sopenharmony_ci			 (dev->current_pcb_config.index) + 1);
77762306a36Sopenharmony_ci		dev_info(dev->dev,
77862306a36Sopenharmony_ci			"type=%x\n",
77962306a36Sopenharmony_ci			 dev->current_pcb_config.type);
78062306a36Sopenharmony_ci		dev_info(dev->dev,
78162306a36Sopenharmony_ci			 "mode=%x\n",
78262306a36Sopenharmony_ci			 dev->current_pcb_config.mode);
78362306a36Sopenharmony_ci		dev_info(dev->dev,
78462306a36Sopenharmony_ci			 "speed=%x\n",
78562306a36Sopenharmony_ci			 dev->current_pcb_config.speed);
78662306a36Sopenharmony_ci		dev_info(dev->dev,
78762306a36Sopenharmony_ci			 "ts1_source=%x\n",
78862306a36Sopenharmony_ci			 dev->current_pcb_config.ts1_source);
78962306a36Sopenharmony_ci		dev_info(dev->dev,
79062306a36Sopenharmony_ci			 "ts2_source=%x\n",
79162306a36Sopenharmony_ci			 dev->current_pcb_config.ts2_source);
79262306a36Sopenharmony_ci		dev_info(dev->dev,
79362306a36Sopenharmony_ci			 "analog_source=%x\n",
79462306a36Sopenharmony_ci			 dev->current_pcb_config.analog_source);
79562306a36Sopenharmony_ci	}
79662306a36Sopenharmony_ci
79762306a36Sopenharmony_ci	return 0;
79862306a36Sopenharmony_ci}
799