/*
* Programming the mspx4xx sound processor family
*
* (c) 1997-2001 Gerd Knorr <kraxel@bytesex.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/freezer.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <media/msp3400.h>
#include <linux/kthread.h>
#include <linux/suspend.h>
#include "msp3400-driver.h"
/* this one uses the automatic sound standard detection of newer msp34xx
chip versions */
static struct {
int retval;
int main, second;
char *name;
v4l2_std_id std;
} msp_stdlist[] = {
{ 0x0000, 0, 0, "could not detect sound standard", V4L2_STD_ALL },
{ 0x0001, 0, 0, "autodetect start", V4L2_STD_ALL },
{ 0x0002, MSP_CARRIER(4.5), MSP_CARRIER(4.72),
"4.5/4.72 M Dual FM-Stereo", V4L2_STD_MN },
{ 0x0003, MSP_CARRIER(5.5), MSP_CARRIER(5.7421875),
"5.5/5.74 B/G Dual FM-Stereo", V4L2_STD_BG },
{ 0x0004, MSP_CARRIER(6.5), MSP_CARRIER(6.2578125),
"6.5/6.25 D/K1 Dual FM-Stereo", V4L2_STD_DK },
{ 0x0005, MSP_CARRIER(6.5), MSP_CARRIER(6.7421875),
"6.5/6.74 D/K2 Dual FM-Stereo", V4L2_STD_DK },
{ 0x0006, MSP_CARRIER(6.5), MSP_CARRIER(6.5),
"6.5 D/K FM-Mono (HDEV3)", V4L2_STD_DK },
{ 0x0007, MSP_CARRIER(6.5), MSP_CARRIER(5.7421875),
"6.5/5.74 D/K3 Dual FM-Stereo", V4L2_STD_DK },
{ 0x0008, MSP_CARRIER(5.5), MSP_CARRIER(5.85),
"5.5/5.85 B/G NICAM FM", V4L2_STD_BG },
{ 0x0009, MSP_CARRIER(6.5), MSP_CARRIER(5.85),
"6.5/5.85 L NICAM AM", V4L2_STD_L },
{ 0x000a, MSP_CARRIER(6.0), MSP_CARRIER(6.55),
"6.0/6.55 I NICAM FM", V4L2_STD_PAL_I },
{ 0x000b, MSP_CARRIER(6.5), MSP_CARRIER(5.85),
"6.5/5.85 D/K NICAM FM", V4L2_STD_DK },
{ 0x000c, MSP_CARRIER(6.5), MSP_CARRIER(5.85),
"6.5/5.85 D/K NICAM FM (HDEV2)", V4L2_STD_DK },
{ 0x000d, MSP_CARRIER(6.5), MSP_CARRIER(5.85),
"6.5/5.85 D/K NICAM FM (HDEV3)", V4L2_STD_DK },
{ 0x0020, MSP_CARRIER(4.5), MSP_CARRIER(4.5),
"4.5 M BTSC-Stereo", V4L2_STD_MTS },
{ 0x0021, MSP_CARRIER(4.5), MSP_CARRIER(4.5),
"4.5 M BTSC-Mono + SAP", V4L2_STD_MTS },
{ 0x0030, MSP_CARRIER(4.5), MSP_CARRIER(4.5),
"4.5 M EIA-J Japan Stereo", V4L2_STD_NTSC_M_JP },
{ 0x0040, MSP_CARRIER(10.7), MSP_CARRIER(10.7),
"10.7 FM-Stereo Radio", V4L2_STD_ALL },
{ 0x0050, MSP_CARRIER(6.5), MSP_CARRIER(6.5),
"6.5 SAT-Mono", V4L2_STD_ALL },
{ 0x0051, MSP_CARRIER(7.02), MSP_CARRIER(7.20),
"7.02/7.20 SAT-Stereo", V4L2_STD_ALL },
{ 0x0060, MSP_CARRIER(7.2), MSP_CARRIER(7.2),
"7.2 SAT ADR", V4L2_STD_ALL },
{ -1, 0, 0, NULL, 0 }, /* EOF */
};
static struct msp3400c_init_data_dem {
int