From patchwork Thu Sep 2 15:57:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: raja_mani@ti.com X-Patchwork-Id: 149391 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o82EkNF5004248 for ; Thu, 2 Sep 2010 14:46:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755605Ab0IBOqa (ORCPT ); Thu, 2 Sep 2010 10:46:30 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:42288 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755576Ab0IBOqa (ORCPT ); Thu, 2 Sep 2010 10:46:30 -0400 Received: from dlep33.itg.ti.com ([157.170.170.112]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o82EkNhf018454 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Sep 2010 09:46:23 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dlep33.itg.ti.com (8.13.7/8.13.7) with ESMTP id o82Ek914000162; Thu, 2 Sep 2010 09:46:21 -0500 (CDT) From: raja_mani@ti.com To: hverkuil@xs4all.nl, linux-media@vger.kernel.org, mchehab@infradead.org Cc: matti.j.aaltonen@nokia.com, Raja Mani , Pramodh AG Subject: [RFC/PATCH 5/8] drivers:staging:ti-st: Code cleanup in FM Common module Date: Thu, 2 Sep 2010 11:57:57 -0400 Message-Id: <1283443080-30644-6-git-send-email-raja_mani@ti.com> X-Mailer: git-send-email 1.6.5 In-Reply-To: <1283443080-30644-5-git-send-email-raja_mani@ti.com> References: <1283443080-30644-1-git-send-email-raja_mani@ti.com> <1283443080-30644-2-git-send-email-raja_mani@ti.com> <1283443080-30644-3-git-send-email-raja_mani@ti.com> <1283443080-30644-4-git-send-email-raja_mani@ti.com> <1283443080-30644-5-git-send-email-raja_mani@ti.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Thu, 02 Sep 2010 14:46:40 +0000 (UTC) diff --git a/drivers/staging/ti-st/fmdrv_common.c b/drivers/staging/ti-st/fmdrv_common.c index 8152031..ec502b0 100644 --- a/drivers/staging/ti-st/fmdrv_common.c +++ b/drivers/staging/ti-st/fmdrv_common.c @@ -38,8 +38,7 @@ #include "fmdrv_common.h" #include "st.h" #include "fmdrv_rx.h" -/* TODO: Enable when FM TX is supported */ -/* #include "fmdrv_tx.h" */ +#include "fmdrv_tx.h" #ifndef DEBUG #ifdef pr_info @@ -188,6 +187,8 @@ static struct fm_reg_table fm_reg_info[] = { {0x51, REG_RD, "MS_GET"}, {0x52, REG_WR, "PS_SCROLL_SPEED_SET"}, {0x52, REG_RD, "PS_SCROLL_SPEED_GET"}, + {0x57, REG_WR, "ANT_IMP_SET"}, + {0x57, REG_RD, "ANT_IMP_GET"}, }; /* Region info */ @@ -1507,9 +1508,8 @@ int fmc_set_frequency(struct fmdrv_ops *fmdev, unsigned int freq_to_set) break; case FM_MODE_TX: - /* TODO: Enable when FM TX is supported */ - /* ret = fm_tx_set_frequency(fmdev, freq_to_set); */ - /* break; */ + ret = fm_tx_set_frequency(fmdev, freq_to_set); + break; default: ret = -EINVAL; @@ -1548,13 +1548,6 @@ exit: return ret; } -/* Returns current band index (0-Europe/US; 1-Japan) */ -int fmc_get_region(struct fmdrv_ops *fmdev, unsigned char *region) -{ - *region = fmdev->rx.region.region_index; - return 0; -} - int fmc_set_region(struct fmdrv_ops *fmdev, unsigned char region_to_set) { int ret; @@ -1565,9 +1558,8 @@ int fmc_set_region(struct fmdrv_ops *fmdev, unsigned char region_to_set) break; case FM_MODE_TX: - /* TODO: Enable when FM TX is supported */ - /* ret = fm_tx_set_region(fmdev, region_to_set); */ - /* break; */ + ret = fm_tx_set_region(fmdev, region_to_set); + break; default: ret = -EINVAL; @@ -1585,9 +1577,8 @@ int fmc_set_mute_mode(struct fmdrv_ops *fmdev, unsigned char mute_mode_toset) break; case FM_MODE_TX: - /* TODO: Enable when FM TX is supported */ - /* ret = fm_tx_set_mute_mode(fmdev, mute_mode_toset); */ - /* break; */ + ret = fm_tx_set_mute_mode(fmdev, mute_mode_toset); + break; default: ret = -EINVAL; @@ -1605,9 +1596,8 @@ int fmc_set_stereo_mono(struct fmdrv_ops *fmdev, unsigned short mode) break; case FM_MODE_TX: - /* TODO: Enable when FM TX is supported */ - /* ret = fm_tx_set_stereo_mono(fmdev, mode); */ - /* break; */ + ret = fm_tx_set_stereo_mono(fmdev, mode); + break; default: ret = -EINVAL; @@ -1625,9 +1615,8 @@ int fmc_set_rds_mode(struct fmdrv_ops *fmdev, unsigned char rds_en_dis) break; case FM_MODE_TX: - /* TODO: Enable when FM TX is supported */ - /* ret = fm_tx_set_rds_mode(fmdev, rds_en_dis); */ - /* break; */ + ret = fm_tx_set_rds_mode(fmdev, rds_en_dis); + break; default: ret = -EINVAL; @@ -2101,6 +2090,8 @@ static int __init fm_drv_init(void) fmdev->irq_info.fm_int_handlers = g_IntHandlerTable; fmdev->curr_fmmode = FM_MODE_OFF; + fmdev->tx_data.pwr_lvl = FM_PWR_LVL_DEF; + fmdev->tx_data.preemph = FM_TX_PREEMPH_50US; goto exit; rel_rdsbuf: diff --git a/drivers/staging/ti-st/fmdrv_common.h b/drivers/staging/ti-st/fmdrv_common.h index 7fb55f3..9f60c2c 100644 --- a/drivers/staging/ti-st/fmdrv_common.h +++ b/drivers/staging/ti-st/fmdrv_common.h @@ -173,6 +173,8 @@ enum fm_reg_index { MS_GET, PS_SCROLL_SPEED_SET, PS_SCROLL_SPEED_GET, + IMP_SET, + IMP_GET, FM_REG_MAX_ENTRIES }; @@ -300,8 +302,8 @@ struct bts_action_delay { #define FM_RX_VOLUME_GAIN_STEP 0x370 /* Mute modes */ -#define FM_MUTE_ON 0 -#define FM_MUTE_OFF 1 +#define FM_MUTE_OFF 0 +#define FM_MUTE_ON 1 #define FM_MUTE_ATTENUATE 2 #define FM_RX_MUTE_UNMUTE_MODE 0x00 @@ -432,6 +434,23 @@ struct bts_action_delay { #define FM_DEFAULT_RX_VOLUME 10 #define FM_DEFAULT_RSSI_THRESHOLD 3 +/* Range for TX power level in units for dB/uV */ +#define FM_PWR_LVL_LOW 91 +#define FM_PWR_LVL_HIGH 122 + +/* Chip specific default TX power level value */ +#define FM_PWR_LVL_DEF 4 + +/* FM TX Pre-emphasis filter values */ +#define FM_TX_PREEMPH_OFF 1 +#define FM_TX_PREEMPH_50US 0 +#define FM_TX_PREEMPH_75US 2 + +/* FM TX antenna impedence values */ +#define FM_TX_ANT_IMP_50 0 +#define FM_TX_ANT_IMP_200 1 +#define FM_TX_ANT_IMP_500 2 + /* Functions exported by FM common sub-module */ int fmc_prepare(struct fmdrv_ops *); int fmc_release(struct fmdrv_ops *);