summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig45
-rw-r--r--drivers/misc/Makefile2
-rw-r--r--drivers/misc/ds4510.c379
-rw-r--r--drivers/misc/ds4510.h52
-rw-r--r--drivers/misc/pca9551_led.c170
5 files changed, 1 insertions, 647 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index cbc45ed7b97..0f753b9dbb9 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -290,40 +290,10 @@ config CROS_EC_SPI
provides a faster and more robust interface than I2C but the bugs
are less interesting.
-config DS4510
- bool "Enable support for DS4510 CPU supervisor"
- help
- Enable support for the Maxim DS4510 CPU supervisor. It has an
- integrated 64-byte EEPROM, four programmable non-volatile I/O pins
- and a configurable timer for the supervisor function. The device is
- connected over I2C.
-
config FSL_IIM
bool "Enable FSL IC Identification Module (IIM) driver"
depends on ARCH_MX5
-config FSL_SEC_MON
- bool "Enable FSL SEC_MON Driver"
- help
- Freescale Security Monitor block is responsible for monitoring
- system states.
- Security Monitor can be transitioned on any security failures,
- like software violations or hardware security violations.
-
-choice
- prompt "Security monitor interaction endianess"
- depends on FSL_SEC_MON
- default SYS_FSL_SEC_MON_BE if PPC
- default SYS_FSL_SEC_MON_LE
-
-config SYS_FSL_SEC_MON_LE
- bool "Security monitor interactions are little endian"
-
-config SYS_FSL_SEC_MON_BE
- bool "Security monitor interactions are big endian"
-
-endchoice
-
config IRQ
bool "Interrupt controller"
help
@@ -458,19 +428,6 @@ config SPL_PWRSEQ
device. When the device is started up, its power sequence can be
initiated.
-config PCA9551_LED
- bool "Enable PCA9551 LED driver"
- help
- Enable driver for PCA9551 LED controller. This controller
- is connected via I2C. So I2C needs to be enabled.
-
-config PCA9551_I2C_ADDR
- hex "I2C address of PCA9551 LED controller"
- depends on PCA9551_LED
- default 0x60
- help
- The I2C address of the PCA9551 LED controller.
-
config STM32MP_FUSE
bool "Enable STM32MP fuse wrapper providing the fuse API"
depends on ARCH_STM32MP && MISC
@@ -672,7 +629,7 @@ config GDSYS_SOC
config IHS_FPGA
bool "Enable IHS FPGA driver"
- depends on MISC
+ depends on MISC && (GDSYS_LEGACY_DRIVERS || SYS_FPGA_FLAVOR_GAZERBEAM)
help
Support IHS (Integrated Hardware Systems) FPGA, the main FPGAs on
gdsys devices, which supply the majority of the functionality offered
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 279dbcbdd30..f7422c8e95a 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -32,7 +32,6 @@ endif
obj-$(CONFIG_ALTERA_SYSID) += altera_sysid.o
obj-$(CONFIG_ATSHA204A) += atsha204a-i2c.o
obj-$(CONFIG_CBMEM_CONSOLE) += cbmem_console.o
-obj-$(CONFIG_DS4510) += ds4510.o
obj-$(CONFIG_FSL_DEVICE_DISABLE) += fsl_devdis.o
obj-$(CONFIG_FSL_IFC) += fsl_ifc.o
obj-$(CONFIG_FSL_IIM) += fsl_iim.o
@@ -59,7 +58,6 @@ obj-$(CONFIG_NPCM_OTP) += npcm_otp.o
obj-$(CONFIG_NPCM_HOST) += npcm_host_intf.o
obj-$(CONFIG_NUVOTON_NCT6102D) += nuvoton_nct6102d.o
obj-$(CONFIG_P2SB) += p2sb-uclass.o
-obj-$(CONFIG_PCA9551_LED) += pca9551_led.o
obj-$(CONFIG_$(PHASE_)PWRSEQ) += pwrseq-uclass.o
ifdef CONFIG_QFW
obj-y += qfw.o
diff --git a/drivers/misc/ds4510.c b/drivers/misc/ds4510.c
deleted file mode 100644
index 302015e2793..00000000000
--- a/drivers/misc/ds4510.c
+++ /dev/null
@@ -1,379 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright 2008 Extreme Engineering Solutions, Inc.
- */
-
-/*
- * Driver for DS4510, a CPU supervisor with integrated EEPROM, SRAM,
- * and 4 programmable non-volatile GPIO pins.
- */
-
-#include <i2c.h>
-#include <command.h>
-#include <linux/delay.h>
-#include "ds4510.h"
-
-enum {
- DS4510_CMD_INFO,
- DS4510_CMD_DEVICE,
- DS4510_CMD_NV,
- DS4510_CMD_RSTDELAY,
- DS4510_CMD_OUTPUT,
- DS4510_CMD_INPUT,
- DS4510_CMD_PULLUP,
- DS4510_CMD_EEPROM,
- DS4510_CMD_SEEPROM,
- DS4510_CMD_SRAM,
-};
-
-/*
- * Write to DS4510, taking page boundaries into account
- */
-static int ds4510_mem_write(uint8_t chip, int offset, uint8_t *buf, int count)
-{
- int wrlen;
- int i = 0;
-
- do {
- wrlen = DS4510_EEPROM_PAGE_SIZE -
- DS4510_EEPROM_PAGE_OFFSET(offset);
- if (count < wrlen)
- wrlen = count;
- if (i2c_write(chip, offset, 1, &buf[i], wrlen))
- return -1;
-
- /*
- * This delay isn't needed for SRAM writes but shouldn't delay
- * things too much, so do it unconditionally for simplicity
- */
- udelay(DS4510_EEPROM_PAGE_WRITE_DELAY_MS * 1000);
- count -= wrlen;
- offset += wrlen;
- i += wrlen;
- } while (count > 0);
-
- return 0;
-}
-
-/*
- * General read from DS4510
- */
-static int ds4510_mem_read(uint8_t chip, int offset, uint8_t *buf, int count)
-{
- return i2c_read(chip, offset, 1, buf, count);
-}
-
-/*
- * Write SEE bit in config register.
- * nv = 0 - Writes to SEEPROM registers behave like EEPROM
- * nv = 1 - Writes to SEEPROM registers behave like SRAM
- */
-static int ds4510_see_write(uint8_t chip, uint8_t nv)
-{
- uint8_t data;
-
- if (i2c_read(chip, DS4510_CFG, 1, &data, 1))
- return -1;
-
- if (nv) /* Treat SEEPROM bits as EEPROM */
- data &= ~DS4510_CFG_SEE;
- else /* Treat SEEPROM bits as SRAM */
- data |= DS4510_CFG_SEE;
-
- return ds4510_mem_write(chip, DS4510_CFG, &data, 1);
-}
-
-/*
- * Write de-assertion of reset signal delay
- */
-static int ds4510_rstdelay_write(uint8_t chip, uint8_t delay)
-{
- uint8_t data;
-
- if (i2c_read(chip, DS4510_RSTDELAY, 1, &data, 1))
- return -1;
-
- data &= ~DS4510_RSTDELAY_MASK;
- data |= delay & DS4510_RSTDELAY_MASK;
-
- return ds4510_mem_write(chip, DS4510_RSTDELAY, &data, 1);
-}
-
-/*
- * Write pullup characteristics of IO pins
- */
-static int ds4510_pullup_write(uint8_t chip, uint8_t val)
-{
- val &= DS4510_IO_MASK;
-
- return ds4510_mem_write(chip, DS4510_PULLUP, (uint8_t *)&val, 1);
-}
-
-/*
- * Read pullup characteristics of IO pins
- */
-static int ds4510_pullup_read(uint8_t chip)
-{
- uint8_t val;
-
- if (i2c_read(chip, DS4510_PULLUP, 1, &val, 1))
- return -1;
-
- return val & DS4510_IO_MASK;
-}
-
-/*
- * Write drive level of IO pins
- */
-static int ds4510_gpio_write(uint8_t chip, uint8_t val)
-{
- uint8_t data;
- int i;
-
- for (i = 0; i < DS4510_NUM_IO; i++) {
- if (i2c_read(chip, DS4510_IO0 - i, 1, &data, 1))
- return -1;
-
- if (val & (0x1 << i))
- data |= 0x1;
- else
- data &= ~0x1;
-
- if (ds4510_mem_write(chip, DS4510_IO0 - i, &data, 1))
- return -1;
- }
-
- return 0;
-}
-
-/*
- * Read drive level of IO pins
- */
-static int ds4510_gpio_read(uint8_t chip)
-{
- uint8_t data;
- int val = 0;
- int i;
-
- for (i = 0; i < DS4510_NUM_IO; i++) {
- if (i2c_read(chip, DS4510_IO0 - i, 1, &data, 1))
- return -1;
-
- if (data & 1)
- val |= (1 << i);
- }
-
- return val;
-}
-
-/*
- * Read physical level of IO pins
- */
-static int ds4510_gpio_read_val(uint8_t chip)
-{
- uint8_t val;
-
- if (i2c_read(chip, DS4510_IO_STATUS, 1, &val, 1))
- return -1;
-
- return val & DS4510_IO_MASK;
-}
-
-/*
- * Display DS4510 information
- */
-static int ds4510_info(uint8_t chip)
-{
- int i;
- int tmp;
- uint8_t data;
-
- printf("DS4510 @ 0x%x:\n\n", chip);
-
- if (i2c_read(chip, DS4510_RSTDELAY, 1, &data, 1))
- return -1;
- printf("rstdelay = 0x%x\n\n", data & DS4510_RSTDELAY_MASK);
-
- if (i2c_read(chip, DS4510_CFG, 1, &data, 1))
- return -1;
- printf("config = 0x%x\n", data);
- printf(" /ready = %d\n", data & DS4510_CFG_READY ? 1 : 0);
- printf(" trip pt = %d\n", data & DS4510_CFG_TRIP_POINT ? 1 : 0);
- printf(" rst sts = %d\n", data & DS4510_CFG_RESET ? 1 : 0);
- printf(" /see = %d\n", data & DS4510_CFG_SEE ? 1 : 0);
- printf(" swrst = %d\n\n", data & DS4510_CFG_SWRST ? 1 : 0);
-
- printf("gpio pins: 3210\n");
- printf("---------------\n");
- printf("pullup ");
-
- tmp = ds4510_pullup_read(chip);
- if (tmp == -1)
- return tmp;
- for (i = DS4510_NUM_IO - 1; i >= 0; i--)
- printf("%d", (tmp & (1 << i)) ? 1 : 0);
- printf("\n");
-
- printf("driven ");
- tmp = ds4510_gpio_read(chip);
- if (tmp == -1)
- return -1;
- for (i = DS4510_NUM_IO - 1; i >= 0; i--)
- printf("%d", (tmp & (1 << i)) ? 1 : 0);
- printf("\n");
-
- printf("read ");
- tmp = ds4510_gpio_read_val(chip);
- if (tmp == -1)
- return -1;
- for (i = DS4510_NUM_IO - 1; i >= 0; i--)
- printf("%d", (tmp & (1 << i)) ? 1 : 0);
- printf("\n");
-
- return 0;
-}
-
-struct cmd_tbl cmd_ds4510[] = {
- U_BOOT_CMD_MKENT(device, 3, 0, (void *)DS4510_CMD_DEVICE, "", ""),
- U_BOOT_CMD_MKENT(nv, 3, 0, (void *)DS4510_CMD_NV, "", ""),
- U_BOOT_CMD_MKENT(output, 4, 0, (void *)DS4510_CMD_OUTPUT, "", ""),
- U_BOOT_CMD_MKENT(input, 3, 0, (void *)DS4510_CMD_INPUT, "", ""),
- U_BOOT_CMD_MKENT(pullup, 4, 0, (void *)DS4510_CMD_PULLUP, "", ""),
- U_BOOT_CMD_MKENT(info, 2, 0, (void *)DS4510_CMD_INFO, "", ""),
- U_BOOT_CMD_MKENT(rstdelay, 3, 0, (void *)DS4510_CMD_RSTDELAY, "", ""),
- U_BOOT_CMD_MKENT(eeprom, 6, 0, (void *)DS4510_CMD_EEPROM, "", ""),
- U_BOOT_CMD_MKENT(seeprom, 6, 0, (void *)DS4510_CMD_SEEPROM, "", ""),
- U_BOOT_CMD_MKENT(sram, 6, 0, (void *)DS4510_CMD_SRAM, "", ""),
-};
-
-int do_ds4510(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
-{
- static uint8_t chip = 0x51;
- struct cmd_tbl *c;
- ulong ul_arg2 = 0;
- ulong ul_arg3 = 0;
- int tmp;
- ulong addr;
- ulong off;
- ulong cnt;
- int end;
- int (*rw_func)(uint8_t, int, uint8_t *, int);
-
- c = find_cmd_tbl(argv[1], cmd_ds4510, ARRAY_SIZE(cmd_ds4510));
-
- /* All commands but "device" require 'maxargs' arguments */
- if (!c || !((argc == (c->maxargs)) ||
- (((int)c->cmd == DS4510_CMD_DEVICE) &&
- (argc == (c->maxargs - 1))))) {
- return cmd_usage(cmdtp);
- }
-
- /* arg2 used as chip addr and pin number */
- if (argc > 2)
- ul_arg2 = hextoul(argv[2], NULL);
-
- /* arg3 used as output/pullup value */
- if (argc > 3)
- ul_arg3 = hextoul(argv[3], NULL);
-
- switch ((int)c->cmd) {
- case DS4510_CMD_DEVICE:
- if (argc == 3)
- chip = ul_arg2;
- printf("Current device address: 0x%x\n", chip);
- return 0;
- case DS4510_CMD_NV:
- return ds4510_see_write(chip, ul_arg2);
- case DS4510_CMD_OUTPUT:
- tmp = ds4510_gpio_read(chip);
- if (tmp == -1)
- return -1;
- if (ul_arg3)
- tmp |= (1 << ul_arg2);
- else
- tmp &= ~(1 << ul_arg2);
- return ds4510_gpio_write(chip, tmp);
- case DS4510_CMD_INPUT:
- tmp = ds4510_gpio_read_val(chip);
- if (tmp == -1)
- return -1;
- return (tmp & (1 << ul_arg2)) != 0;
- case DS4510_CMD_PULLUP:
- tmp = ds4510_pullup_read(chip);
- if (tmp == -1)
- return -1;
- if (ul_arg3)
- tmp |= (1 << ul_arg2);
- else
- tmp &= ~(1 << ul_arg2);
- return ds4510_pullup_write(chip, tmp);
- case DS4510_CMD_INFO:
- return ds4510_info(chip);
- case DS4510_CMD_RSTDELAY:
- return ds4510_rstdelay_write(chip, ul_arg2);
- case DS4510_CMD_EEPROM:
- end = DS4510_EEPROM + DS4510_EEPROM_SIZE;
- off = DS4510_EEPROM;
- break;
- case DS4510_CMD_SEEPROM:
- end = DS4510_SEEPROM + DS4510_SEEPROM_SIZE;
- off = DS4510_SEEPROM;
- break;
- case DS4510_CMD_SRAM:
- end = DS4510_SRAM + DS4510_SRAM_SIZE;
- off = DS4510_SRAM;
- break;
- default:
- /* We should never get here... */
- return 1;
- }
-
- /* Only eeprom, seeprom, and sram commands should make it here */
- if (strcmp(argv[2], "read") == 0)
- rw_func = ds4510_mem_read;
- else if (strcmp(argv[2], "write") == 0)
- rw_func = ds4510_mem_write;
- else
- return cmd_usage(cmdtp);
-
- addr = hextoul(argv[3], NULL);
- off += hextoul(argv[4], NULL);
- cnt = hextoul(argv[5], NULL);
-
- if ((off + cnt) > end) {
- printf("ERROR: invalid len\n");
- return -1;
- }
-
- return rw_func(chip, off, (uint8_t *)addr, cnt);
-}
-
-U_BOOT_CMD(
- ds4510, 6, 1, do_ds4510,
- "ds4510 eeprom/seeprom/sram/gpio access",
- "device [dev]\n"
- " - show or set current device address\n"
- "ds4510 info\n"
- " - display ds4510 info\n"
- "ds4510 output pin 0|1\n"
- " - set pin low or high-Z\n"
- "ds4510 input pin\n"
- " - read value of pin\n"
- "ds4510 pullup pin 0|1\n"
- " - disable/enable pullup on specified pin\n"
- "ds4510 nv 0|1\n"
- " - make gpio and seeprom writes volatile/non-volatile"
- "\n"
- "ds4510 rstdelay 0-3\n"
- " - set reset output delay"
- "\n"
- "ds4510 eeprom read addr off cnt\n"
- "ds4510 eeprom write addr off cnt\n"
- " - read/write 'cnt' bytes at EEPROM offset 'off'\n"
- "ds4510 seeprom read addr off cnt\n"
- "ds4510 seeprom write addr off cnt\n"
- " - read/write 'cnt' bytes at SRAM-shadowed EEPROM offset 'off'\n"
- "ds4510 sram read addr off cnt\n"
- "ds4510 sram write addr off cnt\n"
- " - read/write 'cnt' bytes at SRAM offset 'off'"
-);
diff --git a/drivers/misc/ds4510.h b/drivers/misc/ds4510.h
deleted file mode 100644
index 5c7a1a8c737..00000000000
--- a/drivers/misc/ds4510.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Copyright 2008 Extreme Engineering Solutions, Inc.
- */
-
-#ifndef __DS4510_H_
-#define __DS4510_H_
-
-/* General defines */
-#define DS4510_NUM_IO 0x04
-#define DS4510_IO_MASK ((1 << DS4510_NUM_IO) - 1)
-#define DS4510_EEPROM_PAGE_WRITE_DELAY_MS 20
-
-/* EEPROM from 0x00 - 0x39 */
-#define DS4510_EEPROM 0x00
-#define DS4510_EEPROM_SIZE 0x40
-#define DS4510_EEPROM_PAGE_SIZE 0x08
-#define DS4510_EEPROM_PAGE_OFFSET(x) ((x) & (DS4510_EEPROM_PAGE_SIZE - 1))
-
-/* SEEPROM from 0xf0 - 0xf7 */
-#define DS4510_SEEPROM 0xf0
-#define DS4510_SEEPROM_SIZE 0x08
-
-/* Registers overlapping SEEPROM from 0xf0 - 0xf7 */
-#define DS4510_PULLUP 0xF0
-#define DS4510_PULLUP_DIS 0x00
-#define DS4510_PULLUP_EN 0x01
-#define DS4510_RSTDELAY 0xF1
-#define DS4510_RSTDELAY_MASK 0x03
-#define DS4510_RSTDELAY_125 0x00
-#define DS4510_RSTDELAY_250 0x01
-#define DS4510_RSTDELAY_500 0x02
-#define DS4510_RSTDELAY_1000 0x03
-#define DS4510_IO3 0xF4
-#define DS4510_IO2 0xF5
-#define DS4510_IO1 0xF6
-#define DS4510_IO0 0xF7
-
-/* Status configuration registers from 0xf8 - 0xf9*/
-#define DS4510_IO_STATUS 0xF8
-#define DS4510_CFG 0xF9
-#define DS4510_CFG_READY 0x80
-#define DS4510_CFG_TRIP_POINT 0x40
-#define DS4510_CFG_RESET 0x20
-#define DS4510_CFG_SEE 0x10
-#define DS4510_CFG_SWRST 0x08
-
-/* SRAM from 0xfa - 0xff */
-#define DS4510_SRAM 0xfa
-#define DS4510_SRAM_SIZE 0x06
-
-#endif /* __DS4510_H_ */
diff --git a/drivers/misc/pca9551_led.c b/drivers/misc/pca9551_led.c
deleted file mode 100644
index 040d0d5cf48..00000000000
--- a/drivers/misc/pca9551_led.c
+++ /dev/null
@@ -1,170 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright (C) 2015 Stefan Roese <sr@denx.de>
- */
-
-#include <errno.h>
-#include <i2c.h>
-#include <status_led.h>
-
-#ifndef CONFIG_PCA9551_I2C_ADDR
-#error "CONFIG_PCA9551_I2C_ADDR not defined!"
-#endif
-
-#define PCA9551_REG_INPUT 0x00 /* Input register (read only) */
-#define PCA9551_REG_PSC0 0x01 /* Frequency prescaler 0 */
-#define PCA9551_REG_PWM0 0x02 /* PWM0 */
-#define PCA9551_REG_PSC1 0x03 /* Frequency prescaler 1 */
-#define PCA9551_REG_PWM1 0x04 /* PWM1 */
-#define PCA9551_REG_LS0 0x05 /* LED0 to LED3 selector */
-#define PCA9551_REG_LS1 0x06 /* LED4 to LED7 selector */
-
-#define PCA9551_CTRL_AI (1 << 4) /* Auto-increment flag */
-
-#define PCA9551_LED_STATE_ON 0x00
-#define PCA9551_LED_STATE_OFF 0x01
-#define PCA9551_LED_STATE_BLINK0 0x02
-#define PCA9551_LED_STATE_BLINK1 0x03
-
-struct pca9551_blink_rate {
- u8 psc; /* Frequency preescaler, see PCA9551_7.pdf p. 6 */
- u8 pwm; /* Pulse width modulation, see PCA9551_7.pdf p. 6 */
-};
-
-static int freq_last = -1;
-static int mask_last = -1;
-static int idx_last = -1;
-static int mode_last;
-
-static int pca9551_led_get_state(int led, int *state)
-{
- unsigned int reg;
- u8 shift, buf;
- int ret;
-
- if (led < 0 || led > 7) {
- return -EINVAL;
- } else if (led < 4) {
- reg = PCA9551_REG_LS0;
- shift = led << 1;
- } else {
- reg = PCA9551_REG_LS1;
- shift = (led - 4) << 1;
- }
-
- ret = i2c_read(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- *state = (buf >> shift) & 0x03;
- return 0;
-}
-
-static int pca9551_led_set_state(int led, int state)
-{
- unsigned int reg;
- u8 shift, buf, mask;
- int ret;
-
- if (led < 0 || led > 7) {
- return -EINVAL;
- } else if (led < 4) {
- reg = PCA9551_REG_LS0;
- shift = led << 1;
- } else {
- reg = PCA9551_REG_LS1;
- shift = (led - 4) << 1;
- }
- mask = 0x03 << shift;
-
- ret = i2c_read(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- buf = (buf & ~mask) | ((state & 0x03) << shift);
-
- ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, &buf, 1);
- if (ret)
- return ret;
-
- return 0;
-}
-
-static int pca9551_led_set_blink_rate(int idx, struct pca9551_blink_rate rate)
-{
- unsigned int reg;
- int ret;
-
- switch (idx) {
- case 0:
- reg = PCA9551_REG_PSC0;
- break;
- case 1:
- reg = PCA9551_REG_PSC1;
- break;
- default:
- return -EINVAL;
- }
- reg |= PCA9551_CTRL_AI;
-
- ret = i2c_write(CONFIG_PCA9551_I2C_ADDR, reg, 1, (u8 *)&rate, 2);
- if (ret)
- return ret;
-
- return 0;
-}
-
-/*
- * Functions referenced by cmd_led.c or status_led.c
- */
-void __led_init(led_id_t id, int state)
-{
-}
-
-void __led_set(led_id_t mask, int state)
-{
- if (state == CONFIG_LED_STATUS_OFF)
- pca9551_led_set_state(mask, PCA9551_LED_STATE_OFF);
- else
- pca9551_led_set_state(mask, PCA9551_LED_STATE_ON);
-}
-
-void __led_toggle(led_id_t mask)
-{
- int state = 0;
-
- pca9551_led_get_state(mask, &state);
- pca9551_led_set_state(mask, !state);
-}
-
-void __led_blink(led_id_t mask, int freq)
-{
- struct pca9551_blink_rate rate;
- int mode;
- int idx;
-
- if ((freq == freq_last) || (mask == mask_last)) {
- idx = idx_last;
- mode = mode_last;
- } else {
- /* Toggle blink index */
- if (idx_last == 0) {
- idx = 1;
- mode = PCA9551_LED_STATE_BLINK1;
- } else {
- idx = 0;
- mode = PCA9551_LED_STATE_BLINK0;
- }
-
- idx_last = idx;
- mode_last = mode;
- }
- freq_last = freq;
- mask_last = mask;
-
- rate.psc = ((freq * 38) / 1000) - 1;
- rate.pwm = 128; /* 50% duty cycle */
-
- pca9551_led_set_blink_rate(idx, rate);
- pca9551_led_set_state(mask, mode);
-}