tdc: added helper functions to the core

Signed-off-by: Samuel Iglesias Gonsálvez's avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
parent ec765a55
......@@ -39,6 +39,66 @@ static void tdc_fw_reset(struct spec_dev *dev)
mdelay(5000);
}
/* XXX: Check that the value is properly written? */
static int tdc_set_utc_time(struct spec_tdc *tdc)
{
u32 utc_time; /* TODO: fill the variable with a proper value */
writel(utc_time, tdc->base + TDC_START_UTC);
writel(TDC_CTRL_LOAD_UTC, tdc->base + TDC_CTRL_REG);
return 0;
}
static u32 tdc_get_utc_time(struct spec_tdc *tdc)
{
return readl(tdc->base + TDC_CURRENT_UTC);
}
/* XXX: void-function or I should check that the value is properly written? */
void tdc_set_irq_tstamp_thresh(struct spec_tdc *tdc, u32 val)
{
writel(val, tdc->base + TDC_IRQ_TSTAMP_THRESH);
}
u32 tdc_get_irq_tstamp_thresh(struct spec_tdc *tdc)
{
return readl(tdc->base + TDC_IRQ_TSTAMP_THRESH);
}
/* XXX: void-function or I should check that the value is properly written? */
void tdc_set_irq_time_thresh(struct spec_tdc *tdc, u32 val)
{
writel(val, tdc->base + TDC_IRQ_TIME_THRESH);
}
u32 tdc_get_irq_time_thresh(struct spec_tdc *tdc)
{
return readl(tdc->base + TDC_IRQ_TIME_THRESH);
}
/* XXX: void-function or I should check that the value is properly written? */
void tdc_set_dac_word(struct spec_tdc *tdc, u32 val)
{
writel(val, tdc->base + TDC_DAC_WORD);
writel(TDC_CTRL_CONFIG_DAC, tdc->base + TDC_CTRL_REG);
}
void tdc_clear_da_capo_flag(struct spec_tdc *tdc)
{
writel(TDC_CTRL_CLEAR_DACAPO_FLAG, tdc->base + TDC_CTRL_REG);
}
void tdc_activate_adquisition(struct spec_tdc *tdc)
{
/* Before activate the adquisition is required to reset the ACAM chip */
tdc_acam_reset(tdc);
writel(TDC_CTRL_EN_ACQ, tdc->base + TDC_CTRL_REG);
}
void tdc_deactivate_adquisition(struct spec_tdc *tdc)
{
writel(TDC_CTRL_DIS_ACQ, tdc->base + TDC_CTRL_REG);
}
int tdc_probe(struct spec_dev *dev)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment