[media] media: i2c: max2175: Add MAX2175 support

This patch adds driver support for the MAX2175 chip. This is Maxim
Integrated's RF to Bits tuner front end chip designed for software-defined
radio solutions. This driver exposes the tuner as a sub-device instance
with standard and custom controls to configure the device.

Signed-off-by: Ramesh Shanmugasundaram <ramesh.shanmugasundaram@bp.renesas.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
This commit is contained in:
Ramesh Shanmugasundaram 2017-06-13 09:54:47 -03:00 committed by Mauro Carvalho Chehab
parent a45509c080
commit b47b79d8a2
7 changed files with 1667 additions and 0 deletions

View File

@ -42,6 +42,7 @@ For more details see the file COPYING in the source distribution of Linux.
davinci-vpbe
fimc
ivtv
max2175
meye
omap3isp
omap4_camera

View File

@ -0,0 +1,62 @@
Maxim Integrated MAX2175 RF to bits tuner driver
================================================
The MAX2175 driver implements the following driver-specific controls:
``V4L2_CID_MAX2175_I2S_ENABLE``
-------------------------------
Enable/Disable I2S output of the tuner. This is a private control
that can be accessed only using the subdev interface.
Refer to Documentation/media/kapi/v4l2-controls for more details.
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 4
* - ``(0)``
- I2S output is disabled.
* - ``(1)``
- I2S output is enabled.
``V4L2_CID_MAX2175_HSLS``
-------------------------
The high-side/low-side (HSLS) control of the tuner for a given band.
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 4
* - ``(0)``
- The LO frequency position is below the desired frequency.
* - ``(1)``
- The LO frequency position is above the desired frequency.
``V4L2_CID_MAX2175_RX_MODE (menu)``
-----------------------------------
The Rx mode controls a number of preset parameters of the tuner like
sample clock (sck), sampling rate etc. These multiple settings are
provided under one single label called Rx mode in the datasheet. The
list below shows the supported modes with a brief description.
.. flat-table::
:header-rows: 0
:stub-columns: 0
:widths: 1 4
* - ``"Europe modes"``
* - ``"FM 1.2" (0)``
- This configures FM band with a sample rate of 0.512 million
samples/sec with a 10.24 MHz sck.
* - ``"DAB 1.2" (1)``
- This configures VHF band with a sample rate of 2.048 million
samples/sec with a 32.768 MHz sck.
* - ``"North America modes"``
* - ``"FM 1.0" (0)``
- This configures FM band with a sample rate of 0.7441875 million
samples/sec with a 14.88375 MHz sck.
* - ``"DAB 1.2" (1)``
- This configures FM band with a sample rate of 0.372 million
samples/sec with a 7.441875 MHz sck.

View File

@ -796,6 +796,18 @@ config VIDEO_SAA6752HS
To compile this driver as a module, choose M here: the
module will be called saa6752hs.
comment "SDR tuner chips"
config SDR_MAX2175
tristate "Maxim 2175 RF to Bits tuner"
depends on VIDEO_V4L2 && MEDIA_SDR_SUPPORT && I2C
---help---
Support for Maxim 2175 tuner. It is an advanced analog/digital
radio receiver with RF-to-Bits front-end designed for SDR solutions.
To compile this driver as a module, choose M here; the
module will be called max2175.
comment "Miscellaneous helper chips"
config VIDEO_THS7303

View File

@ -86,3 +86,5 @@ obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o
obj-$(CONFIG_VIDEO_OV2659) += ov2659.o
obj-$(CONFIG_VIDEO_TC358743) += tc358743.o
obj-$(CONFIG_SDR_MAX2175) += max2175.o

1453
drivers/media/i2c/max2175.c Normal file

File diff suppressed because it is too large Load Diff

109
drivers/media/i2c/max2175.h Normal file
View File

@ -0,0 +1,109 @@
/*
* Maxim Integrated MAX2175 RF to Bits tuner driver
*
* This driver & most of the hard coded values are based on the reference
* application delivered by Maxim for this device.
*
* Copyright (C) 2016 Maxim Integrated Products
* Copyright (C) 2017 Renesas Electronics Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* 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.
*/
#ifndef __MAX2175_H__
#define __MAX2175_H__
#define MAX2175_EU_XTAL_FREQ 36864000 /* In Hz */
#define MAX2175_NA_XTAL_FREQ 40186125 /* In Hz */
enum max2175_region {
MAX2175_REGION_EU = 0, /* Europe */
MAX2175_REGION_NA, /* North America */
};
enum max2175_band {
MAX2175_BAND_AM = 0,
MAX2175_BAND_FM,
MAX2175_BAND_VHF,
MAX2175_BAND_L,
};
enum max2175_eu_mode {
/* EU modes */
MAX2175_EU_FM_1_2 = 0,
MAX2175_DAB_1_2,
/*
* Other possible modes to add in future
* MAX2175_DAB_1_0,
* MAX2175_DAB_1_3,
* MAX2175_EU_FM_2_2,
* MAX2175_EU_FMHD_4_0,
* MAX2175_EU_AM_1_0,
* MAX2175_EU_AM_2_2,
*/
};
enum max2175_na_mode {
/* NA modes */
MAX2175_NA_FM_1_0 = 0,
MAX2175_NA_FM_2_0,
/*
* Other possible modes to add in future
* MAX2175_NA_FMHD_1_0,
* MAX2175_NA_FMHD_1_2,
* MAX2175_NA_AM_1_0,
* MAX2175_NA_AM_1_2,
*/
};
/* Supported I2S modes */
enum {
MAX2175_I2S_MODE0 = 0,
MAX2175_I2S_MODE1,
MAX2175_I2S_MODE2,
MAX2175_I2S_MODE3,
MAX2175_I2S_MODE4,
};
/* Coefficient table groups */
enum {
MAX2175_CH_MSEL = 0,
MAX2175_EQ_MSEL,
MAX2175_AA_MSEL,
};
/* HSLS LO injection polarity */
enum {
MAX2175_LO_BELOW_DESIRED = 0,
MAX2175_LO_ABOVE_DESIRED,
};
/* Channel FSM modes */
enum max2175_csm_mode {
MAX2175_LOAD_TO_BUFFER = 0,
MAX2175_PRESET_TUNE,
MAX2175_SEARCH,
MAX2175_AF_UPDATE,
MAX2175_JUMP_FAST_TUNE,
MAX2175_CHECK,
MAX2175_LOAD_AND_SWAP,
MAX2175_END,
MAX2175_BUFFER_PLUS_PRESET_TUNE,
MAX2175_BUFFER_PLUS_SEARCH,
MAX2175_BUFFER_PLUS_AF_UPDATE,
MAX2175_BUFFER_PLUS_JUMP_FAST_TUNE,
MAX2175_BUFFER_PLUS_CHECK,
MAX2175_BUFFER_PLUS_LOAD_AND_SWAP,
MAX2175_NO_ACTION
};
#endif /* __MAX2175_H__ */

View File

@ -0,0 +1,28 @@
/*
* max2175.h
*
* Maxim Integrated MAX2175 RF to Bits tuner driver - user space header file.
*
* Copyright (C) 2016 Maxim Integrated Products
* Copyright (C) 2017 Renesas Electronics Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* 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.
*/
#ifndef __UAPI_MAX2175_H_
#define __UAPI_MAX2175_H_
#include <linux/v4l2-controls.h>
#define V4L2_CID_MAX2175_I2S_ENABLE (V4L2_CID_USER_MAX217X_BASE + 0x01)
#define V4L2_CID_MAX2175_HSLS (V4L2_CID_USER_MAX217X_BASE + 0x02)
#define V4L2_CID_MAX2175_RX_MODE (V4L2_CID_USER_MAX217X_BASE + 0x03)
#endif /* __UAPI_MAX2175_H_ */