1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */ 2f15cbe6fSPaul Mundt #ifndef __ASM_CPU_SH3_DAC_H 3f15cbe6fSPaul Mundt #define __ASM_CPU_SH3_DAC_H 4f15cbe6fSPaul Mundt 5f15cbe6fSPaul Mundt /* 6f15cbe6fSPaul Mundt * Copyright (C) 2003 Andriy Skulysh 7f15cbe6fSPaul Mundt */ 8f15cbe6fSPaul Mundt 9f15cbe6fSPaul Mundt 10f15cbe6fSPaul Mundt #define DADR0 0xa40000a0 11f15cbe6fSPaul Mundt #define DADR1 0xa40000a2 12f15cbe6fSPaul Mundt #define DACR 0xa40000a4 13f15cbe6fSPaul Mundt #define DACR_DAOE1 0x80 14f15cbe6fSPaul Mundt #define DACR_DAOE0 0x40 15f15cbe6fSPaul Mundt #define DACR_DAE 0x20 16f15cbe6fSPaul Mundt 17f15cbe6fSPaul Mundt sh_dac_enable(int channel)18f15cbe6fSPaul Mundtstatic __inline__ void sh_dac_enable(int channel) 19f15cbe6fSPaul Mundt { 20f15cbe6fSPaul Mundt unsigned char v; 219d56dd3bSPaul Mundt v = __raw_readb(DACR); 22f15cbe6fSPaul Mundt if(channel) v |= DACR_DAOE1; 23f15cbe6fSPaul Mundt else v |= DACR_DAOE0; 249d56dd3bSPaul Mundt __raw_writeb(v,DACR); 25f15cbe6fSPaul Mundt } 26f15cbe6fSPaul Mundt sh_dac_disable(int channel)27f15cbe6fSPaul Mundtstatic __inline__ void sh_dac_disable(int channel) 28f15cbe6fSPaul Mundt { 29f15cbe6fSPaul Mundt unsigned char v; 309d56dd3bSPaul Mundt v = __raw_readb(DACR); 31f15cbe6fSPaul Mundt if(channel) v &= ~DACR_DAOE1; 32f15cbe6fSPaul Mundt else v &= ~DACR_DAOE0; 339d56dd3bSPaul Mundt __raw_writeb(v,DACR); 34f15cbe6fSPaul Mundt } 35f15cbe6fSPaul Mundt sh_dac_output(u8 value,int channel)36f15cbe6fSPaul Mundtstatic __inline__ void sh_dac_output(u8 value, int channel) 37f15cbe6fSPaul Mundt { 389d56dd3bSPaul Mundt if(channel) __raw_writeb(value,DADR1); 399d56dd3bSPaul Mundt else __raw_writeb(value,DADR0); 40f15cbe6fSPaul Mundt } 41f15cbe6fSPaul Mundt 42f15cbe6fSPaul Mundt #endif /* __ASM_CPU_SH3_DAC_H */ 43