Source
x
/* -----------------------------------------------------------------------------
// SPDX-License-Identifier: GPL-2.0
/*
* R-Mobile TPU PWM driver
*
* Copyright (C) 2012 Renesas Solutions Corp.
*/
/* Timer start register (shared) */
/* Timer control register */
/* Timer mode register */
/* Timer I/O control register */
/* Timer interrupt enable register */
/* Timer status register */
/* Timer counter */
/* Timer general register A */
/* Timer general register B */
/* Timer general register C */
/* Timer general register D */
enum tpu_pin_state {
TPU_PIN_INACTIVE, /* Pin is driven inactive */
TPU_PIN_PWM, /* Pin is driven by PWM */
TPU_PIN_ACTIVE, /* Pin is driven active */
};
struct tpu_device;
struct tpu_pwm_device {
bool timer_on; /* Whether the timer is running */
struct tpu_device *tpu;
unsigned int channel; /* Channel number in the TPU */
enum pwm_polarity polarity;
unsigned int prescaler;
u16 period;
u16 duty;
};
struct tpu_device {
struct platform_device *pdev;
struct pwm_chip chip;
spinlock_t lock;
void __iomem *base;
struct clk *clk;
};
static void tpu_pwm_write(struct tpu_pwm_device *pwm, int reg_nr, u16 value)