/*
* 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.
*/
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/kernel.h>
#include <linux/math64.h>
#include <linux/max2175.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include "max2175.h"
#define DRIVER_NAME "max2175"
#define mxm_dbg(ctx, fmt, arg...) dev_dbg(&ctx->client->dev, fmt, ## arg)
#define mxm_err(ctx, fmt, arg...) dev_err(&ctx->client->dev, fmt, ## arg)
/* Rx mode */
struct max2175_rxmode {
enum max2175_band band; /* Associated band */
u32 freq; /* Default freq in Hz */
u8 i2s_word_size; /* Bit value */
};
/* Register map to define preset values */
struct max2175_reg_map {
u8 idx; /* Register index */
u8 val; /* Register value */
};
static const struct max2175_rxmode eu_rx_modes[] = {
/* EU modes */
[MAX2175_EU_FM_1_2] = { MAX2175_BAND_FM, 98256000, 1 },
[MAX2175_DAB_1_2] = { MAX2175_BAND_VHF, 182640000, 0 },
};
static const struct max2175_rxmode na_rx_modes[] = {
/* NA modes */
[MAX2175_NA_FM_1_0] = { MAX2175_BAND_FM, 98255520, 1 },
[MAX2175_NA_FM_2_0] = { MAX2175_BAND_FM, 98255520, 6 },
};
/*
* Preset values: