ipod: Small cleanup of piezo code on PP502x-based iPods

Basically use proper register names instead of magic values.

PP5002-based ipods (ie ipod1g-3g) use UART1 to drive the piezo vs
PWM of the newer models.

Change-Id: Ia333717a825ac6a0ebf43850fc31fca34178dd88
This commit is contained in:
Solomon Peachy 2025-10-01 20:45:07 -04:00
parent b09ce21023
commit 1ab63c3d92
3 changed files with 13 additions and 10 deletions

View file

@ -658,13 +658,13 @@ target/arm/ipod/power-ipod.c
# if LCD_DEPTH == 2
target/arm/ipod/lcd-as-gray.S
# endif
# ifndef IPOD_1G2G
# ifndef IPOD_3G
# if defined(CPU_PP502x)
target/arm/ipod/piezo.c
# endif /* IPOD_3G */
# endif /* CPU_PP502x */
# ifndef IPOD_1G2G
drivers/pcf50605.c
target/arm/ipod/powermgmt-ipod-pcf.c
# endif /* IPOD_1G2G */
# endif /* !IPOD_1G2G */
#endif /* CPU_PP && IPOD_ARCH */
#if CONFIG_I2C == I2C_PP5024 || CONFIG_I2C == I2C_PP5020 || CONFIG_I2C == I2C_PP5002

View file

@ -7,7 +7,7 @@
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2004 by Thom Johansen
* Copyright (C) 2004 by Thom Johansen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -96,7 +96,7 @@
#define CPU_HI_INT_EN (*(volatile unsigned long*)(0x60004124))
#define CPU_HI_INT_DIS (*(volatile unsigned long*)(0x60004128))
#define CPU_HI_INT_PRIORITY (*(volatile unsigned long*)(0x6000412c))
#define COP_HI_INT_EN_STAT (*(volatile unsigned long*)(0x60004130))
#define COP_HI_INT_EN (*(volatile unsigned long*)(0x60004134))
#define COP_HI_INT_DIS (*(volatile unsigned long*)(0x60004138))
@ -551,6 +551,9 @@
#define LCD2_BLOCK_READY 0x04000000
#define LCD2_BLOCK_TXOK 0x01000000
/* PWM */
#define PWM0_CTRL (*(volatile unsigned long*)(0x7000a000))
/* I2C */
#define I2C_BASE 0x7000c000

View file

@ -43,22 +43,22 @@ static inline void piezo_hw_init(void)
{
#ifndef SIMULATOR
/*logf("PIEZO: hw_init");*/
outl(inl(0x70000010) & ~0xc, 0x70000010);
outl(inl(0x6000600c) | 0x20000, 0x6000600c); /* enable device */
DEV_INIT1 &= ~0xc;
DEV_EN |= DEV_PWM;
#endif
}
static void piezo_hw_tick(unsigned int form_and_period)
{
#ifndef SIMULATOR
outl(0x80000000 | form_and_period, 0x7000a000); /* set pitch */
PWM0_CTRL = 0x80000000 | form_and_period;
#endif
}
static inline void piezo_hw_stop(void)
{
#ifndef SIMULATOR
outl(0x0, 0x7000a000); /* piezo off */
PWM0_CTRL = 0;
#endif
}