msm: demod_wrapper: Add driver for Demod wrapper block on mpq8092

Demod wrapper driver configures and initializes paths in demod wrapper.
Demod wrapper HW components should be configured according to requested
signal path type.

Change-Id: I4c302d9a2733406da7965fe59ab47feb6723445a
Signed-off-by: Daria Botvinsky <dariabb@codeaurora.org>
This commit is contained in:
Daria Botvinsky 2013-11-18 16:57:15 +02:00
parent b2603ebd6f
commit 105e1e245e
7 changed files with 3313 additions and 0 deletions

View File

@ -0,0 +1,142 @@
Introduction
============
Demod wrapper is used for TV signals receptions and include several
hardware components as can be seen in the following scheme:
+-------+ ++------------->
Satellite | | TSIF | +-------+
Tuner +--------+ +----+ |UCCP330|+--------------+-->|TS-BRG |+->
Signal-->| ADC0 ++----->|RXFE|+--->|Demod | +-------+ +-------+
+--------+ ++->|IMG | | |+->|Resamp.|+--+
| +----+ | | +-------+ +
| +-------+ |
ATV&DTV +--------+ + |
Tuner -->| ADC1 |+--+ + SIF+CVBS
Signal +--------+ + +-------------->
| +-------+ + To Albacore
| | | |
| +----+ |FORZA | |
External +--------+ ++->|RXFE|+--->|Demod | +-------+ +
ATV -->| ADC2 |+----->|ATV |+-+ | |+->|Resamp.|+--+
Receiver +--------+ +----+ + | | +-------+ |
Signal | +-------+ +
+--------------------------+
The driver controls and navigates Analog TV (atv) or Digital TV (dtv) signal
throughout the demod wrapper hardware components (Forza and UCCP330 are
not under the demod wrapper driver scope).
Demod wrapper driver configures the units under its responsibility.
The functionality of configuring the units should belong to a single driver
because this driver encapsulates all the knowledge and management needed for
such a complicated configuration.
Other drivers interacts with this driver in the following way:
* UCCP330 demod and Forza demod drivers use the demod wrapper driver as
part of the demodulate operation.
* External receivers use the demod wrapper driver to filter their output
signals.
* Topology driver uses the demod wrapper driver to configure the ts-bridge.
Hardware description
====================
The demod wrapper consists from the following hardware components:
- ADC - analog to digital convertor.
- RXFE components - filters signal.
- Resamplers for analog signals.
- TS bridge - navigates TSIF output.
- UCCP330 Demod - has a separate driver.
- Forza Demod - has a separate driver.
The demod wrapper driver sets all the clocks needed to activate the
components under its responsibility.
The dependency drivers will use deferred probing to ensure the correct
initialization order.
Software description
====================
The driver encapsulates the activation and configuration of the components
in the demod wrapper.
The paths of the signal that enters the demod wrapper are divided to
functional paths:
- Forza path - signal is navigated from ADC1 -> RXFE_ATV -> FORZA Demod ->
Resample -> SIF+CVBS output
- UCCP330 Satellite path - signal is navigated from ADC0 -> RXFE_IMG ->
TSIF output (may or may not pass the TS-BRIDGE)
- UCCP330 Terrestrial/Cable path - signal is navigated from ADC1 ->
RXFE_IMG -> TSIF output (may or may not pass the TS-BRIDGE)
- external atv path - signal is navigated from ADC2 -> RXFE_ATV ->
SIF+CVBS output
The user of the demod wrapper driver can activate the desired path.
The driver knows for each chosen functional path to configure its units
to allow the expected signal flow.
The only paths that can operate in parallel are:
* external atv path with UCCP330 Satellite path.
* external atv path with UCCP330 Terrestrial/Cable path.
All the other options are mutually exclusive: if one of those paths is
active, a set path request for the other will
override the previous path.
The driver is protected from concurrent requests by using a mutex.
Design
======
The demod wrapper driver is a regular Linux platform driver designed to support
the needed functionality of the HW components in demod wrapper block available
on specific SoCs.
Subsystem Restart (SSR)
=======================
The hardware IP does not have any firmware and therefore SSR support is not requried.
Interface
=========
The driver exposes an api to user space.
The driver creates device at /dev/demod_wrapper.
The api is:
- open
- close
- ioctl
DEMOD_WRAPPER_SET_PATH - configures a signal path (used for all paths
types except UCCP330 Satellite path)
DEMOD_WRAPPER_SET_PATH_UCCP330_SAT - configures a signal path os type
UCCP330 Satellite path
DEMOD_WRAPPER_RELEASE_PATH - releases a specific path
DEMOD_WRAPPER_TS_BRIDGE_INIT - initializes ts bridge
DEMOD_WRAPPER_TS_BRIDGE_ENABLE - enables ts bridge
DEMOD_WRAPPER_TS_BRIDGE_DISABLE - disables ts bridge
The ioctl functions use different structures, as described below:
demod_wrapper_path_type:
- demod_wrapper_forza_atv
- demod_wrapper_uccp330_dtv_s
- demod_wrapper_uccp330_dtv_t_c
- demod_wrapper_ext_atv
demod_wrapper_baud_rate:
- demod_wrapper_narrow
- demod_wrapper_medium
- demod_wrapper_wide
demod_wrapper_ts_bridge:
- demod_wrapper_ts_serial
- demod_wrapper_ts_parallel
The driver exposes all the registers of the components in demod wrapper
via debugfs. You can find the registers in debugfs under demod_wrapper
directory.
Configuration Sequences
------------------------
Paths related call sequence :
1. set_path
2. release_path (optional)
Ts-bridge related call sequence:
1. bridge_init
2. bridge_enable
3. bridge_disable

View File

@ -0,0 +1,29 @@
Demod Wrapper - HW block in broadcast subsystem
The Demod wrapper block contains HW units that
are responsible for navigating and filtering an analog TV or
digital TV signal to integrated demodulators.
The driver supports the operation of those units and provides
a way to set and configure a desired signal path.
documentation: Documentation/arm/msm/demod_wrapper.txt.
The devicetree representation of the MSM_DEMOD_WRAPPER block should be:
Required properties:
- compatible: "qcom,msm-demod-wrapper"
- reg: physical memory base addresses and sizes for demod_wrapper.
- vdd-supply: power regulator (GDSC) supplying power to the broadcast subsystem.
- adc-supply: power regulator supplying power to adcs in the demod wrapper block.
Example :
dw: msm-demod-wrapper@fc600000 {
compatible = "qcom,msm-demod-wrapper";
reg = <0xfc600000 0xdd000>;
vdd-supply = <&gdsc_bcss>;
adc-supply = <&pma8084_l27>;
};

View File

@ -55,3 +55,13 @@ config TSC
CI: communication with the internal Conditional Access Module (CAM)
over Common Interface (CI).
This can also be compiled as a loadable module.
config DEMOD_WRAPPER
depends on ARCH_MPQ8092
tristate "Demod Wrapper (Part of broadcast HW block) Support"
---help---
The Demod wrapper block contains HW units that
are responsible for navigating and filtering an analog TV or
digital TV signal to integrated demodulators.
The driver supports the operation of those units and provides
a way to set and configure a desired signal path.

View File

@ -7,3 +7,5 @@ obj-$(CONFIG_TSPP2) += tspp2.o
obj-$(CONFIG_CI_BRIDGE_SPI) += ci-bridge-spi.o
obj-$(CONFIG_TSC) += tsc.o
obj-$(CONFIG_ENSIGMA_UCCP_330) += ensigma_uccp330.o
obj-$(CONFIG_DEMOD_WRAPPER) += demod_wrapper.o

File diff suppressed because it is too large Load Diff

View File

@ -224,6 +224,7 @@ header-y += kexec.h
header-y += keyboard.h
header-y += keyctl.h
header-y += ensigma_uccp330.h
header-y += demod_wrapper.h
ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/include/uapi/asm/kvm.h \
$(srctree)/arch/$(SRCARCH)/include/asm/kvm.h),)

View File

@ -0,0 +1,241 @@
#ifndef _DEMOD_WRAPPER_H_
#define _DEMOD_WRAPPER_H_
#include <linux/ioctl.h>
/**
* enum demod_wrapper_path_type -
* represents all the possible path types in demod wrapper.
* @demod_wrapper_forza_atv: a path for analog tv that passes through
* forza demod. This path type is for all analog standards supported by forza.
* @demod_wrapper_dtv_s: a path for digital tv that passes through
* digital demod. This path type is for satellite standards supported by
* this demod.
* @demod_wrapper_dtv_t_c: a path for digital tv that passes through
* digital demod. This path type is for terrestrial and cable standards
* supported by this demod.
* @demod_wrapper_ext_atv: a path for analog tv. The demod in this case is
* external and located outside the demod wrapper.
* @demod_wrapper_num_of_paths: number of path types.
*/
enum demod_wrapper_path_type {
DEMOD_WRAPPER_FORZA_ATV,
DEMOD_WRAPPER_DTV_S,
DEMOD_WRAPPER_DTV_T_C,
DEMOD_WRAPPER_EXT_ATV,
DEMOD_WRAPPER_NUM_OF_PATHS
};
/**
* enum demod_wrapper_power_mode -
* represents all the possible power modes of demod wrapper.
* @demod_wrapper_full_preformance: demod wrapper will operate in full
* performance mode.
* @demod_wrapper_num_of_power_modes: number of power modes.
*/
enum demod_wrapper_power_mode {
DEMOD_WRAPPER_FULL_PREFORMANCE,
DEMOD_WRAPPER_NUM_OF_POWER_MODES
};
/**
* enum demod_wrapper_baud_rate_mode -
* represents all the baud rate modes that are supported in dtv satellite paths.
* @demod_wrapper_narrow: narrow baud rate mode.
* @demod_wrapper_medium: medium baud rate mode.
* @demod_wrapper_wide: wide baud rate mode.
* @demod_wrapper_num_of_baud_rate_modes: number of baud_rate modes.
*/
enum demod_wrapper_baud_rate_mode {
DEMOD_WRAPPER_NARROW,
DEMOD_WRAPPER_MEDIUM,
DEMOD_WRAPPER_WIDE,
DEMOD_WRAPPER_NUM_OF_BAUD_RATE_MODES
};
/**
* enum demod_wrapper_pdm_num -
* represents the two pdms that exists in demod wrapper: pdm0 and pdm1.
* @demod_wrapper_pdm0:
* @demod_wrapper_pdm1:
*/
enum demod_wrapper_pdm_num {
DEMOD_WRAPPER_PDM0,
DEMOD_WRAPPER_PDM1
};
/**
* enum demod_wrapper_ts_bridge -
* represents the output types of the ts bridge.
* @demod_wrapper_ts_serial: output of ts bridge is serial.
* @demod_wrapper_ts_parallel: output of ts bridge is parallel.
*/
enum demod_wrapper_ts_bridge {
DEMOD_WRAPPER_TS_SERIAL,
DEMOD_WRAPPER_TS_PARALLEL
};
/**
* struct demod_wrapper_release_path_args -
* arguments to be passed to DEMOD_WRAPPER_RELEASE_PATH ioctl.
* @type: the type of the path to be released.
*/
struct demod_wrapper_release_path_args {
enum demod_wrapper_path_type type;
};
/**
* struct demod_wrapper_set_path_args -
* arguments to be passed to DEMOD_WRAPPER_SET_PATH ioctl.
* @type: the type of the path to set.
* @pdm: the number of the pdm that this path should work with.
* @power: the power mode that this path should work in.
* Note: if we want to set external_atv path there is no pdm
* involved so passing any value as pdm will be fine
*/
struct demod_wrapper_set_path_args {
enum demod_wrapper_path_type type;
enum demod_wrapper_pdm_num pdm;
enum demod_wrapper_power_mode power;
};
/**
* struct demod_wrapper_set_path_dtv_sat_args -
* arguments that should be passed to DEMOD_WRAPPER_SET_PATH_DTV_SAT
* ioctl.
* @pdm: the number of the pdm that dtv satellite path should work with.
* @power: the power mode that dtv satellite path should work in.
* @br_mode: baud rate parameter that is a specific paramter for dtv satellite,
* and indicates what is the baud rate of the satellite signal.
*/
struct demod_wrapper_set_path_dtv_sat_args {
enum demod_wrapper_pdm_num pdm;
enum demod_wrapper_power_mode power;
enum demod_wrapper_baud_rate_mode br_mode;
};
/**
* struct demod_wrapper_init_ts_bridge -
* argumants that should be passed to DEMOD_WRAPPER_TS_BRIDGE_INIT ioctl.
* @out: indicates if the output signal of the ts bridge is serial or parallel.
*/
struct demod_wrapper_init_ts_bridge_args {
enum demod_wrapper_ts_bridge out;
};
/**
* struct demod_wrapper_pm_set_params_args -
* argumants that should be passed to DEMOD_WRAPPER_PM_SET_PARAMS ioctl.
* @pm_loop_cntr: the value that will be set to BCDEM_REGS_PM_LOOP_CNTR register
* @pm_params_threshold: the value that will be set to
* BCDEM_REGS_PM_PARAMS_THRESHOLD
*/
struct demod_wrapper_pm_set_params_args {
unsigned int pm_loop_cntr;
unsigned int pm_params_threshold;
};
/**
* struct demod_wrapper_pm_get_thrshld_cntr_args -
* argumants that should be passed to DEMOD_WRAPPER_PM_GET_THRSHLD_CNTR ioctl.
* @pm_thrshld_cntr: the parameter will hold the value gotten from
* BCDEM_REGS_PM_RO_THRSHLD_CNTR
*/
struct demod_wrapper_pm_get_thr_cntr_args {
unsigned int pm_thrshld_cntr;
};
/**
* struct demod_wrapper_pm_get_power_args -
* argumants that should be passed to DEMOD_WRAPPER_PM_GET_POWER ioctl.
* @pm_power: the parameter will hold the value gotten from
* BCDEM_REGS_PM_RO_POWER
*/
struct demod_wrapper_pm_get_power_args {
unsigned int pm_power;
};
#define DEMOD_WRAPPER_BASIC_CMDS_NUM 1
/**
* ioctl cmd : DEMOD_WRAPPER_SET_PATH -
* Performs initialization and configuration of components
* in demod_wrapper that are needed for the requested path.
* If there is any path conflict - overrides.
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_SET_PATH _IOW(DEMOD_WRAPPER_BASIC_CMDS_NUM,\
1, struct demod_wrapper_set_path_args)
/**
* ioctl cmd : DEMOD_WRAPPER_SET_PATH_DTV_SAT -
* Performs initialization and configuration of components
* in demod_wrapper that are needed for dtv sat path.
* If there is any path conflict - overrides.
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_SET_PATH_DTV_SAT _IOW(\
DEMOD_WRAPPER_BASIC_CMDS_NUM, 2,\
struct demod_wrapper_set_path_dtv_sat_args)
/**
* ioctl cmd : DEMOD_WRAPPER_RELEASE_PATH -
* Releases the requested path.
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_RELEASE_PATH _IOW(DEMOD_WRAPPER_BASIC_CMDS_NUM,\
3, struct demod_wrapper_release_path_args)
/**
* ioctl cmd : DEMOD_WRAPPER_RELEASE_PATH -
* Sets the out of the ts-bridge according to received
* argument. Sets the in as parallel.
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_TS_BRIDGE_INIT _IOW(DEMOD_WRAPPER_BASIC_CMDS_NUM,\
4, struct demod_wrapper_init_ts_bridge_args)
/**
* ioctl cmd : DEMOD_WRAPPER_RELEASE_PATH -
* Enables the ts-bridge. If ts-bridge was'nt initialized
* (with DEMOD_WRAPPER_TS_BRIDGE_INIT) sets default values:
* in - parallel
* out - parallel
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_TS_BRIDGE_ENABLE _IO(DEMOD_WRAPPER_BASIC_CMDS_NUM, 5)
/**
* ioctl cmd : DEMOD_WRAPPER_RELEASE_PATH -
* Disables the ts-bridge.
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_TS_BRIDGE_DISABLE _IO(\
DEMOD_WRAPPER_BASIC_CMDS_NUM, 6)
/**
* ioctl cmd : DEMOD_WRAPPER_PM_SET_PARAMS -
* Sets values for BCDEM_REGS_PM_LOOP_CNTR and BCDEM_REGS_PM_PARAMS_THRESHOLD
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_PM_SET_PARAMS _IOW(DEMOD_WRAPPER_BASIC_CMDS_NUM,\
7, struct demod_wrapper_pm_set_params_args)
/**
* ioctl cmd : DEMOD_WRAPPER_PM_GET_THR_CNTR -
* Gets the value of the BCDEM_REGS_OM_RO_THRSHLD_CNTR
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_PM_GET_THRSHLD_CNTR _IOR(\
DEMOD_WRAPPER_BASIC_CMDS_NUM,\
8, struct demod_wrapper_pm_get_thr_cntr_args)
/**
* ioctl cmd : DEMOD_WRAPPER_PM_GET_POWER -
* Gets the value of the BCDEM_REGS_RO_POWER
* Returns 0 in success.
*/
#define DEMOD_WRAPPER_PM_GET_POWER _IOR(DEMOD_WRAPPER_BASIC_CMDS_NUM,\
9, struct demod_wrapper_pm_get_power_args)
#endif /* _DEMOD_WRAPPER_H_ */